fix(ebom): 工作表编辑页面暂存时,没有下级也需要可以保存

This commit is contained in:
曹鹏飞 2024-06-18 09:53:13 +08:00
parent 925b883916
commit 39a8f28b20
2 changed files with 16 additions and 7 deletions

View File

@ -1932,10 +1932,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
checkUserRoleAuth(dto.getParent().getCreatedBy());
//暂存数据为空后面不处理
if (CollUtil.isEmpty(dto.getDatas())) {
return dto.getParent();
}
// //暂存数据为空后面不处理
// if (CollUtil.isEmpty(dto.getDatas())) {
// return dto.getParent();
// }
EBomEdit eBomEdit = new EBomEdit(EBomSourceEnum.FROM_MDM.getValue());

View File

@ -14,6 +14,7 @@ import com.nflg.product.bomnew.constant.*;
import com.nflg.product.bomnew.pojo.dto.BomNewEBomParentEditDTO;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomChildEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
import com.nflg.product.bomnew.service.BomNewEbomChildService;
@ -21,6 +22,7 @@ import com.nflg.product.bomnew.service.BomNewEbomParentService;
import com.nflg.product.bomnew.service.MaterialMainService;
import com.nflg.product.bomnew.service.UserRoleService;
import com.nflg.product.bomnew.util.ListCommonUtil;
import com.nflg.product.bomnew.util.MaterialshouldBomExistUtil;
import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.VersionUtil;
import lombok.Getter;
@ -75,6 +77,11 @@ public class EBomEdit {
parent.setStatus(EBomStatusEnum.WAIT_CHECK.getValue());
parent.setNum(new BigDecimal(1));
parent.setBomExist(1);
MaterialMainEntity materialMainEntity = SpringUtil.getBean(MaterialMainService.class).lambdaQuery()
.eq(MaterialMainEntity::getMaterialNo, parent.getMaterialNo())
.one();
parent.setShouldBomExist(MaterialshouldBomExistUtil.checkShouldBomExist(materialMainEntity.getMaterialCategoryCode()
, materialMainEntity.getMaterialGetType()) ? 1 : 0);
parent.setLastVersionIs(1);
parent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
@ -132,6 +139,7 @@ public class EBomEdit {
parentEntity.setRootIs(parentEntity.getMaterialNo().startsWith("31") ? 1 : 0);
parentEntity.setUserRootIs(1);
parentEntity.setDeptRowId(SessionUtil.getDepartRowId());
parentEntity.setBomExist(CollUtil.isEmpty(createDTO.getDatas()) ? 0 : 1);
createDTO.getDatas().forEach(k -> {
k.setParentRowId(parentEntity.getRowId());
@ -274,9 +282,9 @@ public class EBomEdit {
throw new NflgBusinessException(STATE.Error, "parent 数据不能为空");
}
if (CollUtil.isEmpty(dto.getDatas())) {
throw new NflgBusinessException(STATE.Error, "datas 数据不能为空");
}
// if (CollUtil.isEmpty(dto.getDatas())) {
// throw new NflgBusinessException(STATE.Error, "datas 数据不能为空");
// }
List<String> materialNos = dto.getDatas().stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
if(materialNos.contains(dto.getParent().getMaterialNo())){
@ -356,6 +364,7 @@ public class EBomEdit {
parentEntity.setModifyTime(LocalDateTime.now());
}
parentEntity.setEditStatus(dto.getOpType());
parentEntity.setBomExist(CollUtil.isEmpty(dto.getDatas()) ? 0 : 1);
//提交
if (Objects.equals(dto.getOpType(), EbomEditStatusEnum.HANDLER_FINISHED.getValue())) {
//工艺人员