1
heshaofeng
2026-03-12 070b9f3ea747fc763f999e4cc6b86b202f48a237
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs
@@ -50,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;
@@ -71,6 +72,7 @@
            _locationInfoRepository = locationInfoRepository;
            _allocateOrderRepository = allocateOrderRepository;
            _outboundOrderRepository = outboundOrderRepository;
            _outboundOrderDetailRepository = outboundOrderDetailRepository;
        }
        public async Task<WebResponseContent> ReceiveInboundOrder(List<Dt_InboundOrder> models, int operateType)
@@ -1031,10 +1033,23 @@
                    }
                    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("该单据有正在出库的物料,不能关闭");
                            }
                        }
                        outbound.OrderStatus = (int)OutOrderStatusEnum.关闭;
                        outbound.Operator = App.User.UserName;
                        _outboundOrderRepository.UpdateData(outbound);