Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom

This commit is contained in:
jing's 2024-01-24 17:02:27 +08:00
commit 3ca4ee7606
6 changed files with 35 additions and 23 deletions

View File

@ -16,6 +16,8 @@ public class AddVirtrualMaterialDTO {
private String materialDesc ;
private String materialCategoryCode;
private String projectType;
@ApiModelProperty("申请后返回的物料编码")
private String materialNo;
}

View File

@ -265,7 +265,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
child.setTechnologyUserCode(parentEntity.getTechnologyUserCode());
child.setTechnologyUserName(parentEntity.getTechnologyUserName());
if (parentEntity.getStatus().equals(PBomStatusEnum.PUBLISH.getValue())) {
if ( parent.getStatus()< PBomStatusEnum.PUBLISH.getValue() && parentEntity.getStatus().equals(PBomStatusEnum.PUBLISH.getValue())) {
child.setStatus(PBomStatusEnum.BORROWED_PARTS.getValue());
}
@ -398,7 +398,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
result = Convert.convert(BomNewPbomParentVO.class, parent);
}
materialMainService.intiMaterialInfo(ImmutableList.of(result));
VUtils.isTure(StrUtil.isBlank(result.getMaterialCategoryCode()) || !result.getMaterialCategoryCode().startsWith("20")).throwMessage("插入工艺包的物料需制作物料");
VUtils.isTure(StrUtil.isBlank(result.getMaterialCategoryCode()) || !result.getMaterialCategoryCode().startsWith("20")).throwMessage("插入工艺包的物料需制作物料");
// drawingNo = StrUtil.join("", result.getDrawingNo(), technologyPackageTypeEntity.getDrawingNoSuffix());
// 检查改图号是否已存在主数据中
@ -418,10 +418,16 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
toM.setDrawingNo(drawingNo);
toM.setMaterialDesc(materialDesc);
toM.setMaterialCategoryCode("201201");
toM.setProjectType(packageParam.getProjectType());
Map<String, AddVirtrualMaterialDTO> mMap = materialService.batchAddMaterial(ImmutableList.of(toM));
// String materialNo = materialService.addMaterial(drawingNo, materialName, materialDesc, "201201");
String materialNo=mMap.get(key).getMaterialNo();
return materialMainService.getMaterialBaseInfo(ImmutableList.of(materialNo)).get(0);
BaseMaterialVO resultD = materialMainService.getMaterialBaseInfo(ImmutableList.of(materialNo)).get(0);
//插入工艺包
packageParam.setTechnologyPackageMaterialNo(materialNo);
insertTechnologyPackage(packageParam);
return resultD;
}
@Transactional(rollbackFor = Exception.class)
@ -432,6 +438,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
throw new NflgBusinessException(STATE.BusinessError, "单条物料时,请选择上下级");
}
TechnologyPackageParamBuilder builder = new TechnologyPackageParamBuilder(technologyPackageParam);
builder.builder();
if (CollUtil.isNotEmpty(builder.getPackageParent())) {
this.saveOrUpdateBatch(builder.getPackageParent());
}

View File

@ -187,6 +187,9 @@ public class MaterialService {
ma.setApplyUserCode(SessionUtil.getRealName());
ma.setMaterialUnit("PC");
ma.setProcessState(10);
if(StrUtil.isNotBlank(md.getProjectType())){
ma.setProjectType(md.getProjectType());
}
resultList.add(ma);
AddMaterialMainDTO ent=new AddMaterialMainDTO();
@ -381,7 +384,7 @@ public class MaterialService {
if (optional.isPresent()) {
OaResult oaResult = optional.get();
materialMainEntity.setOaRowId(oaResult.getInstId());
materialMainEntity.setProcessState(100);
// materialMainEntity.setProcessState(10);
}
}
materialMainService.updateBatchById(entityList);

View File

@ -146,7 +146,7 @@ public abstract class VirtualPackageBase {
parent.setSourceRowId(0L);
parent.setLastVersionIs(1);
parent.setNum(new BigDecimal(1));
parent.setDeviseName(SessionUtil.getUserCode());
parent.setDeviseUserCode(SessionUtil.getUserCode());
parent.setDeviseName(SessionUtil.getRealName());
parent.setCreatedBy(SessionUtil.getUserCode());
parent.setDeptName(SessionUtil.getDepartName());

View File

@ -163,9 +163,9 @@ public class ConvertToMBom {
*
* @param
*/
private void handEmptyMakePackage() {
private void handEmptyMakePackage(List<ConvertToMBomDTO> childBomTree) {
List<ConvertToMBomDTO> childBomTree = ConvertToMbomUtil.toTree(parent.getRowId(), allChildTreeList_1020, ConvertToMBomDTO::getRelParentRowId, ConvertToMBomDTO::getBomRowId);
// List<ConvertToMBomDTO> childBomTree = ConvertToMbomUtil.toTree(parent.getRowId(), allChildTreeList_1020, ConvertToMBomDTO::getRelParentRowId, ConvertToMBomDTO::getBomRowId);
for (ConvertToMBomDTO item : childBomTree) {
if (VirtualPackageTypeEnum.DELIVERY_PACKAGE.equalsValue(item.getVirtualPartType())) {
List<ConvertToMBomDTO> makeChild = item.getChildNodes().stream().filter(u -> VirtualPackageTypeEnum.MAKING_PACKAGE.equalsValue(u.getVirtualPartType())).collect(Collectors.toList());
@ -231,7 +231,7 @@ public class ConvertToMBom {
recursionHandlerChild1020(item, directDeliveryPackage);
}
//处理制作包无下级的情况
handEmptyMakePackage();
handEmptyMakePackage(childBomTree);
}

View File

@ -178,22 +178,22 @@
</select>
<update id="updateRootState">
update t_bom_new_ebom_parent
set root_is=0,
user_root_is=0
where last_version_is = 1;
update t_bom_new_ebom_parent a set a.root_is=1 ,a.user_root_is=1 where material_no not in (select material_no from (
select b.material_no from t_bom_new_ebom_parent a
join t_bom_new_ebom_child b on a.row_id=b.parent_row_id
where a.last_version_is=1 ) b ) and last_version_is=1;
update t_bom_new_ebom_parent a left join (select material_no ,created_by from (
select b.material_no ,b.created_by from t_bom_new_ebom_parent a
update t_bom_new_ebom_parent
set root_is=0,
user_root_is=0
where last_version_is = 1;
update t_bom_new_ebom_parent a set a.root_is=1 ,a.user_root_is=1 where material_no not in (select material_no from (
select b.material_no from t_bom_new_ebom_parent a
join t_bom_new_ebom_child b on a.row_id=b.parent_row_id
where a.last_version_is=1 ) b ) t on a.material_no=t.material_no and a.created_by=t.created_by
set user_root_is=1
where a.last_version_is=1 and t.created_by is null
where a.last_version_is=1 ) b ) and last_version_is=1;
update t_bom_new_ebom_parent a left join (select material_no ,created_by from (
select b.material_no ,b.created_by from t_bom_new_ebom_parent a
join t_bom_new_ebom_child b on a.row_id=b.parent_row_id
where a.last_version_is=1 ) b ) t on a.material_no=t.material_no and a.created_by=t.created_by
set user_root_is=1
where a.last_version_is=1 and t.created_by is null
</update>