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

View File

@@ -32,4 +32,12 @@ export function submit(data) {
})
}
export default { add, edit, del, submit }
export function getform(params) {
return request({
url: 'api/devicerunrecord/getform',
method: 'get',
params
})
}
export default { add, edit, del, submit, getform }

View File

@@ -7,12 +7,13 @@
:before-close="handleClose"
destroy-on-close
@close="close"
@open="open"
>
<el-form ref="form" :model="form1" :rules="rules" size="mini" label-width="160px">
<el-row>
<el-col :span="12">
<el-form-item label="设备:" prop="devicerecord_id">
<el-input v-model="form1.device_code" :disabled="true" style="width: 200px;"/>
<el-form-item label="设备:" prop="device_code">
<el-input v-model="form1.device_code" :disabled="true" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="12">
@@ -25,12 +26,12 @@
<el-row>
<el-col :span="12">
<el-form-item label="工作时间(分钟):">
<el-input-number :controls="false" :min="0" :precision="0" v-model="form1.run_times" style="width: 200px;"/>
<el-input-number v-model="form1.run_times" :controls="false" :min="0" :precision="0" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="保养时间(分钟):">
<el-input-number :controls="false" :min="0" :precision="0" v-model="form1.prepare_times" style="width: 200px;" />
<el-input-number v-model="form1.prepare_times" :controls="false" :min="0" :precision="0" style="width: 200px;" />
</el-form-item>
</el-col>
</el-row>
@@ -38,12 +39,12 @@
<el-row>
<el-col :span="12">
<el-form-item label="故障时间(分钟):">
<el-input-number :controls="false" :min="0" :precision="0" v-model="form1.error_times" style="width: 200px;" />
<el-input-number v-model="form1.error_times" :controls="false" :min="0" :precision="0" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="工装调整时间(分钟):">
<el-input-number :controls="false" :precision="0" :min="0" v-model="form1.adjust_times" style="width: 200px;" />
<el-input-number v-model="form1.adjust_times" :controls="false" :precision="0" :min="0" style="width: 200px;" />
</el-form-item>
</el-col>
</el-row>
@@ -51,12 +52,12 @@
<el-row>
<el-col :span="12">
<el-form-item label="生产总量:">
<el-input-number :controls="false" :min="0" :precision="2" v-model="form1.product_qty" style="width: 200px;" />
<el-input-number v-model="form1.product_qty" :controls="false" :min="0" :precision="2" style="width: 200px;" />
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="不合格数:">
<el-input-number :controls="false" :min="0" :precision="2" v-model="form1.nok_qty" style="width: 200px;" />
<el-input-number v-model="form1.nok_qty" :controls="false" :min="0" :precision="2" style="width: 200px;" />
</el-form-item>
</el-col>
</el-row>
@@ -95,6 +96,12 @@ export default {
type: Object
}
},
data() {
return {
form1: {},
dialogVisible: false
}
},
watch: {
dialogShow: {
handler(newValue, oldValue) {
@@ -103,12 +110,6 @@ export default {
}
}
},
data() {
return {
form1: {},
dialogVisible: false
}
},
methods: {
handleClose(done) {
this.$confirm('确认关闭?')
@@ -122,6 +123,14 @@ export default {
this.$emit('update:dialogShow', false)
this.$emit('tableChanged')
},
open() {
crudDevicerunrecord.getform({ 'devicerecord_id': this.form1.devicerecord_id }).then(res => {
debugger
if (res != null) {
this.form1.error_times = res.error_times
}
})
},
cancel() {
this.dialogVisible = false
this.crud.toQuery()