This commit is contained in:
zds
2022-10-25 20:38:45 +08:00
parent 75155bceb9
commit 685609114a
6 changed files with 55 additions and 47 deletions

View File

@@ -451,35 +451,39 @@ public class DevicerepairmstServiceImpl implements DevicerepairmstService {
@Override
@Transactional(rollbackFor = Exception.class)
public void confirmRepair(JSONObject whereJson) {
public void confirmRepair(JSONObject map) {
Long currentUserId = SecurityUtils.getCurrentUserId();
String nickName = SecurityUtils.getNickName();
WQLObject reMstTab = WQLObject.getWQLObject("EM_BI_DeviceRepairMst"); // 设备维修单主表
WQLObject reDtlTab = WQLObject.getWQLObject("EM_BI_DeviceRepairDtl"); // 设备维修单明细表
// 1.判断维修单明细中是否完成 都为是,不是则报错
JSONArray reDtlArr = reDtlTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(reDtlArr)) throw new BadRequestException("明细为空");
for (int i = 0; i < reDtlArr.size(); i++) {
JSONObject json = reDtlArr.getJSONObject(i);
if (!StrUtil.equals(json.getString("isfinish"), "1")) {
throw new BadRequestException("维修项目未完成");
JSONArray rows = map.getJSONArray("rows");
for(int m=0; m<rows.size();m++){
JSONObject whereJson = rows.getJSONObject(m);
// 1.判断维修单明细中是否完成 都为是,不是则报错
JSONArray reDtlArr = reDtlTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").getResultJSONArray(0);
if (ObjectUtil.isEmpty(reDtlArr)) throw new BadRequestException(whereJson.getString("repair_code")+"明细为空");
for (int i = 0; i < reDtlArr.size(); i++) {
JSONObject json = reDtlArr.getJSONObject(i);
if (!StrUtil.equals(json.getString("isfinish"), "1")) {
throw new BadRequestException(whereJson.getString("repair_code")+"维修项目未完成");
}
}
// 2.维修人、维修时间不能为空
JSONObject jsonRemst = reMstTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").uniqueResult(0);
String update_optname = jsonRemst.getString("update_optname");
String update_time = jsonRemst.getString("update_time");
if (ObjectUtil.isEmpty(update_optname) || ObjectUtil.isEmpty(update_time)) {
throw new BadRequestException(whereJson.getString("repair_code")+"维修人或者维修时间不能为空");
}
// 3.更新维修单主表
jsonRemst.put("invstatus","07");
jsonRemst.put("confirm_optid",currentUserId);
jsonRemst.put("confirm_optname",nickName);
jsonRemst.put("confirm_time",DateUtil.now());
reMstTab.update(jsonRemst);
}
// 2.维修人、维修时间不能为空
JSONObject jsonRemst = reMstTab.query("repair_id = '" + whereJson.getString("repair_id") + "'").uniqueResult(0);
String update_optname = jsonRemst.getString("update_optname");
String update_time = jsonRemst.getString("update_time");
if (ObjectUtil.isEmpty(update_optname) || ObjectUtil.isEmpty(update_time)) {
throw new BadRequestException("维修人活着维修时间不能为空");
}
// 3.更新维修单主表
jsonRemst.put("invstatus","07");
jsonRemst.put("confirm_optid",currentUserId);
jsonRemst.put("confirm_optname",nickName);
jsonRemst.put("confirm_time",DateUtil.now());
reMstTab.update(jsonRemst);
}
@Override

View File

@@ -108,6 +108,7 @@
WHERE
file.is_delete = '0'
AND file.status not in ('90','91')
and file.device_level in ('A','B')
OPTION 输入.device_code <> ""
(file.device_code like 输入.device_code or
@@ -121,7 +122,7 @@
OPTION 输入.deptIds <> ""
d1.dept_id in 输入.deptIds
ENDOPTION
order by file.use_groupid,file.device_code
ENDSELECT
ENDQUERY
ENDIF