bug修复

This commit is contained in:
luoliming 2024-01-07 19:38:16 +08:00
parent 506cf0adea
commit 48d69751d8
8 changed files with 54 additions and 10 deletions

View File

@ -171,7 +171,7 @@ public class PBomApi extends BaseApi {
}
@GetMapping("convertToMBom")
@ApiOperation("发布MBom")
@ApiOperation("MBom")
public ResultVO<Boolean> convertToMBom(@RequestParam("bomRowId") Long bomRowId) throws ExecutionException, InterruptedException {
BomNewPbomParentEntity parent = bomNewPbomParentService.getById(bomRowId);
VUtils.isTure(!parent.getMaterialNo().startsWith("31")).throwMessage("只有31开头的物料才可以发布");
@ -182,6 +182,14 @@ public class PBomApi extends BaseApi {
}
@GetMapping("realesePbom")
@ApiOperation("发布Pbom")
public ResultVO<Boolean> realesePbom(@RequestParam("bomRowId") Long bomRowId) {
return ResultVO.success(bomNewPbomParentService.realesePbom(bomRowId));
}

View File

@ -9,10 +9,11 @@ public enum PBomStatusEnum implements ValueEnum<Integer>{
//1=待发布 2=待分配工厂 3=已分配工厂 4=已发布
WAIT_PUBLISH(1,"待发布"),
WAIT_FACTORY(2,"待分配工厂"),
FACTORY_CONFIRM(3,"已分配工厂"),
BORROWED_PARTS(2, "借用件"),
PUBLISH(4,"已发布"),
BORROWED_PARTS(5, "借用件");
WAIT_FACTORY(8,"待分配工厂"),
FACTORY_CONFIRM(16,"已分配工厂");

View File

@ -29,5 +29,8 @@ public interface BomNewPbomParentMapper extends BaseMapper<BomNewPbomParentEntit
Page<BomNewPbomParentVO> releaseListByPage(Page<BomNewPbomParentQuery> page, @Param("query") BomNewPbomParentQuery query);
List<BomNewPbomParentVO> getParentChild(@Param("parentRowId") Long parentRowId);
void bomRelease(@Param("releaseUserName")String releaseUserName, @Param("rowIds") List<Long> rowIds );
void bomRelease(@Param("status") Integer status, @Param("releaseUserName")String releaseUserName, @Param("rowIds") List<Long> rowIds );
void toMBom(@Param("status") Integer status, @Param("toMBomUserName")String toMBomUserName, @Param("rowIds") List<Long> rowIds );
}

View File

@ -175,7 +175,7 @@ public class BomNewPbomParentEntity implements Serializable {
* BOM状态1=待发布 2=待分配工厂 3=已分配工厂 4=已发布
*/
@TableField(value = "status")
@ApiModelProperty(value = "BOM状态1=待发布 2=待分配工厂 3=已分配工厂 4=已发布")
@ApiModelProperty(value = "BOM状态1=待发布 4=已发布 8=待分配工厂 16=已分配工厂")
private Integer status;
/**

View File

@ -126,7 +126,7 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
/**
* BOM状态1=待发布 2=待分配工厂 3=已分配工厂 4=已发布
*/
@ApiModelProperty(value = "BOM状态1=待发布 2=待分配工厂 3=已分配工厂 4=已发布")
@ApiModelProperty(value = "BOM状态1=待发布 2-借用件 4=已发布 8=待分配工厂 16=已分配工厂")
private Integer status;
/**

View File

@ -524,7 +524,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
rootParent.setStatus(PBomStatusEnum.PUBLISH.getValue());
this.updateById(rootParent);
if(CollUtil.isNotEmpty(bomRowIds)){
this.getBaseMapper().bomRelease(SessionUtil.getRealName(),bomRowIds);
this.getBaseMapper().toMBom(PBomStatusEnum.PUBLISH.getValue(), SessionUtil.getRealName(),bomRowIds);
}
@ -532,6 +532,26 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
return true;
}
/**
* 发布Pbom
* @param bomRowId
*/
public boolean realesePbom(Long bomRowId){
BomNewPbomParentEntity parent = this.getById(bomRowId);
VUtils.isTure(Objects.isNull(parent)).throwMessage("所选BOM-不存在");
try {
List<BomNewPbomParentVO> allBom = getAllBom(bomRowId, 0);
List<Long> bomRowIds = allBom.stream().filter(u -> PBomStatusEnum.WAIT_PUBLISH.equalsValue(u.getStatus()) && u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
Integer state= parent.getMaterialNo().startsWith("31")?PBomStatusEnum.WAIT_FACTORY.getValue():PBomStatusEnum.PUBLISH.getValue();
this.getBaseMapper().bomRelease(state,SessionUtil.getUserName(),bomRowIds);
}
catch (Exception ex){
throw new NflgBusinessException(STATE.BusinessError, "发布Pbom失败"+ex.getMessage());
}
return true;
}
/**
* 获取CRM 订单号
* @param materialNo

View File

@ -99,6 +99,7 @@ public class ConvertToMBom {
mBomParent.setCreatedTime(LocalDateTime.now());
mBomParent.setModifyTime(LocalDateTime.now());
mBomParent.setSourceRowId(parent.getRowId());
mBomParent.setLastVersionIs(1);
this.mBomParentResult.add(mBomParent);
buildChild(EBomConstant.MAIN_FACTORY_CODE_1010.equals(facCode) ? allChildTreeList_1010 : allChildTreeList_1020, mBomParent.getRowId());

View File

@ -85,7 +85,7 @@
<!--获取已发布列表-->
<select id="releaseListByPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
select * , row_id as bomRowId
from t_bom_new_pbom_parent where root_is=1 and status = 4
from t_bom_new_pbom_parent where root_is=1 and status &gt;= 4
<if test="query.startDate== null">
and release_time > DATE_SUB(release_time, INTERVAL 3 DAY)
</if>
@ -106,7 +106,16 @@
</select>
<!--bom发布-->
<update id="bomRelease">
update t_bom_new_pbom_parent set status=4 , release_user_name=#{releaseUserName} , release_time=now()
update t_bom_new_pbom_parent set status=#{status} , release_user_name=#{releaseUserName} , release_time=now()
where row_id in
<foreach collection="rowIds" item="rowId" open="(" close=")" separator=",">
#{rowId}
</foreach>
</update>
<!---->
<update id="toMBom">
update t_bom_new_pbom_parent set status=#{status} , last_convert_mbom_user_name=#{toMBomUserName} , last_convert_mbom_time=now()
where row_id in
<foreach collection="rowIds" item="rowId" open="(" close=")" separator=",">
#{rowId}
@ -114,4 +123,6 @@
</update>
</mapper>