From 070b9f3ea747fc763f999e4cc6b86b202f48a237 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期四, 12 三月 2026 18:07:51 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs |   75 +++++++++++++++++++++++++++++++++----
 1 files changed, 67 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/InboundOrderService.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/InboundOrderService.cs"
index 3416506..b099aa3 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/InboundOrderService.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/InboundOrderService.cs"
@@ -7,6 +7,7 @@
 using WIDESEA_Common.LocationEnum;
 using WIDESEA_Common.OrderEnum;
 using WIDESEA_Common.StockEnum;
+using WIDESEA_Common.TaskEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
@@ -49,9 +50,10 @@
         private readonly IBasicService _basicService;
         private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
         private readonly IRepository<Dt_OutboundOrder> _outboundOrderRepository;
+        private readonly IRepository<Dt_OutboundOrderDetail> _outboundOrderDetailRepository;
         public IRepository<Dt_InboundOrder> Repository => BaseDal;
 
-        public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_StockInfo> stockRepository, IRepository<Dt_LocationType> locationTypeRepository, IMaterielInfoService materielInfoService, IBasicService basicService, IRepository<Dt_LocationInfo> locationInfoRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_OutboundOrder> outboundOrderRepository) : base(BaseDal)
+        public InboundOrderService(IRepository<Dt_InboundOrder> BaseDal, IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_InboundOrderDetail> inboundOrderDetailRepository, IRepository<Dt_Task> taskRepository, IStockService stockService, IInboundOrderDetailService inboundOrderDetailService, IMaterialUnitService materialUnitService, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_InboundOrder> inboundOrderRepository, IRepository<Dt_WarehouseArea> warehouseAreaRepository, IRepository<Dt_StockInfo> stockRepository, IRepository<Dt_LocationType> locationTypeRepository, IMaterielInfoService materielInfoService, IBasicService basicService, IRepository<Dt_LocationInfo> locationInfoRepository, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_OutboundOrder> outboundOrderRepository, IRepository<Dt_OutboundOrderDetail> outboundOrderDetailRepository) : base(BaseDal)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
@@ -70,6 +72,7 @@
             _locationInfoRepository = locationInfoRepository;
             _allocateOrderRepository = allocateOrderRepository;
             _outboundOrderRepository = outboundOrderRepository;
+            _outboundOrderDetailRepository = outboundOrderDetailRepository;
         }
 
         public async Task<WebResponseContent> ReceiveInboundOrder(List<Dt_InboundOrder> models, int operateType)
@@ -717,6 +720,11 @@
                 {
                     // 璇嗗埆涓烘墭鐩樺彿
                     palletCode = code;
+                    var task =_taskRepository.Db.Queryable<Dt_Task>().Where(t => t.PalletCode == palletCode).ToList();
+                    if(task!=null && task.Any())
+                    {
+                        return WebResponseContent.Instance.Error($"鎵樼洏鍙� {palletCode} 瀛樺湪鏈畬鎴愮殑浠诲姟锛屾棤娉曟挙閿�");
+                    }
                 }
                 else
                 {
@@ -910,6 +918,15 @@
                         {
                             sugarQueryable1 = sugarQueryable1.Where(x => x.OrderType.Equals(searchParameters.Value.ToString()));
                         }
+
+                        var detailMaterielCode = searchParametersList.FirstOrDefault(x => x.Name == "materielCode");
+                        if(detailMaterielCode!=null && !string.IsNullOrEmpty(detailMaterielCode.Value?.ToString()))
+                        {
+                            string materielCode = detailMaterielCode.Value.ToString().Trim();
+                            sugarQueryable1 = sugarQueryable1.Where(x => x.Details.Any(d => d.MaterielCode.Contains(materielCode)));
+
+                        }
+
                         //var dataList = sugarQueryable1.ToPageList(options.Page, options.Rows, ref totalCount);
                         //return new PageGridData<Dt_InboundOrder>(totalCount, dataList);
                     }
@@ -972,6 +989,18 @@
             return content.OK(data: details);
         }
 
+        public WebResponseContent GetLocationType(string code)
+        {
+           var warehouseAreaName = _warehouseAreaRepository.QueryFirst(x => x.Code == code);
+            if(string.IsNullOrWhiteSpace(warehouseAreaName.ToString()))
+            {
+                return WebResponseContent.Instance.Error("鏈壘鍒颁粨搴撳悕绉�");
+            }
+            var locationTypeDesc = _locationTypeRepository.Db.Queryable<Dt_LocationType>().Where(x => string.Equals(x.LocationTypeDesc, warehouseAreaName.Name, StringComparison.OrdinalIgnoreCase)).First();
+
+            return WebResponseContent.Instance.OK(data:locationTypeDesc.LocationType);
+        }
+
         public WebResponseContent HandCloseOrder(List<string> orderNos)
         {
             try
@@ -980,11 +1009,7 @@
                 {
                     var inbound = _inboundOrderRepository.QueryFirst(x => x.InboundOrderNo == orderNo);
                     var outbound = _outboundOrderRepository.QueryFirst(x=>x.OrderNo == orderNo);
-                    if(inbound == null && outbound == null)
-                    {
-                        return WebResponseContent.Instance.Error($"璇ュ崟鎹笉瀛樺湪锛屾棤娉曡繘琛屽叧闂�");
-                    }
-
+                    
                     if (inbound != null)
                     {
                         if (inbound.OrderStatus != (int)InOrderStatusEnum.鏈紑濮� && inbound.OrderStatus != (int)InOrderStatusEnum.鍏ュ簱涓�)
@@ -994,15 +1019,49 @@
                         inbound.OrderStatus = (int)InOrderStatusEnum.鎵嬪姩鍏抽棴;
                         inbound.Operator = App.User.UserName;
                         _inboundOrderRepository.UpdateData(inbound);
-                    }else if (outbound != null)
+
+                        var inboundItems = _inboundOrderDetailRepository.QueryData(x => x.OrderId == inbound.Id);
+                        if(inboundItems.FirstOrDefault().OrderDetailStatus == (int)OrderDetailStatusEnum.New)
+                        {
+                            foreach (var item in inboundItems)
+                            {
+                                item.OrderDetailStatus = (int)InOrderStatusEnum.鎵嬪姩鍏抽棴;
+                                item.Modifier = App.User.UserName;
+                                BaseDal.Db.Updateable<Dt_InboundOrderDetail>(item).ExecuteCommand();
+                            }
+                        }
+                    }
+                    else if (outbound != null)
                     {
-                        if(outbound.OrderStatus !=(int)OutOrderStatusEnum.鏈紑濮� && outbound.OrderStatus != (int)OutOrderStatusEnum.鍑哄簱涓�)
+                        if(outbound.OrderStatus ==(int)OutOrderStatusEnum.鍑哄簱瀹屾垚)
                         {
                             return WebResponseContent.Instance.Error($"璇ュ崟鎹姸鎬佷笉鍙互鍏抽棴");
+                        }
+                        if(outbound.OrderStatus == (int)OutOrderStatusEnum.鍑哄簱涓�)
+                        {
+                           var outboundDetails = _outboundOrderDetailRepository.QueryData(x => x.OrderId == outbound.Id);
+                            if (outboundDetails == null)
+                            {
+                                return WebResponseContent.Instance.Error("璇ュ崟鎹姸鎬佷笉鑳藉叧闂�");
+                            }
+                            var detailStatus = outboundDetails.All(x => x.LockQuantity == x.OverOutQuantity);
+                            if (!detailStatus)
+                            {
+                                return WebResponseContent.Instance.Error("璇ュ崟鎹湁姝e湪鍑哄簱鐨勭墿鏂欙紝涓嶈兘鍏抽棴");
+                            }
                         }
                         outbound.OrderStatus = (int)OutOrderStatusEnum.鍏抽棴;
                         outbound.Operator = App.User.UserName;
                         _outboundOrderRepository.UpdateData(outbound);
+
+                        var outboundItems = BaseDal.Db.Queryable<Dt_OutboundOrderDetail>().Where(x => x.OrderId == outbound.Id).ToList();
+                        if(outboundItems.FirstOrDefault().OrderDetailStatus == (int)OrderDetailStatusEnum.New)
+                        foreach(var item in outboundItems)
+                        {
+                            item.OrderDetailStatus = (int)OutOrderStatusEnum.鍏抽棴;
+                            item.Modifier = App.User.UserName;
+                            BaseDal.Db.Updateable<Dt_OutboundOrderDetail>(item).ExecuteCommand();
+                        }
                     }
                     
                 }

--
Gitblit v1.9.3