| | |
| | | using Quartz; |
| | | using SqlSugar; |
| | | using System.Reflection; |
| | | using System.Threading.Tasks; |
| | | using WIDESEAWCS_BasicInfoRepository; |
| | | using WIDESEAWCS_BasicInfoService; |
| | | using WIDESEAWCS_Common; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_Core.Helper; |
| | | using WIDESEAWCS_Core.HttpContextUser; |
| | | using WIDESEAWCS_DTO.MOM; |
| | |
| | | using WIDESEAWCS_QuartzJob.Service; |
| | | using WIDESEAWCS_SignalR; |
| | | using WIDESEAWCS_Tasks.ConveyorLineJob; |
| | | using static System.Collections.Specialized.BitVector32; |
| | | using ICacheService = WIDESEAWCS_Core.Caches.ICacheService; |
| | | |
| | | namespace WIDESEAWCS_Tasks |
| | |
| | | List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode); |
| | | foreach (var station in stationManagers) |
| | | { |
| | | if (station.stationType == 11) |
| | | { |
| | | ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(station.stationChildCode); |
| | | ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(station.stationChildCode, "DeviceCommand"); |
| | | if (command != null && commandWrite != null) |
| | |
| | | var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray(); |
| | | if (structs[0] == true) |
| | | { |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine.DeviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{station.stationChildCode}】空托盘请求扫码入库"); |
| | | NGRequestTaskInbound(conveyorLine, command, station.stationChildCode, 0, station.stationLocation); |
| | | } |
| | | else |
| | | { |
| | | ConveyorLineSendFinish(conveyorLine, station.stationChildCode, 0, false); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | #region 调用事件总线通知前端 |
| | | |
| | | var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken"); |
| | |
| | | } |
| | | |
| | | #region 入库 |
| | | |
| | | /// <summary> |
| | | /// 输送线请求入库 |
| | | /// </summary> |
| | |
| | | { |
| | | try |
| | | { |
| | | //ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】请求扫码入库"); |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】请求扫码入库"); |
| | | |
| | | var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode); |
| | | HandleTaskOut(conveyorLine, command, childDeviceCode, ProtocalDetailValue, task); |
| | |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | if (command.Barcode == task.PalletCode) |
| | | { |
| | | Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | | if (newTask != null) |
| | | { |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 输送线请求入库下一地址 |
| | | |
| | | /// <summary> |
| | | /// 输送线入库完成 |
| | |
| | | { |
| | | var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish) |
| | | { |
| | | if (command.Barcode == task.PalletCode) |
| | | { |
| | | ConsoleHelper.WriteWarningLine($"【{conveyorLine._deviceName}】任务号:【{command.TaskNum}】,托盘条码:【{command.Barcode}】已到达【{childDeviceCode}】输送线入库完成,下一目标地址【等待分配货位】"); |
| | | ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true); |
| | |
| | | WebResponseContent content = _taskService.UpdateTaskStatusToNext(task); |
| | | Console.Out.WriteLine(content.ToJsonString()); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 入库 |
| | | |
| | | #region 出库 |
| | | |
| | | /// <summary> |
| | | /// 输送线请求出信息 |
| | | /// </summary> |
| | |
| | | { |
| | | var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | if (command.Barcode == task.PalletCode) |
| | | { |
| | | //task.NextAddress = task.NextAddress.Replace("-1", ""); |
| | | //ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task); |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输送线请求出库下一地址 |
| | |
| | | { |
| | | Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | if (command.Barcode == task.PalletCode) |
| | | { |
| | | Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress); |
| | | if (newTask != null) |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输送线出库完成 |
| | |
| | | { |
| | | var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode); |
| | | if (task != null) |
| | | { |
| | | if (command.Barcode == task.PalletCode) |
| | | { |
| | | WebResponseContent content = new WebResponseContent(); |
| | | //ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task); |
| | |
| | | content = _taskService.UpdateTaskStatusToNext(task); |
| | | } |
| | | } |
| | | } |
| | | |
| | | #endregion |
| | | #endregion 出库 |
| | | |
| | | /// <summary> |
| | | /// 输送线交互完成 |
| | |
| | | } |
| | | |
| | | #region 检测空盘实盘任务 |
| | | |
| | | /// <summary> |
| | | /// 监测空托盘实盘出库 |
| | | /// </summary> |
| | |
| | | if (tasks.Count < index) |
| | | { |
| | | ConsoleHelper.WriteErrorLine($"【{childDeviceCode}】请求【{taskType.ToString()}】任务,已有【{taskType.ToString()}】任务【{tasks.Count}】,最多拥有【{index - 1}】"); |
| | | |
| | | #region 调用WMS获取出库任务 |
| | | |
| | | WMSTaskDTO taskDTO = new WMSTaskDTO(); |
| | |
| | | } |
| | | var wmsIpAddress = wmsBase + requestTrayOutTask; |
| | | |
| | | |
| | | var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, platform.ProductionLine }.ToJsonString()); |
| | | //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString()); |
| | | |
| | |
| | | |
| | | taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); |
| | | |
| | | #endregion |
| | | #endregion 调用WMS获取出库任务 |
| | | |
| | | CreateAndSendTask(taskDTO); |
| | | } |
| | |
| | | } |
| | | return content; |
| | | } |
| | | #endregion |
| | | |
| | | #endregion 检测空盘实盘任务 |
| | | |
| | | #region 化成NG口入库 |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | #endregion 化成NG口入库 |
| | | } |
| | | } |