From a0a0df2e824b6fe7e5a3c0afce78127fecf84fc9 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期一, 03 十一月 2025 08:23:05 +0800
Subject: [PATCH] ERP接口代码更新,WCS代码优化,出入库分配优化

---
 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/桁架/TrussCartonJob.cs |   57 ++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 32 insertions(+), 25 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\241\201\346\236\266/TrussCartonJob.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\241\201\346\236\266/TrussCartonJob.cs"
index e5cf9f5..5f12377 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\241\201\346\236\266/TrussCartonJob.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\241\201\346\236\266/TrussCartonJob.cs"
@@ -62,39 +62,46 @@
 
         public Task Execute(IJobExecutionContext context)
         {
-            bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
-            if (flag && value != null)
+            try
             {
-                OtherDevice device = (OtherDevice)value;
-                List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
-                //鑾峰彇鍗忚
-                DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == device.DeviceCode && x.DeviceProParamType == nameof(R_TrussCartonDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
-                DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == device.DeviceCode && x.DeviceProParamType == nameof(W_TrussCartonDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
-                //鍒ゆ柇鍗忚鏄惁婊¤冻
-                if (deviceProRead!=null && deviceProWrite!=null)
+                bool flag = context.JobDetail.JobDataMap.TryGetValue("JobParams", out object? value);
+                if (flag && value != null)
                 {
-                    foreach (var item in stationMangers)
+                    OtherDevice device = (OtherDevice)value;
+                    List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
+                    //鑾峰彇鍗忚
+                    DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == device.DeviceCode && x.DeviceProParamType == nameof(R_TrussCartonDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+                    DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == device.DeviceCode && x.DeviceProParamType == nameof(W_TrussCartonDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+                    //鍒ゆ柇鍗忚鏄惁婊¤冻
+                    if (deviceProRead != null && deviceProWrite != null)
                     {
-                        //鐮佸灈鐘舵��
-                        bool Call = device.GetValue<R_TrussCartonDB, bool>(GetCartonCall(item.StackerCraneStationCode), item.StackerCraneCode);
-                        
-                        if (Call && item.IsOccupied == 0)
+                        device.SetValue(W_TrussCartonDB.W_CartonHeart, false, device.DeviceCode);
+                        //鍐欏叆蹇冭烦
+                        foreach (var item in stationMangers)
                         {
-                            //璇锋眰WMS鍙枡浠诲姟
+                            //鐮佸灈鐘舵��
+                            bool Call = device.GetValue<R_TrussCartonDB, bool>(GetCartonCall(item.StackerCraneStationCode), item.StackerCraneCode);
 
+                            if (Call && item.IsOccupied == 0)
+                            {
+                                //璇锋眰WMS鍙枡浠诲姟
+                            }
+                            else if (Call && item.IsOccupied == 1)
+                            {
+                                //璇锋眰WMS绌烘墭鍙犵洏浠诲姟
+                            }
                         }
-                        else if (Call && item.IsOccupied==1)
-                        {
-                            //璇锋眰WMS绌烘墭鍙犵洏浠诲姟
-
-                        }
-                        
+                        device.SetValue(W_TrussCartonDB.W_CartonHeart, true, device.DeviceCode);
+                    }
+                    else
+                    {
+                        WriteError(device.DeviceCode, $"鏈壘鍒拌澶囩紪鍙穥device.DeviceCode}鐨勫崗璁俊鎭�");
                     }
                 }
-                else
-                {
-                    WriteError(device.DeviceCode, $"鏈壘鍒拌澶囩紪鍙穥device.DeviceCode}鐨勫崗璁俊鎭�");
-                }
+            }
+            catch (Exception ex)
+            {
+                WriteError(nameof(TrussCartonJob),ex.Message);
             }
             return Task.CompletedTask;
         }

--
Gitblit v1.9.3