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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
using HH.WMS.Common;
using HH.WMS.DAL.Basic;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Basic;
using HH.WMS.Entitys.Dto;
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_AREA_QTYBLL : DapperBaseBLL
    {
        #region GET
 
        
 
        #endregion
 
 
        #region REDUCE QTY
 
        public OperateResult ReduceQtyAndAlloc(List<TN_WM_B_AREA_QTYEntity> AreaQtyList, string areaCode, IDbTransaction trans, LogPara logPara = null)
        {
            var result = CreateDAL<TN_WM_B_AREA_QTYDAL>().ReduceAreaQtyAndAllocQty(AreaQtyList, areaCode, logPara, trans);
            if(logPara != null)
                Log.Detail(logPara, "降库区量表并降分配量" + result.Describe());
            return result;
        }
 
        #endregion
        public OperateResult ReduceQtyAlloc(List<TN_WM_B_AREA_QTYEntity> AreaQtyList, string areaCode, IDbTransaction trans, LogPara logPara = null)
        {
            var result = CreateDAL<TN_WM_B_AREA_QTYDAL>().ReduceAreaAllocQty(AreaQtyList, areaCode, logPara, trans);
            if (logPara != null)
                Log.Detail(logPara, "降库区量表并降分配量" + result.Describe());
            return result;
        }
 
        #region 根据条件汇总当前库存
        /// <summary>
        /// 根据条件汇总当前库存
        /// </summary>
        /// <param name="itemCode">物料编码</param>
        /// <param name="strWhere">条件</param>
        /// <returns></returns>
        /// <History>[HANHE(XDL)] CREATED BY 2018-11-16</History>
        public TN_WM_B_AREA_QTYEntity GetAreaSummaryQty(string itemCode, string strWhere)
        {
            return CreateDAL<TN_WM_B_AREA_QTYDAL>().GetAreaSummaryQty(itemCode, strWhere);
        }
        #endregion
 
        public List<TN_WM_B_AREA_QTYEntity> GetAreaQtyByOwner(string ownerCode)
        {
            return CreateDAL<TN_WM_B_AREA_QTYDAL>().GetAreaQtyByOwner(ownerCode);
        }
 
        public List<TN_WM_B_AREA_QTYEntity> AddItemWeight(List<TN_WM_B_AREA_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_AREA_QTYEntity> areaQtyList, IDbTransaction trans, bool isDefaultOwner = false)
        {
            Log.Detail("TN_WM_B_AREA_QTYBLL.AddList", "添加库区量表!");
            areaQtyList = AddItemWeight(areaQtyList);
            return CreateDAL<TN_WM_B_AREA_QTYDAL>().AddAreaQty(areaQtyList, trans);
        }
    }
}