Merge branch 'feature/DM/rakor' into dev

This commit is contained in:
曹鹏飞 2024-09-25 18:34:03 +08:00
commit c28fb465ef
9 changed files with 141 additions and 13 deletions

View File

@ -17,7 +17,9 @@ import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.entity.BomNewTechnologyPackageTypeEntity;
import com.nflg.product.bomnew.pojo.query.BomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
import com.nflg.product.bomnew.pojo.query.PBomExceptionQuery;
import com.nflg.product.bomnew.pojo.query.PbomImportToSAPQuery;
import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.*;
@ -27,12 +29,12 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import nflg.product.common.vo.ResultVO;
import org.apache.commons.compress.utils.Lists;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.io.IOException;
import java.util.ArrayList;
@ -40,7 +42,6 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ExecutionException;
import java.util.function.Consumer;
import java.util.stream.Collectors;
/**
@ -438,5 +439,25 @@ public class PBomApi extends BaseApi {
return ResultVO.success(bomNewPbomParentService.checkBomExist(bomRowId,type));
}
/**
* 获取节点异常状态
* @param query query
* @return 节点异常状态
*/
@PostMapping("getBomException")
@ApiOperation("获取节点异常状态")
public ResultVO<List<BomExceptionVO>> getBomException(@Valid @RequestBody @NotEmpty List<BomExceptionQuery> query) {
return ResultVO.success(bomNewPbomParentService.getBomException(query));
}
/**
* 获取单个节点异常状态
* @param query query
* @return 节点异常状态
*/
@PostMapping("getSingleBomException")
@ApiOperation("获取单个节点异常状态")
public ResultVO<BomExceptionVO> getSingleBomException(@Valid @RequestBody @NotEmpty PBomExceptionQuery query) {
return ResultVO.success(bomNewPbomParentService.getSingleBomException(query));
}
}

View File

@ -0,0 +1,36 @@
package com.nflg.product.bomnew.pojo.query;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @author 曹鹏飞
* @date 2024/9/25 17:38:14
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "com-nflg-product-bomnew-pojo-new-query-PBomExceptionQuery")
public class PBomExceptionQuery implements Serializable {
/**
* materialNo 物料编号
*/
@ApiModelProperty(value = "物料编号")
protected String materialNo;
/**
* drawingNo 图号
*/
@ApiModelProperty(value = "图号")
protected String drawingNo;
/**
* facCode 工厂编号
*/
@ApiModelProperty(value = "工厂编号")
protected String facCode;
}

View File

@ -42,9 +42,15 @@ public class ReverseReportVO {
@ApiModelProperty(value = "数量")
private BigDecimal num;
@ApiModelProperty(value = "子级数量")
private BigDecimal childNum;
@ApiModelProperty("单位")
private String materialUnit;
@ApiModelProperty("子级单位")
private String childMaterialUnit;
@ApiModelProperty(value = "创建人编码")
private String createdBy;

View File

@ -6,7 +6,10 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.*;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@ -25,9 +28,7 @@ import com.nflg.product.bomnew.pojo.dto.*;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
import com.nflg.product.bomnew.pojo.entity.*;
import com.nflg.product.bomnew.pojo.query.BomNewPbomParentQuery;
import com.nflg.product.bomnew.pojo.query.CopyPBomV2Query;
import com.nflg.product.bomnew.pojo.query.PbomImportToSAPQuery;
import com.nflg.product.bomnew.pojo.query.*;
import com.nflg.product.bomnew.pojo.vo.*;
import com.nflg.product.bomnew.service.domain.PBom.*;
import com.nflg.product.bomnew.service.domain.Sap;
@ -44,6 +45,8 @@ import org.ttzero.excel.entity.Workbook;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import javax.validation.constraints.NotEmpty;
import java.io.IOException;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@ -2042,4 +2045,59 @@ public class BomNewPbomParentService extends ServiceImpl<BomNewPbomParentMapper,
}
public List<BomExceptionVO> getBomException(@Valid @NotEmpty List<BomExceptionQuery> query) {
List<BomExceptionVO> datas = new ArrayList<>();
List<BaseMaterialVO> materialVOS = materialMainService.getMaterialBaseInfo(query.stream().map(BomExceptionQuery::getMaterialNo).collect(Collectors.toList()));
boolean isException = false;
for (int index = query.size() - 1; index >= 0; index--) {
BomExceptionQuery bom = query.get(index);
BomExceptionVO vo = new BomExceptionVO();
vo.setBomRowId(bom.getBomRowId());
vo.setRowId(bom.getRowId());
vo.setMaterialNo(bom.getMaterialNo());
if (isException) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_14.getValue());
} else {
BaseMaterialVO mv = materialVOS.stream().filter(f -> StrUtil.equals(f.getMaterialNo(), bom.getMaterialNo())).findFirst().orElse(null);
if (Objects.isNull(mv) || !Objects.equals(mv.getMaterialState(), MateiralStateEnum.ACTIVE.getValue())) {
isException = true;
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
} else {
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
}
}
datas.add(vo);
}
Collections.reverse(datas);
return datas;
}
public BomExceptionVO getSingleBomException(@Valid @NotEmpty PBomExceptionQuery query) {
List<String> materialNosOrDrawingNos = Collections.singletonList(StrUtil.isNotBlank(query.getMaterialNo()) ? query.getMaterialNo() : query.getDrawingNo());
List<BaseMaterialVO> materialVOS = materialMainService.initMaterialForAnyNo(materialNosOrDrawingNos);
BomExceptionVO vo = new BomExceptionVO();
BaseMaterialVO mVO = materialVOS.stream().findFirst().orElse(null);
if (Objects.nonNull(mVO)) {
vo.setMaterialNo(mVO.getMaterialNo());
if (!Objects.equals(mVO.getMaterialState(), MaterialGetEnum.MaterialStateEnum.OK.getValue())) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
} else {
materialNosOrDrawingNos = pbomChildService.lambdaQuery()
.select(BomNewPbomChildEntity::getMaterialNo)
.eq(StrUtil.isNotBlank(query.getMaterialNo()), BomNewPbomChildEntity::getMaterialNo, query.getMaterialNo())
.eq(StrUtil.isNotBlank(query.getDrawingNo()), BomNewPbomChildEntity::getDrawingNo, query.getDrawingNo())
.eq(BomNewPbomChildEntity::getFacCode, query.getFacCode())
.list()
.stream().map(BomNewPbomChildEntity::getMaterialNo)
.collect(Collectors.toList());
materialVOS = materialMainService.initMaterialForAnyNo(materialNosOrDrawingNos);
if (materialVOS.stream().anyMatch(f -> !Objects.equals(f.getMaterialState(), MaterialGetEnum.MaterialStateEnum.OK.getValue()))) {
vo.setExceptionStatus(EBomExceptionStatusEnum.EXCEPT_NO_2.getValue());
} else {
vo.setExceptionStatus(EBomExceptionStatusEnum.OK.getValue());
}
}
}
return vo;
}
}

View File

@ -16,7 +16,6 @@ import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1DTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1ResultDTO;
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
import com.nflg.product.bomnew.util.VUtils;
import lombok.extern.slf4j.Slf4j;
import nflg.product.common.constant.STATE;
import nflg.product.common.vo.ResultVO;
@ -142,7 +141,10 @@ public class SapOpUtilService {
public List<OperationErrorMsgVO> importToSapV2(ImportSapParamDTO impartSapParamDTO, List<T1DTO> backList) {
VUtils.isTure(CollUtil.isEmpty(impartSapParamDTO.getT1())).throwMessage("没有需要同步的数据");
if (CollUtil.isEmpty(impartSapParamDTO.getT1())) {
log.info("没有需要同步的数据");
return Collections.emptyList();
}
SapReqParams params = new SapReqParams();
// 接口名
params.setFunName("ZRFC_PP_005");

View File

@ -182,6 +182,8 @@ public class EBomQueryService {
vo.setBomVersion("1");
} else {
vo.setBomVersion(level >= lastVO.getLevelNum() ? lastVO.getBomVersion() : String.valueOf(Integer.parseInt(lastVO.getBomVersion()) + 1));
vo.setChildNum(lastVO.getNum());
vo.setChildMaterialUnit(lastVO.getChildMaterialUnit());
}
return vo;
}

View File

@ -176,6 +176,8 @@ public class PBomQueryService {
vo.setBomVersion("1");
} else {
vo.setBomVersion(level >= lastVO.getLevelNum() ? lastVO.getBomVersion() : String.valueOf(Integer.parseInt(lastVO.getBomVersion()) + 1));
vo.setChildNum(lastVO.getNum());
vo.setChildMaterialUnit(lastVO.getChildMaterialUnit());
}
return vo;
}

View File

@ -412,9 +412,9 @@
<!--ebom单层反查-->
<select id="eBomReverseReport" resultType="com.nflg.product.bomnew.pojo.vo.ReverseReportVO">
select b.* , a.drawing_no as childDrawingNo from t_bom_new_ebom_child_formal a
select b.* , a.drawing_no as childDrawingNo,a.num AS childNum,a.material_unit AS childMaterialUnit
from t_bom_new_ebom_child_formal a
join t_bom_new_ebom_parent_formal b on a.parent_row_id=b.row_id
where true
<if test="bomVersionRowId!=null and bomVersionRowId>0">
and a.bom_version_row_id=#{bomVersionRowId}
@ -427,7 +427,8 @@
<!--ebom单层反查-->
<select id="eBomReverseReportNewst" resultType="com.nflg.product.bomnew.pojo.vo.ReverseReportVO">
select b.* , a.drawing_no as childDrawingNo from t_bom_new_ebom_child a
select b.*, a.drawing_no as childDrawingNo, a.num AS childNum, a.material_unit AS childMaterialUnit
from t_bom_new_ebom_child a
join t_bom_new_ebom_parent b on a.parent_row_id=b.row_id
where a.material_no =#{materialNo} and b.status=4
</select>

View File

@ -78,8 +78,8 @@
<!--pbom单层反查-->
<select id="pBomSingleReverseReport" resultType="com.nflg.product.bomnew.pojo.vo.ReverseReportVO">
select IFNULL(a.num,1)*IFNULL(b.num,1) AS num,b.* , a.drawing_no as childDrawingNo from
t_bom_new_pbom_child_formal a
select b.* , a.drawing_no as childDrawingNo,a.num AS childNum,a.material_unit AS childMaterialUnit
from t_bom_new_pbom_child_formal a
join t_bom_new_pbom_parent_formal b on a.parent_row_id=b.row_id
where true