From ad16e8351b0ece14ac2c1672dea69b08ef079e88 Mon Sep 17 00:00:00 2001
From: 肖洋 <cathay_xy@163.com>
Date: 星期三, 15 一月 2025 18:19:03 +0800
Subject: [PATCH] 优化代码并更新配置文件

---
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json                                                      |    6 +-
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_BZ/CommonConveyorLine_BZJob.cs                         |   24 ++++-------
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs                            |   60 +++++++++++++++++++++---------
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs |    7 ++-
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs                         |    2 -
 5 files changed, 58 insertions(+), 41 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_BZ/CommonConveyorLine_BZJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_BZ/CommonConveyorLine_BZJob.cs
index 637b479..f00e1ff 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_BZ/CommonConveyorLine_BZJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_BZ/CommonConveyorLine_BZJob.cs
@@ -1,4 +1,5 @@
 锘�#region MyRegion
+
 #region << 鐗� 鏈� 娉� 閲� >>
 
 /*----------------------------------------------------------------
@@ -20,37 +21,24 @@
 
 using AutoMapper;
 using HslCommunication;
-using Microsoft.AspNetCore.Server.HttpSys;
 using Newtonsoft.Json;
 using Quartz;
-using SqlSugar;
-using System.Diagnostics.CodeAnalysis;
-using System.Net;
 using System.Reflection;
-using System.Threading.Tasks;
 using WIDESEAWCS_BasicInfoRepository;
 using WIDESEAWCS_BasicInfoService;
 using WIDESEAWCS_Common;
-using WIDESEAWCS_Common.TaskEnum;
-using WIDESEAWCS_Core;
-using WIDESEAWCS_Core.Caches;
 using WIDESEAWCS_Core.Helper;
-using WIDESEAWCS_Core.HttpContextUser;
 using WIDESEAWCS_DTO.MOM;
-using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_IProcessRepository;
-using WIDESEAWCS_ISystemRepository;
 using WIDESEAWCS_ISystemServices;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob;
-using WIDESEAWCS_QuartzJob.DeviceBase;
 using WIDESEAWCS_QuartzJob.DTO;
 using WIDESEAWCS_QuartzJob.Service;
 using WIDESEAWCS_SignalR;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
-using static Microsoft.EntityFrameworkCore.DbLoggerCategory.Database;
 using ICacheService = WIDESEAWCS_Core.Caches.ICacheService;
 
 namespace WIDESEAWCS_Tasks
@@ -95,6 +83,7 @@
                 if (conveyorLine != null)
                 {
                     #region 绔欏彴鏂瑰紡
+
                     List<Dt_StationManager> stationManagers = _stationManagerService.GetAllStationByDeviceCode(conveyorLine.DeviceCode);
 
                     foreach (var station in stationManagers)
@@ -112,6 +101,7 @@
                         }
 
                         #region 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
+
                         //var tokenInfos = _cacheService.Get<List<UserInfo>>("Cache_UserToken");
                         //if (tokenInfos == null || !tokenInfos.Any())
                         //{
@@ -130,9 +120,11 @@
 
                         #endregion 璋冪敤浜嬩欢鎬荤嚎閫氱煡鍓嶇
                     }
-                    #endregion
+
+                    #endregion 绔欏彴鏂瑰紡
 
                     #region 璺敱鏂瑰紡
+
                     //List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
                     //foreach (string childDeviceCode in childDeviceCodes)
                     //{
@@ -168,7 +160,8 @@
                     //        }
                     //    }
                     //}
-                    #endregion
+
+                    #endregion 璺敱鏂瑰紡
                 }
             }
             catch (Exception ex)
@@ -274,4 +267,5 @@
         }
     }
 }
+
 #endregion
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
index 3479aa7..0f78e15 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/CommonConveyorLine_GWJob.cs
@@ -244,7 +244,6 @@
                 Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
                 if (newTask != null)
                 {
-
                     //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, newTask.TaskNum, childDeviceCode);
                     //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, newTask.NextAddress, childDeviceCode);
                     //conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineBarcode, command.ConveyorLineBarcode, childDeviceCode);
@@ -361,7 +360,6 @@
                     conveyorLine.SetValue(ConveyorLineDBName_After.ResponState, 1, childDeviceCode);
                     _taskService.UpdateTaskStatusToNext(task);
                 }
-
             }
         }
 
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
index 2dce837..16bde53 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob_GW/GWTask/RequestInbound.cs
@@ -238,24 +238,48 @@
         {
             if (command.ConveyorLineBarcode != "NoRead")
             {
-                var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode);
-
-                if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null)
+                var config = _sys_ConfigService.GetByConfigKey("SYS_BASE", "ISFRINTRAY");
+                if (config.ConfigValue == "1")
                 {
-                    WriteInfo(conveyorLine.DeviceName, "褰撳墠鎵樼洏瀛樺湪浠诲姟");
-                    return;
-                }
-
-                var content = CreateAndSendTask(taskDTO);
-                if (content.Status)
-                {
-                    var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
-                    if (task != null)
+                    Random random = new Random();
+                    var task = new Dt_Task()
                     {
-                        var taskCommand = MapTaskCommand(task, command);
-                        conveyorLine.SendCommand(taskCommand, childDeviceCode);
-                        //ConveyorLineSendFinish(conveyorLine, childDeviceCode, true);
-                        _taskService.UpdateTaskStatusToNext(task);
+                        CurrentAddress = childDeviceCode,
+                        Grade = 1,
+                        NextAddress = "2066",
+                        PalletCode = command.ConveyorLineBarcode,
+                        Roadway = "FR",
+                        SourceAddress = childDeviceCode,
+                        TargetAddress = "2066",
+                        TaskNum = random.Next(1,9999),
+                        TaskType = (int)TaskInboundTypeEnum.InTray,
+                        TaskState = (int)TaskInStatusEnum.Line_InExecuting,
+                        WMSId = 0
+                    };
+                    var taskCommand = MapTaskCommand(task, command);
+                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                }
+                else
+                {
+                    var taskDTO = CreateEmptyTrayTaskDto(command.ConveyorLineBarcode, childDeviceCode);
+
+                    if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null)
+                    {
+                        WriteInfo(conveyorLine.DeviceName, "褰撳墠鎵樼洏瀛樺湪浠诲姟");
+                        return;
+                    }
+
+                    var content = CreateAndSendTask(taskDTO);
+                    if (content.Status)
+                    {
+                        var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+                        if (task != null)
+                        {
+                            var taskCommand = MapTaskCommand(task, command);
+                            conveyorLine.SendCommand(taskCommand, childDeviceCode);
+                            //ConveyorLineSendFinish(conveyorLine, childDeviceCode, true);
+                            _taskService.UpdateTaskStatusToNext(task);
+                        }
                     }
                 }
             }
@@ -369,10 +393,10 @@
             }
 
 
-            if( conveyorLine.ReadValue(ConveyorLineDBName_After.InteractiveSignal, childDeviceCode).ObjToInt() ==  0) //鎵樼洏姝e弽淇″彿
+            if (conveyorLine.ReadValue(ConveyorLineDBName_After.InteractiveSignal, childDeviceCode).ObjToInt() == 0) //鎵樼洏姝e弽淇″彿
             {
 
-            }; 
+            };
 
             conveyorLine.ReadValue(ConveyorLineDBName_After.InteractiveSignal, childDeviceCode);  //鎵樼洏鏈夋棤鐢佃姱淇″彿
 
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
index 8caca28..9583158 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/appsettings.json
@@ -11,11 +11,11 @@
   //杩炴帴瀛楃涓�
   //"ConnectionString": "HTI6FB1H05Krd07mNm9yBCNhofW6edA5zLs9TY~MNthRYW3kn0qKbMIsGp~3yyPDF1YZUCPBQx8U0Jfk4PH~ajNFXVIwlH85M3F~v_qKYQ3CeAz3q1mLVDn8O5uWt1~3Ut2V3KRkEwYHvW2oMDN~QIDXPxDgXN0R2oTIhc9dNu7QNaLEknblqmHhjaNSSpERdDVZIgHnMKejU_SL49tralBkZmDNi0hmkbL~837j1NWe37u9fJKmv91QPb~16JsuI9uu0EvNZ06g6PuZfOSAeFH9GMMIZiketdcJG3tHelo=",
   //"ConnectionString": "Data Source=192.168.5.251;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",
-  //"ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  "ConnectionString": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WMS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
   //"ConnectionString": "Data Source=.\\LIULEI;Initial Catalog=WIDESEA_WMSDB_BBMain;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-  "ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  //"ConnectionString": "Data Source=192.168.20.251;Initial Catalog=WIDESEA_WMSDB;User ID=sa;Password=123456@gy;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
   //"ConnectionStringWCS": "Data Source=192.168.5.251;Initial Catalog=WIDESEAWCS_TEST;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
-  //"ConnectionStringWCS": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+  "ConnectionStringWCS": "Data Source=127.0.0.1;Initial Catalog=WIDESEA_WCS2F08;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
   //璺ㄥ煙
   "Cors": {
     "PolicyName": "CorsIpAccess", //绛栫暐鍚嶇О
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs
index 1cf4236..c85e30c 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/WIDESEA_WMSServer.MvcApplicationPartsAssemblyInfo.cs
@@ -1,9 +1,10 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
-//     This code was generated by a tool.
+//     姝や唬鐮佺敱宸ュ叿鐢熸垚銆�
+//     杩愯鏃剁増鏈�:4.0.30319.42000
 //
-//     Changes to this file may cause incorrect behavior and will be lost if
-//     the code is regenerated.
+//     瀵规鏂囦欢鐨勬洿鏀瑰彲鑳戒細瀵艰嚧涓嶆纭殑琛屼负锛屽苟涓斿鏋�
+//     閲嶆柊鐢熸垚浠g爜锛岃繖浜涙洿鏀瑰皢浼氫涪澶便��
 // </auto-generated>
 //------------------------------------------------------------------------------
 

--
Gitblit v1.9.3