wangxinhui
2025-08-26 a23691d54a0142ba9a0668788d366638bd82349e
ÏîÄ¿´úÂë/WCS/WCSServices/WIDESEAWCS_Tasks/³ÉÆ·²Ö/ConveyorLineJob_CPH.cs
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Components.Routing;
using Newtonsoft.Json;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
using Quartz;
using SqlSugar.Extensions;
using System;
@@ -80,11 +81,24 @@
                        //码垛环线请求任务 
                        if (conveyorLineInfoRead != null && (conveyorLineInfoRead.R_State == 2 || conveyorLineInfoRead.R_State == 3) && conveyorLineInfoRead.R_TaskNo <= 0 && !string.IsNullOrEmpty(conveyorLineInfoRead.R_BoxCode) && conveyorLineInfoRead.R_Request==1)
                        {
                            WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.R_BoxCode, item.StationCode);
                            //向WMS请求任务
                            if (true)
                            {
                            //WebResponseContent content = _taskService.RequestWMSTaskSimple(conveyorLineInfoRead.R_BoxCode, item.StationCode);
                            ////向WMS请求任务
                            //if (true)
                            //{
                            //}
                            if (conveyorLineInfoRead.R_BoxCode=="1")
                            {
                                int taskNum = Convert.ToInt32(DateTime.Now.ToString("ddHHmmss"));
                                WebResponseContent content = _taskService.RequestWMSTaskSimple(taskNum.ToString(), item.StationCode,taskType:TaskTypeEnum.ProductMD.ObjToInt(),taskNum: taskNum, targetAddress:"2554");
                                //请求任务
                                if (content.Status)
                                {
                                    //写入出库线体地址
                                    device.SetValue(W_CLineCPHDB.W_TaskNo, 5, item.StationCode);
                                    device.SetValue(W_CLineCPHDB.W_TaskNo, taskNum, item.StationCode);
                                    device.SetValue(W_ConveyorLineCPDB.W_Command, 1, item.StationCode);
                                }
                            }
                        }
                    }
@@ -94,16 +108,14 @@
                        //获取码垛口任务更新任务状态
                        if (conveyorLineInfoRead != null && (conveyorLineInfoRead.R_State == 2 || conveyorLineInfoRead.R_State == 3) && conveyorLineInfoRead.R_TaskNo > 0)
                        {
                        }
                    }
                    else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt() && deviceProRead != null)
                            Dt_Task task = _taskRepository.QueryFirst(x => x.TaskNum == conveyorLineInfoRead.R_TaskNo && x.NextAddress==item.StationCode && x.TaskState == TaskStatusEnum.Line_Executing.ObjToInt());
                            if (task != null)
                    {
                        R_CLineCPHInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_CLineCPHInfo>(deviceProRead.DeviceProAddress);
                        //码垛环线排出口请求取消任务
                        if (conveyorLineInfoRead != null && (conveyorLineInfoRead.R_State == 2 || conveyorLineInfoRead.R_State == 3) && conveyorLineInfoRead.R_TaskNo > 0 && conveyorLineInfoRead.R_Request == 2)
                        {
                                task.CurrentAddress = item.StationCode;
                                task.NextAddress = task.TargetAddress;
                                task.DeviceCode = item.StackerCraneCode;
                                _taskService.UpdateTask(task, TaskStatusEnum.MD_Executing);
                            }
                        }
                    }
                    else