From 1ec3de8254a3dc8d77f01283ab4d85f52d446192 Mon Sep 17 00:00:00 2001 From: wxw <Administrator@DESKTOP-5BIMHQ3> Date: 星期五, 09 五月 2025 08:00:59 +0800 Subject: [PATCH] Merge branch 'master' into wxw --- Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 176 insertions(+), 0 deletions(-) diff --git a/Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs b/Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs index 8856889..67ed85e 100644 --- a/Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs +++ b/Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs @@ -689,6 +689,10 @@ stockDetail.Status = "0";//寰呭垎閰� stockDetail.InspectStatus = "0";//寰呮楠� } + else if (endAreaInfo.Type == "4")//璁惧鍖� + { + + } //淇敼搴撳瓨鏄庣粏 Db.Updateable(stockDetail).ExecuteCommand(); @@ -716,6 +720,178 @@ } } + /// <summary> + /// 娓呮礂鏈哄彨鏂欑姸鎬� + /// </summary> + /// <param name="deviceID">娓呮礂鏈虹紪鍙�</param> + /// <param name="deviceStation">鍙枡鐐逛綅锛氣�漣nput鈥�-鍏ュ彛锛堝彨鑴忔《锛夛紝鈥漮utput鈥�-鍑哄彛锛堝噣妗剁敵璇峰偍浣嶏級</param> + /// <param name="status"></param> + /// <exception cref="Exception"></exception> + public void RCSCleanRequest(string deviceID,string deviceStation,string status,string url) + { + try + { + if (string.IsNullOrEmpty(deviceID)) + { + throw new Exception("娓呮礂鏈虹紪鍙蜂笉鑳戒负绌�"); + } + if (status != "1") + { + throw new Exception("闈炲彨鏂欑姸鎬�"); + } + //閫氳繃璁惧鍙锋煡鎵惧埌鎵�灞炶澶囷紙鍖哄煙锛� + var deviceInfo = Db.Queryable<SysStorageArea>().First(w => w.IsDel == "0" && w.DeviceCode == deviceID); + if (deviceInfo == null) + { + throw new Exception("璁惧淇℃伅涓嶅瓨鍦�"); + } + var houseNo = deviceInfo.WareHouseNo;//鍙《璁惧鎵�灞炶溅闂寸紪鍙� + + var startLoction = new SysStorageLocat();//璧峰鍌ㄤ綅淇℃伅 + var endLoction = new SysStorageLocat();//鐩爣鍌ㄤ綅淇℃伅 + var palletModel = new DataStockDetail();//鍒嗛厤妗朵俊鎭� + + //寮�鍚簨鍔� + Db.BeginTran(); + + //鍙枡鐐逛綅 + switch (deviceStation) + { + case "input"://鍙剰妗� + //鍙《璁惧鎵�鍦ㄥ偍浣嶄俊鎭紙鐩爣鍌ㄤ綅锛� + endLoction = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.WareHouseNo == houseNo && w.AreaNo == deviceInfo.AreaNo); + + // 鎵�鏈夊緟鍒嗛厤鐨勮剰妗� + var stockDetail = Db.Queryable<DataStockDetail>().Where(w => w.Status == "0" && w.PalletStatus == "3"); + + //浼樺厛鏌ユ壘鑴忔《缂撳瓨杞﹂棿 + palletModel = stockDetail.Where(w => w.AreaNo == "C43").OrderByDescending(o => o.UpdateTime).First(); + if (palletModel == null)//鑴忔《缂撳瓨杞﹂棿娌℃湁鑴忔《锛屽啀浠庝笁妤间腑闂寸珯鑴忔《鍖烘煡鎵� + { + palletModel = stockDetail.Where(w =>w.WareHouseNo=="M16" && w.AreaNo == "C26").OrderByDescending(o => o.UpdateTime).First(); + } + if (palletModel == null)//涓夋ゼ涓棿绔欒剰妗跺尯娌℃湁鑴忔《锛屽啀浠庡洓妤间腑闂寸珯鑴忔《鍖烘煡鎵� + { + palletModel = stockDetail.Where(w => w.WareHouseNo == "M01" && w.AreaNo == "C03").OrderByDescending(o => o.UpdateTime).First(); + } + if (palletModel == null) + { + throw new Exception("鏃犺剰妗跺彲鍒嗛厤"); + } + //璧峰鍌ㄤ綅鍦板潃淇℃伅 + startLoction = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.Status == "1" && w.LocatNo == palletModel.LocatNo); + if (startLoction == null) + { + throw new Exception($"璧峰鐩爣鍌ㄤ綅淇℃伅涓嶅瓨鍦紝妗跺彿锛歿palletModel.LocatNo}"); + } + + break; + + case "output"://鍑�妗剁敵璇峰偍浣� + //鍙《璁惧鎵�鍦ㄥ偍浣嶄俊鎭紙璧峰鍌ㄤ綅锛� + startLoction = Db.Queryable<SysStorageLocat>().First(w => w.IsDel == "0" && w.WareHouseNo == houseNo && w.AreaNo == deviceInfo.AreaNo); + //妗朵俊鎭� + palletModel = Db.Queryable<DataStockDetail>().Where(w => w.WareHouseNo==houseNo && w.AreaNo==deviceInfo.AreaNo && w.LocatNo==startLoction.LocatNo).First(); + if (palletModel == null) + { + throw new Exception("鏈煡璇㈠埌鍑�妗朵俊鎭�"); + } + //鍒嗛厤鍌ㄤ綅 + //浼樺厛鍒嗛厤鍥涙ゼ涓棿绔欏噣妗跺尯 + endLoction= Db.Queryable<SysStorageLocat>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Flag == "0" + && w.WareHouseNo == "M01" && w.AreaNo == "C01") + .OrderBy(o => o.Row).OrderByDescending(o => o.Column).First(); + if (endLoction == null)//鍥涙ゼ涓棿绔欏噣妗跺尯娌℃湁绌哄偍浣嶏紝鍐嶄粠涓夋ゼ涓棿绔欏噣妗跺尯鏌ユ壘 + { + endLoction = Db.Queryable<SysStorageLocat>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Flag == "0" + && w.WareHouseNo == "M16" && w.AreaNo == "C24") + .OrderBy(o => o.Row).OrderByDescending(o => o.Column).First(); + } + if (endLoction == null)//涓夋ゼ涓棿绔欏噣妗跺尯娌℃湁绌哄偍浣嶏紝鍐嶄粠涓夋ゼ娓呮礂闂寸紦瀛樺尯鏌ユ壘 + { + endLoction = Db.Queryable<SysStorageLocat>().Where(w => w.IsDel == "0" && w.Status == "0" && w.Flag == "0" + && w.WareHouseNo == "M44" && w.AreaNo == "C55") + .OrderBy(o => o.Row).OrderByDescending(o => o.Column).First(); + } + if (endLoction == null) + { + throw new Exception("鏈煡璇㈠埌鍚堥�傚偍浣�"); + } + break; + + default: + throw new Exception("鍙枡鐐逛綅寮傚父"); + + } + var taskNo = new Common().GetMaxNo("TK"); + //娣诲姞浠诲姟 + var logTaskEntry = new LogTask + { + TaskNo = taskNo, + Sender = "WMS", + Receiver = "RCS", + IsSuccess = 0, //鏄惁涓嬪彂鎴愬姛 0澶辫触 1鎴愬姛 + + StartLocat = "",//璧峰浣嶇疆 + EndLocat = endLoction.LocatNo,//鐩爣浣嶇疆 + PalletNo = "",//鎵樼洏鐮� + IsSend = 1,//鏄惁鍙啀娆′笅鍙� + IsCancel = 1,//鏄惁鍙彇娑� + IsFinish = 1,//鏄惁鍙畬鎴� + Type = "1",//浠诲姟绫诲瀷 0 鍏ュ簱浠诲姟 1 鍑哄簱浠诲姟 2 绉诲簱浠诲姟 + Status = "0",//浠诲姟鐘舵��0锛氱瓑寰呮墽琛�1姝e湪鎵ц2鎵ц瀹屾垚 + OrderType = "3",//0 鍏ュ簱鍗� 1 鍑哄簱鍗� 2 鐩樼偣鍗� 3 绉诲簱鍗� + + CreateTime = DateTime.Now + }; + Db.Insertable(logTaskEntry).ExecuteCommand(); + + //缁勭粐涓嬪彂灏忚溅浠诲姟淇℃伅 + var task = new TaskDetial + { + Taskno = taskNo,//浠诲姟鍙� + Startport = palletModel.LocatNo,//璧峰浣嶇疆 + Endport = endLoction.LocatNo,//鐩爣浣嶇疆 + Pallno = palletModel.PalletNo,//妗跺彿 + Crtype = "1",//鍙《 + }; + + string agvMsg = string.Empty; + //缁欎笅杞︿笅鍙戜换鍔� + logTaskEntry.SendDate = DateTime.Now;//鍙戦�佹椂闂� + var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); + if (agvResult)//鎴愬姛 + { + //璇锋眰鎴愬姛淇敼浠诲姟琛ㄧ浉搴斿瓧娈电姸鎬� + logTaskEntry.IsSuccess = 1; + logTaskEntry.IsSend = 0; + //logTaskEntry.IsCancel = 0; + logTaskEntry.BackDate = DateTime.Now; + logTaskEntry.Status = "1";//姝e湪鎵ц + Db.Insertable(logTaskEntry).ExecuteCommand(); + + startLoction.Status = "3";//鍑哄簱涓� + Db.Updateable(startLoction).ExecuteCommand(); + + endLoction.Status = "2";//鍏ュ簱涓� + Db.Updateable(endLoction).ExecuteCommand(); + } + else//澶辫触 + { + logTaskEntry.IsSuccess = 0; + logTaskEntry.Information = agvMsg; + Db.Insertable(logTaskEntry).ExecuteCommand(); + } + //鎻愪氦浜嬪姟 + Db.CommitTran(); + } + catch (Exception e) + { + //鍥炴粴浜嬪姟 + Db.RollbackTran(); + throw new Exception(e.Message); + } + } private bool YikuTask(string palletNo, string taskNo, string url) { -- Gitblit v1.8.0