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 org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
@ -144,6 +145,8 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@DS("#header.poolName") @DS("#header.poolName")
public AjaxResult updateInspectionRecord(EquOrder equOrder) { public AjaxResult updateInspectionRecord(EquOrder equOrder) {
boolean checkRepair = false;
EquOrderEqu equ = equOrder.getEqu(); EquOrderEqu equ = equOrder.getEqu();
List<EquOrderDetail> detailList = equ.getDetailList(); List<EquOrderDetail> detailList = equ.getDetailList();
for (EquOrderDetail detail : detailList) { for (EquOrderDetail detail : detailList) {
@ -167,6 +170,21 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
} }
equOrderStandardMapper.insertBaseFileBatch(files); 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()); standard.setUpdateTime(DateUtils.getNowDate());
equOrderStandardMapper.updateEquOrderStandard(standard); equOrderStandardMapper.updateEquOrderStandard(standard);
@ -174,30 +192,35 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
} }
// 更新工单信息 // 更新工单信息
equOrder.setOrderStatus("1"); equOrder.setOrderStatus("1"); // 状态为已完成
equOrder.setUpdateTime(DateUtils.getNowDate()); equOrder.setUpdateTime(DateUtils.getNowDate());
equOrder.setUpdateBy(SecurityContextHolder.getUserName()); equOrder.setUpdateBy(SecurityContextHolder.getUserName());
equOrder.setPlanPerson(SecurityContextHolder.getUserName()); equOrder.setPlanPerson(SecurityContextHolder.getUserName());
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
// 获取故障报修流水号 if (checkRepair) {
EquRepairOrder equRepairOrder = new EquRepairOrder(); // 获取故障报修流水号
String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber()); EquRepairOrder equRepairOrder = new EquRepairOrder();
String equipmentCode = equOrder.getEquipmentCode(); String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber());
//报修单号 String equipmentCode = equOrder.getEquipmentCode();
equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); //报修单号
//在主表中存入报修单号信息 equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum);
equOrder.setRepairCode(equRepairOrder.getOrderCode()); //在主表中存入报修单号信息
equOrderMapper.updateEquOrder(equOrder); 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()); equOrderMapper.updateEquOrder(equOrder);
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);
return success(equOrder); return success(equOrder);
} }

Loading…
Cancel
Save