1
wankeda
2025-04-15 99d9d4ed78eeb7b59c5c2ce314a82765f08a600a
´úÂë¹ÜÀí/NEWCode/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -52,6 +52,7 @@
        }
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
@@ -65,8 +66,8 @@
                // å®šä¹‰çº¿ä½“实盘入库请求的地址和任务类型
                var requests = new Dictionary<string, string>
                {
                    { "DB1002.1093.0", "ZJXL-WLX002" },
                    { "DB1002.1493.0", "FJXL-WLX002" }
                    { "DB1002.693.0", "ZJXL-WLX002" },
                    { "DB1002.1093.0", "FJXL-WLX002" }
                };
                // å®šä¹‰çº¿ä½“空盘回流请求的地址和任务类型
@@ -112,7 +113,7 @@
                string taskType = request.Value.Contains("ZJXL") ? "正极" : "负极";
                // æŸ¥è¯¢æ˜¯å¦å­˜åœ¨å·²ç”Ÿæˆçš„æ–°ä»»åŠ¡
                var task = _taskRepository.QueryFirst(x => x.SourceAddress == fromAdd && x.TaskState == (int)TaskInStatusEnum.InNew);
                var task = _taskRepository.QueryFirst(x => x.SourceAddress == fromAdd);//&& x.TaskState == (int)TaskInStatusEnum.InNew
                if (task != null)
                {
                    ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}{requestType},任务已生成存在,稍后重试......");
@@ -120,7 +121,7 @@
                }
                // æŸ¥è¯¢ä»»åŠ¡ç±»åž‹å¯¹åº”çš„czTask
                DtCZTask czTask = _taskCZRepository.QueryFirst(x => x.TaskType == taskType);
                DtCZTask czTask = _taskCZRepository.QueryFirst(x => x.TaskType == taskType && x.TaskStatus == TaskInStatusEnum.InFinish.ToString());
                if (czTask == null)
                {
                    ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}{requestType},{taskType}任务不存在,稍后重试......");
@@ -128,7 +129,7 @@
                }
                // åˆ›å»ºå¹¶æ·»åŠ æ–°ä»»åŠ¡åˆ°ä»»åŠ¡ä»“åº“
                task = CreateTask(fromAdd, czTask.TaskEndAddress, czTask.TaskOrderNo, czTask.TaskProductCode, taskType);
                task = CreateTask(fromAdd, czTask.TaskEndAddress, czTask.TaskOrderNo, czTask.TaskProductCode, taskType, czTask.Id);
                _taskRepository.AddData(task);
                ConsoleHelper.WriteInfoLine($"{nameof(CommonConveyorLineJob)}: {taskType}{requestType},任务已生成,等待执行......");
            }
@@ -145,7 +146,7 @@
                }
                string fromAdd = request.Value;
                string taskType = request.Value.Contains("ZJXL") ? "正极" : "负极";
                string taskType = "负极"; //request.Value.Contains("ZJXL") ? "正极" :
                // æ ¹æ®ä»»åŠ¡ç±»åž‹ç¡®å®šè¯·æ±‚åœ°å€
                (string upRequest, string gmRequest, string gmState) = GetRequestAddresses(taskType);
@@ -188,8 +189,13 @@
        }
        // è¾…助方法:创建任务对象
        private Dt_Task CreateTask(string currentAddress, string targetAddress, string remark, string palletCode, string taskType)
        private Dt_Task CreateTask(string currentAddress, string targetAddress, string remark, string palletCode, string taskType, int czTaskID = 0)
        {
            Dt_Task dt_Task = _taskRepository.QueryFirst(x => x.SourceAddress == currentAddress);
            if (dt_Task != null)
            {
                return null;
            }
            return new Dt_Task
            {
                TaskNum = _taskService.GetTaskNum(),
@@ -198,13 +204,14 @@
                CurrentAddress = currentAddress,
                SourceAddress = currentAddress,
                TaskState = targetAddress != "WaitBind" ? (int)TaskInStatusEnum.InNew : (int)TaskInStatusEnum.InPending,
                TaskType = (int)TaskInboundTypeEnum.Inbound,
                TaskType = (int)TaskOutboundTypeEnum.Outbound,
                Grade = 1,
                PalletCode = palletCode,
                TargetAddress = targetAddress,
                NextAddress = targetAddress,
                Barcode = "",
                Roadway = $"{taskType}AGV",
                WMSId = 0,
                WMSId = czTaskID > 0 ? czTaskID : 0,
                Remark = remark
            };
        }