From 3f6685c77beeb12baf840733fb890860f4c26e7c Mon Sep 17 00:00:00 2001
From: mac <user@users-MacBook-Pro.local>
Date: 星期四, 25 七月 2024 17:25:59 +0800
Subject: [PATCH] 2024年07月25日17:24:45

---
 HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs |   84 ++++++++++++++---------------------------
 1 files changed, 29 insertions(+), 55 deletions(-)

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
index 1b9285f..6841d02 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -14,6 +14,9 @@
 
         public void Show()
         {
+           
+
+
             #region  鐣岄潰甯冨眬
             this.BackgroundColor = CSS.CSS_Color.viewMiddle;
             LogicView.TopView topView = new LogicView.TopView();
@@ -70,7 +73,7 @@
             }
 
             // 鏉′欢澶勭悊鏂规硶
-            InpOrOutLogicMethod.InputCondition(this, viewLayout);
+            InpOrOutLogicMethod.Current.InputCondition(this, viewLayout);
             ///娣诲姞鍥炬爣鐨刅iew
             LogicView.LogicAddView addInputIcon = new LogicView.LogicAddView();
             addInputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
@@ -89,7 +92,7 @@
             titleOutpu.btnNextIcon.Visible = false;
             viewLayout.AddChidren(titleOutpu.FLayoutView());
             //鐩爣澶勭悊鏂规硶
-            InpOrOutLogicMethod.OutputTarget(this, viewLayout);
+            InpOrOutLogicMethod.Current.OutputTarget(this, viewLayout);
             ///娣诲姞鍥炬爣鐨刅iew
             LogicView.LogicAddView addOutputIcon = new LogicView.LogicAddView();
             addOutputIcon.frameLayout.SetCornerWithSameRadius(Application.GetRealHeight(12), HDLUtils.RectCornerBottomLeft | HDLUtils.RectCornerBottomRight);
@@ -223,28 +226,24 @@
             ///淇濆瓨鐐瑰嚮浜嬩欢
             saveView.btnClick.MouseUpEventHandler += (sender, e) =>
             {
-                if (Logic.currlogic.input.Count == 0 && Logic.currlogic.output.Count == 0)
-                {
-                    new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNullOrtargetNull);
-                    return;
-                }
+                //if (Logic.currlogic.input.Count == 0 && Logic.currlogic.output.Count == 0)
+                //{
+                //    new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNullOrtargetNull);
+                //    return;
+                //}
                 if (Logic.currlogic.input.Count == 0)
                 {
                     new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNull);
                     return;
                 }
-                if (Logic.currlogic.output.Count == 0)
+                if (Logic.currlogic.output.Count == 0&&!push.btnNextIcon.IsSelected)
                 {
                     new LogicView.TipPopView().TipBox(StringId.tip, StringId.targetNull);
                     return;
                 }
-
-                
-
-
                 Loading loading = new Loading();
                 this.AddChidren(loading);
-                HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
+                HDL_ON.DAL.Server.ResponsePackNew r = null; 
                 if (string.IsNullOrEmpty(Logic.currlogic.userLogicId))
                 {
                     List<string> list = new List<string>();
@@ -252,11 +251,11 @@
                     {
                         list.Add(logic.name);
                     }
-                    new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view
+                    new LogicView.TipPopView().InputBox(StringId.editName, InpOrOutLogicMethod.Current.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName, view
                         ) =>
                     {
                         Logic.currlogic.name = logicName;
-                        Logic.currlogic.sid = LogicMethod.CurrLogicMethod.NewSid();
+                        Logic.currlogic.sid = LogicMethod.Current.NewSid();
                         loading.Start();
                         new System.Threading.Thread(() =>
                         {
@@ -265,7 +264,7 @@
                                 if (!MainPage.NoLoginMode)
                                 {
                                     //鍙戦�佹柊鍔犻�昏緫鍛戒护锛�
-                                    responsePackNew = Send.AddLogic(Logic.currlogic);
+                                    r = Send.Current.AddLogic(Logic.currlogic,true);
                                 }
 
                             }
@@ -278,46 +277,30 @@
                                     if(MainPage.NoLoginMode)
                                     {
                                         Logic.LogicList.Add(Logic.currlogic);
-                                        LogicMethod.CurrLogicMethod.RemoveAllView();
+                                        LogicMethod.Current.RemoveAllView();
                                         MainView.MainShow();
                                         return;
                                     }
 
-                                    if (responsePackNew != null && responsePackNew.Code == "0" && responsePackNew.Data.ToString() != "")
+                                    if (r != null)
                                     {
-                                        //鑾峰彇閫昏緫璇︾粏杩斿洖鏄竴涓暟缁�(object绫诲瀷杞崲涓烘暟缁�);
-                                        var jArray = Newtonsoft.Json.Linq.JArray.Parse(responsePackNew.Data.ToString());
-                                        for (int a = 0; a < jArray.Count; a++)
+                                        var userLogicIdList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<Logic>>(r.Data.ToString());
+                                        for (int i = 0; i < userLogicIdList.Count; i++)
                                         {
-                                            var jay = jArray[a];
-                                            //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
-                                            var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
-                                            var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str);
-                                            if (logic.userLogicId != "")
-                                            {
-                                                //鏇存柊浜戠鍞竴鑷姩鍖杋d;
-                                                Logic.currlogic.userLogicId = logic.userLogicId;
-                                            }
-                                            else
+                                            var logic = userLogicIdList[i];
+                                            if (string.IsNullOrEmpty(logic.userLogicId))
                                             {
                                                 //鑷繁鐪嬬殑鎵�浠ヤ笉闇�瑕佹敮鎸佷腑鑻辨枃
                                                 new LogicView.TipPopView().FlashingBox("娌℃湁杩斿洖浜戠鍞竴鑷姩鍖杋d");
                                             }
-
+                                            //鏇存柊浜戠鍞竴鑷姩鍖杋d;
+                                            Logic.currlogic.userLogicId = logic.userLogicId;
                                         }
-
                                         Logic.LogicList.Add(Logic.currlogic);
-                                        LogicMethod.CurrLogicMethod.RemoveAllView();
+                                        LogicMethod.Current.RemoveAllView();
                                         MainView.MainShow();
                                     }
-                                    else if (responsePackNew != null && responsePackNew.Code == "14005")
-                                    {
-                                        new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
-                                    }
-                                    else
-                                    {
-                                        new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
-                                    }
+                                   
                                 });
                             }
 
@@ -336,7 +319,7 @@
                         try
                         {
                             //鍙戦�佷慨鏀归�昏緫鍛戒护锛�
-                            responsePackNew = Send.UpdateLogic(Logic.currlogic);
+                            r = Send.Current.UpdateLogic(Logic.currlogic,true);
 
                         }
                         catch { }
@@ -345,23 +328,14 @@
                             Application.RunOnMainThread(() =>
                             {
                                 loading.Hide();
-                                if (responsePackNew != null && responsePackNew.Code == "0")
+                                if (r != null )
                                 {
-                                    LogicMethod.CurrLogicMethod.RemoveAllView();
+                                    LogicMethod.Current.RemoveAllView();
                                     MainView.MainShow();
                                 }
-                                else if (responsePackNew != null && responsePackNew.Code == "14005")
-                                {
-                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
-                                }
-                                else
-                                {
-                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
-                                }
+
                             });
                         }
-
-
 
                     })
                     { IsBackground = true }.Start();

--
Gitblit v1.8.0