From 6e9f630e4e12738d98241b684e6227e02010b6c5 Mon Sep 17 00:00:00 2001
From: Huangxiaoqiang-03 <1247017146@qq.com>
Date: 星期五, 01 十一月 2024 17:30:30 +0800
Subject: [PATCH] 1

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/PartialTaskService_Inbound.cs |   28 +++++++++++++++++++++++-----
 1 files changed, 23 insertions(+), 5 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 7f4f0ee..9cf7970 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>
@@ -100,6 +104,7 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
+                _unitOfWorkManage.BeginTran();
                 Dt_LocationInfo? locationInfo = _basicService.LocationInfoService.AssignLocation(stationCode, taskType);
                 //Dt_LocationInfo dt_LocationInfo = null;
                 if (locationInfo != null)
@@ -107,7 +112,7 @@
                     Dt_Task task = new()
                     {
                         CurrentAddress = stationCode,
-                        Grade = 0,
+                        Grade = 2,
                         PalletCode = palletCode,
                         NextAddress = locationInfo.LocationCode,
                         Roadway = locationInfo.RoadwayNo,
@@ -119,11 +124,12 @@
                     BaseDal.AddData(task);
                     int beforeStatus = locationInfo.LocationStatus;
 
-                    locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt();
+
+                    
                     if (isUpdateStock)
                     {
                         locationInfo.LocationStatus = LocationStatusEnum.Lock.ObjToInt();
-                        _basicService.LocationInfoService.UpdateLocationLock(locationInfo,task.TaskNum);
+                        _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
 
                         if (stockInfo != null && stockInfo.Details != null && stockInfo.Details.Count > 0)
                         {
@@ -137,16 +143,28 @@
                             return content = WebResponseContent.Instance.Error("鏈壘鍒板簱瀛樹俊鎭�");
                         }
                     }
+                    else
+                    {
+                        locationInfo.LocationStatus = LocationStatusEnum.PalletLock.ObjToInt();
+                        _basicService.LocationInfoService.UpdateLocationLock(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
+                    }
                     _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
-                    //_basicService.LocationInfoService.Repository.UpdateData(dt_LocationInfo);
+                    List<Dt_Task> tasks = new List<Dt_Task>(); 
+                    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)
+                    {
+                        return content = WebResponseContent.Instance.Error("浠诲姟涓嬪彂寮傚父"); 
+                    }
+                    _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;

--
Gitblit v1.9.3