using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using WIDESEA_Common.StockEnum; using WIDESEA_Core; using WIDESEA_Core.BaseRepository; using WIDESEA_Core.BaseServices; using WIDESEA_Core.Enums; using WIDESEA_Core.Helper; using WIDESEA_IOutboundRepository; using WIDESEA_IRecordService; using WIDESEA_IStockService; using WIDESEA_Model.Models; namespace WIDESEA_IOutboundService { public partial class OutStockLockInfoService : ServiceBase, IOutStockLockInfoService { private readonly IStockService _stockService; private readonly IRecordService _recordService; public IOutStockLockInfoRepository Repository => BaseDal; public IUnitOfWorkManage _unitOfWorkManage; public OutStockLockInfoService(IOutStockLockInfoRepository BaseDal, IStockService stockService, IRecordService recordService, IUnitOfWorkManage unitOfWorkManage) : base(BaseDal) { _recordService = recordService; _stockService = stockService; _unitOfWorkManage = unitOfWorkManage; } public List GetByOrderDetailId(string orderNo, int orderDetailId, OutLockStockStatusEnum? outStockStatus) { return BaseDal.QueryData(x =>x.OrderNo== orderNo && x.OrderDetailId == orderDetailId && outStockStatus == null ? true : x.Status == outStockStatus.ObjToInt()); } /// /// 生成出库详情 /// public Dt_OutStockLockInfo GetOutStockLockInfo(Dt_OutBSTOrder outBSTOrder, Dt_OutBSTOrderDetail outboundOrderDetail, Dt_StockInfo outStock, decimal assignQuantity, int? taskNum = null) { Dt_OutStockLockInfo outStockLockInfo = new Dt_OutStockLockInfo() { PalletCode = outStock.PalletCode, AssignQuantity = assignQuantity, MaterielCode = outboundOrderDetail.MaterialNo, BatchNo = "", LocationCode = outStock.LocationCode, MaterielName = outStock.MaterielName, OrderDetailId = outboundOrderDetail.Id, OrderNo = outBSTOrder.OutBSTOrderNo, MaterielId = outStock.MaterielId, OriginalQuantity = outStock.StockLength, Status = taskNum == null ? OutLockStockStatusEnum.已分配.ObjToInt() : OutLockStockStatusEnum.出库中.ObjToInt(), StockId = outStock.Id, TaskNum = taskNum, OrderQuantity = outboundOrderDetail.XqLen, Unit = outStock.Unit }; return outStockLockInfo; } } }