package com.shlanbao.tzsc.utils.params;
|
|
import java.io.UnsupportedEncodingException;
|
import java.util.ArrayList;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
import com.shlanbao.tzsc.pms.md.eqp.beans.EquipmentsBean;
|
import com.shlanbao.tzsc.base.model.Combobox;
|
import com.shlanbao.tzsc.init.BaseParams;
|
import com.shlanbao.tzsc.pms.md.fixCode.beans.FixCodeBean;
|
import com.shlanbao.tzsc.pms.sys.role.beans.RoleBean;
|
|
|
/**
|
* 数据字典导入固定参数
|
* @author wanchanghuang
|
* @create 2015年9月9日10:14:10
|
*/
|
public class SysEqpTypeBase {
|
|
/**
|
* 点检角色(操作工,维修工,维修主管)
|
* value-sys_role表ID(角色ID)
|
*/
|
public static Map<String, String> getDJRoleAlls(){
|
Map<String, String> roleMap = new HashMap<String, String>();
|
List<RoleBean> list=BaseParams.getListRole();
|
if(list.size()>0 && list!=null){
|
for(RoleBean r:list){
|
if(r.getSeq()==11){
|
roleMap.put(r.getName(), r.getId());
|
}
|
}
|
}
|
return roleMap;
|
}
|
/**
|
* 获取数组格式的点检角色id 操作工点检、维修工点检、维修主管点检
|
* @return 工种角色id:0操作工、1机械维修工、2机械维修主管、3润滑工、4机械轮保工、5电气维修工、6电气维修主管、7电气轮保工
|
*/
|
|
public static String[] getArrayDJRoleAll(){
|
try {
|
List<RoleBean> list=BaseParams.getListRole();
|
String str="";
|
if(list.size()>0 && list!=null){
|
for(RoleBean r:list){
|
if(r.getSeq()==14){
|
str+=r.getId()+",";
|
}
|
}
|
}
|
//拼接 "1,2,3"
|
str="\""+str.substring(0, str.length()-1)+"\"";
|
//将字符串转换成数组
|
String [] stringArr= str.split(",");
|
return stringArr;
|
} catch (Exception e) {
|
// TODO: handle exception
|
}
|
return null;
|
}
|
/**
|
* 轮保角色(操作工,维修工,维修主管)
|
* value-sys_role表ID(角色ID)
|
* 注意:如果需要添加新角色,页面addMdType.jsp需要新增(目的页面显示角色名称)
|
* queryTypeCategory.jsp
|
*/
|
public static Map<String, String> getLBRoleAlls(){
|
Map<String, String> roleMap = new HashMap<String, String>();
|
List<RoleBean> list=BaseParams.getListRole();
|
if(list.size()>0 && list!=null){
|
for(RoleBean r:list){
|
if(r.getSeq()==14){
|
roleMap.put(r.getName(), r.getId());
|
}
|
}
|
}
|
return roleMap;
|
}
|
|
/**
|
* 润滑部位
|
* roleMap.put( "VE-卷烟机","VE");
|
roleMap.put("SE-卷烟机","SE");
|
roleMap.put( "MAX-卷烟机","MAX");
|
roleMap.put( "HCF-卷烟机","HCF");
|
roleMap.put("ZF12B-卷烟机","ZF12B");
|
|
roleMap.put( "YB25-包装机","YB25");
|
roleMap.put( "YB45-包装机","YB45");
|
roleMap.put( "YB55-包装机","YB55");
|
roleMap.put( "YB65-包装机","YB65");
|
roleMap.put("YB95-包装机","YB95");
|
*
|
*/
|
public static Map<String, String> getRHRoleAlls(){
|
Map<String, String> roleMap = new HashMap<String, String>();
|
List<FixCodeBean> list=BaseParams.getListMdFixCode();
|
if(list!=null && list.size()>0){
|
for(FixCodeBean f:list){
|
if("RH001".equalsIgnoreCase(f.getUpcode())){
|
roleMap.put(f.getName(), f.getCode());
|
}
|
}
|
}
|
return roleMap;
|
}
|
/**
|
* 设备点检增加功能,部位下啦
|
*
|
* type 卷-卷烟机
|
* 包-包装机
|
* 封-封箱机
|
* 发射-发射机
|
* 喂丝-喂丝机
|
* @throws UnsupportedEncodingException
|
*
|
*/
|
public static Map<String, String> getDJBoxRoleAlls(String equipmentCode,String eqpTypeName) throws UnsupportedEncodingException{
|
Map<String, String> roleMap = new HashMap<String, String>();
|
int code=Integer.parseInt(equipmentCode);
|
if(code<=30){
|
roleMap.put( "VE-卷烟机","VE");
|
roleMap.put("SE-卷烟机","SE");
|
roleMap.put( "MAX-卷烟机","MAX");
|
roleMap.put( "HCF-卷烟机","HCF");
|
roleMap.put("ZF12B-卷烟机","ZF12B");
|
}else if(code>=31&&code<=60){
|
if(eqpTypeName.indexOf("25")>-1){
|
roleMap.put( "YB25-包装机","ZB25");
|
}else{
|
roleMap.put( "YB45-包装机","ZB45");
|
}
|
roleMap.put( "YB55-包装机","YB55");
|
roleMap.put( "YB65-包装机","YB65");
|
roleMap.put("YB95-包装机","YB95");
|
}else if(code>=61&&code<=70){
|
roleMap.put("YP11A-封箱机","YP11A");
|
}else if(code>=131&&code<=140){
|
roleMap.put("YP27B-发射机","YP27B");
|
}else if(code>=101&&code<=130){
|
roleMap.put("成型机","成型机");
|
}
|
return roleMap;
|
}
|
/**
|
* 数据字典润滑导入,润滑方式
|
*
|
* */
|
public static Map<String,String> getBaseDatas(){
|
Map<String,String> map = new HashMap<String, String>();
|
List<Map<String,String>> list= BaseParams.getListSysEqpType();
|
if(null!=list && list.size()>0){
|
map=list.get(0);
|
}
|
return map;
|
}
|
|
/**
|
* 获取设备 key :name val:id
|
* @return
|
*/
|
public static Map<String,String> getAllEqpNameAndID(){
|
Map<String,String> map = new HashMap<String, String>();
|
List<Combobox> box=BaseParams.getAllEqpsCombobox(false);
|
for (int i = 0; i < box.size(); i++) {
|
Combobox b=new Combobox();
|
b=box.get(i);
|
map.put(b.getName(), b.getId());
|
}
|
return map;
|
}
|
|
/**
|
* 获取设备型号和名字 key:name val:id
|
* @return
|
*/
|
public static Map<String,String> getEqpTypeNameAndID(){
|
Map<String,String> map = new HashMap<String, String>();
|
List<Combobox> box=BaseParams.getEqpTypesCombobox(false);
|
for (int i = 0; i < box.size(); i++) {
|
Combobox b=new Combobox();
|
b=box.get(i);
|
map.put(b.getName(), b.getId());
|
}
|
return map;
|
}
|
|
/**
|
* 获取车间的 key:name val:id
|
* @return
|
*/
|
public static Map<String,String> getworkshopNameAndID(){
|
Map<String,String> map = new HashMap<String, String>();
|
List<Combobox> box=BaseParams.getWorkShopCombobox(false);
|
for (int i = 0; i < box.size(); i++) {
|
Combobox b=new Combobox();
|
b=box.get(i);
|
map.put(b.getName(), b.getId());
|
}
|
return map;
|
}
|
/**
|
* 设备类型 key:name val:id
|
* @return
|
*/
|
public static Map<String,String> geteqpCategoryFromEqpType(){
|
List<Combobox> box=BaseParams.getEqpCategoryCombobox(false);
|
Map<String,String> map = new HashMap<String, String>();
|
for (int i = 0; i < box.size(); i++) {
|
Combobox b=new Combobox();
|
b=box.get(i);
|
map.put(b.getName(), b.getId());
|
}
|
return map;
|
}
|
|
/**
|
* 解析excel 导入数据将文字转成对应id key:单位名 val:单位id
|
* @return
|
*/
|
public static Map<String,String> getUnit(){
|
Map<String, String> map=new HashMap<String, String>();
|
List<Combobox> ls=BaseParams.getUnitCombobox(false);
|
for (int i = 0; i < ls.size(); i++) {
|
map.put(ls.get(i).getName(), ls.get(i).getId());
|
}
|
return map;
|
}
|
/**
|
* 设备启用禁用
|
* map.put("启用", "1");
|
map.put("禁用", "0");
|
*/
|
public static Map<String,String> eqpStat(){
|
Map<String, String> roleMap = new HashMap<String, String>();
|
List<FixCodeBean> list=BaseParams.getListMdFixCode();
|
if(list!=null && list.size()>0){
|
for(FixCodeBean f:list){
|
if("IS001".equalsIgnoreCase(f.getUpcode())){
|
roleMap.put(f.getName(), f.getCode());
|
}
|
}
|
}
|
return roleMap;
|
}
|
/**
|
* 设备固入状态
|
* map.put("未入固", "1");
|
map.put("已入固", "0");
|
*/
|
public static Map<String,String> eqpPutStat(){
|
Map<String, String> roleMap = new HashMap<String, String>();
|
List<FixCodeBean> list=BaseParams.getListMdFixCode();
|
if(list!=null && list.size()>0){
|
for(FixCodeBean f:list){
|
if("GR001".equalsIgnoreCase(f.getUpcode())){
|
roleMap.put(f.getName(), f.getCode());
|
}
|
}
|
}
|
return roleMap;
|
}
|
/** 对应字段
|
* 转换的数据包括:表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, 工单类型, 数采设备id
|
* * 生产类型转换 PRODUCTTYPE0001 key:MES生产类型编码 val:数采生产类型id
|
* * 设备类型 转换 EQPCATEGORY0001 key:MES设备类型编码 val:数采设备类型id
|
* * 设备机型转换 MACHINETYPE0001 key:MES设备机型编码 val:数采设备机型id
|
*/
|
/**
|
* [功能说明]:通过mes_code,upcode找到md_fix_code表,返回对象
|
* 注意mes_code可传MES编号,也可以传数采编号,由flag决定
|
* @creatTime 2016年6月15日11:46:37
|
* @author wanchanghuang
|
* @param flag=true mes_code:表示MES编号
|
* flag=false mes_code:表示数采编号
|
*
|
* */
|
public static FixCodeBean getFixCodeByMesCode(String mes_code,String upcode,boolean flag){
|
List<FixCodeBean> list=BaseParams.getListMdFixCode();
|
FixCodeBean fixCodeBean=null;
|
if(flag){
|
for(FixCodeBean fcb:list){ //mes找数采
|
if(mes_code.equals(fcb.getMesCode()) && upcode.equals(fcb.getUpcode())){
|
fixCodeBean=fcb;
|
break;
|
}
|
}
|
}else{
|
for(FixCodeBean fcb:list){ //数采找MES
|
if(mes_code.equals(fcb.getCode()) && upcode.equals(fcb.getUpcode())){
|
fixCodeBean=fcb;
|
break;
|
}
|
}
|
}
|
return fixCodeBean;
|
}
|
|
/**
|
* [功能说明]:true-通过MES设备CODE,找到设备对象并返回
|
* false-通过设备ID(equipmentcode),找到设备对象
|
* */
|
public static EquipmentsBean getEquipmentByMesCodeToId(String equipmentcode,boolean flag) {
|
List<EquipmentsBean> list=BaseParams.getAllEquipments();
|
if(flag){
|
for(EquipmentsBean eb:list){
|
if(equipmentcode.equals(eb.getMesEqpCode())){
|
EquipmentsBean eqb=new EquipmentsBean();
|
eqb.setId(eb.getId());
|
eqb.setName(eb.getName());
|
return eqb;
|
}
|
}
|
}else{
|
for(EquipmentsBean eb:list){
|
if(equipmentcode.equals(eb.getId())){
|
EquipmentsBean eqb=new EquipmentsBean();
|
eqb.setId(eb.getId());
|
eqb.setName(eb.getName());
|
eqb.setMesEqpCode(eb.getMesEqpCode());
|
return eqb;
|
}
|
}
|
}
|
|
return null;
|
}
|
|
|
/**
|
* wct设备有效作业率
|
* jcTIme -就餐时间 wct就餐时间固定30分钟
|
*
|
* */
|
public static Double jcTime=30d;
|
|
/**
|
* 设备轮完成保状态,目前全部完成为8
|
*/
|
public static int Wctype=8;
|
|
/**
|
* 班次 1-早 2-中 3-晚 0-全部
|
*
|
* */
|
public static String shift_0="0";
|
public static String shift_1="1";
|
public static String shift_2="2";
|
public static String shift_3="3";
|
/**
|
* 班次 1-早 2-中 3-晚 0-全部
|
* 取到具体的班次
|
* 张璐
|
*
|
* */
|
public static String[] getShift(){
|
return new String[]{"0","1","2","3"};
|
}
|
/**
|
* 周期 1-日 2-周 3-月 4-年
|
*
|
* */
|
public static String period_1="1";
|
public static String period_2="2";
|
public static String period_3="3";
|
public static String period_4="4";
|
/**
|
* 周期 1-日 2-周 3-月 4-年
|
* @return
|
*/
|
public static Map<String,String> getRh2(){
|
Map<String, String> map=new HashMap<String, String>();
|
map.put("日", "1");
|
map.put("周", "2");
|
map.put("月", "3");
|
map.put("年", "4");
|
return map;
|
}
|
|
|
/**
|
* 共鞥:用于判定WCT设备点检中维修主管信息状态
|
* 0-未完成,1-通过,2-有故障
|
*/
|
public static String che_WX0="0";
|
public static String che_WX1="1";
|
public static String che_WX2="2";
|
/**
|
* 条烟提升机code
|
*/
|
public static Integer TYTS_CODE=151;
|
/**
|
* 张璐
|
* excel导出设置行数和页数
|
* 生产统计中,导出暂设置为1W条
|
*/
|
public static int page=1;
|
public static int rows=10000;
|
|
|
|
/**
|
* 包装机设备类型code
|
*/
|
public static int packerEqpTypeCode=2;
|
/**
|
* 卷烟机设备类型code
|
*/
|
public static int rollerEqpTypeCode=1;
|
/**
|
* 封箱机设备类型code
|
*/
|
public static int sealerEqpTypeCode=3;
|
/**
|
* 成型机设备类型code
|
*/
|
public static int filterEqpTypeCode=4;
|
/**
|
* 发射机设备类型code
|
*/
|
public static int launchEqpTypeCode=5;
|
/**
|
* 装盘机设备类型code
|
*/
|
public static int snatchEqpTypeCode=6;
|
/**
|
* 卸盘机设备类型code
|
*/
|
public static int unsnatchEqpTypeCode=7;
|
|
/**
|
* 盘纸规格 交接班使用
|
*/
|
public static Double pz_gg=5000D;
|
////////////////////////////////WCT 与 PMS 数据交互数据暂存////////////////////
|
//用于区别各个字段代表的数据含义
|
/**
|
* 未过滤点位和处理的原始数据
|
*/
|
public static int ORIGINALDATA=1;
|
/**
|
* 处理后的数据
|
*/
|
public static int FINALDATA=2;
|
|
/**
|
* 原始数据集合(key为当前会话id)
|
*/
|
public static HashMap<String,String> ORIGINALDATA_MAP=new HashMap<>();
|
/**
|
* 处理后的数据集合(key为当前会话id)
|
*/
|
public static HashMap<String,String> FINALDATA_MAP=new HashMap<>();
|
|
|
|
|
|
/**
|
*
|
* 0:重量
|
* 1:圆周
|
2//圆度
|
3//长度
|
4//吸阻
|
5//总通风率
|
6//硬度
|
20支质量
|
含水率,含末率,端部落丝量,端部位置
|
*
|
* */
|
public static String getZJCJType(String code){
|
String type="-1";
|
if(code.equals("JZYZZL")||code.equals("CPZL")){
|
type="0";
|
}else if(code.equals("JZYZYZ")||code.equals("FTLLBYZ")||code.equals("CPYZ")){
|
type="1";
|
}else if(code.equals("FTLLBYD")){
|
type="2";
|
}else if(code.equals("JZYZCD")||code.equals("FTLLBCD")||code.equals("CPCD")){
|
type="3";
|
}else if(code.contains("JZYZXZ")||code.equals("FTLLBXZ")||code.equals("CPXZ")){
|
type="4";
|
/*}else if(code.equals("JZYZZL")||code.equals("FTLLBZL")){
|
type="5";*/
|
}else if(code.equals("JZYZYD")||code.equals("FTLLBYD1")||code.equals("CPYD")){
|
type="6";
|
}
|
return type;
|
}
|
|
|
|
|
|
}
|