From 950e90445bc8e878f5b82d6e743b7e4f94556e55 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期四, 20 三月 2025 13:54:18 +0800 Subject: [PATCH] 1 --- CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs | 105 +++++++++++++++++++++++++++++++++++++++++++++------- 1 files changed, 91 insertions(+), 14 deletions(-) diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs index 6704cde..759cd2a 100644 --- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs +++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs @@ -4,6 +4,7 @@ using WIDESEAWCS_Common.TaskEnum; using WIDESEAWCS_Core; using WIDESEAWCS_Core.Helper; +using WIDESEAWCS_DTO.MOM; using WIDESEAWCS_DTO.TaskInfo; using WIDESEAWCS_DTO.WMS; using WIDESEAWCS_Model.Models; @@ -216,26 +217,102 @@ { if (command.ConveyorLineBarcode != "NoRead") { - - var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode); - - if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null) + var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); + var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.MOMIP_BASE)?.ConfigValue; + var ipAddress = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.TrayCellsStatus)?.ConfigValue; + if (wmsBase == null || ipAddress == null) { - WriteInfo(conveyorLine.DeviceName, "褰撳墠鎵樼洏瀛樺湪浠诲姟"); - return; + throw new InvalidOperationException("MOM IP 鏈厤缃�"); } - - var content = CreateAndSendTask(taskDTO); - if (content.Status) + var stationManager=_stationManagerRepository.QueryFirst(x=>x.stationChildCode == childDeviceCode); + TrayCellsStatusDto trayCells = new TrayCellsStatusDto() { - var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); - if (task != null) + Software = "WMS", + TrayBarcode = command.ConveyorLineBarcode, + EquipmentCode = stationManager.stationEquipMOM, + SessionId = Guid.NewGuid().ToString(), + EmployeeNo = "MITest", + SceneType = "4", + RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ") + }; + + var MOMIpAddress = wmsBase + ipAddress; + + var result = HttpHelper.PostAsync(MOMIpAddress, trayCells.ToJsonString()).Result; + WriteInfo("鍏ョ珯鏍¢獙", $"銆恵stationManager.stationChildCode}銆戝叆绔欐牎楠岃姹傚弬鏁般�恵trayCells.ToJsonString()}銆�"); + WriteInfo("鍏ョ珯鏍¢獙", ""); + WriteInfo("鍏ョ珯鏍¢獙", $"銆恵stationManager.stationChildCode}銆戝叆绔欐牎楠岃繑鍥炲弬鏁般�恵result}銆�"); + ResultTrayCellsStatus result1 = JsonConvert.DeserializeObject<ResultTrayCellsStatus>(result); + + if (result1.Success) + { + var serialNosError = result1.SerialNos.Where(x => x.SerialNoStatus != 1 && x.SerialNoStatus != 4).ToList(); + if (serialNosError.Count > 0) { - var taskCommand = MapTaskCommand(task, command); - conveyorLine.SendCommand(taskCommand, childDeviceCode); - _taskService.UpdateTaskStatusToNext(task); + if (result1.ProcessCode == "AG01") + { + var strings = new List<string>() { "2234", "2226", "2218" }; + foreach (var item in strings) + { + var station = _stationManagerRepository.QueryFirst(x => x.productLine == result1.ProductionLine && x.stationChildCode == item); + if(station != null) + { + //鍙戦�佸埌鍒嗗 + } + } + } } + else + { + var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode); + + if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null) + { + WriteInfo(conveyorLine.DeviceName, "褰撳墠鎵樼洏瀛樺湪浠诲姟"); + return; + } + + var content = CreateAndSendTask(taskDTO); + if (content.Status) + { + var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); + if (task != null) + { + var taskCommand = MapTaskCommand(task, command); + conveyorLine.SendCommand(taskCommand, childDeviceCode); + _taskService.UpdateTaskStatusToNext(task); + } + } + } + } + else + { + ConsoleHelper.WriteErrorLine(result1.MOMMessage); + } + + + + + //var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode); + + //if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null) + //{ + // WriteInfo(conveyorLine.DeviceName, "褰撳墠鎵樼洏瀛樺湪浠诲姟"); + // return; + //} + + //var content = CreateAndSendTask(taskDTO); + //if (content.Status) + //{ + // var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); + // if (task != null) + // { + // var taskCommand = MapTaskCommand(task, command); + // conveyorLine.SendCommand(taskCommand, childDeviceCode); + // _taskService.UpdateTaskStatusToNext(task); + // } + //} //} } } -- Gitblit v1.9.3