From ba0b68c347de4c9214d128d0b51d3af75688d6b3 Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期三, 11 九月 2024 01:22:09 +0800
Subject: [PATCH] Merge branch 'master' of http://47.115.28.255:8110/r/TigerClouds-Tech/Server/TigerApi6_2024

---
 Tiger.Business/MES/Biz.WorkStep.cs |   74 +++++++++++++++++++++++++++++++------
 1 files changed, 62 insertions(+), 12 deletions(-)

diff --git a/Tiger.Business/MES/Biz.WorkStep.cs b/Tiger.Business/MES/Biz.WorkStep.cs
index 5b906c1..b64748e 100644
--- a/Tiger.Business/MES/Biz.WorkStep.cs
+++ b/Tiger.Business/MES/Biz.WorkStep.cs
@@ -22,31 +22,41 @@
         /// </summary>
         public partial class WorkStep : IWorkStep
         {
-            public WorkStep(IWorkStep.Types type, IPosition position)
+            public WorkStep(IWorkStep.NodeTypes type, IPosition position)
             {
-                Type = type;
+                NodeType = type;
                 CurPosition = position;
             }
 
             #region Propertys & Variables
             public string ID { get; set; } = Guid.NewGuid().ToString("N");
-            
-            public IWorkStep.Types Type { get; set; }
+            public string Name { get; set; }
+            public IWorkStep.NodeTypes NodeType { get; set; }
             public MES_WO_NODE Node { get; set; }
+            public MES_WO_OPER OperSetting { get; set; }
             public MES_WO_NODE_ACT NodeAct { get; set; }
-            public MES_WO_ACTION Setting { get; set; }
+            public MES_WO_ACTION ActSetting { 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;
-            public string NodeName => Type == IWorkStep.Types.Action ? NodeAct.ACT_NAME : Node.NODE_NAME;
-            private bool _IsFinished = false;
-            public bool IsFinished
+            public string NodeID => NodeType == IWorkStep.NodeTypes.Action ? NodeAct.ID : Node.ID;
+            //private bool _IsFinished = false;
+            //public bool IsFinished
+            //{
+            //    get => NodeType == IWorkStep.NodeTypes.Action ? CurAction.IsFinished : _IsFinished; 
+            //    set { _IsFinished = value; }
+            //}
+            public StepStatus Status { get; set; } = StepStatus.Normal;
+            public bool IsFinished => Status == StepStatus.Finished;
+            private Locale _Message;
+            public Locale Message
             {
-                get => Type == IWorkStep.Types.Action ? CurAction.IsFinished : _IsFinished; 
-                set { _IsFinished = value; }
+                get => _Message;
+                set { _MsgHistory.Add(_Message = value); }
             }
+            private List<Locale> _MsgHistory = new();
+            public List<Locale> MsgHistory => _MsgHistory;
             public Action DBSubmitAction { get; set; } = () => { };
             #endregion
 
@@ -59,7 +69,7 @@
             {
                 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);
+                CurAction.Init(this, CurPosition, NodeAct, ActSetting);
             }
 
             /// <summary>
@@ -89,6 +99,46 @@
             {
                 return CurAction.Submit(input);
             }
+
+            /// <summary>
+            /// 缁撴潫宸ユ鎵ц
+            /// </summary>
+            /// <returns></returns>
+            public ApiAction<SubmitOutput> End(SubmitInput input)
+            {
+                return CurAction.End(input);
+            }
+
+            /// <summary>
+            /// 璁剧疆宸ユ鐘舵�佸拰娑堟伅
+            /// </summary>
+            /// <returns></returns>
+            public void SetStatusMessage(StepStatus status, Locale msg)
+            {
+                Message = msg;
+                Status = status;
+            }
+
+            /// <summary>
+            /// 鑾峰彇褰撳墠宸ユ鐨勪俊鎭�
+            /// </summary>
+            /// <returns></returns>
+            public WorkStepInfo GetInfo(string locale)
+            {
+                return new WorkStepInfo() { 
+                    ID = ID,
+                    Name = Name,
+                    Sequence = Sequence,
+                    NodeID = NodeID,
+                    NodeType = NodeType.ToString(),
+                    Node = Node,
+                    OperSetting = OperSetting,
+                    NodeAct = NodeAct,
+                    ActSetting = ActSetting,
+                    Status = Status.ToString(),
+                    Message = Message.IsNullOrEmpty() ? "" : Biz.T(Message, locale),
+                };
+            }
             #endregion
 
         }

--
Gitblit v1.9.3