From 9ae0890dd74771ba9edd44d4830e0de37f8d9938 Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期五, 26 九月 2025 16:55:03 +0800
Subject: [PATCH] MES接口优化,老厂排程优化等

---
 项目代码/WCS/WCSServices/WIDESEAWCS_Tasks/成品仓/ConveyorLineJob_CPH.cs |   51 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 20 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPH.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPH.cs"
index bdf7663..a23ee93 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPH.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServices/WIDESEAWCS_Tasks/\346\210\220\345\223\201\344\273\223/ConveyorLineJob_CPH.cs"
@@ -82,13 +82,13 @@
                                 {
                                     //鑾峰彇褰撳墠璁惧
                                     OtherDevice device = (OtherDevice)value;
-                                    List<string> deviceStations = device.DeviceProDTOs.Select(x => x.DeviceChildCode).Distinct().ToList();
                                     List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
-                                    foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode)))
+                                    Dt_StationManger? RequestIn = stationMangers.FirstOrDefault(x => x.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt());
+                                    if (RequestIn != null)
                                     {
-                                        DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
-                                        DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
-                                        if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt() && deviceProRead != null && deviceProWrite != null)
+                                        DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == RequestIn.StationCode && x.DeviceProParamType == nameof(R_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+                                        DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == RequestIn.StationCode && x.DeviceProParamType == nameof(W_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+                                        if (deviceProRead != null && deviceProWrite != null)
                                         {
                                             R_CLineCPHInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_CLineCPHInfo>(deviceProRead.DeviceProAddress);
                                             //鐮佸灈鐜嚎璇锋眰浠诲姟 
@@ -100,18 +100,34 @@
                                                 //{
 
                                                 //}
-                                                //鍐欏叆鎵ц鏁版嵁
-                                                device.SetValue(W_CLineCPHDB.W_TaskNo, 1002, item.StationCode);
-                                                device.SetValue(W_CLineCPHDB.W_Channel, 5, item.StationCode);
-                                                device.SetValue(W_CLineCPHDB.W_Long, 400, item.StationCode);
-                                                device.SetValue(W_CLineCPHDB.W_Wide, 370, item.StationCode);
-                                                device.SetValue(W_CLineCPHDB.W_High, 300, item.StationCode);
-                                                device.SetValue(W_CLineCPHDB.W_TMID, conveyorLineInfoRead.R_BoxCode, item.StationCode);
-                                                device.SetValue(W_CLineCPHDB.W_Request, 1, item.StationCode);
+                                                string[] strings = conveyorLineInfoRead.R_BoxCode.Split("-");
+                                                if (strings.Length==2)
+                                                {
+                                                    //鍐欏叆鎵ц鏁版嵁
+                                                    device.SetValue(W_CLineCPHDB.W_TaskNo, 100 + strings[1].ObjToInt(), RequestIn.StationCode);
+                                                    device.SetValue(W_CLineCPHDB.W_Channel, strings[1].ObjToInt(), RequestIn.StationCode);
 
+                                                    device.SetValue(W_CLineCPHDB.W_Long, 425, RequestIn.StationCode);
+                                                    device.SetValue(W_CLineCPHDB.W_Wide, 325, RequestIn.StationCode);
+                                                    device.SetValue(W_CLineCPHDB.W_High, 400, RequestIn.StationCode);
+                                                    device.SetValue(W_CLineCPHDB.W_TMID, conveyorLineInfoRead.R_BoxCode, RequestIn.StationCode);
+                                                    device.SetValue(W_CLineCPHDB.W_Request, 1, RequestIn.StationCode);
+                                                }
+                                                else
+                                                {
+                                                    WriteError(RequestIn.StationName, $"鏁版嵁鎴彇閿欒锛歿strings}");
+                                                }
                                             }
                                         }
-                                        else if (item.StationType == StationTypeEnum.StationType_OnlyOutbound.ObjToInt() && deviceProRead != null)
+                                        else
+                                        {
+                                            WriteError(RequestIn.StationName, $"鏈壘鍒拌澶囧瓙缂栧彿{RequestIn.StationCode}鐨勫崗璁俊鎭�");
+                                        }
+                                    }
+                                    foreach (var item in stationMangers.Where(x=>x.StationType==StationTypeEnum.StationType_OnlyOutbound.ObjToInt()))
+                                    {
+                                        DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_CLineCPHDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+                                        if (deviceProRead != null)
                                         {
                                             R_CLineCPHInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_CLineCPHInfo>(deviceProRead.DeviceProAddress);
                                             //鑾峰彇鐮佸灈鍙d换鍔℃洿鏂颁换鍔$姸鎬�
@@ -127,14 +143,9 @@
                                                 }
                                             }
                                         }
-                                        else
-                                        {
-                                            WriteError(item.StationName, $"鏈壘鍒拌澶囧瓙缂栧彿{item.StationCode}鐨勫崗璁俊鎭�");
-                                        }
                                     }
+                                    Thread.Sleep(100);
                                 }
-                                Thread.Sleep(100);
-                                
                             }
                         }
                         catch (Exception ex)

--
Gitblit v1.9.3