1.转EBOM

This commit is contained in:
大米 2023-12-24 11:57:51 +08:00
parent 9eb0dcd64f
commit eb19755b41
4 changed files with 71 additions and 68 deletions

View File

@ -47,7 +47,7 @@ import java.util.concurrent.ExecutionException;
@Api(tags = "原始BOM") @Api(tags = "原始BOM")
@RestController @RestController
@RequestMapping("bom/new/bomOriginal") @RequestMapping("bom/new/bomOriginal")
public class OriginalBomApi extends BaseApi { public class OriginalBomApi extends BaseApi {
@Resource @Resource
BomNewOriginalParentService originalParentService; BomNewOriginalParentService originalParentService;
@ -78,15 +78,16 @@ public class OriginalBomApi extends BaseApi {
public ResultVO<List<TreeNode<BomOriginalListVO>>> getChildTree(@RequestParam("rowId") Long rowId) throws ExecutionException, InterruptedException { public ResultVO<List<TreeNode<BomOriginalListVO>>> getChildTree(@RequestParam("rowId") Long rowId) throws ExecutionException, InterruptedException {
return ResultVO.success(originalParentService.getChildTree(rowId)); return ResultVO.success(originalParentService.getChildTree(rowId));
} }
@PostMapping("saveBom") @PostMapping("saveBom")
@ApiOperation("编辑时-暂存") @ApiOperation("编辑时-暂存")
public ResultVO<Boolean> saveBom(@Valid @RequestBody OriginalSaveBomDTO bom) { public ResultVO<Boolean> saveBom(@Valid @RequestBody OriginalSaveBomDTO bom) {
return ResultVO.success(originalParentService.saveBom(bom,false)); return ResultVO.success(originalParentService.saveBom(bom, false));
} }
@PostMapping("saveSubmit") @PostMapping("saveSubmit")
@ApiOperation("编辑时-提交") @ApiOperation("编辑时-提交")
public ResultVO<Boolean> saveSubmit(@Valid @RequestBody OriginalSaveBomDTO bom) { public ResultVO<Boolean> saveSubmit(@Valid @RequestBody OriginalSaveBomDTO bom) {
return ResultVO.success(originalParentService.saveSubmit(bom)); return ResultVO.success(originalParentService.saveSubmit(bom));
} }
@ -120,6 +121,7 @@ public class OriginalBomApi extends BaseApi {
/** /**
* 原始BOM转EBom * 原始BOM转EBom
*
* @return * @return
*/ */
@PostMapping("convertToEBom") @PostMapping("convertToEBom")
@ -128,7 +130,7 @@ public class OriginalBomApi extends BaseApi {
public ResultVO<Boolean> convertToEBom(@RequestBody List<Long> bomRowIds) throws ExecutionException, InterruptedException { public ResultVO<Boolean> convertToEBom(@RequestBody List<Long> bomRowIds) throws ExecutionException, InterruptedException {
VUtils.isTure(CollUtil.isEmpty(bomRowIds)).throwMessage("请选择要转换的BOM"); 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); originalParentService.convertToEBom(bomRowIds);
//更新物料使用 //更新物料使用
bomNewEbomChildMapper.updateEBomMaterialUse(); bomNewEbomChildMapper.updateEBomMaterialUse();
@ -152,7 +154,7 @@ public class OriginalBomApi extends BaseApi {
@ApiOperation("导入") @ApiOperation("导入")
@PostMapping("importBom") @PostMapping("importBom")
@Transactional(rollbackFor = Exception.class) @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")) { if (file != null && !file.getOriginalFilename().endsWith("xls") && !file.getOriginalFilename().endsWith("xlsx")) {
return ResultVO.error("请上传Excel文件"); return ResultVO.error("请上传Excel文件");
} }
@ -160,12 +162,7 @@ public class OriginalBomApi extends BaseApi {
//计算层级 //计算层级
originalParentService.computeLevelNumAndRootState(); originalParentService.computeLevelNumAndRootState();
// TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
// @Override
// public void afterCommit() {
// originalParentService.computeLevelNumAndRootState();
// }
// });
return ResultVO.success(true); return ResultVO.success(true);
} }
@ -174,18 +171,18 @@ public class OriginalBomApi extends BaseApi {
@ApiOperation("新增物料") @ApiOperation("新增物料")
@GetMapping("testaddMaterial") @GetMapping("testaddMaterial")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResultVO<String> testaddMaterial(@RequestParam(value = "drawingNo" ,required = false)String drawingNo, public ResultVO<String> testaddMaterial(@RequestParam(value = "drawingNo", required = false) String drawingNo,
@RequestParam(value = "materialName" ,required = false)String materialName, @RequestParam(value = "materialName", required = false) String materialName,
@RequestParam("materialCategoryCode")String materialCategoryCode) throws IOException { @RequestParam("materialCategoryCode") String materialCategoryCode) throws IOException {
materialService.addMaterial(drawingNo, materialName,materialCategoryCode); materialService.addMaterial(drawingNo, materialName, materialCategoryCode);
return ResultVO.success("true"); return ResultVO.success("true");
} }
@ApiOperation("获取sessionKey") @ApiOperation("获取sessionKey")
@GetMapping("getSessionKey") @GetMapping("getSessionKey")
public ResultVO<String> getSessionKey() { public ResultVO<String> getSessionKey() {
return ResultVO.success(SessionUtil.getSessionKey()); return ResultVO.success(SessionUtil.getSessionKey());
@ -196,19 +193,16 @@ public class OriginalBomApi extends BaseApi {
@PostMapping("testImportBom") @PostMapping("testImportBom")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResultVO<Boolean> testImportBom() throws IOException { 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); originalParentService.importBomTest(inputStream);
TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
@Override // originalParentService.computeLevelNumAndRootState();
public void afterCommit() {
originalParentService.computeLevelNumAndRootState(); originalParentService.computeLevelNumAndRootState();
}
});
return ResultVO.success(true); return ResultVO.success(true);
} }
} }

View File

@ -33,5 +33,8 @@ public interface BomNewOriginalParentMapper extends BaseMapper<BomNewOriginalPar
/** /**
* 更新是否根节点状态 * 更新是否根节点状态
*/ */
void updateRootState(); void updateRootState_1();
void updateRootState_2();
void updateRootState_3();
} }

View File

@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nflg.product.base.core.config.SpringContextUtils; import com.nflg.product.base.core.config.SpringContextUtils;
import com.nflg.product.base.core.conmon.util.SessionUtil; 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.OriginalConstant;
import com.nflg.product.bomnew.constant.OriginalEditStatusEnum; import com.nflg.product.bomnew.constant.OriginalEditStatusEnum;
import com.nflg.product.bomnew.constant.OriginalSourceEnum; import com.nflg.product.bomnew.constant.OriginalSourceEnum;
@ -99,22 +100,22 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
* @param bom * @param bom
* @return * @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<BomOriginalListVO> saveEnts = bom.getBomList().stream().filter(u -> u.getDelIs().equals(0)).collect(Collectors.toList());
List<BomNewOriginalChildEntity> childEntities = Convert.toList(BomNewOriginalChildEntity.class, saveEnts); List<BomNewOriginalChildEntity> childEntities = Convert.toList(BomNewOriginalChildEntity.class, saveEnts);
// originalChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id",bom.getParentRowId())); // originalChildService.getBaseMapper().deleteByMap(ImmutableMap.of("parent_row_id",bom.getParentRowId()));
childEntities.forEach(u -> { childEntities.forEach(u -> {
u.setParentRowId(bom.getParentRowId()); u.setParentRowId(bom.getParentRowId());
if(submitIs){ if (submitIs) {
u.setEditStatus(OriginalEditStatusEnum.HANDLER_FINISHED.getValue()); u.setEditStatus(OriginalEditStatusEnum.HANDLER_FINISHED.getValue());
} }
}); });
if (CollUtil.isNotEmpty(childEntities)) { if (CollUtil.isNotEmpty(childEntities)) {
//删除行 //删除行
List<Long> delRowIds = bom.getBomList().stream().filter(u->u.getRowId()>0).map(u-> u.getRowId()).collect(Collectors.toList()); 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.getBaseMapper().delOriginalChildNotInRowIds(delRowIds, bom.getParentRowId());
originalChildService.saveOrUpdateBatch(childEntities); originalChildService.saveOrUpdateBatch(childEntities);
} }
return true; return true;
@ -128,7 +129,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
* @return * @return
*/ */
public Boolean saveSubmit(OriginalSaveBomDTO bom) { public Boolean saveSubmit(OriginalSaveBomDTO bom) {
saveBom(bom,true); saveBom(bom, true);
//将状态变为已处理 //将状态变为已处理
BomNewOriginalParentEntity parentEntity = new BomNewOriginalParentEntity(); BomNewOriginalParentEntity parentEntity = new BomNewOriginalParentEntity();
parentEntity.setRowId(bom.getParentRowId()); parentEntity.setRowId(bom.getParentRowId());
@ -161,13 +162,13 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
child.setStatus(parentEntity.getStatus()); child.setStatus(parentEntity.getStatus());
child.setDeviseName(parentEntity.getDeviseName()); child.setDeviseName(parentEntity.getDeviseName());
child.setDeviseUserCode(parentEntity.getDeviseUserCode()); child.setDeviseUserCode(parentEntity.getDeviseUserCode());
// child.setCreatedBy(parentEntity.getCreatedBy()); // child.setCreatedBy(parentEntity.getCreatedBy());
// child.setCreatedTime(parentEntity.getCreatedTime()); // child.setCreatedTime(parentEntity.getCreatedTime());
child.setBomRowId(parentEntity.getRowId()); child.setBomRowId(parentEntity.getRowId());
child.setLevelNum(parentEntity.getLevelNum()); child.setLevelNum(parentEntity.getLevelNum());
child.setDeptName(parentEntity.getDeptName()); child.setDeptName(parentEntity.getDeptName());
child.setSource(parentEntity.getSource()); child.setSource(parentEntity.getSource());
if(parentEntity.getStatus().equals(OriginalStatusEnum.OVER_CONVERT)){ if (parentEntity.getStatus().equals(OriginalStatusEnum.OVER_CONVERT)) {
child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue()); child.setStatus(OriginalStatusEnum.BORROWED_PARTS.getValue());
} }
//非本人则为借用件 //非本人则为借用件
@ -233,7 +234,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
if (CollUtil.isNotEmpty(list)) { if (CollUtil.isNotEmpty(list)) {
for (BomNewOriginalParentEntity bom : list) { for (BomNewOriginalParentEntity bom : list) {
bom.setRootIs(1); // bom.setRootIs(1);
List<BomOriginalListVO> bomDetail = this.getBaseMapper().getParentChild(bom.getRowId()); List<BomOriginalListVO> bomDetail = this.getBaseMapper().getParentChild(bom.getRowId());
OriginalBomDetailTask detailTask = new OriginalBomDetailTask(bomDetail); OriginalBomDetailTask detailTask = new OriginalBomDetailTask(bomDetail);
detailTask.setLevelNum(1); detailTask.setLevelNum(1);
@ -284,16 +285,18 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
* 计算层级数和根节点状态 * 计算层级数和根节点状态
*/ */
public void computeLevelNumAndRootState() { public void computeLevelNumAndRootState() {
//计算树的层级数
// CompletableFuture.runAsync(() -> {
try {
this.getBaseMapper().updateRootState();
this.compucteLevelNum();
} catch (Exception e) { try {
log.info("计算层级出错:"+e.getMessage()); 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); List<BomOriginalListVO> bomTree = getBomTree(bomRowId);
//需删除的BOM //需删除的BOM
List<BomOriginalListVO> delBom = bomTree.stream().filter(u -> u.getBomRowId() > 0 && OriginalStatusEnum.UN_CONVERT.equalsValue(u.getStatus())).collect(Collectors.toList()); List<BomOriginalListVO> delBom = bomTree.stream().filter(u -> u.getBomRowId() > 0 && OriginalStatusEnum.UN_CONVERT.equalsValue(u.getStatus())).collect(Collectors.toList());
List<Long> delParentRowId=new ArrayList<>(); List<Long> delParentRowId = new ArrayList<>();
for ( BomOriginalListVO bom: delBom) { for (BomOriginalListVO bom : delBom) {
delParentRowId.add(bom.getBomRowId()); delParentRowId.add(bom.getBomRowId());
} }
delParentRowId.add(bomRowId); delParentRowId.add(bomRowId);
@ -333,7 +336,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
List<BomNewOriginalParentEntity> bomNewOriginalParentEntities = this.getBaseMapper().selectBatchIds(bomRowIds); List<BomNewOriginalParentEntity> bomNewOriginalParentEntities = this.getBaseMapper().selectBatchIds(bomRowIds);
List<BomNewOriginalParentEntity> convertedBom = bomNewOriginalParentEntities.stream().filter(u -> OriginalStatusEnum.OVER_CONVERT.equalsValue(u.getStatus())).collect(Collectors.toList()); 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) { for (BomNewOriginalParentEntity parent : bomNewOriginalParentEntities) {
@ -385,17 +388,16 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
/** /**
* 原始BOM导入 * 原始BOM导入
*/ */
@Transactional(rollbackFor = Exception.class)
public void importBom(MultipartFile file) throws IOException { public void importBom(MultipartFile file) throws IOException {
rowNum.set(1); rowNum.set(1);
excelContextTL.set(new ArrayList<>()); excelContextTL.set(new ArrayList<>());
String uuid = IdUtil.simpleUUID(); String uuid = IdUtil.simpleUUID();
EecExcelUtil.handlerExcel(file.getInputStream(), BomNewOriginalExcelDTO.class, BomNewOriginalParentService::handlerExcelRow); EecExcelUtil.handlerExcel(file.getInputStream(), BomNewOriginalExcelDTO.class, BomNewOriginalParentService::handlerExcelRow);
List<BomNewOriginalExcelDTO> excelContext = excelContextTL.get(); List<BomNewOriginalExcelDTO> excelContext = excelContextTL.get();
List<Integer> noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u->u.getRowNum()).collect(Collectors.toList()); 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 )+"层次为空"); 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()); 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 )+"图号为空"); 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()); // 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 )+"数量为空"); // VUtils.isTure(CollUtil.isNotEmpty(noNum)).throwMessage( StrUtil.join(",",noNum )+"数量为空");
@ -410,7 +412,7 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
PlmBomToOriginalConvert convert = new PlmBomToOriginalConvert(); PlmBomToOriginalConvert convert = new PlmBomToOriginalConvert();
List<BomNewOriginalExcelDTO> chileds = excelContext.stream().filter(u -> u.getParentKey().equals(data.getLevelNo() + "-" + data.getRowNum())).collect(Collectors.toList()); List<BomNewOriginalExcelDTO> chileds = excelContext.stream().filter(u -> u.getParentKey().equals(data.getLevelNo() + "-" + data.getRowNum())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(chileds)) { if (CollUtil.isNotEmpty(chileds)) {
int i=1; int i = 1;
for (BomNewOriginalExcelDTO ch : chileds) { for (BomNewOriginalExcelDTO ch : chileds) {
ch.setOrderNo(i); ch.setOrderNo(i);
i++; i++;
@ -430,8 +432,8 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
public static void handlerExcelRow(BomNewOriginalExcelDTO data) { public static void handlerExcelRow(BomNewOriginalExcelDTO data) {
data.setRowNum(rowNum.get()); data.setRowNum(rowNum.get());
// data.setOrderNo(data.getLevelNo()); // data.setOrderNo(data.getLevelNo());
data.setChartNo(StrUtil.trim(data.getChartNo()).replace("","(").replace("",")").replace(" ","")); data.setChartNo(StrUtil.trim(data.getChartNo()).replace("", "(").replace("", ")").replace(" ", ""));
rowNum.set(rowNum.get() + 1); rowNum.set(rowNum.get() + 1);
excelContextTL.get().add(data); excelContextTL.get().add(data);
@ -446,12 +448,12 @@ public class BomNewOriginalParentService extends ServiceImpl<BomNewOriginalParen
String uuid = IdUtil.simpleUUID(); String uuid = IdUtil.simpleUUID();
EecExcelUtil.handlerExcel(file, BomNewOriginalExcelDTO.class, BomNewOriginalParentService::handlerExcelRow); EecExcelUtil.handlerExcel(file, BomNewOriginalExcelDTO.class, BomNewOriginalParentService::handlerExcelRow);
List<BomNewOriginalExcelDTO> excelContext = excelContextTL.get(); List<BomNewOriginalExcelDTO> excelContext = excelContextTL.get();
List<Integer> noLevelNo = excelContext.stream().filter(u -> Objects.isNull(u.getLevelNo())).map(u->u.getRowNum()).collect(Collectors.toList()); 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 )+"层次为空"); 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()); 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 )+"图号为空"); 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()); 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 )+"数量为空"); VUtils.isTure(CollUtil.isNotEmpty(noNum)).throwMessage(StrUtil.join(",", noNum) + "数量为空");
for (BomNewOriginalExcelDTO data : excelContext) { for (BomNewOriginalExcelDTO data : excelContext) {
List<BomNewOriginalExcelDTO> parentData = excelContext.stream().filter(u -> u.getLevelNo().equals(data.getLevelNo() - 1) && u.getRowNum() < data.getRowNum()) 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(); PlmBomToOriginalConvert convert = new PlmBomToOriginalConvert();
List<BomNewOriginalExcelDTO> chileds = excelContext.stream().filter(u -> u.getParentKey().equals(data.getLevelNo() + "-" + data.getRowNum())).collect(Collectors.toList()); List<BomNewOriginalExcelDTO> chileds = excelContext.stream().filter(u -> u.getParentKey().equals(data.getLevelNo() + "-" + data.getRowNum())).collect(Collectors.toList());
if (CollUtil.isNotEmpty(chileds)) { if (CollUtil.isNotEmpty(chileds)) {
int i=1; int i = 1;
for (BomNewOriginalExcelDTO ch : chileds) { for (BomNewOriginalExcelDTO ch : chileds) {
ch.setOrderNo(i); ch.setOrderNo(i);
i++; i++;

View File

@ -124,23 +124,27 @@
</foreach>; </foreach>;
</update> </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 ( update t_bom_new_original_parent a join (
select a.row_id from t_bom_new_original_parent a select a.row_id from t_bom_new_original_parent a
left join t_bom_new_original_child b left join t_bom_new_original_child b
on a.drawing_no=b.drawing_no 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 ( update t_bom_new_original_parent a join (
select a.row_id from t_bom_new_original_parent a select a.row_id from t_bom_new_original_parent a
left join t_bom_new_original_child b left join t_bom_new_original_child b
on a.drawing_no=b.drawing_no and a.created_by=b.created_by 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> </update>
</mapper> </mapper>