From adf52922fbe13bc6c164b5dafeb0e445ca2f214f Mon Sep 17 00:00:00 2001 From: zhaowc <526854230@qq.com> Date: 星期五, 17 一月 2025 14:15:52 +0800 Subject: [PATCH] WCS返回出库完成信号 更改 --- Wms/Wms/Controllers/DownApiController.cs | 271 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 files changed, 250 insertions(+), 21 deletions(-) diff --git a/Wms/Wms/Controllers/DownApiController.cs b/Wms/Wms/Controllers/DownApiController.cs index 0640314..d1d9bb1 100644 --- a/Wms/Wms/Controllers/DownApiController.cs +++ b/Wms/Wms/Controllers/DownApiController.cs @@ -14,6 +14,10 @@ using WMS.IBLL.ILogServer; using Wms.Tools; using System.Collections.Generic; +using Model.ModelVm.PdaVm; +using WMS.IBLL.IPdaServer; +using Model.ModelVm; +using WMS.IBLL.IDataServer; namespace Wms.Controllers { @@ -29,13 +33,20 @@ private readonly IPalletBindServer _asnPalletBindSvc;//鎵樼洏缁戝畾Svc private readonly IStockCheckServer _crCheckSvc;//鎵樼洏缁戝畾Svc private readonly ITaskServer _taskSvc;//浠诲姟Svc - public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc) + private readonly IPdaSoServer _pdaSoSvc;//绌烘墭鍑哄簱Svc + private readonly IPdaAsnServer _paAsnSvc;//绌烘墭璺虹粦瀹� + private readonly IStockServer _stockSvc;//AGV浠诲姟瀹屾垚绠� + + public DownApiController(IOptions<ApiUrlConfig> setting, IExportNoticeServer exNoticeSvc, IPalletBindServer asnPalletBindSvc, IStockCheckServer crCheckSvc, ITaskServer taskSvc, IPdaSoServer pdaSoSvc,IPdaAsnServer paAsnSvc,IStockServer stockSvc) { _config = setting.Value; _exNoticeSvc = exNoticeSvc; _asnPalletBindSvc = asnPalletBindSvc; _crCheckSvc = crCheckSvc; _taskSvc = taskSvc; + _pdaSoSvc = pdaSoSvc; + _paAsnSvc = paAsnSvc; + _stockSvc = stockSvc; } #region WMS鎺ュ彛 璋冪敤涓嬫父绯荤粺鎺ュ彛 @@ -220,10 +231,10 @@ var list = _asnPalletBindSvc.RequestRoadWayModel(model.PalletNo, model.HouseNo); LogFile.SaveLogToFile($"WCS鐢宠宸烽亾杩斿洖锛�( {JsonConvert.SerializeObject(list)} ),", logStr); - new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鍏ュ簱鏃ュ織", model.PalletNo.Substring(0, 8), - "鐢宠宸烽亾", $"鐢宠宸烽亾鎵樼洏鍙凤細{model.PalletNo.Substring(0, 8)}鐨勬垚鍔熶俊鎭�", 2); + new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鍏ュ簱鏃ュ織", model.PalletNo, + "鐢宠宸烽亾", $"鐢宠宸烽亾鎵樼洏鍙凤細{model.PalletNo}鐨勬垚鍔熶俊鎭�", 2); - return Ok(new { Success = 0, Message = "鐢宠鍌ㄤ綅鎴愬姛", TaskList = list }); + return Ok(new { Success = 0, Message = "鐢宠宸烽亾鎴愬姛", TaskList = list }); } else { @@ -234,15 +245,15 @@ new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鍏ュ簱鏃ュ織", model.PalletNo.Substring(0, 8), "鐢宠宸烽亾", $"鐢宠宸烽亾鎵樼洏鍙凤細{model.PalletNo.Substring(0, 8)}鐨勬垚鍔熶俊鎭�", 2); - return Ok(new { Success = 0, Message = "鐢宠鍌ㄤ綅鎴愬姛", TaskList = list }); + return Ok(new { Success = 0, Message = "鐢宠宸烽亾鎴愬姛", TaskList = list }); } } catch (Exception e) { LogFile.SaveLogToFile($"WCS鐢宠宸烽亾杩斿洖锛�( {e.Message} ),", logStr); - new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鍏ュ簱鏃ュ織", model.PalletNo.Substring(0, 8), - "鐢宠宸烽亾", $"鐢宠宸烽亾鎵樼洏鍙凤細{model.PalletNo.Substring(0, 8)}鐨勫け璐ヤ俊鎭�", 2); + new OperationASNServer().AddLogOperationAsn("鍏ュ簱浣滀笟", "鍏ュ簱鏃ュ織", model.PalletNo, + "鐢宠宸烽亾", $"鐢宠宸烽亾鎵樼洏鍙凤細{model.PalletNo}鐨勫け璐ヤ俊鎭�", 2); return Ok(new ErpModel { Success = -1, Message = e.Message }); } @@ -297,12 +308,12 @@ string pallet = model.PalletNo.Substring(0, 8); OutCommandDto list; if (model.TaskModel == "1") - { - list = _asnPalletBindSvc.RequestLocation(pallet, model.HouseNo, model.RoadwayNo); + { + list = _asnPalletBindSvc.RequestLocationModel(pallet, model.HouseNo, model.RoadwayNo); } else { - list = _asnPalletBindSvc.RequestLocationModel(pallet, model.HouseNo, model.RoadwayNo); + list = _asnPalletBindSvc.RequestLocation(pallet, model.HouseNo, model.RoadwayNo); } if (model.PalletNo.Length == 9) @@ -353,20 +364,20 @@ } //鎺ユ敹鏃堕棿 var time1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - var orderType = _taskSvc.GetTaskOrderType(model.TaskNo);// 鍒ゆ柇鍗曟嵁绫诲瀷鍏ュ嚭绉� + var orderType = _taskSvc.GetTaskOrderType(model.TaskNo,model.TaskType);// 鍒ゆ柇鍗曟嵁绫诲瀷鍏ュ嚭绉� switch (orderType) { case "0"://鍏ュ簱瀹屾垚浠诲姟 if (model.TaskType == "0")//0锛氬叆搴� 1锛氬嚭搴� 2锛氱Щ搴� { _asnPalletBindSvc.ArrivalSuccess(model.TaskNo, 0); - return Ok(new WcsModel { StatusCode = 0, Msg = "鍏ュ簱瀹屾垚" }); + return Ok(new WcsModel { StatusCode = 0, Msg = "鍏ュ簱瀹屾垚" }); } break; case "1"://鍑哄簱瀹屾垚浠诲姟 if (model.TaskType == "1")//0锛氬叆搴� 1锛氬嚭搴� 2锛氱Щ搴� { - _exNoticeSvc.ExportSuccess(model.TaskNo, 0); + _exNoticeSvc.ExportSuccess(model.TaskNo, 0, _config.AgvHost + _config.GenAgvSchedulingTask); return Ok(new WcsModel { StatusCode = 0, Msg = "鍑哄簱瀹屾垚" }); } else if (model.TaskType == "2") @@ -421,7 +432,7 @@ var bl = _exNoticeSvc.EmptyException(model); LogFile.SaveLogToFile($"绌哄彇寮傚父锛�(鎵ц缁撴灉鎴愬姛),", logStr); - return Ok(new { Success = 0, Message = "" }); + return Ok(new { Success = 0,StatusCode = 0, Message = "" }); } catch (Exception e) { @@ -446,7 +457,7 @@ var list = _asnPalletBindSvc.FullException(model); LogFile.SaveLogToFile($"婊″叆寮傚父锛�( {JsonConvert.SerializeObject(list)} ),", logStr); - return Ok(new { Success = 0, Message = "", TaskList = list }); + return Ok(new { Success = 0, StatusCode = 0, Message = "", TaskList = list }); } catch (Exception e) { @@ -500,12 +511,218 @@ throw new Exception(ex.Message); } } + + /// <summary> + /// 鑷姩鐮佸灈缁戝畾淇℃伅杩斿洖宸烽亾鍙� + /// </summary> + /// <param name="model">鍏ュ簱鍗曚俊鎭�</param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult BindRequestRoadWay(BoxPalletBindVm model) + { + var logStr = $@".\log\WCS\WCS鎵樼洏缁戝畾-鐢宠宸烽亾" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; - //鎵樼洏绠辩爜淇℃伅 鑷姩鐮佸灈 (wcs鎻愪緵) + try + { + var jsonData = JsonConvert.SerializeObject(model); + LogFile.SaveLogToFile($"WCS鎵樼洏缁戝畾-鐢宠宸烽亾锛�( {jsonData} ),", logStr); + + _asnPalletBindSvc.BindPalletStock(model, 0); + //鐢宠宸烽亾 + var list = _asnPalletBindSvc.RequestRoadWay(model.PalletNo, "W01"); + LogFile.SaveLogToFile($"WCS鎵樼洏缁戝畾-鐢宠宸烽亾杩斿洖锛�( {JsonConvert.SerializeObject(list)} ),", logStr); + + return Ok(new { Success = 0, Message = "鎵樼洏缁戝畾-鐢宠宸烽亾鎴愬姛", TaskList = list }); + } + catch (Exception e) + { + LogFile.SaveLogToFile($"WCS鎵樼洏缁戝畾-鐢宠宸烽亾杩斿洖锛�( {e.Message} ),", logStr); + + return Ok(new ErpModel { Success = -1, Message = e.Message }); + } + } + + /// <summary> + /// WCS鐢宠绌烘墭璺虹粦瀹� + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult BindPlnInHouseWcs(PalletsBind model) + { + var logStr = $@".\log\WCS\WCS鐢宠绌烘墭璺虹粦瀹�" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + try + { + var strMsg = _paAsnSvc.BindNullPallets(model); + + return Ok(new { Success = 0, Message = "绌烘墭璺虹粦瀹氭垚鍔�", TaskList = strMsg }); + } + catch (Exception e) + { + LogFile.SaveLogToFile($"WCS鐢宠绌烘墭璺虹粦瀹氬紓甯歌繑鍥烇細( {e.Message} ),", logStr); + + return Ok(new ErpModel { Success = -1, Message = e.Message }); + } + } + + /// <summary> + /// WCS鐢宠绌烘墭鍑哄簱 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult IssuePlnOutHouseWcs(OutModePalletVm model) + { + var logStr = $@".\log\WCS\WCS鐢宠绌烘墭鍑哄簱" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + try + { + List<OutCommandDto> _list = _pdaSoSvc.IssuePlnOutHouseWcs(model,0); + + return Ok(new { Success = 0, Message = "绌烘墭鐩樺嚭搴撴垚鍔�", TaskList = _list }); + } + catch (Exception e) + { + LogFile.SaveLogToFile($"WCS鐢宠绌烘墭鍑哄簱寮傚父杩斿洖锛�( {e.Message} ),", logStr); + + return Ok(new ErpModel { Success = -1, Message = e.Message }); + } + } + + /// <summary> + /// WCS鐢宠鏄惁缂犺啘 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult RequestPackWcs(RequesIsBale model) + { + var logStr = $@".\log\WCS\WCS鐢宠缂犺啘鎷嗚啘" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + try + { + int t = _asnPalletBindSvc.RequestPackWcs(model.PalletNo); + LogFile.SaveLogToFile($"WCS鐢宠缂犺啘鍏ュ簱璇锋眰锛岃姹傛墭鐩樺憟锛�( {model.PalletNo} ),", logStr); + + return Ok(new { Success = t, Message = "缂犺啘鎸囦护鍙戦�佹垚鍔�" }); + } + catch (Exception e) + { + LogFile.SaveLogToFile($"WCS鐢宠缂犺啘鍏ュ簱寮傚父杩斿洖锛�( {e.Message} ),", logStr); + + return Ok(new ErpModel { Success = -1, Message = e.Message }); + } + } + + /// <summary> + /// WCS鐢宠鏄惁鎷嗚啘 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult RequestUnPackWcs(RequesIsBale model) + { + var logStr = $@".\log\WCS\WCS鐢宠缂犺啘鎷嗚啘" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + try + { + int t = _asnPalletBindSvc.RequestUnPackWcs(model.PalletNo); + + return Ok(new { Success = t, Message = "鎷嗚啘鎸囦护鍙戦�佹垚鍔�" }); + } + catch (Exception e) + { + LogFile.SaveLogToFile($"WCS鐢宠鎷嗚啘鍑哄簱寮傚父杩斿洖锛�( {e.Message} ),", logStr); + + return Ok(new ErpModel { Success = -1, Message = e.Message }); + } + } + + /// <summary> + /// WCS鍙嶉缂犺啘瀹屾垚 + /// </summary> + /// <param name="model"></param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult RequestPackedWcs(RequesIsBale model) + { + var logStr = $@".\log\WCS\WCS鐢宠缂犺啘鎷嗚啘" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + try + { + int t = _asnPalletBindSvc.RequestPackedWcs(model.PalletNo); + + return Ok(new { Success = t, Message = "缂犺啘瀹屾垚鎸囦护鍙戦�佹垚鍔�" }); + } + catch (Exception e) + { + LogFile.SaveLogToFile($"WCS鐢宠缂犺啘瀹屾垚寮傚父杩斿洖锛�( {e.Message} ),", logStr); + + return Ok(new ErpModel { Success = -1, Message = e.Message }); + } + } + + ///// <summary> + ///// 鎴愬搧绠辩爜鎷嗗灈鎷h揣 + ///// </summary> + ///// <param name="model">鍏ュ簱鍗曚俊鎭�</param> + ///// <returns></returns> + //[AllowAnonymous] + //[HttpPost] + //public IActionResult BoxUnstackd(BoxPickList model) + //{ + // var logStr = $@".\log\WCS\WCS鎴愬搧绠辩爜鎷嗗灈" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + + // try + // { + + // var jsonData = JsonConvert.SerializeObject(model); + // LogFile.SaveLogToFile($"WCS鎴愬搧绠辩爜鎷嗗灈锛�( {jsonData} ),", logStr); + + // _comeSvc.BoxUnstackd(model.PalletNo, model.BoxList); + // var list = new { Success = 0, Message = "鎴愬搧绠辩爜鎷嗗灈" }; + // LogFile.SaveLogToFile($"WCS鎴愬搧绠辩爜鎷嗗灈杩斿洖锛�( {JsonConvert.SerializeObject(list)} ),", logStr); + + // return Ok(list); + // } + // catch (Exception e) + // { + // LogFile.SaveLogToFile($"WCS鎴愬搧绠辩爜鎷嗗灈锛�( {e.Message} ),", logStr); + + // return Ok(new ErpModel { Success = -1, Message = e.Message }); + // } + //} //鐢宠绌烘墭(鑷姩鐮佺┖鎵樻椂鐢�) //杞﹂棿鍙枡 + + //WCS鐢宠鎷嗗灈淇℃伅 + /// <summary> + /// 鎴愬搧绠辩爜鎷嗗灈鎷h揣 + /// </summary> + /// <param name="model">鍏ュ簱鍗曚俊鎭�</param> + /// <returns></returns> + [AllowAnonymous] + [HttpPost] + public IActionResult ResultBoxInfoCheckWcs(BoxInfoCheck model) + { + var logStr = $@".\log\WCS\WCS鐢宠鎷嗗灈鎵樼洏淇℃伅" + DateTime.Now.ToString("yyyyMMdd") + ".txt"; + try + { + RequestBoxInfoCheck list = _exNoticeSvc.BoxInfoCheckWcs(model); + return Ok(new { Success = 1,Message = "鎷嗗灈淇℃伅鑾峰彇鎴愬姛",data = list}); + } + catch (Exception e) + { + LogFile.SaveLogToFile($"WCS鐢宠鎵樼洏鎷嗗灈寮傚父杩斿洖锛�( {e.Message} ),", logStr); + + return Ok(new ErpModel { Success = -1, Message = e.Message}); + } + + } #region AGV @@ -515,10 +732,10 @@ /// AGV 鎵ц鍥炶皟鐨勬柟娉曪紝鍖呭惈浠诲姟寮�濮嬶紝璧板嚭鍌ㄤ綅锛屼换鍔″畬鎴愬強浠诲姟鍙栨秷銆� /// 鍙栨秷閫氱煡涓轰换鍔″崟锛屽叾浠栭�氱煡涓哄崟涓换鍔$粍鎴栧瓙浠诲姟銆傛敞鎰忥細鏄惁閫氱煡闇�瑕佸湪浠诲姟妯℃澘閰嶇疆 /// </summary> + /// <param name="model">鍏ュ簱鍗曚俊鎭�</param> /// <returns></returns> - /// <exception cref="Exception"></exception> [HttpPost] - public IActionResult AgvCallback(AgvContinueTask model) + public IActionResult AgvCallback(AgvTaskDto model) { try { @@ -529,20 +746,32 @@ //鎺ユ敹鏃堕棿 var time1 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); - var orderType = _taskSvc.GetTaskOrderType(model.TaskCode);// 鍒ゆ柇鍗曟嵁绫诲瀷鍏ュ嚭绉� + + //娴嬭瘯鎺ュ彛鐢� + var orderType = _taskSvc.GetTaskOrderType(model.TaskCode,"0");// 鍒ゆ柇鍗曟嵁绫诲瀷鍏ュ嚭绉� var taskType = _taskSvc.GetTaskType(model.TaskCode);//鏍规嵁浠诲姟鍙疯幏鍙栦换鍔$被鍨� switch (orderType) { case "0"://鍏ュ簱浠诲姟鎵ц + _stockSvc.ArriveFinish(model.TaskCode); + break; + case "1"://鍑哄簱浠诲姟鎵ц + _stockSvc.SoFinish(model.TaskCode); + break; + case "2"://鐩樺簱浠诲姟鎵ц + case "3"://绉诲簱浠诲姟鎵ц - return Ok(new OutCommanAgvDto { Code = "0", Message = "鎴愬姛", ReqCode = model.ReqCode }); + _stockSvc.MoveFinish(model.TaskCode); + break; + // return Ok(new OutCommanAgvDto { Code = "0", Message = "鎴愬姛", ReqCode = model.ReqCode }); default: return Ok(new OutCommanAgvDto { Code = "1", Message = "澶辫触", ReqCode = model.ReqCode }); } + return Ok(new OutCommanAgvDto { Code = "0", Message = "鎴愬姛", ReqCode = model.ReqCode }); } catch (Exception ex) @@ -555,7 +784,7 @@ } } - + #endregion -- Gitblit v1.8.0