fix: 电气bom优化

This commit is contained in:
曹鹏飞 2024-04-25 16:55:54 +08:00
parent 25ea8efdf4
commit beedcbeb27
4 changed files with 16 additions and 7 deletions

View File

@ -15,6 +15,7 @@ import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.DQBomImportService; import com.nflg.product.bomnew.service.DQBomImportService;
import com.nflg.product.bomnew.service.DQBomService; import com.nflg.product.bomnew.service.DQBomService;
import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.EecExcelUtil;
import com.nflg.product.bomnew.util.VUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO; import nflg.product.common.vo.ResultVO;
@ -139,7 +140,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("checkException") @PostMapping("checkException")
@ApiOperation("异常检查") @ApiOperation("异常检查")
public ResultVO<String> checkException(@Valid @RequestBody @NotEmpty List<Long> bomRowIds) { public ResultVO<String> checkException(@Valid @RequestBody @NotEmpty List<Long> bomRowIds) {
dQBomService.checkException(bomRowIds.get(0)); bomRowIds.forEach(dQBomService::checkException);
return ResultVO.success(); return ResultVO.success();
} }
@ -151,7 +152,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("deleteBom") @PostMapping("deleteBom")
@ApiOperation("删除bom") @ApiOperation("删除bom")
public ResultVO<String> deleteBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) { public ResultVO<String> deleteBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
dQBomService.deleteBom(rootBomRowIds.get(0)); rootBomRowIds.forEach(dQBomService::deleteBom);
return ResultVO.success(); return ResultVO.success();
} }
@ -163,6 +164,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("exportBom") @PostMapping("exportBom")
@ApiOperation("导出bom") @ApiOperation("导出bom")
public void exportBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds, HttpServletResponse response) throws IOException { public void exportBom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds, HttpServletResponse response) throws IOException {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导出1条");
List<DQbomExcelVO> data = dQBomService.exportBom(rootBomRowIds.get(0)); List<DQbomExcelVO> data = dQBomService.exportBom(rootBomRowIds.get(0));
EecExcelUtil.export(response, data, DQbomExcelVO.class, "电气专用bom"); EecExcelUtil.export(response, data, DQbomExcelVO.class, "电气专用bom");
} }
@ -175,7 +177,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("convertToPbom") @PostMapping("convertToPbom")
@ApiOperation("生成pbom") @ApiOperation("生成pbom")
public ResultVO convertToPbom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) { public ResultVO convertToPbom(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
dQBomService.convertToPbom(rootBomRowIds.get(0)); rootBomRowIds.forEach(dQBomService::convertToPbom);
return ResultVO.success(); return ResultVO.success();
} }
@ -211,6 +213,7 @@ public class DQBomApi extends BaseApi {
@PostMapping("importToSAP") @PostMapping("importToSAP")
@ApiOperation("导入到SAP") @ApiOperation("导入到SAP")
public ResultVO<Boolean> importToSAP(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) { public ResultVO<Boolean> importToSAP(@Valid @RequestBody @NotEmpty List<Long> rootBomRowIds) {
VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条");
return dQBomService.importToSAP(rootBomRowIds.get(0)); return dQBomService.importToSAP(rootBomRowIds.get(0));
} }

View File

@ -130,7 +130,8 @@ public class BomNewDQbomExceptionCheckService {
// } else if (parent.getMaterialNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) { // } else if (parent.getMaterialNo().startsWith(BomConstant.NO_TEMPORARY_PREFIX)) {
// status = EBomExceptionStatusEnum.EXCEPT_NO_4; // status = EBomExceptionStatusEnum.EXCEPT_NO_4;
} else { } else {
BaseMaterialVO materialVO = materialVOS.stream().filter(v -> v.getMaterialNo().equals(parent.getMaterialNo())) BaseMaterialVO materialVO = materialVOS.stream()
.filter(v -> v.getMaterialNo().equals(parent.getMaterialNo()))
.findFirst() .findFirst()
.orElse(null); .orElse(null);
if (materialVO == null) { if (materialVO == null) {

View File

@ -375,6 +375,10 @@ public class DQBomImportService {
dQbomExcelVO.setNum(BigDecimal.ONE); dQbomExcelVO.setNum(BigDecimal.ONE);
} }
} }
if (StrUtil.equals(dQbomExcelVO.getMaterialNo(), "9000000000")) {
dQbomExcelVO.setProjectType("T");
}
dQbomExcelVO.setCurrentVersion("");
excelContextTL.get().add(dQbomExcelVO); excelContextTL.get().add(dQbomExcelVO);
} }

View File

@ -224,8 +224,9 @@ public class DQBomService {
if (Objects.isNull(query.getParent()) || query.getParent().getBomRowId() == 0) { if (Objects.isNull(query.getParent()) || query.getParent().getBomRowId() == 0) {
//新增父级节点 //新增父级节点
BomNewDQbomParentEntity oldParent = dQBomParentService.lambdaQuery().eq(BomNewDQbomParentEntity::getMaterialNo, query.getParent().getMaterialNo()) BomNewDQbomParentEntity oldParent = dQBomParentService.lambdaQuery()
.eq(BomNewDQbomParentEntity::getLastVersionIs, 1) .eq(BomNewDQbomParentEntity::getMaterialNo, query.getParent().getMaterialNo())
.eq(BomNewDQbomParentEntity::getStatus, DQBomStatusEnum.WAIT_CONVERT.getValue())
.one(); .one();
VUtils.isTure(oldParent != null && !oldParent.getCreatedBy().equals(SessionUtil.getUserCode())) VUtils.isTure(oldParent != null && !oldParent.getCreatedBy().equals(SessionUtil.getUserCode()))
.throwMessage("父级已被其他人创建"); .throwMessage("父级已被其他人创建");
@ -380,7 +381,7 @@ public class DQBomService {
t1.setMATNR(d.getParentMaterialNo()); t1.setMATNR(d.getParentMaterialNo());
t1.setIDNRK(d.getMaterialNo()); t1.setIDNRK(d.getMaterialNo());
t1.setMEINS(d.getMaterialUnit()); t1.setMEINS(d.getMaterialUnit());
t1.setMENGE("1"); t1.setMENGE(d.getNum().toString());
t1.setPOSTP(d.getProjectType()); t1.setPOSTP(d.getProjectType());
t1.setDATUM(dateYMD); t1.setDATUM(dateYMD);
t1s.add(t1); t1s.add(t1);