From d5fe80c5cb7dc0b209d8fea9faa84c7ca5b20324 Mon Sep 17 00:00:00 2001
From: Admin <Admin@ADMIN>
Date: 星期五, 16 一月 2026 16:07:18 +0800
Subject: [PATCH] 出入库移库完成

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MESTaskService.cs |   67 ++++++++++++++++++++-------------
 1 files changed, 41 insertions(+), 26 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 f19a9d6..712c319 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"
@@ -45,28 +45,41 @@
                 if (string.IsNullOrWhiteSpace(mES_In.endPosition)) return apiResponse.Error("鐩爣浣嶇疆涓嶈兘涓虹┖");
                 if (string.IsNullOrWhiteSpace(mES_In.containerType)) return apiResponse.Error("杞藉叿绫诲瀷涓嶈兘涓虹┖");  //杞藉叿绫诲瀷锛屽竷鏂�-1锛屾澗甯冨嵎-2锛屾垚鍝�-1
 
-                Dt_Warehouse dt_Warehouse = _warehouseService.QueryWarehouse(mES_In.warehouseNo);
-                if (dt_Warehouse == null) return apiResponse.Error($"WMS鏈兘鏌ヨ閬撳搴斾粨搴擄紝浠撳簱缂栫爜锛歿mES_In.warehouseNo}");
-                int LocationType = 1;
-                if (dt_Warehouse.WarehouseType == (int)WarehouseEnum.YMYL)
-                {
-                    if (mES_In.containerType == "2") LocationType = 2;
-                }
-                else if (dt_Warehouse.WarehouseType == (int)WarehouseEnum.YMCP)
-                {
-                    LocationType = 3;
-                }
-
-                string Roadway = _locationInfoService.AccessingTunnel(dt_Warehouse.WarehouseId, LocationType);
-                if (Roadway == "") return apiResponse.Error($"WMS鏈兘鏌ヨ閬撳搴斿贩閬撶紪鍙凤紝浠撳簱缂栫爜锛歿mES_In.warehouseNo}");
-
-                //鑾峰彇瀵瑰簲PLC绔欏彴淇℃伅
-                Dt_roadwayinfo _Roadwayinfo = _roadWayinfoService.QbtainPlatform(Roadway);
-
                 Dt_Task setask = BaseDal.QueryData(x => x.PalletCode == mES_In.containerNo).FirstOrDefault();
                 if (setask != null) return apiResponse.Error($"WMS宸叉湁褰撳墠浠诲姟锛屼笉鍙噸澶嶄笅鍙戯紝鎵樼洏缂栧彿锛歿mES_In.containerNo}");
 
+                Dt_Warehouse dt_Warehouse = _warehouseService.QueryWarehouse(mES_In.warehouseNo);
+                int LocationType = 1;
+                string Roadway = "0";
 
+                string SourceAddress = mES_In.startPosition;
+                string TargetAddress = "";
+                string CurrentAddress = mES_In.startPosition;
+                string NextAddress = "";
+                int WarehouseId = 0;
+
+                if (dt_Warehouse != null)
+                {
+                    if (dt_Warehouse.WarehouseType == (int)WarehouseEnum.YMYL)
+                    {
+                        if (mES_In.containerType == "2") LocationType = 2;
+                    }
+                    else if (dt_Warehouse.WarehouseType == (int)WarehouseEnum.YMCP)
+                    {
+                        LocationType = 3;
+                    }
+                    Roadway = _locationInfoService.AccessingTunnel(dt_Warehouse.WarehouseId, LocationType);
+                    if (Roadway == "0") return apiResponse.Error($"WMS鏈兘鏌ヨ閬撳搴斿贩閬撶紪鍙凤紝浠撳簱缂栫爜锛歿mES_In.warehouseNo}");
+                    //鑾峰彇瀵瑰簲PLC绔欏彴淇℃伅
+                    Dt_roadwayinfo _Roadwayinfo = _roadWayinfoService.QbtainPlatform(Roadway);
+                    NextAddress = _Roadwayinfo.InStationCode;
+                    WarehouseId = dt_Warehouse.WarehouseId;
+                }
+                else
+                {
+                    TargetAddress = mES_In.endPosition;
+                    NextAddress = mES_In.endPosition;
+                }
                 Dt_Task task = new Dt_Task();
                 task.TaskNum = mES_In.transNo;
                 task.PalletCode = mES_In.containerNo;
@@ -74,27 +87,27 @@
                 task.Roadway = Roadway;
                 task.TaskType = (int)TaskTypeEnum.Inbound;
                 task.TaskStatus = (int)InTaskStatusEnum.InNew;
-                task.SourceAddress = mES_In.startPosition;
-                task.TargetAddress = "";
-                task.CurrentAddress = mES_In.startPosition;
-                task.NextAddress = _Roadwayinfo.InStationCode;
-                task.WarehouseId = dt_Warehouse.WarehouseId;
+                task.SourceAddress = SourceAddress;
+                task.TargetAddress = TargetAddress;
+                task.CurrentAddress = CurrentAddress;
+                task.NextAddress = NextAddress;
+                task.WarehouseId = WarehouseId;
                 task.OrderNo = mES_In.transDate.ToString();
                 task.Grade = 1;
                 task.Creater = "MES";
                 task.CreateDate = DateTime.Now;
 
-                Dt_StockInfo dt_StockInfo = new Dt_StockInfo();
+                /*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;
+                dt_StockInfo.CreateDate = DateTime.Now;*/
 
                 _unitOfWorkManage.BeginTran();
                 BaseDal.AddData(task);
-                _stockInfoService.Repository.AddData(dt_StockInfo);
+                //_stockInfoService.Repository.AddData(dt_StockInfo);
                 _unitOfWorkManage.CommitTran();
                 WriteLog.GetLog("鎺ユ敹MES鍏ュ簱浠诲姟涓嬪彂").Write($"鍙傛暟锛歿mES_In.containerNo}", $"鍏ュ簱浠诲姟娣诲姞鎴愬姛");
                 return apiResponse.OK();
@@ -300,6 +313,7 @@
                 mesInResult.ContainerNo = ContainerNo;
                 mesInResult.LocationCode = LocationCode;
                 mES_Parame = HttpHelper.Post<MES_parameter>(MES_InReporttask, mesInResult, "鍏ュ簱浠诲姟姹囨姤");
+                WriteLog.GetLog("鍏ュ簱浠诲姟鍙嶉鎺ュ彛").Write($"璁㈠崟缂栧彿锛歿TransNo}锛屾墽琛岀粨鏋滐細{Result}锛屾墽琛岀粨鏋滄弿杩帮細{ResultMsg}锛屾墭鐩樻潯鐮侊細{ContainerNo}锛屽簱浣嶇紪鍙凤細{LocationCode}锛屾帴鏀跺埌鐨勫洖鍙傦細{mesInResult.ToJson()}", $"浠诲姟涓婃姤淇℃伅");
                 return mES_Parame;
             }
             catch (Exception ex)
@@ -321,6 +335,7 @@
                 mesInResult.Result = Result;
                 mesInResult.ResultMsg = ResultMsg;
                 mES_Parame = HttpHelper.Post<MES_parameter>(MES_OutReporttask, mesInResult, "鍑哄簱浠诲姟姹囨姤");
+                WriteLog.GetLog("鍑哄簱浠诲姟鍙嶉鎺ュ彛").Write($"璁㈠崟缂栧彿锛歿TransNo}锛屾墽琛岀粨鏋滐細{Result}锛屾墽琛岀粨鏋滄弿杩帮細{ResultMsg}锛屾帴鏀跺埌鐨勫洖鍙傦細{mesInResult.ToJson()}", $"浠诲姟涓婃姤淇℃伅");
                 return mES_Parame;
             }
             catch (Exception ex)

--
Gitblit v1.9.3