fix: 原始bom转换ebom后重新设置是否有bom

This commit is contained in:
曹鹏飞 2024-04-15 10:03:53 +08:00
parent 3a82521c3a
commit 3c8d341bdb
5 changed files with 29 additions and 5 deletions

View File

@ -176,6 +176,8 @@ public class OriginalBomApi extends BaseApi {
ebomParentService.getBaseMapper().updateRootState(); ebomParentService.getBaseMapper().updateRootState();
ebomParentService.getBaseMapper().updateRootForWaitReview(); ebomParentService.getBaseMapper().updateRootForWaitReview();
ebomParentService.resetAllBomExist();
return ResultVO.success(result); return ResultVO.success(result);
} }

View File

@ -4,8 +4,10 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery; import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery; import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.pojo.vo.*; import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO;
import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO;
import com.nflg.product.bomnew.pojo.vo.ReverseReportVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection; import java.util.Collection;
@ -74,4 +76,6 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
void resetBomExist(Long rowId); void resetBomExist(Long rowId);
Set<String> getMaterialParent(@Param("materialNos") Collection<String> materialNos ,@Param("createdBy") String createdBy); Set<String> getMaterialParent(@Param("materialNos") Collection<String> materialNos ,@Param("createdBy") String createdBy);
void resetAllBomExist();
} }

View File

@ -2045,7 +2045,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
LogRecordContext.putVariable("bom", ent); LogRecordContext.putVariable("bom", ent);
} }
private void resetBomExist(Long rowId) { /**
* 重置BOM存在状态
* @param rowId 父级节点rowId
*/
public void resetBomExist(Long rowId) {
log.debug("resetBomExist{}", rowId);
this.getBaseMapper().resetBomExist(rowId); this.getBaseMapper().resetBomExist(rowId);
} }
/**
* 重置所有BOM存在状态
*/
public void resetAllBomExist() {
log.debug("resetAllBomExist");
this.getBaseMapper().resetAllBomExist();
}
} }

View File

@ -306,7 +306,6 @@ public class OriginalBomToEBomConvert extends BaseConvert {
// this.eBomChildResult.add(childEntity); // this.eBomChildResult.add(childEntity);
return childEntity; return childEntity;
} }
/** /**
@ -327,7 +326,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
eBomParent.setSourceRowId(parentEnt.getBomRowId()); eBomParent.setSourceRowId(parentEnt.getBomRowId());
eBomParent.setLastVersionIs(1); eBomParent.setLastVersionIs(1);
eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue()); eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
eBomParent.setModifyTime(LocalDateTime.now()); //eBomParent.setModifyTime(LocalDateTime.now());
eBomParent.setBomExist(parentEnt.getBomRowId() > 0 ? 1 : 0); eBomParent.setBomExist(parentEnt.getBomRowId() > 0 ? 1 : 0);
eBomParent.setDeviseName(SessionUtil.getRealName()); eBomParent.setDeviseName(SessionUtil.getRealName());
eBomParent.setDeptName(SessionUtil.getDepartName()); eBomParent.setDeptName(SessionUtil.getDepartName());

View File

@ -353,4 +353,10 @@
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_ebom_child WHERE parent_row_id = p.row_id), 1, 0)) SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_ebom_child WHERE parent_row_id = p.row_id), 1, 0))
WHERE p.row_id = #{rowId}; WHERE p.row_id = #{rowId};
</select> </select>
<select id="resetAllBomExist">
UPDATE t_bom_new_ebom_parent p
SET p.bom_exist = (IF(EXISTS (SELECT 1 FROM t_bom_new_ebom_child WHERE parent_row_id = p.row_id), 1, 0))
WHERE p.status &lt; 4;
</select>
</mapper> </mapper>