huangxiaoqiang
昨天 843cc2ea1b104ecdf9da61318a4136a5d4096411
集成Quartz定时任务,支持NG出库自动化及WMS/WCS接口扩展

本次更新主要内容如下:

1. 集成Quartz任务调度框架,新增OutNGTask定时任务,实现NG出库任务自动化处理,并通过WMS接口下发NG任务。
2. WMSTaskDTO增加NextAddress字段,支持任务下发时指定下一位置。
3. 新增WCS接口ReceiveByWMSNGTask,支持WMS下发NG出库任务,ConfigConst同步增加相关常量。
4. 优化高温巷道任务分配逻辑,新增GetGWRoadWayAsync方法,实现巷道轮询分配,避免任务集中。
5. 任务完成时对OutNG类型区分高温/分容,分容走原有流程,高温走NG专用流程,新增CompleteNgTaskAsync方法。
6. 优化出库站台占用判断,提升任务下发安全性。
7. 多处优化日志输出与异常处理,减少无效日志,增强可维护性。
8. 升级/新增Quartz相关依赖,数据库结构同步更新。
9. 其他细节优化与Bug修复,提升系统健壮性和可用性。
已添加9个文件
已删除1个文件
已修改50个文件
1761 ■■■■ 文件已修改
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/CodeChunks.db 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/CodeChunks.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/CodeChunks.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/SemanticSymbols.db 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/SemanticSymbols.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/SemanticSymbols.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IProcessService/obj/Debug/net6.0/WIDESEAWCS_IProcessService.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfo_HtyRepository/obj/Debug/net6.0/WIDESEAWCS_ITaskInfo_HtyRepository.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfo_HtyService/obj/Debug/net6.0/WIDESEAWCS_ITaskInfo_HtyService.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessService/obj/Debug/net6.0/WIDESEAWCS_ProcessService.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SignalR/obj/Debug/net6.0/WIDESEAWCS_SignalR.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfo_HtyRepository/obj/Debug/net6.0/WIDESEAWCS_TaskInfo_HtyRepository.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfo_HtyService/obj/Debug/net6.0/WIDESEAWCS_TaskInfo_HtyService.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs 288 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob_NewCW/CommonStackerCrane_NewCWJob.cs 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/CodeChunks.db 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/CodeChunks.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/CodeChunks.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/SemanticSymbols.db 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/SemanticSymbols.db-shm 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/SemanticSymbols.db-wal 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Cache/obj/Debug/net6.0/WIDESEA_Cache.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/JobSetup.cs 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/ISchedulerCenter.cs 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/JobFactory.cs 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/JobSetup.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/ResponseContent.cs 45 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/SchedulerCenterServer.cs 470 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/TaskInfoDto.cs 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/TasksQz.cs 80 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/WMS/WMSTaskDTO.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationRepository/obj/Debug/net6.0/WIDESEA_IStoragIntegrationRepository.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationRepository/obj/Debug/net6.0/WIDESEA_StoragIntegrationRepository.AssemblyInfo.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/NGTask/OutNGTask.cs 168 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/QuartzJobMildd.cs 59 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/WIDESEA_Tasks.csproj 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/obj/WIDESEA_Tasks.csproj.nuget.g.targets 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_WMSServer.csproj 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/CodeChunks.db
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/CodeChunks.db-shm
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/CodeChunks.db-wal
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/SemanticSymbols.db
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/SemanticSymbols.db-shm
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/CopilotIndices/17.14.1569.27729/SemanticSymbols.db-wal
Binary files differ
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_DTO/TaskInfo/WMSTaskDTO.cs
@@ -49,6 +49,11 @@
        public string TargetAddress { get; set; }
        /// <summary>
        /// ä¸‹ä¸€ä½ç½®
        /// </summary>
        public string NextAddress { get; set; }
        /// <summary>
        /// ä¼˜å…ˆçº§
        /// </summary>
        public int Grade { get; set; }
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IProcessService/obj/Debug/net6.0/WIDESEAWCS_IProcessService.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEAWCS_IProcessService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+29aa484d06b2d4839536034bb1033d0e60334ec2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEAWCS_IProcessService")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEAWCS_IProcessService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -72,6 +72,13 @@
        WebResponseContent ReceiveByWMSGWTask([NotNull] WMSTaskDTO taskDTO);
        /// <summary>
        /// æŽ¥æ”¶WMSNg出库任务
        /// </summary>
        /// <param name="taskDTO"></param>
        /// <returns></returns>
        WebResponseContent ReceiveByWMSNGTask([NotNull] WMSTaskDTO taskDTO);
        /// <summary>
        /// æ ¹æ®æ‰˜ç›˜å·ã€èµ·å§‹åœ°å€å‘WMS请求任务
        /// </summary>
        /// <param name="palletCode">托盘号</param>
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfo_HtyRepository/obj/Debug/net6.0/WIDESEAWCS_ITaskInfo_HtyRepository.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEAWCS_ITaskInfo_HtyRepository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+29aa484d06b2d4839536034bb1033d0e60334ec2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEAWCS_ITaskInfo_HtyRepository")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEAWCS_ITaskInfo_HtyRepository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfo_HtyService/obj/Debug/net6.0/WIDESEAWCS_ITaskInfo_HtyService.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEAWCS_ITaskInfo_HtyService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+29aa484d06b2d4839536034bb1033d0e60334ec2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEAWCS_ITaskInfo_HtyService")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEAWCS_ITaskInfo_HtyService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessService/obj/Debug/net6.0/WIDESEAWCS_ProcessService.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEAWCS_ProcessService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+02a4fdd78cef9c7d2a26bfb9aa187179cf0baac3")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEAWCS_ProcessService")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEAWCS_ProcessService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs
@@ -94,7 +94,7 @@
            {
            }
            return Json(vueDictionaryDTOs);
            return Json(vueDictionaryDTOs.GroupBy(x => x.DicNo).Select(g => g.First()).ToList());
        }
        private VueDictionaryDTO? GetVueDictionary(string key)
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/Task/TaskController.cs
@@ -36,6 +36,11 @@
        {
            return Service.ReceiveByWMSGWTask(taskDTOs);
        }
        [HttpPost, Route("ReceiveByWMSNGTask"), AllowAnonymous]
        public WebResponseContent ReceiveByWMSNGTask([FromBody] WMSTaskDTO taskDTOs)
        {
            return Service.ReceiveByWMSNGTask(taskDTOs);
        }
        [HttpPost, HttpGet, Route("UpdateTaskExceptionMessage")]
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SignalR/obj/Debug/net6.0/WIDESEAWCS_SignalR.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEAWCS_SignalR")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+29aa484d06b2d4839536034bb1033d0e60334ec2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEAWCS_SignalR")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEAWCS_SignalR")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/Partial/TaskService.cs
@@ -252,7 +252,7 @@
                // å‘起请求获取入库任务
                content = await RequestInTask(palletCode, stationManager);
                ConsoleHelper.WriteErrorLine($"{stationManager.stationChildCode}站台请求响应信息:{content.ToJsonString()}");
                //ConsoleHelper.WriteErrorLine($"{stationManager.stationChildCode}站台请求响应信息:{content.ToJsonString()}");
                if (!content.Status)
                {
@@ -260,7 +260,7 @@
                }
                var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
                ConsoleHelper.WriteSuccessLine(content.Data.ToString());
                //ConsoleHelper.WriteSuccessLine(content.Data.ToString());
                return ReceiveByWMSTask(task);
            }
            catch (Exception ex)
@@ -559,6 +559,7 @@
                    task.NextAddress = "002-000-002";
                    task.SourceAddress = taskDTO.SourceAddress;
                    task.TargetAddress = taskDTO.TargetAddress;
                }
                BaseDal.AddData(task);
@@ -573,6 +574,44 @@
            return content;
        }
        public WebResponseContent ReceiveByWMSNGTask([NotNull] WMSTaskDTO taskDTO)
        {
            WebResponseContent content = new WebResponseContent();
            try
            {
                var task = BaseDal.QueryFirst(x => x.TaskNum == taskDTO.TaskNum || x.PalletCode == taskDTO.PalletCode);
                if (task != null)
                {
                    var taskHty = task.Adapt<Dt_Task_Hty>();
                    _taskHtyRepository.AddData(taskHty);
                    BaseDal.DeleteData(task);
                }
                Dt_Task taskNew = _mapper.Map<Dt_Task>(taskDTO);
                taskNew.Creater = "WMS";
                if (taskNew.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                {
                    taskNew.TaskState = (int)TaskOutStatusEnum.OutNew;
                    taskNew.CurrentAddress = taskDTO.SourceAddress;
                    taskNew.NextAddress = taskDTO.NextAddress;
                    taskNew.SourceAddress = taskDTO.SourceAddress;
                    taskNew.TargetAddress = taskDTO.TargetAddress;
                }
                BaseDal.AddData(taskNew);
                _taskExecuteDetailService.AddTaskExecuteDetail(taskNew.WMSId, "接收WMS任务");
                content = WebResponseContent.Instance.OK("成功");
            }
            catch (Exception ex)
            {
                content = WebResponseContent.Instance.Error($"任务接收错误,错误信息:{ex.Message}");
            }
            return content;
        }
        /// <summary>
        /// æŽ¥æ”¶WMS任务信息
        /// </summary>
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -778,7 +778,7 @@
                if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
                {
                    if (!task.Roadway.Contains("GW") && task.TaskType != (int)TaskOutboundTypeEnum.InToOut)
                    if (!task.Roadway.Contains("GW") && task.TaskType != (int)TaskOutboundTypeEnum.InToOut && task.TaskType != (int)TaskOutboundTypeEnum.OutNG)
                    {
                        var routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress);
                        if (!routers.Any()) return WebResponseContent.Instance.Error($"未找到设备路由信息");
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfo_HtyRepository/obj/Debug/net6.0/WIDESEAWCS_TaskInfo_HtyRepository.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEAWCS_TaskInfo_HtyRepository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+29aa484d06b2d4839536034bb1033d0e60334ec2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEAWCS_TaskInfo_HtyRepository")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEAWCS_TaskInfo_HtyRepository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfo_HtyService/obj/Debug/net6.0/WIDESEAWCS_TaskInfo_HtyService.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEAWCS_TaskInfo_HtyService")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+29aa484d06b2d4839536034bb1033d0e60334ec2")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEAWCS_TaskInfo_HtyService")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEAWCS_TaskInfo_HtyService")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_After/CommonConveyorLine_AfterJob.cs
@@ -171,7 +171,6 @@
            _noticeService.Logs(userTokenIds, new { conveyorLine.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
            WriteInfo(conveyorLine.DeviceName, log);
            //if()
            var taskNew = _taskService.QueryTaskByPalletCode(command.ConveyorLineBarcode, stationInfo.Roadway);
            if (taskNew == null)
@@ -214,7 +213,6 @@
            var taskNew = _taskRepository.QueryFirst(x => x.Roadway == stationInfo.Roadway && x.TaskType == (int)TaskOutboundTypeEnum.OutTray);
            if (taskNew == null)   //不存在空框出库任务 åˆ™è¯·æ±‚WMS出空库
            {
                ConsoleHelper.WriteWarningLine("请求空托盘");
                if (_taskService.RequestTask(command.ConveyorLineBarcode, stationInfo).Result.Status)
                {
                    Dt_Task task = _taskService.QueryTaskByPalletCode(command.ConveyorLineBarcode, stationInfo.Roadway);
@@ -284,26 +282,24 @@
                    WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
                    if (!content.Status)
                    {
                        ConsoleHelper.WriteErrorLine($"{stationManager.stationChildCode}分容呼叫空托盘失败{content.Message}");
                        return;
                    }
                    WMSTaskDTO wMSTaskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
                    ConsoleHelper.WriteSuccessLine(content.Data.ToString());
                    List<WMSTaskDTO> wMSTaskDTOs = new List<WMSTaskDTO>() { wMSTaskDTO };
                    _taskService.ReceiveWMSTask(wMSTaskDTOs);
                    needBarcode.inLineNum += 1;
                    _needBarcodeRepository.UpdateData(needBarcode);
                }
                else
                {
                    ConsoleHelper.WriteErrorLine($"分容空托盘入口【{stationManager.stationChildCode}】在途数量>缓存数量");
                }
                //else
                //{
                //    ConsoleHelper.WriteErrorLine($"分容空托盘入口【{stationManager.stationChildCode}】在途数量>缓存数量");
                //}
            }
            else
            {
                ConsoleHelper.WriteErrorLine($"分容空托盘入口【{stationManager.stationChildCode}】有盘");
            }
            //else
            //{
            //    ConsoleHelper.WriteErrorLine($"分容空托盘入口【{stationManager.stationChildCode}】有盘");
            //}
        }
    }
}
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CWTask/RequestInbound.cs
@@ -189,8 +189,6 @@
                        _taskService.Delete(taskExecuting);
                    }
                    ConsoleHelper.WriteErrorLine($"当前托盘存在任务:【{command.ConveyorLineBarcode}】");
                    WriteInfo(conveyorLine.DeviceName, $"当前托盘存在任务{command.ConveyorLineBarcode}");
                }
@@ -260,16 +258,6 @@
                    var task = _taskService.QueryBarCodeConveyorLineTask(command.ConveyorLineBarcode, childDeviceCode);
                    if (task != null)
                    {
                        if (childDeviceCode == "1039")
                        {
                            var GWTask = _taskRepository.QueryData(x => x.Roadway.Contains("GWSC2") && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList();
                            if (GWTask.Count >= 2 && childDeviceCode == "1039" && task.Roadway.Contains("GWSC2"))
                            {
                                ConsoleHelper.WriteErrorLine($"托盘号:【{command.ConveyorLineBarcode}】高温二已存在【{GWTask.Count}】个任务大于2个任务不可下发");
                                return;
                            }
                        }
                        ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
                        bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode);
@@ -283,7 +271,7 @@
                }
                else
                {
                    if (content.Message != "请求过于频繁,请稍后再试" && content.Message != "无法获取目标地址")
                    if (content.Message != "请求过于频繁,请稍后再试" && content.Message != "无法获取目标地址" && !content.Message.Contains("存在任务") && !content.Message.Contains("存在库存不允许入库"))
                    {
                        WriteInfo(conveyorLine.DeviceName, content.Message);
                        conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, stationManager.stationNGChildCode, childDeviceCode);
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_CW/CommonConveyorLine_CWJob.cs
@@ -239,16 +239,6 @@
                }
                else
                {
                    //if (childDeviceCode == "1039")
                    //{
                    //    var GWTask = _taskRepository.QueryData(x => x.Roadway.Contains("GWSC2") && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList();
                    //    if (GWTask.Count >= 2 && childDeviceCode == "1039" && task.Roadway.Contains("GWSC2"))
                    //    {
                    //        ConsoleHelper.WriteErrorLine($"时间:【{DateTime.Now}】托盘号:【{command.ConveyorLineBarcode}】高温二已存在【{GWTask.Count}】个任务大于2个任务不可下发");
                    //        return;
                    //    }
                    //}
                    ConveyorLineTaskCommand_After taskCommand = _mapper.Map<ConveyorLineTaskCommand_After>(task);
                    bool sendFlag = SendCommand(taskCommand, conveyorLine, childDeviceCode);
@@ -645,8 +635,6 @@
                var result = await HttpHelper.PostAsync(wmsIpAddress, new { Position = childDeviceCode, Tag = (int)taskType, AreaCdoe = platform.Stacker, AreaCdoes = strings, platform.ProductionLine }.Serialize());
                WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
                ConsoleHelper.WriteSuccessLine($"时间:【{DateTime.Now}】请求WMS出库任务返回结果:【{content.Serialize()}】");
                // æ£€æŸ¥çŠ¶æ€å¹¶è¿”å›ž
                if (!content.Status)
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -135,7 +135,7 @@
                        if (command == null) continue;
                        //if (command.InteractiveSignal == 0 && command.HasPallet != 1) continue;
                        if (command.ConveyorLineBarcode.Trim().Contains("\0")) command.ConveyorLineBarcode = "";
                        DeviceProtocolDetailDTO? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.FirstOrDefault(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand_After.InteractiveSignal) && x.ProtocalDetailValue == command.InteractiveSignal.ToString());
                        if (deviceProtocolDetails != null)
                        {
@@ -231,10 +231,10 @@
                {
                    if (childDeviceCode == "1039")
                    {
                        var GWTask = _taskRepository.QueryData(x => (x.Roadway.Contains("GWSC2")|| x.Roadway.Contains("GWSC3")) && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList();
                        var GWTask = _taskRepository.QueryData(x => (x.Roadway.Contains("GWSC2") || x.Roadway.Contains("GWSC3")) && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList();
                        if ((GWTask.Where(x => x.Roadway.Contains("GWSC2")).ToList().Count >= 2 && task.Roadway.Contains("GWSC2")) || (GWTask.Where(x => x.Roadway.Contains("GWSC3")).ToList().Count >= 2 && task.Roadway.Contains("GWSC3")))
                        {
                            ConsoleHelper.WriteErrorLine($"时间:【{DateTime.Now}】托盘号:【{command.ConveyorLineBarcode}】高温{(task.Roadway.Contains("GWSC3")?"三":"二")}已存在【{GWTask.Count}】个任务大于2个任务不可下发");
                            //ConsoleHelper.WriteErrorLine($"时间:【{DateTime.Now}】托盘号:【{command.ConveyorLineBarcode}】高温{(task.Roadway.Contains("GWSC3") ? "三" : "二")}已存在【{GWTask.Count}】个任务大于2个任务不可下发");
                            return;
                        }
                    }
@@ -582,7 +582,7 @@
            var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
            if (content.Status)
            {
                Console.WriteLine($"{taskDTO.TaskType}呼叫成功");
                //Console.WriteLine($"{taskDTO.TaskType}呼叫成功");
            }
            return content;
        }
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
@@ -254,7 +254,7 @@
                        _taskService.Delete(taskExecuting);
                    }
                    ConsoleHelper.WriteErrorLine($"当前托盘存在任务:【{command.ConveyorLineBarcode}】");
                    //ConsoleHelper.WriteErrorLine($"当前托盘存在任务:【{command.ConveyorLineBarcode}】");
                    WriteInfo(conveyorLine.DeviceName, $"当前托盘存在任务{command.ConveyorLineBarcode}");
                }
@@ -323,10 +323,16 @@
                    {
                        if (childDeviceCode == "1039")
                        {
                            var GWTask = _taskRepository.QueryData(x => x.Roadway.Contains("GWSC2") && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList();
                            if (GWTask.Count >= 2 && childDeviceCode == "1039" && task.Roadway.Contains("GWSC2"))
                            //var GWTask = _taskRepository.QueryData(x => x.Roadway.Contains("GWSC2") && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList();
                            //if (GWTask.Count >= 2 && childDeviceCode == "1039" && task.Roadway.Contains("GWSC2"))
                            //{
                            //    ConsoleHelper.WriteErrorLine($"托盘号:【{command.ConveyorLineBarcode}】高温二已存在【{GWTask.Count}】个任务大于2个任务不可下发");
                            //    return;
                            //}
                            var GWTask = _taskRepository.QueryData(x => (x.Roadway.Contains("GWSC2") || x.Roadway.Contains("GWSC3")) && x.SourceAddress == "1039" && (x.TaskState == (int)TaskInStatusEnum.Line_InExecuting || x.TaskState == (int)TaskInStatusEnum.Line_InFinish)).ToList();
                            if ((GWTask.Where(x => x.Roadway.Contains("GWSC2")).ToList().Count >= 2 && task.Roadway.Contains("GWSC2")) || (GWTask.Where(x => x.Roadway.Contains("GWSC3")).ToList().Count >= 2 && task.Roadway.Contains("GWSC3")))
                            {
                                ConsoleHelper.WriteErrorLine($"托盘号:【{command.ConveyorLineBarcode}】高温二已存在【{GWTask.Count}】个任务大于2个任务不可下发");
                                //ConsoleHelper.WriteErrorLine($"时间:【{DateTime.Now}】托盘号:【{command.ConveyorLineBarcode}】高温{(task.Roadway.Contains("GWSC3") ? "三" : "二")}已存在【{GWTask.Count}】个任务大于2个任务不可下发");
                                return;
                            }
                        }
@@ -345,15 +351,13 @@
                }
                else
                {
                    if (content.Message != "请求过于频繁,请稍后再试" && content.Message != "无法获取目标地址" && !content.Message.Contains("存在任务"))
                    if (content.Message != "请求过于频繁,请稍后再试" && content.Message != "无法获取目标地址" && !content.Message.Contains("存在任务") && !content.Message.Contains("存在库存不允许入库"))
                    {
                        WriteInfo(conveyorLine.DeviceName, content.Message);
                        conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, stationManager.stationNGChildCode, childDeviceCode);
                        conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, Convert.ToInt16(1), childDeviceCode);
                        ConsoleHelper.WriteErrorLine($"【{conveyorLine.DeviceName}】托盘号:【{command.ConveyorLineBarcode}】请求点位:【{childDeviceCode}】异常信息【{content.Message}】");
                        WriteInfo(conveyorLine.DeviceName, $"【{conveyorLine.DeviceName}】托盘号:【{command.ConveyorLineBarcode}】请求点位:【{childDeviceCode}】异常信息【{content.Message}】");
                    }
                    ConsoleHelper.WriteErrorLine($"【{conveyorLine.DeviceName}】托盘号:【{command.ConveyorLineBarcode}】请求点位:【{childDeviceCode}】异常信息【{content.Message}】");
                }
            }
            catch (Exception ex)
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -1,4 +1,5 @@
using Mapster;
using Autofac.Core;
using Mapster;
using Newtonsoft.Json;
using Quartz;
using System.Diagnostics.CodeAnalysis;
@@ -60,7 +61,6 @@
        {
            try
            {
                CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams");
                if (commonStackerCrane != null)
                {
@@ -81,35 +81,30 @@
                                StackerCraneTaskCommand? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
                                if (stackerCraneTaskCommand != null)
                                {
                                    var taskNum = commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.TaskNum);
                                    //var taskBarCode = commonStackerCrane.GetValue<StackerCraneDBName, string>(StackerCraneDBName.Barcode);
                                    ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】堆垛机任务号:【{taskNum}】任务任务号:【{task.TaskNum}】", ConsoleColor.DarkBlue);
                                    if (taskNum == 0)
                                    bool IsInStock = commonStackerCrane.Communicator.Read<bool>("DB14.4.3");
                                    if (!IsInStock)
                                    {
                                        ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】任务号为【{0}】,任务号不一致可以下发任务", ConsoleColor.DarkBlue);
                                        Thread.Sleep(1000);
                                        bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                        if (sendFlag)
                                        var taskNum = commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.TaskNum);
                                        ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】堆垛机任务号:【{taskNum}】任务任务号:【{task.TaskNum}】", ConsoleColor.DarkBlue);
                                        if (taskNum == 0)
                                        {
                                            StringBuilder builder = new StringBuilder();
                                            builder.AppendLine();
                                            builder.AppendLine($"【{commonStackerCrane.DeviceName}】堆垛机状态:【{commonStackerCrane.StackerCraneStatusDes}】,时间:【{DateTime.Now}】");
                                            builder.AppendLine($"【{commonStackerCrane.DeviceName}】手自动状态:【{commonStackerCrane.StackerCraneAutoStatusDes}】,时间:【{DateTime.Now}】");
                                            builder.AppendLine($"【{commonStackerCrane.DeviceName}】作业状态:【{commonStackerCrane.StackerCraneWorkStatusDes}】,时间:【{DateTime.Now}】");
                                            builder.AppendLine($"【{commonStackerCrane.DeviceName}】下发任务成功,【{JsonConvert.SerializeObject(stackerCraneTaskCommand, Formatting.Indented)}】");
                                            builder.AppendLine($"时间:【{DateTime.Now}】");
                                            builder.AppendLine();
                                            ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue);
                                            commonStackerCrane.LastTaskType = task.TaskType;
                                            _taskService.UpdateTaskStatusToNext(task.TaskNum);
                                            Thread.Sleep(1000);
                                            bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                            if (sendFlag)
                                            {
                                                commonStackerCrane.LastTaskType = task.TaskType;
                                                _taskService.UpdateTaskStatusToNext(task.TaskNum);
                                            }
                                        }
                                        else
                                        {
                                            ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】任务号不为【{0}】,不可以下发任务", ConsoleColor.DarkBlue);
                                        }
                                    }
                                    else
                                    {
                                        ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】任务号不为【{0}】,不可以下发任务", ConsoleColor.DarkBlue);
                                        ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】有货信息不为【{0}】,不可以下发任务", ConsoleColor.DarkBlue);
                                        WriteInfo("堆垛机有货信号", $"【{commonStackerCrane.DeviceName}】有货信息不为【{IsInStock}】,不可以下发任务");
                                    }
                                }
                            }
@@ -162,8 +157,6 @@
            {
                if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
                {
                    ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】堆垛机作业状态:【{(int)commonStackerCrane.StackerCraneWorkStatusValue}】时间【{DateTime.Now}】", ConsoleColor.Magenta);
                    string str = $"【{commonStackerCrane.DeviceName}】任务完成,任务号:【{e.TaskNum}】时间【{DateTime.Now}】";
                    WriteInfo(commonStackerCrane.DeviceName, str);
                    ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
@@ -171,9 +164,9 @@
                    if (task == null) commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
                    if (commonStackerCrane.DeviceCode.Contains("CW") && task.TaskType==(int)TaskOutboundTypeEnum.InToOut)
                    if (commonStackerCrane.DeviceCode.Contains("CW") && task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
                    {
                        var stationinfo = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017"||x.stationPLC=="1024") && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode);
                        var stationinfo = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017" || x.stationPLC == "1024") && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode);
                        IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC);
                        if (device != null)
@@ -189,6 +182,48 @@
                            {
                                CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode);
                                Thread.Sleep(100);
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
                            }
                        }
                        WriteInfo(commonStackerCrane.DeviceName, $"【手动出库记录】任务号【{e.TaskNum}】托盘号【{task.PalletCode}】");
                    }
                    if (task.TaskType == (int)TaskOutboundTypeEnum.OutNG)
                    {
                        Dt_StationManager stationinfo = null;
                        if (commonStackerCrane.DeviceCode.Contains("CW"))
                            stationinfo = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017" || x.stationPLC == "1024") && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode);
                        else
                            stationinfo = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.stationChildCode == task.TargetAddress);
                        IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC);
                        if (device != null)
                        {
                            if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
                            {
                                CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode);
                                Thread.Sleep(100);
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, stationinfo.stationChildCode);
                                Thread.Sleep(100);
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
                            }
                            else if (device.DeviceCode == "1015" || device.DeviceCode == "2025")
                            {
                                CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(1815), stationinfo.stationChildCode);
                                Thread.Sleep(100);
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, stationinfo.stationChildCode);
                                Thread.Sleep(100);
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
                            }
                            else
                            {
                                CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode);
                                Thread.Sleep(100);
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, task.PalletCode, stationinfo.stationChildCode);
                                Thread.Sleep(100);
                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
                            }
@@ -219,19 +254,23 @@
                    }
                    var content = _taskService.StackCraneTaskCompleted(e.TaskNum);
                    if (commonStackerCrane.DeviceCode.Contains("CH") && task.TaskType == (int)TaskOutboundTypeEnum.Outbound)
                    {
                        task = _taskRepository.QueryFirst(x => x.TaskNum == e.TaskNum);
                        Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
                        _taskService.UpdateData(newTask);
                    }
                    if ((task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && (task.TargetAddress == "002-021-001" || task.TargetAddress == "001-021-001"))|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm)
                    {
                        var TASKHTY = task.Adapt<Dt_Task_Hty>();
                        _taskRepository.DeleteData(task);
                        _htyRepository.AddData(TASKHTY);
                    }
                    var isWorkType = commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
                    str = $"{commonStackerCrane.DeviceName}】WMS|WCS任务完成:【{content.Status}】,堆垛机完成信号写入:【{isWorkType}】,任务号:【{e.TaskNum}】时间【{DateTime.Now}】";
                    WriteInfo(commonStackerCrane.DeviceName, str);
                    ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
@@ -315,98 +354,155 @@
        /// <returns>如果未被占用,返回传入的任务信息,否则,返回null</returns>
        private Dt_Task? OutTaskStationIsOccupied([NotNull] Dt_Task task)
        {
            Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault();
            if (task.Roadway.Contains("GW") || task.Roadway.Contains("CW"))
            if (task.TaskType == (int)TaskOutboundTypeEnum.OutNG)
            {
                if (router != null)
                if (task.Roadway.Contains("CW"))
                {
                    IDevice? device = null;
                    if (task.Roadway.Contains("CW"))
                    var stationinfo = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017" || x.stationPLC == "1024") && x.stationType == 10 && x.Roadway == task.Roadway);
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC);
                    if (device != null)
                    {
                        device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
                        if (device != null)
                        if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
                        {
                            if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
                            CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
                            if (conveyorLine.IsOccupied(task.TargetAddress))//出库站台未被占用
                            {
                                CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
                                if (conveyorLine.IsOccupied(task.NextAddress))//出库站台未被占用
                                return task;
                            }
                        }
                        else
                        {
                            CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
                            if (conveyorLine.IsOccupied(task.TargetAddress))//出库站台未被占用
                            {
                                return task;
                            }
                        }
                    }
                    else
                    {
                        _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.NextAddress}】对应的通讯对象,无法判断出库站台是否被占用");
                    }
                }
                else
                {
                    var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && x.stationChildCode == task.TargetAddress);
                    IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC);
                    if (device != null)
                    {
                        CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
                        if (conveyorLine.IsOccupied(task.TargetAddress))//出库站台未被占用
                        {
                            return task;
                        }
                    }
                    else
                    {
                        _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.NextAddress}】对应的通讯对象,无法判断出库站台是否被占用");
                    }
                }
            }
            else
            {
                Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault();
                if (task.Roadway.Contains("GW") || task.Roadway.Contains("CW"))
                {
                    if (router != null)
                    {
                        IDevice? device = null;
                        if (task.Roadway.Contains("CW"))
                        {
                            device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
                            if (device != null)
                            {
                                if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
                                {
                                    CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
                                    if (conveyorLine.IsOccupied(task.NextAddress))//出库站台未被占用
                                    {
                                        return task;
                                    }
                                }
                                else
                                {
                                    CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
                                    if (conveyorLine.IsOccupied(task.NextAddress))//出库站台未被占用
                                    {
                                        return task;
                                    }
                                }
                            }
                            else
                            {
                                _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.NextAddress}】对应的通讯对象,无法判断出库站台是否被占用");
                            }
                        }
                    }
                    else
                    {
                        IDevice? device = null;
                        if (task.Roadway.Contains("GW"))
                        {
                            string targetDeviceCode = task.Roadway == "GWSC3" ? "2025" : "1015";
                            device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == targetDeviceCode);
                            if (device != null)
                            {
                                CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
                                if (conveyorLine.IsOccupied(task.TargetAddress))//出库站台未被占用
                                {
                                    return task;
                                }
                            }
                            else
                            {
                                CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
                                if (conveyorLine.IsOccupied(task.NextAddress))//出库站台未被占用
                                _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.TargetAddress}】对应的通讯对象,无法判断出库站台是否被占用");
                            }
                        }
                        //_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.TargetAddress}】信息,无法校验站台");
                    }
                }
                else
                {
                    if ((task.NextAddress == ("002-021-001") || task.NextAddress == ("001-021-001")) && task.Roadway.Contains("JZ"))
                    {
                        return task;
                    }
                    else
                    {
                        //Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault();
                        if (router != null)
                        {
                            IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
                            if (device != null)
                            {
                                CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                                if (conveyorLine.IsOccupiedx(router.ChildPosi))//出库站台未被占用
                                {
                                    return task;
                                }
                            }
                        }
                        else
                        {
                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.NextAddress}】对应的通讯对象,无法判断出库站台是否被占用");
                        }
                    }
                }
                else
                {
                    IDevice? device = null;
                    if (task.Roadway.Contains("GW"))
                    {
                        string targetDeviceCode = task.Roadway == "GWSC3" ? "2025" : "1015";
                        device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == targetDeviceCode);
                        if (device != null)
                        {
                            CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
                            if (conveyorLine.IsOccupied(task.TargetAddress))//出库站台未被占用
                            else
                            {
                                return task;
                                _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{router.ChildPosiDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                            }
                        }
                        else
                        {
                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{task.TargetAddress}】对应的通讯对象,无法判断出库站台是否被占用");
                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
                        }
                    }
                    //_taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.TargetAddress}】信息,无法校验站台");
                }
            }
            else
            {
                if ((task.NextAddress == ("002-021-001") || task.NextAddress == ("001-021-001")) && task.Roadway.Contains("JZ"))
                {
                    return task;
                }
                else
                {
                    //Dt_Router? router = _routerService.QueryNextRoutes(task.Roadway, task.NextAddress).FirstOrDefault();
                    if (router != null)
                    {
                        IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
                        if (device != null)
                        {
                            CommonConveyorLine conveyorLine = (CommonConveyorLine)device;
                            if (conveyorLine.IsOccupiedx(router.ChildPosi))//出库站台未被占用
                            {
                                return task;
                            }
                        }
                        else
                        {
                            _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到出库站台【{router.ChildPosiDeviceCode}】对应的通讯对象,无法判断出库站台是否被占用");
                        }
                    }
                    else
                    {
                        _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"未找到站台【{task.NextAddress}】信息,无法校验站台");
                    }
                }
            }
            return null;
        }
        /// <summary>
        /// æŸ¥æ‰¾å…¶ä»–出库任务的辅助方法(排除指定任务ID的任务)
        /// </summary>
@@ -523,7 +619,7 @@
            }
            else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
            {
                if (task.Roadway.Contains("GW")|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm)
                if (task.Roadway.Contains("GW")|| task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm || task.TaskType == (int)TaskOutboundTypeEnum.OutNG)
                {
                    string[] endCodes = task.NextAddress.Split("-");
                    stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]);
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob_NewCW/CommonStackerCrane_NewCWJob.cs
@@ -82,27 +82,14 @@
                                if (stackerCraneTaskCommand != null)
                                {
                                    var taskNum = commonStackerCrane.GetValue<StackerCraneDBName, int>(StackerCraneDBName.TaskNum);
                                    //var taskBarCode = commonStackerCrane.GetValue<StackerCraneDBName, string>(StackerCraneDBName.Barcode);
                                    ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】堆垛机任务号:【{taskNum}】任务任务号:【{task.TaskNum}】", ConsoleColor.DarkBlue);
                                    if (taskNum == 0)
                                    {
                                        ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】任务号为【{0}】,任务号不一致可以下发任务", ConsoleColor.DarkBlue);
                                        Thread.Sleep(1000);
                                        bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                        if (sendFlag)
                                        {
                                            StringBuilder builder = new StringBuilder();
                                            builder.AppendLine();
                                            builder.AppendLine($"【{commonStackerCrane.DeviceName}】堆垛机状态:【{commonStackerCrane.StackerCraneStatusDes}】,时间:【{DateTime.Now}】");
                                            builder.AppendLine($"【{commonStackerCrane.DeviceName}】手自动状态:【{commonStackerCrane.StackerCraneAutoStatusDes}】,时间:【{DateTime.Now}】");
                                            builder.AppendLine($"【{commonStackerCrane.DeviceName}】作业状态:【{commonStackerCrane.StackerCraneWorkStatusDes}】,时间:【{DateTime.Now}】");
                                            builder.AppendLine($"【{commonStackerCrane.DeviceName}】下发任务成功,【{JsonConvert.SerializeObject(stackerCraneTaskCommand, Formatting.Indented)}】");
                                            builder.AppendLine($"时间:【{DateTime.Now}】");
                                            builder.AppendLine();
                                            ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue);
                                            commonStackerCrane.LastTaskType = task.TaskType;
                                            _taskService.UpdateTaskStatusToNext(task.TaskNum);
                                        }
@@ -162,8 +149,6 @@
            {
                if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
                {
                    ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】堆垛机作业状态:【{(int)commonStackerCrane.StackerCraneWorkStatusValue}】时间【{DateTime.Now}】", ConsoleColor.Magenta);
                    string str = $"【{commonStackerCrane.DeviceName}】任务完成,任务号:【{e.TaskNum}】时间【{DateTime.Now}】";
                    WriteInfo(commonStackerCrane.DeviceName, str);
                    ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
@@ -185,9 +170,6 @@
                        }
                        WriteInfo(commonStackerCrane.DeviceName, $"【手动出库记录】任务号【{e.TaskNum}】托盘号【{task.PalletCode}】");
                    }
                    if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                    {
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerStationJob/CommonStackerStationCraneJob.cs
@@ -83,15 +83,6 @@
                                    bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
                                    if (sendFlag)
                                    {
                                        StringBuilder builder = new StringBuilder();
                                        builder.AppendLine();
                                        builder.AppendLine($"【{commonStackerCrane.DeviceName}】堆垛机状态:【{commonStackerCrane.StackerCraneStatusDes}】,时间:【{DateTime.Now}】");
                                        builder.AppendLine($"【{commonStackerCrane.DeviceName}】手自动状态:【{commonStackerCrane.StackerCraneAutoStatusDes}】,时间:【{DateTime.Now}】");
                                        builder.AppendLine($"【{commonStackerCrane.DeviceName}】作业状态:【{commonStackerCrane.StackerCraneWorkStatusDes}】,时间:【{DateTime.Now}】");
                                        builder.AppendLine($"【{commonStackerCrane.DeviceName}】下发任务成功,【{JsonConvert.SerializeObject(stackerCraneTaskCommand, Formatting.Indented)}】");
                                        builder.AppendLine($"时间:【{DateTime.Now}】");
                                        builder.AppendLine();
                                        ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue);
                                        commonStackerCrane.LastTaskType = task.TaskType;
                                        _taskService.UpdateTaskStatusToNext(task.TaskNum);
                                    }
@@ -151,8 +142,6 @@
            {
                if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
                {
                    ConsoleHelper.WriteColorLine($"【{commonStackerCrane.DeviceName}】堆垛机作业状态:【{(int)commonStackerCrane.StackerCraneWorkStatusValue}】时间【{DateTime.Now}】", ConsoleColor.Magenta);
                    string str = $"【{commonStackerCrane.DeviceName}】任务完成,任务号:【{e.TaskNum}】时间【{DateTime.Now}】";
                    WriteInfo(commonStackerCrane.DeviceName, str);
                    ConsoleHelper.WriteColorLine(str, ConsoleColor.Blue);
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/CodeChunks.db
Binary files differ
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/CodeChunks.db-shm
Binary files differ
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/CodeChunks.db-wal
Binary files differ
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/SemanticSymbols.db
Binary files differ
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/SemanticSymbols.db-shm
Binary files differ
Code Management/WMS/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1569.27729/SemanticSymbols.db-wal
Binary files differ
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Cache/obj/Debug/net6.0/WIDESEA_Cache.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEA_Cache")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bfa85418f2da7b0f3570d7e44b203727c637b729")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEA_Cache")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEA_Cache")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Const/ConfigConst.cs
@@ -143,6 +143,11 @@
        public const string ReceiveTask = "ReceiveTask";
        /// <summary>
        /// è¯·æ±‚WCS任务下发NG出库任务
        /// </summary>
        public const string ReceiveByWMSNGTask = "ReceiveByWMSNGTask";
        /// <summary>
        /// è¯·æ±‚WCS任务
        /// </summary>
        public const string GetStation = "GetStation";
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Enums/ManageEnum.cs
@@ -587,5 +587,6 @@
        è‡ªåŠ¨æ¢å¤ = 4,
        äººå·¥å®Œæˆ = 5,
        è‡ªåŠ¨å®Œæˆ = 6,
        NG任务删除 = 7,
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/Extensions/JobSetup.cs
ÎļþÒÑɾ³ý
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/ISchedulerCenter.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,71 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace WIDESEA.QuartzJob
{
    public interface ISchedulerCenter
    {
        /// <summary>
        /// å¼€å¯ä»»åŠ¡è°ƒåº¦
        /// </summary>
        /// <returns></returns>
        Task<ResponseContent> StartScheduleAsync();
        /// <summary>
        /// åœæ­¢ä»»åŠ¡è°ƒåº¦
        /// </summary>
        /// <returns></returns>
        Task<ResponseContent> StopScheduleAsync();
        /// <summary>
        ///
        /// </summary>
        /// <param name="sysSchedule"></param>
        /// <returns></returns>
        Task<ResponseContent> AddScheduleJobAsync(TasksQz sysSchedule);
        /// <summary>
        /// åœæ­¢ä¸€ä¸ªä»»åŠ¡
        /// </summary>
        /// <param name="sysSchedule"></param>
        /// <returns></returns>
        Task<ResponseContent> StopScheduleJobAsync(TasksQz sysSchedule);
        /// <summary>
        /// æ£€æµ‹ä»»åŠ¡æ˜¯å¦å­˜åœ¨
        /// </summary>
        /// <param name="sysSchedule"></param>
        /// <returns></returns>
        Task<bool> IsExistScheduleJobAsync(TasksQz sysSchedule);
        /// <summary>
        /// æš‚停指定的计划任务
        /// </summary>
        /// <param name="sysSchedule"></param>
        /// <returns></returns>
        Task<ResponseContent> PauseJob(TasksQz sysSchedule);
        /// <summary>
        /// æ¢å¤ä¸€ä¸ªä»»åŠ¡
        /// </summary>
        /// <param name="sysSchedule"></param>
        /// <returns></returns>
        Task<ResponseContent> ResumeJob(TasksQz sysSchedule);
        /// <summary>
        /// èŽ·å–ä»»åŠ¡è§¦å‘å™¨çŠ¶æ€
        /// </summary>
        /// <param name="sysSchedule"></param>
        /// <returns></returns>
        Task<List<TaskInfoDto>> GetTaskStaus(TasksQz sysSchedule);
        /// <summary>
        /// èŽ·å–è§¦å‘å™¨æ ‡è¯†
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        string GetTriggerState(string key);
        /// <summary>
        /// ç«‹å³æ‰§è¡Œ ä¸€ä¸ªä»»åŠ¡
        /// </summary>
        /// <param name="tasksQz"></param>
        /// <returns></returns>
        Task<ResponseContent> ExecuteJobAsync(TasksQz tasksQz);
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/JobFactory.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,51 @@
using Microsoft.Extensions.DependencyInjection;
using Quartz;
using Quartz.Spi;
using System;
using System.Collections.Generic;
using System.Text;
namespace WIDESEA.QuartzJob
{
    public class JobFactory : IJobFactory
    {
        /// <summary>
        /// æ³¨å…¥åå°„获取依赖对象
        /// </summary>
        private readonly IServiceProvider _serviceProvider;
        public JobFactory(IServiceProvider serviceProvider)
        {
            _serviceProvider = serviceProvider;
        }
        /// <summary>
        /// å®žçŽ°æŽ¥å£Job
        /// </summary>
        /// <param name="bundle"></param>
        /// <param name="scheduler"></param>
        /// <returns></returns>
        public IJob NewJob(TriggerFiredBundle bundle, IScheduler scheduler)
        {
            try
            {
                var serviceScope = _serviceProvider.CreateScope();
                var job = serviceScope.ServiceProvider.GetService(bundle.JobDetail.JobType) as IJob;
                return job;
            }
            catch (Exception)
            {
                throw;
            }
        }
        public void ReturnJob(IJob job)
        {
            var disposable = job as IDisposable;
            if (disposable != null)
            {
                disposable.Dispose();
            }
        }
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/JobSetup.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
using Microsoft.Extensions.DependencyInjection;
using Quartz;
using Quartz.Spi;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
namespace WIDESEA.QuartzJob
{
    /// <summary>
    /// ä»»åŠ¡è°ƒåº¦ å¯åŠ¨æœåŠ¡
    /// </summary>
    public static class JobSetup
    {
        public static void AddJobSetup(this IServiceCollection services)
        {
            if (services == null) throw new ArgumentNullException(nameof(services));
            services.AddSingleton<IJobFactory, JobFactory>();
            services.AddSingleton<ISchedulerCenter, SchedulerCenterServer>();
            var baseType = typeof(IJob);
            var path = AppDomain.CurrentDomain.RelativeSearchPath ?? AppDomain.CurrentDomain.BaseDirectory;
            var referencedAssemblies = System.IO.Directory.GetFiles(path, "WIDESEA_Tasks.dll").Select(Assembly.LoadFrom).ToArray();
            var types = referencedAssemblies
                .SelectMany(a => a.DefinedTypes)
                .Select(type => type.AsType())
                .Where(x => x != baseType && baseType.IsAssignableFrom(x)).ToArray();
            var implementTypes = types.Where(x => x.IsClass).ToArray();
            foreach (var implementType in implementTypes)
            {
                services.AddTransient(implementType);
            }
        }
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/ResponseContent.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WIDESEA.QuartzJob
{
    public class ResponseContent
    {
        public ResponseContent()
        {
        }
        public ResponseContent(bool status)
        {
            Status = status;
        }
        public bool Status { get; set; }
        public string Code { get; set; }
        public string Message { get; set; }
        public object Data { get; set; }
        public ResponseContent OK()
        {
            Status = true;
            return this;
        }
        public static ResponseContent Instance
        {
            get { return new ResponseContent(); }
        }
        public ResponseContent OK(string message = null, object data = null)
        {
            Status = true;
            Message = message;
            Data = data;
            return this;
        }
        public ResponseContent Error(string message = null)
        {
            Status = false;
            Message = message;
            return this;
        }
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/SchedulerCenterServer.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,470 @@
using Quartz;
using Quartz.Impl;
using Quartz.Impl.Triggers;
using Quartz.Spi;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.Helper;
namespace WIDESEA.QuartzJob
{
    public class SchedulerCenterServer : ISchedulerCenter
    {
        private Task<IScheduler> _scheduler;
        private readonly IJobFactory _iocjobFactory;
        public SchedulerCenterServer(IJobFactory jobFactory)
        {
            _iocjobFactory = jobFactory;
            _scheduler = GetSchedulerAsync();
        }
        private Task<IScheduler> GetSchedulerAsync()
        {
            if (_scheduler != null)
                return _scheduler;
            else
            {
                // ä»ŽFactory中获取Scheduler实例
                NameValueCollection collection = new NameValueCollection
                {
                    { "quartz.serializer.type", "binary" },
                };
                StdSchedulerFactory factory = new StdSchedulerFactory(collection);
                return _scheduler = factory.GetScheduler();
            }
        }
        /// <summary>
        /// å¼€å¯ä»»åŠ¡è°ƒåº¦
        /// </summary>
        /// <returns></returns>
        public async Task<ResponseContent> StartScheduleAsync()
        {
            var result = new ResponseContent();
            try
            {
                _scheduler.Result.JobFactory = _iocjobFactory;
                if (!_scheduler.Result.IsStarted)
                {
                    //等待任务运行完成
                    await _scheduler.Result.Start();
                    ConsoleHelper.WriteSuccessLine("任务调度开启!");
                    result = ResponseContent.Instance.OK($"任务调度开启成功");
                    return result;
                }
                else
                {
                    result = ResponseContent.Instance.OK($"任务调度已经开启");
                    return result;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// åœæ­¢ä»»åŠ¡è°ƒåº¦
        /// </summary>
        /// <returns></returns>
        public async Task<ResponseContent> StopScheduleAsync()
        {
            var result = new ResponseContent();
            try
            {
                if (!_scheduler.Result.IsShutdown)
                {
                    //等待任务运行完成
                    await _scheduler.Result.Shutdown();
                    //await Console.Out.WriteLineAsync("任务调度停止!");
                    result = ResponseContent.Instance.OK($"任务调度停止成功");
                    return result;
                }
                else
                {
                    result = ResponseContent.Instance.OK($"任务调度已经停止");
                    return result;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// æ·»åŠ ä¸€ä¸ªè®¡åˆ’ä»»åŠ¡ï¼ˆæ˜ å°„ç¨‹åºé›†æŒ‡å®šIJob实现类)
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="tasksQz"></param>
        /// <returns></returns>
        public async Task<ResponseContent> AddScheduleJobAsync(TasksQz tasksQz)
        {
            var result = new ResponseContent();
            if (tasksQz != null)
            {
                try
                {
                    JobKey jobKey = new JobKey(tasksQz.Id.ToString(), tasksQz.JobGroup);
                    if (await _scheduler.Result.CheckExists(jobKey))
                    {
                        result = ResponseContent.Instance.OK($"该任务计划已经在执行:【{tasksQz.Name}】,请勿重复启动!");
                        return result;
                    }
                    #region è®¾ç½®å¼€å§‹æ—¶é—´å’Œç»“束时间
                    if (tasksQz.BeginTime == null)
                    {
                        tasksQz.BeginTime = DateTime.Now;
                    }
                    DateTimeOffset starRunTime = DateBuilder.NextGivenSecondDate(tasksQz.BeginTime, 1);//设置开始时间
                    if (tasksQz.EndTime == null)
                    {
                        tasksQz.EndTime = DateTime.MaxValue.AddDays(-1);
                    }
                    DateTimeOffset endRunTime = DateBuilder.NextGivenSecondDate(tasksQz.EndTime, 1);//设置暂停时间
                    #endregion
                    #region é€šè¿‡åå°„获取程序集类型和类
                    Assembly assembly = Assembly.Load(new AssemblyName(tasksQz.AssemblyName));
                    Type jobType = assembly.GetType(tasksQz.AssemblyName + "." + tasksQz.ClassName);
                    #endregion
                    //判断任务调度是否开启
                    //if (!_scheduler.Result.IsStarted)
                    //{
                    //    await StartScheduleAsync();
                    //}
                    //传入反射出来的执行程序集
                    IJobDetail job = new JobDetailImpl(tasksQz.Id.ToString(), tasksQz.JobGroup, jobType);
                    job.JobDataMap.Add("JobParam", tasksQz.JobParams);
                    ITrigger trigger;
                    #region æ³›åž‹ä¼ é€’
                    //IJobDetail job = JobBuilder.Create<T>()
                    //    .WithIdentity(sysSchedule.Name, sysSchedule.JobGroup)
                    //    .Build();
                    #endregion
                    if (tasksQz.Cron != null && CronExpression.IsValidExpression(tasksQz.Cron) && tasksQz.TriggerType > 0)
                    {
                        trigger = CreateCronTrigger(tasksQz);
                        ((CronTriggerImpl)trigger).MisfireInstruction = MisfireInstruction.CronTrigger.DoNothing;
                    }
                    else
                    {
                        trigger = CreateSimpleTrigger(tasksQz);
                    }
                    // å‘Šè¯‰Quartz使用我们的触发器来安排作业
                    await _scheduler.Result.ScheduleJob(job, trigger);
                    //await Task.Delay(TimeSpan.FromSeconds(120));
                    //await Console.Out.WriteLineAsync("关闭了调度器!");
                    //await _scheduler.Result.Shutdown();
                    result = ResponseContent.Instance.OK($"【{tasksQz.Name}】成功");
                    return result;
                }
                catch (Exception ex)
                {
                    result = ResponseContent.Instance.Error($"任务计划异常:【{ex.Message}】");
                    return result;
                }
            }
            else
            {
                result = ResponseContent.Instance.Error($"任务计划不存在:【{tasksQz?.Name}】");
                return result;
            }
        }
        /// <summary>
        /// ä»»åŠ¡æ˜¯å¦å­˜åœ¨?
        /// </summary>
        /// <returns></returns>
        public async Task<bool> IsExistScheduleJobAsync(TasksQz sysSchedule)
        {
            JobKey jobKey = new JobKey(sysSchedule.Id.ToString(), sysSchedule.JobGroup);
            if (await _scheduler.Result.CheckExists(jobKey))
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        /// <summary>
        /// æš‚停一个指定的计划任务
        /// </summary>
        /// <returns></returns>
        public async Task<ResponseContent> StopScheduleJobAsync(TasksQz sysSchedule)
        {
            var result = new ResponseContent();
            try
            {
                JobKey jobKey = new JobKey(sysSchedule.Id.ToString(), sysSchedule.JobGroup);
                if (!await _scheduler.Result.CheckExists(jobKey))
                {
                    result = ResponseContent.Instance.Error($"未找到要暂停的任务:【{sysSchedule.Name}】");
                    return result;
                }
                else
                {
                    await _scheduler.Result.DeleteJob(jobKey);
                    result = ResponseContent.Instance.OK($"【{sysSchedule.Name}】成功");
                    return result;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// æ¢å¤æŒ‡å®šçš„计划任务
        /// </summary>
        /// <param name="sysSchedule"></param>
        /// <returns></returns>
        public async Task<ResponseContent> ResumeJob(TasksQz sysSchedule)
        {
            var result = new ResponseContent();
            try
            {
                JobKey jobKey = new JobKey(sysSchedule.Id.ToString(), sysSchedule.JobGroup);
                if (!await _scheduler.Result.CheckExists(jobKey))
                {
                    result = ResponseContent.Instance.Error($"未找到要恢复的任务:【{sysSchedule.Name}】");
                    return result;
                }
                await _scheduler.Result.ResumeJob(jobKey);
                result = ResponseContent.Instance.OK($"【{sysSchedule.Name}】成功");
                return result;
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// æš‚停指定的计划任务
        /// </summary>
        /// <param name="sysSchedule"></param>
        /// <returns></returns>
        public async Task<ResponseContent> PauseJob(TasksQz sysSchedule)
        {
            var result = new ResponseContent();
            try
            {
                JobKey jobKey = new JobKey(sysSchedule.Id.ToString(), sysSchedule.JobGroup);
                if (!await _scheduler.Result.CheckExists(jobKey))
                {
                    result = ResponseContent.Instance.Error($"未找到要暂停的任务:【{sysSchedule.Name}】");
                    return result;
                }
                await _scheduler.Result.PauseJob(jobKey);
                result = ResponseContent.Instance.Error($"【{sysSchedule.Name}】成功");
                return result;
            }
            catch (Exception)
            {
                throw;
            }
        }
        #region çŠ¶æ€çŠ¶æ€å¸®åŠ©æ–¹æ³•
        public async Task<List<TaskInfoDto>> GetTaskStaus(TasksQz sysSchedule)
        {
            var ls = new List<TaskInfoDto>();
            var noTask = new List<TaskInfoDto>{ new TaskInfoDto {
                jobId = sysSchedule.Id.ToString(),
                jobGroup = sysSchedule.JobGroup,
                triggerId = "",
                triggerGroup = "",
                triggerStatus = "不存在"
            } };
            JobKey jobKey = new JobKey(sysSchedule.Id.ToString(), sysSchedule.JobGroup);
            IJobDetail job = await _scheduler.Result.GetJobDetail(jobKey);
            if (job == null)
            {
                return noTask;
            }
            //info.Append(string.Format("任务ID:{0}\r\n任务名称:{1}\r\n", job.Key.Name, job.Description));
            var triggers = await _scheduler.Result.GetTriggersOfJob(jobKey);
            if (triggers == null || triggers.Count == 0)
            {
                return noTask;
            }
            foreach (var trigger in triggers)
            {
                var triggerStaus = await _scheduler.Result.GetTriggerState(trigger.Key);
                string state = GetTriggerState(triggerStaus.ToString());
                ls.Add(new TaskInfoDto
                {
                    jobId = job.Key.Name,
                    jobGroup = job.Key.Group,
                    triggerId = trigger.Key.Name,
                    triggerGroup = trigger.Key.Group,
                    triggerStatus = state
                });
                //info.Append(string.Format("触发器ID:{0}\r\n触发器名称:{1}\r\n状态:{2}\r\n", item.Key.Name, item.Description, state));
            }
            return ls;
        }
        public string GetTriggerState(string key)
        {
            string state = null;
            if (key != null)
                key = key.ToUpper();
            switch (key)
            {
                case "1":
                    state = "暂停";
                    break;
                case "2":
                    state = "完成";
                    break;
                case "3":
                    state = "出错";
                    break;
                case "4":
                    state = "阻塞";
                    break;
                case "0":
                    state = "正常";
                    break;
                case "-1":
                    state = "不存在";
                    break;
                case "BLOCKED":
                    state = "阻塞";
                    break;
                case "COMPLETE":
                    state = "完成";
                    break;
                case "ERROR":
                    state = "出错";
                    break;
                case "NONE":
                    state = "不存在";
                    break;
                case "NORMAL":
                    state = "正常";
                    break;
                case "PAUSED":
                    state = "暂停";
                    break;
            }
            return state;
        }
        #endregion
        #region åˆ›å»ºè§¦å‘器帮助方法
        /// <summary>
        /// åˆ›å»ºSimpleTrigger触发器(简单触发器)
        /// </summary>
        /// <param name="sysSchedule"></param>
        /// <param name="starRunTime"></param>
        /// <param name="endRunTime"></param>
        /// <returns></returns>
        private ITrigger CreateSimpleTrigger(TasksQz sysSchedule)
        {
            if (sysSchedule.CycleRunTimes > 0)
            {
                ITrigger trigger = TriggerBuilder.Create()
                .WithIdentity(sysSchedule.Id.ToString(), sysSchedule.JobGroup)
                .StartAt(sysSchedule.BeginTime.Value)
                .WithSimpleSchedule(x => x
                    .WithIntervalInSeconds(sysSchedule.IntervalSecond)
                    .WithRepeatCount(sysSchedule.CycleRunTimes - 1))
                .EndAt(sysSchedule.EndTime.Value)
                .Build();
                return trigger;
            }
            else
            {
                ITrigger trigger = TriggerBuilder.Create()
                .WithIdentity(sysSchedule.Id.ToString(), sysSchedule.JobGroup)
                .StartAt(sysSchedule.BeginTime.Value)
                .WithSimpleSchedule(x => x
                    .WithIntervalInSeconds(sysSchedule.IntervalSecond)
                    .RepeatForever()
                )
                .EndAt(sysSchedule.EndTime.Value)
                .Build();
                return trigger;
            }
            // è§¦å‘作业立即运行,然后每10秒重复一次,无限循环
        }
        /// <summary>
        /// åˆ›å»ºç±»åž‹Cron的触发器
        /// </summary>
        /// <param name="m"></param>
        /// <returns></returns>
        private ITrigger CreateCronTrigger(TasksQz sysSchedule)
        {
            // ä½œä¸šè§¦å‘器
            return TriggerBuilder.Create()
                   .WithIdentity(sysSchedule.Id.ToString(), sysSchedule.JobGroup)
                   .StartAt(sysSchedule.BeginTime.Value)//开始时间
                   .EndAt(sysSchedule.EndTime.Value)//结束数据
                   .WithCronSchedule(sysSchedule.Cron)//指定cron表达式
                   .ForJob(sysSchedule.Id.ToString(), sysSchedule.JobGroup)//作业名称
                   .Build();
        }
        #endregion
        /// <summary>
        /// ç«‹å³æ‰§è¡Œ ä¸€ä¸ªä»»åŠ¡
        /// </summary>
        /// <param name="tasksQz"></param>
        /// <returns></returns>
        public async Task<ResponseContent> ExecuteJobAsync(TasksQz tasksQz)
        {
            var result = new ResponseContent();
            try
            {
                JobKey jobKey = new JobKey(tasksQz.Id.ToString(), tasksQz.JobGroup);
                //判断任务是否存在,存在则 è§¦å‘一次,不存在则先添加一个任务,触发以后再 åœæ­¢ä»»åŠ¡
                if (!await _scheduler.Result.CheckExists(jobKey))
                {
                    //不存在 åˆ™ æ·»åŠ ä¸€ä¸ªè®¡åˆ’ä»»åŠ¡
                    await AddScheduleJobAsync(tasksQz);
                    //触发执行一次
                    await _scheduler.Result.TriggerJob(jobKey);
                    //停止任务
                    await StopScheduleJobAsync(tasksQz);
                    result = ResponseContent.Instance.OK($"立即执行计划任务:【{tasksQz.Name}】成功");
                }
                else
                {
                    await _scheduler.Result.TriggerJob(jobKey);
                    result = ResponseContent.Instance.OK($"立即执行计划任务:【{tasksQz.Name}】成功");
                }
            }
            catch (Exception ex)
            {
                result = ResponseContent.Instance.Error($"立即执行计划任务失败:【{ex.Message}】");
            }
            return result;
        }
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/TaskInfoDto.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WIDESEA.QuartzJob
{
    public class TaskInfoDto
    {
        /// <summary>
        /// ä»»åŠ¡ID
        /// </summary>
        public string jobId { get; set; }
        /// <summary>
        /// ä»»åŠ¡åç§°
        /// </summary>
        public string jobName { get; set; }
        /// <summary>
        /// ä»»åŠ¡åˆ†ç»„
        /// </summary>
        public string jobGroup { get; set; }
        /// <summary>
        /// è§¦å‘器ID
        /// </summary>
        public string triggerId { get; set; }
        /// <summary>
        /// è§¦å‘器名称
        /// </summary>
        public string triggerName { get; set; }
        /// <summary>
        /// è§¦å‘器分组
        /// </summary>
        public string triggerGroup { get; set; }
        /// <summary>
        /// è§¦å‘器状态
        /// </summary>
        public string triggerStatus { get; set; }
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/QuartzJob/TasksQz.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,80 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace WIDESEA.QuartzJob
{
    /// <summary>
    /// ä»»åŠ¡è®¡åˆ’è¡¨
    /// </summary>
    public class TasksQz
    {
        /// <summary>
        /// ä»»åŠ¡åç§°
        /// </summary>
        public string Name { get; set; }
        /// <summary>
        /// ä»»åŠ¡åˆ†ç»„
        /// </summary>
        public string JobGroup { get; set; }
        /// <summary>
        /// ä»»åŠ¡è¿è¡Œæ—¶é—´è¡¨è¾¾å¼
        /// </summary>
        public string Cron { get; set; }
        /// <summary>
        /// ä»»åŠ¡æ‰€åœ¨DLL对应的程序集名称
        /// </summary>
        public string AssemblyName { get; set; }
        /// <summary>
        /// ä»»åŠ¡æ‰€åœ¨ç±»
        /// </summary>
        public string ClassName { get; set; }
        /// <summary>
        /// ä»»åŠ¡æè¿°
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// æ‰§è¡Œæ¬¡æ•°
        /// </summary>
        public int RunTimes { get; set; }
        /// <summary>
        /// å¼€å§‹æ—¶é—´
        /// </summary>
        public DateTime? BeginTime { get; set; }
        /// <summary>
        /// ç»“束时间
        /// </summary>
        public DateTime? EndTime { get; set; }
        /// <summary>
        /// è§¦å‘器类型(0、simple 1、cron)
        /// </summary>
        public int TriggerType { get; set; }
        /// <summary>
        /// æ‰§è¡Œé—´é𔿗¶é—´, ç§’为单位
        /// </summary>
        public int IntervalSecond { get; set; }
        /// <summary>
        /// å¾ªçŽ¯æ‰§è¡Œæ¬¡æ•°
        /// </summary>
        public int CycleRunTimes { get; set; }
        /// <summary>
        /// æ˜¯å¦å¯åЍ
        /// </summary>
        public bool IsStart { get; set; } = true;
        /// <summary>
        /// æ‰§è¡Œä¼ å‚
        /// </summary>
        public string JobParams { get; set; }
        public bool? IsDeleted { get; set; }
        /// <summary>
        /// åˆ›å»ºæ—¶é—´
        /// </summary>
        public DateTime CreateTime { get; set; } = DateTime.Now;
        /// <summary>
        /// ä»»åŠ¡å†…å­˜ä¸­çš„çŠ¶æ€
        /// </summary>
        public List<TaskInfoDto> Triggers { get; set; }
        public int Id { get; set; }
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/WIDESEA_Core.csproj
@@ -25,6 +25,7 @@
    <PackageReference Include="MiniProfiler.AspNetCore.Mvc" Version="4.3.8" />
    <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
    <PackageReference Include="OfficeOpenXml.Core.ExcelPackage" Version="1.0.0" />
    <PackageReference Include="Quartz" Version="3.18.0" />
    <PackageReference Include="SkiaSharp" Version="2.88.8" />
    <PackageReference Include="SqlSugarCore" Version="5.1.4.152" />
    <PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.0" />
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/WMS/WMSTaskDTO.cs
@@ -50,6 +50,11 @@
        public string TargetAddress { get; set; }
        /// <summary>
        /// ä¸‹ä¸€ä½ç½®
        /// </summary>
        public string NextAddress { get; set; }
        /// <summary>
        /// ä¼˜å…ˆçº§
        /// </summary>
        public int Grade { get; set; }
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationRepository/obj/Debug/net6.0/WIDESEA_IStoragIntegrationRepository.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEA_IStoragIntegrationRepository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bfa85418f2da7b0f3570d7e44b203727c637b729")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEA_IStoragIntegrationRepository")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEA_IStoragIntegrationRepository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/Task/IDt_TaskService.cs
@@ -278,4 +278,6 @@
    WebResponseContent GetLocationStatus();
    Task<string> GetRoadWayAsync(List<string> process);
    Task<string> GetGWRoadWayAsync(List<string> process);
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationRepository/obj/Debug/net6.0/WIDESEA_StoragIntegrationRepository.AssemblyInfo.cs
@@ -14,7 +14,7 @@
[assembly: System.Reflection.AssemblyCompanyAttribute("WIDESEA_StoragIntegrationRepository")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+bfa85418f2da7b0f3570d7e44b203727c637b729")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+990afb24199ef1f7a4648728ac28ed74394e459c")]
[assembly: System.Reflection.AssemblyProductAttribute("WIDESEA_StoragIntegrationRepository")]
[assembly: System.Reflection.AssemblyTitleAttribute("WIDESEA_StoragIntegrationRepository")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Location/LocationInfoService.cs
@@ -37,7 +37,7 @@
                                    ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository,
                                    IStockInfoDetailRepository stockInfoDetailRepository,
                                    IMapper mapper,
                                    IDt_TaskService taskService,
                                    IDt_TaskService taskService,
                                    IDt_AreaInfoRepository AreaInfoRepository,
                                    ISys_ConfigService configService) : base(BaseDal)
    {
@@ -52,7 +52,7 @@
        _mapper = mapper;
        _taskService = taskService;
        _AreaInfoRepository = AreaInfoRepository;
        _configService= configService;
        _configService = configService;
    }
    /// <summary>
@@ -130,7 +130,7 @@
    public WebResponseContent HandOutTask(int locationID)
    {
        LogFactory.GetLog("手动出库任务").InfoFormat(true, "手动出库任务", JsonConvert.SerializeObject(locationID), App.User.UserName);
        WebResponseContent content=new WebResponseContent();
        WebResponseContent content = new WebResponseContent();
        try
        {
            Dt_AreaInfo areaInfo = _AreaInfoRepository.QueryFirst(x => x.AreaCode == "CWSC1");
@@ -240,9 +240,9 @@
                return content.Error("未找到货位信息!");
            }
            DtStockInfo stock = _stockInfoRepository.QueryFirst(x => x.LocationId == location.Id);
            if(stock == null)
            if (stock == null)
            {
                location.LocationStatus= (int)LocationEnum.Free;
                location.LocationStatus = (int)LocationEnum.Free;
                BaseDal.UpdateData(location);
            }
            else
@@ -259,7 +259,7 @@
                    AddStockInfoDetailHty(details);
                }
                await AddStockInfoHtyAsync(stockInfo_Hty);
                location.LocationStatus = (int)LocationEnum.Free;
                BaseDal.UpdateData(location);
@@ -337,7 +337,7 @@
            int enable = Convert.ToBoolean(saveModel.Extra) ? 0 : 4;
            for (int i = 0; i < saveModel.DelKeys.Count; i++)
            {
                DtLocationInfo location = BaseDal.QueryData(x => x.Id == int.Parse(saveModel.DelKeys[i].ToString())).FirstOrDefault();
                DtLocationInfo location = BaseDal.QueryFirst(x => x.Id == int.Parse(saveModel.DelKeys[i].ToString()));
                location.LocationStatus = enable;
                locations.Add(location);
            }
@@ -530,12 +530,12 @@
    {
        var isStockAdd = SqlSugarHelper.DbWMS.Insertable(details).ExecuteCommand();
        if (isStockAdd==0)
        if (isStockAdd == 0)
        {
            throw new Exception("库存明细历史信息添加失败");
        }
    }
    #endregion
    #endregion å†…部方法
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -160,6 +160,45 @@
        }
    }
    public async Task<WebResponseContent> CompleteNgTaskAsync(Dt_Task task)
    {
        WebResponseContent content = new WebResponseContent();
        try
        {
            var boxing = await _boxingInfoRepository.QueryFirstNavAsync(x => x.PalletCode == task.PalletCode);
            if (boxing != null)
            {
                await _boxingInfoRepository.Db.DeleteNav<DtBoxingInfo>(x => x.Id == boxing.Id)
                                            .Include(x => x.BoxingInfoDetails)
                                            .ExecuteCommandAsync();
            }
            var loc = _locationRepository.QueryFirst(x => x.LocationCode == task.SourceAddress && x.RoadwayNo == task.Roadway);
            var taskHty = task.Adapt<Dt_Task_Hty>();
            taskHty.FinishTime = DateTime.Now;
            taskHty.OperateType = App.User.UserName != null ? (int)OperateTypeEnum.人工完成 : (int)OperateTypeEnum.自动完成;
            taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System";
            int lastStatus = loc.LocationStatus;
            loc.LocationStatus = (int)LocationEnum.Free;
            task.TaskState = (int)TaskOutStatusEnum.OutFinish;
            // äº‹åŠ¡å¤„ç†
            await _unitOfWorkManage.UseTranAsync(async () =>
            {
                await UpdateLocationAsync(loc);
                await DeleteTaskAsync(task.TaskId);
                await AddTaskHtyAsync(taskHty);
            });
            _locationStatusChangeRecordRepository.AddLocationStatusChangeRecord(loc, lastStatus, (int)StatusChangeTypeEnum.AutomaticDelivery, task.TaskNum);
            return content.OK("任务完成成功", task.Remark);
        }
        catch (Exception err)
        {
            LogFactory.GetLog("任务完成").Error(true, $"系统异常,异常信息:{err.Message}");
            return content.Error(err.Message);
        }
    }
    private AgingOutputDto MapToAgingOutputDto(DtStockInfo stock, ResponseEqptRunDto? info = null)
    {
        // TODO Value值根据MOM下发的静置时间到当前时间的分钟数
@@ -407,7 +446,15 @@
                return content.OK("入库任务完成成功");
            }
            // æ ¹æ®æ˜¯å¦æœ‰ç»„盘信息创建库存实例模型
            DtStockInfo stock = boxing == null ? CreateEmptyPalletStock(task, locationInf) : CreateFullPalletStock(task, locationInf, boxing);
            DtStockInfo stock = null;
            if (boxing == null && task.TaskType == (int)TaskInboundTypeEnum.InTray)
            {
                stock = CreateEmptyPalletStock(task, locationInf);
            }
            else
            {
                stock = CreateFullPalletStock(task, locationInf, boxing);
            }
            // æ‰§è¡Œæ•°æ®åº“事务
            bool isResult = await ExecuteTransaction(stock, taskHty, locationInf, task.TaskId, boxing);
@@ -638,11 +685,20 @@
            case (int)TaskOutboundTypeEnum.OutTray:
            case (int)TaskOutboundTypeEnum.Outbound:
            case (int)TaskOutboundTypeEnum.OutNG:
                LogFactory.GetLog("任务完成").InfoFormat(true, "出库任务", "");
                return await CompleteStackTaskAsync(task, stock);
            case (int)TaskOutboundTypeEnum.OutNG:
                LogFactory.GetLog("任务完成").InfoFormat(true, "出库任务", "");
                if(task.Roadway.Contains("FR"))
                {
                    return await CompleteStackTaskAsync(task, stock);
                }
                else
                {
                    return await CompleteNgTaskAsync(task);
                }
            case (int)TaskOutboundTypeEnum.OutFireAlarm:
                LogFactory.GetLog("任务完成").InfoFormat(true, "火警任务", "");
@@ -671,7 +727,7 @@
            {
                return CreateAndReturnWMSTaskDTO(task);
            }
            if(task != null && (task.TaskState != (int)TaskInStatusEnum.InNew || task.TaskState != (int)TaskOutStatusEnum.OutNew))
            if (task != null && (task.TaskState != (int)TaskInStatusEnum.InNew || task.TaskState != (int)TaskOutStatusEnum.OutNew))
            {
                return content.Error($"托盘{input.PalletCode}存在任务");
            }
@@ -737,6 +793,14 @@
                ConsoleHelper.WriteErrorLine($"获取电芯状态失败:{result.MOMMessage}");
                if (result.SerialNos.Count <= 0)
                {
                    var config = _configService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStacker, SysConfigConst.InboundIsEmpty);
                    var strings = config.ConfigValue.Split(',').ToList();
                    if (strings.Contains(input.Position))
                    {
                        // todo送至NG口
                        ConsoleHelper.WriteErrorLine($"当前位置【{input.Position}】不能入空托盘");
                        return content.Error($"当前位置【{input.Position}】不能入空托盘");
                    }
                    // ç©ºæ‰˜ç›˜å…¥åº“逻辑
                    var staion = _stationManagerRepository.QueryFirst(x => x.stationChildCode == input.Position && x.stationType == 1 && x.remark == "IN");
                    if (staion != null)
@@ -759,8 +823,8 @@
                if (strings.Contains(input.Position))
                {
                    // todo送至NG口
                    ConsoleHelper.WriteErrorLine($"当前位置不能入空托盘");
                    return content.Error("当前位置不能入空托盘");
                    ConsoleHelper.WriteErrorLine($"当前位置【{input.Position}】不能入空托盘");
                    return content.Error($"当前位置【{input.Position}】不能入空托盘");
                }
                else
                    return await RequestTrayInTaskAsync(input);
@@ -2210,13 +2274,19 @@
    {
        WebResponseContent content = new WebResponseContent();
        // èŽ·å–ç›®æ ‡åœ°å€
        //string ToAddress = await GetRoadWayAsync(process);
        string ToAddress = string.Empty;
        if (flag < 2)
        if (input.Position == "1039")
        {
            ToAddress = await GetGWRoadWayAsync(process);
        }
        else if (flag < 2)
        {
            ToAddress = await GetRoadWayAsync(process);
        }
        else
        {
            ToAddress = process[0];
        }
        if (string.IsNullOrEmpty(ToAddress))
        {
            return content.Error("无法获取目标地址");
@@ -2249,10 +2319,6 @@
        {
            task.TaskId = taskId;
            isResult = await _taskExecuteDetailRepository.AddDetailAsync(task, false, TaskDescription.GetTaskUpdateDescription(input.PalletCode, input.Position, ToAddress, TaskInStatusEnum.InNew.GetIntegralRuleTypeEnumDesc()));
            //var location = _locationRepository.QueryFirst(x => x.RoadwayNo == task.Roadway && x.LocationCode == task.TargetAddress);
            //location.LocationStatus = (int)LocationEnum.Lock;
            //var isLocation = _locationRepository.UpdateData(location);
            if (isResult)
            {
@@ -2356,6 +2422,40 @@
        return minRoadwayNo;
    }
    private static readonly object _lock = new object();
    private static int _currentIndex = -1; // è®°å½•上一次分配的巷道索引
    public async Task<string> GetGWRoadWayAsync(List<string> process)
    {
        var deviceCode = await SqlSugarHelper.DbWCS.Queryable<Dt_DeviceInfo>()
             .Where(x => x.DeviceStatus == 1.ToString() && process.Contains(x.DeviceCode))
             .Select(x => x.DeviceCode).ToListAsync();
        var availableRoadways = _locationRepository.QueryData(x => deviceCode.Contains(x.RoadwayNo) && x.LocationStatus == (int)LocationEnum.Free && x.EnalbeStatus == (int)EnableEnum.Enable)
                            .GroupBy(x => x.RoadwayNo)
                            .Select(g => new
                            {
                                RoadwayNo = g.Key,
                                Count = g.Count(),
                                TargetCount = BaseDal.QueryData(t => t.TargetAddress == g.Key).Count()
                            })
                            .Where(x => x.Count - x.TargetCount > 0 && x.TargetCount < 2)
                            .OrderByDescending(x => x.Count)
                            .ToList();
        if (!availableRoadways.Any())
        {
            return null; // æˆ–抛出异常
        }
        // è½®è¯¢åˆ†é…
        lock (_lock)
        {
            _currentIndex = (_currentIndex + 1) % availableRoadways.Count;
            return availableRoadways[_currentIndex].RoadwayNo;
        }
    }
    /// <summary>
    /// æ ¹æ®åŒºåŸŸèŽ·å–å··é“æˆ–ç«™å°
    /// </summary>
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/NGTask/OutNGTask.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,168 @@
using AutoMapper;
using Masuit.Tools;
using Newtonsoft.Json;
using Quartz;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core;
using WIDESEA_Core.Const;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.WMS;
using WIDESEA_IServices;
using WIDESEA_IStorageTaskRepository;
using WIDESEA_IStorageTaskServices;
using WIDESEA_Model.Models;
using WIDESEA_StorageTaskRepository;
using WIDESEAWCS_BasicInfoRepository;
using WIDESEAWCS_Model.Models;
namespace WIDESEA_Tasks
{
    public class OutNGTask : IJob
    {
        private readonly IDt_TaskRepository _taskRepository;
        private readonly IDt_StationManagerRepository _stationManagerRepository;
        private readonly ISys_ConfigService _configService;
        private readonly IDt_TaskService _taskService;
        private readonly IDt_Task_HtyRepository _task_HtyRepository;
        private readonly IMapper _mapper;
        public OutNGTask(IDt_TaskRepository taskRepository, IDt_StationManagerRepository stationManagerRepository, ISys_ConfigService configService, IDt_TaskService taskService, IDt_Task_HtyRepository task_HtyRepository, IMapper mapper)
        {
            _taskRepository = taskRepository;
            _stationManagerRepository = stationManagerRepository;
            _configService = configService;
            _taskService = taskService;
            _task_HtyRepository = task_HtyRepository;
            _mapper = mapper;
        }
        public Task Execute(IJobExecutionContext context)
        {
            try
            {
                var task = _taskRepository.QueryFirst(x => x.TaskType == (int)TaskInboundTypeEnum.Inbound && x.TaskState == (int)TaskInStatusEnum.SC_InExecuting && x.ErrorMessage != null && (x.Roadway.Contains("GW") || x.Roadway.Contains("CW")));
                if (task != null)
                {
                    Dt_StationManager stationManager = null;
                    string position = null;
                    if (task.Roadway.Contains("CW"))
                    {
                        stationManager = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017" || x.stationPLC == "1024") && x.stationType == 10 && x.Roadway == task.Roadway);
                        position = task.Roadway switch
                        {
                            var s when s.StartsWith("CWSC") =>
                            int.TryParse(s.Substring(4), out var num)
                            ? num switch
                            {
                                >= 1 and <= 9 => "001-035-001",
                                >= 11 and <= 17 => "001-036-001"
                            }
                            : throw new Exception("未找到该巷道信息"),
                            _ => throw new Exception("未找到该巷道信息")
                        };
                    }
                    else
                    {
                        stationManager = _stationManagerRepository.QueryFirst(x => x.stationType == 1 && (x.stationPLC == "1015" || x.stationPLC == "2025") && x.remark == task.Roadway);
                        position = "002-000-002";
                    }
                    var taskNew = CreateTask(task, stationManager, position);
                    WMSTaskDTO taskDTO = CreateTaskDTO(taskNew);
                    var configs = _configService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
                    var wmsBase = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.WCSIPAddress)?.ConfigValue;
                    var ipAddress = configs.FirstOrDefault(x => x.ConfigKey == SysConfigConst.ReceiveByWMSNGTask)?.ConfigValue;
                    if (wmsBase == null || ipAddress == null)
                    {
                        throw new InvalidOperationException("WMS IP æœªé…ç½®");
                    }
                    var wmsIpAddress = wmsBase + ipAddress;
                    var result = HttpHelper.PostAsync(wmsIpAddress, taskDTO.ToJsonString()).Result;
                    var content = JsonConvert.DeserializeObject<WebResponseContent>(result);
                    if (content.Status)
                    {
                        var taskHtyNG = CreateHistoricalTask(task);
                        _task_HtyRepository.AddData(taskHtyNG);
                        _taskRepository.DeleteData(task);
                        _taskRepository.AddData(taskNew);
                    }
                    return Task.CompletedTask;
                }
            }
            catch (Exception ex)
            {
                ConsoleHelper.WriteWarningLine($"执行 NG ä»»åŠ¡å‡ºåº“æ—¶å‘ç”Ÿå¼‚å¸¸: {ex.Message}{ex.StackTrace}");
            }
            return Task.CompletedTask;
        }
        private Dt_Task CreateTask(Dt_Task task,Dt_StationManager stationManager,string position)
        {
            return new Dt_Task
            {
                Grade = 1,
                Roadway = task.Roadway,
                TargetAddress = stationManager.stationChildCode,
                Dispatchertime = DateTime.Now,
                MaterialNo = "",
                NextAddress = position,
                OrderNo = null,
                PalletCode = task.PalletCode,
                SourceAddress = task.TargetAddress,
                CurrentAddress = task.TargetAddress,
                TaskState = (int)TaskOutStatusEnum.OutNew,
                TaskType = (int)TaskOutboundTypeEnum.OutNG,
                TaskNum = _taskRepository.GetTaskNo().Result,
                Creater = "System",
                CreateDate = DateTime.Now,
                TaskId = 0,
                ProductionLine = task.ProductionLine,
                ProcessCode = task.ProcessCode,
                ErrorMessage = task.ErrorMessage,
            };
        }
        private WMSTaskDTO CreateTaskDTO(Dt_Task task)
        {
            return new WMSTaskDTO
            {
                TaskNum = task.TaskNum.Value,
                Grade = 1,
                PalletCode = task.PalletCode,
                RoadWay = task.Roadway,
                SourceAddress = task.SourceAddress,
                TargetAddress = task.TargetAddress,
                NextAddress = task.NextAddress,
                TaskState = task.TaskState.Value,
                Id = 0,
                TaskType = task.TaskType,
                ProductionLine = task.ProductionLine,
            };
        }
        private Dt_Task_Hty CreateHistoricalTask(Dt_Task task, bool isHand = false)
        {
            // æ›´æ–°ä»»åŠ¡çŠ¶æ€
            task.TaskState = task.TaskType > 199 ? (int)TaskInStatusEnum.InFinish : (int)TaskOutStatusEnum.OutFinish;
            task.CurrentAddress = task.NextAddress;
            // åˆ›å»ºåŽ†å²ä»»åŠ¡
            var taskHty = _mapper.Map<Dt_Task_Hty>(task);
            taskHty.FinishTime = DateTime.Now;
            taskHty.TaskId = 0;
            taskHty.OperateType = (int)OperateTypeEnum.NG任务删除;
            taskHty.SourceId = task.TaskId;
            if (isHand)
            {
                taskHty.Creater = App.User.UserName != null ? App.User.UserName : "System";
            }
            return taskHty;
        }
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/QuartzJobMildd.cs
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,59 @@

using Microsoft.AspNetCore.Builder;
using System;
using System.Collections.Generic;
using System.Text;
using WIDESEA.QuartzJob;
using WIDESEA_Core;
using WIDESEA_Core.Helper;
namespace WIDESEA_Tasks
{
    /// <summary>
    /// Quartz å¯åŠ¨æœåŠ¡
    /// </summary>
    public static class QuartzJobMiddleWare
    {
        public static void UseQuartzJobMildd(this IApplicationBuilder app)
        {
            if (app == null) throw new ArgumentNullException(nameof(app));
            var schedulerCenter = app.ApplicationServices.GetService(typeof(ISchedulerCenter)) as ISchedulerCenter;
            try
            {
                var allQzServices = new List<TasksQz>()
                {
                    new TasksQz()
                    {
                         Id = 1,
                         AssemblyName = "WIDESEA_Tasks",
                         ClassName = "OutNGTask",
                         CreateTime = DateTime.Now,
                         IntervalSecond = Convert.ToInt32( AppSettings.app("IntervalSecond")),
                         IsDeleted = false,
                         IsStart = false,
                         JobGroup = "WIDESEA_Tasks",
                         Name = "OutNGTask",
                         TriggerType = 0
                    },
                };
                foreach (var item in allQzServices)
                {
                    var ResuleModel = schedulerCenter.AddScheduleJobAsync(item).Result;
                    if (ResuleModel.Status)
                    {
                        ConsoleHelper.WriteSuccessLine($"{item.ClassName}启动成功");
                    }
                    else
                    {
                        Console.Out.WriteLine($"QuartzNetJob{item.Name}启动失败!错误信息:{ResuleModel.Message}");
                    }
                }
                schedulerCenter.StartScheduleAsync();
            }
            catch (Exception e)
            {
                throw;
            }
        }
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/WIDESEA_Tasks.csproj
@@ -6,4 +6,12 @@
    <Nullable>enable</Nullable>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Quartz" Version="3.18.0" />
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\WIDESEA_StorageTaskServices\WIDESEA_StorageTaskServices.csproj" />
  </ItemGroup>
</Project>
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/obj/WIDESEA_Tasks.csproj.nuget.g.targets
@@ -1,2 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
    <Import Project="$(NuGetPackageRoot)system.text.json\8.0.0\buildTransitive\net6.0\System.Text.Json.targets" Condition="Exists('$(NuGetPackageRoot)system.text.json\8.0.0\buildTransitive\net6.0\System.Text.Json.targets')" />
    <Import Project="$(NuGetPackageRoot)sqlitepclraw.lib.e_sqlite3\2.1.6\buildTransitive\net6.0\SQLitePCLRaw.lib.e_sqlite3.targets" Condition="Exists('$(NuGetPackageRoot)sqlitepclraw.lib.e_sqlite3\2.1.6\buildTransitive\net6.0\SQLitePCLRaw.lib.e_sqlite3.targets')" />
  </ImportGroup>
</Project>
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskController.cs
@@ -284,4 +284,9 @@
    {
        return await Service.GetRoadWayAsync(process);
    }
    [HttpPost, AllowAnonymous, Route("GetGWRoadWayAsync")]
    public async Task<string> GetGWRoadWayAsync(List<string> process)
    {
        return await Service.GetGWRoadWayAsync(process);
    }
}
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Program.cs
@@ -1,32 +1,35 @@
using WIDESEA_Core.Helper;
using WIDESEA_Core.Extensions;
using WIDESEA_Core.Middlewares;
using System.Reflection;
using WIDESEA_Core.Filter;
using Autofac;
using Autofac.Core;
using Autofac.Extensions.DependencyInjection;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.OpenApi.Models;
using NewLife.Windows;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using Newtonsoft.Json;
using System.Text;
using Microsoft.AspNetCore.Mvc.Controllers;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Microsoft.AspNetCore.Mvc.ModelBinding.Validation;
using WIDESEA_Core;
using WIDESEA_Core.BaseServices;
using Autofac.Extensions.DependencyInjection;
using Autofac;
using WIDESEA_WMSServer.Filter;
using WIDESEA_Core.Authorization;
using WIDESEA_Core.Core;
using Swashbuckle.AspNetCore.SwaggerGen;
using Microsoft.OpenApi.Models;
using WIDESEA_StorageTaskServices;
using Autofac.Core;
using WIDESEA_Cache;
using Quartz.Spi;
using SimpleRedis;
using WIDESEA_DTO.WMS;
using static NewLife.Remoting.ApiHttpClient;
using NewLife.Windows;
using Swashbuckle.AspNetCore.SwaggerGen;
using System.Reflection;
using System.Text;
using WIDESEA.QuartzJob;
using WIDESEA_Cache;
using WIDESEA_Core;
using WIDESEA_Core.Authorization;
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Core;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Extensions;
using WIDESEA_Core.Filter;
using WIDESEA_Core.Helper;
using WIDESEA_Core.Middlewares;
using WIDESEA_DTO.WMS;
using WIDESEA_StorageTaskServices;
using WIDESEA_Tasks;
using WIDESEA_WMSServer.Filter;
using static NewLife.Remoting.ApiHttpClient;
var builder = WebApplication.CreateBuilder(args);
@@ -119,6 +122,13 @@
builder.Services.AddHostedService<MyBackgroundService>();
//builder.Services.AddSingleton<IJobFactory, JobFactory>();
//builder.Services.AddSingleton<ISchedulerCenter, SchedulerCenterServer>();
//builder.Services.AddTransient<OutNGTask>();//Job使用瞬时依赖注入
//缓存设置配置转实体
builder.Services.AddConfigurableOptions<CacheSettingsOptions>();
//禁止在主机启动时通过 App.GetOptions<TOptions> èŽ·å–é€‰é¡¹ï¼Œå¦‚éœ€èŽ·å–é…ç½®é€‰é¡¹ç†åº”é€šè¿‡ App.GetConfig<TOptions>("配置节点", true)。
@@ -154,6 +164,7 @@
        WIDESEA_Core.Helper.ConsoleHelper.WriteSuccessLine("Redis æœåŠ¡å·²æˆåŠŸæ³¨å†Œ");
    }
}
app.UseQuartzJobMildd();
// 3、配置中间件
app.UseMiniProfiler();//性能分析器
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/WIDESEA_WMSServer.csproj
@@ -41,5 +41,6 @@
      <ProjectReference Include="..\WIDESEA_StorageOutOrderServices\WIDESEA_StorageOutOrderServices.csproj" />
      <ProjectReference Include="..\WIDESEA_StorageTaskServices\WIDESEA_StorageTaskServices.csproj" />
      <ProjectReference Include="..\WIDESEA_StoragIntegrationServices\WIDESEA_StoragIntegrationServices.csproj" />
      <ProjectReference Include="..\WIDESEA_Tasks\WIDESEA_Tasks.csproj" />
    </ItemGroup>
</Project>
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -10,8 +10,8 @@
  "MainDB": "DB_WIDESEA", //当前项目的主库,所对应的连接字符串的Enabled必须为true
  //连接字符串
  //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionStringWCS": "Data Source=192.168.20.253;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionString": "Data Source=.;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  "ConnectionStringWCS": "Data Source=.;Initial Catalog=WIDESEA_WCSDB;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
  //跨域
  "Cors": {
    "PolicyName": "CorsIpAccess", //策略名称
@@ -34,6 +34,8 @@
      "ClearRedis": true
    }
  },
  //Job执行间隔时间,单位为秒
  "IntervalSecond": 10,
  // å…è®¸å‡ºåº“的编码
  "OutBoundMateriel": [
    //{
Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs
@@ -43,6 +43,7 @@
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_StorageTaskServices")]
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_StoragIntegrationRepository")]
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_StoragIntegrationServices")]
[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEA_Tasks")]
// ç”± MSBuild WriteCodeFragment ç±»ç”Ÿæˆã€‚