From d09a1552e45e6cfc8f83c0249cd296b8706c0dc2 Mon Sep 17 00:00:00 2001 From: zhaowc <526854230@qq.com> Date: 星期二, 20 五月 2025 09:33:27 +0800 Subject: [PATCH] 修改下发AGV任务接口,修改条码增加功能 --- Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs | 430 ++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 342 insertions(+), 88 deletions(-) diff --git a/Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs b/Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs index 8856889..f497068 100644 --- a/Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs +++ b/Wms/WMS.BLL/BllTransServer/HopperTransportServer.cs @@ -217,7 +217,7 @@ /// <param name="lotNo">鎵规</param> /// <param name="userId">鎿嶄綔浜�</param> /// <exception cref="Exception"></exception> - public void jiaoLiaoHopper(string areaNo,string endLocate,string plnStatus,string standard,string skuNo,string lotNo,string url,int userId) + public void jiaoLiaoHopper(string areaNo,string endLocate,string plnStatus,string standard,string skuNo,string lotNo,string url, string bindUrl, int userId) { try { @@ -306,7 +306,7 @@ { throw new Exception("鏈壘鍒板搴旀《淇℃伅"); } - resultYi = YikuTask(palletModel.PalletNo, taskNo, url); + resultYi = YikuTask(palletModel.PalletNo, taskNo, url,bindUrl); } #endregion //璧峰鍌ㄤ綅鍦板潃淇℃伅 @@ -358,29 +358,41 @@ string agvMsg = string.Empty; //缁欎笅杞︿笅鍙戜换鍔� logTaskEntry.SendDate = DateTime.Now;//鍙戦�佹椂闂� - var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); - if (agvResult)//鎴愬姛 + //涓嬪彂杞藉叿绫诲瀷 + var bind = RcsHelper.BindPalletAndSite(palletModel.PalletNo, palletModel.LocatNo, url, 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 = 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(); + startLoction.Status = "3";//鍑哄簱涓� + Db.Updateable(startLoction).ExecuteCommand(); - endLocateInfo.Status = "2";//鍏ュ簱涓� - Db.Updateable(endLocateInfo).ExecuteCommand(); + endLocateInfo.Status = "2";//鍏ュ簱涓� + Db.Updateable(endLocateInfo).ExecuteCommand(); + } + else//澶辫触 + { + logTaskEntry.IsSuccess = 0; + logTaskEntry.Information = agvMsg; + Db.Insertable(logTaskEntry).ExecuteCommand(); + } } - else//澶辫触 + else { logTaskEntry.IsSuccess = 0; - logTaskEntry.Information = agvMsg; + logTaskEntry.Information = "璐ф灦涓庤揣浣嶇粦瀹氬け璐ワ紝鍘熷洜锛�"+agvBindMsg; Db.Insertable(logTaskEntry).ExecuteCommand(); } + } //鎻愪氦浜嬪姟 Db.CommitTran(); @@ -405,7 +417,7 @@ /// <param name="lotNo">鎵规</param> /// <param name="userId">鎿嶄綔浜�</param> /// <exception cref="Exception"></exception> - public void jiaoCheHopper(string areaNo, string StartLocate, string plnNo, string plnStatus, decimal weight, string skuNo, string lotNo, string url,int userId) + public void jiaoCheHopper(string areaNo, string StartLocate, string plnNo, string plnStatus, decimal weight, string skuNo, string lotNo, string url,string bindUrl,int userId) { try { @@ -550,29 +562,42 @@ string agvMsg = string.Empty; //缁欎笅杞︿笅鍙戜换鍔� logTaskEntry.SendDate = DateTime.Now;//鍙戦�佹椂闂� - var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); - if (agvResult)//鎴愬姛 + //涓嬪彂杞藉叿涓庤揣浣嶇粦瀹� + var bind = RcsHelper.BindPalletAndSite(plnNo, StartLocate, 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 = 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(); + startLoction.Status = "3";//鍑哄簱涓� + Db.Updateable(startLoction).ExecuteCommand(); - endLocatInfo.Status = "2";//鍏ュ簱涓� - Db.Updateable(endLocatInfo).ExecuteCommand(); + endLocatInfo.Status = "2";//鍏ュ簱涓� + Db.Updateable(endLocatInfo).ExecuteCommand(); + } + else//澶辫触 + { + logTaskEntry.IsSuccess = 0; + logTaskEntry.Information = agvMsg; + Db.Insertable(logTaskEntry).ExecuteCommand(); + } + } - else//澶辫触 + else { logTaskEntry.IsSuccess = 0; - logTaskEntry.Information = agvMsg; + logTaskEntry.Information = "璐ф灦涓庤揣浣嶇粦瀹氬け璐ワ紝鍘熷洜锛�"+agvBindMsg; Db.Insertable(logTaskEntry).ExecuteCommand(); } + //鎻愪氦浜嬪姟 Db.CommitTran(); @@ -689,6 +714,10 @@ stockDetail.Status = "0";//寰呭垎閰� stockDetail.InspectStatus = "0";//寰呮楠� } + else if (endAreaInfo.Type == "4")//璁惧鍖� + { + + } //淇敼搴撳瓨鏄庣粏 Db.Updateable(stockDetail).ExecuteCommand(); @@ -716,8 +745,192 @@ } } + /// <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,string bindUrl) + { + 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;//鍙《璁惧鎵�灞炶溅闂寸紪鍙� - private bool YikuTask(string palletNo, string taskNo, string url) + 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 bind = RcsHelper.BindPalletAndSite(palletModel.PalletNo, palletModel.LocatNo, bindUrl, out string agvBindMsg); + if (bind) + { + 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(); + } + } + else + { + logTaskEntry.IsSuccess = 0; + logTaskEntry.Information = agvBindMsg; + 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,string bindUrl) { try { @@ -809,33 +1022,47 @@ string agvMsg = string.Empty; //缁欎笅杞︿笅鍙戜换鍔� logTaskEntry.SendDate = DateTime.Now;//鍙戦�佹椂闂� - var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70"); - if (agvResult)//鎴愬姛 + //涓嬪彂杞藉叿涓庤揣浣嶇粦瀹� + var bind = RcsHelper.BindPalletAndSite(palletInfoYi.LocatNo, palletInfoYi.PalletNo, 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 = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70"); + if (agvResult)//鎴愬姛 + { + //璇锋眰鎴愬姛淇敼浠诲姟琛ㄧ浉搴斿瓧娈电姸鎬� + logTaskEntry.IsSuccess = 1; + logTaskEntry.IsSend = 0; + //logTaskEntry.IsCancel = 0; + logTaskEntry.BackDate = DateTime.Now; + logTaskEntry.Status = "1";//姝e湪鎵ц + Db.Insertable(logTaskEntry).ExecuteCommand(); - //淇敼绉诲嚭鍌ㄤ綅鐘舵�� - locatInfo.Status = "5";//绉诲嚭涓� - Db.Updateable(locatInfo).ExecuteCommand(); + //淇敼绉诲嚭鍌ㄤ綅鐘舵�� + locatInfo.Status = "5";//绉诲嚭涓� + Db.Updateable(locatInfo).ExecuteCommand(); - //淇敼绉诲叆鍌ㄤ綅鐘舵�� - transferLocat.Status = "4";//绉诲叆涓� - Db.Updateable(transferLocat).ExecuteCommand(); + //淇敼绉诲叆鍌ㄤ綅鐘舵�� + transferLocat.Status = "4";//绉诲叆涓� + Db.Updateable(transferLocat).ExecuteCommand(); + } + else//澶辫触 + { + logTaskEntry.IsSuccess = 0; + logTaskEntry.Information = agvMsg; + Db.Insertable(logTaskEntry).ExecuteCommand(); + + throw new Exception($"缁欏皬杞︿笅鍙戠Щ搴撲换鍔″け璐ワ紝妗跺彿锛歿palletInfoYi.PalletNo}"); + } } - else//澶辫触 + else { logTaskEntry.IsSuccess = 0; - logTaskEntry.Information = agvMsg; + logTaskEntry.Information = agvBindMsg; Db.Insertable(logTaskEntry).ExecuteCommand(); throw new Exception($"缁欏皬杞︿笅鍙戠Щ搴撲换鍔″け璐ワ紝妗跺彿锛歿palletInfoYi.PalletNo}"); } + } } return true; @@ -851,7 +1078,7 @@ /// <param name="taskNo"></param> /// <param name="url"></param> /// <exception cref="Exception"></exception> - public void OutBinAgv(string taskNo,string url) + public void OutBinAgv(string taskNo,string url, string bindUrl) { try { @@ -904,33 +1131,47 @@ string agvMsg = string.Empty; //缁欎笅杞︿笅鍙戜换鍔� logTaskInfoZ.SendDate = DateTime.Now;//鍙戦�佹椂闂� - var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70"); - if (agvResult)//鎴愬姛 + //涓嬪彂杞藉叿涓庤揣浠粦瀹� + var bind = RcsHelper.BindPalletAndSite(logTaskInfoZ.PalletNo, logTaskInfoZ.StartLocat, bindUrl, out string agvBindMsg); + if (bind) { - //璇锋眰鎴愬姛淇敼浠诲姟琛ㄧ浉搴斿瓧娈电姸鎬� - logTaskInfoZ.IsSuccess = 1; - logTaskInfoZ.IsSend = 0; - //logTaskEntry.IsCancel = 0; - logTaskInfoZ.BackDate = DateTime.Now; - logTaskInfoZ.Status = "1";//姝e湪鎵ц - Db.Insertable(logTaskInfoZ).ExecuteCommand(); + var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg, "70"); + if (agvResult)//鎴愬姛 + { + //璇锋眰鎴愬姛淇敼浠诲姟琛ㄧ浉搴斿瓧娈电姸鎬� + logTaskInfoZ.IsSuccess = 1; + logTaskInfoZ.IsSend = 0; + //logTaskEntry.IsCancel = 0; + logTaskInfoZ.BackDate = DateTime.Now; + logTaskInfoZ.Status = "1";//姝e湪鎵ц + Db.Insertable(logTaskInfoZ).ExecuteCommand(); - //淇敼绉诲嚭鍌ㄤ綅鐘舵�� - startLocatInfoZ.Status = "5";//绉诲嚭涓� - Db.Updateable(startLocatInfoZ).ExecuteCommand(); + //淇敼绉诲嚭鍌ㄤ綅鐘舵�� + startLocatInfoZ.Status = "5";//绉诲嚭涓� + Db.Updateable(startLocatInfoZ).ExecuteCommand(); - //淇敼绉诲叆鍌ㄤ綅鐘舵�� - endLocatInfoZ.Status = "4";//绉诲叆涓� - Db.Updateable(endLocatInfoZ).ExecuteCommand(); + //淇敼绉诲叆鍌ㄤ綅鐘舵�� + endLocatInfoZ.Status = "4";//绉诲叆涓� + Db.Updateable(endLocatInfoZ).ExecuteCommand(); + } + else//澶辫触 + { + logTaskInfoZ.IsSuccess = 0; + logTaskInfoZ.Information = agvMsg; + Db.Insertable(logTaskInfoZ).ExecuteCommand(); + + throw new Exception($"缁欏皬杞︿笅鍙戠Щ搴撲换鍔″け璐ワ紝妗跺彿锛歿logTaskInfoZ.PalletNo}"); + } } - else//澶辫触 + else { logTaskInfoZ.IsSuccess = 0; - logTaskInfoZ.Information = agvMsg; + logTaskInfoZ.Information = agvBindMsg; Db.Insertable(logTaskInfoZ).ExecuteCommand(); throw new Exception($"缁欏皬杞︿笅鍙戠Щ搴撲换鍔″け璐ワ紝妗跺彿锛歿logTaskInfoZ.PalletNo}"); } + } } catch (Exception e) @@ -946,7 +1187,7 @@ /// </summary> /// <param name="url"></param> /// <exception cref="Exception"></exception> - public void TransferBackTimer(string url) + public void TransferBackTimer(string url,string bindUrl) { try { @@ -1021,34 +1262,47 @@ string agvMsg = string.Empty; //缁欎笅杞︿笅鍙戜换鍔� logTaskEntry.SendDate = DateTime.Now;//鍙戦�佹椂闂� - var agvResult = RcsHelper.CreateTaskForAgv(task, url, out agvMsg); - if (agvResult)//鎴愬姛 + //涓嬪彂杞藉叿涓庤揣浣嶇粦瀹� + var bind = RcsHelper.BindPalletAndSite(detailInfo.PalletNo, detailInfo.LocatNo, 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 = 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(); - //淇敼绉诲嚭鍌ㄤ綅鐘舵�� - locatModel.Status = "5";//绉诲嚭涓� - Db.Updateable(locatModel).ExecuteCommand(); + //淇敼绉诲嚭鍌ㄤ綅鐘舵�� + locatModel.Status = "5";//绉诲嚭涓� + Db.Updateable(locatModel).ExecuteCommand(); - //淇敼绉诲叆鍌ㄤ綅鐘舵�� - endLocatInfo.Status = "4";//绉诲叆涓� - Db.Updateable(endLocatInfo).ExecuteCommand(); + //淇敼绉诲叆鍌ㄤ綅鐘舵�� + endLocatInfo.Status = "4";//绉诲叆涓� + Db.Updateable(endLocatInfo).ExecuteCommand(); + } + else//澶辫触 + { + logTaskEntry.IsSuccess = 0; + logTaskEntry.Information = agvMsg; + Db.Insertable(logTaskEntry).ExecuteCommand(); + + throw new Exception($"缁欏皬杞︿笅鍙戠Щ搴撲换鍔″け璐ワ紝妗跺彿锛歿detailInfo.PalletNo}"); + } } - else//澶辫触 + else { logTaskEntry.IsSuccess = 0; - logTaskEntry.Information = agvMsg; + logTaskEntry.Information = agvBindMsg; Db.Insertable(logTaskEntry).ExecuteCommand(); throw new Exception($"缁欏皬杞︿笅鍙戠Щ搴撲换鍔″け璐ワ紝妗跺彿锛歿detailInfo.PalletNo}"); } - + } } //鎻愪氦浜嬪姟 -- Gitblit v1.8.0