From c6e8b600398de38b6684f5fa1eaaaade8562859b Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期六, 20 九月 2025 15:16:56 +0800
Subject: [PATCH] Merge branch 'master' of http://115.159.85.185:8098/r/ZhiHuiQiCe/LongDeLiLiKu

---
 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/原料库/ConveyorLineJob_YLOld.cs |  102 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 102 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/ConveyorLineJob_YLOld.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/ConveyorLineJob_YLOld.cs"
new file mode 100644
index 0000000..51ddf6a
--- /dev/null
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\345\216\237\346\226\231\345\272\223/ConveyorLineJob_YLOld.cs"
@@ -0,0 +1,102 @@
+锘縰sing Microsoft.AspNetCore.Components.Routing;
+using Newtonsoft.Json;
+using Quartz;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection.Metadata;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Common;
+using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_Communicator;
+using WIDESEAWCS_Core;
+using WIDESEAWCS_Core.Helper;
+using WIDESEAWCS_IBasicInfoRepository;
+using WIDESEAWCS_ITaskInfoRepository;
+using WIDESEAWCS_ITaskInfoService;
+using WIDESEAWCS_Model.Models;
+using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Models;
+using WIDESEAWCS_QuartzJob.Repository;
+using WIDESEAWCS_QuartzJob.Service;
+using WIDESEAWCS_Tasks.ConveyorLineJob;
+using ICacheService = WIDESEAWCS_Core.Caches.ICacheService;
+
+namespace WIDESEAWCS_Tasks
+{
+    [DisallowConcurrentExecution]
+    public class ConveyorLineJob_YLOld : JobBase, IJob
+    {
+        private readonly ICacheService _cacheService;
+        private readonly ITaskService _taskService;
+        private readonly ITaskExecuteDetailService _taskExecuteDetailService;
+        private readonly ITaskRepository _taskRepository;
+        private readonly IStationMangerRepository _stationMangerRepository;
+        private readonly IRouterRepository _routerRepository;
+        private readonly IRouterService _routerService;
+        private readonly IRouterExtension _routerExtension;
+        private readonly List<Dt_WarehouseDevice> warehouseDevices;
+
+        public ConveyorLineJob_YLOld(ICacheService cacheService, ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository, IRouterRepository routerRepository, IRouterService routerService, IRouterExtension routerExtension)
+        {
+            _cacheService = cacheService;
+            _taskService = taskService;
+            _taskExecuteDetailService = taskExecuteDetailService;
+            _taskRepository = taskRepository;
+            _stationMangerRepository = stationMangerRepository;
+            _routerRepository = routerRepository;
+            _routerService = routerService;
+            _routerExtension = routerExtension;
+
+            string? warehouseDevicesStr = _cacheService.Get<string>(nameof(Dt_WarehouseDevice));
+            if (!string.IsNullOrEmpty(warehouseDevicesStr))
+            {
+                warehouseDevices = JsonConvert.DeserializeObject<List<Dt_WarehouseDevice>>(warehouseDevicesStr) ?? new List<Dt_WarehouseDevice>();
+            }
+            else
+            {
+                warehouseDevices = new List<Dt_WarehouseDevice>();
+            }
+        }
+
+        public Task Execute(IJobExecutionContext context)
+        {
+            bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
+            if (flag && value != null)
+            {
+                OtherDevice device = (OtherDevice)value;
+                //鑾峰彇鎵�鏈夊崗璁殑杈撻�佺嚎绔欏彴
+                List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).ToList();
+                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
+                foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode)))
+                {
+                    DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(WR_CLineYLDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+                    if (deviceProRead != null)
+                    {
+                        R_ConveyorLineYLInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineYLInfo>(deviceProRead.DeviceProAddress);
+                        if (conveyorLineInfoRead != null && item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt() && conveyorLineInfoRead.WR_ToHode <= 0 && conveyorLineInfoRead.WR_Request == 86 && !string.IsNullOrEmpty(conveyorLineInfoRead.WR_TMID)) //鑰佸巶鐢宠鍏ュ簱
+                        {
+                            WebResponseContent content = _taskService.YLPurchaseBoxing(conveyorLineInfoRead.WR_TMID);
+                            if (content.Status)
+                            {
+                                device.SetValue(WR_CLineYLDB.WR_Reresult, 86, item.StationCode);
+                                WriteInfo(item.StationCode, $"璇锋眰閫�鏂欐潯鐮�:{conveyorLineInfoRead.WR_TMID}");
+                            }
+                            else
+                            {
+                                WriteError(item.StationCode, $"璇锋眰閫�鏂欏け璐ワ細{content.Message}");
+                            }
+                        }
+                    }
+                    else
+                    {
+                        WriteError(item.StationName, $"鏈壘鍒拌澶囧瓙缂栧彿{item.StationCode}鐨勫崗璁俊鎭�");
+                    }
+                }
+            }
+            return Task.CompletedTask;
+        }
+    }
+}

--
Gitblit v1.9.3