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:
commit
3b15f04be5
|
|
@ -147,9 +147,11 @@ public class PBomApi extends BaseApi {
|
|||
|
||||
@GetMapping("copyBomCheck")
|
||||
@ApiOperation("复制前检查")
|
||||
public ResultVO<List<BomCopyCheckResultVO>> copyBomCheck(@RequestParam("sourceBomRowId") Long sourceBomRowId , @RequestParam("targetFacCode") String targetFacCode ) throws ExecutionException, InterruptedException {
|
||||
public ResultVO<List<BomCopyCheckResultVO>> copyBomCheck(@RequestParam("sourceBomRowId") Long sourceBomRowId ,
|
||||
@RequestParam("targetFacCode") String targetFacCode ,
|
||||
@RequestParam("rowId") Long rowId) throws ExecutionException, InterruptedException {
|
||||
|
||||
return ResultVO.success(bomNewPbomParentService.copyBomCheck(sourceBomRowId,targetFacCode));
|
||||
return ResultVO.success(bomNewPbomParentService.copyBomCheck(sourceBomRowId,targetFacCode,rowId));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -206,6 +206,10 @@ public class BomNewEbomChildEntity implements Serializable {
|
|||
@ApiModelProperty(value = "0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包")
|
||||
private Integer virtualPartType;
|
||||
|
||||
@TableField(value = "virtual_part_root_material_no")
|
||||
@ApiModelProperty(value = "生成虚拟包跟物料编码")
|
||||
private String virtualPartRootMaterialNo;
|
||||
|
||||
private static final long serialVersionUID = -14147430944632372L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -223,6 +223,10 @@ public class BomNewPbomChildEntity implements Serializable {
|
|||
@ApiModelProperty(value = "0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包")
|
||||
private Integer virtualPartType;
|
||||
|
||||
@TableField(value = "virtual_part_root_material_no")
|
||||
@ApiModelProperty(value = "生成虚拟包跟物料编码")
|
||||
private String virtualPartRootMaterialNo;
|
||||
|
||||
private static final long serialVersionUID = -76633783850936076L;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -315,6 +315,9 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty("0-非虚拟包 1-发货包 2-制作包 4-直发包 8-发货前装配包")
|
||||
private Integer virtualPartType;
|
||||
|
||||
@ApiModelProperty("生成虚拟包的跟节点物料编码")
|
||||
private String virtualPartRootMaterialNo;
|
||||
|
||||
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -627,9 +627,9 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
if (CollUtil.isNotEmpty(eBomToPBom.getUpgradeChangeResult())) {
|
||||
upgradeChangeService.saveOrUpdateBatch(eBomToPBom.getUpgradeChangeResult());
|
||||
}
|
||||
;
|
||||
if (CollUtil.isNotEmpty(eBomToPBom.getHasConvertEBomRowIds())) {
|
||||
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), eBomToPBom.getHasConvertEBomRowIds());
|
||||
List<Long> bomRowIds = bomTree.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(bomRowIds)) {
|
||||
this.getBaseMapper().updateStateBatchByRowIds(EBomStatusEnum.PUBLISHED.getValue(), bomRowIds);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -108,8 +108,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
if (StrUtil.isNotBlank(materialNo)) {
|
||||
List<String> parentMaterialByMaterialNo = getParentMaterialByMaterialNo(materialNo).stream().collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(parentMaterialByMaterialNo)) {
|
||||
List<BomNewPbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(userRoleService.getUserFactory(),parentMaterialByMaterialNo );
|
||||
List<BomNewPbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(userRoleService.getUserFactory(),parentMaterialByMaterialNo, materialNo);
|
||||
List<BomNewPbomParentVO> parents = this.getBaseMapper().getParentForMaterialNoSeach(StrUtil.isBlank(userRoleService.getUserFactory())?userRoleService.getUserFactory():query.getFacCode(),parentMaterialByMaterialNo );
|
||||
List<BomNewPbomParentVO> childs = this.getBaseMapper().getChildForMaterialNoSeach(StrUtil.isBlank(userRoleService.getUserFactory())?userRoleService.getUserFactory():query.getFacCode(),parentMaterialByMaterialNo, materialNo);
|
||||
List<BomNewPbomParentVO> data = new ArrayList<>();
|
||||
data.addAll(parents);
|
||||
data.addAll(childs);
|
||||
|
|
@ -117,7 +117,7 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
return handSeachToTree(parents, childs);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return new Page<BomNewPbomParentVO>() ;
|
||||
} else {
|
||||
Page<BomNewPbomParentVO> result = this.getBaseMapper().workDetailsListByPage(new Page<>(query.getPage(), query.getPageSize()), query, userRoleService.getUserFactory());
|
||||
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
|
|
@ -424,7 +424,16 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
* @param targetFacCode
|
||||
* @return
|
||||
*/
|
||||
public List<BomCopyCheckResultVO> copyBomCheck(Long sourceBomRowId, String targetFacCode) throws ExecutionException, InterruptedException {
|
||||
public List<BomCopyCheckResultVO> copyBomCheck(Long sourceBomRowId, String targetFacCode,Long rowId) throws ExecutionException, InterruptedException {
|
||||
|
||||
BomNewPbomParentEntity root = this.getById(sourceBomRowId);
|
||||
VUtils.isTure(root.getMaterialNo().startsWith("31")).throwMessage("31码物料不能进行复制");
|
||||
|
||||
BomNewPbomChildEntity child = pbomChildService.getById(rowId);
|
||||
if(child.getVirtualPartRootMaterialNo().startsWith("31") && child.getVirtualPartType()>0){
|
||||
VUtils.isTure(true).throwMessage("31下的虚拟包不能删除");
|
||||
}
|
||||
|
||||
checkCopyBomParam(sourceBomRowId, targetFacCode);
|
||||
BomCopy bomCopy = new BomCopy(sourceBomRowId, targetFacCode, getAllBom(sourceBomRowId, 0));
|
||||
bomCopy.check();
|
||||
|
|
@ -434,6 +443,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void copyFrom(CopyPBomParam param) throws ExecutionException, InterruptedException {
|
||||
|
||||
|
||||
checkCopyBomParam(param.getSourceBomRowId(), param.getTargetFacCode());
|
||||
BomCopy bomCopy = new BomCopy(param.getSourceBomRowId(), param.getTargetFacCode(), getAllBom(param.getSourceBomRowId(), 0));
|
||||
bomCopy.copy(param.getCheckResult());
|
||||
|
|
|
|||
|
|
@ -60,11 +60,12 @@ public class UserRoleService {
|
|||
*/
|
||||
public String getUserFactory(){
|
||||
Integer userMultiplantFacRoleCount = materialMainService.getBaseMapper().getUserMultiplantFacRoleCount(SessionUtil.getRowId());
|
||||
if(userMultiplantFacRoleCount>0){
|
||||
return "";
|
||||
}else {
|
||||
return SessionUtil.getFullDeptName().contains("仙桃公司")?"1020":"1010";
|
||||
}
|
||||
return "";
|
||||
// if(userMultiplantFacRoleCount>0){
|
||||
// return "";
|
||||
// }else {
|
||||
// return SessionUtil.getFullDeptName().contains("仙桃公司")?EBomConstant.XIAN_TAO_FACTORY_CODE_1020:EBomConstant.MAIN_FACTORY_CODE_1010;
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import lombok.Setter;
|
|||
import nflg.product.common.constant.STATE;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
|
@ -185,23 +186,22 @@ public class CheckEBomException {
|
|||
* @param list
|
||||
*/
|
||||
public void initExceptionYellowWarn(List<BomNewEbomParentVO> list) {
|
||||
List<BomNewEbomParentVO> exceptionList = allBomDetail.stream().filter(u -> u.getExceptionStatus() > 1).collect(Collectors.toList());
|
||||
List<BomNewEbomParentVO> exceptionList = allBomDetail.stream().filter(u -> u.getExceptionStatus() > EBomExceptionStatusEnum.OK.getValue()).collect(Collectors.toList());
|
||||
// List<String> exceptionMaterialNos = exceptionList.stream().map(u -> u.getMaterialNo()).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(exceptionList)) {
|
||||
return;
|
||||
}
|
||||
for (BomNewEbomParentVO exItem : list) {
|
||||
|
||||
try {
|
||||
List<BomNewEbomParentVO> warnList = allBomDetail.stream().filter(u -> exItem.getBomRowId() != null && exItem.getBomRowId() > 0 && u.getLevelNumber().compareTo(exItem.getLevelNumber()) < 0 && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList());
|
||||
warnList.forEach(k -> {
|
||||
k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue());
|
||||
});
|
||||
}catch ( Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
List<BomNewEbomParentVO> warnList = allBomDetail.stream().filter(u -> u.getBomRowId() > 0 && u.getLevelNumber().compareTo(exItem.getLevelNumber().setScale(0, RoundingMode.FLOOR))>=0 && u.getRowId()!=exItem.getRowId() && u.getLevelNumber().compareTo(exItem.getLevelNumber()) < 0 && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList());
|
||||
warnList.forEach(k -> {
|
||||
k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue());
|
||||
});
|
||||
|
||||
}
|
||||
List<BomNewEbomParentVO> root = allBomDetail.stream().filter(u -> u.getLevelNumber().compareTo(BigDecimal.ZERO) == 0 && EBomExceptionStatusEnum.OK.equalsValue(u.getExceptionStatus())).collect(Collectors.toList());
|
||||
root.forEach(k->{
|
||||
k.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue());
|
||||
});
|
||||
|
||||
|
||||
// List<String> allErrorParent = SpringUtil.getBean(BomNewEbomParentService.class).getBatchParentMaterialByMaterialNo(exceptionMaterialNos);
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ public class EBomToPBom {
|
|||
@Getter
|
||||
private List<BomNewEbomUpgradeChangeEntity> upgradeChangeResult = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
private List<Long> hasConvertEBomRowIds=new ArrayList<>();
|
||||
// @Getter
|
||||
// private List<Long> hasConvertEBomRowIds=new ArrayList<>();
|
||||
|
||||
|
||||
private Map<String, String> generateDrawingNoMap = new HashMap<>();
|
||||
|
|
@ -152,7 +152,7 @@ public class EBomToPBom {
|
|||
.eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).one();
|
||||
|
||||
this.hasConvertEBomRowIds.add(parentVo.getRowId());
|
||||
// this.hasConvertEBomRowIds.add(parentVo.getRowId());
|
||||
if (Objects.nonNull(oldParent) && !EBomStatusEnum.PUBLISHED.equalsValue(oldParent.getStatus())) {
|
||||
SpringUtil.getBean(BomNewPbomChildService.class).getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id", oldParent.getRowId()));
|
||||
oldParent.setCurrentVersion(parentVo.getCurrentVersion());
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ public abstract class VirtualPackageBase {
|
|||
* 构建子级
|
||||
* @return
|
||||
*/
|
||||
protected BomNewEbomChildEntity buildChild(BomNewEbomParentEntity parent, Long parentRowId, String orderNo,VirtualPackageTypeEnum virtualPackageTypeEnum){
|
||||
protected BomNewEbomChildEntity buildChild(BomNewEbomParentEntity parent, Long parentRowId, String orderNo,VirtualPackageTypeEnum virtualPackageTypeEnum,String rootMaterialNo){
|
||||
BomNewEbomChildEntity childEntity =new BomNewEbomChildEntity();
|
||||
BeanUtil.copyProperties(parent,childEntity);
|
||||
childEntity.setRowId(IdWorker.getId());
|
||||
|
|
@ -119,6 +119,7 @@ public abstract class VirtualPackageBase {
|
|||
childEntity.setProjectType("L");
|
||||
childEntity.setMaterialUnit("PC");
|
||||
childEntity.setProjectTypeInputType(ProjectTypeInputTypeEnum.AUTO_MATCH.getValue());
|
||||
childEntity.setVirtualPartRootMaterialNo(rootMaterialNo);
|
||||
this.childResult.add(childEntity);
|
||||
return childEntity;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
|
|||
//构建构建发货包下直发
|
||||
BomNewEbomParentEntity directDeliveryPackage = buildParentVirtualPackage(parent.getDrawingNo(), parent.getMaterialName(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
//构建产品-子级为制作包合直发包
|
||||
buildChild(makingPackage, bomRowId, "001", VirtualPackageTypeEnum.MAKING_PACKAGE);
|
||||
buildChild(directDeliveryPackage, bomRowId, "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
buildChild(makingPackage, bomRowId, "001", VirtualPackageTypeEnum.MAKING_PACKAGE,parent.getMaterialNo());
|
||||
buildChild(directDeliveryPackage, bomRowId, "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,parent.getMaterialNo());
|
||||
|
||||
}
|
||||
if(virtualPackageValue.contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) && (parent.getVirtrualPackageEnum()| VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue())!=VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getValue()) {
|
||||
|
|
@ -53,7 +53,7 @@ public class VirtualPackageFor21 extends VirtualPackageBase {
|
|||
makingPackage=getParentZhiZuo();
|
||||
}
|
||||
BomNewEbomParentEntity preAssemblyPackage = buildParentVirtualPackage(parent.getDrawingNo(), parent.getMaterialName(), VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
buildChild(preAssemblyPackage, makingPackage.getRowId(), "001", VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
buildChild(preAssemblyPackage, makingPackage.getRowId(), "001", VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE,parent.getMaterialNo());
|
||||
|
||||
}
|
||||
List<BomNewEbomParentVO> child = getChild();
|
||||
|
|
|
|||
|
|
@ -50,11 +50,11 @@ public class VirtualPackageFor31 extends VirtualPackageBase {
|
|||
BomNewEbomParentEntity directDeliveryPackage = buildParentVirtualPackage(item.getDrawingNo(), item.getMaterialName(), VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
|
||||
//构建-产品下发货包-子级
|
||||
buildChild(deliveryPackage, bomRowId, "001", VirtualPackageTypeEnum.DELIVERY_PACKAGE);
|
||||
buildChild(deliveryPackage, bomRowId, "001", VirtualPackageTypeEnum.DELIVERY_PACKAGE,parent.getMaterialNo());
|
||||
|
||||
//构建发货包-子级
|
||||
buildChild(makingPackage, deliveryPackage.getRowId(), "001", VirtualPackageTypeEnum.MAKING_PACKAGE);
|
||||
buildChild(directDeliveryPackage, deliveryPackage.getRowId(), "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE);
|
||||
buildChild(makingPackage, deliveryPackage.getRowId(), "001", VirtualPackageTypeEnum.MAKING_PACKAGE,parent.getMaterialNo());
|
||||
buildChild(directDeliveryPackage, deliveryPackage.getRowId(), "002", VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE,parent.getMaterialNo());
|
||||
|
||||
BomNewEbomChildEntity itemUp = new BomNewEbomChildEntity();
|
||||
itemUp.setRowId(item.getRowId());
|
||||
|
|
@ -68,7 +68,7 @@ public class VirtualPackageFor31 extends VirtualPackageBase {
|
|||
if(Objects.isNull(makingPackage)){
|
||||
makingPackage=getParentZhiZuo();
|
||||
}
|
||||
buildChild(preAssemblyPackage, makingPackage.getRowId(), "001", VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE);
|
||||
buildChild(preAssemblyPackage, makingPackage.getRowId(), "001", VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE,parent.getMaterialNo());
|
||||
}
|
||||
}
|
||||
parent.setVirtrualPackageEnum(getVPackageNum(parent));
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
<result column="source_row_id" property="sourceRowId" jdbcType="BIGINT"/>
|
||||
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
||||
<result column="virtual_part_type" property="virtualPartType" jdbcType="INTEGER"/>
|
||||
<result column="virtual_part_root_material_no" property="virtualPartRootMaterialNo" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
|
|
@ -37,7 +38,7 @@
|
|||
row_id, parent_row_id, identity_no, order_number, drawing_no, material_no, material_name, material_desc,
|
||||
material_texture, material_unit, material_category_code, unit_weight, num, total_weight, project_type,
|
||||
project_type_input_type, created_by,virtual_part_is, created_time, modify_time, edit_status, exception_status, source,
|
||||
source_row_id, remark,virtual_part_type
|
||||
source_row_id, remark,virtual_part_type,virtual_part_root_material_no
|
||||
</sql>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -33,11 +33,12 @@
|
|||
<result column="remark" property="remark" jdbcType="VARCHAR"/>
|
||||
<result column="source_parent_material_no" property="sourceParentMaterialNo" jdbcType="VARCHAR"/>
|
||||
<result column="virtual_part_type" property="virtualPartType" jdbcType="INTEGER"/>
|
||||
<result column="virtual_part_root_material_no" property="virtualPartRootMaterialNo"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
row_id, parent_row_id, identity_no, fac_code, order_number, drawing_no, material_no, material_name, material_desc, material_texture, material_unit, material_category_code, unit_weight, num, total_weight, project_type, production_factory_code,production_factory_code_input_type, set_production_factory_time, super_material_status, virtual_part_is, created_by, created_time, modify_time, source_row_id, remark, source_parent_material_no ,virtual_part_type </sql>
|
||||
row_id, parent_row_id, identity_no, fac_code, order_number, drawing_no, material_no, material_name, material_desc, material_texture, material_unit, material_category_code, unit_weight, num, total_weight, project_type, production_factory_code,production_factory_code_input_type, set_production_factory_time, super_material_status, virtual_part_is, created_by, created_time, modify_time, source_row_id, remark, source_parent_material_no ,virtual_part_type ,virtual_part_root_material_no </sql>
|
||||
|
||||
|
||||
<delete id="delByRowId">
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@
|
|||
c.row_id as bomRowId, c.row_id as childBomRowId, b.*
|
||||
from t_bom_new_pbom_parent a
|
||||
join t_bom_new_pbom_child b on a.row_id =b.parent_row_id
|
||||
left join t_bom_new_pbom_parent c on b.material_no=c.material_no and c.last_version_is=1
|
||||
left join t_bom_new_pbom_parent c on b.material_no=c.material_no and b.fac_code=c.fac_code and c.last_version_is=1
|
||||
where a.last_version_is=1
|
||||
<if test="userFac!=null and userFac!=''">
|
||||
and a.fac_code=#{userFac}
|
||||
|
|
|
|||
Loading…
Reference in New Issue