From 19e5b7583a2aa1968c674b4b35f618cc6c2e29ef Mon Sep 17 00:00:00 2001
From: huanghongfeng <huanghongfeng@hnkhzn.com>
Date: 星期一, 09 十二月 2024 14:16:30 +0800
Subject: [PATCH] 新增历史信息,页面排序,生产时间

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   68 +++++++++++++++++++--------------
 1 files changed, 39 insertions(+), 29 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
index 3093bdf..5e8fb03 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs"
@@ -49,6 +49,7 @@
 using WIDESEA_ITaskInfoService;
 using WIDESEA_Model.Models;
 using WIDESEA_TaskInfoRepository;
+using static WIDESEA_ITaskInfoService.ITaskService;
 
 namespace WIDESEA_TaskInfoService
 {
@@ -125,35 +126,34 @@
             Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(task.PalletCode);
             //鏌ヨ揣浣�
             Dt_LocationInfo locationInfo = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == task.TargetAddress);
-
+            Dt_StockInfoDetail dt_StockInfodetail = _stockService.StockInfoDetailService.Repository.QueryFirst(x => x.StockId == stockInfo.Id);
             CheckCompleted(stockInfo, locationInfo);
 
+            if (stockInfo.MaterialType == (int)InventoryMaterialType.绌烘墭)
+            {
+                string currentTime = DateTime.Now.ToString("HHmmss");
+                stockInfo.PalletCode = "KTP" + currentTime;
+            }
+            stockInfo.LocationCode = task.TargetAddress;
             stockInfo.StockStatus = StockStatusEmun.宸插叆搴�.ObjToInt();
              _stockService.StockInfoService.Repository.UpdateData(stockInfo);
-            if (_stockService.StockInfoService.Repository.UpdateData(stockInfo))
-            {
-                string[] Pallet = stockInfo.PalletCode.Split("-");
-                Dt_StockInfoDetail dt_StockInfoDetail = new()
-                {
-                    StockId = stockInfo.Id,
-                    MaterielCode = Pallet[0],    //鐗╂枡缂栧彿
-                    MaterielName = Pallet[1],    //鏉愯川
-                    OrderNo = stockInfo.PalletCode,        //鍗曟嵁锛堟墭鐩樻潯鐮侊級
-                    BatchNo = Pallet[2],         //鎵规鍙�
-                    SerialNumber = Pallet[2],    //搴忓垪鍙�
-                    StockQuantity = decimal.Parse(Pallet[3]),    //搴忓垪鍙�
-                    OutboundQuantity = decimal.Parse(Pallet[3]),    //搴忓垪鍙�
-                    Status = (int)StockStatusEmun.宸插叆搴�,
-                    Creater = "WMS",
-                    CreateDate = DateTime.Now,
-                };
-                _stockService.StockInfoDetailService.AddData(dt_StockInfoDetail);
-            }
 
+            if(dt_StockInfodetail != null)
+            {
+                dt_StockInfodetail.Status = StockStatusEmun.宸插叆搴�.ObjToInt();
+                _stockService.StockInfoDetailService.Repository.UpdateData(dt_StockInfodetail);
+            }
             beforeQuantity = stockInfo.Details.Where(x => x.Id != 0).Sum(x => x.StockQuantity);
 
             int beforeStatus = locationInfo.LocationStatus;
-            locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+            if (stockInfo.MaterialType == (int)InventoryMaterialType.绌烘墭)
+            {
+                locationInfo.LocationStatus = LocationStatusEnum.Pallet.ObjToInt();
+            }
+            else
+            {
+                locationInfo.LocationStatus = LocationStatusEnum.InStock.ObjToInt();
+            }
             _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Inbound.ObjToInt(), false);
 
             _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
@@ -239,22 +239,30 @@
             stockInfo.StockStatus = StockStatusEmun.鍑哄簱瀹屾垚.ObjToInt();
             _stockService.StockInfoService.Repository.UpdateData(stockInfo);
             int beforeStatus = locationInfo.LocationStatus;
-            if (task.Depth == 1)
+            /*if (task.Depth == 1)
             {
-                if (DepthTask(task)) { }
+                *//*if (DepthTask(task)) 
+                {
+                }
                 else
                 {
                     locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
                     _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
                     _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
-                }
+                }*//*
+                locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+                _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
+                _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
             }
             else
             {
                 locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
                 _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
                 _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
-            }
+            }*/
+            locationInfo.LocationStatus = LocationStatusEnum.Free.ObjToInt();
+            _basicService.LocationInfoService.UpdateLocationFree(locationInfo, task.TaskNum, StockChangeType.Outbound.ObjToInt(), false);
+            _basicService.LocationInfoService.Repository.UpdateData(locationInfo);
 
             task.TaskStatus = OutTaskStatusEnum.OutFinish.ObjToInt();
             BaseDal.DeleteAndMoveIntoHty(task, App.User.UserId == 0 ? OperateType.鑷姩瀹屾垚 : OperateType.浜哄伐瀹屾垚);
@@ -297,12 +305,12 @@
             return WebResponseContent.Instance.OK();
         }
 
-        public WebResponseContent RelocationTaskCompleted(string PalletCode,string SourceAddress, string TargetAddress)
+        public WebResponseContent RelocationTaskCompleted(GenerateInv2 generate)
         {
-            Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(PalletCode);
+            Dt_StockInfo stockInfo = _stockService.StockInfoService.Repository.GetStockInfo(generate.PalletCode);
 
-            Dt_LocationInfo locationpoint = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == SourceAddress);
-            Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == TargetAddress);
+            Dt_LocationInfo locationpoint = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == generate.SourceAddress);
+            Dt_LocationInfo locationEnd = _basicService.LocationInfoService.Repository.QueryFirst(x => x.LocationCode == generate.TargetAddress);
             List<Dt_LocationInfo> loca = new List<Dt_LocationInfo>();
 
             stockInfo.LocationCode = locationEnd.LocationCode;
@@ -340,5 +348,7 @@
             }
             return false;
         }
+
+        
     }   
 }

--
Gitblit v1.9.3