jt
2021-06-10 5d0d028456874576560552f5a5c4e8b801786f11
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
using HH.WMS.Common;
using HH.WMS.DAL.Basic;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Basic;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HH.WMS.Common.External;
 
namespace HH.WMS.BLL.Basic
{
    public class TN_WM_B_STOCK_QTYBLL : DapperBaseBLL
    {
        #region REDUCE QTY
 
        public OperateResult ReduceQtyAndAlloc(List<TN_WM_B_STOCK_QTYEntity> reduceStockQty, IDbTransaction trans, LogPara logPara = null)
        {
            var result = CreateDAL<TN_WM_B_STOCK_QTYDAL>().ReduceStockQtyAndAllocQty(reduceStockQty, trans);
            if(logPara != null)
                Log.Detail(logPara, "降仓库库存和分配量" + result.Describe());
            return result;
        }
    
        #endregion
        public OperateResult ReduceStockAlloc(List<TN_WM_B_STOCK_QTYEntity> reduceStockQty, IDbTransaction trans, LogPara logPara = null)
        {
            var result = CreateDAL<TN_WM_B_STOCK_QTYDAL>().ReduceStockAllocQty(reduceStockQty, trans);
            if (logPara != null)
                Log.Detail(logPara, "降仓库库存和分配量" + result.Describe());
            return result;
        }
 
        public List<TN_WM_B_STOCK_QTYEntity> AddItemWeight(List<TN_WM_B_STOCK_QTYEntity> areaQtys)
        {
            foreach (var areaQty in areaQtys)
            {
 
                var item = CreateDAL<TN_WMS_ITEMDAL>().GetItemEntity(areaQty.CN_S_ITEM_CODE);
                if (item != null)
                {
                    Log.Detail("添加物料净重:", item.CN_F_NW.ToString());
                    areaQty.CN_F_PLANNED_QTY = item.CN_F_NW;
                }
            }
            return areaQtys;
        }
 
        public OperateResult AddList(List<TN_WM_B_STOCK_QTYEntity> stockQtyList, IDbTransaction trans, bool isDefaultOwner = false)
        {
            Log.Detail("TN_WM_B_AREA_QTYBLL.AddList", "添加仓库量表!");
            stockQtyList = AddItemWeight(stockQtyList);
            return CreateDAL<TN_WM_B_STOCK_QTYDAL>().AddStockQty(stockQtyList, trans);
        }
    }
}