Merge branch 'refs/heads/feature/DM/nflg-bom' into feature/DM/nflg-bom-transition

# Conflicts:
#	nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/mapper/master/BomNewEbomParentMapper.java
This commit is contained in:
曹鹏飞 2024-05-30 10:22:38 +08:00
commit 2844382d1d
11 changed files with 37 additions and 15 deletions

View File

@ -13,7 +13,7 @@ public enum SapStatusEnum implements ValueEnum<Integer> {
UNPUB_SAP(1, "未导入"),
PUB_RUNNING(2, "导入中"),
PUB_SAP(3, "已导入"),
PUB_SUCCESS(3, "全部导入成功"),
PUB_ERROR(4, "部分导入失败"),
PUB_ERROR_ALL(5, "全部导入失败");

View File

@ -103,6 +103,10 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
void delEBomHistory(@Param("parentRowIds") List<Long> parentRowIds);
Page<BomNewEbomParentVO> getSapErrorWorksheet(Page<Object> objectPage, String userCode);
Integer getSapErrorNum(String userCode);
List<BomNewEbomParentEntity> getLatestByMaterialNo(Collection<String> materialNos);
void updateLastVersionIs();

View File

@ -273,8 +273,8 @@ public class BomNewMbomMiddleVO extends BaseMaterialVO implements Serializable {
public String getStatusName(){
if(materialBackStatus==null || materialBackStatus.equals(MBomConstantEnum.MaterialBackStatusEnum.APPLY_0.getValue())){
if (SapStatusEnum.PUB_SAP.getValue().equals(status)) {
return SapStatusEnum.PUB_SAP.getDescription();
if (SapStatusEnum.PUB_SUCCESS.getValue().equals(status)) {
return SapStatusEnum.PUB_SUCCESS.getDescription();
}
return MBomConstantEnum.MaterialBackStatusEnum.APPLY_0.getDescription();

View File

@ -306,9 +306,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
* @return
*/
public Page<BomNewEbomParentVO> formalWorksheet(BomNewEbomParentQuery query) {
Page<BomNewEbomParentVO> result = this.getBaseMapper().formalWorksheet(new Page<>(query.getPage(), query.getPageSize()), query, SessionUtil.getUserCode());
Page<BomNewEbomParentVO> result = new Page<>();
if (StrUtil.equals(query.getMaterialNo(), "0")) {
result = this.getBaseMapper().getSapErrorWorksheet(new Page<>(query.getPage(), query.getPageSize()), SessionUtil.getUserCode());
} else {
result = this.getBaseMapper().formalWorksheet(new Page<>(query.getPage(), query.getPageSize()), query, SessionUtil.getUserCode());
}
if (CollUtil.isNotEmpty(result.getRecords())) {
materialMainService.intiMaterialInfo(result.getRecords());
}
@ -970,7 +973,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
updateSapState(rootBomRowId, SapStatusEnum.PUB_RUNNING);
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
if (CollUtil.isEmpty(liErrMsg)) {
state = SapStatusEnum.PUB_SAP;
state = SapStatusEnum.PUB_SUCCESS;
} else if (sapDto.getT1().size() != liErrMsg.size()) {
state = SapStatusEnum.PUB_ERROR;
}
@ -2536,7 +2539,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
public Integer getSapErrorNum() {
return bomNewSapErrorMsgService.lambdaQuery().eq(BomNewSapErrorMsgEntity::getType, 0).count();
//return bomNewSapErrorMsgService.lambdaQuery().eq(BomNewSapErrorMsgEntity::getType, 0).count();
return this.getBaseMapper().getSapErrorNum(SessionUtil.getUserCode());
}
public List<OperationErrorMsgVO> getSapError(Long rowId) {

View File

@ -89,7 +89,7 @@ public class BomNewMbomDetailService extends ServiceImpl<BomNewMbomDetailMapper,
throw new NflgBusinessException(STATE.Error, "顶层数据不存在");
}
if (Objects.equals(SapStatusEnum.PUB_SAP.getValue(), parentEntity.getStatus())) {
if (Objects.equals(SapStatusEnum.PUB_SUCCESS.getValue(), parentEntity.getStatus())) {
throw new NflgBusinessException(STATE.Error, "已发布数据不能操作");
}

View File

@ -118,7 +118,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
public Page<BomNewMbomMiddleVO> formalListPage(BomNewMbomParentQuery query) {
query.setStatus(SapStatusEnum.PUB_SAP.getValue());
query.setStatus(SapStatusEnum.PUB_SUCCESS.getValue());
List<String> facCode= SpringUtil.getBean(UserRoleService.class).getUserOfFactory();
String code= StrUtil.join(",",facCode);
query.setFacCode(code);
@ -306,7 +306,7 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
updateSapState(parentVO.getRowId(), SapStatusEnum.PUB_RUNNING);
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(result, null);
if (CollUtil.isEmpty(liErrMsg)) {
state = SapStatusEnum.PUB_SAP;
state = SapStatusEnum.PUB_SUCCESS;
} else if (result.getT1().size() != liErrMsg.size()) {
state = SapStatusEnum.PUB_ERROR;
}

View File

@ -1134,7 +1134,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
updateSapState(rootRowId, SapStatusEnum.PUB_RUNNING);
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
if (CollUtil.isEmpty(liErrMsg)) {
state = SapStatusEnum.PUB_SAP;
state = SapStatusEnum.PUB_SUCCESS;
} else if (sapDto.getT1().size() != liErrMsg.size()) {
state = SapStatusEnum.PUB_ERROR;
}

View File

@ -435,7 +435,7 @@ public class DQBomService {
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null);
log.debug("本次导入到sap数量共{}个,其中{}个有错误", sapDto.getT1().size(), liErrMsg.size());
if (CollUtil.isEmpty(liErrMsg)) {
state = SapStatusEnum.PUB_SAP;
state = SapStatusEnum.PUB_SUCCESS;
} else if (sapDto.getT1().size() != liErrMsg.size()) {
state = SapStatusEnum.PUB_ERROR;
}

View File

@ -170,7 +170,7 @@ public class OptionalMbomMaterialService extends ServiceImpl<OptionalMbomMateria
updateSapState(entity.getRootRowId(), SapStatusEnum.PUB_RUNNING);
liErrMsg = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(result, null);
if (CollUtil.isEmpty(liErrMsg)) {
state = SapStatusEnum.PUB_SAP;
state = SapStatusEnum.PUB_SUCCESS;
} else if (result.getT1().size() != liErrMsg.size()) {
state = SapStatusEnum.PUB_ERROR;
}

View File

@ -78,7 +78,7 @@ public class ConvertToMBomBase {
BomNewMbomParentEntity oldParent = SpringUtil.getBean(BomNewMbomParentService.class).lambdaQuery().eq(BomNewMbomParentEntity::getMaterialNo, parent.getMaterialNo()).eq(BomNewMbomParentEntity::getFacCode, facCode)
.last(" order by current_version desc limit 1").one();
if (Objects.nonNull(oldParent)) {
if (SapStatusEnum.PUB_SAP.equalsValue(oldParent.getStatus())) {
if (SapStatusEnum.PUB_SUCCESS.equalsValue(oldParent.getStatus())) {
//将数据迁移到历史表
SpringUtil.getBean(BomNewMbomParentService.class).getBaseMapper().insertMBomIntoHistory(oldParent.getRowId());

View File

@ -490,6 +490,20 @@
LEFT JOIN t_bom_new_ebom_child b ON a.material_no = b.material_no
WHERE a.row_id = #{parentRowId}
</select>
<select id="getSapErrorWorksheet" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
SELECT *, row_id AS bomRowId
FROM t_bom_new_ebom_parent
WHERE status = 4
AND (root_is = 1 OR user_root_is = 1)
AND sap_state > 3
AND created_by = #{userCode}
</select>
<select id="getSapErrorNum" resultType="java.lang.Integer">
SELECT COUNT(1)
FROM t_bom_new_ebom_parent p
INNER JOIN t_bom_new_sap_error_msg e ON p.row_id = e.target_row_id AND e.type = 0
WHERE p.created_by = #{userCode}
</select>
<select id="getLatestByMaterialNo" resultType="com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity">
SELECT p1.*