From 879014e6dcd2e3897eea4a7585fb7c87183d9ffd Mon Sep 17 00:00:00 2001
From: Rodney Chen <rodney.chen@hotmail.com>
Date: 星期三, 16 十月 2024 15:31:57 +0800
Subject: [PATCH] 增加行为禁用功能

---
 Tiger.Business.MES/Common/WorkStep.cs |   24 +++++++++++++++++++++++-
 Tiger.Api/Language.db                 |    0 
 Tiger.IBusiness/Common/IStep.cs       |    2 ++
 3 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/Tiger.Api/Language.db b/Tiger.Api/Language.db
index 288d0f7..211b393 100644
--- a/Tiger.Api/Language.db
+++ b/Tiger.Api/Language.db
Binary files differ
diff --git a/Tiger.Business.MES/Common/WorkStep.cs b/Tiger.Business.MES/Common/WorkStep.cs
index 3ca316e..6b790d7 100644
--- a/Tiger.Business.MES/Common/WorkStep.cs
+++ b/Tiger.Business.MES/Common/WorkStep.cs
@@ -41,6 +41,12 @@
         public int Sequence { get; set; }
         public List<string> PrepNodeIDs { get; set; } = new();
         public string NodeID => NodeType == IWorkStep.NodeTypes.Action ? NodeAct.ID : Node.ID;
+        private bool _IsActive = true;
+        public bool IsActive
+        {
+            get => NodeType == IWorkStep.NodeTypes.Action ? ActSetting.IS_ACTIVE == "Y" : _IsActive;
+            set { _IsActive = value; }
+        }
         private bool _IsFinished = false;
         public bool IsFinished
         {
@@ -79,7 +85,23 @@
         public ApiAction<SubmitOutput> TryBegin(SubmitInput input)
         {
             BeginAt = DateTime.Now;
-            return CurAction.TryBegin(input);
+            //宸ユ琛屼负鍚敤鍒欐甯告墽琛�
+            if (IsActive)
+            {
+                return CurAction.TryBegin(input);
+            }
+            //宸ユ琛屼负涓嶅惎鐢紝鍚﹀垯宸ユ榛樿瀹屾垚
+            else
+            {
+                CurAction.IsFinished = true;
+                var action = new ApiAction<SubmitOutput>(new SubmitOutput());
+                this.Message = Biz.L($"琛屼负鏈惎鐢�");
+                this.Status = StepStatus.InActive;
+                action.Data.ShortMsg = new($"琛屼负鏈惎鐢�", ShortMessage.Types.Success);
+                //action.LocaleMsg = new($"{0}琛屼负鏈惎鐢�");
+                action.LocaleMsg = new("MES.WorkAction.NotActive", NodeAct.ACT_NAME);
+                return action;
+            }
         }
 
         /// <summary>
diff --git a/Tiger.IBusiness/Common/IStep.cs b/Tiger.IBusiness/Common/IStep.cs
index a3ab6ae..6824063 100644
--- a/Tiger.IBusiness/Common/IStep.cs
+++ b/Tiger.IBusiness/Common/IStep.cs
@@ -62,6 +62,8 @@
 
     public enum StepStatus
     {
+        [Description("绂佺敤")]
+        InActive,
         [Description("姝e父")]
         Normal,
         [Description("鎴愬姛")]

--
Gitblit v1.9.3