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
86
using HH.WMS.BLL.InStock;
using HH.WMS.Common.External;
using HH.WMS.DAL;
using HH.WMS.DAL.ERP;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Basic;
using HH.WMS.Entitys.Entitys;
using HH.WMS.Entitys.ERP;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using HH.WMS.Common;
 
namespace HH.WMS.BLL.ERP
{
    /// <summary>
    /// 大磅单
    /// </summary>
    public class TN_ER_CAR_POUNDBLL : DapperBaseBLL
    {
        #region GET
 
        public DataTable Get(string tableName, int pageIndex, int pageSize, out long total, string orderBy = "")
        {
            return CreateDAL<TN_ER_CAR_POUNDDAL>().GetCar(tableName, pageIndex, pageSize, out total, orderBy);
        }
 
        public TN_ER_CAR_POUNDEntity GetByCarNo(string carNo, string orderBy)
        {
            var carPound = BLLCreator.Create<DapperBLL<TN_ER_CAR_POUNDEntity>>().GetSingleEntity(new { CN_S_CAR_NO = carNo }, orderBy);
            return carPound;
        }
 
        public List<TN_ER_CAR_POUNDEntity> GetList(int sync)
        {
            return CreateDAL<DapperDAL<TN_ER_CAR_POUNDEntity>>().GetList(new { CN_N_SYNC = sync });
        }
 
        #endregion
 
        #region ADD
 
        public OperateResult Add(TN_ER_CAR_POUNDEntity carPound)
        {
            var result = BLLCreator.Create<DapperBLL<TN_ER_CAR_POUNDEntity>>().Add(carPound);
            return result;
        }
 
        #endregion
 
        #region UPDATE
 
        public OperateResult UpdateSyncState(string poundNo, int syncState, IDbTransaction trans)
        {
            var result = BLLCreator.Create<DapperBLL<TN_ER_CAR_POUNDEntity>>().Update(new { CN_N_SYNC = syncState }, new { CN_S_POUND_NO = poundNo });
            return result;
        }
 
        public OperateResult Update(TN_ER_CAR_POUNDEntity carPound, object where, LogPara logPara = null)
        {
            var result = BLLCreator.Create<DapperBLL<TN_ER_CAR_POUNDEntity>>().Update(carPound, where);
            if (logPara != null)
                Log.Detail(logPara, "更新车号:" + carPound.CN_S_CAR_NO + result.Describe());
            return result;
        }
 
        public OperateResult UpdateState(string areaCode, string state, LogPara logPara = null)
        {
            var result = BLLCreator.Create<DapperBLL<TN_ER_CAR_POUNDEntity>>().Update(new
            {
                CN_S_STATE = state
            }, new
            {
                CN_S_UNLOCAD_AREA_CODE = areaCode
            });
            if(logPara != null)
                Log.Detail(logPara, "更新库区:" + areaCode + "的状态为:" + state);
            return result;
        }
 
        #endregion
    }
}