优化
This commit is contained in:
@@ -713,15 +713,11 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
String formula_id = MapUtil.getStr(whereJson, "formula_id");
|
||||
|
||||
WQLObject formMstTab = WQLObject.getWQLObject("PDM_BI_Formula"); // 配方主表
|
||||
WQLObject formDtlTab = WQLObject.getWQLObject("PDM_BI_FormulaDtl"); // 配方明细表
|
||||
WQLObject workTab = WQLObject.getWQLObject("PDM_BI_WorkOrder"); // 工令表
|
||||
WQLObject deptTab = WQLObject.getWQLObject("sys_dept"); // 部门表
|
||||
WQLObject storageTab = WQLObject.getWQLObject("tool_local_storage"); // 文件表
|
||||
WQLObject materTab = WQLObject.getWQLObject("md_me_materialbase"); // 物料表
|
||||
WQLObject materExtTab = WQLObject.getWQLObject("MD_ME_ProducMaterialExt"); // 成品扩展属性表
|
||||
WQLObject paraTab = WQLObject.getWQLObject("PDM_BI_WorkProcedureParaProduct"); // 工艺参数表
|
||||
WQLObject workTaskTab = WQLObject.getWQLObject("PDM_BI_WorkTask"); // 工令工序任务表
|
||||
WQLObject classTab = WQLObject.getWQLObject("md_pb_classstandard"); // 分类表
|
||||
WQLObject deviceTab = WQLObject.getWQLObject("em_bi_deviceinfo"); // 设备表
|
||||
|
||||
JSONObject jsonMst = formMstTab.query("formula_id ='" + formula_id + "'").uniqueResult(0);
|
||||
@@ -796,25 +792,24 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
JSONObject jsonPW04 = paraTab.query("material_id = '" + material_id + "' and para_code = 'PW004'").uniqueResult(0);
|
||||
JSONObject jsonQM04 = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM004'").uniqueResult(0);
|
||||
JSONObject jsonQM06 = paraTab.query("material_id = '" + material_id + "' and para_code = 'QM006'").uniqueResult(0);
|
||||
if (ObjectUtil.isNotEmpty(jsonQM13)) oneMap.put("number_1", jsonQM13.getString("value"));
|
||||
if (ObjectUtil.isNotEmpty(jsonQM13)) oneMap.put("number_1", NumberUtil.round(jsonQM13.getString("value"), 0).toString());
|
||||
if (ObjectUtil.isNotEmpty(jsonQM14)) {
|
||||
String number_2 = NumberUtil.mul(masterbucket_qty, NumberUtil.div(jsonQM14.getString("value"), "100").toString()).toString();
|
||||
oneMap.put("number_2", NumberUtil.round(number_2, 2).toString());
|
||||
// oneMap.put("number_2", jsonQM14.getString("value")); // 待删除
|
||||
oneMap.put("number_2", NumberUtil.round(number_2, 0).toString());
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(jsonQM04)) oneMap.put("pre_time", jsonQM04.getString("value"));
|
||||
if (ObjectUtil.isNotEmpty(jsonQM06)) {
|
||||
// 预磨酒精
|
||||
String pre_fas = NumberUtil.mul(masterbucket_qty, NumberUtil.div(jsonQM06.getString("value"), "100").toString()).toString();
|
||||
oneMap.put("pre_fas", NumberUtil.round(pre_fas, 2).toString());
|
||||
oneMap.put("pre_fas", NumberUtil.round(pre_fas, 0).toString());
|
||||
|
||||
// 投料酒精
|
||||
double mul_1 = NumberUtil.mul(jsonMst.getDoubleValue("masterbucket_qty"), jsonMaterExt.getDoubleValue("liquid_rate"));
|
||||
BigDecimal mul_2 = NumberUtil.mul(jsonMst.getDoubleValue("masterbucket_qty"), NumberUtil.div(jsonQM06.getString("value"), "100"));
|
||||
String put_fas = NumberUtil.sub(mul_1, mul_2).toString();
|
||||
|
||||
oneMap.put("put_fas", NumberUtil.round(put_fas, 2).toString());
|
||||
oneMap.put("put_fas", NumberUtil.round(put_fas, 0).toString());
|
||||
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(jsonPW02)) {
|
||||
@@ -1046,97 +1041,4 @@ public class FormulaServiceImpl implements FormulaService {
|
||||
|
||||
return wcchange;
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
JSONArray jsonDevice1 = new JSONArray();
|
||||
JSONObject j51 = new JSONObject();
|
||||
j51.put("device_code","QMJ051");
|
||||
jsonDevice1.add(j51);
|
||||
JSONObject j52 = new JSONObject();
|
||||
j52.put("device_code","QMJ052");
|
||||
jsonDevice1.add(j52);
|
||||
JSONObject j53 = new JSONObject();
|
||||
j53.put("device_code","QMJ053");
|
||||
jsonDevice1.add(j53);
|
||||
|
||||
JSONObject j54 = new JSONObject();
|
||||
j54.put("device_code","QMJ054");
|
||||
jsonDevice1.add(j54);
|
||||
|
||||
JSONObject j60 = new JSONObject();
|
||||
j60.put("device_code","QMJ060");
|
||||
jsonDevice1.add(j60);
|
||||
|
||||
JSONObject j67 = new JSONObject();
|
||||
j67.put("device_code","QMJ067");
|
||||
jsonDevice1.add(j67);
|
||||
|
||||
JSONObject j68 = new JSONObject();
|
||||
j68.put("device_code","QMJ068");
|
||||
jsonDevice1.add(j68);
|
||||
|
||||
JSONObject j69 = new JSONObject();
|
||||
j69.put("device_code","QMJ069");
|
||||
jsonDevice1.add(j69);
|
||||
|
||||
JSONObject j70 = new JSONObject();
|
||||
j70.put("device_code","QMJ070");
|
||||
jsonDevice1.add(j70);
|
||||
|
||||
List<Integer> list = new ArrayList<Integer>();
|
||||
if (jsonDevice1.size()!=0) {
|
||||
for(int i=0;i<jsonDevice1.size();i++){
|
||||
JSONObject jo_i = jsonDevice1.getJSONObject(i);
|
||||
list.add(Integer.valueOf(jo_i.getString("device_code").substring(3, 6)));
|
||||
}
|
||||
HashMap<String,List<Integer>> hashmap = new HashMap<String,List<Integer>>();
|
||||
//第一个数据
|
||||
int flag = list.get(0);
|
||||
int num = 0;
|
||||
for(int i=0;i<list.size();i++){
|
||||
int now = list.get(i);
|
||||
int now2 = now - 1 ;
|
||||
//如果连着
|
||||
if((now == flag) || (now2 == flag)){
|
||||
flag = now;
|
||||
if(hashmap.containsKey(num+"")){
|
||||
List<Integer> new_list= hashmap.get(num+"");
|
||||
new_list.add(now);
|
||||
hashmap.put(num+"",new_list);
|
||||
}else{
|
||||
List<Integer> new_list= new ArrayList<Integer>();
|
||||
new_list.add(now);
|
||||
hashmap.put(num+"",new_list);
|
||||
}
|
||||
}else{//不连续了就新增一个
|
||||
flag = now;
|
||||
num++;
|
||||
List<Integer> new_list= new ArrayList<Integer>();
|
||||
new_list.add(now);
|
||||
hashmap.put(num+"",new_list);
|
||||
}
|
||||
}
|
||||
|
||||
String strs = "";
|
||||
for (Map.Entry<String, List<Integer>> entry : hashmap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<Integer> bj_bomdlt = entry.getValue();
|
||||
int n0 = bj_bomdlt.get(0);
|
||||
int n_last = bj_bomdlt.get(bj_bomdlt.size() - 1);
|
||||
String str = "";
|
||||
if (n0 == n_last) {
|
||||
str = n0 + "";
|
||||
} else {
|
||||
str = n0 + "-" + n_last;
|
||||
}
|
||||
if (StrUtil.isNotEmpty(strs)) {
|
||||
strs = strs + "、" + str;
|
||||
} else {
|
||||
strs = str;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(strs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user