PDA手持填写巡检记录优化

highway
wws 1 year ago
parent 6dafbca7d1
commit baa2e209a3

@ -18,6 +18,7 @@ import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
@ -144,6 +145,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@DS("#header.poolName")
public AjaxResult updateInspectionRecord(EquOrder equOrder) {
boolean checkRepair = false;
EquOrderEqu equ = equOrder.getEqu();
List<EquOrderDetail> detailList = equ.getDetailList();
for (EquOrderDetail detail : detailList) {
@ -167,6 +170,21 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
equOrderStandardMapper.insertBaseFileBatch(files);
}
// 校验标准信息-是否申请报修
if (standard.getStandardType().equals("quantify")) {
int up = standard.getActualValue().compareTo(standard.getDetailUpLimit());
int down = standard.getActualValue().compareTo(standard.getDetailDownLimit());
if (!(up != 1 && down != -1)) {
checkRepair = true;
}
}else {
// 未达标
if (standard.getDetailReach().equals("1")) {
checkRepair = true;
}
}
// 更新标准
standard.setUpdateTime(DateUtils.getNowDate());
equOrderStandardMapper.updateEquOrderStandard(standard);
@ -174,30 +192,35 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
}
// 更新工单信息
equOrder.setOrderStatus("1");
equOrder.setOrderStatus("1"); // 状态为已完成
equOrder.setUpdateTime(DateUtils.getNowDate());
equOrder.setUpdateBy(SecurityContextHolder.getUserName());
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
// 获取故障报修流水号
EquRepairOrder equRepairOrder = new EquRepairOrder();
String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber());
String equipmentCode = equOrder.getEquipmentCode();
//报修单号
equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum);
//在主表中存入报修单号信息
equOrder.setRepairCode(equRepairOrder.getOrderCode());
equOrderMapper.updateEquOrder(equOrder);
if (checkRepair) {
// 获取故障报修流水号
EquRepairOrder equRepairOrder = new EquRepairOrder();
String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber());
String equipmentCode = equOrder.getEquipmentCode();
//报修单号
equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum);
//在主表中存入报修单号信息
equOrder.setRepairCode(equRepairOrder.getOrderCode());
//新增报修记录
equRepairOrder.setOrderId(IdUtils.fastSimpleUUID());
equRepairOrder.setCreateTime(DateUtils.getNowDate());
equRepairOrder.setCreateBy(SecurityUtils.getUsername());
equRepairOrder.setOrderStatus("待审核");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equRepairOrderMapper.insertEquRepairOrder(equRepairOrder);
}
//新增报修记录
equRepairOrder.setOrderId(IdUtils.fastSimpleUUID());
equRepairOrder.setCreateTime(DateUtils.getNowDate());
equRepairOrder.setCreateBy(SecurityUtils.getUsername());
equRepairOrder.setOrderStatus("待审核");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equRepairOrderMapper.insertEquRepairOrder(equRepairOrder);
// 更新工单信息
equOrderMapper.updateEquOrder(equOrder);
return success(equOrder);
}

Loading…
Cancel
Save