From 51bd4ac4f323fab99ff9ac20763ca15af0e53a57 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期四, 22 一月 2026 21:51:15 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs |   35 +++++++++++++++++++++++++++--------
 1 files changed, 27 insertions(+), 8 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs"
index 138206c..ded4b28 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_InboundService/TakeStockOrderService.cs"
@@ -30,6 +30,7 @@
 using WIDESEA_DTO.CalcOut;
 using Newtonsoft.Json.Serialization;
 using Newtonsoft.Json;
+using WIDESEA_DTO.Basic;
 
 namespace WIDESEA_InboundService
 {
@@ -50,7 +51,8 @@
         private readonly IRepository<Dt_StockInfoDetail> _stockInfoDetailRepository;
         private readonly IOutboundService _outboundService;
         private readonly IFeedbackMesService _feedbackMesService;
-        public TakeStockOrderService(IRepository<Dt_TakeStockOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfo> stockInfoRepository,IRepository<Dt_TakeStockOrderDetail> takeStockOrderDetail,IRepository<Dt_Task> taskRepository,ILocationInfoService locationInfoService, IRepository<Dt_InboundOrder> inboundOrderRepository,IRepository<Dt_OutboundOrder> outboundOrderRepository,IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, IOutboundPickingService outboundPickingService, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IOutboundService outboundService,IFeedbackMesService feedbackMesService) : base(BaseDal)
+        private readonly IESSApiService _eSSApiService;
+        public TakeStockOrderService(IRepository<Dt_TakeStockOrder> BaseDal, IUnitOfWorkManage unitOfWorkManage,IRepository<Dt_TakeStockOrder> takeStockOrder,IRepository<Dt_StockInfo> stockInfoRepository,IRepository<Dt_TakeStockOrderDetail> takeStockOrderDetail,IRepository<Dt_Task> taskRepository,ILocationInfoService locationInfoService, IRepository<Dt_InboundOrder> inboundOrderRepository,IRepository<Dt_OutboundOrder> outboundOrderRepository,IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository, IOutboundPickingService outboundPickingService, IRepository<Dt_StockInfoDetail> stockInfoDetailRepository, IOutboundService outboundService,IFeedbackMesService feedbackMesService,IESSApiService eSSApiService) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _takeStockOrder = takeStockOrder;
@@ -66,8 +68,20 @@
             _stockInfoDetailRepository = stockInfoDetailRepository;
             _outboundService = outboundService;
             _feedbackMesService = feedbackMesService;
+            _eSSApiService = eSSApiService;
         }
 
+        private Dictionary<string, string> stations = new Dictionary<string, string>
+        {
+            {"2-1","2-9" },
+            {"3-1","3-9" },
+        };
+
+        private Dictionary<string, string> movestations = new Dictionary<string, string>
+        {
+            {"2-1","2-5" },
+            {"3-1","3-5" },
+        };
         public WebResponseContent ValidateBoxNo(string orderNo, string boxNo)
         {
             try
@@ -210,7 +224,7 @@
                 {
                     return content.Error("鏈壘鍒拌鐩樼偣鍗曟嵁");
                 }
-                var stock = _stockInfoRepository.QueryFirst(x => x.PalletCode == boxNo);
+                var stock = _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Where(x => x.PalletCode == boxNo).Includes(x=>x.Details).First();
 
                 if (stock == null)
                 {
@@ -253,24 +267,29 @@
                     NextAddress = "",
                     OrderNo = takeStockOrder.OrderNo,
                     Roadway = newLocation.RoadwayNo,
-                    SourceAddress = sourceAddress,
+                    SourceAddress = stations.GetValueOrDefault(sourceAddress)??"",
                     TargetAddress = newLocation.LocationCode,
                     TaskStatus = (int)TaskStatusEnum.New,
                     TaskType = TaskTypeEnum.InInventory.ObjToInt(),
                     PalletType = stock.PalletType,
                     WarehouseId = stock.WarehouseId
                 };
+                if (stock.Details.Count <= 0)
+                {
+                    stock.PalletType = (int)PalletTypeEnum.Empty;
+                    newTask.TaskType = TaskTypeEnum.InEmpty.ObjToInt();
+                }
                 _unitOfWorkManage.BeginTran();
                 _stockInfoRepository.UpdateData(stock);
                 _takeStockOrder.UpdateData(takeStockOrder);
                 _taskRepository.AddData(newTask);
                 _unitOfWorkManage.CommitTran();
 
-                //var moveResult = await _eSSApiService.MoveContainerAsync(new MoveContainerRequest
-                //{
-                //    slotCode = movestations[station],
-                //    containerCode = palletCode
-                //});
+                var moveResult = _eSSApiService.MoveContainerAsync(new MoveContainerRequest
+                {
+                    slotCode = movestations[sourceAddress],
+                    containerCode = boxNo
+                });
                 return content.OK();
 
             }

--
Gitblit v1.9.3