|
|
|
|
@@ -60,6 +60,7 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|
|
|
|
String is_all = MapUtil.getStr(whereJson, "is_all");
|
|
|
|
|
String biz_date = MapUtil.getStr(whereJson, "biz_date");
|
|
|
|
|
String pcsn = MapUtil.getStr(whereJson, "pcsn");
|
|
|
|
|
String formula_code = MapUtil.getStr(whereJson, "formula_code");
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("flag", "1");
|
|
|
|
|
map.put("device_id", MapUtil.getStr(whereJson, "device_id"));
|
|
|
|
|
@@ -70,6 +71,7 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|
|
|
|
}
|
|
|
|
|
if (StrUtil.equals(is_all, "0")) map.put("status", "99");
|
|
|
|
|
if (ObjectUtil.isNotEmpty(pcsn)) map.put("pcsn", "%"+pcsn+"%");
|
|
|
|
|
if (ObjectUtil.isNotEmpty(formula_code)) map.put("formula_code", "%"+formula_code+"%");
|
|
|
|
|
JSONObject json = WQL.getWO("QPDM_BI_FORMULA01").addParamMap(map).pageQuery(WqlUtil.getHttpContext(page), "fMst.status,task.start_time,fMst.bucket_type ASC");
|
|
|
|
|
return json;
|
|
|
|
|
}
|
|
|
|
|
@@ -383,127 +385,137 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|
|
|
|
String formula_code = whereJson.getString("formula_code");
|
|
|
|
|
String device_id = whereJson.getString("device_id");
|
|
|
|
|
|
|
|
|
|
WQLObject dtlTab = WQLObject.getWQLObject("PDM_BI_FormulaDtl");
|
|
|
|
|
WQLObject mstTab = WQLObject.getWQLObject("PDM_BI_Formula");
|
|
|
|
|
WQLObject dtlTab = WQLObject.getWQLObject("PDM_BI_FormulaDtl"); // 配方明细表
|
|
|
|
|
WQLObject mstTab = WQLObject.getWQLObject("PDM_BI_Formula"); // 配方主表
|
|
|
|
|
WQLObject workTab = WQLObject.getWQLObject("PDM_BI_WorkTask"); // 工序任务表
|
|
|
|
|
|
|
|
|
|
HashMap<String, String> param = new HashMap<>();
|
|
|
|
|
param.put("flag", "8");
|
|
|
|
|
param.put("formula_code", formula_code);
|
|
|
|
|
param.put("device_id", device_id);
|
|
|
|
|
JSONArray mstArr = WQL.getWO("QPDM_BI_FORMULA01").addParamMap(param).process().getResultJSONArray(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(mstArr)) {
|
|
|
|
|
throw new BadRequestException("此配粉工位有配方正在作业");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 下发电气: 配方编号,当前配粉物料编码、物料重量、配粉槽重量、小秤误差值、中秤误差值、大秤误差值
|
|
|
|
|
*/
|
|
|
|
|
JSONObject jsonDtl = dtlTab.query("formuladtl_id = '" + formuladtl_id + "'").uniqueResult(0);
|
|
|
|
|
// 查询配粉槽重量
|
|
|
|
|
JSONObject jsonMst = mstTab.query("formula_id ='" + jsonDtl.getString("formula_id") + "'").uniqueResult(0);
|
|
|
|
|
String storagevehicle_id = jsonMst.getString("storagevehicle_id");
|
|
|
|
|
if (ObjectUtil.isEmpty(storagevehicle_id)) throw new BadRequestException("此配方没有配粉槽");
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("flag", "8");
|
|
|
|
|
map.put("storagevehicle_id", storagevehicle_id);
|
|
|
|
|
JSONObject jsonIvt = WQL.getWO("QPDM_BI_FORMULA02").addParamMap(map).process().uniqueResult(0);
|
|
|
|
|
// 校验配方状态为30生产中 或者 配方状态为20提交并且工序任务状态为30开始生产
|
|
|
|
|
String statusMst = jsonMst.getString("status");
|
|
|
|
|
JSONObject jsonWork = workTab.query("workorder_id = '" + jsonMst.getString("workorder_id") + "' and workprocedure_code = 'GX001' and status = '30'").uniqueResult(0);
|
|
|
|
|
if (StrUtil.equals(statusMst, "30") || (StrUtil.equals(statusMst, "20") && ObjectUtil.isNotEmpty(jsonWork))) {
|
|
|
|
|
HashMap<String, String> param = new HashMap<>();
|
|
|
|
|
param.put("flag", "8");
|
|
|
|
|
param.put("formula_code", formula_code);
|
|
|
|
|
param.put("device_id", device_id);
|
|
|
|
|
JSONArray mstArr = WQL.getWO("QPDM_BI_FORMULA01").addParamMap(param).process().getResultJSONArray(0);
|
|
|
|
|
if (ObjectUtil.isNotEmpty(mstArr)) {
|
|
|
|
|
throw new BadRequestException("此配粉工位有配方正在作业");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 准备下发的参数
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
|
// 配方编码
|
|
|
|
|
JSONObject data1 = new JSONObject();
|
|
|
|
|
data1.put("device_code", device_code);
|
|
|
|
|
data1.put("code", "to_formula_code");
|
|
|
|
|
data1.put("value", jsonDtl.getString("formula_code"));
|
|
|
|
|
array.add(data1);
|
|
|
|
|
// 当前配粉物料编码
|
|
|
|
|
JSONObject data2 = new JSONObject();
|
|
|
|
|
data2.put("device_code", device_code);
|
|
|
|
|
data2.put("code", "to_material_code");
|
|
|
|
|
data2.put("value", data.getString("material_code"));
|
|
|
|
|
array.add(data2);
|
|
|
|
|
// 物料重量
|
|
|
|
|
JSONObject data3 = new JSONObject();
|
|
|
|
|
data3.put("device_code", device_code);
|
|
|
|
|
data3.put("code", "to_formula_qty");
|
|
|
|
|
data3.put("value", jsonDtl.getString("formula_qty"));
|
|
|
|
|
array.add(data3);
|
|
|
|
|
// 配粉槽重量
|
|
|
|
|
JSONObject data4 = new JSONObject();
|
|
|
|
|
data4.put("device_code", device_code);
|
|
|
|
|
data4.put("code", "to_masterbucket_qty");
|
|
|
|
|
data4.put("value", jsonMst.getString("masterbucket_qty"));
|
|
|
|
|
array.add(data4);
|
|
|
|
|
// 配方明细id
|
|
|
|
|
JSONObject data8 = new JSONObject();
|
|
|
|
|
data8.put("device_code", device_code);
|
|
|
|
|
data8.put("code", "to_formuladtl_id");
|
|
|
|
|
data8.put("value", jsonDtl.getString("formuladtl_id"));
|
|
|
|
|
array.add(data8);
|
|
|
|
|
/*
|
|
|
|
|
* 下发电气: 配方编号,当前配粉物料编码、物料重量、配粉槽重量、小秤误差值、中秤误差值、大秤误差值
|
|
|
|
|
*/
|
|
|
|
|
String storagevehicle_id = jsonMst.getString("storagevehicle_id");
|
|
|
|
|
if (ObjectUtil.isEmpty(storagevehicle_id)) throw new BadRequestException("此配方没有配粉槽");
|
|
|
|
|
HashMap<String, String> map = new HashMap<>();
|
|
|
|
|
map.put("flag", "8");
|
|
|
|
|
map.put("storagevehicle_id", storagevehicle_id);
|
|
|
|
|
JSONObject jsonIvt = WQL.getWO("QPDM_BI_FORMULA02").addParamMap(map).process().uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
// 小称误差值
|
|
|
|
|
JSONObject data5 = new JSONObject();
|
|
|
|
|
data5.put("device_code", device_code);
|
|
|
|
|
data5.put("code", "to_small_scale_error");
|
|
|
|
|
// 中称误差值
|
|
|
|
|
JSONObject data6 = new JSONObject();
|
|
|
|
|
data6.put("device_code", device_code);
|
|
|
|
|
data6.put("code", "to_middle_scale_error");
|
|
|
|
|
// 大称误差值
|
|
|
|
|
JSONObject data7 = new JSONObject();
|
|
|
|
|
data7.put("device_code", device_code);
|
|
|
|
|
data7.put("code", "to_big_scale_error");
|
|
|
|
|
// 准备下发的参数
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
|
// 配方编码
|
|
|
|
|
JSONObject data1 = new JSONObject();
|
|
|
|
|
data1.put("device_code", device_code);
|
|
|
|
|
data1.put("code", "to_formula_code");
|
|
|
|
|
data1.put("value", jsonDtl.getString("formula_code"));
|
|
|
|
|
array.add(data1);
|
|
|
|
|
// 当前配粉物料编码
|
|
|
|
|
JSONObject data2 = new JSONObject();
|
|
|
|
|
data2.put("device_code", device_code);
|
|
|
|
|
data2.put("code", "to_material_code");
|
|
|
|
|
data2.put("value", data.getString("material_code"));
|
|
|
|
|
array.add(data2);
|
|
|
|
|
// 物料重量
|
|
|
|
|
JSONObject data3 = new JSONObject();
|
|
|
|
|
data3.put("device_code", device_code);
|
|
|
|
|
data3.put("code", "to_formula_qty");
|
|
|
|
|
data3.put("value", jsonDtl.getString("formula_qty"));
|
|
|
|
|
array.add(data3);
|
|
|
|
|
// 配粉槽重量
|
|
|
|
|
JSONObject data4 = new JSONObject();
|
|
|
|
|
data4.put("device_code", device_code);
|
|
|
|
|
data4.put("code", "to_masterbucket_qty");
|
|
|
|
|
data4.put("value", jsonMst.getString("masterbucket_qty"));
|
|
|
|
|
array.add(data4);
|
|
|
|
|
// 配方明细id
|
|
|
|
|
JSONObject data8 = new JSONObject();
|
|
|
|
|
data8.put("device_code", device_code);
|
|
|
|
|
data8.put("code", "to_formuladtl_id");
|
|
|
|
|
data8.put("value", jsonDtl.getString("formuladtl_id"));
|
|
|
|
|
array.add(data8);
|
|
|
|
|
|
|
|
|
|
switch (device_code) {
|
|
|
|
|
case "PFW001":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE1").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE1").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE1").getValue());
|
|
|
|
|
break;
|
|
|
|
|
case "PFW002":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE2").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE2").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE2").getValue());
|
|
|
|
|
break;
|
|
|
|
|
case "PFW003":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE3").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE3").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE3").getValue());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
array.add(data5);
|
|
|
|
|
array.add(data6);
|
|
|
|
|
array.add(data7);
|
|
|
|
|
// 小称误差值
|
|
|
|
|
JSONObject data5 = new JSONObject();
|
|
|
|
|
data5.put("device_code", device_code);
|
|
|
|
|
data5.put("code", "to_small_scale_error");
|
|
|
|
|
// 中称误差值
|
|
|
|
|
JSONObject data6 = new JSONObject();
|
|
|
|
|
data6.put("device_code", device_code);
|
|
|
|
|
data6.put("code", "to_middle_scale_error");
|
|
|
|
|
// 大称误差值
|
|
|
|
|
JSONObject data7 = new JSONObject();
|
|
|
|
|
data7.put("device_code", device_code);
|
|
|
|
|
data7.put("code", "to_big_scale_error");
|
|
|
|
|
|
|
|
|
|
// 调用电气接口 下发电气
|
|
|
|
|
Map<String, Object> result = wmsToAcsService.action(array);
|
|
|
|
|
String status = MapUtil.getStr(result, "status");
|
|
|
|
|
if (!StrUtil.equals(status, "200")) {
|
|
|
|
|
String message = MapUtil.getStr(result, "message");
|
|
|
|
|
throw new BadRequestException("下发电气失败:" + message);
|
|
|
|
|
switch (device_code) {
|
|
|
|
|
case "PFW001":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE1").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE1").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE1").getValue());
|
|
|
|
|
break;
|
|
|
|
|
case "PFW002":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE2").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE2").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE2").getValue());
|
|
|
|
|
break;
|
|
|
|
|
case "PFW003":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE3").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE3").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE3").getValue());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
array.add(data5);
|
|
|
|
|
array.add(data6);
|
|
|
|
|
array.add(data7);
|
|
|
|
|
|
|
|
|
|
// 调用电气接口 下发电气
|
|
|
|
|
Map<String, Object> result = wmsToAcsService.action(array);
|
|
|
|
|
String status = MapUtil.getStr(result, "status");
|
|
|
|
|
if (!StrUtil.equals(status, "200")) {
|
|
|
|
|
String message = MapUtil.getStr(result, "message");
|
|
|
|
|
throw new BadRequestException("下发电气失败:" + message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
|
|
|
|
String nickName = SecurityUtils.getNickName();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
|
|
|
|
|
// 更新主表开始时间 和状态为执行中
|
|
|
|
|
String start_time = jsonMst.getString("start_time");
|
|
|
|
|
if (ObjectUtil.isEmpty(start_time)) {
|
|
|
|
|
jsonMst.put("start_id", currentUserId);
|
|
|
|
|
jsonMst.put("start_name", nickName);
|
|
|
|
|
jsonMst.put("start_time", now);
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.equals(jsonMst.getString("status"), "30")) {
|
|
|
|
|
jsonMst.put("status", "30");
|
|
|
|
|
}
|
|
|
|
|
mstTab.update(jsonMst);
|
|
|
|
|
// 更新明细状态为开始作业
|
|
|
|
|
jsonDtl.put("status", "20");
|
|
|
|
|
jsonDtl.put("start_id", currentUserId);
|
|
|
|
|
jsonDtl.put("start_name", nickName);
|
|
|
|
|
jsonDtl.put("start_time", now);
|
|
|
|
|
dtlTab.update(jsonDtl);
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException("配方状态不为生产中或者工序任务不为生产中");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Long currentUserId = SecurityUtils.getCurrentUserId();
|
|
|
|
|
String nickName = SecurityUtils.getNickName();
|
|
|
|
|
String now = DateUtil.now();
|
|
|
|
|
|
|
|
|
|
// 更新主表开始时间 和状态为执行中
|
|
|
|
|
String start_time = jsonMst.getString("start_time");
|
|
|
|
|
if (ObjectUtil.isEmpty(start_time)) {
|
|
|
|
|
jsonMst.put("start_id", currentUserId);
|
|
|
|
|
jsonMst.put("start_name", nickName);
|
|
|
|
|
jsonMst.put("start_time", now);
|
|
|
|
|
}
|
|
|
|
|
if (!StrUtil.equals(jsonMst.getString("status"), "30")) {
|
|
|
|
|
jsonMst.put("status", "30");
|
|
|
|
|
}
|
|
|
|
|
mstTab.update(jsonMst);
|
|
|
|
|
// 更新明细状态为开始作业
|
|
|
|
|
jsonDtl.put("status", "20");
|
|
|
|
|
jsonDtl.put("start_id", currentUserId);
|
|
|
|
|
jsonDtl.put("start_name", nickName);
|
|
|
|
|
jsonDtl.put("start_time", now);
|
|
|
|
|
dtlTab.update(jsonDtl);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@@ -900,87 +912,96 @@ public class FlourworkServiceImpl implements FlourworkService {
|
|
|
|
|
|
|
|
|
|
WQLObject dtlTab = WQLObject.getWQLObject("PDM_BI_FormulaDtl");
|
|
|
|
|
WQLObject mstTab = WQLObject.getWQLObject("PDM_BI_Formula");
|
|
|
|
|
WQLObject workTab = WQLObject.getWQLObject("PDM_BI_WorkTask"); // 工序任务表
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* 下发电气: 配方编号,当前配粉物料编码、物料重量、配粉槽重量、小秤误差值、中秤误差值、大秤误差值
|
|
|
|
|
*/
|
|
|
|
|
JSONObject jsonDtl = dtlTab.query("formuladtl_id = '" + formuladtl_id + "'").uniqueResult(0);
|
|
|
|
|
// 查询配粉槽重量
|
|
|
|
|
JSONObject jsonMst = mstTab.query("formula_id ='" + jsonDtl.getString("formula_id") + "'").uniqueResult(0);
|
|
|
|
|
|
|
|
|
|
// 准备下发的参数
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
|
// 配方编码
|
|
|
|
|
JSONObject data1 = new JSONObject();
|
|
|
|
|
data1.put("device_code", device_code);
|
|
|
|
|
data1.put("code", "to_formula_code");
|
|
|
|
|
data1.put("value", jsonDtl.getString("formula_code"));
|
|
|
|
|
array.add(data1);
|
|
|
|
|
// 当前配粉物料编码
|
|
|
|
|
JSONObject data2 = new JSONObject();
|
|
|
|
|
data2.put("device_code", device_code);
|
|
|
|
|
data2.put("code", "to_material_code");
|
|
|
|
|
data2.put("value", data.getString("material_code"));
|
|
|
|
|
array.add(data2);
|
|
|
|
|
// 物料重量
|
|
|
|
|
JSONObject data3 = new JSONObject();
|
|
|
|
|
data3.put("device_code", device_code);
|
|
|
|
|
data3.put("code", "to_formula_qty");
|
|
|
|
|
data3.put("value", jsonDtl.getString("formula_qty"));
|
|
|
|
|
array.add(data3);
|
|
|
|
|
// 配粉槽重量
|
|
|
|
|
JSONObject data4 = new JSONObject();
|
|
|
|
|
data4.put("device_code", device_code);
|
|
|
|
|
data4.put("code", "to_masterbucket_qty");
|
|
|
|
|
data4.put("value", jsonMst.getString("masterbucket_qty"));
|
|
|
|
|
array.add(data4);
|
|
|
|
|
// 配方明细id
|
|
|
|
|
JSONObject data8 = new JSONObject();
|
|
|
|
|
data8.put("device_code", device_code);
|
|
|
|
|
data8.put("code", "to_formuladtl_id");
|
|
|
|
|
data8.put("value", jsonDtl.getString("formuladtl_id"));
|
|
|
|
|
array.add(data8);
|
|
|
|
|
String statusMst = jsonMst.getString("status");
|
|
|
|
|
JSONObject jsonWork = workTab.query("workorder_id = '" + jsonMst.getString("workorder_id") + "' and workprocedure_code = 'GX001' and status = '30'").uniqueResult(0);
|
|
|
|
|
if (StrUtil.equals(statusMst, "30") || (StrUtil.equals(statusMst, "20") && ObjectUtil.isNotEmpty(jsonWork))) {
|
|
|
|
|
/*
|
|
|
|
|
* 下发电气: 配方编号,当前配粉物料编码、物料重量、配粉槽重量、小秤误差值、中秤误差值、大秤误差值
|
|
|
|
|
*/
|
|
|
|
|
// 准备下发的参数
|
|
|
|
|
JSONArray array = new JSONArray();
|
|
|
|
|
// 配方编码
|
|
|
|
|
JSONObject data1 = new JSONObject();
|
|
|
|
|
data1.put("device_code", device_code);
|
|
|
|
|
data1.put("code", "to_formula_code");
|
|
|
|
|
data1.put("value", jsonDtl.getString("formula_code"));
|
|
|
|
|
array.add(data1);
|
|
|
|
|
// 当前配粉物料编码
|
|
|
|
|
JSONObject data2 = new JSONObject();
|
|
|
|
|
data2.put("device_code", device_code);
|
|
|
|
|
data2.put("code", "to_material_code");
|
|
|
|
|
data2.put("value", data.getString("material_code"));
|
|
|
|
|
array.add(data2);
|
|
|
|
|
// 物料重量
|
|
|
|
|
JSONObject data3 = new JSONObject();
|
|
|
|
|
data3.put("device_code", device_code);
|
|
|
|
|
data3.put("code", "to_formula_qty");
|
|
|
|
|
data3.put("value", jsonDtl.getString("formula_qty"));
|
|
|
|
|
array.add(data3);
|
|
|
|
|
// 配粉槽重量
|
|
|
|
|
JSONObject data4 = new JSONObject();
|
|
|
|
|
data4.put("device_code", device_code);
|
|
|
|
|
data4.put("code", "to_masterbucket_qty");
|
|
|
|
|
data4.put("value", jsonMst.getString("masterbucket_qty"));
|
|
|
|
|
array.add(data4);
|
|
|
|
|
// 配方明细id
|
|
|
|
|
JSONObject data8 = new JSONObject();
|
|
|
|
|
data8.put("device_code", device_code);
|
|
|
|
|
data8.put("code", "to_formuladtl_id");
|
|
|
|
|
data8.put("value", jsonDtl.getString("formuladtl_id"));
|
|
|
|
|
array.add(data8);
|
|
|
|
|
|
|
|
|
|
// 小称误差值
|
|
|
|
|
JSONObject data5 = new JSONObject();
|
|
|
|
|
data5.put("device_code", device_code);
|
|
|
|
|
data5.put("code", "to_small_scale_error");
|
|
|
|
|
// 中称误差值
|
|
|
|
|
JSONObject data6 = new JSONObject();
|
|
|
|
|
data6.put("device_code", device_code);
|
|
|
|
|
data6.put("code", "to_middle_scale_error");
|
|
|
|
|
// 大称误差值
|
|
|
|
|
JSONObject data7 = new JSONObject();
|
|
|
|
|
data7.put("device_code", device_code);
|
|
|
|
|
data7.put("code", "to_big_scale_error");
|
|
|
|
|
// 小称误差值
|
|
|
|
|
JSONObject data5 = new JSONObject();
|
|
|
|
|
data5.put("device_code", device_code);
|
|
|
|
|
data5.put("code", "to_small_scale_error");
|
|
|
|
|
// 中称误差值
|
|
|
|
|
JSONObject data6 = new JSONObject();
|
|
|
|
|
data6.put("device_code", device_code);
|
|
|
|
|
data6.put("code", "to_middle_scale_error");
|
|
|
|
|
// 大称误差值
|
|
|
|
|
JSONObject data7 = new JSONObject();
|
|
|
|
|
data7.put("device_code", device_code);
|
|
|
|
|
data7.put("code", "to_big_scale_error");
|
|
|
|
|
|
|
|
|
|
switch (device_code) {
|
|
|
|
|
case "PFW001":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE1").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE1").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE1").getValue());
|
|
|
|
|
break;
|
|
|
|
|
case "PFW002":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE2").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE2").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE2").getValue());
|
|
|
|
|
break;
|
|
|
|
|
case "PFW003":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE3").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE3").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE3").getValue());
|
|
|
|
|
break;
|
|
|
|
|
switch (device_code) {
|
|
|
|
|
case "PFW001":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE1").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE1").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE1").getValue());
|
|
|
|
|
break;
|
|
|
|
|
case "PFW002":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE2").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE2").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE2").getValue());
|
|
|
|
|
break;
|
|
|
|
|
case "PFW003":
|
|
|
|
|
data5.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("SMALL_BALANCE3").getValue());
|
|
|
|
|
data6.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("MIDDLE_BALANCE3").getValue());
|
|
|
|
|
data7.put("value", SpringContextHolder.getBean(ParamServiceImpl.class).findByCode("BIG_BALANCE3").getValue());
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
array.add(data5);
|
|
|
|
|
array.add(data6);
|
|
|
|
|
array.add(data7);
|
|
|
|
|
|
|
|
|
|
// 调用电气接口 下发电气
|
|
|
|
|
Map<String, Object> result = wmsToAcsService.action(array);
|
|
|
|
|
String status = MapUtil.getStr(result, "status");
|
|
|
|
|
if (!StrUtil.equals(status, "200")) {
|
|
|
|
|
String message = MapUtil.getStr(result, "message");
|
|
|
|
|
throw new BadRequestException("下发电气失败:" + message);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
throw new BadRequestException("配方状态不为生产中或者工序任务不为生产中");
|
|
|
|
|
}
|
|
|
|
|
array.add(data5);
|
|
|
|
|
array.add(data6);
|
|
|
|
|
array.add(data7);
|
|
|
|
|
|
|
|
|
|
// 调用电气接口 下发电气
|
|
|
|
|
Map<String, Object> result = wmsToAcsService.action(array);
|
|
|
|
|
String status = MapUtil.getStr(result, "status");
|
|
|
|
|
if (!StrUtil.equals(status, "200")) {
|
|
|
|
|
String message = MapUtil.getStr(result, "message");
|
|
|
|
|
throw new BadRequestException("下发电气失败:" + message);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|