机具绑定成套后无法领料修改

This commit is contained in:
liang.chao 2024-09-30 17:39:50 +08:00
parent c1f82de915
commit 5823ed3eaf
5 changed files with 49 additions and 3 deletions

View File

@ -57,5 +57,8 @@ public class MaWhole {
/** 创建人 */ /** 创建人 */
@ApiModelProperty(value = "创建人") @ApiModelProperty(value = "创建人")
private Integer createBy; private Integer createBy;
/** 是否是成套设备1 */
@ApiModelProperty(value = "是否是成套设备1")
private Integer isWholeSet;
} }

View File

@ -54,6 +54,7 @@ public interface MaWholeSetMapper {
* @return * @return
*/ */
List<Integer> selectTypeId(@Param("id") Integer id); List<Integer> selectTypeId(@Param("id") Integer id);
List<MaWhole> selectAllTypeId();
/** /**
* 先根据id去查询物质类型树 * 先根据id去查询物质类型树
@ -79,4 +80,8 @@ public interface MaWholeSetMapper {
int selectByWholeTypeName(MaWholeSetDto wholeTypeName); int selectByWholeTypeName(MaWholeSetDto wholeTypeName);
List<LeaseApplyDetails> selectListByWholeTypeName(MaWholeSetDto wholeTypeName); List<LeaseApplyDetails> selectListByWholeTypeName(MaWholeSetDto wholeTypeName);
void updateMaType(MaWhole maWhole);
void updateMaType1();
} }

View File

@ -18,6 +18,7 @@ import java.util.List;
/** /**
* 整套抱杆操作实现层 * 整套抱杆操作实现层
*
* @Author ma_sh * @Author ma_sh
* @create 2024/4/15 17:17 * @create 2024/4/15 17:17
*/ */
@ -30,6 +31,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
/** /**
* 新增整套抱杆管理 * 新增整套抱杆管理
*
* @param dto * @param dto
* @return * @return
*/ */
@ -57,6 +59,10 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
int res = 0; int res = 0;
try { try {
res = insertMaWholeSet(dto.getDeviceInfo()); res = insertMaWholeSet(dto.getDeviceInfo());
// 将机具类型标记为成套设备无法领料
//先查出所有的typeId
List<MaWhole> typeIdList = mapper.selectAllTypeId();
updateMaType(typeIdList);
if (res == 0) { if (res == 0) {
log.error("insertMaWholeSet方法插入异常"); log.error("insertMaWholeSet方法插入异常");
throw new RuntimeException("insertMaWholeSet方法插入异常"); throw new RuntimeException("insertMaWholeSet方法插入异常");
@ -71,6 +77,14 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
} }
} }
private void updateMaType(List<MaWhole> deviceInfo) {
// 先全部置为null
mapper.updateMaType1();
for (MaWhole maWhole : deviceInfo) {
mapper.updateMaType(maWhole);
}
}
private int selectByWholeTypeName(MaWholeSetDto wholeTypeName) { private int selectByWholeTypeName(MaWholeSetDto wholeTypeName) {
return mapper.selectByWholeTypeName(wholeTypeName); return mapper.selectByWholeTypeName(wholeTypeName);
} }
@ -88,6 +102,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
/** /**
* 查询整套抱杆明细 * 查询整套抱杆明细
*
* @param dto * @param dto
* @return * @return
*/ */
@ -98,6 +113,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
/** /**
* 根据id删除 * 根据id删除
*
* @param dto * @param dto
* @return * @return
*/ */
@ -110,6 +126,10 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
int res = 0; int res = 0;
try { try {
res = deleteMaWhole(dto); res = deleteMaWhole(dto);
// 将机具类型标记为成套设备无法领料
//先查出所有的typeId
List<MaWhole> typeIdList = mapper.selectAllTypeId();
updateMaType(typeIdList);
if (res == 0) { if (res == 0) {
throw new RuntimeException("删除失败"); throw new RuntimeException("删除失败");
} }
@ -122,6 +142,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
/** /**
* 根据id删除整套配件信息 * 根据id删除整套配件信息
*
* @param * @param
* @return * @return
*/ */
@ -131,6 +152,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
/** /**
* 修改整套抱杆管理 * 修改整套抱杆管理
*
* @param dto * @param dto
* @return * @return
*/ */
@ -150,6 +172,10 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
try { try {
deleteMaWhole(dto); deleteMaWhole(dto);
res = insertMaWholeSet(dto.getDeviceInfo()); res = insertMaWholeSet(dto.getDeviceInfo());
// 将机具类型标记为成套设备无法领料
//先查出所有的typeId
List<MaWhole> typeIdList = mapper.selectAllTypeId();
updateMaType(typeIdList);
if (res == 0) { if (res == 0) {
log.error("insertMaWholeSet方法插入异常"); log.error("insertMaWholeSet方法插入异常");
throw new RuntimeException("insertMaWholeSet方法插入异常"); throw new RuntimeException("insertMaWholeSet方法插入异常");
@ -169,6 +195,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
/** /**
* 修改时查询整套抱杆明细 * 修改时查询整套抱杆明细
*
* @param id * @param id
* @return * @return
*/ */
@ -205,6 +232,7 @@ public class MaWholeSetServiceImpl implements MaWholeSetService {
/** /**
* 根据parentId查询去重 * 根据parentId查询去重
*
* @param parentId * @param parentId
* @return * @return
*/ */

View File

@ -45,6 +45,15 @@
values(#{item.typeId},#{item.parentId},#{item.totalNum},#{item.wholeTypeName},#{item.createBy},#{item.ascriptionType}, now(),1) values(#{item.typeId},#{item.parentId},#{item.totalNum},#{item.wholeTypeName},#{item.createBy},#{item.ascriptionType}, now(),1)
</foreach> </foreach>
</insert> </insert>
<update id="updateMaType">
update ma_type
set is_whole_set = 1
where type_id = #{typeId}
</update>
<update id="updateMaType1">
update ma_type
set is_whole_set = null
</update>
<delete id="deleteById"> <delete id="deleteById">
delete from ma_whole_set delete from ma_whole_set
where parent_id = #{id} where parent_id = #{id}
@ -180,11 +189,12 @@
LEFT JOIN ma_type mt2 ON mt.parent_id = mt2.type_id 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 LEFT JOIN ma_whole_set mws2 ON mws2.type_id = mt.type_id
AND mws2.whole_type_name = #{wholeTypeName} AND mws2.whole_type_name = #{wholeTypeName}
AND mws2.company_id = #{companyId}
WHERE WHERE
mt.type_id IN ( SELECT mws.type_id FROM ma_whole_set mws WHERE mws.whole_type_name = #{wholeTypeName}) 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.`status` = '0'
AND mt.del_flag = '0' AND mt.del_flag = '0'
</select> </select>
<select id="selectAllTypeId" resultType="com.bonus.sgzb.material.domain.MaWhole">
select type_id from ma_whole_set
</select>
</mapper> </mapper>

View File

@ -114,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
LEFT JOIN ma_type mt2 ON mt2.type_id = mt.parent_id 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) 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 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
<if test="level!=null and level!=''"> <if test="level!=null and level!=''">
<if test="level == 2"> <if test="level == 2">
AND mt.level IN ('1','2') AND mt.level IN ('1','2')