BUG修复
This commit is contained in:
parent
9998d74ffb
commit
e54e9e87c9
|
|
@ -58,6 +58,9 @@ public class PBomApi extends BaseApi {
|
|||
@Resource
|
||||
private UserRoleService userRoleService;
|
||||
|
||||
@Resource
|
||||
private MaterialMainService materialMainService;
|
||||
|
||||
|
||||
@PostMapping("workDetailsListByPage")
|
||||
@ApiOperation("PBom工作列表")
|
||||
|
|
@ -101,6 +104,8 @@ public class PBomApi extends BaseApi {
|
|||
@PostMapping("editSubmit")
|
||||
@ApiOperation("编辑-提交")
|
||||
public ResultVO<Boolean> editSubmit(@Valid @RequestBody EditPBomParamDTO param){
|
||||
//检查物料是否被冻结
|
||||
materialMainService.checkMaterialFreeze(param.getChildList());
|
||||
bomNewPbomParentService.editSave(param, PBomEditStatusEnum.HANDLER_FINISHED);
|
||||
return ResultVO.success(true);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -112,7 +112,7 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
* 是否有BOM: 0-否 1-是
|
||||
*/
|
||||
@ApiModelProperty(value = "是否有BOM: 0-否 1-是")
|
||||
private Integer bomExist;
|
||||
private Integer bomExist=0;
|
||||
|
||||
/**
|
||||
* 是否最新版:0-否 1-是
|
||||
|
|
|
|||
|
|
@ -866,6 +866,24 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
for (BomNewEbomChildEntity childEntities : eBomEdit.childEntities) {
|
||||
childEntities.setOrderNumber(OrderNoUtil.orderNo2Str(orderNo));
|
||||
if(childEntities.getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName()))
|
||||
{
|
||||
childEntities.setVirtualPartType(VirtualPackageTypeEnum.MAKING_PACKAGE.getValue());
|
||||
childEntities.setVirtualPartIs(1);
|
||||
|
||||
}
|
||||
else if(childEntities.getMaterialName().contains(VirtualPackageTypeEnum.DELIVERY_PACKAGE.getConMaterialName())){
|
||||
childEntities.setVirtualPartType(VirtualPackageTypeEnum.DELIVERY_PACKAGE.getValue());
|
||||
childEntities.setVirtualPartIs(1);
|
||||
}
|
||||
else if(childEntities.getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName())){
|
||||
childEntities.setVirtualPartType(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getValue());
|
||||
childEntities.setVirtualPartIs(1);
|
||||
}
|
||||
else if(childEntities.getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName())){
|
||||
childEntities.setVirtualPartType(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue());
|
||||
childEntities.setVirtualPartIs(1);
|
||||
}
|
||||
orderNo++;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -467,9 +467,6 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
//获取整颗树的BOM
|
||||
List<BomOriginalListVO> bomAllChildList = this.getBomTree(parent.getRowId());
|
||||
|
||||
//检查-有子级的物料,编码不能为空
|
||||
List<String> noMaterialDrawing = bomAllChildList.stream().filter(u -> u.getBomRowId() > 0 && StrUtil.isBlank(u.getMaterialNo())).map(u -> u.getDrawingNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noMaterialDrawing)).throwMessage(StrUtil.join(",", noMaterialDrawing)+" 请维护物料编码");
|
||||
|
||||
BomOriginalListVO parentVO = Convert.convert(BomOriginalListVO.class, parent);
|
||||
parentVO.setEBomRowId(eBomRowId);
|
||||
|
|
|
|||
|
|
@ -264,7 +264,6 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
child.setVirtualPackageIs(parentEntity.getVirtualPackageIs());
|
||||
child.setTechnologyUserCode(parentEntity.getTechnologyUserCode());
|
||||
child.setTechnologyUserName(parentEntity.getTechnologyUserName());
|
||||
|
||||
if ( parent.getStatus()< PBomStatusEnum.PUBLISH.getValue() && parentEntity.getStatus().equals(PBomStatusEnum.PUBLISH.getValue())) {
|
||||
child.setStatus(PBomStatusEnum.BORROWED_PARTS.getValue());
|
||||
}
|
||||
|
|
@ -316,6 +315,10 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 编辑-
|
||||
* 机加工件【分类代码以200301开头】只可以删除它的下级,
|
||||
|
|
|
|||
|
|
@ -5,10 +5,12 @@ import cn.hutool.cache.CacheUtil;
|
|||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.core.lang.Pair;
|
||||
import cn.hutool.core.lang.TypeReference;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.product.bomnew.constant.MateiralStateEnum;
|
||||
import com.nflg.product.bomnew.constant.MaterialGetEnum;
|
||||
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||
import com.nflg.product.bomnew.mapper.master.MaterialMainMapper;
|
||||
|
|
@ -16,6 +18,7 @@ import com.nflg.product.bomnew.pojo.entity.MaterialMainEntity;
|
|||
import com.nflg.product.bomnew.pojo.vo.BaseMaterialVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialMateVO;
|
||||
import com.nflg.product.bomnew.util.ListCommonUtil;
|
||||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -58,7 +61,35 @@ public class MaterialMainService extends ServiceImpl<MaterialMainMapper, Materia
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 检查物料状态是否为冻结
|
||||
* @param data
|
||||
*/
|
||||
public <T extends BaseMaterialVO > void checkMaterialFreeze(List<T> data){
|
||||
intiMaterialState(data);
|
||||
List<String> freeZeMaterialNos = data.stream().filter(u -> MateiralStateEnum.FREEZE.equalsValue(u.getMaterialState())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(freeZeMaterialNos)).throwMessage("以下物料被冻结:"+StrUtil.join(",", freeZeMaterialNos));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 初化化物料状态
|
||||
* @param data
|
||||
* @param <T>
|
||||
*/
|
||||
public <T extends BaseMaterialVO> void intiMaterialState(List<T> data ) {
|
||||
List<String> materialNos = data.stream().filter(u -> StrUtil.isNotBlank(u.getMaterialNo())).map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(materialNos)) {
|
||||
List<BaseMaterialVO> materialBaseInfos = SpringUtil.getBean(MaterialMainService.class).getMaterialBaseInfo(materialNos);
|
||||
Map<String, BaseMaterialVO> materialMp = ListCommonUtil.listToMap(materialBaseInfos, BaseMaterialVO::getMaterialNo);
|
||||
for (T t : data) {
|
||||
|
||||
if (StrUtil.isNotBlank(t.getMaterialNo()) && materialMp.containsKey(t.getMaterialNo())) {
|
||||
t.setMaterialState(materialMp.get(t.getMaterialNo()).getMaterialState());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class SapOpUtilService {
|
|||
*/
|
||||
public ResultVO<Boolean> importToSap(ImportSapParamDTO impartSapParamDTO) {
|
||||
if (CollUtil.isEmpty(impartSapParamDTO.getT1())) {
|
||||
return null;
|
||||
return ResultVO.error("同步SAP 参数错误");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class EBomToPBom {
|
|||
private BomNewPbomParentEntity buildPBomParent(BomNewEbomParentVO parentVo, String facCode) {
|
||||
BomNewPbomParentEntity oldParent = SpringUtil.getBean(BomNewPbomParentService.class).lambdaQuery()
|
||||
.eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).one();
|
||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).eq(BomNewPbomParentEntity::getLastVersionIs,1).one();
|
||||
|
||||
// this.hasConvertEBomRowIds.add(parentVo.getRowId());
|
||||
if (Objects.nonNull(oldParent) && !EBomStatusEnum.PUBLISHED.equalsValue(oldParent.getStatus())) {
|
||||
|
|
@ -166,7 +166,12 @@ public class EBomToPBom {
|
|||
pBomParent.setFacCode(facCode);
|
||||
pBomParent.setTechnologyUserCode(SessionUtil.getUserCode());
|
||||
pBomParent.setTechnologyUserName(SessionUtil.getRealName());
|
||||
|
||||
pBomParent.setCurrentVersion(VersionUtil.getNextVersion(""));
|
||||
if(Objects.nonNull(oldParent)){
|
||||
parentVo.setCurrentVersion(VersionUtil.getNextVersion(oldParent.getCurrentVersion()));
|
||||
oldParent.setExpireEndTime(LocalDateTime.now());
|
||||
oldParent.setLastVersionIs(0);
|
||||
}
|
||||
this.pBomParentResult.add(pBomParent);
|
||||
return pBomParent;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,6 +83,12 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
SpringUtil.getBean(MaterialMainService.class).intiMaterialInfo(bomDetail, "material", "materialTexture","materialName");
|
||||
|
||||
SpringUtil.getBean(MaterialMainService.class).initShouldBomExist(bomDetail, BomOriginalListVO::getMaterialCategoryCode, BomOriginalListVO::setShouldBomExist, BomOriginalListVO::getMaterialGetType);
|
||||
|
||||
|
||||
//检查-有子级的物料,编码不能为空
|
||||
List<String> noMaterialDrawing = bomDetail.stream().filter(u -> u.getBomRowId() > 0 && StrUtil.isBlank(u.getMaterialNo())).map(u -> u.getDrawingNo()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noMaterialDrawing)).throwMessage(StrUtil.join(",", noMaterialDrawing)+" 请维护物料编码");
|
||||
|
||||
//处理父级
|
||||
hanlerDo(parent);
|
||||
|
||||
|
|
@ -332,6 +338,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
eBomParent.setCreatedJob(SpringUtil.getBean(UserRoleService.class).technician() ? UserJobEnum.ENGINEER.getValue() : UserJobEnum.DESIGNER.getValue());
|
||||
if (Objects.nonNull(ebom)) {
|
||||
ebom.setLastVersionIs(0);
|
||||
ebom.setExpireEndTime(LocalDateTime.now());
|
||||
this.eBomParentResult.add(ebom);
|
||||
}
|
||||
this.eBomParentResult.add(eBomParent);
|
||||
|
|
|
|||
|
|
@ -116,6 +116,14 @@ public class ConvertToMBom {
|
|||
mBomParent.setSourceRowId(parent.getRowId());
|
||||
mBomParent.setLastVersionIs(1);
|
||||
mBomParent.setStatus(MBomConstantEnum.MBomStatusEnum.UNPUB_SAP.getValue());
|
||||
//当10120 bom 内容为空时,不创建31 的Mbom
|
||||
if(EBomConstant.XIAN_TAO_FACTORY_CODE_1020.equals(facCode) ){
|
||||
List<ConvertToMBomDTO> bomContent1020 = allChildTreeList_1020.stream().filter(u -> u.getDelIs().equals(0) && u.getVirtualPartType().equals(0)).collect(Collectors.toList());
|
||||
if(CollUtil.isEmpty(bomContent1020)){
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.mBomParentResult.add(mBomParent);
|
||||
|
||||
|
||||
|
|
@ -124,7 +132,7 @@ public class ConvertToMBom {
|
|||
allChild_1010.forEach(u->{
|
||||
u.setRelParentRowId(u.getParentRowId());
|
||||
});
|
||||
buildChild(EBomConstant.MAIN_FACTORY_CODE_1010.equals(facCode) ? allChild_1010 : allChildTreeList_1020, mBomParent.getRowId());
|
||||
buildChild(facCode, EBomConstant.MAIN_FACTORY_CODE_1010.equals(facCode) ? allChild_1010 : allChildTreeList_1020, mBomParent.getRowId());
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -135,24 +143,24 @@ public class ConvertToMBom {
|
|||
*
|
||||
* @param allChild
|
||||
*/
|
||||
private void buildChild(List<ConvertToMBomDTO> allChild, Long bomRowId) {
|
||||
private void buildChild(String facCode, List<ConvertToMBomDTO> allChild, Long bomRowId) {
|
||||
List<ConvertToMBomDTO> childBomTree = ConvertToMbomUtil.toTree(parent.getRowId(), allChild, ConvertToMBomDTO::getRelParentRowId, ConvertToMBomDTO::getBomRowId);
|
||||
; for (ConvertToMBomDTO item : childBomTree) {
|
||||
//构建子级
|
||||
if (item.getDelIs().equals(0)) {
|
||||
buildMBomChildDo(item, 0L,bomRowId);
|
||||
buildMBomChildDo(facCode, item, 0L,bomRowId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buildMBomChildDo(ConvertToMBomDTO item , Long parentRowId ,Long bomRowId){
|
||||
private void buildMBomChildDo(String facCode , ConvertToMBomDTO item , Long parentRowId ,Long bomRowId){
|
||||
if (item.getDelIs().equals(0)) {
|
||||
parentRowId = buildChildDo(item, bomRowId, parentRowId);
|
||||
parentRowId = buildChildDo(facCode,item, bomRowId, parentRowId);
|
||||
}
|
||||
for (ConvertToMBomDTO itemChild : item.getChildNodes()) {
|
||||
buildMBomChildDo(itemChild, parentRowId,bomRowId);
|
||||
buildMBomChildDo(facCode, itemChild, parentRowId,bomRowId);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -178,12 +186,13 @@ public class ConvertToMBom {
|
|||
}
|
||||
}
|
||||
|
||||
private Long buildChildDo(ConvertToMBomDTO dto, Long bomRowId, Long parentRowId) {
|
||||
private Long buildChildDo(String facCode, ConvertToMBomDTO dto, Long bomRowId, Long parentRowId) {
|
||||
BomNewMbomDetailEntity child = new BomNewMbomDetailEntity();
|
||||
BeanUtil.copyProperties(dto, child);
|
||||
child.setRowId(IdWorker.getId());
|
||||
child.setBomRowId(bomRowId);
|
||||
child.setFacCode(dto.getProductionFactoryCode());
|
||||
// child.setFacCode(dto.getProductionFactoryCode());
|
||||
child.setFacCode(facCode);
|
||||
child.setParentRowId(parentRowId);
|
||||
child.setCreatedBy(SessionUtil.getUserCode());
|
||||
child.setCreatedTime(LocalDateTime.now());
|
||||
|
|
|
|||
Loading…
Reference in New Issue