pan
2025-11-19 c84db706e8c8d82a96bb4b4c18c243a42b2976c1
ÏîÄ¿´úÂë/WMSÎÞ²Ö´¢°æ/WIDESEA_WMSServer/WIDESEA_OutboundService/OutStockLockInfoService.cs
@@ -1,4 +1,5 @@
using System;
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,6 +11,7 @@
using WIDESEA_Core.BaseServices;
using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
using WIDESEA_DTO.Outbound;
using WIDESEA_IRecordService;
using WIDESEA_IStockService;
using WIDESEA_Model.Models;
@@ -32,9 +34,9 @@
            _recordService = recordService;
        }
        /// <summary>
        /// åˆ›å»ºå‡ºåº“锁定信息 - ä¿®å¤ç‰ˆæœ¬
        /// åˆ›å»ºå‡ºåº“锁定
        /// </summary>
        public Dt_OutStockLockInfo GetOutStockLockInfo(
            Dt_OutboundOrder outboundOrder,
@@ -70,7 +72,7 @@
                // ä½¿ç”¨ç¬¬ä¸€ä¸ªå¯ç”¨æ¡ç 
                var firstAvailableDetail = stockDetails
                    .Where(x => x.StockQuantity > x.OutboundQuantity)
                    .OrderBy(x => x.ProductionDate)
                    .OrderBy(x => x.CreateDate)
                    .FirstOrDefault();
                if (firstAvailableDetail == null)
@@ -82,6 +84,8 @@
            return new Dt_OutStockLockInfo()
            {
                lineNo= outboundOrderDetail.lineNo,
                PalletCode = outStock.PalletCode,
                AssignQuantity = assignQuantity,
                MaterielCode = outboundOrderDetail.MaterielCode,
@@ -97,8 +101,9 @@
                Status = (int)OutLockStockStatusEnum.已分配,
                StockId = outStock.Id,
                Unit = outboundOrderDetail.Unit,
                SupplyCode     = outboundOrderDetail.SupplyCode,
                FactoryArea = outboundOrder.FactoryArea,
                OrderType=outboundOrder.OrderType,
                SupplyCode = outboundOrderDetail.SupplyCode,
                WarehouseCode = outboundOrderDetail.WarehouseCode,
                // æ–°å¢žå­—段
                CurrentBarcode = targetBarcode,
@@ -115,6 +120,37 @@
                .Where(x => x.OrderDetailId == orderDetailId)
                .OrderBy(x => x.Id)
                .ToListAsync();
        }
        public async Task<LockInfoDetailDto> GetLockInfoDetail(int lockInfoId)
        {
            var lockInfo = await Db.Queryable<Dt_OutStockLockInfo>()
                .LeftJoin<Dt_OutboundOrderDetail>((lockInfo, detail) => lockInfo.OrderDetailId == detail.Id)
                .Where((lockInfo, detail) => lockInfo.Id == lockInfoId)
                .Select((lockInfo, detail) => new LockInfoDetailDto
                {
                    Id = lockInfo.Id,
                    OrderNo = lockInfo.OrderNo,
                    OrderDetailId = lockInfo.OrderDetailId,
                    BatchNo = lockInfo.BatchNo,
                    MaterielCode = lockInfo.MaterielCode,
                    StockId = lockInfo.StockId,
                    OrderQuantity = lockInfo.OrderQuantity,
                    OriginalQuantity = lockInfo.OriginalQuantity,
                    AssignQuantity = lockInfo.AssignQuantity,
                    PickedQty = lockInfo.PickedQty,
                    LocationCode = lockInfo.LocationCode,
                    PalletCode = lockInfo.PalletCode,
                    Status = lockInfo.Status,
                    IsSplitted = lockInfo.IsSplitted,
                    ParentLockId = lockInfo.ParentLockId,
                    MaterielName = detail.MaterielName,
                    Unit = detail.Unit
                })
                .FirstAsync();
            return lockInfo;
        }
        /// <summary>
@@ -181,7 +217,10 @@
            }
        }
        public List<Dt_OutStockLockInfo> GetByOrderDetailId(int orderDetailId, OutLockStockStatusEnum? outStockStatus)
        {
            return BaseDal.QueryData(x => x.OrderDetailId == orderDetailId && outStockStatus == null ? true : x.Status == outStockStatus.ObjToInt());
        }
    }
}