集成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修复,提升系统健壮性和可用性。
| | |
| | | public string TargetAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¸ä¸ä½ç½® |
| | | /// </summary> |
| | | public string NextAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¼å
级 |
| | | /// </summary> |
| | | public int Grade { get; set; } |
| | |
| | | [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")] |
| | |
| | | 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> |
| | |
| | | [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")] |
| | |
| | | [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")] |
| | |
| | | [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")] |
| | |
| | | { |
| | | |
| | | } |
| | | return Json(vueDictionaryDTOs); |
| | | return Json(vueDictionaryDTOs.GroupBy(x => x.DicNo).Select(g => g.First()).ToList()); |
| | | } |
| | | |
| | | private VueDictionaryDTO? GetVueDictionary(string key) |
| | |
| | | { |
| | | return Service.ReceiveByWMSGWTask(taskDTOs); |
| | | } |
| | | [HttpPost, Route("ReceiveByWMSNGTask"), AllowAnonymous] |
| | | public WebResponseContent ReceiveByWMSNGTask([FromBody] WMSTaskDTO taskDTOs) |
| | | { |
| | | return Service.ReceiveByWMSNGTask(taskDTOs); |
| | | } |
| | | |
| | | |
| | | [HttpPost, HttpGet, Route("UpdateTaskExceptionMessage")] |
| | |
| | | [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")] |
| | |
| | | |
| | | // å起请æ±è·åå
¥åºä»»å¡ |
| | | content = await RequestInTask(palletCode, stationManager); |
| | | ConsoleHelper.WriteErrorLine($"{stationManager.stationChildCode}ç«å°è¯·æ±ååºä¿¡æ¯:{content.ToJsonString()}"); |
| | | //ConsoleHelper.WriteErrorLine($"{stationManager.stationChildCode}ç«å°è¯·æ±ååºä¿¡æ¯:{content.ToJsonString()}"); |
| | | |
| | | if (!content.Status) |
| | | { |
| | |
| | | } |
| | | |
| | | var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString()); |
| | | ConsoleHelper.WriteSuccessLine(content.Data.ToString()); |
| | | //ConsoleHelper.WriteSuccessLine(content.Data.ToString()); |
| | | return ReceiveByWMSTask(task); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | task.NextAddress = "002-000-002"; |
| | | task.SourceAddress = taskDTO.SourceAddress; |
| | | task.TargetAddress = taskDTO.TargetAddress; |
| | | |
| | | } |
| | | BaseDal.AddData(task); |
| | | |
| | |
| | | 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> |
| | |
| | | |
| | | 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($"æªæ¾å°è®¾å¤è·¯ç±ä¿¡æ¯"); |
| | |
| | | [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")] |
| | |
| | | [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")] |
| | |
| | | |
| | | _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) |
| | |
| | | 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); |
| | |
| | | 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}ãæç"); |
| | | //} |
| | | } |
| | | } |
| | | } |
| | |
| | | _taskService.Delete(taskExecuting); |
| | | } |
| | | |
| | | ConsoleHelper.WriteErrorLine($"å½åæçåå¨ä»»å¡ï¼ã{command.ConveyorLineBarcode}ã"); |
| | | |
| | | WriteInfo(conveyorLine.DeviceName, $"å½åæçåå¨ä»»å¡{command.ConveyorLineBarcode}"); |
| | | } |
| | | |
| | |
| | | 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); |
| | |
| | | } |
| | | 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); |
| | |
| | | } |
| | | 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); |
| | |
| | | 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) |
| | |
| | | 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) |
| | | { |
| | |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | |
| | | var content = _taskService.ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO }); |
| | | if (content.Status) |
| | | { |
| | | Console.WriteLine($"{taskDTO.TaskType}å¼å«æå"); |
| | | //Console.WriteLine($"{taskDTO.TaskType}å¼å«æå"); |
| | | } |
| | | return content; |
| | | } |
| | |
| | | _taskService.Delete(taskExecuting); |
| | | } |
| | | |
| | | ConsoleHelper.WriteErrorLine($"å½åæçåå¨ä»»å¡ï¼ã{command.ConveyorLineBarcode}ã"); |
| | | //ConsoleHelper.WriteErrorLine($"å½åæçåå¨ä»»å¡ï¼ã{command.ConveyorLineBarcode}ã"); |
| | | |
| | | WriteInfo(conveyorLine.DeviceName, $"å½åæçåå¨ä»»å¡{command.ConveyorLineBarcode}"); |
| | | } |
| | |
| | | { |
| | | 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; |
| | | } |
| | | } |
| | |
| | | } |
| | | 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) |
| | |
| | | using Mapster; |
| | | using Autofac.Core; |
| | | using Mapster; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System.Diagnostics.CodeAnalysis; |
| | |
| | | { |
| | | try |
| | | { |
| | | |
| | | CommonStackerCrane commonStackerCrane = (CommonStackerCrane)context.JobDetail.JobDataMap.Get("JobParams"); |
| | | if (commonStackerCrane != null) |
| | | { |
| | |
| | | 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}ã,ä¸å¯ä»¥ä¸åä»»å¡"); |
| | | } |
| | | } |
| | | } |
| | |
| | | { |
| | | 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); |
| | |
| | | |
| | | 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) |
| | |
| | | { |
| | | 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); |
| | | } |
| | |
| | | } |
| | | |
| | | 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); |
| | |
| | | /// <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> |
| | |
| | | } |
| | | 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]); |
| | |
| | | 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); |
| | | } |
| | |
| | | { |
| | | 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); |
| | |
| | | } |
| | | WriteInfo(commonStackerCrane.DeviceName, $"ãæå¨åºåºè®°å½ãä»»å¡å·ã{e.TaskNum}ãæçå·ã{task.PalletCode}ã"); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup) |
| | | { |
| | |
| | | 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); |
| | | } |
| | |
| | | { |
| | | 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); |
| | |
| | | [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")] |
| | |
| | | public const string ReceiveTask = "ReceiveTask"; |
| | | |
| | | /// <summary> |
| | | /// 请æ±WCSä»»å¡ä¸åNGåºåºä»»å¡ |
| | | /// </summary> |
| | | public const string ReceiveByWMSNGTask = "ReceiveByWMSNGTask"; |
| | | |
| | | /// <summary> |
| | | /// 请æ±WCSä»»å¡ |
| | | /// </summary> |
| | | public const string GetStation = "GetStation"; |
| | |
| | | èªå¨æ¢å¤ = 4, |
| | | äººå·¥å®æ = 5, |
| | | èªå¨å®æ = 6, |
| | | NGä»»å¡å é¤ = 7, |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; } |
| | | } |
| | | } |
| | |
| | | <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" /> |
| | |
| | | public string TargetAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¸ä¸ä½ç½® |
| | | /// </summary> |
| | | public string NextAddress { get; set; } |
| | | |
| | | /// <summary> |
| | | /// ä¼å
级 |
| | | /// </summary> |
| | | public int Grade { get; set; } |
| | |
| | | [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")] |
| | |
| | | WebResponseContent GetLocationStatus(); |
| | | |
| | | Task<string> GetRoadWayAsync(List<string> process); |
| | | |
| | | Task<string> GetGWRoadWayAsync(List<string> process); |
| | | } |
| | |
| | | [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")] |
| | |
| | | ILocationStatusChangeRecordRepository locationStatusChangeRecordRepository, |
| | | IStockInfoDetailRepository stockInfoDetailRepository, |
| | | IMapper mapper, |
| | | IDt_TaskService taskService, |
| | | IDt_TaskService taskService, |
| | | IDt_AreaInfoRepository AreaInfoRepository, |
| | | ISys_ConfigService configService) : base(BaseDal) |
| | | { |
| | |
| | | _mapper = mapper; |
| | | _taskService = taskService; |
| | | _AreaInfoRepository = AreaInfoRepository; |
| | | _configService= configService; |
| | | _configService = configService; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | 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"); |
| | |
| | | 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 |
| | |
| | | AddStockInfoDetailHty(details); |
| | | } |
| | | await AddStockInfoHtyAsync(stockInfo_Hty); |
| | | |
| | | |
| | | |
| | | location.LocationStatus = (int)LocationEnum.Free; |
| | | BaseDal.UpdateData(location); |
| | |
| | | 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); |
| | | } |
| | |
| | | { |
| | | |
| | | var isStockAdd = SqlSugarHelper.DbWMS.Insertable(details).ExecuteCommand(); |
| | | if (isStockAdd==0) |
| | | if (isStockAdd == 0) |
| | | { |
| | | throw new Exception("åºåæç»åå²ä¿¡æ¯æ·»å 失败"); |
| | | } |
| | | } |
| | | |
| | | |
| | | #endregion |
| | | |
| | | #endregion å
鍿¹æ³ |
| | |
| | | } |
| | | } |
| | | |
| | | 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ä¸åçéç½®æ¶é´å°å½åæ¶é´çåéæ° |
| | |
| | | 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); |
| | |
| | | |
| | | 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, "ç«è¦ä»»å¡", ""); |
| | |
| | | { |
| | | 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}åå¨ä»»å¡"); |
| | | } |
| | |
| | | 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) |
| | |
| | | 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); |
| | |
| | | { |
| | | 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("æ æ³è·åç®æ å°å"); |
| | |
| | | { |
| | | 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) |
| | | { |
| | |
| | | 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> |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | 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; |
| | | } |
| | | } |
| | | } |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | |  |
| | | 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; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | <Nullable>enable</Nullable> |
| | | </PropertyGroup> |
| | | |
| | | <ItemGroup> |
| | | <PackageReference Include="Quartz" Version="3.18.0" /> |
| | | </ItemGroup> |
| | | |
| | | <ItemGroup> |
| | | <ProjectReference Include="..\WIDESEA_StorageTaskServices\WIDESEA_StorageTaskServices.csproj" /> |
| | | </ItemGroup> |
| | | |
| | | </Project> |
| | |
| | | <?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> |
| | |
| | | { |
| | | return await Service.GetRoadWayAsync(process); |
| | | } |
| | | [HttpPost, AllowAnonymous, Route("GetGWRoadWayAsync")] |
| | | public async Task<string> GetGWRoadWayAsync(List<string> process) |
| | | { |
| | | return await Service.GetGWRoadWayAsync(process); |
| | | } |
| | | } |
| | |
| | | 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); |
| | | |
| | |
| | | |
| | | 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)ã |
| | |
| | | WIDESEA_Core.Helper.ConsoleHelper.WriteSuccessLine("Redis æå¡å·²æå注å"); |
| | | } |
| | | } |
| | | app.UseQuartzJobMildd(); |
| | | |
| | | // 3ãé
ç½®ä¸é´ä»¶ |
| | | app.UseMiniProfiler();//æ§è½åæå¨ |
| | |
| | | <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> |
| | |
| | | "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", //çç¥åç§° |
| | |
| | | "ClearRedis": true |
| | | } |
| | | }, |
| | | //Jobæ§è¡é´éæ¶é´ï¼åä½ä¸ºç§ |
| | | "IntervalSecond": 10, |
| | | // å
许åºåºçç¼ç |
| | | "OutBoundMateriel": [ |
| | | //{ |
| | |
| | | [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 ç±»çæã |
| | | |