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
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
130
131
132
133
134
using HH.WMS.BLL.Basic;
using HH.WMS.DAL;
using HH.WMS.DAL.Common;
using HH.WMS.Entitys;
using HH.WMS.Entitys.Basic;
using HH.WMS.Entitys.Common;
using Newtonsoft.Json;
/********************************************************************************
 
** auth: DBS
 
** date: 2018/11/14 20:32:52
 
** desc: 尚未编写描述
 
** Ver.:  V1.0.0
 
*********************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace HH.WMS.BLL.Common
{
    public class MONGO_KEYTYPE_MAPBLL : BaseBLL
    {
        public MONGO_KEYTYPE_MAP GetEntity(string barCode)
        {
            return CreateDAL<MONGO_KEYTYPE_MAPDAL>().GetEntity(barCode);
        }
 
        public List<MONGO_KEYTYPE_MAP> GetList(List<string> barCodeList)
        {
            return CreateDAL<MONGO_KEYTYPE_MAPDAL>().GetList(barCodeList);
        }
 
        public ScanCodeClass AnalysisCode(string barCode)
        {
            MONGO_KEYTYPE_MAP map = GetEntity(barCode);
            if (map == null) return null;
            ScanCodeClass scanCodeMode = new ScanCodeClass();
            switch (map.Type)
            {
                case "1"://CS程序打印条码
                    MONGO_PRINT_BARCODE barcode = BLLCreator.Create<MONGO_PRINT_BARCODEBLL>().GetValue(barCode);
                    scanCodeMode = new ScanCodeClass() { Key = map.Key, Type = map.Type, PrintBarCode = barcode };
                    break;
                case "2"://三生XML唯一码
                    TN_WM_B_UNIQUE_BARCODEEntity uniqueCode = BLLCreator.Create<TN_WM_B_UNIQUE_BARCODEBLL>().GetValue(barCode);
                    if (uniqueCode == null)
                    {
                        scanCodeMode = null;
                        break;
                    }
                    AutoBomItemEntity itemEnity = BLLCreator.Create<TN_WMS_ITEMBLL>().GetItem(uniqueCode.CN_S_ITEM_CODE);
                    if (uniqueCode != null)
                    {
                        if (itemEnity == null)
                        {
                            scanCodeMode = null;
                        }
                        else
                        {
                            uniqueCode.CN_F_MIN_PACK_QTY = Convert.ToString(itemEnity.CN_F_MIN_PACK_QTY);
                            uniqueCode.CN_C_IS_LOT_OUT = Convert.ToString(itemEnity.CN_C_IS_LOT_OUT);
                            uniqueCode.CN_C_IS_SN = Convert.ToString(itemEnity.CN_C_IS_SN);
                            uniqueCode.AuxiliaryUnitList = itemEnity.AuxiliaryUnitList;//辅助单位
                            scanCodeMode = new ScanCodeClass() { Key = map.Key, Type = map.Type, uniqueCode = uniqueCode };
                        }
 
                    }
                    break;
                case "3":
                    break;
                case "4"://准物料编码
                    var index = barCode.IndexOf("$");
                    var qty = 1;
                    if (index > 0)
                    {
                        qty = Convert.ToInt32(barCode.Substring(barCode.IndexOf("$"), barCode.Length));
                        barCode = barCode.Substring(0, barCode.IndexOf("$"));
                    }
                    AutoBomItemEntity itemenity = BLLCreator.Create<TN_WMS_ITEMBLL>().GetItem(barCode);
 
                    AutoBomItemQtyEntity qtyEntity = new AutoBomItemQtyEntity()
                    {
                        itemEntity = itemenity,
                        itemEntityQty = qty
                    };
                    scanCodeMode = new ScanCodeClass() { Key = map.Key, Type = map.Type, Item = qtyEntity };
                    break;
                case "5"://物流单号
                    scanCodeMode = new ScanCodeClass() { Key = map.Key, Type = map.Type, Item = null };
                    break;
                default:
                    break;
            }
 
            return scanCodeMode;
        }
 
        public ScanCodeClass AnalysisCodeYS(string barCode, string isUse)
        {
            ScanCodeClass scanCodeMode = new ScanCodeClass();
            MONGO_PRINT_BARCODE barcode = BLLCreator.Create<MONGO_PRINT_BARCODEBLL>().GetValueYS(barCode, isUse);
            if (barcode == null)
            {
                return null;
            }
            scanCodeMode = new ScanCodeClass() { Key = "", Type = "1", PrintBarCode = barcode };
            return scanCodeMode;
        }
        public ScanCodeClass AnalysisCodeBackYS(string barCode, string isUse)
        {
            ScanCodeClass scanCodeMode = new ScanCodeClass();
            List<MONGO_PRINT_BARCODE> barcode = BLLCreator.Create<MONGO_PRINT_BARCODEBLL>().GetValueBackYS(barCode, isUse);
            if (barcode.Count > 0)
            {
                scanCodeMode = new ScanCodeClass() { Key = "", Type = "1", PrintBarCode = barcode[0] };
            }
            else
            {
                return null;
            }
            return scanCodeMode;
        }
        public bool Insert(List<MONGO_KEYTYPE_MAP> list)
        {
            return CreateDAL<MONGO_KEYTYPE_MAPDAL>().Insert(list);
        }
    }
}