服务端的TigerApi 框架,基于.NET6 2024 版本
Rodney Chen
2024-05-31 d4c326deaa51e7d4897a84afc339684012b8cfbe
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
using Apache.NMS.ActiveMQ.Commands;
using Rhea.Common;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using Tiger.IBusiness;
using Tiger.Model;
using Tiger.Model.Minsun;
 
namespace Tiger.Business.WMS
{
    /// <summary>
    /// 库存信息接口
    /// </summary>
    public class InventroyInfo : IInventroyInfo
    {
        /// <summary>
        /// 入库信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List<iInStoreInfo> GetInStoreInfo(iParams param)
        {
            DbClient db = Biz.DataSource["WMS57"].Client;
            var query = db.Queryable<WMS_ITEM, BAS_ITEM,V_WH_UNIT>((i, m,v) =>
                                    new JoinQueryInfos(
                                        JoinType.Left, i.ITEM_CODE == m.ITEM_CODE,
                                        JoinType.Left, i.WH_ID == v.WH_ID && i.LOCATION_ID == v.LOCATION_ID
                                        ))
                .Where((i, m, v) => i.STATUS == WMS_ITEM.STATUSs.InStore.GetValue() && (i.TRANS_CODE == "BIZ_ERP_OTH_IN" || i.TRANS_CODE == "BIZ_ERP_RECEIPT"))
                .WhereIF(!string.IsNullOrEmpty(param.sn), (i, m, v) => i.SN == param.sn)
                .WhereIF(!string.IsNullOrEmpty(param.startDate), (i, m, v) => i.UPDATE_TIME >= Convert.ToDateTime(param.startDate))
                .WhereIF(!string.IsNullOrEmpty(param.endDate), (i, m, v) => i.UPDATE_TIME < Convert.ToDateTime(param.endDate))
                .Select((i, m, v) => new iInStoreInfo
                {
                    sn = i.SN,
                    MaterialCode = i.ITEM_CODE,
                    MaterialName = m.ITEM_NAME,
                    VendorCode = i.SUPP_CODE,
                    WarehouseCode = v.WH_CODE,
                    LocationCode = v.LOCATION_CODE,
                    LotNo = i.LOTNO,
                    SourceCode = i.TRANS_NO,
                    QTY = i.QTY,
                    CreateDate = i.CREATE_TIME,
                    UpdateDate = i.UPDATE_TIME
                })
                .ToList();
            return query;
        }
 
        /// <summary>
        /// 出库信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List<iOutStoreInfo> GetOutStoreInfo(iParams param)
        {
            DbClient db = Biz.DataSource["WMS57"].Client;
            var query = db.Queryable<WMS_ITEM, BAS_ITEM, V_WH_UNIT>((i, m, v) =>
                                    new JoinQueryInfos(
                                        JoinType.Left, i.ITEM_CODE == m.ITEM_CODE,
                                        JoinType.Left, i.WH_ID == v.WH_ID && i.LOCATION_ID == v.LOCATION_ID
                                        ))
                .Where((i, m, v) => i.STATUS == WMS_ITEM.STATUSs.OffShelf.GetValue() || i.STATUS == WMS_ITEM.STATUSs.Sended.GetValue() || i.STATUS == WMS_ITEM.STATUSs.Shipped.GetValue())
                .WhereIF(!string.IsNullOrEmpty(param.sn), (i, m, v) => i.SN == param.sn)
                .WhereIF(!string.IsNullOrEmpty(param.startDate), (i, m, v) => i.UPDATE_TIME >= Convert.ToDateTime(param.startDate))
                .WhereIF(!string.IsNullOrEmpty(param.endDate), (i, m, v) => i.UPDATE_TIME < Convert.ToDateTime(param.endDate))
                .Select((i, m, v) => new iOutStoreInfo
                {
                    sn = i.SN,
                    MaterialCode = i.ITEM_CODE,
                    MaterialName = m.ITEM_NAME,
                    WarehouseCode = v.WH_CODE,
                    LocationCode = v.LOCATION_CODE,
                    BillCode = i.TRANS_NO,
                    QTY = i.QTY,
                    CreateDate = i.CREATE_TIME,
                    UpdateDate = i.UPDATE_TIME
                })
                .ToList();
            return query;
        }
 
        public List<iReturnInfo> GetReturnInfo(iParamsBase param)
        {
            throw new NotImplementedException();
        }
 
        public List<iSplitInfo> GetSplitInfo(iParams param)
        {
            throw new NotImplementedException();
        }
 
        /// <summary>
        /// 物料库存信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public List<iStorageInfo> GetStorageInfo(iParamsBase param)
        {
            DbClient db = Biz.DataSource["WMS57"].Client;
            var query = db.Queryable<WMS_ITEM, BAS_ITEM, BAS_SUPPLIER>((i, m,s) =>
                                    new JoinQueryInfos(
                                        JoinType.Left, i.ITEM_CODE == m.ITEM_CODE,
                                        JoinType.Left, i.SUPP_CODE == s.SUPP_CODE
                                        ))
                .Where((i, m, s) => i.STATUS == WMS_ITEM.STATUSs.InStore.GetValue())
                .WhereIF(!string.IsNullOrEmpty(param.startDate), (i, m, s) => i.UPDATE_TIME >= Convert.ToDateTime(param.startDate))
                .WhereIF(!string.IsNullOrEmpty(param.endDate), (i, m, s) => i.UPDATE_TIME < Convert.ToDateTime(param.endDate))
                .Select((i, m, s) => new iStorageInfo
                {
                    MaterialCode = i.ITEM_CODE,
                    MaterialName = m.ITEM_NAME,
                    VenderCode = i.SUPP_CODE,
                    VenderName = s.SUPP_NAME_CN,
                    Unit = m.UNIT,
                    QTY = i.QTY,
                    UpdateDate = i.UPDATE_TIME
                })
                .ToList();
            return query;
        }
    }
}