This commit is contained in:
zds
2022-11-09 20:17:41 +08:00
parent e497b2a0cd
commit 52b7294a9f
7 changed files with 106 additions and 19 deletions

View File

@@ -461,6 +461,7 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
WQLObject reMstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairMst"); // 设备维修单主表
WQLObject reDtlTab = WQLObject.getWQLObject("EM_BI_DeviceRepairDtl"); // 设备维修单明细表
WQLObject EM_BI_DeviceRunRecord = WQLObject.getWQLObject("EM_BI_DeviceRunRecord");
String invstatus = map.getString("invstatus");
if(StrUtil.isEmpty(invstatus)){
@@ -491,6 +492,17 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
jsonRemst.put("confirm_optid",currentUserId);
jsonRemst.put("confirm_optname",nickName);
jsonRemst.put("confirm_time",DateUtil.now());
String run_date = DateUtil.today();
//累加故障时间
JSONObject run = EM_BI_DeviceRunRecord.query("devicerecord_id = '" + jsonRemst.getString("devicerecord_id") + "' AND run_date = '" + run_date + "'").uniqueResult(0);
if(run != null){
if(StrUtil.isNotEmpty(run.getString("error_times"))){
run.put("error_times",run.getIntValue("error_times")+jsonRemst.getIntValue("estimaterepair_times")*60);
}else{
run.put("error_times",jsonRemst.getIntValue("estimaterepair_times")*60);
}
EM_BI_DeviceRunRecord.update(run);
}
}
reMstTab.update(jsonRemst);
}

View File

@@ -67,6 +67,12 @@ public class DevicerunrecordController {
return new ResponseEntity<>(HttpStatus.OK);
}
@Log("查询开单表单")
@ApiOperation("查询开单表单")
@GetMapping("/getform")
public ResponseEntity<Object> getform(@RequestParam Map whereJson) {
return new ResponseEntity<>(devicerunrecordService.getform(whereJson),HttpStatus.OK);
}
@PostMapping("/submit")
@Log("填报")

View File

@@ -72,6 +72,11 @@ public interface DevicerunrecordService {
*/
void deleteAll(Long[] ids);
/**
* 提交
* @param whereJson /
*/
JSONObject getform(Map whereJson);
/**
* 填报

View File

@@ -160,7 +160,9 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
double theory_beat = jsonFile.getDoubleValue("theory_beat"); // 理论节拍
JSONObject jsonMst = tab.query("devicerecord_id = '" + devicerecord_id + "' and run_date = '" + run_date + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonMst)) throw new BadRequestException("填报信息已存在");
if (ObjectUtil.isNotEmpty(jsonMst)) {
throw new BadRequestException("填报信息已存在");
}
JSONObject json = new JSONObject();
json.put("runrecord_id", IdUtil.getSnowflake(1,1).nextId());
@@ -232,9 +234,32 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
tab.update(json);
String run_date = json.getString("run_date");
JSONArray jsonMst = tab.query("devicerecord_id = '" + devicerecord_id + "' and run_date = '" + run_date + "'").getResultJSONArray(0);
if (jsonMst.size() > 1) throw new BadRequestException("填报信息已存在");
if (jsonMst.size() > 1) {
throw new BadRequestException("填报信息已存在");
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public JSONObject getform(Map json) {
WQLObject EM_BI_DeviceRepairMst = WQLObject.getWQLObject("EM_BI_DeviceRepairMst");
String devicerecord_id = (String) json.get("devicerecord_id");
String today = DateUtil.today();
JSONObject jo = WQL.getWO("EM_DEVICERUNRECORD001")
.addParam("devicerecord_id",devicerecord_id)
.addParam("flag","3")
.addParam("end_time","%"+today+"%").process().uniqueResult(0);
if(jo == null ){
jo = new JSONObject();
jo.put("error_times","0");
}else{
if(StrUtil.isNotEmpty(jo.getString("error_times"))){
jo.put("error_times",jo.getIntValue("error_times")*60);
}else{
jo.put("error_times","0");
}
}
return jo;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteAll(Long[] ids) {
@@ -271,7 +296,9 @@ public class DevicerunrecordServiceImpl implements DevicerunrecordService {
double theory_beat = jsonFile.getDoubleValue("theory_beat"); // 理论节拍
JSONObject jsonMst = tab.query("devicerecord_id = '" + devicerecord_id + "' and run_date = '" + run_date + "'").uniqueResult(0);
if (ObjectUtil.isNotEmpty(jsonMst)) throw new BadRequestException("填报信息已存在");
if (ObjectUtil.isNotEmpty(jsonMst)) {
throw new BadRequestException("填报信息已存在");
}
JSONObject json = new JSONObject();
json.put("runrecord_id", IdUtil.getSnowflake(1,1).nextId());

View File

@@ -16,6 +16,7 @@
输入.flag TYPEAS s_string
输入.classIds TYPEAS f_string
输入.device_code TYPEAS s_string
输入.devicerecord_id TYPEAS s_string
输入.begin_time TYPEAS s_string
输入.end_time TYPEAS s_string
输入.run_date TYPEAS s_string
@@ -127,5 +128,24 @@
ENDQUERY
ENDIF
IF 输入.flag = "3"
QUERY
SELECT
sum(DeviceRepairMst.estimaterepair_times) AS error_times
FROM
EM_BI_DeviceRepairMst DeviceRepairMst
WHERE
DeviceRepairMst.is_delete = '0'
and DeviceRepairMst.invstatus in ('07','99')
OPTION 输入.devicerecord_id <> ""
DeviceRepairMst.devicerecord_id = 输入.devicerecord_id
ENDOPTION
OPTION 输入.end_time <> ""
DeviceRepairMst.real_start_date like 输入.end_time
ENDOPTION
ENDSELECT
ENDQUERY
ENDIF