From c3f27a0b37bfaeeaab62839eba8fc0dcab1d03ad Mon Sep 17 00:00:00 2001 From: wws <18630710203@163.com> Date: Wed, 15 Nov 2023 17:49:35 +0800 Subject: [PATCH] =?UTF-8?q?=E7=82=B9=E6=A3=80=E3=80=81=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E3=80=81=E4=BF=9D=E5=85=BB=E9=80=BB=E8=BE=91=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/op/device/domain/EquPlan.java | 30 +++++++++++++++++ .../service/impl/EquPlanServiceImpl.java | 10 ++++-- .../impl/EquUpkeepOrderServiceImpl.java | 33 ++++++++++--------- .../resources/mapper/device/EquPlanMapper.xml | 2 ++ 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java index 12eb7404..39b371ca 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquPlan.java @@ -145,6 +145,36 @@ public class EquPlan extends BaseEntity { private String shutDown; private String planEquId; + private List loopStartArray; + + private Date loopStart; + + private Date loopEnd; + + public Date getLoopEnd() { + return loopEnd; + } + + public void setLoopEnd(Date loopEnd) { + this.loopEnd = loopEnd; + } + + public Date getLoopStart() { + return loopStart; + } + + public void setLoopStart(Date loopStart) { + this.loopStart = loopStart; + } + + public List getLoopStartArray() { + return loopStartArray; + } + + public void setLoopStartArray(List loopStartArray) { + this.loopStartArray = loopStartArray; + } + public String getPlanEquId() { return planEquId; } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java index a42b3e81..cc16bf04 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java @@ -95,6 +95,10 @@ public class EquPlanServiceImpl implements IEquPlanService { equPlan.setUpdateTimeEnd(formatter.format(equPlan.getUpdateTimeArray().get(1))); } } + if (equPlan.getLoopStartArray() != null) { + equPlan.setLoopStart(equPlan.getLoopStartArray().get(0)); + equPlan.setLoopEnd(equPlan.getLoopStartArray().get(1)); + } List equPlans = equPlanMapper.selectEquPlanList(equPlan); //获取当前所选工厂 @@ -140,8 +144,10 @@ public class EquPlanServiceImpl implements IEquPlanService { equPlan.setPlanId(IdUtils.fastSimpleUUID()); equPlan.setPlanCode((DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + planSerialNum)); - equPlan.setPlanLoopStart(equPlan.getPlanTimeArray().get(0)); - equPlan.setPlanLoopEnd(equPlan.getPlanTimeArray().get(1)); + if (equPlan.getPlanTimeArray().size() > 0) { + equPlan.setPlanLoopStart(equPlan.getPlanTimeArray().get(0)); + equPlan.setPlanLoopEnd(equPlan.getPlanTimeArray().get(1)); + } equPlan.setFactoryCode(factory); equPlan.setCreateBy(SecurityContextHolder.getUserName()); equPlan.setCreateTime(DateUtils.getNowDate()); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java index 82eeecfd..88c2c84c 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java @@ -121,23 +121,24 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService { // 生成工单-备件 List spareList = new ArrayList<>(); List equSpareList = equPlanEqu.getSpareList(); - for (EquPlanEquSpare spare : equSpareList) { - EquOrderEquSpare spareTemp = new EquOrderEquSpare(); - BeanUtils.copyProperties(spare,spareTemp); - spareTemp.setId(IdUtils.fastSimpleUUID()); - spareTemp.setOrderCode(equOrder.getOrderCode()); - spareTemp.setParentCode(equ.getId()); - spareTemp.setFactoryCode(factory); - spareTemp.setCreateBy(SecurityContextHolder.getUserName()); - spareTemp.setCreateTime(DateUtils.getNowDate()); - spareTemp.setUpdateBy(SecurityContextHolder.getUserName()); - spareTemp.setUpdateTime(DateUtils.getNowDate()); - // 插入备件信息 - equOrderEquSpareMapper.insertEquOrderEquSpare(spareTemp); - spareList.add(spareTemp); + if (equSpareList != null) { + for (EquPlanEquSpare spare : equSpareList) { + EquOrderEquSpare spareTemp = new EquOrderEquSpare(); + BeanUtils.copyProperties(spare,spareTemp); + spareTemp.setId(IdUtils.fastSimpleUUID()); + spareTemp.setOrderCode(equOrder.getOrderCode()); + spareTemp.setParentCode(equ.getId()); + spareTemp.setFactoryCode(factory); + spareTemp.setCreateBy(SecurityContextHolder.getUserName()); + spareTemp.setCreateTime(DateUtils.getNowDate()); + spareTemp.setUpdateBy(SecurityContextHolder.getUserName()); + spareTemp.setUpdateTime(DateUtils.getNowDate()); + // 插入备件信息 + equOrderEquSpareMapper.insertEquOrderEquSpare(spareTemp); + spareList.add(spareTemp); + } } - // 备件置入 - System.out.println(spareList); + // 生成工单-设备-保养项 List detailList = equPlanEqu.getEquPlanDetailList(); diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquPlanMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquPlanMapper.xml index 2f42777f..1d50851f 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquPlanMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquPlanMapper.xml @@ -73,6 +73,8 @@ and upkeep = #{upkeep} and calculation_rule = #{calculationRule} and shut_down = #{shutDown} + and CONVERT(date,plan_loop_start) >= #{loopStart} + and #{loopEnd} >= CONVERT(date,plan_loop_start) and del_flag = '0'