三阶段修改

This commit is contained in:
2022-07-14 15:07:14 +08:00
parent 83d037ad86
commit 4dc47922bd
2 changed files with 46 additions and 4 deletions

View File

@@ -716,6 +716,9 @@ public class SparePartServiceImpl implements SparePartService {
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)){
throw new PdaRequestException("未查询到相关设备信息!");
}
JSONObject returnjo = new JSONObject();
returnjo.put("code", "1");
returnjo.put("content", content);
@@ -728,7 +731,8 @@ 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");
JSONObject jsonFile = WQLObject.getWQLObject("EM_BI_EquipmentFile").query("device_code = '" + jo.getString("device_code") + "'").uniqueResult(0);
@@ -773,9 +777,46 @@ public class SparePartServiceImpl implements SparePartService {
throw new PdaRequestException("设备不存在!");
}
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.isEmpty(run)){
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
String run_date = jo.getString("run_date"); //生产时间
double run_times = jo.getDoubleValue("run_times"); //生产时间
double prepare_times = jo.getDoubleValue("prepare_times");//准备时间
double error_times = jo.getDoubleValue("error_times"); //故障时间
double adjust_times = jo.getDoubleValue("adjust_times"); //工装调整时间
double product_qty = jo.getDoubleValue("product_qty"); //生产总量
double nok_qty = jo.getDoubleValue("nok_qty"); //不合格数
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);
if (ObjectUtil.isNotEmpty(run)){
run.put("run_date", run_date);
run.put("run_times", run_times);
run.put("prepare_times", prepare_times);
run.put("error_times", error_times);
run.put("adjust_times", adjust_times);
run.put("product_qty", product_qty);
run.put("nok_qty", nok_qty);
run.put("oee_value", oee_value);
WQLObject.getWQLObject("EM_BI_DeviceRunRecord").update(run);
}else {
JSONObject json = new JSONObject();
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);
json.put("prepare_times", prepare_times);
json.put("error_times", error_times);
json.put("adjust_times", adjust_times);
json.put("product_qty", product_qty);
json.put("nok_qty", nok_qty);
json.put("create_id", currentUserId);
json.put("create_name", nickName);
json.put("create_time", DateUtil.now());
WQLObject.getWQLObject("EM_BI_DeviceRunRecord").insert(json);
}
JSONObject returnjo = new JSONObject();

View File

@@ -254,7 +254,8 @@
run.adjust_times,
run.product_qty,
run.nok_qty,
run.oee_value
run.oee_value,
run.run_date
FROM
em_bi_equipmentfile file
LEFT JOIN em_bi_devicerunrecord run ON run.devicerecord_id = file.devicerecord_id