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;
|
}
|
|
|
}
|