From 4de417b106a062452f5ac86e626e7e225b753eab Mon Sep 17 00:00:00 2001 From: zhaowc <526854230@qq.com> Date: 星期二, 23 九月 2025 08:03:11 +0800 Subject: [PATCH] 优化问题 --- Wms/WMS.BLL/BllTransServer/RcsServer.cs | 108 ++++++++++++++++++++++++++--------------------------- 1 files changed, 53 insertions(+), 55 deletions(-) diff --git a/Wms/WMS.BLL/BllTransServer/RcsServer.cs b/Wms/WMS.BLL/BllTransServer/RcsServer.cs index 0417f22..de8b33e 100644 --- a/Wms/WMS.BLL/BllTransServer/RcsServer.cs +++ b/Wms/WMS.BLL/BllTransServer/RcsServer.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Numerics; +using System.Reflection; using System.Security.Policy; using System.Text; using System.Threading.Tasks; @@ -336,7 +338,7 @@ //logTaskEntry2.IsCancel = 0; logTaskEntry2.BackDate = DateTime.Now; logTaskEntry2.Status = "1"; - Db.Insertable(logTaskEntry2).ExecuteCommand(); + Db.Updateable(logTaskEntry2).ExecuteCommand(); startLoction2.Status = "3";//鍑哄簱涓� Db.Updateable(startLoction2).ExecuteCommand(); @@ -348,7 +350,7 @@ { logTaskEntry2.IsSuccess = 0; logTaskEntry2.Information = agvMsg; - Db.Insertable(logTaskEntry2).ExecuteCommand(); + Db.Updateable(logTaskEntry2).ExecuteCommand(); } //鎻愪氦浜嬪姟 @@ -412,7 +414,7 @@ //logTaskEntry.IsCancel = 0; logTaskEntry.BackDate = DateTime.Now; logTaskEntry.Status = "1";//姝e湪鎵ц - Db.Insertable(logTaskEntry).ExecuteCommand(); + Db.Updateable(logTaskEntry).ExecuteCommand(); startLoction.Status = "3";//鍑哄簱涓� Db.Updateable(startLoction).ExecuteCommand(); @@ -424,7 +426,7 @@ { logTaskEntry.IsSuccess = 0; logTaskEntry.Information = agvMsg; - Db.Insertable(logTaskEntry).ExecuteCommand(); + Db.Updateable(logTaskEntry).ExecuteCommand(); } //鎻愪氦浜嬪姟 @@ -704,7 +706,7 @@ //logTaskEntry.IsCancel = 0; logTaskEntry.BackDate = DateTime.Now; logTaskEntry.Status = "1";//姝e湪鎵ц - Db.Insertable(logTaskEntry).ExecuteCommand(); + Db.Updateable(logTaskEntry).ExecuteCommand(); deviceLocatInfo.Status = "3";//鍑哄簱涓� Db.Updateable(deviceLocatInfo).ExecuteCommand(); @@ -716,7 +718,7 @@ { logTaskEntry.IsSuccess = 0; logTaskEntry.Information = agvMsg; - Db.Insertable(logTaskEntry).ExecuteCommand(); + Db.Updateable(logTaskEntry).ExecuteCommand(); } //鎻愪氦浜嬪姟 Db.CommitTran(); @@ -941,17 +943,12 @@ stockDetail.PalletStatus = "0"; stockDetail.Status = "0";//寰呭垎閰� } - else if (endAreaInfo.Type == "1")//棰勬贩鍖� - { - stockDetail.PalletStatus = "1"; - stockDetail.Status = "0";//寰呭垎閰� - } - else if (endAreaInfo.Type == "2")//鍗婃垚鍝佸尯 + else if (endAreaInfo.Type == "1")//婊℃《 { stockDetail.PalletStatus = "2"; stockDetail.Status = "0";//寰呭垎閰� } - else if (endAreaInfo.Type == "3")//鑴忔《鍖� + else if (endAreaInfo.Type == "2")//鑴忔《鍖� { stockDetail.PalletStatus = "3"; stockDetail.LotNo = "";//鎵规 @@ -1097,18 +1094,16 @@ } locatEnd.Status = "0"; //绌哄偍浣� Db.Updateable(locatEnd).ExecuteCommand(); - - if (task.Type == "1")//鍑哄簱浠诲姟 + + //淇敼搴撳瓨鏄庣粏 + var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == task.PalletNo); + if (stockDetail == null) { - //淇敼搴撳瓨鏄庣粏 - var stockDetail = Db.Queryable<DataStockDetail>().First(w => w.IsDel == "0" && w.PalletNo == task.PalletNo && w.Status == "2"); - if (stockDetail == null) - { - throw new Exception("鏈煡璇㈠埌璇ユ《搴撳瓨淇℃伅,璇锋鏌�!"); - } - stockDetail.Status = "0";//寰呭垎閰� - Db.Updateable(stockDetail).ExecuteCommand(); + throw new Exception("鏈煡璇㈠埌璇ユ《搴撳瓨淇℃伅,璇锋鏌�!"); } + stockDetail.Status = "0";//寰呭垎閰� + Db.Updateable(stockDetail).ExecuteCommand(); + //娣诲姞鎿嶄綔鏃ュ織璁板綍 var k = new OperationCrServer().AddLogOperationCr("搴撳唴浣滀笟", "搴撳唴鏃ュ織", taskNo, "鍙栨秷", $"鐐瑰嚮鍙栨秷鎸夐挳銆佸彇娑堜簡浠诲姟鍙蜂负锛歿taskNo}鐨勪换鍔�", userId); Db.CommitTran(); @@ -1125,7 +1120,7 @@ /// <param name="taskNo"></param> /// <param name="userId"></param> /// <exception cref="Exception"></exception> - public void DownTask(string taskNo, int userId,string url) + public void DownTask(string taskNo, int userId,string url,string bindUrl) { try { @@ -1142,7 +1137,7 @@ throw new Exception("鍙湁绛夊緟鎵ц鐨勪换鍔℃墠鍙墜鍔ㄤ笅鍙�"); } //鏌ユ壘璇ユ《鏈夋病鏈夋鍦ㄦ墽琛岀殑浠诲姟 - var tasking = Db.Queryable<LogTask>().First(w => w.IsDel == "0" && w.Status == "1" && w.PalletNo == logTaskEntry.PalletNo); + var tasking = Db.Queryable<LogTask>().First(w => w.IsDel == "0" && w.Status == "1" && w.PalletNo == logTaskEntry.PalletNo); if (tasking != null) { throw new Exception($"璇ユ《鏈夋鍦ㄦ墽琛岀殑浠诲姟"); @@ -1153,20 +1148,20 @@ { throw new Exception($"鏈煡璇㈠埌璧峰鍌ㄤ綅淇℃伅"); } - if (startLocatInfo.Status != "1") - { - throw new Exception($"璧峰鍌ㄤ綅鐘舵�佸紓甯�"); - } + //if (startLocatInfo.Status != "1") + //{ + // throw new Exception($"璧峰鍌ㄤ綅鐘舵�佸紓甯�"); + //} //鐩爣鍌ㄤ綅淇℃伅 var endLocatInfo = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.LocatNo == logTaskEntry.EndLocat); if (endLocatInfo == null) { throw new Exception($"鏈煡璇㈠埌鐩爣鍌ㄤ綅淇℃伅"); } - if (endLocatInfo.Status != "0") - { - throw new Exception($"鐩爣鍌ㄤ綅鐘舵�佸紓甯�"); - } + //if (endLocatInfo.Status != "0") + //{ + // throw new Exception($"鐩爣鍌ㄤ綅鐘舵�佸紓甯�"); + //} //缁勭粐缁欏皬杞︿笅鍙戜换鍔′俊鎭� var task = new TaskDetial { @@ -1179,30 +1174,33 @@ string agvMsg = string.Empty; //缁欎笅杞︿笅鍙戜换鍔� logTaskEntry.SendDate = DateTime.Now;//鍙戦�佹椂闂� - var agvResult = CreateTaskForAgv(task, url, out agvMsg); - if (agvResult)//鎴愬姛 + //鍏堢粰璐т綅缁戝畾杞藉叿 + var bind = RcsHelper.BindPalletAndSite(logTaskEntry.PalletNo, logTaskEntry.StartLocat, bindUrl, out string agvBindMsg); + if (bind) { - //璇锋眰鎴愬姛淇敼浠诲姟琛ㄧ浉搴斿瓧娈电姸鎬� - logTaskEntry.IsSuccess = 1; - logTaskEntry.IsSend = 0; - logTaskEntry.IsCancel = 0; - logTaskEntry.BackDate = DateTime.Now; - logTaskEntry.Status = "1";//姝e湪鎵ц - Db.Insertable(logTaskEntry).ExecuteCommand(); + var agvResult = CreateTaskForAgv(task, url, out agvMsg); + if (agvResult)//鎴愬姛 + { + //璇锋眰鎴愬姛淇敼浠诲姟琛ㄧ浉搴斿瓧娈电姸鎬� + logTaskEntry.IsSuccess = 1; + logTaskEntry.IsSend = 1; + logTaskEntry.IsCancel = 1; + logTaskEntry.BackDate = DateTime.Now; + Db.Updateable(logTaskEntry).ExecuteCommand(); - startLocatInfo.Status = "3";//鍑哄簱涓� - Db.Updateable(startLocatInfo).ExecuteCommand(); + startLocatInfo.Status = "3";//鍑哄簱涓� + Db.Updateable(startLocatInfo).ExecuteCommand(); - endLocatInfo.Status = "2";//鍏ュ簱涓� - Db.Updateable(endLocatInfo).ExecuteCommand(); + endLocatInfo.Status = "2";//鍏ュ簱涓� + Db.Updateable(endLocatInfo).ExecuteCommand(); + } + else//澶辫触 + { + logTaskEntry.IsSuccess = 0; + logTaskEntry.Information = agvMsg; + Db.Updateable(logTaskEntry).ExecuteCommand(); + } } - else//澶辫触 - { - logTaskEntry.IsSuccess = 0; - logTaskEntry.Information = agvMsg; - Db.Insertable(logTaskEntry).ExecuteCommand(); - } - //娣诲姞鎿嶄綔鏃ュ織璁板綍 var k = new OperationCrServer().AddLogOperationCr("搴撳唴浣滀笟", "搴撳唴鏃ュ織", taskNo, "涓嬪彂", $"鐐瑰嚮涓嬪彂鎸夐挳銆佷换鍔″彿涓猴細{taskNo}鐨勪换鍔�", userId); Db.CommitTran(); @@ -1460,7 +1458,7 @@ //logTaskEntry.IsCancel = 0; logTaskEntry.BackDate = DateTime.Now; logTaskEntry.Status = "1";//姝e湪鎵ц - Db.Insertable(logTaskEntry).ExecuteCommand(); + Db.Updateable(logTaskEntry).ExecuteCommand(); locatInfo.Status = "5";//绉诲嚭涓� @@ -1473,7 +1471,7 @@ { logTaskEntry.IsSuccess = 0; logTaskEntry.Information = agvMsg; - Db.Insertable(logTaskEntry).ExecuteCommand(); + Db.Updateable(logTaskEntry).ExecuteCommand(); throw new Exception($"缁欏皬杞︿笅鍙戠Щ搴撲换鍔″け璐ワ紝妗跺彿锛歿palletInfoYi.PalletNo}"); } -- Gitblit v1.8.0