From 4aa6ae21272b3013c5042c73cdc60efa787d57df Mon Sep 17 00:00:00 2001 From: 陈嘉乐 <cjl@hdlchina.com.cn> Date: 星期二, 01 十二月 2020 20:39:02 +0800 Subject: [PATCH] 2020-12-01-4 --- HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs | 2 HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs | 4 + HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs | 74 +++++++----------- HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs | 142 +++++++++++++++++++++++++++++++++- .vs/HDL_APP_Project/xs/sqlite3/storage.ide | 0 .vs/HDL_APP_Project/xs/UserPrefs.xml | 13 ++ .vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal | 0 7 files changed, 180 insertions(+), 55 deletions(-) diff --git a/.vs/HDL_APP_Project/xs/UserPrefs.xml b/.vs/HDL_APP_Project/xs/UserPrefs.xml index 583dc6e..67e0774 100644 --- a/.vs/HDL_APP_Project/xs/UserPrefs.xml +++ b/.vs/HDL_APP_Project/xs/UserPrefs.xml @@ -1,19 +1,26 @@ 锘�<Properties StartupConfiguration="{09712674-2A38-407B-B1E2-560B2C352F9A}|Default"> <MonoDevelop.Ide.Workbench ActiveDocument="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs"> <Files> - <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="559" Column="1" /> - <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" Line="1" Column="1" /> - <File FileName="HDL_ON/DAL/Server/NewAPI.cs" Line="427" Column="20" /> + <File FileName="HDL_ON/DAL/Server/HttpUtil.cs" Line="188" Column="1" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs" Line="176" Column="37" /> + <File FileName="HDL_ON/DAL/Server/NewAPI.cs" Line="419" Column="77" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs" Line="28" Column="64" /> + <File FileName="HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs" Line="21" Column="35" /> </Files> <Pads> <Pad Id="ProjectPad"> <State name="__root__"> <Node name="HDL_APP_Project" expanded="True"> <Node name="HDL_ON" expanded="True"> + <Node name="DAL" expanded="True"> + <Node name="Server" expanded="True" /> + </Node> + <Node name="Entity" expanded="True" /> <Node name="UI" expanded="True"> <Node name="UI2" expanded="True"> <Node name="3-Intelligence" expanded="True"> <Node name="Automation" expanded="True"> + <Node name="LogicView" expanded="True" /> <Node name="AddLogic.cs" selected="True" /> </Node> </Node> diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide index 8f56e29..c1fd0f9 100644 --- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide +++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide Binary files differ diff --git a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal index 5f48073..47e661d 100644 --- a/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal +++ b/.vs/HDL_APP_Project/xs/sqlite3/storage.ide-wal Binary files differ diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs index 6d1b622..39434f2 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/AddLogic.cs @@ -35,7 +35,8 @@ topView.setBtn.Visible = true; topView.clickSetBtn.Visible = true; } - topView.clickSetBtn.MouseUpEventHandler += (sender,e) => { + topView.clickSetBtn.MouseUpEventHandler += (sender, e) => + { Set set = new Set(); MainPage.BasePageView.AddChidren(set); set.Show(); @@ -43,7 +44,7 @@ }; - VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout + VerticalScrolViewLayout viewLayout = new VerticalScrolViewLayout { Y = Application.GetRealHeight(64), Width = Application.GetRealWidth(LogicView.TextSize.view375), @@ -162,50 +163,35 @@ this.AddChidren(saveView.FLayoutView()); saveView.btnClick.MouseUpEventHandler += (sender, e) => { + if (string.IsNullOrEmpty(Logic.currlogic.sid)) + { + List<string> list = new List<string>(); + foreach (var logic in Logic.LogicList) + { + list.Add(logic.name); + } + new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => + { + Logic.currlogic.name = logicName; + Logic.currlogic.sid = LogicMethod.NewSid(); + var responsePackNew = Send.AddLogic(Logic.currlogic); + if (responsePackNew.Code == "0") + { + Logic.LogicList.Add(Logic.currlogic); + LogicMethod.RemoveAllView(); + MainView.MainShow(); + } + //鍙戦�佹柊鍔犱慨鏀归�昏緫鍛戒护锛� - Logic.currlogic.sid = "000101000000000A0A0100CC1100"; - //Logic.currlogic.sid = LogicMethod.NewSid(); - //var f = Send.AddLogic(Logic.currlogic); + }); - //var a = Send.getLogicIdList(); - - //var d = Send.getLogic(Logic.currlogic); - - var c = Send.delLogic(Logic.currlogic); - - //var e1= Send.switchLogic(Logic.currlogic); - - - - //if (string.IsNullOrEmpty(Logic.currlogic.sid)) - //{ - // List<string> list = new List<string>(); - // foreach (var logic in Logic.LogicList) - // { - // list.Add(logic.name); - // } - // new LogicView.TipPopView().InputBox(StringId.editName, Logic.currlogic.name, StringId.nameNull, StringId.NameAlreadyExists, list, (logicName) => - // { - // Logic.currlogic.name = logicName; - // Logic.currlogic.sid = LogicMethod.NewSid(); - // var responsePackNew = Send.AddLogic(Logic.currlogic); - // if (responsePackNew.Code == "0") - // { - // Logic.LogicList.Add(Logic.currlogic); - // LogicMethod.RemoveAllView(); - // MainView.MainShow(); - // } - // //鍙戦�佹柊鍔犱慨鏀归�昏緫鍛戒护锛� - - // }); - - //} - //else - //{ - // LogicMethod.RemoveAllView(); - // MainView.MainShow(); - // //鍙戦�佹柊鍔犱慨鏀归�昏緫鍛戒护锛� - //} + } + else + { + LogicMethod.RemoveAllView(); + MainView.MainShow(); + //鍙戦�佹柊鍔犱慨鏀归�昏緫鍛戒护锛� + } }; #endregion diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs index 95f9f48..af6daaf 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Logic.cs @@ -16,6 +16,10 @@ /// </summary> public static Logic currlogic; /// <summary> + /// 浜戠鍞竴id + /// </summary> + public string userLogicId = ""; + /// <summary> /// 閫昏緫鍞竴鏍囪瘑 /// </summary> public string sid = ""; diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs index 6870204..2e008e0 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/LogicView/LogicTypeTitleView.cs @@ -66,7 +66,7 @@ /// <returns></returns> public FrameLayout FLayoutView() { - btnText.TextAlignment = TextAlignment.BottomLeft; + btnText.TextAlignment = TextAlignment.CenterLeft; btnNextIcon.Gravity = Gravity.CenterVertical; frameLayout.AddChidren(btnText); frameLayout.AddChidren(btnNextIcon); diff --git a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs index 6f61531..4412688 100644 --- a/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs +++ b/HDL_ON/UI/UI2/3-Intelligence/Automation/Send.cs @@ -21,11 +21,140 @@ /// <summary> /// 浣忓畢ID /// </summary> - public static string homeId = "1333681497069043713"; + public static string homeId = "1333723044544233473"; /// <summary> /// 缃戝叧ID /// </summary> - public static string gatewayId = "1333682616549752834"; + public static string gatewayId = "1333723647223775233"; + ///// <summary> + ///// 鑾峰彇閫昏緫ID鍒楄〃 + ///// </summary> + ///// <returns></returns> + //public const string getLogicId = "鑾峰彇閫昏緫ID"; + ///// <summary> + ///// 鑾峰彇閫昏緫 + ///// </summary> + ///// <returns></returns> + //public const string getLogic= "鑾峰彇閫昏緫璇︾粏"; + ///// <summary> + ///// 娣诲姞鑷姩鍖栧懡浠� + ///// </summary> + ///// <returns></returns> + //public const string addLogic= "娣诲姞鏂伴�昏緫"; + ///// <summary> + ///// 缂栬緫鏇存柊閫昏緫 + ///// </summary> + ///// <returns></returns> + //public const string updateLogic = "缂栬緫閫昏緫"; + ///// <summary> + ///// 鍒犻櫎閫昏緫 + ///// </summary> + ///// <returns></returns> + //public const string delLogic = "鍒犻櫎閫昏緫"; + ///// <summary> + ///// 閫昏緫寮�鍏� + ///// </summary> + ///// <returns></returns> + //public const string switchLogic = "閫昏緫寮�鍏�"; + //public static ResponsePackNew Logic(string type,Logic logic) { + // string url = ""; + // var jObject = new JObject { }; + // switch (type) { + // case getLogicId: { + // jObject.Add("homeId",homeId); + // url = NewAPI.API_POST_Logic_List; + // } + // break; + // case getLogic: { + // var jArray = new JArray { }; + // jArray.Add(logic.userLogicId); + // jObject.Add("userLogicIds", jArray); + // url = NewAPI.API_POST_Logic_Info; + // } break; + // case addLogic: { + // try + // { + // var cycleJObject = new JObject { }; + // var cyclevaluejArray = new JArray { }; + // cycleJObject.Add("type", logic.cycle.type); + // foreach (var dictionary in logic.cycle.value) + // { + // cyclevaluejArray.Add(dictionary); + // } + // cycleJObject.Add("value", cyclevaluejArray); + + // var inputArray = new JArray { }; + // foreach (var dictionary in logic.input) + // { + // var inputTypeJOb = new JObject { }; + // inputTypeJOb.Add("sid", dictionary.sid); + // inputTypeJOb.Add("condition_type", dictionary.condition_type); + + // var conditionArray = new JArray { }; + // foreach (var dic in dictionary.condition) + // { + // var conditionJOb = new JObject { }; + // conditionJOb.Add("key", dic["key"]); + // conditionJOb.Add("comparator", dic["comparator"]); + // conditionJOb.Add("data_type", dic["data_type"]); + // conditionJOb.Add("value", dic["value"]); + // conditionArray.Add(conditionJOb); + // } + // inputTypeJOb.Add("condition", conditionArray); + // inputArray.Add(inputTypeJOb); + // } + + // var outputArray = new JArray { }; + // foreach (var dictionary in logic.output) + // { + // var outputTypeJOb = new JObject { }; + // outputTypeJOb.Add("sid", dictionary.sid); + // outputTypeJOb.Add("target_type", dictionary.target_type); + // var statusArray = new JArray { }; + // foreach (var dic in dictionary.status) + // { + // var statusJOb = new JObject { }; + // statusJOb.Add("key", dic["key"]); + // statusJOb.Add("value", dic["value"]); + // statusArray.Add(statusJOb); + // } + // outputTypeJOb.Add("status", statusArray); + // outputArray.Add(outputTypeJOb); + // } + + // var logicjArray = new JArray { }; + // var logicIfon = new JObject { }; + // logicIfon.Add("sid", logic.sid); + // logicIfon.Add("gatewayId", gatewayId); + // logicIfon.Add("name", logic.name); + // logicIfon.Add("relation", logic.relation); + // logicIfon.Add("enable", logic.enable); + // logicIfon.Add("cycle", cycleJObject); + // logicIfon.Add("input", inputArray); + // logicIfon.Add("output", outputArray); + // logicjArray.Add(logicIfon); + // var jObject = new JObject { { "homeId", homeId }, { "logics", logicjArray } }; + // responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add); + + // } + // catch (Exception e) + // { + // var dd = e.Message; + // } + // } break; + // case updateLogic: { + // } break; + // case delLogic: { } break; + // case switchLogic: { } break; + + + // } + + // return RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Add); + //} + + + /// <summary> /// 鑾峰彇閫昏緫ID鍒楄〃 /// </summary> @@ -43,7 +172,7 @@ public static ResponsePackNew getLogic(Logic logic) { var jArray = new JArray { }; - jArray.Add(logic.sid); + jArray.Add(logic.userLogicId); var jObject = new JObject { { "userLogicIds", jArray } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Info); return responsePackNew; @@ -129,7 +258,6 @@ return responsePackNew; } - /// <summary> /// 缂栬緫鏇存柊閫昏緫 /// </summary> @@ -190,6 +318,7 @@ var logicjArray = new JArray { }; var logicIfon = new JObject { }; + logicIfon.Add("userLogicId", logic.userLogicId); logicIfon.Add("sid", logic.sid); logicIfon.Add("gatewayId", gatewayId); logicIfon.Add("name", logic.name); @@ -218,7 +347,7 @@ public static ResponsePackNew delLogic(Logic logic) { var jArray = new JArray { }; - jArray.Add(logic.sid); + jArray.Add(logic.userLogicId); var jObject = new JObject { { "userLogicIds", jArray } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Delete); return responsePackNew; @@ -229,9 +358,8 @@ /// <returns></returns> public static ResponsePackNew switchLogic(Logic logic) { - logic.enable ="false"; var jArray = new JArray { }; - var job = new JObject { { "userLogicId", logic.sid } , { "enable", logic.enable } }; + var job = new JObject { { "userLogicId", logic.userLogicId } , { "enable", logic.enable } }; jArray.Add(job); var jObject = new JObject { { "logics", jArray } }; var responsePackNew = RequestServerhomeId(jObject, NewAPI.API_POST_Logic_Enable); -- Gitblit v1.8.0