From 3575e34f3e6fbf119ea4e7d3739c37494a158605 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Mon, 4 Dec 2023 13:55:46 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86-?= =?UTF-8?q?=E7=BB=B4=E4=BF=AEPC=E5=A1=AB=E5=86=99=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E3=80=81=E6=89=8B=E6=8C=81=E5=A1=AB=E5=86=99=E7=BB=B4=E4=BF=AE?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E4=BF=AE=E6=94=B9=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/op/device/domain/EquEquipment.java | 12 + .../mapper/EquRepairWorkOrderMapper.java | 8 + .../service/impl/DevicePDAServiceImpl.java | 245 ++++++++++-------- .../impl/EquRepairWorkOrderServiceImpl.java | 9 + .../device/EquRepairWorkOrderMapper.xml | 7 + 5 files changed, 179 insertions(+), 102 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquEquipment.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquEquipment.java index 5566f4e4..3b2755e8 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquEquipment.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquEquipment.java @@ -154,6 +154,10 @@ public class EquEquipment extends BaseEntity { @Excel(name = "SAP资产号") private String sapAsset; + /** 设备状态 */ + @Excel(name = "设备状态") + private String equipmentStatus; + public void setEquipmentId(Long equipmentId) { this.equipmentId = equipmentId; } @@ -400,6 +404,14 @@ public class EquEquipment extends BaseEntity { return sapAsset; } + //设备状态 + public void setEquipmentStatus(String equipmentStatus) { + this.equipmentStatus = equipmentStatus; + } + public String getEquipmentStatus() { + return equipmentStatus; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairWorkOrderMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairWorkOrderMapper.java index 3393c5aa..58cc2b5a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairWorkOrderMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairWorkOrderMapper.java @@ -4,6 +4,7 @@ import java.util.List; import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.domain.BaseFileData; +import com.op.device.domain.EquEquipment; import com.op.device.domain.EquRepairWorkOrder; import com.op.device.domain.EquTeamUser; import org.apache.ibatis.annotations.Param; @@ -104,4 +105,11 @@ public interface EquRepairWorkOrderMapper { * @return */ EquRepairWorkOrder selectEquRepairWorkOrderByWorkCode(String workCode); + + /** + * 修改设备状态 + * @param equEquipment + * @return + */ + public int updateEquipmentStatus(EquEquipment equEquipment); } 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 6d28e899..c1669d0d 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 @@ -15,6 +15,7 @@ import com.op.device.service.IDevicePDAService; import com.op.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import org.springframework.util.CollectionUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; @@ -537,14 +538,23 @@ public class DevicePDAServiceImpl implements IDevicePDAService { equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate()); //维修中 equRepairWorkOrder.setWorkStatus("2"); + //维修工单里面的设备名 简化TODO + EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId()); + //修改设备状态 改为维修中 + EquEquipment equEquipment = new EquEquipment(); + equEquipment.setEquipmentCode(list.getEquipmentCode()); + equEquipment.setEquipmentStatus("2"); + equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment); + equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder); - return success("提交成功,开始维修!"); + return success("提交成功,设备开始维修!"); } catch (Exception e) { return error(); } } /** + * 查询设备 * @param equipmentId * @return */ @@ -617,117 +627,148 @@ public class DevicePDAServiceImpl implements IDevicePDAService { * @param equRepairWorkOrder * @return */ + @Transactional//增加事务注解,出错时自动回滚 @Override @DS("#header.poolName") public AjaxResult updateMaintenanceRecords(EquRepairWorkOrder equRepairWorkOrder) { - //判断是否停机 - EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId()); - if (list.getWorkDownMachine().equals("1")) { - //维修结束时间、维修真正停机时间 - equRepairWorkOrder.setActualDownEndTime(DateUtils.getNowDate()); - } - equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate()); - //更新每一项点检/巡检检查项信息 - List checkLists = equRepairWorkOrder.getDetailList(); - for (EquOrder checkList : checkLists) { - checkList.setUpdateBy(SecurityUtils.getUsername()); - checkList.setUpdateTime(DateUtils.getNowDate()); - List standardLists = checkList.getStandardList(); - for (EquOrderStandard standardList : standardLists) { - //先删除每个检查项标准图片 - equOrderStandardMapper.deleteBaseFileBySourceId(standardList.getId()); - //图片 - if (StringUtils.isNotEmpty(standardList.getPicturePath())) { - String[] ids = standardList.getPicturePath().split(","); - List files = new ArrayList<>(); - BaseFileData file = null; - for (String id : ids) { - file = new BaseFileData(); - file.setFileId(IdUtils.fastSimpleUUID()); - file.setFileName(id.split("&fileName=")[1]); - file.setFileAddress(id); - file.setSourceId(standardList.getId()); - file.setCreateBy(SecurityUtils.getUsername()); - file.setCreateTime(new Date()); - //维修后 - file.setImageType("4"); - files.add(file); + try { + //判断是否停机 + EquRepairWorkOrder list = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId()); + if (list.getWorkDownMachine().equals("1")) { + //维修真正停机时间 + equRepairWorkOrder.setActualDownEndTime(DateUtils.getNowDate()); + } + //维修工单结束时间 + equRepairWorkOrder.setWorkEndTime(DateUtils.getNowDate()); + + ////更新每一项点检/巡检检查项信息 + //判空 + if(StringUtils.isNotEmpty(equRepairWorkOrder.getDetailList())){ + List checkLists = equRepairWorkOrder.getDetailList(); + for (EquOrder checkList : checkLists) { + checkList.setUpdateBy(SecurityUtils.getUsername()); + checkList.setUpdateTime(DateUtils.getNowDate()); + List standardLists = checkList.getStandardList(); + for (EquOrderStandard standardList : standardLists) { + //先删除每个检查项标准图片 + equOrderStandardMapper.deleteBaseFileBySourceId(standardList.getId()); + //图片批量新增 + if (StringUtils.isNotEmpty(standardList.getPicturePath())) { + String[] ids = standardList.getPicturePath().split(","); + List files = new ArrayList<>(); + BaseFileData file = null; + for (String id : ids) { + file = new BaseFileData(); + file.setFileId(IdUtils.fastSimpleUUID()); + file.setFileName(id.split("&fileName=")[1]); + file.setFileAddress(id); + file.setSourceId(standardList.getId()); + file.setCreateBy(SecurityUtils.getUsername()); + file.setCreateTime(new Date()); + //图片类型 维修后 + file.setImageType("4"); + files.add(file); + } + equOrderStandardMapper.insertBaseFileBatch(files); + } + standardList.setRepairReach(standardList.getDetailReach()); + standardList.setRepairValue(standardList.getActualValue()); + standardList.setUpdateTime(DateUtils.getNowDate()); + standardList.setUpdateBy(SecurityUtils.getUsername()); + equOrderStandardMapper.updateActualValues(standardList); } - equOrderStandardMapper.insertBaseFileBatch(files); + equOrderMapper.updateEquOrder(checkList); } - standardList.setRepairReach(standardList.getDetailReach()); - standardList.setRepairValue(standardList.getActualValue()); - standardList.setUpdateTime(DateUtils.getNowDate()); - standardList.setUpdateBy(SecurityUtils.getUsername()); - equOrderStandardMapper.updateActualValues(standardList); } - equOrderMapper.updateEquOrder(checkList); - } - //新建申领单 - List equSpareApplies = equRepairWorkOrder.getApplyList(); - for (EquSpareApply equSpareApply : equSpareApplies) { - //生成领料单code - String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber()); - String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairWorkOrder.getWorkCode().substring(10); - //十五位单号 - equSpareApply.setApplyCode("AW" + code + serialNum); - equSpareApply.setApplyId(IdUtils.fastSimpleUUID()); - //备品备件规格型号!!!!! -// equSpareApply.setSpareModel(equSpareApply.getS); - equSpareApply.setSpareCode(equSpareApply.getMaterialCode()); - equSpareApply.setSpareName(equSpareApply.getMaterialDesc()); - equSpareApply.setApplyPeople(SecurityUtils.getUsername()); - equSpareApply.setCreateBy(SecurityUtils.getUsername()); - equSpareApply.setCreateTime(DateUtils.getNowDate()); - equSpareApply.setApplyTime(DateUtils.getNowDate()); - equSpareApply.setSpareUseEquipment(equRepairWorkOrder.getEquipmentCode()); - equSpareApply.setWorkCode(equRepairWorkOrder.getWorkCode()); - HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); - String key = "#header.poolName"; - equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", "")); - equSpareApplyMapper.insertEquSpareApply(equSpareApply); - - //更新完备品申领单后,更新库存 - SparePartsLedger sparePartsLedger = new SparePartsLedger(); - sparePartsLedger.setStorageId(equSpareApply.getStorageId()); - BigDecimal applyNum = equSpareApply.getSpareQuantity(); - BigDecimal amount = equSpareApply.getAmount(); - sparePartsLedger.setAmount(amount.subtract(applyNum)); - sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger); - } + ////新建申领单 + //判空 + if(StringUtils.isNotEmpty(equRepairWorkOrder.getApplyList())){ + List equSpareApplies = equRepairWorkOrder.getApplyList(); + for (EquSpareApply equSpareApply : equSpareApplies) { + //生成领料单code + String serialNum = String.format("%03d", equSpareApplyMapper.selectSerialNumber()); + String code = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equRepairWorkOrder.getWorkCode().substring(10); + //十五位单号 + equSpareApply.setApplyCode("AW" + code + serialNum); + equSpareApply.setApplyId(IdUtils.fastSimpleUUID()); + //备品备件规格型号!!!!! + //equSpareApply.setSpareModel(equSpareApply.getSpareMode()); + //备件编码 + equSpareApply.setSpareCode(equSpareApply.getMaterialCode()); + //备件名称 + equSpareApply.setSpareName(equSpareApply.getMaterialDesc()); + //申领人 + equSpareApply.setApplyPeople(SecurityUtils.getUsername()); + equSpareApply.setCreateBy(SecurityUtils.getUsername()); + equSpareApply.setCreateTime(DateUtils.getNowDate()); + //申领时间 + equSpareApply.setApplyTime(DateUtils.getNowDate()); + //使用设备 + equSpareApply.setSpareUseEquipment(equRepairWorkOrder.getEquipmentCode()); + //关联维修工单号 + equSpareApply.setWorkCode(equRepairWorkOrder.getWorkCode()); + HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); + String key = "#header.poolName"; + //工厂号 + equSpareApply.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", "")); + equSpareApplyMapper.insertEquSpareApply(equSpareApply); + + ////更新完备品申领单后,更新库存 + SparePartsLedger sparePartsLedger = new SparePartsLedger(); + sparePartsLedger.setStorageId(equSpareApply.getStorageId()); + BigDecimal applyNum = equSpareApply.getSpareQuantity(); + BigDecimal amount = equSpareApply.getAmount(); + //减去库存 + sparePartsLedger.setAmount(amount.subtract(applyNum)); + sparePartsLedgerMapper.updateSparePartsLedger(sparePartsLedger); + } + } - //图片 - //先删除每个维修工单对应图片 - equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId()); - if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) { - String[] ids = equRepairWorkOrder.getFileList().split(","); - List files = new ArrayList<>(); - BaseFileData file = null; - for (String id : ids) { - file = new BaseFileData(); - file.setFileId(IdUtils.fastSimpleUUID()); - file.setFileName(id.split("&fileName=")[1]); - file.setFileAddress(id); - file.setSourceId(equRepairWorkOrder.getWorkId()); - file.setCreateBy(SecurityUtils.getUsername()); - file.setCreateTime(new Date()); - //维修后 - file.setImageType("4"); - files.add(file); + ////增加多个维修后照片 + //先删除每个维修工单对应图片 + equRepairWorkOrderMapper.deleteBaseFileBySourceId(equRepairWorkOrder.getWorkId()); + if (StringUtils.isNotEmpty(equRepairWorkOrder.getFileList())) { + String[] ids = equRepairWorkOrder.getFileList().split(","); + List files = new ArrayList<>(); + BaseFileData file = null; + for (String id : ids) { + file = new BaseFileData(); + file.setFileId(IdUtils.fastSimpleUUID()); + file.setFileName(id.split("&fileName=")[1]); + file.setFileAddress(id); + file.setSourceId(equRepairWorkOrder.getWorkId()); + file.setCreateBy(SecurityUtils.getUsername()); + file.setCreateTime(new Date()); + //维修后 + file.setImageType("4"); + files.add(file); + } + equRepairWorkOrderMapper.insertBaseFileBatch(files); } - equRepairWorkOrderMapper.insertBaseFileBatch(files); + + ////更新维修工单 + //维修状态 + equRepairWorkOrder.setWorkStatus("1"); + //维修人 + equRepairWorkOrder.setWorkPerson(SecurityUtils.getUsername()); + //维修人员联系方式TODO!!!! + equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername()); + equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate()); + equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder); + + //维修工单里面的设备名 简化TODO + EquRepairWorkOrder example = equRepairWorkOrderMapper.selectEquRepairWorkOrderByWorkId(equRepairWorkOrder.getWorkId()); + //修改设备状态 由维修中改为正常运行 + EquEquipment equEquipment = new EquEquipment(); + equEquipment.setEquipmentCode(example.getEquipmentCode()); + equEquipment.setEquipmentStatus("1"); + equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment); + + return success("提交成功,维修完成!"); + } catch (Exception e) { + return error("提交失败!"); } - //维修人:当前登录人 - //维修状态 - equRepairWorkOrder.setWorkStatus("1"); - //维修结束时间 - equRepairWorkOrder.setWorkPerson(SecurityUtils.getUsername()); - equRepairWorkOrder.setUpdateBy(SecurityUtils.getUsername()); - equRepairWorkOrder.setUpdateTime(DateUtils.getNowDate()); - equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder); - //需要更新设备状态????这里没做 - return success("提交成功,维修完成!"); } /** diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java index 58746268..790412b6 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairWorkOrderServiceImpl.java @@ -185,6 +185,15 @@ public class EquRepairWorkOrderServiceImpl implements IEquRepairWorkOrderService equOrderStandard.setUpdateTime(DateUtils.getNowDate()); equOrderStandardMapper.updateStandardAfterRepair(equOrderStandard); } + + if(equRepairWorkOrder.getWorkStatus().equals("1")){ + //修改设备状态 由维修中改为正常运行 + EquEquipment equEquipment = new EquEquipment(); + equEquipment.setEquipmentCode(equRepairWorkOrder.getEquipmentCode()); + equEquipment.setEquipmentStatus("1"); + equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment); + } + return equRepairWorkOrderMapper.updateEquRepairWorkOrder(equRepairWorkOrder); } diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquRepairWorkOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquRepairWorkOrderMapper.xml index 8236de13..062a6694 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquRepairWorkOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquRepairWorkOrderMapper.xml @@ -477,4 +477,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and del_flag = '0' + + update base_equipment + set equipment_status = #{equipmentStatus} + where equipment_code = #{equipmentCode} + and del_flag = '0' + + \ No newline at end of file From 6c81f5e1d13552c3e9a7b84005dc75f5a4627cf1 Mon Sep 17 00:00:00 2001 From: A0010407 Date: Mon, 4 Dec 2023 14:22:31 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E5=AE=A1=E6=A0=B8=E6=97=B6=E5=88=A4=E6=96=AD=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E6=98=AF=E4=B8=8D=E6=98=AF=E7=9C=9F=E7=9A=84=E6=95=85=E9=9A=9C?= =?UTF-8?q?=20=E9=9C=80=E8=A6=81=E7=BB=B4=E4=BF=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/EquRepairOrderServiceImpl.java | 53 +++++++++++++++++-- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java index de1ffbac..e970b796 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java @@ -164,6 +164,7 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { /** * 审核故障报修 + * 审核过程中判断设备是不是真的故障 需要维修 * * @param equRepairOrder 故障报修 * @return 结果 @@ -171,7 +172,7 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { @Override @DS("#header.poolName") public int checkEquRepairOrder(EquRepairOrder equRepairOrder) { - //改了,不生成流水号,从第十位开始切割 + //不生成流水号,从报修单号第十位开始切割、拼接 String code = equRepairOrder.getOrderCode().substring(10); String workCode = DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + code; //判断是否是点检、巡检过来的 @@ -185,7 +186,6 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { one.setWorkCode("WX" + workCode); one.setUpdateBy(SecurityUtils.getUsername()); one.setUpdateTime(DateUtils.getNowDate()); - //只更新其中一个信息 equOrderMapper.updateEquOrderRepairCode(one); } } @@ -196,11 +196,15 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { equRepairWorkOrder.setOrderCode(equRepairOrder.getOrderCode()); //维修单号 equRepairWorkOrder.setWorkCode("WX" + workCode); + //报修id equRepairWorkOrder.setOrderId(equRepairOrder.getOrderId()); + //设备编号 equRepairWorkOrder.setEquipmentCode(equRepairOrder.getEquipmentCode()); + //维修组 equRepairWorkOrder.setWorkTeam(equRepairOrder.getWorkTeam()); //不委外 equRepairWorkOrder.setWorkOutsource("0"); + //无委外单号 equRepairWorkOrder.setOutWorkCode("无"); //是否立即维修 1是 0 否 equRepairWorkOrder.setWorkHandle("0"); @@ -213,7 +217,9 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { }else{ equRepairWorkOrder.setWorkDownMachine("0"); } + //故障描述???? equRepairWorkOrder.setWorkFaultDesc(equRepairOrder.getOrderDesc()); + //维修状态 待维修 equRepairWorkOrder.setWorkStatus("0"); equRepairWorkOrder.setWorkId(IdUtils.fastSimpleUUID()); equRepairWorkOrder.setCreateTime(DateUtils.getNowDate()); @@ -225,20 +231,35 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder); equRepairOrder.setOrderStatus("审核通过"); + ////更新设备状态 + EquEquipment equEquipment = new EquEquipment(); + equEquipment.setEquipmentCode(equRepairOrder.getEquipmentCode()); + //0 故障 + equEquipment.setEquipmentStatus("0"); + equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment); + }else if(equRepairOrder.getRepairDestination().equals("不维修")){ equRepairOrder.setOrderStatus("驳回"); }else if(equRepairOrder.getRepairDestination().equals("委外维修")){ EquOutsourceWork equOutsourceWork = new EquOutsourceWork(); - //委外工单编码、id、联系方式、委外单位、委外人员、委外原因 + //id equOutsourceWork.setWorkId(IdUtils.fastSimpleUUID()); + //报修单号 equOutsourceWork.setOrderCode(equRepairOrder.getOrderCode()); + //设备编码 equOutsourceWork.setEquipmentCode(equRepairOrder.getEquipmentCode()); + //委外工单号 equOutsourceWork.setWorkCode("WW" + workCode); + //维修工单号 equOutsourceWork.setRepairCode("无"); + //委外联系方式 equOutsourceWork.setWorkConnection(equRepairOrder.getWorkConnection()); + //委外单位 equOutsourceWork.setWorkOutsourcingUnit(equRepairOrder.getWorkOutsourcingUnit()); + //委外人员 equOutsourceWork.setWorkPerson(equRepairOrder.getOutSourcePerson()); + //委外原因 equOutsourceWork.setWorkReason(equRepairOrder.getOutSourceReason()); //委外类型 维修委外 equOutsourceWork.setWorkType("0"); @@ -246,20 +267,35 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { equOutsourceWork.setCreateTime(DateUtils.getNowDate()); HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String key = "#header.poolName"; + //工厂号 equOutsourceWork.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); equOutsourceWorkMapper.insertEquOutsourceWork(equOutsourceWork); equRepairOrder.setOrderStatus("审核通过"); + + ////更新设备状态 + EquEquipment equEquipment = new EquEquipment(); + equEquipment.setEquipmentCode(equRepairOrder.getEquipmentCode()); + //0 故障 + equEquipment.setEquipmentStatus("0"); + equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment); + }else if(equRepairOrder.getRepairDestination().equals("立即维修")){ EquRepairWorkOrder equRepairWorkOrder = new EquRepairWorkOrder(); + //维修工单id + equRepairWorkOrder.setWorkId(IdUtils.fastSimpleUUID()); //报修单号 equRepairWorkOrder.setOrderCode(equRepairOrder.getOrderCode()); //维修单号 equRepairWorkOrder.setWorkCode("WX"+workCode); + //orderId equRepairWorkOrder.setOrderId(equRepairOrder.getOrderId()); + //设备编码 equRepairWorkOrder.setEquipmentCode(equRepairOrder.getEquipmentCode()); + //维修组 equRepairWorkOrder.setWorkTeam(equRepairOrder.getWorkTeam()); //不委外 equRepairWorkOrder.setWorkOutsource("0"); + //无委外工单号 equRepairWorkOrder.setOutWorkCode("无"); //是否立即维修 1是 0 否 equRepairWorkOrder.setWorkHandle("0"); @@ -272,9 +308,10 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { }else{ equRepairWorkOrder.setWorkDownMachine("0"); } + //故障描述 equRepairWorkOrder.setWorkFaultDesc(equRepairOrder.getOrderDesc()); + //工单状态 待维修 equRepairWorkOrder.setWorkStatus("0"); - equRepairWorkOrder.setWorkId(IdUtils.fastSimpleUUID()); equRepairWorkOrder.setCreateTime(DateUtils.getNowDate()); equRepairWorkOrder.setCreateBy(SecurityUtils.getUsername()); //工厂 @@ -283,6 +320,14 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { equRepairWorkOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_","")); equRepairWorkOrderMapper.insertEquRepairWorkOrder(equRepairWorkOrder); equRepairOrder.setOrderStatus("审核通过"); + + ////更新设备状态 + EquEquipment equEquipment = new EquEquipment(); + equEquipment.setEquipmentCode(equRepairOrder.getEquipmentCode()); + //0 故障 + equEquipment.setEquipmentStatus("0"); + equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment); + } equRepairOrder.setUpdateTime(DateUtils.getNowDate()); equRepairOrder.setUpdateBy(SecurityUtils.getUsername());