diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java index 9ff9a90a..91130479 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquCheckItemController.java @@ -114,6 +114,6 @@ public class EquCheckItemController extends BaseController { @Log(title = "检查项维护", businessType = BusinessType.DELETE) @DeleteMapping("/{itemIds}") public AjaxResult remove(@PathVariable String[] itemIds) { - return toAjax(equCheckItemService.deleteEquCheckItemByItemIds(itemIds)); + return equCheckItemService.deleteEquCheckItemByItemIds(itemIds); } } 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 10220ddb..9a30ef5c 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 @@ -137,6 +137,16 @@ public class EquPlan extends BaseEntity { private List personListVO; + private String workCenterName; + + public String getWorkCenterName() { + return workCenterName; + } + + public void setWorkCenterName(String workCenterName) { + this.workCenterName = workCenterName; + } + public List getPersonListVO() { return personListVO; } diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java index 2baa336e..cb2e59c0 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquCheckItemMapper.java @@ -3,6 +3,7 @@ package com.op.device.mapper; import java.util.List; import com.op.device.domain.EquCheckItem; +import com.op.device.domain.EquPlanDetail; import com.op.device.domain.vo.EquCheckItemVO; /** @@ -85,4 +86,11 @@ public interface EquCheckItemMapper { * @return */ List selectCheckItemByEquipmentCode(String equipmentCode); + + /** + * 检验计划里是否有 + * @param itemCode + * @return + */ + List checkDelItem(String itemCode); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java b/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java index d493ec69..b3df8267 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/IEquCheckItemService.java @@ -52,7 +52,7 @@ public interface IEquCheckItemService { * @param itemIds 需要删除的检查项维护主键集合 * @return 结果 */ - public int deleteEquCheckItemByItemIds(String[] itemIds); + public AjaxResult deleteEquCheckItemByItemIds(String[] itemIds); /** * 删除检查项维护信息 diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java index 4ddaab8e..9c2691ed 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquCheckItemServiceImpl.java @@ -11,6 +11,7 @@ import com.op.common.core.utils.uuid.IdUtils; import com.op.common.core.web.domain.AjaxResult; import com.op.device.domain.EquCheckItemDetail; import com.op.device.domain.EquItemEquipment; +import com.op.device.domain.EquPlanDetail; import com.op.device.domain.dto.EquCheckItemDTO; import com.op.device.domain.vo.EquCheckItemVO; import com.op.device.mapper.EquCheckItemDetailMapper; @@ -284,14 +285,26 @@ public class EquCheckItemServiceImpl implements IEquCheckItemService { */ @Override @DS("#header.poolName") - public int deleteEquCheckItemByItemIds(String[] itemIds) { + public AjaxResult deleteEquCheckItemByItemIds(String[] itemIds) { + + // 检验 + for (String data : itemIds) { + // 检验 + EquCheckItem equCheckItem = equCheckItemMapper.selectEquCheckItemByItemId(data); + List checkItemList = equCheckItemMapper.checkDelItem(equCheckItem.getItemCode()); + if (checkItemList.size() > 0) { + return error(500,"该检查项已有计划使用,删除失败!"); + } + } + for (String data : itemIds) { // 逻辑删除检查项详情信息 equCheckItemDetailMapper.delEquCheckItemDetailByItemId(data); // 逻辑删除设备关联 equItemEquipmentMapper.delEquItemEquipmentByItemId(data); } - return equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds); + equCheckItemMapper.deleteEquCheckItemByItemIds(itemIds); + return success("删除成功!"); } /** diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml index 73bb9b7e..8f9380fc 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquCheckItemMapper.xml @@ -77,6 +77,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where item_code in ( select item_code from equ_item_equipment where equipment_code = #{equipmentCode} and del_flag = '0' ) and del_flag = '0' + + insert into equ_check_item diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquPlanEquMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquPlanEquMapper.xml index 8813f53e..a8e0cfec 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquPlanEquMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquPlanEquMapper.xml @@ -38,12 +38,13 @@ and attr1 = #{attr1} and attr2 = #{attr2} and attr3 = #{attr3} + and del_flag = '0'