Merge branch 'feature/DM/nflg-bom' of http://112.74.186.154:3000/nflj/nflg_project into feature/DM/nflg-bom
# Conflicts: # nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/domain/EBom/CheckEBomException.java
This commit is contained in:
commit
cfc4280ba5
|
|
@ -14,10 +14,7 @@ import com.nflg.product.bomnew.pojo.query.BomNewEbomMaterialQuery;
|
|||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.*;
|
||||
import com.nflg.product.bomnew.service.BomNewEbomParentService;
|
||||
import com.nflg.product.bomnew.service.BomNewOriginalParentService;
|
||||
import com.nflg.product.bomnew.service.MaterialMainService;
|
||||
import com.nflg.product.bomnew.service.UserRoleService;
|
||||
import com.nflg.product.bomnew.service.*;
|
||||
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageBase;
|
||||
import com.nflg.product.bomnew.service.domain.EBom.VirtualPackageFor31;
|
||||
import com.nflg.product.bomnew.util.EecExcelUtil;
|
||||
|
|
@ -66,6 +63,9 @@ public class EbomApi extends BaseApi {
|
|||
@Resource
|
||||
private UserRoleService userRoleService;
|
||||
|
||||
@Resource
|
||||
private BomNewEbomUpgradeChangeService upgradeChangeService;
|
||||
|
||||
|
||||
@PostMapping("workDetailsListByPage")
|
||||
@ApiOperation("Ebom-工作明细列表")
|
||||
|
|
@ -81,10 +81,28 @@ public class EbomApi extends BaseApi {
|
|||
|
||||
@PostMapping("changeImpact")
|
||||
@ApiOperation("Ebom-变更影响")
|
||||
public ResultVO<Page<BomNewEbomParentVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
|
||||
return ResultVO.success(bomNewEbomParentService.formalWorksheet(query));
|
||||
public ResultVO<Page<BomNewEbomUpgradeChangeVO>> changeImpact(@RequestBody BomNewEbomParentQuery query) {
|
||||
return ResultVO.success(bomNewEbomParentService.getUpgradeChangeList(query));
|
||||
}
|
||||
|
||||
@PostMapping("delChangeImpact")
|
||||
@ApiOperation("Ebom-删除变更影响")
|
||||
public ResultVO<Boolean> delChangeImpact(@RequestBody List<Long> rowIds){
|
||||
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要删除的数据");
|
||||
upgradeChangeService.delChangeImpact(rowIds);
|
||||
return ResultVO.success(true);
|
||||
}
|
||||
|
||||
@PostMapping("updateChangeImpactVersion")
|
||||
@ApiOperation("Ebom-更新版本")
|
||||
public ResultVO<Boolean> updateChangeImpactVersion(@RequestBody List<Long> rowIds){
|
||||
VUtils.isTure(CollUtil.isEmpty(rowIds)).throwMessage("请选择要更新版本的数据");
|
||||
upgradeChangeService.updateChangeImpactVersion(rowIds);
|
||||
return ResultVO.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("getChild")
|
||||
@ApiOperation("获取子级")
|
||||
public ResultVO<List<BomNewEbomParentVO>> getChild(@RequestParam("bomRowId") Long bomRowId) {
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ import java.util.concurrent.ExecutionException;
|
|||
@Api(tags = "原始BOM")
|
||||
@RestController
|
||||
@RequestMapping("bom/new/bomOriginal")
|
||||
public class OriginalBomApi extends BaseApi {
|
||||
public class OriginalBomApi extends BaseApi {
|
||||
|
||||
@Resource
|
||||
BomNewOriginalParentService originalParentService;
|
||||
|
|
@ -78,15 +78,16 @@ public class OriginalBomApi extends BaseApi {
|
|||
public ResultVO<List<TreeNode<BomOriginalListVO>>> getChildTree(@RequestParam("rowId") Long rowId) throws ExecutionException, InterruptedException {
|
||||
return ResultVO.success(originalParentService.getChildTree(rowId));
|
||||
}
|
||||
|
||||
@PostMapping("saveBom")
|
||||
@ApiOperation("编辑时-暂存")
|
||||
public ResultVO<Boolean> saveBom(@Valid @RequestBody OriginalSaveBomDTO bom) {
|
||||
return ResultVO.success(originalParentService.saveBom(bom,false));
|
||||
return ResultVO.success(originalParentService.saveBom(bom, false));
|
||||
}
|
||||
|
||||
@PostMapping("saveSubmit")
|
||||
@ApiOperation("编辑时-提交")
|
||||
public ResultVO<Boolean> saveSubmit(@Valid @RequestBody OriginalSaveBomDTO bom) {
|
||||
public ResultVO<Boolean> saveSubmit(@Valid @RequestBody OriginalSaveBomDTO bom) {
|
||||
return ResultVO.success(originalParentService.saveSubmit(bom));
|
||||
}
|
||||
|
||||
|
|
@ -120,6 +121,7 @@ public class OriginalBomApi extends BaseApi {
|
|||
|
||||
/**
|
||||
* 原始BOM转EBom
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("convertToEBom")
|
||||
|
|
@ -128,7 +130,7 @@ public class OriginalBomApi extends BaseApi {
|
|||
public ResultVO<Boolean> convertToEBom(@RequestBody List<Long> bomRowIds) throws ExecutionException, InterruptedException {
|
||||
|
||||
VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要转换的BOM");
|
||||
VUtils.isTure(bomRowIds.size()>20).throwMessage("你选择的BOM数据大于20");
|
||||
VUtils.isTure(bomRowIds.size() > 20).throwMessage("你选择的BOM数据大于20");
|
||||
originalParentService.convertToEBom(bomRowIds);
|
||||
//更新物料使用
|
||||
bomNewEbomChildMapper.updateEBomMaterialUse();
|
||||
|
|
@ -152,7 +154,7 @@ public class OriginalBomApi extends BaseApi {
|
|||
@ApiOperation("导入")
|
||||
@PostMapping("importBom")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO<Boolean> importBom(@RequestParam(value = "file")MultipartFile file) throws IOException {
|
||||
public ResultVO<Boolean> importBom(@RequestParam(value = "file") MultipartFile file) throws IOException {
|
||||
if (file != null && !file.getOriginalFilename().endsWith("xls") && !file.getOriginalFilename().endsWith("xlsx")) {
|
||||
return ResultVO.error("请上传Excel文件");
|
||||
}
|
||||
|
|
@ -160,12 +162,7 @@ public class OriginalBomApi extends BaseApi {
|
|||
|
||||
//计算层级
|
||||
originalParentService.computeLevelNumAndRootState();
|
||||
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
||||
// @Override
|
||||
// public void afterCommit() {
|
||||
// originalParentService.computeLevelNumAndRootState();
|
||||
// }
|
||||
// });
|
||||
|
||||
|
||||
return ResultVO.success(true);
|
||||
}
|
||||
|
|
@ -174,18 +171,18 @@ public class OriginalBomApi extends BaseApi {
|
|||
@ApiOperation("新增物料")
|
||||
@GetMapping("testaddMaterial")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO<String> testaddMaterial(@RequestParam(value = "drawingNo" ,required = false)String drawingNo,
|
||||
@RequestParam(value = "materialName" ,required = false)String materialName,
|
||||
@RequestParam("materialCategoryCode")String materialCategoryCode) throws IOException {
|
||||
public ResultVO<String> testaddMaterial(@RequestParam(value = "drawingNo", required = false) String drawingNo,
|
||||
@RequestParam(value = "materialName", required = false) String materialName,
|
||||
@RequestParam("materialCategoryCode") String materialCategoryCode) throws IOException {
|
||||
|
||||
materialService.addMaterial(drawingNo, materialName,materialCategoryCode);
|
||||
materialService.addMaterial(drawingNo, materialName, materialCategoryCode);
|
||||
return ResultVO.success("true");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取sessionKey")
|
||||
@GetMapping("getSessionKey")
|
||||
public ResultVO<String> getSessionKey() {
|
||||
public ResultVO<String> getSessionKey() {
|
||||
|
||||
|
||||
return ResultVO.success(SessionUtil.getSessionKey());
|
||||
|
|
@ -196,19 +193,16 @@ public class OriginalBomApi extends BaseApi {
|
|||
@PostMapping("testImportBom")
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public ResultVO<Boolean> testImportBom() throws IOException {
|
||||
InputStream inputStream=new FileInputStream("C:\\Users\\01956\\Desktop\\西卡印尼烘干线总站BOM.xlsx");
|
||||
InputStream inputStream = new FileInputStream("C:\\Users\\01956\\Desktop\\西卡印尼烘干线总站BOM.xlsx");
|
||||
originalParentService.importBomTest(inputStream);
|
||||
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
|
||||
@Override
|
||||
public void afterCommit() {
|
||||
originalParentService.computeLevelNumAndRootState();
|
||||
}
|
||||
});
|
||||
|
||||
// originalParentService.computeLevelNumAndRootState();
|
||||
|
||||
originalParentService.computeLevelNumAndRootState();
|
||||
|
||||
|
||||
return ResultVO.success(true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.nflg.product.bomnew.pojo.entity.BomNewEbomParentEntity;
|
|||
import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery;
|
||||
import com.nflg.product.bomnew.pojo.query.OriginalBomQuery;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.BomOriginalListVO;
|
||||
import com.nflg.product.bomnew.pojo.vo.MaterialHistoryProjectTypeVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
|
@ -38,6 +39,8 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
* @return
|
||||
*/
|
||||
Page<BomNewEbomParentVO> formalWorksheet(Page<BomNewEbomParentVO> page, @Param("query") BomNewEbomParentQuery query);
|
||||
|
||||
Page<BomNewEbomUpgradeChangeVO> getUpgradeChangeList(Page<BomNewEbomUpgradeChangeVO> page, @Param("query") BomNewEbomParentQuery query);
|
||||
/**
|
||||
* 获取子级
|
||||
* @param rowId
|
||||
|
|
@ -58,4 +61,6 @@ public interface BomNewEbomParentMapper extends BaseMapper<BomNewEbomParentEntit
|
|||
void updateRootState();
|
||||
|
||||
void delBatch(@Param("rowIds") List<Long> rowIds);
|
||||
|
||||
void updateStateBatchByRowIds(@Param("status") Integer status, @Param("list") List<Long> list );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,5 +33,8 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
|
|||
/**
|
||||
* 更新是否根节点状态
|
||||
*/
|
||||
void updateRootState();
|
||||
void updateRootState_1();
|
||||
|
||||
void updateRootState_2();
|
||||
void updateRootState_3();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,96 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_upgrade_change
|
||||
* ebom-变更影响
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2023-12-23 16:10:19
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="com-nflg-product-bomnew-pojo-new-vo-BomNewEbomUpgradeChangeEntityVO")
|
||||
public class BomNewEbomUpgradeChangeVO implements Serializable {
|
||||
|
||||
/**
|
||||
* 主键-行ID
|
||||
*/
|
||||
@ApiModelProperty(value = "主键-行ID")
|
||||
private Long rowId;
|
||||
|
||||
/**
|
||||
* 受影响的物料编码
|
||||
*/
|
||||
@ApiModelProperty(value = "受影响的物料编码")
|
||||
private String materialNo;
|
||||
|
||||
/**
|
||||
* 修订版(旧)
|
||||
*/
|
||||
@ApiModelProperty(value = "修订版(旧)")
|
||||
private String versionOld;
|
||||
|
||||
/**
|
||||
* 修订版(新)
|
||||
*/
|
||||
@ApiModelProperty(value = "修订版(新)")
|
||||
private String versionNew;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String materialName;
|
||||
|
||||
/**
|
||||
* 图号
|
||||
*/
|
||||
@ApiModelProperty(value = "图号")
|
||||
private String drawingNo;
|
||||
|
||||
/**
|
||||
* 设计人员
|
||||
*/
|
||||
@ApiModelProperty(value = "设计人员")
|
||||
private String deviseName;
|
||||
|
||||
/**
|
||||
* 设计人员部门
|
||||
*/
|
||||
@ApiModelProperty(value = "设计人员部门")
|
||||
private String deptName;
|
||||
|
||||
/**
|
||||
* 关联物料编码
|
||||
*/
|
||||
@ApiModelProperty(value = "关联物料编码")
|
||||
private String relMaterialNo;
|
||||
|
||||
/**
|
||||
* 关联物料描述
|
||||
*/
|
||||
@ApiModelProperty(value = "关联物料描述")
|
||||
private String relMaterialDesc;
|
||||
|
||||
/**
|
||||
* 状态:0-未升级处理 1-已升级处理
|
||||
*/
|
||||
@ApiModelProperty(value = "状态:0-未升级处理 1-已升级处理")
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private LocalDateTime updatedTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
@ -201,6 +201,20 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取变更影响
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
public Page<BomNewEbomUpgradeChangeVO> getUpgradeChangeList(BomNewEbomParentQuery query) {
|
||||
Page<BomNewEbomUpgradeChangeVO> result = this.getBaseMapper().getUpgradeChangeList(new Page<>(query.getPage(), query.getPageSize()), query);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取子级
|
||||
*
|
||||
|
|
@ -248,6 +262,8 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
}
|
||||
}
|
||||
}
|
||||
//初始化错误
|
||||
initBomException(parentChild);
|
||||
return parentChild;
|
||||
|
||||
}
|
||||
|
|
@ -446,11 +462,16 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
BomNewEbomParentVO parent = Convert.convert(BomNewEbomParentVO.class, this.getById(bomRowId));
|
||||
List<BomNewEbomParentVO> bomTree = getBomTree(bomRowId);
|
||||
|
||||
EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree, paramDto.getFacCodes());
|
||||
parent.setBomRowId(parent.getRowId());
|
||||
parent.setChildBomRowId(parent.getRowId());
|
||||
parent.setParentRowId(0L);
|
||||
bomTree.add(parent);
|
||||
EBomToPBom eBomToPBom = new EBomToPBom(parent, bomTree, paramDto.getFacCodes(),0L);
|
||||
eBomToPBom.convert();
|
||||
|
||||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomParentResult())) {
|
||||
pBomParentService.saveOrUpdateBatch(eBomToPBom.getPBomParentResult());
|
||||
|
||||
}
|
||||
if (CollUtil.isNotEmpty(eBomToPBom.getPBomChildResult())) {
|
||||
pBomChildService.saveOrUpdateBatch(eBomToPBom.getPBomChildResult());
|
||||
|
|
@ -461,6 +482,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());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@ import com.nflg.product.bomnew.mapper.master.BomNewEbomUpgradeChangeMapper;
|
|||
import com.nflg.product.bomnew.pojo.entity.BomNewEbomUpgradeChangeEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* t_bom_new_ebom_upgrade_change 表服务实现类
|
||||
|
|
@ -16,4 +18,25 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class BomNewEbomUpgradeChangeService extends ServiceImpl<BomNewEbomUpgradeChangeMapper, BomNewEbomUpgradeChangeEntity> {
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
public void delChangeImpact(List<Long> rowIds){
|
||||
this.getBaseMapper().deleteBatchIds(rowIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新版本
|
||||
*/
|
||||
public void updateChangeImpactVersion(List<Long> rowIds){
|
||||
List<BomNewEbomUpgradeChangeEntity> upList = this.getBaseMapper().selectBatchIds(rowIds);
|
||||
//
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.product.base.core.config.SpringContextUtils;
|
||||
import com.nflg.product.base.core.conmon.util.SessionUtil;
|
||||
import com.nflg.product.base.core.exception.NflgBusinessException;
|
||||
import com.nflg.product.bomnew.constant.OriginalConstant;
|
||||
import com.nflg.product.bomnew.constant.OriginalEditStatusEnum;
|
||||
import com.nflg.product.bomnew.constant.OriginalSourceEnum;
|
||||
|
|
@ -99,22 +100,22 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
* @param bom
|
||||
* @return
|
||||
*/
|
||||
public Boolean saveBom(OriginalSaveBomDTO bom ,Boolean submitIs) {
|
||||
public Boolean saveBom(OriginalSaveBomDTO bom, Boolean submitIs) {
|
||||
|
||||
List<BomOriginalListVO> saveEnts = bom.getBomList().stream().filter(u -> u.getDelIs().equals(0)).collect(Collectors.toList());
|
||||
List<BomNewOriginalChildEntity> childEntities = Convert.toList(BomNewOriginalChildEntity.class, saveEnts);
|
||||
// originalChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id",bom.getParentRowId()));
|
||||
childEntities.forEach(u -> {
|
||||
u.setParentRowId(bom.getParentRowId());
|
||||
if(submitIs){
|
||||
if (submitIs) {
|
||||
u.setEditStatus(OriginalEditStatusEnum.HANDLER_FINISHED.getValue());
|
||||
}
|
||||
});
|
||||
|
||||
if (CollUtil.isNotEmpty(childEntities)) {
|
||||
//删除行
|
||||
List<Long> delRowIds = bom.getBomList().stream().filter(u->u.getRowId()>0).map(u-> u.getRowId()).collect(Collectors.toList());
|
||||
originalChildService.getBaseMapper().delOriginalChildNotInRowIds(delRowIds,bom.getParentRowId());
|
||||
List<Long> delRowIds = bom.getBomList().stream().filter(u -> u.getRowId() > 0).map(u -> u.getRowId()).collect(Collectors.toList());
|
||||
originalChildService.getBaseMapper().delOriginalChildNotInRowIds(delRowIds, bom.getParentRowId());
|
||||
originalChildService.saveOrUpdateBatch(childEntities);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -128,7 +129,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
* @return
|
||||
*/
|
||||
public Boolean saveSubmit(OriginalSaveBomDTO bom) {
|
||||
saveBom(bom,true);
|
||||
saveBom(bom, true);
|
||||
//将状态变为已处理
|
||||
BomNewOriginalParentEntity parentEntity = new BomNewOriginalParentEntity();
|
||||
parentEntity.setRowId(bom.getParentRowId());
|
||||
|
|
@ -161,13 +162,13 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
child.setStatus(parentEntity.getStatus());
|
||||
child.setDeviseName(parentEntity.getDeviseName());
|
||||
child.setDeviseUserCode(parentEntity.getDeviseUserCode());
|
||||
// child.setCreatedBy(parentEntity.getCreatedBy());
|
||||
// child.setCreatedTime(parentEntity.getCreatedTime());
|
||||
// child.setCreatedBy(parentEntity.getCreatedBy());
|
||||
// child.setCreatedTime(parentEntity.getCreatedTime());
|
||||
child.setBomRowId(parentEntity.getRowId());
|
||||
child.setLevelNum(parentEntity.getLevelNum());
|
||||
child.setDeptName(parentEntity.getDeptName());
|
||||
child.setSource(parentEntity.getSource());
|
||||
if(parentEntity.getStatus().equals(OriginalStatusEnum.OVER_CONVERT)){
|
||||
if (parentEntity.getStatus().equals(OriginalStatusEnum.OVER_CONVERT)) {
|
||||
child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue());
|
||||
}
|
||||
//非本人则为借用件
|
||||
|
|
@ -233,7 +234,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
for (BomNewOriginalParentEntity bom : list) {
|
||||
bom.setRootIs(1);
|
||||
// bom.setRootIs(1);
|
||||
List<BomOriginalListVO> bomDetail = this.getBaseMapper().getParentChild(bom.getRowId());
|
||||
OriginalBomDetailTask detailTask = new OriginalBomDetailTask(bomDetail);
|
||||
detailTask.setLevelNum(1);
|
||||
|
|
@ -284,16 +285,18 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
* 计算层级数和根节点状态
|
||||
*/
|
||||
public void computeLevelNumAndRootState() {
|
||||
//计算树的层级数
|
||||
// CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
this.getBaseMapper().updateRootState();
|
||||
this.compucteLevelNum();
|
||||
|
||||
} catch (Exception e) {
|
||||
log.info("计算层级出错:"+e.getMessage());
|
||||
}
|
||||
// });
|
||||
try {
|
||||
this.getBaseMapper().updateRootState_1();
|
||||
this.getBaseMapper().updateRootState_2();
|
||||
this.getBaseMapper().updateRootState_3();
|
||||
this.compucteLevelNum();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
|
||||
log.info("计算层级出错:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -310,8 +313,8 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
List<BomOriginalListVO> bomTree = getBomTree(bomRowId);
|
||||
//需删除的BOM
|
||||
List<BomOriginalListVO> delBom = bomTree.stream().filter(u -> u.getBomRowId() > 0 && OriginalStatusEnum.UN_CONVERT.equalsValue(u.getStatus())).collect(Collectors.toList());
|
||||
List<Long> delParentRowId=new ArrayList<>();
|
||||
for ( BomOriginalListVO bom: delBom) {
|
||||
List<Long> delParentRowId = new ArrayList<>();
|
||||
for (BomOriginalListVO bom : delBom) {
|
||||
delParentRowId.add(bom.getBomRowId());
|
||||
}
|
||||
delParentRowId.add(bomRowId);
|
||||
|
|
@ -333,7 +336,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
List<BomNewOriginalParentEntity> bomNewOriginalParentEntities = this.getBaseMapper().selectBatchIds(bomRowIds);
|
||||
|
||||
List<BomNewOriginalParentEntity> convertedBom = bomNewOriginalParentEntities.stream().filter(u -> OriginalStatusEnum.OVER_CONVERT.equalsValue(u.getStatus())).collect(Collectors.toList());
|
||||
// VUtils.isTure(CollUtil.isNotEmpty(convertedBom)).throwMessage("所选BOM中存在已转换的BOM");
|
||||
// VUtils.isTure(CollUtil.isNotEmpty(convertedBom)).throwMessage("所选BOM中存在已转换的BOM");
|
||||
|
||||
//开始转换
|
||||
for (BomNewOriginalParentEntity parent : bomNewOriginalParentEntities) {
|
||||
|
|
@ -385,17 +388,16 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
/**
|
||||
* 原始BOM导入
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importBom(MultipartFile file) throws IOException {
|
||||
rowNum.set(1);
|
||||
excelContextTL.set(new ArrayList<>());
|
||||
String uuid = IdUtil.simpleUUID();
|
||||
EecExcelUtil.handlerExcel(file.getInputStream(), BomNewOriginalExcelDTO.class, BomNewOriginalParentService::handlerExcelRow);
|
||||
List<BomNewOriginalExcelDTO> excelContext = excelContextTL.get();
|
||||
List<Integer> noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u->u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noLevelNo)).throwMessage(StrUtil.join(",",noLevelNo )+"层次为空");
|
||||
List<Integer> noDrawingNo = excelContext.stream().filter(u -> StrUtil.isBlank(u.getChartNo())).map(u->u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noDrawingNo)).throwMessage(StrUtil.join(",",noDrawingNo )+"图号为空");
|
||||
List<Integer> noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u -> u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noLevelNo)).throwMessage(StrUtil.join(",", noLevelNo) + "层次为空");
|
||||
List<Integer> noDrawingNo = excelContext.stream().filter(u -> StrUtil.isBlank(u.getChartNo())).map(u -> u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noDrawingNo)).throwMessage(StrUtil.join(",", noDrawingNo) + "图号为空");
|
||||
// List<Integer> noNum = excelContext.stream().filter(u -> Objects.isNull(u.getQty())).map(u->u.getRowNum()).collect(Collectors.toList());
|
||||
// VUtils.isTure(CollUtil.isNotEmpty(noNum)).throwMessage( StrUtil.join(",",noNum )+"数量为空");
|
||||
|
||||
|
|
@ -410,7 +412,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
PlmBomToOriginalConvert convert = new PlmBomToOriginalConvert();
|
||||
List<BomNewOriginalExcelDTO> chileds = excelContext.stream().filter(u -> u.getParentKey().equals(data.getLevelNo() + "-" + data.getRowNum())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(chileds)) {
|
||||
int i=1;
|
||||
int i = 1;
|
||||
for (BomNewOriginalExcelDTO ch : chileds) {
|
||||
ch.setOrderNo(i);
|
||||
i++;
|
||||
|
|
@ -430,8 +432,8 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
|
||||
public static void handlerExcelRow(BomNewOriginalExcelDTO data) {
|
||||
data.setRowNum(rowNum.get());
|
||||
// data.setOrderNo(data.getLevelNo());
|
||||
data.setChartNo(StrUtil.trim(data.getChartNo()).replace("(","(").replace(")",")").replace(" ",""));
|
||||
// data.setOrderNo(data.getLevelNo());
|
||||
data.setChartNo(StrUtil.trim(data.getChartNo()).replace("(", "(").replace(")", ")").replace(" ", ""));
|
||||
rowNum.set(rowNum.get() + 1);
|
||||
|
||||
excelContextTL.get().add(data);
|
||||
|
|
@ -446,12 +448,12 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
String uuid = IdUtil.simpleUUID();
|
||||
EecExcelUtil.handlerExcel(file, BomNewOriginalExcelDTO.class, BomNewOriginalParentService::handlerExcelRow);
|
||||
List<BomNewOriginalExcelDTO> excelContext = excelContextTL.get();
|
||||
List<Integer> noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u->u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noLevelNo)).throwMessage(StrUtil.join(",",noLevelNo )+"层次为空");
|
||||
List<Integer> noDrawingNo = excelContext.stream().filter(u -> StrUtil.isBlank(u.getChartNo())).map(u->u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noDrawingNo)).throwMessage(StrUtil.join(",",noDrawingNo )+"图号为空");
|
||||
List<Integer> noNum = excelContext.stream().filter(u -> Objects.isNull(u.getQty())).map(u->u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noNum)).throwMessage( StrUtil.join(",",noNum )+"数量为空");
|
||||
List<Integer> noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u -> u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noLevelNo)).throwMessage(StrUtil.join(",", noLevelNo) + "层次为空");
|
||||
List<Integer> noDrawingNo = excelContext.stream().filter(u -> StrUtil.isBlank(u.getChartNo())).map(u -> u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noDrawingNo)).throwMessage(StrUtil.join(",", noDrawingNo) + "图号为空");
|
||||
List<Integer> noNum = excelContext.stream().filter(u -> Objects.isNull(u.getQty())).map(u -> u.getRowNum()).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(noNum)).throwMessage(StrUtil.join(",", noNum) + "数量为空");
|
||||
|
||||
for (BomNewOriginalExcelDTO data : excelContext) {
|
||||
List<BomNewOriginalExcelDTO> parentData = excelContext.stream().filter(u -> u.getLevelNo().equals(data.getLevelNo() - 1) && u.getRowNum() < data.getRowNum())
|
||||
|
|
@ -464,7 +466,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
|
|||
PlmBomToOriginalConvert convert = new PlmBomToOriginalConvert();
|
||||
List<BomNewOriginalExcelDTO> chileds = excelContext.stream().filter(u -> u.getParentKey().equals(data.getLevelNo() + "-" + data.getRowNum())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(chileds)) {
|
||||
int i=1;
|
||||
int i = 1;
|
||||
for (BomNewOriginalExcelDTO ch : chileds) {
|
||||
ch.setOrderNo(i);
|
||||
i++;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public class CheckEBomException {
|
|||
List<BomNewEbomParentVO> allBomDetail ;
|
||||
|
||||
public CheckEBomException(Long bomRowId) throws ExecutionException, InterruptedException {
|
||||
|
||||
// allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).getBomTree(bomRowId);
|
||||
// BomNewEbomParentEntity parent = SpringUtil.getBean(BomNewEbomParentService.class).getById(bomRowId);
|
||||
// BomNewEbomParentVO convert = Convert.convert(BomNewEbomParentVO.class, parent);
|
||||
|
|
@ -46,6 +47,7 @@ public class CheckEBomException {
|
|||
// allBomDetail.add(convert);
|
||||
|
||||
allBomDetail = SpringUtil.getBean(BomNewEbomParentService.class).buildBomTreeContainSelf(bomRowId);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ public class EBomDetailTask extends RecursiveTask<List<BomNewEbomParentVO>> {
|
|||
BomNewEbomParentEntity ebomParentEntity = stringBomNewOriginalParentEntityMap.get(detailVO.getMaterialNo());
|
||||
detailVO.setChildBomRowId(ebomParentEntity.getRowId());
|
||||
detailVO.setBomRowId(ebomParentEntity.getRowId());
|
||||
|
||||
detailVO.setCurrentVersion(ebomParentEntity.getCurrentVersion());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import com.nflg.product.bomnew.util.ListCommonUtil;
|
|||
import com.nflg.product.bomnew.util.VUtils;
|
||||
import com.nflg.product.bomnew.util.VersionUtil;
|
||||
import lombok.Getter;
|
||||
import org.bouncycastle.crypto.engines.EthereumIESEngine;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
|
@ -58,17 +59,20 @@ public class EBomToPBom {
|
|||
@Getter
|
||||
private List<BomNewEbomUpgradeChangeEntity> upgradeChangeResult = new ArrayList<>();
|
||||
|
||||
@Getter
|
||||
private List<Long> hasConvertEBomRowIds=new ArrayList<>();
|
||||
|
||||
|
||||
private Map<String, String> generateDrawingNoMap = new HashMap<>();
|
||||
|
||||
private Set<String> upChangeMaterialSet=new HashSet<>();
|
||||
private Set<String> upChangeMaterialSet = new HashSet<>();
|
||||
|
||||
|
||||
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes) {
|
||||
public EBomToPBom(BomNewEbomParentVO inParent, List<BomNewEbomParentVO> inAllBomDetail, List<String> inFacCodes, Long parentRowId) {
|
||||
this.parent = inParent;
|
||||
this.allBomDetail = inAllBomDetail;
|
||||
this.facCodes = inFacCodes;
|
||||
generateDrawingNo(allBomDetail, inParent.getRowId(), "");
|
||||
generateDrawingNo(allBomDetail, parentRowId, "");
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -83,6 +87,7 @@ public class EBomToPBom {
|
|||
List<BomNewEbomParentVO> parentList = result.stream().filter(u -> u.getBomRowId() > 0).collect(Collectors.toList());
|
||||
|
||||
for (String facCode : facCodes) {
|
||||
//buildPBomParent(parent, facCode);
|
||||
for (BomNewEbomParentVO vo : parentList) {
|
||||
BomNewPbomParentEntity parentEnt = buildPBomParent(vo, facCode);
|
||||
//子级
|
||||
|
|
@ -94,6 +99,7 @@ public class EBomToPBom {
|
|||
childEnt.setRowId(IdWorker.getId());
|
||||
childEnt.setParentRowId(parentEnt.getRowId());
|
||||
childEnt.setFacCode(facCode);
|
||||
childEnt.setIdentityNo(StrUtil.join("-", parentEnt.getMaterialNo(), eb.getMaterialNo()));
|
||||
this.pBomChildResult.add(childEnt);
|
||||
}
|
||||
}
|
||||
|
|
@ -121,6 +127,7 @@ public class EBomToPBom {
|
|||
.eq(BomNewPbomParentEntity::getMaterialNo, parentVo.getMaterialNo())
|
||||
.eq(BomNewPbomParentEntity::getFacCode, facCode).one();
|
||||
|
||||
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());
|
||||
|
|
@ -128,7 +135,7 @@ public class EBomToPBom {
|
|||
return oldParent;
|
||||
} else {
|
||||
BomNewPbomParentEntity pBomParent = new BomNewPbomParentEntity();
|
||||
BeanUtil.copyProperties( parentVo,pBomParent);
|
||||
BeanUtil.copyProperties(parentVo, pBomParent);
|
||||
pBomParent.setRowId(IdWorker.getId());
|
||||
pBomParent.setLastVersionIs(1);
|
||||
pBomParent.setFacCode(facCode);
|
||||
|
|
@ -155,8 +162,7 @@ public class EBomToPBom {
|
|||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
}
|
||||
else { //当没找到直发包时,记录到变更影响
|
||||
} else { //当没找到直发包时,记录到变更影响
|
||||
buildUpgradeChange(vo);
|
||||
}
|
||||
continue;
|
||||
|
|
@ -169,8 +175,7 @@ public class EBomToPBom {
|
|||
vo.setSourceParentMaterialNo(getParentMaterialNo(vo.getBomRowId()));
|
||||
vo.setParentRowId(lastVirtualPackage.getBomRowId());
|
||||
result.add(vo);
|
||||
}
|
||||
else { //当没找到直发包时,记录到变更影响
|
||||
} else { //当没找到直发包时,记录到变更影响
|
||||
buildUpgradeChange(vo);
|
||||
}
|
||||
continue;
|
||||
|
|
@ -180,35 +185,35 @@ public class EBomToPBom {
|
|||
}
|
||||
|
||||
//变更记录
|
||||
private void buildUpgradeChange(BomNewEbomParentVO vo){
|
||||
private void buildUpgradeChange(BomNewEbomParentVO vo) {
|
||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isNotEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentMaterialNo, voParent.get(0).getMaterialNo()).list();
|
||||
if(CollUtil.isNotEmpty(list)) {
|
||||
if(upChangeMaterialSet.contains(voParent.get(0).getMaterialNo())){
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
if (upChangeMaterialSet.contains(voParent.get(0).getMaterialNo())) {
|
||||
return;
|
||||
}
|
||||
Map<String, List<BomNewEbomVirtualPackageCompositionEntity>> vMaterialMap = ListCommonUtil.listGroupMap(list, BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo);
|
||||
Set<String> oldMaterialNoAndNumSet=new HashSet<>();
|
||||
for (String key: vMaterialMap.keySet()) {
|
||||
oldMaterialNoAndNumSet=vMaterialMap.get(key).stream().map(u->StrUtil.join("-", u.getChildMaterialNo(),u.getNum())).collect(Collectors.toSet());
|
||||
Set<String> oldMaterialNoAndNumSet = new HashSet<>();
|
||||
for (String key : vMaterialMap.keySet()) {
|
||||
oldMaterialNoAndNumSet = vMaterialMap.get(key).stream().map(u -> StrUtil.join("-", u.getChildMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
||||
|
||||
}
|
||||
Set<String> newSet = allBomDetail.stream().filter(u -> u.getParentRowId().equals(vo.getParentRowId()) && Objects.nonNull(u.getProjectType()) && vo.getProjectType().equals(u.getProjectType())).map(u -> StrUtil.join("-", u.getMaterialNo(), u.getNum())).collect(Collectors.toSet());
|
||||
//bom 发生了改变-影响了虚拟包
|
||||
if( CollUtil.isNotEmpty(Sets.difference(oldMaterialNoAndNumSet,newSet)) || CollUtil.isNotEmpty(Sets.difference(newSet,oldMaterialNoAndNumSet)) ){
|
||||
if (CollUtil.isNotEmpty(Sets.difference(oldMaterialNoAndNumSet, newSet)) || CollUtil.isNotEmpty(Sets.difference(newSet, oldMaterialNoAndNumSet))) {
|
||||
upChangeMaterialSet.add(parent.getMaterialNo());
|
||||
buildUpgradeChange(list, voParent.get(0));
|
||||
buildUpgradeChange(list, voParent.get(0));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void buildUpgradeChange(List<BomNewEbomVirtualPackageCompositionEntity> changeList,BomNewEbomParentVO parent){
|
||||
List<String> vmaterialNoList= changeList.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
||||
for (String vmaterialNo: vmaterialNoList) {
|
||||
BomNewEbomUpgradeChangeEntity changeEntity=new BomNewEbomUpgradeChangeEntity();
|
||||
private void buildUpgradeChange(List<BomNewEbomVirtualPackageCompositionEntity> changeList, BomNewEbomParentVO parent) {
|
||||
List<String> vmaterialNoList = changeList.stream().map(u -> u.getVirtualPackageMaterialNo()).distinct().collect(Collectors.toList());
|
||||
for (String vmaterialNo : vmaterialNoList) {
|
||||
BomNewEbomUpgradeChangeEntity changeEntity = new BomNewEbomUpgradeChangeEntity();
|
||||
changeEntity.setRowId(IdWorker.getId());
|
||||
changeEntity.setMaterialNo(vmaterialNo);
|
||||
changeEntity.setVersionOld(parent.getCurrentVersion());
|
||||
|
|
@ -224,7 +229,6 @@ public class EBomToPBom {
|
|||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 提层汇总数量
|
||||
*
|
||||
|
|
@ -234,16 +238,16 @@ public class EBomToPBom {
|
|||
private void liftingLayerSummary(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo) {
|
||||
BigDecimal sum = vo.getNum();
|
||||
String parentLevelNo = vo.getLevelNo().substring(0, vo.getLevelNo().length() - 2);
|
||||
List<String> parentFullPathMaterialNoList=new ArrayList<>();
|
||||
List<String> parentFullPathMaterialNoList = new ArrayList<>();
|
||||
while (parentLevelNo.length() >= lastVirtualPackage.getLevelNo().length()) {
|
||||
String pNo=parentLevelNo;
|
||||
String pNo = parentLevelNo;
|
||||
List<BomNewEbomParentVO> parentList = allBomDetail.stream().filter(u -> u.getLevelNo().equals(pNo) && !u.getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
|
||||
!u.getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !u.getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(parentList)) {
|
||||
sum = NumberUtil.mul(sum, parentList.get(0).getNum());
|
||||
parentFullPathMaterialNoList.add(parentList.get(0).getMaterialNo());
|
||||
}else {
|
||||
} else {
|
||||
parentFullPathMaterialNoList.add(vo.getMaterialNo());
|
||||
}
|
||||
parentLevelNo = parentLevelNo.substring(0, parentLevelNo.length() - 2);
|
||||
|
|
@ -251,32 +255,30 @@ public class EBomToPBom {
|
|||
}
|
||||
vo.setNum(sum);
|
||||
//构建虚拟包组成
|
||||
buildVirtualPackageComposition(lastVirtualPackage, vo,parentFullPathMaterialNoList);
|
||||
buildVirtualPackageComposition(lastVirtualPackage, vo, parentFullPathMaterialNoList);
|
||||
|
||||
}
|
||||
|
||||
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage,BomNewEbomParentVO vo, List<String> parentFullPathMaterialNoList){
|
||||
private void buildVirtualPackageComposition(BomNewEbomParentVO lastVirtualPackage, BomNewEbomParentVO vo, List<String> parentFullPathMaterialNoList) {
|
||||
Collections.reverse(parentFullPathMaterialNoList);
|
||||
String fullPath= StrUtil.join("-", parentFullPathMaterialNoList);
|
||||
String fullPath = StrUtil.join("-", parentFullPathMaterialNoList);
|
||||
List<BomNewEbomVirtualPackageCompositionEntity> list = SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).lambdaQuery()
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getParentFullPathMaterialNo, fullPath)
|
||||
.eq(BomNewEbomVirtualPackageCompositionEntity::getVirtualPackageMaterialNo, lastVirtualPackage.getMaterialNo()).list();
|
||||
//删除旧的
|
||||
if(CollUtil.isNotEmpty(list)){
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<Long> delRowIds = list.stream().map(u -> u.getRowId()).collect(Collectors.toList());
|
||||
SpringUtil.getBean(BomNewEbomVirtualPackageCompositionService.class).getBaseMapper().deleteBatchIds(delRowIds);
|
||||
}
|
||||
BomNewEbomVirtualPackageCompositionEntity packageCompositionEntity=new BomNewEbomVirtualPackageCompositionEntity();
|
||||
BomNewEbomVirtualPackageCompositionEntity packageCompositionEntity = new BomNewEbomVirtualPackageCompositionEntity();
|
||||
packageCompositionEntity.setRowId(IdWorker.getId());
|
||||
packageCompositionEntity.setVirtualPackageMaterialNo(lastVirtualPackage.getMaterialNo());
|
||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId()) ).collect(Collectors.toList());
|
||||
List<BomNewEbomParentVO> voParent = allBomDetail.stream().filter(u -> u.getBomRowId().equals(vo.getParentRowId())).collect(Collectors.toList());
|
||||
VUtils.isTure(CollUtil.isEmpty(voParent)).throwMessage(vo.getMaterialNo() + " 未找到父级");
|
||||
if(voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
|
||||
!voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName()))
|
||||
{
|
||||
if (voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.DIRECT_DELIVERY_PACKAGE.getConMaterialName()) &&
|
||||
!voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.PRE_ASSEMBLY_PACKAGE.getConMaterialName()) && !voParent.get(0).getMaterialName().contains(VirtualPackageTypeEnum.MAKING_PACKAGE.getConMaterialName())) {
|
||||
packageCompositionEntity.setParentMaterialNo(voParent.get(0).getMaterialNo());
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
packageCompositionEntity.setParentMaterialNo(vo.getMaterialNo());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class EbomInitProjectType {
|
|||
sameLevelChild = getChilds(child.getParentRowId());
|
||||
sResult = sameLevelChild.stream().filter(u -> u.getMaterialCategoryCode().startsWith("2005") || u.getMaterialCategoryCode().startsWith("2006")).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(sResult)) {
|
||||
List<String> projectType = sResult.stream().map(u -> u.getProjectType()).distinct().collect(Collectors.toList());
|
||||
List<String> projectType = sResult.stream().filter(u->StrUtil.isNotBlank(u.getProjectType())).map(u -> u.getProjectType()).distinct().collect(Collectors.toList());
|
||||
if (projectType.size() == 1 && projectType.get(0).equals("Q")) {
|
||||
child.setProjectType("Q");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,22 @@
|
|||
package com.nflg.product.bomnew.service.domain.EBom;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* 更新-变更影响版本
|
||||
*/
|
||||
public class UpdateChangeVersion {
|
||||
|
||||
@ApiModelProperty("变更行ID")
|
||||
private Long upChangeRowId;
|
||||
|
||||
|
||||
public UpdateChangeVersion (Long inUpChangeRowId){
|
||||
this.upChangeRowId=inUpChangeRowId;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -231,6 +231,7 @@ public class OriginalBomToEBomConvert extends BaseConvert {
|
|||
eBomParent.setConvertToEbomTime(LocalDateTime.now());
|
||||
eBomParent.setSourceRowId(parentEnt.getBomRowId());
|
||||
eBomParent.setLastVersionIs(1);
|
||||
eBomParent.setEditStatus(EbomEditStatusEnum.HANDLER_CREATED.getValue());
|
||||
eBomParent.setModifyTime(LocalDateTime.now());
|
||||
eBomParent.setBomExist(parentEnt.getBomRowId()>0?1:0);
|
||||
//工艺岗直接到已复核
|
||||
|
|
|
|||
|
|
@ -82,12 +82,12 @@
|
|||
<!--Ebom工作列表-->
|
||||
<select id="getEBomListPage" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
<if test="job==0">
|
||||
select * ,row_id as bomRowId from t_bom_new_ebom_parent where status=1 and created_by=#{createdBy} and user_root_is=1 and
|
||||
select * ,row_id as bomRowId from t_bom_new_ebom_parent where created_by=#{createdBy} and user_root_is=1 and
|
||||
(status=1 or status=3)
|
||||
<include refid="whr"/>
|
||||
</if>
|
||||
<if test="job==1">
|
||||
select * ,row_id as bomRowId from t_bom_new_ebom_parent where status=2 and user_root_is=1 and ( status=2 or status=4 )
|
||||
select * ,row_id as bomRowId from t_bom_new_ebom_parent where user_root_is=1 and ( status=2 or status=4 )
|
||||
<include refid="whr"/>
|
||||
</if>
|
||||
</select>
|
||||
|
|
@ -119,10 +119,31 @@
|
|||
|
||||
<!--BOM-正式工作表-->
|
||||
<select id="formalWorksheet" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
select row_id as bomRowId, * from t_bom_new_ebom_parent where status=4
|
||||
select * , row_id as bomRowId from t_bom_new_ebom_parent where status=4
|
||||
<include refid="whr"/>
|
||||
</select>
|
||||
|
||||
<sql id="getUpgradeChangeListWhr">
|
||||
<if test="query.drawingNo!=null and query.drawingNo!=''">
|
||||
and drawing_no=#{query.drawingNo}
|
||||
</if>
|
||||
<if test="query.materialNo!=null and query.materialNo!=''">
|
||||
and material_no=#{query.materialNo}
|
||||
</if>
|
||||
<if test="query.deviseName!=null and query.deviseName!=''">
|
||||
and devise_name=#{query.deviseName}
|
||||
</if>
|
||||
<if test="query.startDate!=null and query.startDate!=''">
|
||||
and updated_time between #{query.startDate} and #{query.endDate}
|
||||
</if>
|
||||
</sql>
|
||||
|
||||
<!--BOM-变更影响-->
|
||||
<select id="getUpgradeChangeList" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO">
|
||||
select * from t_bom_new_ebom_upgrade_change where status=0
|
||||
<include refid="getUpgradeChangeListWhr"/>
|
||||
</select>
|
||||
|
||||
<!--获取子级-->
|
||||
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO">
|
||||
select *
|
||||
|
|
@ -186,6 +207,13 @@
|
|||
</foreach>;
|
||||
</delete>
|
||||
|
||||
<update id="updateStateBatchByRowIds">
|
||||
update t_bom_new_ebom_parent set status=#{status} where row_id in
|
||||
<foreach collection="list" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
and status=2
|
||||
|
||||
<if test="query.startDate==null or query.startDate==''">
|
||||
and created_time> DATE_ADD(now(), INTERVAL -3 DAY)
|
||||
and convert_to_ebom_time> DATE_ADD(now(), INTERVAL -3 DAY)
|
||||
</if>
|
||||
</if>
|
||||
<if test="query.status==1">
|
||||
|
|
@ -111,7 +111,7 @@
|
|||
</delete>
|
||||
|
||||
<update id="updateBomState">
|
||||
update t_bom_new_original_parent set status = #{status} where
|
||||
update t_bom_new_original_parent set status = #{status},convert_to_ebom_time=now() where
|
||||
row_id in
|
||||
<foreach collection="rowIds" item="rowId" open="(" separator="," close=")">
|
||||
#{rowId}
|
||||
|
|
@ -124,23 +124,27 @@
|
|||
</foreach>;
|
||||
</update>
|
||||
|
||||
<update id="updateRootState">
|
||||
<update id="updateRootState_1">
|
||||
|
||||
update t_bom_new_original_parent set root_is=0,user_root_is=0 where last_version_is=1;
|
||||
update t_bom_new_original_parent set root_is=0,user_root_is=0 where last_version_is=1
|
||||
|
||||
</update>
|
||||
<update id="updateRootState_2">
|
||||
update t_bom_new_original_parent a join (
|
||||
select a.row_id from t_bom_new_original_parent a
|
||||
left join t_bom_new_original_child b
|
||||
on a.drawing_no=b.drawing_no
|
||||
where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.root_is=1;
|
||||
|
||||
where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.root_is=1
|
||||
</update>
|
||||
|
||||
<update id="updateRootState_3">
|
||||
update t_bom_new_original_parent a join (
|
||||
select a.row_id from t_bom_new_original_parent a
|
||||
left join t_bom_new_original_child b
|
||||
on a.drawing_no=b.drawing_no and a.created_by=b.created_by
|
||||
where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.user_root_is=1;
|
||||
|
||||
where a.last_version_is=1 and b.row_id is null ) t on a.row_id=t.row_id set a.user_root_is=1
|
||||
</update>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue