From d9af58da144ca8e636881b427b4489bc9cd54371 Mon Sep 17 00:00:00 2001 From: zhaowc <526854230@qq.com> Date: 星期一, 20 一月 2025 08:31:38 +0800 Subject: [PATCH] 修改机器人拆垛请求分配时的判断 --- Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs | 108 ++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 72 insertions(+), 36 deletions(-) diff --git a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs index 9cb3aac..5c6687e 100644 --- a/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs +++ b/Wms/WMS.BLL/BllSoServer/ExportNoticeServer.cs @@ -1758,7 +1758,7 @@ if (isChai == "0") { var boxInfo = Db.Queryable<DataBoxInfo>().Where(w => w.IsDel == "0" && w.PalletNo == item.PalletNo && w.BitBoxMark == "1").ToList(); - if (boxInfo != null)//鎵樼洏涓婃湁闆剁闇�瑕佹媶绠� + if (boxInfo.Count>0)//鎵樼洏涓婃湁闆剁闇�瑕佹媶绠� { isChai = "1"; unstackingMode2 = "1";//闇�瑕佹媶绠遍渶璧癙DA鎷嗗灈 @@ -2395,24 +2395,22 @@ //娣诲姞鎿嶄綔鏃ュ織璁板綍 var k = new OperationSOServer().AddLogOperationSo("鍑哄簱浣滀笟", "鍑哄簱鏃ュ織", TtaskNo, "瀹屾垚", $"鐐瑰嚮瀹屾垚鎸夐挳銆佸畬鎴愪换鍔″彿涓猴細{TtaskNo}鐨勪换鍔�", userId); } - if (outLine != "") + if (outLine != "" && outLine != "009" && outLine != "013" && outLine != "018" && outLine != "022") { #region 鍒嗛厤鍑哄簱鐩殑浣� - string positionStart = outLine, positionEnd = "" ,type ="D00"; + string positionStart = outLine, positionEnd = "", type = "D00"; var type1 = Db.Queryable<BllExportNotice>().Where(m => m.SONo == allot.First().SONo && m.IsDel == "0" && m.Status == "3").First(); if (type1 == null) { var locateno = Db.Queryable<SysStorageLocat>().Where(m => m.AreaNo == "B13").ToList(); - type = "D02" ; //绌烘墭鐩樺灈鍑哄簱 - if (outLine == "443")//瑗夸晶鍑哄簱 + type = "D02"; //绌烘墭鐩樺灈鍑哄簱 + if (outLine == "443")//瑗夸晶鍑哄簱 { - positionEnd = locateno.First(m => m.LocatNo.Substring(3, 2) == "01" && m.LocatNo.Substring(3, 2) == "02" && m.LocatNo.Substring(3, 2) == "03" && - m.Status == "0" && m.Flag == "0").LocatNo; + positionEnd = locateno.First(m => m.Row == 1 && m.Status == "0" && m.Flag == "0").LocatNo; } else if (outLine == "440") //涓滀晶鍑哄簱 { - positionEnd = locateno.First(m => m.LocatNo.Substring(4, 2) == "04" && m.LocatNo.Substring(4, 2) == "05" && m.LocatNo.Substring(4, 2) == "06" && - m.Status == "0" && m.Flag == "0").LocatNo; //涓滀晶鎴块棿搴撲綅 + positionEnd = locateno.First(m => m.Row == 2 && m.Status == "0" && m.Flag == "0").LocatNo; //涓滀晶鎴块棿搴撲綅 } else //1妤肩┖鎵樼洏鍑哄簱涓嶈皟鐢ˋGV { @@ -2421,31 +2419,34 @@ } } - if (type1.Type == "1" && (type1.Type == "5" || (positionStart == "440" && positionStart == "440"))) //3妤奸鏂欏嚭搴� /3L涓棿鍝佸嚭搴� - { - var locateno = Db.Queryable<SysStorageLocat>().Where(m => m.AreaNo == "B11").ToList(); - if (outLine == "443")//瑗夸晶鍑哄簱 + else + { + if (type1.Type == "1" || (type1.Type == "5" && (positionStart == "440" || positionStart == "443"))) //3妤奸鏂欏嚭搴� /3L涓棿鍝佸嚭搴� { - positionEnd = locateno.First(m => m.LocatNo.Substring(3, 2) == "01"&& m.LocatNo.Substring(4, 2) == "02" && m.Status == "0" && m.Flag == "0").LocatNo; //瑗夸晶鎴块棿搴撲綅 - } - else if(outLine == "440") //涓滀晶鍑哄簱 - { - positionEnd = locateno.First(m => m.LocatNo.Substring(3, 2) == "03" && m.LocatNo.Substring(4, 2) == "04" && m.LocatNo.Substring(4, 2) == "05" && - m.LocatNo.Substring(4, 2) == "06" && m.LocatNo.Substring(3, 2) == "07" && m.Status == "0" && m.Flag == "0").LocatNo; //涓滀晶鎴块棿搴撲綅 - } - } - else if (type1.Type == "2" && type1.Type == "3") //鎶芥鍑哄簱 /鍙栨牱鍑哄簱 - { - positionEnd = Db.Queryable<SysStorageLocat>().First(m => m.AreaNo == "B04" && m.Status == "0" && m.Flag == "0").LocatNo; - } - else if (type1.Type == "4")//涓嶅悎鏍煎搧鍑哄簱 - { + var locateno = Db.Queryable<SysStorageLocat>().Where(m => m.AreaNo == "B11").ToList(); + if (outLine == "443")//瑗夸晶鍑哄簱 + { - positionEnd = Db.Queryable<SysStorageLocat>().First(m => m.AreaNo == "B03" && m.Status == "0" && m.Flag == "0").LocatNo; - } - else //鍏朵粬鍗曟嵁绫诲瀷閮藉瓨鏀惧彂璐х紦瀛樺尯 - { - positionEnd = Db.Queryable<SysStorageLocat>().First(m => m.AreaNo == "B02" && m.Status == "0" && m.Flag == "0").LocatNo; + positionEnd = locateno.OrderBy(m => m.LocatNo).First(m => m.Row == 1 && m.Status == "0" && m.Flag == "0").LocatNo; //瑗夸晶鎴块棿搴撲綅鍜屽闈㈡埧闂� + } + else if (outLine == "440") //涓滀晶鍑哄簱 + { + positionEnd = locateno.OrderBy(m => m.LocatNo).First(m => m.Row == 2 && m.Status == "0" && m.Flag == "0").LocatNo; //涓滀晶鎴块棿搴撲綅 + } + } + else if (type1.Type == "2" || type1.Type == "3") //鎶芥鍑哄簱 /鍙栨牱鍑哄簱 + { + positionEnd = Db.Queryable<SysStorageLocat>().OrderBy(m=>m.LocatNo).First(m => m.AreaNo == "B04" && m.Status == "0" && m.Flag == "0").LocatNo; + } + else if (type1.Type == "4")//涓嶅悎鏍煎搧鍑哄簱 + { + + positionEnd = Db.Queryable<SysStorageLocat>().OrderBy(m => m.LocatNo).First(m => m.AreaNo == "B03" && m.Status == "0" && m.Flag == "0").LocatNo; + } + else //鍏朵粬鍗曟嵁绫诲瀷閮藉瓨鏀惧彂璐х紦瀛樺尯 + { + positionEnd = Db.Queryable<SysStorageLocat>().OrderBy(m => m.LocatNo).First(m => m.AreaNo == "B02" && m.Status == "0" && m.Flag == "0").LocatNo; + } } #endregion @@ -2500,6 +2501,41 @@ LogFile.SaveLogToFile($"AGV浠诲姟鍙嶉鎵ц閫氱煡锛�( {jsonData} ),", logStr); } + #endregion + + #region 娣诲姞鍑哄簱浠诲姟淇℃伅 + + var taskNonew = new Common().GetMaxNo("TK"); + var exTask = new LogTask //灏忚溅绉诲簱浠诲姟 + { + TaskNo = TtaskNo, + Sender = "WMS", + Receiver = "AGV", + IsSuccess = 1, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛 + + StartLocat = positionStart,//璧峰浣嶇疆 + EndLocat = positionEnd,//鐩爣浣嶇疆 + PalletNo = task.PalletNo,//鎵樼洏鐮� + IsSend = 1,//鏄惁鍙啀娆′笅鍙� + IsCancel = 1,//鏄惁鍙彇娑� + IsFinish = 1,//鏄惁鍙畬鎴� + Type = "2",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟 + Status = "1",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚 + OrderType = "3",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗� + CreateTime = DateTime.Now, //鍒涘缓鏃堕棿 + CreateUser = userId, //鍒涘缓浜� + Msg = "灏忚溅浠�" + positionStart + "鍒�" + positionEnd + "鐨勭Щ搴撲换鍔�", //鍏抽敭淇℃伅 + //FinishDate = serverTime, //瀹屾垚鏃堕棿 + }; + Db.Insertable(exTask).ExecuteCommand(); + + #endregion + + #region 鍌ㄤ綅鐘舵�佸彉鏇� + //鏇存敼鍌ㄤ綅鐘舵�佷负鍑哄簱涓� + var locat = Db.Queryable<SysStorageLocat>().First(m => m.LocatNo == positionEnd); + locat.Status = "4"; //4 绉诲叆涓� + Db.Updateable(locat).ExecuteCommand();//淇敼鍌ㄤ綅淇℃伅 #endregion } Db.CommitTran(); @@ -3660,7 +3696,7 @@ } } var boxInfo = Db.Queryable<DataBoxInfo>().Where(w => w.IsDel == "0" && w.PalletNo == item.PalletNo && w.BitBoxMark == "1").ToList(); - if (boxInfo != null)//鎵樼洏涓婃湁闆剁闇�瑕佹媶绠� + if (boxInfo.Count>0)//鎵樼洏涓婃湁闆剁闇�瑕佹媶绠� { result = "1";//闇�瑕佹媶绠� break; @@ -3753,14 +3789,14 @@ try { // 鍒ゆ柇褰撳墠浠诲姟鐘舵�� Status 1:姝e湪鎵ц 3:寮傚父缁撴潫 - var taskModel = Db.Queryable<LogTask>().First(m => m.TaskNo == model.TaskNo && m.IsDel == "0" && m.Status == "1"); + var taskModel = Db.Queryable<LogTask>().First(m => m.TaskNo == model.TaskNo && m.IsDel == "0" ); if (taskModel == null) { throw new Exception("姝や换鍔′笉瀛樺湪鎴栦换鍔$姸鎬佸凡鍙樻洿!"); } // 楠岃瘉鎵樼洏鍒嗛厤淇℃伅 - var palletBindModel = Db.Queryable<BllExportAllot>().First(m => m.PalletNo == model.PalletNo && m.TaskNo == model.TaskNo && m.IsDel == "0" && m.Status == "1"); - if (palletBindModel != null) + var palletBindModel = Db.Queryable<BllExportAllot>().First(m => m.PalletNo == model.PalletNo && m.TaskNo == model.TaskNo && m.IsDel == "0" && m.Status == "2"); + if (palletBindModel == null) { throw new Exception("鏈壘鍒板綋鍓嶆墭鐩樺垎閰嶄换鍔′俊鎭�!"); } -- Gitblit v1.8.0