服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-08-02 d34d9c35ba844da8b805993bd4c69b0253694fc0
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
using Tiger.Model;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using Rhea.Common;
using System.Net;
using System.Linq;
using Newtonsoft.Json;
using Tiger.IBusiness;
using Tiger.Business.MES;
using Tiger.Model.Entitys.MES.Position;
 
namespace Tiger.Business
{
    public partial class Biz
    {
        /// <summary>
        /// 工步
        /// </summary>
        public partial class WorkStep : IWorkStep
        {
            public WorkStep(IWorkStep.Types type, IPosition position)
            {
                Type = type;
                CurPosition = position;
            }
 
            #region Propertys & Variables
            public string ID { get; set; } = Guid.NewGuid().ToString("N");
            
            public IWorkStep.Types Type { get; set; }
            public MES_WO_NODE Node { get; set; }
            public MES_WO_NODE_ACT NodeAct { get; set; }
            public MES_WO_ACTION Setting { get; set; }
            public IPosition CurPosition { get; set; }
            public IWorkAction CurAction { get; set; }
            public int Sequence { get; set; }
            public List<string> PrepNodeIDs { get; set; } = new();
            public string NodeID => Type == IWorkStep.Types.Action ? NodeAct.ID : Node.ID;
            private bool _IsFinished = false;
            public bool IsFinished
            {
                get => Type == IWorkStep.Types.Action ? CurAction.IsFinished : _IsFinished; 
                set { _IsFinished = value; }
            }
            public Action DBSubmitAction { get; set; } = () => { };
            #endregion
 
            #region Functions
            /// <summary>
            /// 初始化工步
            /// </summary>
            /// <returns></returns>
            public void Init()
            {
                CurAction = DI.Resolve(NodeAct.Definition.SERVICE_TYPE) as IWorkAction;
                //CurAction = DI.Resolve("Tiger.IBusiness.IPrintLabel,Tiger.IBusiness") as IWorkAction;
                CurAction.Init(this, CurPosition, NodeAct, Setting);
            }
 
            /// <summary>
            /// 尝试开始执行工步
            /// </summary>
            /// <returns></returns>
            public ApiAction<SubmitOutput> TryBegin(SubmitInput input)
            {
                return CurAction.TryBegin(input);
            }
 
            /// <summary>
            /// 获取行为开始的提示信息
            /// </summary>
            /// <returns></returns>
            public Locale GetBeginMsg()
            {
                return CurAction.GetBeginMsg();
            }
 
            /// <summary>
            /// 工步提交数据
            /// </summary>
            /// <param name="input"></param>
            /// <returns></returns>
            public ApiAction<SubmitOutput> Submit(SubmitInput input)
            {
                return CurAction.Submit(input);
            }
            #endregion
 
        }
    }
}