This commit is contained in:
jing's 2024-01-06 12:02:15 +08:00
parent 9f20578fef
commit b29fdd0baf
6 changed files with 167 additions and 157 deletions

View File

@ -3,6 +3,7 @@ package com.nflg.product.bomnew.pojo.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.List;
/**
@ -60,7 +61,7 @@ public class BaseMaterialVO {
@ApiModelProperty("单位")
private String materialUnit;
@ApiModelProperty("单重")
private BigDecimal materialWeight;
}

View File

@ -294,7 +294,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
child.setVirtualPackageIs(parentEntity.getVirtualPackageIs());
if (parentEntity.getStatus().equals(EBomStatusEnum.PUBLISHED.getValue())) {
child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue());
}
@ -429,9 +428,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
public void checkBomException(List<BomNewEbomParentVO> list) {
public void checkBomException(List<BomNewEbomParentVO> list, List<Integer> unCheckList) {
CheckEBomException checkEBomException = new CheckEBomException(list);
checkEBomException.setUnCheckExcept(unCheckList);
checkEBomException.checkException();
//保存异常
@ -455,7 +454,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
private void saveException(CheckEBomException checkEBomException) {
List<BomNewEbomParentVO> allBomDetail = checkEBomException.getAllBomDetail();
//父级
List<BomNewEbomParentVO> parents = allBomDetail.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
List<BomNewEbomParentVO> parents = allBomDetail.stream().filter(u -> u.getBomRowId() != null && u.getBomRowId() > 0).collect(Collectors.toList());
if (CollUtil.isNotEmpty(parents)) {
List<BomNewEbomParentEntity> pentList = new ArrayList<>();
parents.forEach(k -> {
@ -469,7 +468,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
}
//子级
List<BomNewEbomParentVO> child = allBomDetail.stream().filter(u -> u.getRowId() > 0).collect(Collectors.toList());
List<BomNewEbomParentVO> child = allBomDetail.stream().filter(u -> u.getRowId() != null && u.getRowId() > 0).collect(Collectors.toList());
if (CollUtil.isNotEmpty(parents)) {
List<BomNewEbomChildEntity> childList = new ArrayList<>();
child.forEach(k -> {
@ -509,6 +508,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
/**
* 检查 并保存异常信息
*/
@ -524,9 +524,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
/**
* 生成虚拟包
*
@ -643,14 +640,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
public void editExportBom(List<BomNewEbomParentVO> list, HttpServletResponse response) throws IOException {
final ListSheet<EbomExcelEditVO> listSheet = new ListSheet<EbomExcelEditVO>() {
Long n = 0L;
Long pages = 1L;
@Override
protected List<EbomExcelEditVO> more() {
@ -662,15 +656,12 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
public void exportBom(List<Long> bomRowIds, HttpServletResponse response) throws IOException {
final ListSheet<EbomExcelVO> listSheet = new ListSheet<EbomExcelVO>() {
Long n = 0L;
Long pages = 1L;
@Override
protected List<EbomExcelVO> more() {
List<BomNewEbomParentVO> child = getChildBatch(bomRowIds);
@ -681,9 +672,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
/**
* 计算BOM树高度
*
@ -759,8 +747,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
eBomEdit.temporary(bomNewEBomParentEditDTO);
int orderNo = 1;
if (dto.isDel()) {
if ((parentVO.getSource().equals(EBomSourceEnum.FROM_MDM.getValue())
@ -926,7 +912,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
if (CollectionUtil.isNotEmpty(revertList)) {
UpdateWrapper<BomNewEbomParentEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.lambda()
@ -1226,8 +1211,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
eBomEdit.temporary(dto);
if (CollectionUtil.isNotEmpty(eBomEdit.parentEntities)) {
this.saveOrUpdateBatch(eBomEdit.parentEntities);
}
@ -1309,7 +1292,6 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
}
// checkAndSaveEBomException(dto.getParent().getBomRowId());
List<BomNewEbomParentVO> childList = dto.getDatas();
@ -1380,7 +1362,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
List<BomNewEbomParentVO> tmp1 = dto.getDatas().stream().filter(item -> Objects.nonNull(item.getRowId()) && item.getRowId() > 0).collect(Collectors.toList());
List<BomNewEbomParentVO> tmp2 = dto.getDatas().stream().filter(item -> Objects.isNull(item.getRowId()) || item.getRowId() == 0).collect(Collectors.toList());
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(tmp2);
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(tmp2, "");
String[] ignore = new String[]{
"projectType",
@ -1395,13 +1378,15 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
checkBom.addAll(tmp1);
checkBom.addAll(tmp2);
if(dto.getParent().getRootIs()==null ||dto.getParent().getRootIs()==0 ) {
// if(dto.getParent().getRootIs()==null ||dto.getParent().getRootIs()==0 ) {
// checkBom.add(dto.getParent());
// }
checkBom.add(dto.getParent());
}
// CheckEBomException checkEBomException = new CheckEBomException(checkBom);
// checkEBomException.checkException();
// this.initBomException(checkBom);
checkBomException(checkBom);
checkBomException(checkBom, Arrays.asList(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue()));
if (CollectionUtil.isNotEmpty(dto.getDatas())) {
for (BomNewEbomParentVO vo :
dto.getDatas()) {
@ -1410,6 +1395,11 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
vo.setDeviseName(SessionUtil.getRealName());
vo.setCreatedBy(SessionUtil.getUserCode());
if (vo.getUnitWeight() == null ||BigDecimal.ZERO.compareTo(vo.getUnitWeight()) >= 0) {
vo.setUnitWeight(vo.getMaterialWeight());
}
vo.setTotalWeight(NumberUtil.mul(vo.getUnitWeight(), vo.getNum()));
}
}
}

View File

@ -128,7 +128,7 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
*
* @param list
* @param
* @param setFun
* @param
* @param <T>
*/
public <T> void initMaterialForDrawdingNo

View File

@ -22,6 +22,7 @@ import com.nflg.product.bomnew.util.ListCommonUtil;
import com.nflg.product.bomnew.util.TreeUtils;
import com.nflg.product.bomnew.util.VUtils;
import lombok.Getter;
import lombok.Setter;
import nflg.product.common.constant.STATE;
import java.math.BigDecimal;
@ -36,8 +37,8 @@ public class CheckEBomException {
@Getter
List<BomNewEbomParentVO> allBomDetail ;
@Setter
List<Integer> unCheckExcept;
public static void checkMaterialNoInMain1(List<String> materialNos){
@ -98,6 +99,13 @@ public class CheckEBomException {
public void checkException(){
for (BomNewEbomParentVO vo : allBomDetail) {
// if(Objects.isNull(vo.getExceptionStatus())) {
//忽略不检查的如14
if(CollectionUtil.isNotEmpty(unCheckExcept)
&& vo.getExceptionStatus()!=null
&&unCheckExcept.contains(vo.getExceptionStatus())){
continue;
}
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
// }
if (StrUtil.isNotBlank(vo.getMaterialNo())

View File

@ -83,7 +83,25 @@ public class EBomEdit {
}
private void checkExcept(BomNewEbomParentVO parent, BomNewEbomChildEntity child) {
if (StrUtil.isBlank(child.getMaterialNo()) || Objects.isNull(child.getNum())
|| BigDecimal.ZERO.compareTo(child.getNum()) >= 0) {
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_4.getValue());
} else if (StrUtil.isEmpty(child.getProjectType())) {
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
} else if (StrUtil.isNotBlank(parent.getProjectType())
&& StrUtil.containsAny(parent.getProjectType(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(), ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue())) {
if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(), child.getProjectType())) {
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue());
}
if (StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(), child.getProjectType())) {
child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue());
}
}
}
public void temporary(BomNewEBomParentEditDTO dto) {
@ -137,29 +155,34 @@ public class EBomEdit {
child.setSourceRowId(0l);
child.setParentRowId(parent.getRowId());
child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
// parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
//工艺人员
if(roleList.contains(EBomConstant.TECHNICIAN)){
parent.setStatus(EBomStatusEnum.CHECKED.getValue());
}
// 设计岗位设计岗位的用户只可以编辑未被设计复核过且是自己创建的物料如果设计岗位在编辑过程中新增的物料做为未被设计复核
// 工艺岗位工艺岗位的用户可以编辑被设计复核过的物料如果工艺岗位在编辑过程中新增的物料状态为被设计复核
// if(roleList.contains(EBomConstant.TECHNICIAN)){
// parent.setStatus(EBomStatusEnum.CHECKED.getValue());
// }
checkExcept(dto.getParent(), child);
}
child.setEditStatus(dto.getOpType());
if (StrUtil.isNotBlank(child.getProjectType())) {
child.setProjectType(child.getProjectType().toUpperCase());
}
// parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue());
// parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
}
}
}
public void submit(BomNewEBomParentEditDTO dto) {
@ -170,7 +193,7 @@ public class EBomEdit {
Set<String> difference = Sets.difference(new HashSet<>(materialNos), new HashSet<>(effectiveMaterialNos));
VUtils.isTure(CollUtil.isNotEmpty(difference)).throwMessage(StrUtil.join(",", difference) + "在物料档案中不存在");
// Map<String, BaseMaterialVO> materialVOMap = ListCommonUtil.listToMap(materialBaseInfo, BaseMaterialVO::getMaterialNo);
parentEntities = new ArrayList<>();
childEntities = new ArrayList<>();
List<String> roleList = SpringUtil.getBean(UserRoleService.class).getUserPost();
@ -217,7 +240,7 @@ public class EBomEdit {
//child.setProjectTypeInputType(ProjectTypeInputTypeEnum.MANUAL_INPUT.getValue());
child.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
// child.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
child.setEditStatus(dto.getOpType());
//新增数据
if (child.getRowId() == null || child.getRowId().longValue() == 0) {
@ -232,6 +255,7 @@ public class EBomEdit {
child.setParentRowId(parent.getRowId());
child.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
// parent.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
checkExcept(dto.getParent(), child);
}
@ -239,21 +263,8 @@ public class EBomEdit {
child.setEditStatus(dto.getOpType());
// parent.setCreatedJob(roleList.contains(EBomConstant.TECHNICIAN)?UserJobEnum.ENGINEER.getValue():UserJobEnum.DESIGNER.getValue());
// parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
parent.setTotalWeight(NumberUtil.mul(child.getUnitWeight(), child.getNum()));
// if(StrUtil.isEmpty(child.getProjectType())){
// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_8.getValue());
// }
//
// if(StrUtil.isNotEmpty(dto.getParent().getProjectType()) && StrUtil.containsAny(dto.getParent().getProjectType(),ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(),ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue())){
// if(StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_Q.getValue(),child.getProjectType())){
// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_9.getValue());
// }
//
// if(StrUtil.equals(ProjectTypeInputTypeEnum.ProjectTypeEnum.TYPE_F.getValue(),child.getProjectType())){
// child.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_10.getValue());
// }
// }
// VUtils.isTure(parent.getProjectType().equals(child.getProjectType())).throwMessage("父、子级项目类型不能相同");

View File

@ -71,7 +71,7 @@
<select id="getMaterialBaseInfo" resultType="com.nflg.product.bomnew.pojo.vo.BaseMaterialVO">
select a.row_id as materialRowId, material_no, material_name, material_desc, procure_type, project_type, material_state,drawing_no,a.material_category_code ,material_get_type,drawing_no
,material_texture as material ,material_texture , b.rel_category_code,b.category_name,material_unit
,material_texture as material ,material_texture ,material_weight,b.rel_category_code,b.category_name,material_unit
from t_material_main a join t_material_category b on a.material_category_code=b.category_code
where material_no in
<foreach collection="materialNos" item="item" open="(" close=")" separator=",">