From 994dced313b956180f1b95e68760290c5ed931ba Mon Sep 17 00:00:00 2001 From: wangxinhui <wangxinhui@hnkhzn.com> Date: 星期三, 15 一月 2025 19:12:47 +0800 Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/MeiRuiAn/HuaiAn --- 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/板材仓/RGVJob_BC.cs | 108 +++++++++++------------------------------------------ 1 files changed, 23 insertions(+), 85 deletions(-) diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" index 33ebd26..d314d45 100644 --- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" +++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\235\277\346\235\220\344\273\223/RGVJob_BC.cs" @@ -36,9 +36,10 @@ private readonly IStationMangerRepository _stationMangerRepository; private readonly IRouterRepository _routerRepository; private readonly IRouterService _routerService; + private readonly IRouterExtension _routerExtension; private readonly List<Dt_WarehouseDevice> warehouseDevices; - public RGVJob_BC(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService) + public RGVJob_BC(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension) { _cacheService = cacheService; _taskService = taskService; @@ -47,6 +48,7 @@ _stationMangerRepository = stationMangerRepository; _routerRepository = routerRepository; _routerService = routerService; + _routerExtension = routerExtension; string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice)); if (!string.IsNullOrEmpty(warehouseDevicesStr)) @@ -99,7 +101,26 @@ if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt()) { - if (conveyorLineSignalRead.STB && /*conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && */!conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//鍏ュ簱 + //if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//鍏ュ簱 + //{ + // List<string> stations = _routerExtension.GetEndPoint(item.StationCode, TaskTypeEnum.Inbound.ObjToInt()).Select(x => x.NextPosi).ToList(); + // WebResponseContent responseContent = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode, conveyorLineInfoRead.Spare2, stations); + // if (responseContent.Status) + // { + // Dt_Task task = _taskRepository.QueryFirst(x => x.PalletCode == conveyorLineInfoRead.Barcode && x.CurrentAddress == item.StationCode && x.DeviceCode == device.DeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt()); + // if (task != null) + // { + // device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); + // device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress, item.StationCode); + // device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); + // device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress, item.StationCode); + // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); + // _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); + // } + // } + //} + + if (conveyorLineSignalRead.STB && !conveyorLineSignalWrite.ACK && !string.IsNullOrEmpty(conveyorLineInfoRead.Barcode) && conveyorLineInfoRead.TaskNum == 0)//鍏ュ簱 { WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.Barcode, item.StationCode); if (content.Status) @@ -115,89 +136,6 @@ _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing); } } - - #region - //Dt_Task task = _taskRepository.QueryFirst(x => x.SourceAddress == item.StationDeviceCode && x.TaskState == TaskStatusEnum.New.ObjToInt() && _taskService.TaskInboundTypes.Contains(x.TaskType) && x.PalletCode == conveyorLineInfoRead.Barcode && string.IsNullOrEmpty(x.DeviceCode) && string.IsNullOrEmpty(x.NextAddress) && string.IsNullOrEmpty(x.TargetAddress)); - //if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup) - //{ - // Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode); - // if (stationManger == null) - // { - // WriteError(item.StationName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}"); - // continue; - // } - // List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == task.TaskType && (task.Roadway == x.ChildPosiDeviceCode || task.Roadway == x.ChildPosi)); - // Dt_Router? router = routers.FirstOrDefault(); - // if (router == null) - // { - // WriteError(device.DeviceName, $"鏈壘鍒颁换鍔$被鍨媨task.TaskType}瀵瑰簲鐨勮矾鐢变俊鎭�"); - // } - // else - // { - // if (routers.Count == 1) - // { - // task.Dispatchertime = DateTime.Now; - // _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: router.ChildPosi, targetAddress: router.NextPosi, nextAddress: router.StartPosi, currentAddress: item.StationCode); - - // device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); - // device.SetValue(W_ConveyorLineDB.EndPos, router.StartPosi, item.StationCode); - // device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); - // device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); - // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); - // } - // else - // { - // List<string> canInboundStations = new List<string>(); - // List<string> stations = routers.Select(x => x.NextPosi).ToList(); - // foreach (string station in stations) - // { - // Dt_StationManger stationManger1 = _stationMangerRepository.QueryFirst(x => x.StationCode == station); - // if (stationManger1 != null) - // { - // IDevice? device1 = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationManger1.StationDeviceCode); - // if (device1 != null) - // { - // OtherDevice otherDevice = (OtherDevice)device1; - // //short workType = otherDevice.GetValue<R_ConveyorLineWorkType, short>(R_ConveyorLineWorkType.ConveyorLineWorkType, item.StationCode); - // //if (workType == ConveyorWorkTypeEnum.Undefined.ObjToInt() || workType == ConveyorWorkTypeEnum.Inbound.ObjToInt()) - // { - // canInboundStations.Add(stationManger1.Remark); - // } - // } - // } - // } - - // WebResponseContent responseContent = _taskService.RequestWMSAssignRoadway(task.TaskNum, canInboundStations); - // if (responseContent.Status) - // { - // List<Dt_Router> dt_Routers = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType); - - // Dt_Router? routerTemp = _routerService.QueryNextRoutes(item.StationCode, responseContent.Data.ToString() ?? "", task.TaskType).FirstOrDefault(); - // if (routerTemp != null) - // { - // task.Dispatchertime = DateTime.Now; - // task.Roadway = responseContent.Data.ToString() ?? task.Roadway; - // _taskService.UpdateTask(task, TaskStatusEnum.Line_Executing, deviceCode: routerTemp.ChildPosiDeviceCode, targetAddress: routerTemp.NextPosi, nextAddress: routerTemp.NextPosi, currentAddress: item.StationCode); - - // device.SetValue(W_ConveyorLineDB.StartPos, item.StationCode, item.StationCode); - // device.SetValue(W_ConveyorLineDB.EndPos, routerTemp.NextPosi, item.StationCode); - // device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum, item.StationCode); - // device.SetValue(W_ConveyorLineDB.Spare1, ConveyorWorkTypeEnum.Inbound.ObjToInt(), item.StationCode); - // device.SetValue(W_ConveyorLineDB.ACK, true, item.StationCode); - // } - // else - // { - // WriteError(device.DeviceName, $"鏈壘鍒颁换鍔$被鍨媨task.TaskType},璧风偣{item.StationCode},缁堢偣{responseContent.Data.ToString()}鐨勮矾鐢变俊鎭�"); - // } - // } - // else - // { - // WriteError(device.DeviceName, responseContent.Message); - // } - // } - // } - //} - #endregion } else if (conveyorLineSignalRead.STB /*&& conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm*/ && !conveyorLineSignalWrite.ACK && conveyorLineInfoRead.TaskNum > 0)//鍑哄簱 { -- Gitblit v1.9.3