From af9c3ed5d036ad68faf7e18f566679b3da92d244 Mon Sep 17 00:00:00 2001 From: wanshenmean <cathay_xy@163.com> Date: 星期六, 22 三月 2025 11:36:06 +0800 Subject: [PATCH] 合并 --- CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs | 136 +++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 131 insertions(+), 5 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..57ef8c9 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,10 +4,12 @@ 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; using WIDESEAWCS_QuartzJob; +using WIDESEAWCS_QuartzJob.DeviceBase; using WIDESEAWCS_Tasks.ConveyorLineJob; using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database; @@ -173,6 +175,7 @@ private ConveyorLineTaskCommand_After MapTaskCommand(Dt_Task task, ConveyorLineTaskCommand_After command) { var comm = _mapper.Map<ConveyorLineTaskCommand_After>(task); + comm.ResponState = 1; comm.InteractiveSignal = command.InteractiveSignal; return comm; } @@ -216,14 +219,137 @@ { if (command.ConveyorLineBarcode != "NoRead") { - - var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode); + //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) + //{ + // throw new InvalidOperationException("MOM IP 鏈厤缃�"); + //} + //var stationManager=_stationManagerRepository.QueryFirst(x=>x.stationChildCode == childDeviceCode); + //TrayCellsStatusDto trayCells = new TrayCellsStatusDto() + //{ + // 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") + //}; - if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null) + //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) + // { + // 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) + // { + // IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == station.stationPLC); + // if (device != null) + // { + // CommonConveyorLine_After CommonConveyorLine_After = (CommonConveyorLine_After)device; + // ConveyorLineTaskCommand_After conveyorLineAfter = CommonConveyorLine_After.ReadCustomer<ConveyorLineTaskCommand_After>((Convert.ToInt32(station.stationChildCode)).ToString()); + // } + // //鍙戦�佸埌鍒嗗 + // } + // } + // } + // } + // else + // { + // var strings = new List<string>() { "2142", "2094", "2046" }; + + // foreach (var item in strings) + // { + // var station = _stationManagerRepository.QueryFirst(x => x.productLine == result1.ProductionLine && x.stationChildCode == item); + // if (station != null) + // { + // IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == station.stationPLC); + // if (device != null) + // { + // CommonConveyorLine_After CommonConveyorLine_After = (CommonConveyorLine_After)device; + // ConveyorLineTaskCommand_After conveyorLineAfter = CommonConveyorLine_After.ReadCustomer<ConveyorLineTaskCommand_After>((Convert.ToInt32(station.stationChildCode)).ToString()); + // if (conveyorLineAfter.HasPallet == 0) + // { + // Dt_Task task = new Dt_Task() + // { + // TaskNum = _taskRepository.GetTaskNo().Result, + // Grade = 1, + // PalletCode = command.ConveyorLineBarcode, + // Roadway = station.Roadway, + // SourceAddress = childDeviceCode, + // TargetAddress = station.stationChildCode, + // CurrentAddress = station.stationChildCode, + // NextAddress = station.stationChildCode, + // TaskState = (int)TaskInStatusEnum.InNew, + // ExceptionMessage = "", + // TaskId = 0, + // TaskType = (int)TaskInboundTypeEnum.InTray, + // ProductionLine = result1.ProductionLine, + // }; + // _taskRepository.AddData(task); + // ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task); + // conveyorLine.SendCommand(taskCommand, childDeviceCode); + // conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); + // _taskService.UpdateTaskStatusToNext(task); + // } + // } + // //鍙戦�佸埌鍒嗗 + // return; + // } + // } + // 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); + //} + + + if (_taskRepository.QueryFirst(x => x.PalletCode == command.ConveyorLineBarcode) != null) { WriteInfo(conveyorLine.DeviceName, "褰撳墠鎵樼洏瀛樺湪浠诲姟"); return; } + + + var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode); + var content = CreateAndSendTask(taskDTO); if (content.Status) @@ -233,10 +359,10 @@ { var taskCommand = MapTaskCommand(task, command); conveyorLine.SendCommand(taskCommand, childDeviceCode); + //conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode); _taskService.UpdateTaskStatusToNext(task); } } - //} } } @@ -253,7 +379,7 @@ var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress); var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue; - var requestTrayInTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTrayInTask)?.ConfigValue; + var requestTrayInTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTask)?.ConfigValue; if (wmsBase == null || requestTrayInTask == null) { throw new InvalidOperationException("WMS IP 鏈厤缃�"); -- Gitblit v1.9.3