feat: ebom编辑页面也需要跟电气专用bom的编辑页面一样有父级异常导航

This commit is contained in:
曹鹏飞 2024-05-07 11:08:50 +08:00
parent 5a9948635e
commit ca66acc0a3
3 changed files with 46 additions and 11 deletions

View File

@ -10,12 +10,10 @@ import com.mzt.logapi.starter.annotation.LogRecord;
import com.nflg.product.base.core.api.BaseApi;
import com.nflg.product.base.core.conmon.util.SessionUtil;
import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomEditDetailVO;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO;
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.*;
import com.nflg.product.bomnew.util.EecExcelUtil;
import com.nflg.product.bomnew.util.VUtils;
@ -411,7 +409,7 @@ public class EbomApi extends BaseApi {
@PostMapping("intiException")
@ApiOperation("初始化错误类型")
@LogRecord(success = "Ebom-初始化错误类型,操作结果:{{#_ret}}", bizNo = "{{#bomRowIds.toString()}}", type = "Ebom-初始化错误类型")
public ResultVO<Boolean> intiException(@RequestBody List<Long> bomRowIds) throws ExecutionException, InterruptedException {
public ResultVO<Boolean> intiException(@RequestBody List<Long> bomRowIds) {
bomNewEbomParentService.batchCheckAndSaveEBomException(bomRowIds);
return ResultVO.success(true);
@ -464,4 +462,15 @@ public class EbomApi extends BaseApi {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条");
return bomNewEbomParentService.importToSAP(rootBomRowIds.get(0));
}
/**
* 获取节点异常状态
* @param query query
* @return 节点异常状态
*/
@PostMapping("getBomException")
@ApiOperation("获取节点异常状态")
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
return ResultVO.success(bomNewEbomParentService.getBomException(query));
}
}

View File

@ -24,6 +24,7 @@ import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
import com.nflg.product.bomnew.pojo.entity.*;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
import com.nflg.product.bomnew.pojo.vo.*;
@ -527,10 +528,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
*
* @param rowId
* @return
* @throws ExecutionException
* @throws InterruptedException
*/
public List<BomNewEbomParentVO> getBomTree(Long rowId, Boolean generateLevelNumberFlag) throws ExecutionException, InterruptedException {
public List<BomNewEbomParentVO> getBomTree(Long rowId, Boolean generateLevelNumberFlag) {
List<BomNewEbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
// EBomDetailTask detailTask = new EBomDetailTask(bomDetail);
@ -719,7 +718,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
/**
* 检查 并保存异常信息
*/
public void batchCheckAndSaveEBomException(List<Long> bomRowIds) throws ExecutionException, InterruptedException {
public void batchCheckAndSaveEBomException(List<Long> bomRowIds) {
for (Long bomRowId : bomRowIds) {
CheckEBomException checkEBomException = new CheckEBomException(bomRowId);
checkEBomException.initException();
@ -2258,4 +2257,32 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
});
}
public List<BomExceptionVO> getBomException(List<BomExceptionQuery> query) {
List<BomExceptionVO> datas = new ArrayList<>();
for (int index = 0, count = query.size(); index < count; index++) {
BomExceptionQuery bom = query.get(index);
BomExceptionVO vo = new BomExceptionVO();
if (index == 0) {
batchCheckAndSaveEBomException(Collections.singletonList(bom.getBomRowId()));
BomNewEbomParentEntity parent = getById(bom.getBomRowId());
vo.setMaterialNo(parent.getMaterialNo());
vo.setExceptionStatus(parent.getExceptionStatus());
} else {
BomNewEbomChildEntity child = ebomChildService.getById(bom.getRowId());
vo.setMaterialNo(child.getMaterialNo());
if (Objects.equals(child.getExceptionStatus(), EBomExceptionStatusEnum.OK.getValue())) {
BomNewEbomParentEntity parent = getById(bom.getBomRowId());
vo.setExceptionStatus(parent.getExceptionStatus());
} else {
vo.setExceptionStatus(child.getExceptionStatus());
}
}
vo.setBomRowId(bom.getBomRowId());
vo.setRowId(bom.getRowId());
datas.add(vo);
}
return datas;
}
}

View File

@ -21,7 +21,6 @@ import nflg.product.common.constant.STATE;
import java.math.BigDecimal;
import java.util.*;
import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors;
/**
@ -53,7 +52,7 @@ public class CheckEBomException {
}
public CheckEBomException(Long bomRowId) throws ExecutionException, InterruptedException {
public CheckEBomException(Long bomRowId) {
allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId, true);
//只检查待复核和自己的