From 89051aef8a2c1a85d457914cf6317fe70e0e321c Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期日, 29 十二月 2024 04:33:10 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs |   36 +++++++++++++++---------------------
 1 files changed, 15 insertions(+), 21 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
index ddda47e..562fae5 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/MesTaskService.cs"
@@ -26,7 +26,7 @@
 
 namespace WIDESEA_TaskInfoService
 {
-    public partial class TaskService 
+    public partial class TaskService
     {
         /// <summary>
         /// 娴嬭瘯鏋跺嚭浠�
@@ -38,12 +38,12 @@
             MesResponseContent responseContent = new MesResponseContent();
             try
             {
-                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x=>x.WarehouseCode==WarehouseEnum.HA64.ToString());
+                Dt_Warehouse warehouse = _basicRepository.WarehouseRepository.QueryFirst(x => x.WarehouseCode == WarehouseEnum.HA64.ToString());
                 //鑾峰彇搴撳瓨璁板綍
-                List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => 
-                  x.WarehouseId == warehouse.WarehouseId && 
-                  x.StockStatus==(int)StockStatusEmun.鍏ュ簱瀹屾垚).Includes(x=>x.Details).ToList();
-                Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x=>x.Details.Any(x=>x.BatchNo==model.ToolCode));
+                List<Dt_StockInfo> stockInfos = _stockRepository.StockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x =>
+                  x.WarehouseId == warehouse.WarehouseId &&
+                  x.StockStatus == (int)StockStatusEmun.鍏ュ簱瀹屾垚).Includes(x => x.Details).ToList();
+                Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == model.ToolCode));
                 if (stockInfo == null)
                 {
                     return responseContent.Error($"娴嬭瘯鏋�:{model.ToolCode}鏃犲彲鐢ㄥ簱瀛�");
@@ -52,7 +52,7 @@
                   x.WarehouseId == stockInfo.WarehouseId &&
                   x.LocationStatus == (int)LocationStatusEnum.InStock &&
                   (x.EnableStatus == (int)EnableStatusEnum.Normal || x.EnableStatus == (int)EnableStatusEnum.OnlyOut));
-                if (locationInfo==null)
+                if (locationInfo == null)
                 {
                     return responseContent.Error($"娴嬭瘯鏋惰揣浣�:{stockInfo.LocationCode}鍑哄簱鏉′欢涓嶆弧瓒�");
                 }
@@ -75,12 +75,6 @@
                 stockInfo.StockStatus = (int)StockStatusEmun.鍑哄簱閿佸畾;
                 LocationStatusEnum locationStatus = (LocationStatusEnum)locationInfo.LocationStatus;
                 locationInfo.LocationStatus = (int)LocationStatusEnum.Lock;
-                //灏嗕换鍔℃帹閫佸埌WCS
-                WebResponseContent content = PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV");
-                if (!content.Status)
-                {
-                    return responseContent.Error();
-                }
                 //鍒ゆ柇鏄惁鏈夊嚭搴撳崟淇℃伅
                 _unitOfWorkManage.BeginTran();
                 //鏇存柊搴撳瓨鐘舵��
@@ -91,9 +85,9 @@
                 BaseDal.AddData(taskOut);
                 //鍔犲叆璐т綅鍙樺姩璁板綍
                 _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, locationStatus, LocationChangeType.OutboundAssignLocation, stockInfo.Details.FirstOrDefault()?.OrderNo ?? "", taskOut.TaskNum);
-                //鍔犲叆搴撳瓨鍙樺姩璁板綍
-                //_recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfoDetails, beforeQuantity, totalQuantity, StockChangeTypeEnum.StockLock);
                 _unitOfWorkManage.CommitTran();
+                //灏嗕换鍔℃帹閫佸埌WCS
+                WebResponseContent content = PushTasksToWCS(new List<Dt_Task>() { taskOut }, "AGV");
                 responseContent.OK();
             }
             catch (Exception ex)
@@ -119,7 +113,7 @@
                   x.WarehouseId == warehouse.WarehouseId &&
                   x.StockStatus == (int)StockStatusEmun.鍑哄簱瀹屾垚).Includes(x => x.Details).ToList();
                 Dt_StockInfo? stockInfo = stockInfos.FirstOrDefault(x => x.Details.Any(x => x.BatchNo == backModel.TestToolCode));
-                if (stockInfo==null)
+                if (stockInfo == null)
                 {
                     return responseContent.Error($"{backModel.TestToolCode}搴撳瓨淇℃伅涓嶅瓨鍦�");
                 }
@@ -140,7 +134,7 @@
                     WarehouseId = stockInfo.WarehouseId,
                 };
                 //鏇存敼搴撳瓨鐘舵��
-                stockInfo.StockStatus = StockStatusEmun.鍏ュ簱纭.ObjToInt();
+                stockInfo.StockStatus = StockStatusEmun.閫�搴�.ObjToInt();
                 BaseDal.AddData(taskIn);
                 _stockRepository.StockInfoRepository.UpdateData(stockInfo);
                 //灏嗕换鍔℃帹閫佸埌WCS
@@ -204,15 +198,15 @@
         /// <returns></returns>
         public WebResponseContent TestSynStock(TestToolSynInfo toolSynInfo)
         {
-            WebResponseContent content= new WebResponseContent();
+            WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x=>x.ApiCode==APIEnum.WMS_MES_TestToolSync.ToString());
+                Dt_ApiInfo apiInfo = _apiInfoRepository.QueryFirst(x => x.ApiCode == APIEnum.WMS_MES_TestToolSync.ToString());
                 MESRoot<TestToolSynInfo> root = new MESRoot<TestToolSynInfo>()
                 {
                     From = "WMS",
                     DateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
-                    Content=toolSynInfo
+                    Content = toolSynInfo
                 };
                 JsonSerializerSettings settings = new JsonSerializerSettings
                 {
@@ -222,7 +216,7 @@
                 string response = HttpMesHelper.Post(apiInfo.ApiAddress, request);
                 MesResponseContent mesResponseContent = response.DeserializeObject<MesResponseContent>();
                 //璋冪敤鎺ュ彛
-                if (mesResponseContent.BSucc==true)
+                if (mesResponseContent.BSucc == true)
                 {
                     content.OK(mesResponseContent.StrMsg);
                 }

--
Gitblit v1.9.3