wangxinhui
昨天 9ce6731460179c71f0f2c636b2a1598324d5194e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
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<Dt_OutStockLockInfo, IOutStockLockInfoRepository>, 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<Dt_OutStockLockInfo> GetByOrderDetailId(string orderNo, int orderDetailId, OutLockStockStatusEnum? outStockStatus)
        {
            return BaseDal.QueryData(x =>x.OrderNo== orderNo && x.OrderDetailId == orderDetailId && outStockStatus == null ? true : x.Status == outStockStatus.ObjToInt());
        }
 
        /// <summary>
        /// 生成出库详情
        /// </summary>
        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;
        }
    }
}