zhuguifei
2026-03-10 58402bd5e762361363a0f7d7907153c77dbb819f
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
package com.shlanbao.tzsc.utils.tools;
 
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import com.shlanbao.tzsc.base.model.Combobox;
import com.shlanbao.tzsc.init.BaseParams;
import com.shlanbao.tzsc.pms.md.eqp.beans.EquipmentsBean;
import com.shlanbao.tzsc.pms.md.eqptype.beans.MdEqpTypeBean;
import com.shlanbao.tzsc.pms.md.fixCode.beans.FixCodeBean;
import com.shlanbao.tzsc.pms.md.mattype.beans.MatTypeBean;
import com.shlanbao.tzsc.pms.md.shift.beans.ShiftBean;
import com.shlanbao.tzsc.pms.md.team.beans.TeamBean;
import com.shlanbao.tzsc.pms.md.unit.beans.UnitBean;
import com.shlanbao.tzsc.utils.params.SysEqpTypeBase;
 
public class Mes2DASParams extends SysEqpTypeBase {
    //###########################################MES系统与数采系统常量转换#############################################
    /**                                                对应字段
     * 转换的数据包括:表md_fix_code字段    upcode                    mes_code            code                type        bak
     *
     *                 物料转换            MAT0001                key:MES物料编码                val:数采物料id
     * *             单位转换            UNIT0001            key:MES单位编码                 val:数采单位id
     * *             物料类型转换        MATTYPE0001            key:MES物料类型编码        val:数采物料类型id
     * *             班次转换            SHIFT0001            key:MES班次编码        val:数采班次id
     * *             班组转换            TEAM0001            key:MES班组编码        val:数采班组id
     * *             车间转换            WORKSHOP0001        key:MES车间编码        val:数采车间id
     * *             工单中工段转换        WORKCENTEREQP0001   key:MES设备所属工段        val:数采设备code,        工单类型,
     * *             生产类型转换        PRODUCTTYPE0001        key:MES生产类型编码        val:数采生产类型id
     * *             设备类型 转换        EQPCATEGORY0001        key:MES设备类型编码        val:数采设备类型id
     * *             设备机型转换        MACHINETYPE0001        key:MES设备机型编码        val:数采设备机型id
     * *
     * *
     * *
     * *
     * *
     * *
     *
     *
     *
     */
//        /**
//         * MES 物料转换(查询MD_Mat表)
//         * 定义MD_FIX_CODE 表中     MAT0001    表示单位转换   key:mes物料code   val:数采物料id
//         * mes code    <-->    DAS code
//         * @return
//         */
//        public static Map<String,String> MES2DASMat(){
//            return MES2DASCode("MAT0001");
//        }
        /**
         * MES单位和数采 单位转换
         * 定义MD_FIX_CODE 表中     UNIT0001    表示单位转换   key:mes单位code   val:数采单位id
         * mes code    <-->    DAS code
         * @return
         * update
         */
        public static Map<String,String> MES2DASUnit(){
            Map<String,String> map=null;
            List<UnitBean> list=BaseParams.getUnitLt();
            map=new HashMap<String, String>();
            if(list!=null && list.size()>0 ) {
                for( UnitBean ub:list) {
                    map.put(ub.getCode(), ub.getId());
                }
            }
            return map;
        }
        /**
         * MES物料和数采    物料类型转换
         * 定义MD_FIX_CODE 表中     MATTYPE0001    表示物料类型转换       key :mesMatCode    val:物料类型id
         * mes code    <-->    DAS code
         * @return
         */
        public static Map<String,String> MES2DASMatType(){
            Map<String,String> map=null;
            List<MatTypeBean> list=BaseParams.getMatTypeLt();
            map=new HashMap<String, String>();
            if(list!=null && list.size()>0 ) {
                for( MatTypeBean ub:list) {
                    map.put(ub.getMesCode(), ub.getId());
                }
            }
            return map;
        }
        /**
         * MES和数采    班次
         * 定义MD_FIX_CODE 表中     SHIFT0001    表示班次转换    key:mes班次code    val:数采班次id
         * mes code    <-->    DAS code
         * @return
         */
        public static Map<String,String> MES2DASShift(){
            Map<String,String> map=null;
            List<ShiftBean> list=BaseParams.getShiftLt();
            map=new HashMap<String, String>();
            if(list!=null && list.size()>0 ) {
                for( ShiftBean sb:list) {
                    map.put(sb.getCode(), sb.getId());
                }
            }
            return map;
        }
        /**
         * MES和数采    班组
         * 定义MD_FIX_CODE 表中     TEAM0001    表示班组转换    key:mes班组code    val:数采班组id
         * mes code    <-->    DAS code
         * @return
         */
        public static Map<String,String> MES2DASTeam(){
            Map<String,String> map=null;
            List<TeamBean> list=BaseParams.getTeamLt();
            map=new HashMap<String, String>();
            if(list!=null && list.size()>0 ) {
                for( TeamBean tb:list) {
                    map.put(tb.getCode(), tb.getId());
                }
            }
            return map;
        }
        /**
         * MES和数采    车间 code
         * 定义MD_FIX_CODE 表中     WORKSHOP0001    表示车间code转换    key:mes车间code    val:数采车间id
         * mes code    <-->    DAS code
         * @return
         */
        public static Map<String,String> MES2DASWorkShop(){
            return MES2DASCode("WORKSHOP0001");
        }
 
        /**
         * MES和数采  工单中工段        WORKCENTEREQP0001                        key:mes工单中MachineCode(工段)    val:数采设备code,工单类型,数采设备类型
         * Mes_code 表示MES工段,String[]{"数采设备code","设备工单类型 1卷烟工单 2包装机工单 3成型机工单4封箱机工单","数采设备id"}
         * 定义MD_FIX_CODE 表中     WorkCenterEQP0001
         * mes code    <-->    DAS code
         * @return
         */
        public static Map<String,String[]> MES2DASWorkCenterEQP(){
            Map<String,String[]> map=new HashMap<>();
             List<FixCodeBean> list=BaseParams.getListMdFixCode();
             if(list!=null && list.size()>0){
                 for(FixCodeBean f:list){
                     if("WORKCENTEREQP0001".equalsIgnoreCase(f.getUpcode())){
                         map.put(f.getMesCode(), new String[]{f.getCode(),f.getType(),f.getBak(),f.getName()});
                     }
                 }
             }
            return map;
        }
 
        /**
         * MES和数采    生产类型 code
         * 定义MD_FIX_CODE 表中     PRODUCTTYPE0001    表示生产类型code转换    key:mes生产类型code    val:数采生产类型id
         * mes code    <-->    DAS code
         * @return
         *
         */
        public static Map<String,String> MES2DASProductType(){
            return MES2DASCode("PRODUCTTYPE0001");
        }
 
        /**
         * MES和数采    设备类型
         * 定义MD_FIX_CODE 表中     EQPCATEGORY0001    表示生产类型code转换    key:mes设备类型 code    val:数采设备类型 (如卷烟机、包装机、成型机、封箱机、发射机的表数据id)id
         * mes code    <-->    DAS code
         * @return
         *
         */
        public static Map<String,String> MES2DASEqpCategory(){
            return MES2DASCode("EQPCATEGORY0001");
        }
        /**
         * MES和数采    设备
         *
         */
        public static Map<String,String> MES2DASALLEqp(){
            Map<String,String> map=null;
            List<EquipmentsBean> list=BaseParams.getAllEquipments();
            map=new HashMap<String, String>();
            if(list!=null && list.size()>0 ) {
                for( EquipmentsBean ub:list) {
                    map.put(ub.getWorkCenter(), ub.getId());
                }
            }
            return map;
        }
 
 
        /**
         * MES和数采    设备机型     code
         * 定义MD_FIX_CODE 表中     MACHINETYPE0001    表示生产类型code转换    key:mes设备类型 code    val:数采设备设备机型(如ZJ17的表数据数据id)     id
         * mes code    <-->    DAS code
         * @return
         *
         *         update user      update time               description
         *     ---------------------------------------------------------------------------------
         *         bsw                 2019-05-09 15:55           修改为从md_eqp_type表获取数据
         */
        public static Map<String,String> MES2DASMachineType(){
            Map<String,String> map=new HashMap<>();
            List<MdEqpTypeBean> list=BaseParams.getAllEqpTypes();
            if(list!=null && list.size()>0){
                for(MdEqpTypeBean f:list){
                        map.put(f.getCode(), f.getId());
                }
            }
            return map;
 
        }
        /**
         * MES 编码  到  数采编码转换
         * @param code
         * @return
         */
        public static Map<String,String> MES2DASCode(String code){
            Map<String,String> map=new HashMap<>();
             List<FixCodeBean> list=BaseParams.getListMdFixCode();
             if(list!=null && list.size()>0){
                 for(FixCodeBean f:list){
                     if(code.equalsIgnoreCase(f.getUpcode())){
                         map.put(f.getMesCode(), f.getCode());
                     }
                 }
             }
            return map;
        }
    //###########################################END#############################################
        //***************************************数据字典中的下拉*************************
        /**
         * 轮保类型
         * LBTYPE001
         * 8af2d43f4d73d86d014d73df6da90000    操作工项目
         * 8af2d43f4d73d86d014d73e1615a0001    机械轮保工项目
         * 8af2d49050d2002d0150da33910005b2    电气轮保工项目
         * @return
         */
        public static Map<String,String> LBType(){
            Map<String, String> lbtypeMap = new HashMap<String, String>();
             List<FixCodeBean> list=BaseParams.getListMdFixCode();
             if(list!=null && list.size()>0){
                 for(FixCodeBean f:list){
                     if("LBTYPE001".equalsIgnoreCase(f.getUpcode())){
                         lbtypeMap.put(f.getName(), f.getCode());
                     }
                 }
             }
            return lbtypeMap;
        }
        /**
         * 点检类型
         * DJTYPE001
         * 8af2d43f4d73d86d014d73df6da90000    操作工点检
         * 402899894db72650014db78d4035004f 机械维修工点检
         * 402899894db72650014db78daf010050  机械维修主管点检
         * 8af2d49050d2002d0150da342dfb05b3  电气维修工点检
         * 8af2d49050d2002d0150da35251d05b4  电气维修主管点检
         */
        public static Map<String,String> DJType(){
            Map<String, String> djtypeMap = new HashMap<String, String>();
             List<FixCodeBean> list=BaseParams.getListMdFixCode();
             if(list!=null && list.size()>0){
                 for(FixCodeBean f:list){
                     if("DJTYPE001".equalsIgnoreCase(f.getUpcode())){
                         djtypeMap.put(f.getName(), f.getCode());
                     }
                 }
             }
            return djtypeMap;
        }
        /**
         *     固定的SYS_EQP_CATEGORY的id
         *     SYSEQPCATEGORY001    code                                name        type
                                 8af2d43f4d938ab6014d94890f560002    加注量单位        JZLUNIT
                                8af2d43f4d938ab6014d948996e60003    润滑方式        RHFS001
                                402899894db7df6f014db7f7080e0001    点检方法        DJFS001
        *
        * @return
         */
        public static Map<String,String> SysEqpCategoryMap(){
            return gentMap("SYSEQPCATEGORY001");
        }
        public static Map<String,String> gentMap(String str){
            Map<String, String> djtypeMap = new HashMap<String, String>();
             List<FixCodeBean> list=BaseParams.getListMdFixCode();
             if(list!=null && list.size()>0){
                 for(FixCodeBean f:list){
                     if(str.equalsIgnoreCase(f.getUpcode())){
                         djtypeMap.put(f.getType(), f.getCode());
                     }
                 }
             }
            return djtypeMap;
        }
 
    //*****************************************end******************************
        /**
         * 获取数采需要的辅料大类
         */
        public static HashMap<String,String> getNeedMat(int type){
            HashMap<String,String> matType=new HashMap<>();
            if(type==1){
                //卷烟机辅料
                matType.put("2", "卷烟纸");
                matType.put("3", "水松纸");
                matType.put("4", "滤棒");
            }else if(type==2){
                //包装机辅料
                matType.put("5", "小盒烟膜");
                matType.put("6", "条盒烟膜");
                matType.put("7", "小盒纸");
                matType.put("8", "条盒纸");
                matType.put("9", "内衬纸");
            }else if(type==3){
                //封箱机辅料
                matType.put("22", "箱皮");
            }else if(type==4){
                //成型机辅料
                matType.put("13", "滤棒盘纸");
                matType.put("4", "滤棒");
            }else{
                //卷烟机辅料
                matType.put("2", "卷烟纸");
                matType.put("3", "水松纸");
                matType.put("4", "滤棒");
                //包装机辅料
                matType.put("5", "小盒烟膜");
                matType.put("6", "条盒烟膜");
                matType.put("7", "小盒纸");
                matType.put("8", "条盒纸");
                matType.put("9", "内衬纸");
                //封箱机辅料
                matType.put("22", "箱皮");
                //成型机辅料
                matType.put("13", "滤棒盘纸");
                //成品滤棒
                matType.put("14", "成品滤棒");
            }
            //成品滤棒
            //matType.put("14", "成品滤棒");
            return matType;
        }
        /**
         * @Title: MES2DASRSpeedUnit
         * @Description: 获取额定车速单位代码标识
         * @author baoshiwei
         * @date 2019年5月6日
         * @return
         */
        public static Map<String, String> MES2DASRSpeedUnit() {
            return unitMap("RSpeedUnit");
        }
        /**
         * @Title: MES2DASRCapacityUnit
         * @Description: 获取额定产能单位代码标识
         * @author baoshiwei
         * @date 2019年5月6日
         * @return
         */
        public static Map<String, String> MES2DASRCapacityUnit() {
            return unitMap("RCapacityUnit");
        }
 
        /**
         * @Title: unitMap
         * @Description: mes下发单位标识代码转换
         * @author baoshiwei
         * @date 2019年5月6日
         * @param str
         * @return
         */
        public static Map<String,String> unitMap(String str){
            Map<String, String> djtypeMap = new HashMap<String, String>();
             List<FixCodeBean> list=BaseParams.getListMdFixCode();
             if(list!=null && list.size()>0){
                 for(FixCodeBean f:list){
                     if(str.equalsIgnoreCase(f.getUpcode())){
                         djtypeMap.put(f.getMesCode(), f.getDes());
                     }
                 }
             }
            return djtypeMap;
        }
 
 
    public static Map<String, String> MES2DASALLEqpCode() {
        Map<String,String> map=null;
        List<EquipmentsBean> list=BaseParams.getAllEquipments();
        map=new HashMap<String, String>();
        if(list!=null && list.size()>0 ) {
            for( EquipmentsBean ub:list) {
                map.put(ub.getWorkCenter(), ub.getEquipmentCode());
            }
        }
        return map;
    }
 
    public static List<Combobox> queryCombobox(String type) {
            List<Combobox> comboboxes = new ArrayList<>();
 
 
        List<FixCodeBean> list=BaseParams.getListMdFixCode();
        if(list!=null && list.size()>0){
            Combobox combobox =null;
            for(FixCodeBean f:list){
                if(type.equalsIgnoreCase(f.getUpcode())){
                    combobox = new Combobox();
                    combobox.setId(f.getCode());
                    combobox.setName(f.getName());
                    comboboxes.add(combobox);
                }
            }
        }
            return comboboxes;
    }
 
 
}