diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MaWhole.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MaWhole.java index 1bcd1de..bafc183 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MaWhole.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/domain/MaWhole.java @@ -57,5 +57,8 @@ public class MaWhole { /** 创建人 */ @ApiModelProperty(value = "创建人") private Integer createBy; + /** 是否是成套设备(1:是 ) */ + @ApiModelProperty(value = "是否是成套设备(1:是 )") + private Integer isWholeSet; } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/MaWholeSetMapper.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/MaWholeSetMapper.java index 6868a60..5a36464 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/MaWholeSetMapper.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/mapper/MaWholeSetMapper.java @@ -54,6 +54,7 @@ public interface MaWholeSetMapper { * @return */ List selectTypeId(@Param("id") Integer id); + List selectAllTypeId(); /** * 先根据id去查询物质类型树 @@ -79,4 +80,8 @@ public interface MaWholeSetMapper { int selectByWholeTypeName(MaWholeSetDto wholeTypeName); List selectListByWholeTypeName(MaWholeSetDto wholeTypeName); + + void updateMaType(MaWhole maWhole); + + void updateMaType1(); } diff --git a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/MaWholeSetServiceImpl.java b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/MaWholeSetServiceImpl.java index f1ade54..e700b50 100644 --- a/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/MaWholeSetServiceImpl.java +++ b/sgzb-modules/sgzb-material/src/main/java/com/bonus/sgzb/material/service/impl/MaWholeSetServiceImpl.java @@ -18,6 +18,7 @@ import java.util.List; /** * 整套抱杆操作实现层 + * * @Author ma_sh * @create 2024/4/15 17:17 */ @@ -30,6 +31,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { /** * 新增整套抱杆管理 + * * @param dto * @return */ @@ -57,6 +59,10 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { int res = 0; try { res = insertMaWholeSet(dto.getDeviceInfo()); + // 将机具类型标记为成套设备(无法领料) + //先查出所有的typeId + List typeIdList = mapper.selectAllTypeId(); + updateMaType(typeIdList); if (res == 0) { log.error("insertMaWholeSet方法插入异常"); throw new RuntimeException("insertMaWholeSet方法插入异常"); @@ -71,6 +77,14 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { } } + private void updateMaType(List deviceInfo) { + // 先全部置为null + mapper.updateMaType1(); + for (MaWhole maWhole : deviceInfo) { + mapper.updateMaType(maWhole); + } + } + private int selectByWholeTypeName(MaWholeSetDto wholeTypeName) { return mapper.selectByWholeTypeName(wholeTypeName); } @@ -88,6 +102,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { /** * 查询整套抱杆明细 + * * @param dto * @return */ @@ -98,6 +113,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { /** * 根据id删除 + * * @param dto * @return */ @@ -110,6 +126,10 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { int res = 0; try { res = deleteMaWhole(dto); + // 将机具类型标记为成套设备(无法领料) + //先查出所有的typeId + List typeIdList = mapper.selectAllTypeId(); + updateMaType(typeIdList); if (res == 0) { throw new RuntimeException("删除失败"); } @@ -122,6 +142,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { /** * 根据id删除整套配件信息 + * * @param * @return */ @@ -131,6 +152,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { /** * 修改整套抱杆管理 + * * @param dto * @return */ @@ -150,6 +172,10 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { try { deleteMaWhole(dto); res = insertMaWholeSet(dto.getDeviceInfo()); + // 将机具类型标记为成套设备(无法领料) + //先查出所有的typeId + List typeIdList = mapper.selectAllTypeId(); + updateMaType(typeIdList); if (res == 0) { log.error("insertMaWholeSet方法插入异常"); throw new RuntimeException("insertMaWholeSet方法插入异常"); @@ -169,6 +195,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { /** * 修改时查询整套抱杆明细 + * * @param id * @return */ @@ -205,6 +232,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService { /** * 根据parentId查询,去重 + * * @param parentId * @return */ diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/MaWholeSetMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/MaWholeSetMapper.xml index 36fd7db..0c821c7 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/MaWholeSetMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/MaWholeSetMapper.xml @@ -45,6 +45,15 @@ values(#{item.typeId},#{item.parentId},#{item.totalNum},#{item.wholeTypeName},#{item.createBy},#{item.ascriptionType}, now(),1) + + update ma_type + set is_whole_set = 1 + where type_id = #{typeId} + + + update ma_type + set is_whole_set = null + delete from ma_whole_set where parent_id = #{id} @@ -180,11 +189,12 @@ LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id LEFT JOIN ma_whole_set mws2 ON mws2.type_id = mt.type_id AND mws2.whole_type_name = #{wholeTypeName} - AND mws2.company_id = #{companyId} WHERE mt.type_id IN ( SELECT mws.type_id FROM ma_whole_set mws WHERE mws.whole_type_name = #{wholeTypeName}) AND mt.`status` = '0' AND mt.del_flag = '0' - + \ No newline at end of file diff --git a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SelectMapper.xml b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SelectMapper.xml index 28b94c2..b8e2c79 100644 --- a/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SelectMapper.xml +++ b/sgzb-modules/sgzb-material/src/main/resources/mapper/material/SelectMapper.xml @@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id WHERE mm.ma_code is not null and mm.ma_status in (15) GROUP BY mt.type_id) AS subquery0 ON subquery0.type_id = mt.type_id - WHERE mt.del_flag = '0' + WHERE mt.del_flag = '0' and mt.is_whole_set IS NULL AND mt.level IN ('1','2')