服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-08-06 c598e4bf57de2b4703d6c0e4d0905c9159273d26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tiger.IBusiness;
using static Tiger.Business.Biz;
 
namespace Tiger.Business.MES
{
    /// <summary>
    /// 工单 上下文
    /// </summary>
    public class WoContext
    {
        #region 工单管理
        /// <summary>
        /// 工单批次字典
        /// </summary>
        public static Dictionary<string, WorkBatch> WoBatchDic { get; set; } = new Dictionary<string, WorkBatch>();
 
        /// <summary>
        /// 从工单批次字典中获取一个工单批次对象
        /// </summary>
        /// <param name="workOrder"></param>
        /// <param name="lineCode"></param>
        /// <returns></returns>
        public static WorkBatch GetBatch(string workOrder, string lineCode)
        {
            return WoBatchDic.FirstOrDefault(q => q.Value.Batch.ORDER_NO == workOrder && q.Value.Batch.ACT_LINE == lineCode).Value;
        }
 
        /// <summary>
        /// 判断工单批次是否存在于工单批次字典中
        /// </summary>
        /// <param name="workOrder"></param>
        /// <param name="lineCode"></param>
        /// <returns></returns>
        public static bool ExistsBatch(string workOrder, string lineCode)
        {
            return WoBatchDic.Any(q => q.Value.Batch.ORDER_NO == workOrder && q.Value.Batch.ACT_LINE == lineCode);
        }
        #endregion
    }
}