diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java index 7a79430f..9ba65917 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java @@ -9,6 +9,7 @@ import com.op.common.log.enums.BusinessType; import com.op.common.security.annotation.RequiresPermissions; import com.op.device.domain.EquOrder; import com.op.device.domain.EquPlan; +import com.op.device.domain.dto.UpKeepOrderDTO; import com.op.device.service.IEquUpkeepOrderService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -29,6 +30,18 @@ public class EquUpkeepOrderController extends BaseController { @Autowired private IEquUpkeepOrderService equUpkeepOrderService; + + /** + * 保养工单检验 + * @param upKeepOrderDTO + * @return + */ + @RequiresPermissions("device:upkeepOrder:add") + @PostMapping("/subInspect") + public AjaxResult subInspect(@RequestBody UpKeepOrderDTO upKeepOrderDTO) { + return equUpkeepOrderService.subInspect(upKeepOrderDTO); + } + /** * 查询保养工单列表 */ @@ -78,7 +91,7 @@ public class EquUpkeepOrderController extends BaseController { @Log(title = "保养工单", businessType = BusinessType.UPDATE) @PutMapping public AjaxResult edit(@RequestBody EquOrder equOrder) { - return toAjax(equUpkeepOrderService.updateEquOrder(equOrder)); + return equUpkeepOrderService.updateEquOrder(equOrder); } /** diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java index 6f05277a..dcd6febd 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java @@ -140,6 +140,16 @@ public class EquOrder extends BaseEntity { // 是否停机保养 private String shutDown; + private String orderInspect; + + public String getOrderInspect() { + return orderInspect; + } + + public void setOrderInspect(String orderInspect) { + this.orderInspect = orderInspect; + } + public String getShutDown() { return shutDown; } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrderEqu.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrderEqu.java index 224b9e7d..da1f8da9 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrderEqu.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrderEqu.java @@ -60,6 +60,16 @@ public class EquOrderEqu extends BaseEntity { private List detailList; + private List spareList; + + public List getSpareList() { + return spareList; + } + + public void setSpareList(List spareList) { + this.spareList = spareList; + } + public List getDetailList() { return detailList; } diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/dto/UpKeepOrderDTO.java b/op-modules/op-device/src/main/java/com/op/device/domain/dto/UpKeepOrderDTO.java new file mode 100644 index 00000000..2b33d50c --- /dev/null +++ b/op-modules/op-device/src/main/java/com/op/device/domain/dto/UpKeepOrderDTO.java @@ -0,0 +1,26 @@ +package com.op.device.domain.dto; + +import java.util.List; + +// 保养工单DTO +public class UpKeepOrderDTO { + private List ids; + + private String inspect; + + public String getInspect() { + return inspect; + } + + public void setInspect(String inspect) { + this.inspect = inspect; + } + + public List getIds() { + return ids; + } + + public void setIds(List ids) { + this.ids = ids; + } +} diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquSpareMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquSpareMapper.java index 58d5c9e6..a752d8f6 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquSpareMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquOrderEquSpareMapper.java @@ -58,4 +58,11 @@ public interface EquOrderEquSpareMapper { * @return 结果 */ public int deleteEquOrderEquSpareByIds(String[] ids); + + /** + * 通过上级表单查询备件list + * @param code + * @return + */ + List selectEquOrderEquSpareByParentCode(String code); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepOrderService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepOrderService.java index 74511196..0da3807f 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepOrderService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquUpkeepOrderService.java @@ -3,6 +3,7 @@ package com.op.device.service; import com.op.common.core.web.domain.AjaxResult; import com.op.device.domain.EquOrder; import com.op.device.domain.EquPlan; +import com.op.device.domain.dto.UpKeepOrderDTO; import java.util.List; @@ -43,7 +44,7 @@ public interface IEquUpkeepOrderService { * @param equOrder 保养工单 * @return 结果 */ - public int updateEquOrder(EquOrder equOrder); + public AjaxResult updateEquOrder(EquOrder equOrder); /** * 批量删除保养工单 @@ -60,4 +61,11 @@ public interface IEquUpkeepOrderService { * @return 结果 */ public int deleteEquOrderByOrderId(String orderId); + + /** + * 保养工单检验 + * @param upKeepOrderDTO + * @return + */ + AjaxResult subInspect(UpKeepOrderDTO upKeepOrderDTO); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java index 830b1209..0ad19c07 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java @@ -8,14 +8,11 @@ import com.baomidou.dynamic.datasource.annotation.DS; import com.op.common.core.context.SecurityContextHolder; import com.op.common.core.utils.DateUtils; import com.op.common.core.web.domain.AjaxResult; -import com.op.device.domain.EquOrderDetail; -import com.op.device.domain.EquOrderEqu; -import com.op.device.domain.EquOrderStandard; +import com.op.device.domain.*; import com.op.device.mapper.*; import com.op.system.api.domain.SysUser; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.op.device.domain.EquOrder; import com.op.device.service.IEquOrderService; import static com.op.common.core.web.domain.AjaxResult.success; @@ -40,6 +37,8 @@ public class EquOrderServiceImpl implements IEquOrderService { private EquOrderStandardMapper equOrderStandardMapper; @Autowired private PersonMapper personMapper; + @Autowired + private EquOrderEquSpareMapper equOrderEquSpareMapper; /** * 查询计划工单 @@ -71,6 +70,11 @@ public class EquOrderServiceImpl implements IEquOrderService { } equ.setDetailList(detailList); + List spareList = equOrderEquSpareMapper.selectEquOrderEquSpareByParentCode(equ.getCode()); + if (spareList.size()>0) { + equ.setSpareList(spareList); + } + // 人员信息 List users = equOrderPersonMapper.selectEquOrderPersonByOrderCode(orderCode); 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 c19ed49c..c76e5cef 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 @@ -6,6 +6,7 @@ import com.op.common.core.utils.DateUtils; import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; import com.op.device.domain.*; +import com.op.device.domain.dto.UpKeepOrderDTO; import com.op.device.mapper.*; import com.op.device.service.IEquUpkeepOrderService; import com.op.system.api.domain.SysUser; @@ -207,9 +208,26 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService { */ @Override @DS("#header.poolName") - public int updateEquOrder(EquOrder equOrder) { + public AjaxResult updateEquOrder(EquOrder equOrder) { + // 更新保养工单信息 + equOrder.setOrderStart(equOrder.getTimeArray().get(0)); + equOrder.setOrderEnd(equOrder.getTimeArray().get(1)); + equOrder.setUpdateBy(SecurityContextHolder.getUserName()); equOrder.setUpdateTime(DateUtils.getNowDate()); - return equOrderMapper.updateEquOrder(equOrder); + equOrderMapper.updateEquOrder(equOrder); + + // 更新标准信息 + EquOrderEqu equ = equOrder.getEqu(); + List detailList = equ.getDetailList(); + for (EquOrderDetail detail : detailList) { + List standardList = detail.getStandardList(); + for (EquOrderStandard standard : standardList) { + standard.setUpdateBy(SecurityContextHolder.getUserName()); + standard.setUpdateTime(DateUtils.getNowDate()); + equOrderStandardMapper.updateEquOrderStandard(standard); + } + } + return success(); } /** @@ -235,4 +253,22 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService { public int deleteEquOrderByOrderId(String orderId) { return equOrderMapper.deleteEquOrderByOrderId(orderId); } + + /** + * 保养工单检验 + * @param upKeepOrderDTO + * @return + */ + @Override + @DS("#header.poolName") + public AjaxResult subInspect(UpKeepOrderDTO upKeepOrderDTO) { + List ids = upKeepOrderDTO.getIds(); + for (String id : ids){ + EquOrder order = new EquOrder(); + order.setOrderId(id); + order.setOrderInspect(upKeepOrderDTO.getInspect()); + equOrderMapper.updateEquOrder(order); + } + return success(); + } } diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquSpareMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquSpareMapper.xml index 0b4e5fca..b191f4a0 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquSpareMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderEquSpareMapper.xml @@ -50,6 +50,11 @@ where id = #{id} + + insert into equ_order_equ_spare diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml index 2ffbdad7..a6812033 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml @@ -36,10 +36,11 @@ + - select order_id, plan_id, plan_code, plan_type, order_code, plan_workshop, plan_prod_line, plan_loop, plan_loop_type, plan_loop_start, plan_loop_end, order_start, order_end, equipment_code, order_status, order_cost, plan_person, order_cost_time, order_sign_person, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time,upkeep,calculation_rule,shut_down from equ_order + select order_id, plan_id, plan_code, plan_type, order_code, plan_workshop, plan_prod_line, plan_loop, plan_loop_type, plan_loop_start, plan_loop_end, order_start, order_end, equipment_code, order_status, order_cost, plan_person, order_cost_time, order_sign_person, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time,upkeep,calculation_rule,shut_down,order_inspect from equ_order @@ -151,6 +153,7 @@ upkeep, calculation_rule, shut_down, + order_inspect, #{orderId}, @@ -184,6 +187,7 @@ #{upkeep}, #{calculationRule}, #{shutDown}, + #{orderInspect}, @@ -220,6 +224,7 @@ upkeep = #{upkeep}, calculation_rule = #{calculationRule}, shut_down = #{shutDown}, + order_inspect = #{orderInspect}, where order_id = #{orderId}