From aef56e88ed1faeaa221f36b462a1120d7960e2fa Mon Sep 17 00:00:00 2001
From: 陈嘉乐 <cjl@hdlchina.com.cn>
Date: 星期二, 22 十二月 2020 15:09:01 +0800
Subject: [PATCH] 2020-12-22-4

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

diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
index f8e11ad..268dd0f 100644
--- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
+++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs
@@ -160,7 +160,7 @@
                 this.AddChidren(fLayout);
                 AndOrMethod(fLayout, titleCondition.btnText);
             };
-            ///鏉′欢鐐瑰嚮浜嬩欢
+            ///鏉′欢娣诲姞鐐瑰嚮浜嬩欢
             addInputIcon.btnClick.MouseUpEventHandler += (sen, e) =>
             {
                 var addInputType = new AddInputType();
@@ -168,7 +168,7 @@
                 addInputType.Show();
                 MainPage.BasePageView.PageIndex = MainPage.BasePageView.ChildrenCount - 1;
             };
-            ///鐩爣鐐瑰嚮浜嬩欢
+            ///鐩爣娣诲姞鐐瑰嚮浜嬩欢
             addOutputIcon.btnClick.MouseUpEventHandler += (sen, e) =>
             {
                 var addTarget = new AddTarget();
@@ -184,6 +184,21 @@
             ///淇濆瓨鐐瑰嚮浜嬩欢
             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)
+                {
+                    new LogicView.TipPopView().TipBox(StringId.tip, StringId.conditioncNull);
+                    return;
+                }
+                if (Logic.currlogic.output.Count == 0)
+                {
+                    new LogicView.TipPopView().TipBox(StringId.tip, StringId.targetNull);
+                    return;
+                }
                 Loading loading = new Loading();
                 this.AddChidren(loading);
                 HDL_ON.DAL.Server.ResponsePackNew responsePackNew = null;
@@ -194,7 +209,7 @@
                     {
                         list.Add(logic.name);
                     }
-                    new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) =>
+                    new LogicView.TipPopView().InputBox(StringId.editName, InterfaceDsplaysLogic.GetLogicName(Logic.currlogic), StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) =>
                     {
                         Logic.currlogic.name = logicName;
                         Logic.currlogic.sid = LogicMethod.NewSid();
@@ -226,7 +241,7 @@
                                             //鏁版嵁杩斿簭鍒楀寲涓篖ogic瀵硅薄
                                             var str = Newtonsoft.Json.JsonConvert.SerializeObject(jay);
                                             var logic = Newtonsoft.Json.JsonConvert.DeserializeObject<Logic>(str);
-                                            if (logic.userLogicId!="")
+                                            if (logic.userLogicId != "")
                                             {
                                                 //鏇存柊浜戠鍞竴鑷姩鍖杋d;
                                                 Logic.currlogic.userLogicId = logic.userLogicId;
@@ -242,6 +257,10 @@
                                         Logic.LogicList.Add(Logic.currlogic);
                                         LogicMethod.RemoveAllView();
                                         MainView.MainShow();
+                                    }
+                                    else if (responsePackNew != null && responsePackNew.Code == "14005")
+                                    {
+                                        new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
                                     }
                                     else
                                     {
@@ -279,7 +298,11 @@
                                     LogicMethod.RemoveAllView();
                                     MainView.MainShow();
                                 }
-                                else
+                                else if (responsePackNew != null && responsePackNew.Code == "14005")
+                                {
+                                    new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.gatewayNotOnline));
+                                }
+                                else 
                                 {
                                     new LogicView.TipPopView().FlashingBox(Language.StringByID(StringId.saveFail));
                                 }
@@ -610,6 +633,7 @@
 
             return stateList;
         }
+       
 
     }
 }

--
Gitblit v1.8.0