From 84b36c79f37d9d3abad3bba4ff7ea99b2cc17942 Mon Sep 17 00:00:00 2001 From: 肖洋 <cathay_xy@163.com> Date: 星期三, 18 十二月 2024 23:19:51 +0800 Subject: [PATCH] 合并 --- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 165 +++++++++++++++++++++++++++++++++++------------------- 1 files changed, 107 insertions(+), 58 deletions(-) diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs index 7f61b12..268d844 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs @@ -1,22 +1,8 @@ -锘� -using log4net.Core; -using Mapster; +锘縰sing log4net.Core; using Masuit.Tools; -using Masuit.Tools.Models; -using OfficeOpenXml.FormulaParsing.Excel.Functions.Math; -using SixLabors.Fonts.Tables.AdvancedTypographic; -using System.Diagnostics; -using WIDESEA_Common; using WIDESEA_Core.Const; -using WIDESEA_DTO; using WIDESEA_DTO.MOM; using WIDESEA_DTO.WMS; -using WIDESEA_IStorageBasicRepository; -using WIDESEA_IStoragIntegrationServices; -using WIDESEA_Model.Models; -using WIDESEA_StorageBasicRepository; -using WIDESEA_StorageTaskRepository; -using WIDESEA_StoragIntegrationServices; using WIDESEAWCS_Model.Models; namespace WIDESEA_StorageTaskServices; @@ -24,6 +10,7 @@ public partial class Dt_TaskService : ServiceBase<Dt_Task, IDt_TaskRepository>, IDt_TaskService { #region 璇锋眰浠诲姟鍏ュ簱 + /// <summary> /// 璇锋眰鍏ュ簱 /// </summary> @@ -73,7 +60,7 @@ } /// <summary> - /// + /// /// </summary> /// <param name="input">璇锋眰鍙傛暟</param> /// <param name="flag">瀹炴绌烘鏍囪瘑</param> @@ -156,10 +143,10 @@ } #region 鐩存帴鍑哄簱浠诲姟 + private async Task<Dt_Task> CreateInToOutTaskAsync(RequestTaskDto input, Dt_StationManager stationManager) { //if (stationManager.stationType != 5) throw new Exception("閿欒鐨勮皟鍙�"); - input.EquiCodeMOM = "24MEJQ11-1006-1"; @@ -259,10 +246,11 @@ return task; } - #endregion + #endregion 鐩存帴鍑哄簱浠诲姟 #region 鍏ュ簱浠诲姟 + private async Task<Dt_Task> CreateInTaskAsync(RequestTaskDto input, Dt_StationManager stationManager) { if (stationManager.stationType != 1 && stationManager.stationType != 6) throw new Exception("閿欒鐨勮皟鍙�"); @@ -373,18 +361,20 @@ return task; } - #endregion + + #endregion 鍏ュ簱浠诲姟 #region 搴撲綅鍒嗛厤 + + #region 鑾峰彇璐т綅 /// <summary> - /// + /// /// </summary> /// <param name="requestTask">璇锋眰鍙傛暟</param> /// <param name="isCheckRequest">鏄惁鏈娴嬪簱浣嶇被鍨�</param> /// <returns></returns> private async Task<DtLocationInfo> RequestLocation(RequestTaskDto requestTask, bool isCheckRequest = false) { - #region 鑾峰彇璐т綅 try { List<DtLocationInfo> locations; @@ -409,9 +399,12 @@ Console.WriteLine(err.Message.ToString()); return null; } - #endregion 鑾峰彇璐т綅 + } - #endregion + #endregion 鑾峰彇璐т綅 + + + #endregion 搴撲綅鍒嗛厤 // 鑾峰彇宸ヨ壓鐢宠 private async Task<ProcessApplyDto> GetProcessApplyAsync(RequestTaskDto input, ResultTrayCellsStatus content) @@ -429,7 +422,7 @@ }; } - #endregion 璇锋眰绌烘鍑哄簱 + #endregion 璇锋眰浠诲姟鍏ュ簱 #region 鍒涘缓绌烘鍑哄簱浠诲姟 public async Task<Dt_Task> CreateEmptyOutTaskAsync(RequestTaskDto input, Dt_StationManager stationManager) @@ -469,13 +462,13 @@ } catch (Exception ex) { - throw new Exception(ex.Message); } } #endregion #region 鐩存帴鍑哄簱浠诲姟瀹屾垚 + public async Task<WebResponseContent> CompleteInToOutTaskAsync(Dt_Task task) { WebResponseContent content = new WebResponseContent(); @@ -501,19 +494,63 @@ { try { + if (stationManager.stationType == 15) throw new Exception(""); + // 鍒涘缓涓�涓猅rayCellsStatusDto瀵硅薄锛屽苟璧嬪�� TrayCellsStatusDto trayCells = new TrayCellsStatusDto() { Software = "WMS", TrayBarcode = input.PalletCode, //EquipmentCode = "EQ_CWJZ01" - EquipmentCode = input.EquiCodeMOM + EquipmentCode = input.EquiCodeMOM, + SceneType = "1", }; // 璋冪敤GetTrayCellStatusAsync鏂规硶锛岃幏鍙栨暣鐩樼數鑺� WebResponseContent content = await GetTrayCellStatusAsync(trayCells); // 濡傛灉鐘舵�佷负false锛屽垯杩斿洖content - if (!content.Status) throw new Exception(content.Message); + if (!content.Status) //鍏堢敤瀹炴姝e父鑾峰彇鏁寸洏鐢佃姱鏁版嵁锛� 濡傚紓甯� 鍦ㄦ浣跨敤绌烘绫诲瀷鍐嶆鑾峰彇 鍐嶆湁寮傚父鍒欐姏鍑� + { + + TrayCellsStatusDto trayCells_Empty = new TrayCellsStatusDto() + { + Software = "WMS", + TrayBarcode = input.PalletCode, + //EquipmentCode = "EQ_CWJZ01" + EquipmentCode = input.EquiCodeMOM, + SceneType = "4" + }; + content = await GetTrayCellStatusAsync(trayCells); + + if (!content.Status) throw new Exception(content.Message); + + if (content.Status) //褰撳仛绌烘鍏ュ簱 + { + DtLocationInfo EmptylocationInfo = await RequestLocation(input); + + if (EmptylocationInfo == null) throw new Exception("搴撲綅宸叉弧"); + + var Epmtytask = new Dt_Task + { + CurrentAddress = input.Position, + Grade = 3, //浼樺厛澶勭悊寮傚父鎺掑嚭鍙g殑浠诲姟 闃叉姝e父闇�鎺掑嚭寮傚父鍙g殑浠诲姟鍫电嚎 + Roadway = input.Roadways, + TargetAddress = EmptylocationInfo.LocationCode, + Dispatchertime = DateTime.Now, + MaterialNo = "", + NextAddress = input.Roadways, + OrderNo = null, + PalletCode = input.PalletCode, + SourceAddress = stationManager.stationLocation, + TaskState = (int)TaskInStatusEnum.Line_InFinish, + TaskType = (int)TaskInboundTypeEnum.Inbound, + TaskNum = await BaseDal.GetTaskNo(), + Creater = "Systeam" + }; + + return Epmtytask; + } + } // 娣诲姞缁勭洏淇℃伅 // 灏哻ontent.Data杞崲涓篟esultTrayCellsStatus瀵硅薄 @@ -521,24 +558,25 @@ if (result.SerialNos.Count <= 0) { ConsoleHelper.WriteErrorLine(result.MOMMessage); - var taskNG = new Dt_Task - { - CurrentAddress = input.Position, - Grade = 1, - Roadway = input.Roadways, - TargetAddress = stationManager.stationNGLocation, - Dispatchertime = DateTime.Now, - MaterialNo = "", - NextAddress = stationManager.stationNGChildCode, - OrderNo = null, - PalletCode = input.PalletCode, - SourceAddress = stationManager.stationLocation, - TaskState = (int)TaskInStatusEnum.Line_InFinish, - TaskType = (int)TaskOutboundTypeEnum.InToOut, - TaskNum = await BaseDal.GetTaskNo(), - Creater = "Systeam" - }; - return taskNG; + throw new Exception("鏃犵數鑺暟鎹�"); + //var taskNG = new Dt_Task + //{ + // CurrentAddress = input.Position, + // Grade = 1, + // Roadway = input.Roadways, + // TargetAddress = stationManager.stationNGLocation, + // Dispatchertime = DateTime.Now, + // MaterialNo = "", + // NextAddress = stationManager.stationNGChildCode, + // OrderNo = null, + // PalletCode = input.PalletCode, + // SourceAddress = stationManager.stationLocation, + // TaskState = (int)TaskInStatusEnum.Line_InFinish, + // TaskType = (int)TaskOutboundTypeEnum.InToOut, + // TaskNum = await BaseDal.GetTaskNo(), + // Creater = "Systeam" + //}; + //return taskNG; } //Console.WriteLine(result); @@ -567,20 +605,33 @@ ////var processResponse = await GetProcessResponseAsync(process, input.Position); var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing); + DtLocationInfo locationInfo = null; + if (stationManager.Roadway.Contains("FR")) + { + locationInfo = await RequestLocation(input, true); + } + else + { + locationInfo = await RequestLocation(input); + } + //DtLocationInfo locationInfo = await RequestLocation(input); + + if (locationInfo == null) throw new Exception("搴撲綅宸叉弧"); + var task = new Dt_Task { CurrentAddress = input.Position, - Grade = 1, + Grade = 3, //浼樺厛澶勭悊寮傚父鎺掑嚭鍙g殑浠诲姟 闃叉姝e父闇�鎺掑嚭寮傚父鍙g殑浠诲姟鍫电嚎 Roadway = input.Roadways, - TargetAddress = stationManager.stationLocation, + TargetAddress = locationInfo.LocationCode, Dispatchertime = DateTime.Now, MaterialNo = "", NextAddress = input.Roadways, OrderNo = null, - //PalletCode = stockinfo.PalletCode, - //SourceAddress = stockinfo.LocationCode, - TaskState = (int)TaskOutStatusEnum.OutNew, - TaskType = (int)TaskOutboundTypeEnum.OutTray, + PalletCode = input.PalletCode, + SourceAddress = stationManager.stationLocation, + TaskState = (int)TaskInStatusEnum.Line_InFinish, + TaskType = (int)TaskInboundTypeEnum.Inbound, TaskNum = await BaseDal.GetTaskNo(), Creater = "Systeam" }; @@ -634,12 +685,12 @@ throw new Exception(err.Message); // 鎶涘嚭寮傚父浠ヤ究澶栭儴鎹曡幏 } } - #endregion + + #endregion MyRegion #region 妫�娴嬮珮娓╁簱鏄惁鏈夊彲鍑哄簱搴撳瓨 public WebResponseContent StockCheckingAsync() { - WebResponseContent webResponseContent = new WebResponseContent(); try { @@ -663,7 +714,6 @@ if (stockInfo.Count <= 0) continue; foreach (var item in stockInfo) { - var hasTask = BaseDal.QueryFirst(x => x.PalletCode == item.PalletCode); if (hasTask != null) { @@ -681,7 +731,6 @@ task.NextAddress = "002-000-002"; // 鍒涘缓浠诲姟DTO WMSTaskDTO taskDTO = CreateTaskDTO(task); - var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue; @@ -718,7 +767,7 @@ } } - #endregion + #endregion 妫�娴嬮珮娓╁簱鏄惁鏈夊彲鍑哄簱搴撳瓨 #region 甯告俯琛ョ┖鎵樼洏鑷冲垎瀹� public async Task<WebResponseContent> GetFROutTrayToCW(RequestTaskDto taskDTO) @@ -777,7 +826,7 @@ { Dt_StationManager station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == json.Position); - DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == "ZJ-7"); + DtStockInfo stockInfo = _stockInfoRepository.QueryFirst(X => X.IsFull && X.AreaCode == "CWSC3" && X.ProductionLine == station.productLine); if (stockInfo == null) throw new Exception("搴撳唴鏃犳弧瓒虫潯浠剁殑搴撳瓨鍙嚭搴�"); Dt_StationManager OutStation = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1016" && x.stationType == 10); @@ -812,4 +861,4 @@ return content.Error($"澶辫触锛歿ex.Message}"); } } -} \ No newline at end of file +} \ No newline at end of file -- Gitblit v1.9.3