From baa2e209a331cf3c25dbc473dc7c3b95df29db2b Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Wed, 8 Nov 2023 15:33:51 +0800 Subject: [PATCH] =?UTF-8?q?PDA=E6=89=8B=E6=8C=81=E5=A1=AB=E5=86=99?= =?UTF-8?q?=E5=B7=A1=E6=A3=80=E8=AE=B0=E5=BD=95=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/DevicePDAServiceImpl.java | 61 +++++++++++++------ 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java index c151df26..9bce7eef 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java @@ -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 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); }