From 6db89a97e81e6c26bb2d2ccb3db79ed8858462a2 Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期四, 17 七月 2025 20:38:16 +0800 Subject: [PATCH] 优化异常库位出库功能 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs | 3 - Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationErrorService.cs | 3 - Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs | 2 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs | 4 +- Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Partial/Dt_TaskService.cs | 67 ++++++++++++++++++++------------- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 30 ++++++++++----- 6 files changed, 64 insertions(+), 45 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs index f93798d..15cf98b 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs @@ -443,9 +443,9 @@ if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { - if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut) + if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut && taskDTO.RoadWay.Contains("CW")) { - var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1017" && x.stationType == 10&&x.Roadway==taskDTO.RoadWay); + var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1017" && x.stationType == 10 && x.Roadway == taskDTO.RoadWay); task.TaskState = (int)TaskOutStatusEnum.OutNew; task.CurrentAddress = taskDTO.SourceAddress; task.NextAddress = stationinfo.stationChildCode; diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs index e3cd3d6..1d5c18e 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs @@ -257,7 +257,6 @@ ConsoleHelper.WriteErrorLine($"褰撳墠鎵樼洏瀛樺湪浠诲姟锛氥�恵command.ConveyorLineBarcode}銆�"); WriteInfo(conveyorLine.DeviceName, $"褰撳墠鎵樼洏瀛樺湪浠诲姟{command.ConveyorLineBarcode}"); - return; } var content = CreateAndSendTask(taskDTO); @@ -268,7 +267,6 @@ { var taskCommand = MapTaskCommand(task, command); - //conveyorLine.SendCommand(taskCommand, childDeviceCode); bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode); if (sendFlag) { @@ -276,7 +274,6 @@ } } } - //} } } diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs index b5c54e0..5d5f6c9 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs @@ -103,16 +103,8 @@ ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue); commonStackerCrane.LastTaskType = task.TaskType; - if(task.TaskType == (int)TaskOutboundTypeEnum.InToOut) - { - task.TaskState = (int)TaskOutStatusEnum.SC_OutExecuting; - _taskRepository.AddData(task); - _taskService.StackCraneTaskCompleted(task.TaskNum); - } - else - { - _taskService.UpdateTaskStatusToNext(task.TaskNum); - } + + _taskService.UpdateTaskStatusToNext(task.TaskNum); } } else @@ -179,6 +171,24 @@ if (task == null) commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5); + if (commonStackerCrane.DeviceCode.Contains("CW") && task.TaskType==(int)TaskOutboundTypeEnum.InToOut) + { + var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1017" && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode); + + IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC); + if (device != null) + { + CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device; + conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(1815), stationinfo.stationChildCode); + Thread.Sleep(100); + conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode); + } + WriteInfo(commonStackerCrane.DeviceName, $"銆愭墜鍔ㄥ嚭搴撹褰曘��"); + } + + + + if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) { var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress); diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationErrorService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationErrorService.cs index b7f92a3..914547e 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationErrorService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationErrorService.cs @@ -51,8 +51,7 @@ var threeHoursAgo = now.Subtract(TimeSpan.FromHours(3)); var data = BaseDal.Db.Queryable<DtLocationInfo>() - .Where(x => x.LocationStatus != 2 && x.LocationStatus != 0) - .Where(x => x.EnalbeStatus != 1) + .Where(x => x.LocationStatus != 2 && x.LocationStatus != 0|| x.EnalbeStatus != 1) .WhereIF(!wheres.IsNullOrEmpty(), wheres) .OrderBy(orderByModels) .ToPageList(options.Page, options.Rows, ref totalCount); diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs index 4f5a1b8..d39fe99 100644 --- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs +++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs @@ -140,7 +140,7 @@ { Dt_Task task = new Dt_Task { - Grade = 1, + Grade = 3, Roadway = location.RoadwayNo, TargetAddress = "001-035-001", Dispatchertime = DateTime.Now, 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 c0fedb2..22294eb 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 @@ -184,28 +184,33 @@ if (!result.Success) { - //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 = "System", - // ProductionLine = result.ProductionLine, - // ProcessCode = result.ProcessCode, - //}; - //return taskNG; - Console.WriteLine($"{result.MOMMessage}"); - return null; + List<string> strings = new List<string>() { "2036","2038","2084","2086"}; + if (input.Position.Contains(strings)) + { + Console.WriteLine($"{result.MOMMessage}"); + return null; + } + 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 = "System", + ProductionLine = result.ProductionLine, + ProcessCode = result.ProcessCode, + }; + return taskNG; + } if (result.SerialNos.Count <= 0) @@ -606,11 +611,17 @@ taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System"; var location = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway); - int lastStatus = location.LocationStatus; - location.LocationStatus = (int)LocationEnum.Free; + + if(location != null) + { + int lastStatus = location.LocationStatus; + location.LocationStatus = (int)LocationEnum.Free; + _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); + } + task.TaskState = (int)TaskOutStatusEnum.OutFinish; - _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(location, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum); + // 浜嬪姟澶勭悊 await _unitOfWorkManage.UseTranAsync(async () => { @@ -620,8 +631,10 @@ await DeleteStockInfoDetailsAsync(stock.StockInfoDetails); await AddStockInfoHtyAsync(stockInfo_Hty); } - - await UpdateLocationAsync(location); + if (location != null) + { + await UpdateLocationAsync(location); + } await DeleteTaskAsync(task.TaskId); await AddTaskHtyAsync(taskHty); }); -- Gitblit v1.9.3