From a699ec37293462e17e1b1261bcda5325c1b4840b Mon Sep 17 00:00:00 2001
From: Admin <Admin@ADMIN>
Date: 星期五, 23 一月 2026 13:55:56 +0800
Subject: [PATCH] 优化wmsjob

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MESTaskService.cs |   49 ++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 36 insertions(+), 13 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MESTaskService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MESTaskService.cs"
index ddc2e8f..2c12e3e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MESTaskService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MESTaskService.cs"
@@ -23,6 +23,7 @@
 using WIDESEA_Core.Helper;
 using WIDESEA_DTO.Inbound;
 using WIDESEA_DTO.Task;
+using WIDESEA_ITaskInfoService;
 using WIDESEA_Model.Models;
 using static WIDESEA_ITaskInfoService.ITaskService;
 
@@ -30,6 +31,7 @@
 {
     public partial class TaskService
     {
+        public static List<string> InStationareaList = new List<string>() { "1113", "1114", "1115", "1116", "1117", "1118", "1119", "1120", "1121", "1122" };
         //鍏ュ簱锛岀┖鐩樺洖搴�
         public ApiResponse AddInStoreDoc(MES_InTask mES_In)
         {
@@ -108,20 +110,41 @@
                 task.Creater = "MES";
                 task.CreateDate = DateTime.Now;
 
-                /*Dt_StockInfo dt_StockInfo = new Dt_StockInfo();
-                dt_StockInfo.PalletCode = task.PalletCode;
-                dt_StockInfo.PalletType = task.PalletType;
-                dt_StockInfo.WarehouseId = task.WarehouseId;
-                dt_StockInfo.StockStatus = (int)StockStatusEmun.鍏ュ簱涓�;
-                dt_StockInfo.Creater = "MWS";
-                dt_StockInfo.CreateDate = DateTime.Now;*/
+                int taskid=BaseDal.AddData(task);
 
-                _unitOfWorkManage.BeginTran();
-                BaseDal.AddData(task);
-                //_stockInfoService.Repository.AddData(dt_StockInfo);
-                _unitOfWorkManage.CommitTran();
-                WriteLog.Write_Log("MES_鎺ユ敹鍏ュ簱浠诲姟涓嬪彂", $"鍙嶉淇℃伅", "鎴愬姛", $"浠诲姟娣诲姞鎴愬姛锛屾墭鐩樻潯鐮侊細{task.PalletCode}");
-                return apiResponse.OK();
+                //鍒涘缓浠诲姟鍚庯紝鍒ゆ柇鏄惁鏄骇绾垮洖搴撶殑浠诲姟
+                if (!InStationareaList.Contains(task.SourceAddress))
+                {
+                    WriteLog.Write_Log("MES_鎺ユ敹鍏ュ簱浠诲姟涓嬪彂", $"鍙嶉淇℃伅", "鎴愬姛", $"浠诲姟娣诲姞鎴愬姛锛屾墭鐩樻潯鐮侊細{task.PalletCode}");
+                    return apiResponse.OK();
+                }
+                else
+                {
+                    WCSginseng result = PLC_IssueTasks(
+                        task.TaskId,
+                        int.Parse(task.Roadway),
+                        task.TaskNum,
+                        task.PalletCode,
+                        int.Parse(task.PalletType),
+                        task.CurrentAddress,
+                        task.NextAddress,
+                        "");
+                    if (result.IsSuccess)
+                    {
+
+                        task.TaskStatus = (int)InTaskStatusEnum.PLC_InExecuting;
+                        string Result = MesInTaskStatusEnum.Start.GetDescription();
+                        BaseDal.UpdateData(task);
+                        //璋冨彇涓婃父绯荤粺鍙嶉寮�濮嬩换鍔�
+                        InStoreDocCallback(task.TaskNum, Result, "鎿嶄綔鎴愬姛", task.PalletCode, "");
+                        return apiResponse.OK();
+                    }
+                    else
+                    {
+                        BaseDal.DeleteData(task);
+                        return apiResponse.Error($"涓嬪彂浠诲姟澶辫触锛屼笅鍙慦CS澶辫触锛屽師鍥狅細{result.Message}");
+                    }
+                }
             }
             catch (Exception ex)
             {

--
Gitblit v1.9.3