Merge remote-tracking branch 'origin/feature/DM/nflg-bom' into feature/DM/nflg-bom
This commit is contained in:
commit
e9875cac3c
|
|
@ -246,15 +246,14 @@ public class PBomApi extends BaseApi {
|
|||
@ApiOperation("分工厂-保存")
|
||||
@LogRecord(success = "PBom-分工厂-保存。操作结果:{{#_ret}}", bizNo = "",type = "PBom-分工厂-保存")
|
||||
public ResultVO<Boolean> saveAllocationFactory(@Valid @RequestBody List<SaveAllocationFactoryDTO> params){
|
||||
|
||||
return ResultVO.success(bomNewPbomParentService.saveAllocationFactory(params));
|
||||
return ResultVO.success();
|
||||
//return ResultVO.success(bomNewPbomParentService.saveAllocationFactory(params));
|
||||
}
|
||||
|
||||
@PostMapping("saveAllocationFactoryNew")
|
||||
@ApiOperation("分工厂-批量保存保存")
|
||||
@LogRecord(success = "PBom-分工厂-保存。操作结果:{{#_ret}}", bizNo = "",type = "PBom-分工厂-保存")
|
||||
public ResultVO<Boolean> saveAllocationFactory(@Valid @RequestBody AllocationFactoryParam params){
|
||||
|
||||
return ResultVO.success(bomNewPbomParentService.saveAllocationFactoryNew(params));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,10 @@
|
|||
package com.nflg.product.bomnew.pojo.dto;
|
||||
|
||||
import com.nflg.product.bomnew.service.BomNewLogService;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -12,8 +13,10 @@ import java.util.List;
|
|||
@Data
|
||||
public class AllocationFactoryParam {
|
||||
|
||||
@NotEmpty
|
||||
List<SaveAllocationFactoryDTO> data;
|
||||
|
||||
@ApiModelProperty("是否设置下级 0-否 1-是")
|
||||
@NotNull
|
||||
private Integer setSubNode;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 保存分工厂参数
|
||||
|
|
@ -21,4 +22,7 @@ public class SaveAllocationFactoryDTO {
|
|||
@ApiModelProperty("生产工厂")
|
||||
@NotNull(message = "生产工厂不能为空")
|
||||
private String productionFactoryCode;
|
||||
|
||||
@ApiModelProperty("所有父级的rowId")
|
||||
private List<Long> allParentRowIds;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
|
@ -8,8 +7,6 @@ import lombok.experimental.Accessors;
|
|||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Collections;
|
||||
|
|
@ -328,6 +325,8 @@ public class BomNewEbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty(value = "异常确认标记")
|
||||
private String exceptionTag;
|
||||
|
||||
@ApiModelProperty(value = "待复核根节点")
|
||||
private Integer rootIsForWaitReview;
|
||||
|
||||
private List<BomNewEbomParentVO> childNodes = Collections.emptyList();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,23 +1,19 @@
|
|||
package com.nflg.product.bomnew.pojo.vo;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.Serializable;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDate;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* t_bom_new_pbom_parent
|
||||
*
|
||||
*
|
||||
* @author makejava
|
||||
* @since 2024-01-01 10:39:59
|
||||
*/
|
||||
|
|
@ -46,7 +42,6 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
private String batchNo;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 工厂编码
|
||||
*/
|
||||
|
|
@ -54,7 +49,6 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
private String facCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 排序号
|
||||
*/
|
||||
|
|
@ -62,8 +56,6 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
private String orderNumber;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 单重
|
||||
*/
|
||||
|
|
@ -89,7 +81,6 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
private BigDecimal num;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 是否跟节点 0-否 1-是
|
||||
*/
|
||||
|
|
@ -282,7 +273,8 @@ public class BomNewPbomParentVO extends BaseMaterialVO implements Serializable {
|
|||
@ApiModelProperty("子级")
|
||||
List<BomNewPbomParentVO> childNodes;
|
||||
|
||||
|
||||
@ApiModelProperty("所有父级的rowId")
|
||||
private Set<Long> allParentRowIds = new HashSet<>();
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1322,7 +1322,10 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
|
|||
|
||||
List<Long> rowIds = dto.getRowIdList();
|
||||
|
||||
List<BomNewEbomParentEntity> bomNewEbomParentEntityList = this.lambdaQuery().in(BomNewEbomParentEntity::getRowId, rowIds).eq(BomNewEbomParentEntity::getUserRootIs, 1).list();
|
||||
List<BomNewEbomParentEntity> bomNewEbomParentEntityList = this.lambdaQuery()
|
||||
.in(BomNewEbomParentEntity::getRowId, rowIds)
|
||||
.and(a -> a.eq(BomNewEbomParentEntity::getUserRootIs, 1).or().eq(BomNewEbomParentEntity::getRootIsForWaitReview, 1))
|
||||
.list();
|
||||
|
||||
if (CollUtil.isEmpty(bomNewEbomParentEntityList)) {
|
||||
// return ResultVO.error("下级BOM无法进行复核");
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.nflg.product.bomnew.service;
|
|||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.product.bomnew.constant.EBomConstant;
|
||||
import com.nflg.product.bomnew.mapper.master.BomNewPbomChildMapper;
|
||||
import com.nflg.product.bomnew.pojo.entity.BomNewPbomChildEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
|
@ -26,4 +27,12 @@ public class BomNewPbomChildService extends ServiceImpl<BomNewPbomChildMapper, B
|
|||
public void setParentRowId(List<Long> rowIds, Long parentRowId) {
|
||||
this.getBaseMapper().setParentRowId(rowIds, parentRowId);
|
||||
}
|
||||
|
||||
public boolean setParentFactoryCode1010(List<Long> allParentRowIds) {
|
||||
return this.lambdaUpdate()
|
||||
.in(BomNewPbomChildEntity::getRowId, allParentRowIds)
|
||||
.set(BomNewPbomChildEntity::getProductionFactoryCode, EBomConstant.MAIN_FACTORY_CODE_1010)
|
||||
.set(BomNewPbomChildEntity::getProductionFactoryCodeInputType, 2)
|
||||
.update();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -595,10 +595,8 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
* @param
|
||||
* @param countLevelNum 是否标记层级 0-否 1-是
|
||||
* @return
|
||||
* @throws ExecutionException
|
||||
* @throws InterruptedException
|
||||
*/
|
||||
public List<BomNewPbomParentVO> getAllBom(Long rowId, Integer countLevelNum) throws ExecutionException, InterruptedException {
|
||||
public List<BomNewPbomParentVO> getAllBom(Long rowId, Integer countLevelNum) {
|
||||
List<BomNewPbomParentVO> bomDetail = this.getBaseMapper().getParentChild(rowId);
|
||||
AtomicInteger levelNum = new AtomicInteger(1);
|
||||
PBomDetailTask detailTask = new PBomDetailTask(bomDetail, countLevelNum, levelNum);
|
||||
|
|
@ -645,13 +643,26 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
return CTreePBomUtils.toTree(bomRowId, allBom, BomNewPbomParentVO::getParentRowId, BomNewPbomParentVO::getBomRowId);
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getAllocationFactoryBomTree(AllocationFactoryBomQuery param) throws ExecutionException, InterruptedException {
|
||||
public List<BomNewPbomParentVO> getAllocationFactoryBomTree(AllocationFactoryBomQuery param) {
|
||||
List<BomNewPbomParentVO> allBom = getAllBom(param.getBomRowId(), 1);
|
||||
materialMainService.intiMaterialInfo(allBom, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
return CTreePBomUtils.toTree(param.getBomRowId(), allBom, BomNewPbomParentVO::getParentRowId, BomNewPbomParentVO::getBomRowId);
|
||||
List<BomNewPbomParentVO> tree = CTreePBomUtils.toTree(param.getBomRowId(), allBom, BomNewPbomParentVO::getParentRowId, BomNewPbomParentVO::getBomRowId);
|
||||
initParentRowIds(null, tree);
|
||||
return tree;
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getAllocationFactoryBom(AllocationFactoryBomQuery param) throws ExecutionException, InterruptedException {
|
||||
private void initParentRowIds(BomNewPbomParentVO parent, List<BomNewPbomParentVO> children) {
|
||||
if (CollUtil.isEmpty(children)) return;
|
||||
children.forEach(c -> {
|
||||
if (parent != null) {
|
||||
c.setAllParentRowIds(Sets.newHashSet(parent.getAllParentRowIds()));
|
||||
c.getAllParentRowIds().add(parent.getRowId());
|
||||
}
|
||||
initParentRowIds(c, c.getChildNodes());
|
||||
});
|
||||
}
|
||||
|
||||
public List<BomNewPbomParentVO> getAllocationFactoryBom(AllocationFactoryBomQuery param) {
|
||||
List<BomNewPbomParentVO> allBom = getAllBom(param.getBomRowId(), 1);
|
||||
materialMainService.intiMaterialInfo(allBom, EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
|
||||
return allBom;
|
||||
|
|
@ -676,25 +687,28 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
|
|||
public Boolean saveAllocationFactoryNew(AllocationFactoryParam params) {
|
||||
VUtils.isTure(CollUtil.isEmpty(params.getData())).throwMessage("分配工厂数据为空");
|
||||
//按分配的工厂分组
|
||||
VUtils.isTure(params.getSetSubNode().equals(0)
|
||||
&& params.getData().stream().anyMatch(u -> u.getProductionFactoryCode().equals(EBomConstant.XIAN_TAO_FACTORY_CODE_1020)))
|
||||
.throwMessage("仙桃工厂(1020)下的子级必须也是仙桃");
|
||||
|
||||
if( params.getSetSubNode().equals(0) ){
|
||||
return saveAllocationFactory(params.getData());
|
||||
}else {
|
||||
params.getData().forEach(k -> {
|
||||
try {
|
||||
AllocationFactoryBomQuery query = new AllocationFactoryBomQuery();
|
||||
query.setBomRowId(k.getBomRowId());
|
||||
|
||||
List<BomNewPbomParentVO> allBom = this.getAllocationFactoryBom(query);
|
||||
List<Long> rowIds = new ArrayList<>();
|
||||
rowIds.add(k.getRowId());
|
||||
rowIds.addAll(allBom.stream().map(u -> u.getRowId()).collect(Collectors.toList()));
|
||||
rowIds.addAll(allBom.stream().map(BomNewPbomParentVO::getRowId).collect(Collectors.toList()));
|
||||
if (CollUtil.isNotEmpty(rowIds)) {
|
||||
pbomChildService.getBaseMapper().setProductionFactoryCode(k.getProductionFactoryCode(), rowIds);
|
||||
}
|
||||
} catch (ExecutionException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
if (k.getProductionFactoryCode().equals(EBomConstant.MAIN_FACTORY_CODE_1010)) {
|
||||
//设置所有父级节点为1010
|
||||
pbomChildService.setParentFactoryCode1010(k.getAllParentRowIds());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,9 +116,13 @@ public class PBomDetailTask extends RecursiveTask<List<BomNewPbomParentVO>> {
|
|||
}
|
||||
|
||||
if (CollUtil.isNotEmpty(bomDetail)) {
|
||||
List<Long> childBowIds = bomDetail.stream().filter(u -> u.getBomRowId() > 0).map(u -> u.getBomRowId()).collect(Collectors.toList());
|
||||
List<Long> childBowIds = bomDetail.stream().map(BomNewPbomParentVO::getBomRowId).filter(bomRowId -> bomRowId > 0).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(childBowIds)) {
|
||||
List<BomNewPbomChildEntity> children = SpringUtil.getBean(BomNewPbomChildService.class).lambdaQuery().in(BomNewPbomChildEntity::getParentRowId, childBowIds).list();
|
||||
List<BomNewPbomChildEntity> children = SpringUtil.getBean(BomNewPbomChildService.class)
|
||||
.lambdaQuery()
|
||||
.in(BomNewPbomChildEntity::getParentRowId, childBowIds)
|
||||
.orderByAsc(BomNewPbomChildEntity::getOrderNumber)
|
||||
.list();
|
||||
List<BomNewPbomParentVO> bom = Convert.toList(BomNewPbomParentVO.class, children);
|
||||
|
||||
PBomDetailTask task = new PBomDetailTask(bom, countLevelState,levelNum);
|
||||
|
|
|
|||
|
|
@ -106,10 +106,10 @@
|
|||
</if>
|
||||
<if test="dataType==0" >
|
||||
<if test="technicianIs==0 ">
|
||||
and created_by=#{createdBy} and status in (1,3)
|
||||
created_by=#{createdBy} and status in (1,3)
|
||||
</if>
|
||||
<if test="technicianIs==1 ">
|
||||
and (created_by=#{createdBy} or status=2 )
|
||||
(created_by=#{createdBy} or status=2 )
|
||||
</if>
|
||||
|
||||
</if>
|
||||
|
|
|
|||
|
|
@ -138,7 +138,10 @@
|
|||
</select>
|
||||
|
||||
<select id="getParentChild" resultType="com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO">
|
||||
select * from t_bom_new_pbom_child where parent_row_id=#{parentRowId}
|
||||
select *
|
||||
from t_bom_new_pbom_child
|
||||
where parent_row_id = #{parentRowId}
|
||||
order by order_number
|
||||
</select>
|
||||
<!--bom发布-->
|
||||
<update id="bomRelease">
|
||||
|
|
|
|||
Loading…
Reference in New Issue