From f51582d5b4b498f28513f215f91828ef181df4a1 Mon Sep 17 00:00:00 2001
From: Huangxiaoqiang-03 <1247017146@qq.com>
Date: 星期三, 06 十一月 2024 17:16:09 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs |   54 +++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 37 insertions(+), 17 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
index d6807a3..f297e69 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs"
@@ -9,11 +9,15 @@
 using WIDESEA_Model.Models;
 using WIDESEA_Core.Helper;
 using Microsoft.Extensions.Logging;
+using System.Net.Http.Headers;
+using System.Security.Policy;
+using Newtonsoft.Json;
 
 namespace WIDESEA_TaskInfoService
 {
     public partial class TaskService
     {
+        public string url = AppSettings.Configuration["WCS"];
         /// <summary>
         /// PDA鐢宠鍏ュ簱--鍫嗗灈鏈虹珛搴撳叆搴�
         /// </summary>
@@ -37,7 +41,7 @@
             {
                 return WebResponseContent.Instance.Error("鏈壘鍒拌浠诲姟绫诲瀷涓氬姟");
             }
-            return WebResponseContent.Instance.Error("閿欒");
+            return WebResponseContent.Instance.Error($"閿欒");
         }
 
         /// <summary>
@@ -57,7 +61,7 @@
             }
             catch (Exception ex)
             {
-                content = WebResponseContent.Instance.Error(ex.Message);
+                content = WebResponseContent.Instance.Error($"{ex.Message}");
             }
             return content;
         }
@@ -80,7 +84,7 @@
             }
             catch (Exception ex)
             {
-                content = WebResponseContent.Instance.Error(ex.Message);
+                content = WebResponseContent.Instance.Error($"{ex.Message}");
             }
             return content;
         }
@@ -100,14 +104,15 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
+                _unitOfWorkManage.BeginTran();
                 Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(stationCode, taskType);
-                //Dt_LocationInfo dt_LocationInfo = null;
                 if (locationInfo != null)
                 {
+                    List<Dt_Task> tasks = new List<Dt_Task>();
                     Dt_Task task = new()
                     {
                         CurrentAddress = stationCode,
-                        Grade = 0,
+                        Grade = 2,
                         PalletCode = palletCode,
                         NextAddress = locationInfo.LocationCode,
                         Roadway = locationInfo.RoadwayNo,
@@ -115,16 +120,18 @@
                         TargetAddress = locationInfo.LocationCode,
                         TaskStatus = InTaskStatusEnum.InNew.ObjToInt(),
                         TaskType = taskType,
+                        Depth= locationInfo.Depth,
                     };
                     BaseDal.AddData(task);
                     int beforeStatus = locationInfo.LocationStatus;
 
-
-                    
                     if (isUpdateStock)
                     {
                         locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                        _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
+                        if (locationInfo.Depth == 2)
+                        {
+                            _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
+                        }
 
                         if (stockInfo != null && stockInfo.Details != null && stockInfo.Details.Count > 0)
                         {
@@ -141,17 +148,30 @@
                     else
                     {
                         locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt();
-                        _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
+                        if (locationInfo.Depth == 2)
+                        {
+                            _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
+                        }
                     }
                     _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
+                     
+                    tasks.Add(task);
                     _recordService.LocationStatusChangeRecordSetvice.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), orderNo, task.TaskNum);
 
+                    var response = HttpHelper.Post<WebResponseContent>(url + "ReceiveTask/", tasks, "鍏ュ簱浠诲姟涓嬪彂");
+                    if (!response.Status)
+                    {
+                        _unitOfWorkManage.RollbackTran();
+                        return content = WebResponseContent.Instance.Error($"{response.Message}");
+                    }
+                    _unitOfWorkManage.CommitTran();
                     return content = WebResponseContent.Instance.OK();
                 }
                 return content = WebResponseContent.Instance.Error("鏈壘鍒板彲鍒嗛厤璐т綅");
             }
             catch (Exception ex)
             {
+                _unitOfWorkManage.RollbackTran();
                 content = WebResponseContent.Instance.Error(ex.Message);
             }
             return content;
@@ -169,40 +189,40 @@
         {
             if (BaseDal.QueryFirst(x => x.PalletCode == palletCode) != null)
             {
-                return (false, "璇ユ墭鐩樺彿宸叉湁浠诲姟");
+                return (false, "璇ユ墭鐩樺彿宸叉湁浠诲姟!");
             }
             if (BaseDal.QueryFirst(x => (x.SourceAddress == stationCode || x.CurrentAddress == stationCode) && x.TaskStatus == InTaskStatusEnum.InNew.ObjToInt()) != null)
             {
-                return (false, "褰撳墠鍏ュ簱绔欏彴宸叉湁涓�鏉℃柊寤轰换鍔�");
+                return (false, "褰撳墠鍏ュ簱绔欏彴宸叉湁涓�鏉℃柊寤轰换鍔�!");
             }
             if (isCheckStock)
             {
                 if (stockInfo == null)
                 {
-                    return (false, "鏈壘鍒扮粍鐩樹俊鎭�");
+                    return (false, "鏈壘鍒扮粍鐩樹俊鎭�!");
                 }
                 if (stockInfo.StockStatus != StockStatusEmun.缁勭洏鏆傚瓨.ObjToInt())
                 {
-                    return (false, "璇ョ粍鐩樼姸鎬佷笉鍙叆搴�");
+                    return (false, "璇ョ粍鐩樼姸鎬佷笉鍙叆搴�!");
                 }
                 if (!string.IsNullOrEmpty(stockInfo.LocationCode))
                 {
-                    return (false, "璇ユ墭鐩樺凡缁戝畾璐т綅");
+                    return (false, "璇ユ墭鐩樺凡缁戝畾璐т綅!");
                 }
                 if (stockInfo.Details == null || stockInfo.Details.Count == 0)
                 {
-                    return (false, "娌℃湁搴撳瓨鏄庣粏淇℃伅");
+                    return (false, "娌℃湁搴撳瓨鏄庣粏淇℃伅!");
                 }
             }
             else
             {
                 if (_stockService.StockInfoService.Repository.QueryFirst(x => x.PalletCode == palletCode) != null)
                 {
-                    return (false, "璇ユ墭鐩樺凡瀛樺湪搴撳唴");
+                    return (false, "璇ユ墭鐩樺凡瀛樺湪搴撳唴!");
                 }
             }
 
-            return (true, "鎴愬姛");
+            return (true, "鎴愬姛!");
         }
 
 

--
Gitblit v1.9.3