Merge branch 'refs/heads/feature/DM/nflg-bom' into feature/DM/nflg-bom-transition

This commit is contained in:
曹鹏飞 2024-06-03 16:42:21 +08:00
commit 5d0142fee1
6 changed files with 45 additions and 17 deletions

View File

@ -40,7 +40,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -301,7 +300,9 @@ public class EbomApi extends BaseApi {
@GetMapping("editDetail") @GetMapping("editDetail")
@ApiOperation("编辑物料列表") @ApiOperation("编辑物料列表")
public ResultVO<BomNewEbomEditDetailVO> editDetail(@RequestParam("rowId") Long rowId, @RequestParam("bomRowId") Long bomRowId public ResultVO<BomNewEbomEditDetailVO> editDetail(@RequestParam("rowId") Long rowId, @RequestParam("bomRowId") Long bomRowId
, @RequestParam("projectType") String projectType, @RequestParam(value = "hideVirtualPackage", defaultValue = "0") Integer hideVirtualPackage) { , @RequestParam("projectType") String projectType
, @RequestParam(value = "hideVirtualPackage", defaultValue = "0") Integer hideVirtualPackage
, @RequestParam("parentBomRowId") Long parentBomRowId) {
if (Objects.isNull(rowId)) { if (Objects.isNull(rowId)) {
VUtils.isTure(true).throwMessage("rowId 不能为空"); VUtils.isTure(true).throwMessage("rowId 不能为空");
} }
@ -309,7 +310,7 @@ public class EbomApi extends BaseApi {
VUtils.isTure(true).throwMessage("bomRowId不能为空"); VUtils.isTure(true).throwMessage("bomRowId不能为空");
} }
return ResultVO.success(bomNewEbomParentService.editDetail(rowId, bomRowId, projectType, hideVirtualPackage)); return ResultVO.success(bomNewEbomParentService.editDetail(rowId, bomRowId, projectType, hideVirtualPackage, parentBomRowId));
} }
@PostMapping("updateProjectType") @PostMapping("updateProjectType")

View File

@ -37,6 +37,8 @@ public class EBomConstant {
public static final String PROJECT_TYPE_T="T"; public static final String PROJECT_TYPE_T="T";
public static final String KG="KG";
@AllArgsConstructor @AllArgsConstructor
@Getter @Getter

View File

@ -6,19 +6,29 @@ import lombok.Data;
import lombok.experimental.Accessors; import lombok.experimental.Accessors;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Collections;
import java.util.List; import java.util.List;
@Data @Data
@Accessors(chain = true) @Accessors(chain = true)
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-vo-BomNewEbomEditDetailVO") @ApiModel(value = "com-nflg-product-bomnew-pojo-new-vo-BomNewEbomEditDetailVO")
public class BomNewEbomEditDetailVO implements Serializable { public class BomNewEbomEditDetailVO implements Serializable {
/*
* 当前节点
*/
@ApiModelProperty("当前节点")
private BomNewEbomParentVO parent; private BomNewEbomParentVO parent;
/*
* 当前节点的子级
*/
@ApiModelProperty("当前节点的子级")
private List<BomNewEbomParentVO> datas; private List<BomNewEbomParentVO> datas;
/*
* 当前节点的上级节点
*/
@ApiModelProperty("当前节点的上级节点")
private BomNewEbomParentVO parentParent;
} }

View File

@ -1580,7 +1580,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
return true; return true;
} }
public BomNewEbomEditDetailVO editDetail(Long rowId, Long bomRowId, String projectType, Integer hideVirtualPackage) { public BomNewEbomEditDetailVO editDetail(Long rowId, Long bomRowId, String projectType, Integer hideVirtualPackage, Long parentBomRowId) {
BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO(); BomNewEbomEditDetailVO vo = new BomNewEbomEditDetailVO();
BomNewEbomParentVO parentVO; BomNewEbomParentVO parentVO;
@ -1632,6 +1632,7 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
vo.setParent(parentVO); vo.setParent(parentVO);
vo.setParentParent(Convert.convert(BomNewEbomParentVO.class, this.getBaseMapper().selectById(parentBomRowId)));
return vo; return vo;
} }
@ -2217,13 +2218,17 @@ public class BomNewEbomParentService extends ServiceImpl<BomNewEbomParentMapper,
query.setPage(1L); query.setPage(1L);
query.setPageSize(20L); query.setPageSize(20L);
} }
Page<BomNewEbomParentVO> result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage() Page<BomNewEbomParentVO> result;
, query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode(), SessionUtil.getDepartRowId());
if (StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())) { if (StrUtil.isBlank(query.getMaterialNo()) && StrUtil.isBlank(query.getDrawingNo())) {
result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage()
, query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode(), SessionUtil.getDepartRowId());
//列表搜索 //列表搜索
materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT); materialMainService.intiMaterialInfo(result.getRecords(), EBomConstant.EBOM_IGNORED_FIELDS_INIT_MATERIAL_DEFAULT);
return result; return result;
} }
query.setShowMySelfOnly(0);
result = this.getBaseMapper().workDetailsListByPageNew(new Page<>(query.getPage()
, query.getPageSize()), query, userRoleService.getUserJob(), SessionUtil.getUserCode(), SessionUtil.getDepartRowId());
//根据编号或图号搜索 //根据编号或图号搜索
//从顶级开始查找 //从顶级开始查找
List<BomNewEbomParentVO> roots = result.getRecords().stream() List<BomNewEbomParentVO> roots = result.getRecords().stream()

View File

@ -28,6 +28,7 @@ import com.nflg.product.bomnew.util.ListCommonUtil;
import com.nflg.product.bomnew.util.VUtils; import com.nflg.product.bomnew.util.VUtils;
import com.nflg.product.bomnew.util.VersionUtil; import com.nflg.product.bomnew.util.VersionUtil;
import lombok.Getter; import lombok.Getter;
import org.aspectj.weaver.ast.ITestVisitor;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.LocalDateTime; import java.time.LocalDateTime;
@ -116,7 +117,14 @@ public class OriginalBomToEBomV2Convert extends BaseConvert {
BigDecimal totalWeightResult = BigDecimal.ZERO; BigDecimal totalWeightResult = BigDecimal.ZERO;
List<Long> rowIds=new ArrayList<>(); List<Long> rowIds=new ArrayList<>();
for (BomOriginalListVO item : list1) { for (BomOriginalListVO item : list1) {
numResult = NumberUtil.add(numResult, Objects.nonNull(item.getNum()) ? item.getNum() : BigDecimal.ZERO); BigDecimal numNew=BigDecimal.ZERO;
if( EBomConstant.KG.equalsIgnoreCase(item.getMaterialUnit())){
numNew= item.getTotalWeight();
}else {
numNew=NumberUtil.mul(item.getTotalWeight(),item.getNum());
}
// numResult = NumberUtil.add(numResult, Objects.nonNull( item.getNum()) ? item.getNum() : BigDecimal.ZERO);
numResult = NumberUtil.add(numResult, numNew);
totalWeightResult = NumberUtil.add(totalWeightResult, item.getTotalWeight()); totalWeightResult = NumberUtil.add(totalWeightResult, item.getTotalWeight());
rowIds.add(item.getRowId()); rowIds.add(item.getRowId());
} }

View File

@ -473,12 +473,14 @@
, b.* , b.*
FROM t_bom_new_ebom_child b FROM t_bom_new_ebom_child b
LEFT JOIN t_bom_new_ebom_parent a ON a.material_no = b.material_no LEFT JOIN t_bom_new_ebom_parent a ON a.material_no = b.material_no
<if test="materialNo!=null and materialNo!=''"> <where>
WHERE b.material_no = #{materialNo} <if test="materialNo!=null and materialNo!=''">
</if> AND b.material_no = #{materialNo}
<if test="drawingNo!=null and drawingNo!=''"> </if>
WHERE b.drawingNo = #{drawingNo} <if test="drawingNo!=null and drawingNo!=''">
</if> AND b.drawing_no = #{drawingNo}
</if>
</where>
ORDER BY b.order_number ORDER BY b.order_number
</select> </select>