From 452b9b63ada7ef220952412613552d36ed477adc Mon Sep 17 00:00:00 2001 From: kazelee <1847801760@qq.com> Date: 星期一, 19 五月 2025 17:30:29 +0800 Subject: [PATCH] 测试,修复部分数据表问题 --- Models/TN_Loc_Container.cs | 2 .vs/HH.WCS.Mobox3.AnGang/FileContentIndex/7e201a71-d554-4ded-906f-7da951526801.vsidx | 0 /dev/null | 0 Dispatch/GZRobot.cs | 1 Models/TN_Task.cs | 2 Controllers/DebugController.cs | 6 ++ config/config.json | 2 Models/DebugModel.cs | 1 Helpers/AgvHelper.cs | 2 Services/DebugService.cs | 21 ++++++ .vs/HH.WCS.Mobox3.AnGang/FileContentIndex/0aee5537-94af-4049-9107-4c61afb239ee.vsidx | 0 Dtos/Request/DebugRequest.cs | 5 + Services/AgvService.cs | 120 ++++++++++++++++++++++----------------- Models/TN_Location.cs | 5 - Services/MoboxService.cs | 2 15 files changed, 101 insertions(+), 68 deletions(-) diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/0aee5537-94af-4049-9107-4c61afb239ee.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/0aee5537-94af-4049-9107-4c61afb239ee.vsidx new file mode 100644 index 0000000..bdd8319 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/0aee5537-94af-4049-9107-4c61afb239ee.vsidx Binary files differ diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/24e15c73-c902-489a-b348-f6cec9783170.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/24e15c73-c902-489a-b348-f6cec9783170.vsidx deleted file mode 100644 index 76b7280..0000000 --- a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/24e15c73-c902-489a-b348-f6cec9783170.vsidx +++ /dev/null Binary files differ diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/437becf2-8149-4b30-b2bc-cfc629b6be4c.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/437becf2-8149-4b30-b2bc-cfc629b6be4c.vsidx deleted file mode 100644 index c7797ef..0000000 --- a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/437becf2-8149-4b30-b2bc-cfc629b6be4c.vsidx +++ /dev/null Binary files differ diff --git a/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/7e201a71-d554-4ded-906f-7da951526801.vsidx b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/7e201a71-d554-4ded-906f-7da951526801.vsidx new file mode 100644 index 0000000..4dd5073 --- /dev/null +++ b/.vs/HH.WCS.Mobox3.AnGang/FileContentIndex/7e201a71-d554-4ded-906f-7da951526801.vsidx Binary files differ diff --git a/Controllers/DebugController.cs b/Controllers/DebugController.cs index 2d954b3..d4ef008 100644 --- a/Controllers/DebugController.cs +++ b/Controllers/DebugController.cs @@ -58,5 +58,11 @@ public string InsertLocCntrCg() { return DebugService.InsertLocCntrCg(); } + + [HttpPost] + [Route("SetTaskWeight")] + public string SetTaskWeight(SetTaskWeightInfo model) { + return DebugService.SetTaskWeight(model); + } } } diff --git a/Dispatch/GZRobot.cs b/Dispatch/GZRobot.cs index 8cdc3f3..5d4e4e9 100644 --- a/Dispatch/GZRobot.cs +++ b/Dispatch/GZRobot.cs @@ -257,7 +257,6 @@ if (data.data != null) { res = data.data; } - } catch (Exception ex) { Console.WriteLine(ex.Message); diff --git a/Dtos/Request/DebugRequest.cs b/Dtos/Request/DebugRequest.cs index b9b000c..164e7f5 100644 --- a/Dtos/Request/DebugRequest.cs +++ b/Dtos/Request/DebugRequest.cs @@ -27,5 +27,10 @@ public class CoverInfo { public bool IsCover { set; get; } = true; } + + public class SetTaskWeightInfo { + public string TaskNo { set; get; } + public float Weight { set; get; } + } } } diff --git a/Helpers/AgvHelper.cs b/Helpers/AgvHelper.cs index f4f41b6..962af92 100644 --- a/Helpers/AgvHelper.cs +++ b/Helpers/AgvHelper.cs @@ -29,7 +29,7 @@ public static bool IsNextStateOk(int lastState, int nextState) { var lastPri = GetPri(lastState); var nextPri = GetPri(nextState); - return lastPri != 0 && nextPri != 0 && lastPri <= nextState; + return lastPri != 0 && nextPri != 0 && lastPri <= nextPri; } /// <summary> diff --git a/Models/DebugModel.cs b/Models/DebugModel.cs index 287dee9..10771a8 100644 --- a/Models/DebugModel.cs +++ b/Models/DebugModel.cs @@ -10,7 +10,6 @@ public string LocCode { get; set; } public string LocArea { get; set; } public string CntrCode { get; set; } - public string CntrType { get; set; } public string ItemCode { get; set; } public string BatchNo { get; set; } } diff --git a/Models/TN_Loc_Container.cs b/Models/TN_Loc_Container.cs index 86332b2..ff07b70 100644 --- a/Models/TN_Loc_Container.cs +++ b/Models/TN_Loc_Container.cs @@ -10,8 +10,6 @@ public string S_LOC_CODE { get; set; } public string S_CNTR_CODE { get; set; } - public string S_CNTR_TYPE { get; set; } = ""; - [Navigate(NavigateType.OneToMany, nameof(TN_CG_Detail.S_CNTR_CODE))] public List<TN_CG_Detail> CntrItemRels { get; set; } diff --git a/Models/TN_Location.cs b/Models/TN_Location.cs index 9a097ba..cf19148 100644 --- a/Models/TN_Location.cs +++ b/Models/TN_Location.cs @@ -78,10 +78,5 @@ /// 璐ф灦缂栫爜 /// </summary> public string S_SHELF_CODE { get; set; } - - /// <summary> - /// 璐т綅楂樺害 - /// </summary> - public int N_HEIGHT { get; set; } } } diff --git a/Models/TN_Task.cs b/Models/TN_Task.cs index 53fba52..65606e9 100644 --- a/Models/TN_Task.cs +++ b/Models/TN_Task.cs @@ -36,8 +36,6 @@ public string S_CNTR_CODE { get; set; } public string S_OP_NAME { get; set; } - public int N_START_LAYER { get; internal set; } - public int N_END_LAYER { get; internal set; } public int N_CNTR_COUNT { get; internal set; } /// <summary> diff --git a/Services/AgvService.cs b/Services/AgvService.cs index 2cbf5b8..5ce5195 100644 --- a/Services/AgvService.cs +++ b/Services/AgvService.cs @@ -143,72 +143,88 @@ var endLoc = new TN_Location(); var data = GZRobot.CustomBuf(); - var weight = float.Parse(data[0].parameter_varchar200_up); - tn_task.F_WEIGHT = weight; - // 鍙綋涔嬪墠鎸囧畾缁堢偣璐ф灦鍚庯紝鎵嶅皾璇曡绠楃粓鐐硅揣浣嶏紝鍚﹀垯浜ょ粰浜哄伐鍐冲畾 - if (tn_task.S_END_AREA != "") { - if (weight > 1500) { - // 閲嶉噺瓒呰繃1.5t锛岄渶瑕侀�鎷�-3灞傝揣鏋�- endLoc = db.Queryable<TN_Location>().First(a => a.S_SHELF_CODE == tn_task.S_END_AREA && LocationHelper.IsFree(a) && a.N_CURRENT_NUM == 0 && a.N_HEIGHT <= 3); - } - else if (weight > 0) { - // 閲嶉噺鏈秴杩�.5t锛屽湪鎸囧畾璐ф灦闅忎究閫夋嫨1涓�- endLoc = db.Queryable<TN_Location>().First(a => a.S_SHELF_CODE == tn_task.S_END_AREA && LocationHelper.IsFree(a) && a.N_CURRENT_NUM == 0); - } - else { - // 娌℃湁鎺ユ敹鍒伴噸閲忥紝鎴栭噸閲忓嚭閿�- endLoc = null; - LogHelper.Info($"閿欒鐨勯噸閲忎俊鎭細{weight}"); + if (data.Count == 0) { + LogHelper.Info("璁剧疆缁堢偣璐т綅澶辫触锛氭病鏈夋帴鍙楀埌鏉ヨ嚜鍥借嚜AGV鐨勯噸閲忎俊鎭�); + + //return; + } + else { + var weight = float.Parse(data[0].parameter_varchar200_up); + tn_task.F_WEIGHT = weight; + + if (db.Updateable<TN_Task>(tn_task).UpdateColumns(it => it.F_WEIGHT).ExecuteCommand() <= 0) { + LogHelper.Info("淇敼Task閲嶉噺澶辫触"); return; } + } - // 濡傛灉娌℃湁绗﹀悎鏉′欢鐨勮揣浣嶏紝缃┖锛岀瓑寰匬DA閲嶆柊纭畾 - if (endLoc == null) { - tn_task.S_END_AREA = ""; - tn_task.S_END_LOC = ""; + // 缁堢偣璐ф灦涓虹┖鏃讹紝涓嶅垽鏂紝浜ょ粰浜哄伐澶勭悊 + if (tn_task.S_END_AREA == "") { + LogHelper.Info("缁堢偣璐ф灦涓虹┖锛屼笉澶勭悊"); + } - // 涓嶉渶瑕佸啀缁橤Z AGV浼犵┖鍊硷紝涓�紑濮嬪氨娌$粰鍏蜂綋璐т綅锛屽彧缁欎簡Area + // 鍙綋涔嬪墠鎸囧畾缁堢偣璐ф灦鍚庯紝鎵嶅皾璇曡绠楃粓鐐硅揣浣�+ if (tn_task.F_WEIGHT > 1500) { + // 閲嶉噺瓒呰繃1.5t锛岄渶瑕侀�鎷�-3灞傝揣鏋�+ endLoc = db.Queryable<TN_Location>().First(a => a.S_SHELF_CODE == tn_task.S_END_AREA && LocationHelper.IsFree(a) && a.N_CURRENT_NUM == 0 && a.N_LAYER <= 3); + } + else if (tn_task.F_WEIGHT > 0) { + // 閲嶉噺鏈秴杩�.5t锛屽湪鎸囧畾璐ф灦闅忎究閫夋嫨1涓�+ endLoc = db.Queryable<TN_Location>().First(a => a.S_SHELF_CODE == tn_task.S_END_AREA && LocationHelper.IsFree(a) && a.N_CURRENT_NUM == 0); + } + else { + // 娌℃湁鎺ユ敹鍒伴噸閲忥紝鎴栭噸閲忓嚭閿�+ endLoc = null; + LogHelper.Info($"閿欒鐨勯噸閲忎俊鎭細{tn_task.F_WEIGHT}"); + return; + } - //var request = new UpdateInteractInfo { - // interaction_info_id = 3, // 鏇存敼缁堢偣淇℃伅 - // info_status = "active", - // return_value = "", - //}; + // 濡傛灉娌℃湁绗﹀悎鏉′欢鐨勮揣浣嶏紝缃┖锛岀瓑寰匬DA閲嶆柊纭畾 + if (endLoc == null) { + tn_task.S_END_AREA = ""; + tn_task.S_END_LOC = ""; - //GZRobot.UpdateInteractInfo(request); + // 涓嶉渶瑕佸啀缁橤Z AGV浼犵┖鍊硷紝涓�紑濮嬪氨娌$粰鍏蜂綋璐т綅锛屽彧缁欎簡Area - using (var trans = db.Ado.UseTran()) { - if (db.Updateable<TN_Task>(tn_task).UpdateColumns(it => new { it.S_END_LOC, it.F_WEIGHT }) - .ExecuteCommand() > 0) { - //LocationHelper.LockLoc(endLoc.S_CODE, 1);//缁堢偣鍏ュ簱閿�+ //var request = new UpdateInteractInfo { + // interaction_info_id = 3, // 鏇存敼缁堢偣淇℃伅 + // info_status = "active", + // return_value = "", + //}; - trans.CommitTran(); - LogHelper.Info($"閲嶆柊璁$畻鍚庢病鏈夊悎閫傝揣浣嶏紝浠诲姟 {tn_task.S_CODE} 淇敼鎴愬姛锛屼慨鏀圭粓鐐硅揣鏋跺拰璐т綅涓虹┖"); - } - else { - trans.RollbackTran(); - LogHelper.Info($"閲嶆柊璁$畻鍚庢病鏈夊悎閫傝揣浣嶏紝浠诲姟 {tn_task.S_CODE} 淇敼澶辫触锛屼慨鏀圭粓鐐硅揣鏋跺拰璐т綅涓虹┖"); - } + //GZRobot.UpdateInteractInfo(request); + + using (var trans = db.Ado.UseTran()) { + if (db.Updateable<TN_Task>(tn_task).UpdateColumns(it => new { it.S_END_LOC, it.F_WEIGHT }) + .ExecuteCommand() > 0) { + //LocationHelper.LockLoc(endLoc.S_CODE, 1);//缁堢偣鍏ュ簱閿�+ + trans.CommitTran(); + LogHelper.Info($"閲嶆柊璁$畻鍚庢病鏈夊悎閫傝揣浣嶏紝浠诲姟 {tn_task.S_CODE} 淇敼鎴愬姛锛屼慨鏀圭粓鐐硅揣鏋跺拰璐т綅涓虹┖"); + } + else { + trans.RollbackTran(); + LogHelper.Info($"閲嶆柊璁$畻鍚庢病鏈夊悎閫傝揣浣嶏紝浠诲姟 {tn_task.S_CODE} 淇敼澶辫触锛屼慨鏀圭粓鐐硅揣鏋跺拰璐т綅涓虹┖"); } } - else { - // 鎵惧埌鍚堥�鐨勮揣浣嶏紝鎺ㄩ� - tn_task.S_END_LOC = endLoc.S_CODE; + } + else { + // 鎵惧埌鍚堥�鐨勮揣浣嶏紝鎺ㄩ� + tn_task.S_END_LOC = endLoc.S_CODE; - using (var trans = db.Ado.UseTran()) { - if (db.Updateable<TN_Task>(tn_task).UpdateColumns(it => new { it.S_END_LOC, it.F_WEIGHT }) - .ExecuteCommand() > 0) { - LocationHelper.LockLoc(endLoc.S_CODE, 1);//缁堢偣鍏ュ簱閿�+ using (var trans = db.Ado.UseTran()) { + if (db.Updateable<TN_Task>(tn_task).UpdateColumns(it => new { it.S_END_LOC, it.F_WEIGHT }) + .ExecuteCommand() > 0) { + LocationHelper.LockLoc(endLoc.S_CODE, 1);//缁堢偣鍏ュ簱閿� - trans.CommitTran(); - LogHelper.Info($"璁$畻璐т綅鎴愬姛锛屼换鍔�{tn_task.S_CODE} 淇敼鎴愬姛锛岀粓鐐硅揣鏋朵负 {endLoc.S_SHELF_CODE}锛屼慨鏀圭粓鐐逛綅缃负 {endLoc.S_CODE}"); - } - else { - trans.RollbackTran(); + trans.CommitTran(); + LogHelper.Info($"璁$畻璐т綅鎴愬姛锛屼换鍔�{tn_task.S_CODE} 淇敼鎴愬姛锛岀粓鐐硅揣鏋朵负 {endLoc.S_SHELF_CODE}锛屼慨鏀圭粓鐐逛綅缃负 {endLoc.S_CODE}"); + } + else { + trans.RollbackTran(); - LogHelper.Info($"璁$畻璐т綅鎴愬姛锛屼换鍔�{tn_task.S_CODE} 淇敼澶辫触锛岀粓鐐硅揣鏋朵负 {endLoc.S_SHELF_CODE}锛屼慨鏀圭粓鐐逛綅缃负 {endLoc.S_CODE}"); - } + LogHelper.Info($"璁$畻璐т綅鎴愬姛锛屼换鍔�{tn_task.S_CODE} 淇敼澶辫触锛岀粓鐐硅揣鏋朵负 {endLoc.S_SHELF_CODE}锛屼慨鏀圭粓鐐逛綅缃负 {endLoc.S_CODE}"); } } } diff --git a/Services/DebugService.cs b/Services/DebugService.cs index 4374a10..4684196 100644 --- a/Services/DebugService.cs +++ b/Services/DebugService.cs @@ -189,8 +189,7 @@ if (locCntrRel == null) { var newLocCntrRel = new TN_Loc_Container { S_LOC_CODE = locCntrCg.LocCode, - S_CNTR_CODE = locCntrCg.CntrCode, - S_CNTR_TYPE = locCntrCg.CntrType ?? "" + S_CNTR_CODE = locCntrCg.CntrCode }; loc.N_CURRENT_NUM = 1; @@ -233,5 +232,23 @@ return $"Error reading CSV file: {ex.Message}"; } } + + public static string SetTaskWeight(SetTaskWeightInfo model) { + var db = DbHelper.GetDbClient(); + + try { + if (db.Updateable<TN_Task>().SetColumns(it => it.F_WEIGHT == model.Weight).Where(it => it.S_CODE == model.TaskNo) + .ExecuteCommand() <= 0 ) { + return "淇敼澶辫触"; + } + return "淇敼鎴愬姛"; + + } + catch (Exception ex) { + + return ex.Message; + } + + } } } diff --git a/Services/MoboxService.cs b/Services/MoboxService.cs index 297c577..1345f1e 100644 --- a/Services/MoboxService.cs +++ b/Services/MoboxService.cs @@ -119,7 +119,7 @@ if (task.F_WEIGHT > 1500) { // 閲嶉噺瓒呰繃1.5t锛岄渶瑕侀�鎷�-3灞傝揣鏋� endLoc = db.Queryable<TN_Location>().First( - a => a.S_CODE == model.endLoc && a.N_LOCK_STATE == 0 && a.S_LOCK_STATE == "鏃� && a.C_ENABLE == "Y" && a.N_CURRENT_NUM == 0 && a.N_HEIGHT <= 3); + a => a.S_CODE == model.endLoc && a.N_LOCK_STATE == 0 && a.S_LOCK_STATE == "鏃� && a.C_ENABLE == "Y" && a.N_CURRENT_NUM == 0 && a.N_LAYER <= 3); } else { endLoc = db.Queryable<TN_Location>().First( diff --git a/config/config.json b/config/config.json index 536fd88..e1f40d2 100644 --- a/config/config.json +++ b/config/config.json @@ -2,7 +2,7 @@ "WebApiUrl": "http://127.0.0.1:8901", "RCSApiUrl": "http://127.0.0.1:6001", "NDCApiUrl": "http://127.0.0.1:5201/api/order/", - "SqlServer": "Data Source=(local);Initial Catalog=AnGangTest;User ID=sa;Password=123456;", + "SqlServer": "Data Source=192.168.1.144;Initial Catalog=YinKouAnGan;User ID=hhuser;Password=Am123123", "TCPServerIP": "127.0.0.1", "TCPServerPort": 8085, "Areas": [ -- Gitblit v1.9.1