This commit is contained in:
2022-07-15 14:21:10 +08:00
parent 78b36d2f2c
commit 8e77ee7aaa
2 changed files with 17 additions and 11 deletions

View File

@@ -530,11 +530,16 @@ public class SparePartServiceImpl implements SparePartService {
map.put("flag", "6");
map.put("maintenance_flag", maintenance_flag);
map.put("device_code", device_code);
JSONObject rows = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().uniqueResult(0);
JSONArray rows = WQL.getWO("QPDAEM_BI_SPAREPART").addParamMap(map).process().getResultJSONArray(0);
if (ObjectUtil.isEmpty(rows)) {
rows = new JSONArray();
}
JSONObject content = new JSONObject();
content.put("rows",rows);
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("rows", rows);
returnjo.put("content", content);
returnjo.put("desc", "操作成功!");
return returnjo;
}
@@ -715,8 +720,8 @@ public class SparePartServiceImpl implements SparePartService {
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
String device_code = jo.getString("device_code");
JSONObject content = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag","7").addParam("device_code",device_code).process().uniqueResult(0);
if (ObjectUtil.isEmpty(content)){
JSONObject content = WQL.getWO("QPDAEM_BI_SPAREPART").addParam("flag", "7").addParam("device_code", device_code).process().uniqueResult(0);
if (ObjectUtil.isEmpty(content)) {
throw new PdaRequestException("未查询到相关设备信息!");
}
JSONObject returnjo = new JSONObject();
@@ -750,6 +755,7 @@ public class SparePartServiceImpl implements SparePartService {
BigDecimal div = NumberUtil.div(NumberUtil.sub(run_times, prepare_times, error_times, adjust_times), NumberUtil.sub(run_times, prepare_times, adjust_times));
BigDecimal div1 = NumberUtil.div(NumberUtil.mul(div, theory_beat, product_qty), NumberUtil.sub(run_times, prepare_times, error_times, adjust_times));
BigDecimal oee_value = NumberUtil.mul(div1, NumberUtil.div(NumberUtil.sub(product_qty, nok_qty), product_qty));
oee_value = NumberUtil.round(oee_value, 3);
content.put("oee_value", oee_value);
} catch (Exception e) {
content.put("oee_value", 0);
@@ -768,12 +774,13 @@ public class SparePartServiceImpl implements SparePartService {
if (ObjectUtil.isEmpty(jsonObject)) {
throw new PdaRequestException("传入参数不能为空!");
}
JSONObject jo = JSONObject.parseObject(JSON.toJSONString(jsonObject));
JSONObject form = JSONObject.parseObject(JSON.toJSONString(jsonObject));
JSONObject jo = form.getJSONObject("form");
String device_code = jo.getString("device_code");
JSONObject jsonFile = WQLObject.getWQLObject("EM_BI_EquipmentFile").query("device_code = '" + jo.getString("device_code") + "' AND is_delete = '0' AND status IN (10,11,20,30,40)").uniqueResult(0);
if (ObjectUtil.isEmpty(jsonFile)){
if (ObjectUtil.isEmpty(jsonFile)) {
throw new PdaRequestException("设备不存在!");
}
@@ -790,9 +797,9 @@ public class SparePartServiceImpl implements SparePartService {
double oee_value = jo.getDoubleValue("oee_value"); //不合格数
double theory_beat = jsonFile.getDoubleValue("theory_beat"); // 理论节拍
JSONObject run = WQLObject.getWQLObject("EM_BI_DeviceRunRecord").query("devicerecord_id = '"+jsonFile.getString("devicerecord_id")+"' AND run_date = '"+jo.getString("run_date")+"'").uniqueResult(0);
JSONObject run = WQLObject.getWQLObject("EM_BI_DeviceRunRecord").query("devicerecord_id = '" + jsonFile.getString("devicerecord_id") + "' AND run_date = '" + jo.getString("run_date") + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(run)){
if (ObjectUtil.isNotEmpty(run)) {
run.put("run_date", run_date);
run.put("run_times", run_times);
run.put("prepare_times", prepare_times);
@@ -802,9 +809,9 @@ public class SparePartServiceImpl implements SparePartService {
run.put("nok_qty", nok_qty);
run.put("oee_value", oee_value);
WQLObject.getWQLObject("EM_BI_DeviceRunRecord").update(run);
}else {
} else {
JSONObject json = new JSONObject();
json.put("runrecord_id", IdUtil.getSnowflake(1,1).nextId());
json.put("runrecord_id", IdUtil.getSnowflake(1, 1).nextId());
json.put("devicerecord_id", jsonFile.get("devicerecord_id"));
json.put("run_date", run_date);
json.put("run_times", run_times);

View File

@@ -183,7 +183,6 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
json.put("oee_value", oee_value);
} catch (Exception e) {
json.put("oee_value", 0);
tab.insert(json);
}
tab.update(json);
}