Merge remote-tracking branch 'origin/DM/10月需求' into DM/10月需求

This commit is contained in:
大米 2024-09-29 18:17:39 +08:00
commit 7064fb2d5e
4 changed files with 77 additions and 13 deletions

View File

@ -85,9 +85,16 @@ public class ReportConstant {
//比对
EQ(1, "相等"),
NON_EQ(0, "不相等"),
// NON_EQ(0, "不相等"),
L_NULL(2, "左有右无"),
NULL_R(3, "左无右有");
NULL_R(3, "左无右有"),
NON_EQ_NUM(10, "数量不相等"),
NON_EQ_UNIT(11, "单位不相等"),
NON_EQ_PROJECT_TYPE(12, "项目类型不相等"),
NON_EQ_PARENT_MaterialNo(13, "父级物料编码不相等")
;
private final Integer value;
private final String description;

View File

@ -42,11 +42,19 @@ public class CompareReportField {
// @ExcelProperty(value = "单位")
@ExcelColumn(value="单位")
private String materialUnit;
@ApiModelProperty("项目类型")
// @ExcelProperty(value = "单位")
@ExcelColumn(value="项目类型")
private String projectType;
@ApiModelProperty("层级")
// @ExcelProperty(value="层级")
@ExcelColumn(value="层级")
private Integer levelNum;
@ApiModelProperty("比对结果")
//@ExcelProperty("比对结果")
@MediaColumn
@ -65,6 +73,15 @@ public class CompareReportField {
// @ExcelProperty(value = "单位2")
@ExcelColumn(value="单位 ")
private String materialUnit2;
@ApiModelProperty("项目类型")
// @ExcelProperty(value = "单位")
@ExcelColumn(value="项目类型")
private String projectType2;
@ApiModelProperty("层级")
@ExcelColumn(value="层级 ")
//@ExcelProperty(value="层级2")

View File

@ -1,9 +1,14 @@
package com.nflg.product.bomnew.pojo.vo;
import com.nflg.product.bomnew.constant.ReportConstant;
import com.nflg.product.bomnew.constant.SapErrorMsgTypeEnum;
import com.nflg.product.bomnew.util.EnumUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Objects;
/**
* 比对
*/
@ -18,8 +23,20 @@ public class CompareReportVO {
@ApiModelProperty("右侧bom2")
private ForwardReportVO right;
@ApiModelProperty("符号: 0-不相等 1-相等, 2-左有右缺 ,3-左缺右有")
@ApiModelProperty("符号: 1-相等, 2-左有右缺 ,3-左缺右有,10-数量不相等,11-单位不相等,12-项目类型不相等,13-父级物料编码不相等")
private Integer symbol;
@ApiModelProperty("比较描述")
private String symbolDesc;
public String getSymbolDesc() {
if(Objects.isNull(symbol)){
return "未知";
}
return EnumUtils.getEnumDescription(ReportConstant.SymbolEnum.class,symbol);
}
public CompareReportVO(){
}

View File

@ -92,13 +92,16 @@ public class CompareReportService {
}
excelList.add(compareReportField);
if (ObjectUtil.equal(compareReportVO.getSymbol(), ReportConstant.SymbolEnum.EQ.getValue())
|| ObjectUtil.equal(compareReportVO.getSymbol(), ReportConstant.SymbolEnum.NON_EQ.getValue())) {
|| compareReportVO.getSymbol()>=ReportConstant.SymbolEnum.NON_EQ_NUM.getValue()) {
compareReportField.setLevelNum(compareReportVO.getLeft().getLevelNum());
compareReportField.setNum(compareReportVO.getLeft().getNum());
compareReportField.setMaterialUnit(compareReportVO.getLeft().getMaterialUnit());
compareReportField.setProjectType(compareReportVO.getLeft().getProjectType());
compareReportField.setLevelNum2(compareReportVO.getRight().getLevelNum());
compareReportField.setNum2(compareReportVO.getRight().getNum());
compareReportField.setMaterialUnit2(compareReportVO.getRight().getMaterialUnit());
compareReportField.setProjectType2(compareReportVO.getRight().getProjectType());
if (ObjectUtil.equal(compareReportVO.getLeft().getTag(), ReportConstant.TagEnum.SIGMA.getValue())
|| ObjectUtil.equal(compareReportVO.getRight().getTag(), ReportConstant.TagEnum.SIGMA.getValue())) {
compareReportField.setSumSymbol("Σ");
@ -107,19 +110,23 @@ public class CompareReportService {
compareReportField.setLevelNum(compareReportVO.getLeft().getLevelNum());
compareReportField.setNum(compareReportVO.getLeft().getNum());
compareReportField.setMaterialUnit(compareReportVO.getLeft().getMaterialUnit());
compareReportField.setProjectType(compareReportVO.getLeft().getProjectType());
if (ObjectUtil.equal(compareReportVO.getLeft().getTag(), ReportConstant.TagEnum.SIGMA.getValue())) {
compareReportField.setSumSymbol("Σ");
}
compareReportField.setLevelNum2(null);
compareReportField.setNum2(null);
compareReportField.setMaterialUnit2(null);
compareReportField.setProjectType2(null);
} else if (ObjectUtil.equal(compareReportVO.getSymbol(), ReportConstant.SymbolEnum.NULL_R.getValue())) {
compareReportField.setLevelNum(null);
compareReportField.setNum(null);
compareReportField.setMaterialUnit(null);
compareReportField.setProjectType(null);
compareReportField.setLevelNum2(compareReportVO.getRight().getLevelNum());
compareReportField.setNum2(compareReportVO.getRight().getNum());
compareReportField.setMaterialUnit2(compareReportVO.getRight().getMaterialUnit());
compareReportField.setProjectType2(compareReportVO.getRight().getProjectType());
if (ObjectUtil.equal(compareReportVO.getRight().getTag(), ReportConstant.TagEnum.SIGMA.getValue())) {
compareReportField.setSumSymbol("Σ");
}
@ -161,7 +168,7 @@ public class CompareReportService {
filePath = "1.png";
} else if (ObjectUtil.equal(type, ReportConstant.SymbolEnum.NON_EQ.getValue())) {
} else if ( type>=ReportConstant.SymbolEnum.NON_EQ_NUM.getValue() ) {
filePath = "0.png";
} else if (ObjectUtil.equal(type, ReportConstant.SymbolEnum.L_NULL.getValue())) {
@ -359,29 +366,45 @@ public class CompareReportService {
//比较数量
if(ObjectUtil.isNull(from.getNum()) || ObjectUtil.isNull(to.getNum())){
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_NUM.getValue());
continue;
}
if ( from.getNum().compareTo(to.getNum()) !=0) {
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ.getValue());
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_NUM.getValue());
continue;
}
//项目类型比较
if(ObjectUtil.isNull(from.getProjectType()) || ObjectUtil.isNull(to.getProjectType())){
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_PROJECT_TYPE.getValue());
continue;
}
if (!StrUtil.equals(from.getProjectType().toUpperCase(),to.getProjectType().toUpperCase()) ) {
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_PROJECT_TYPE.getValue());
continue;
}
//多层比较父级物料编码/图号
if (queryType.compareTo(ReportConstant.QueryTypeEnum.MULTI.getValue()) == 0) {
//根节点下面不用比较
if ( (Objects.nonNull(from.getParentRowId()) &&from.getParentRowId()>0)
&& (Objects.nonNull(to.getParentRowId()) &&to.getParentRowId()>0) ) {
if (CollUtil.isEmpty(leftBomRowIdMap.get(from.getParentRowId()))
|| CollUtil.isEmpty(rightBomRowIdMap.get(to.getParentRowId()))) {
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ.getValue());
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_PARENT_MaterialNo.getValue());
continue;
}
//父级物料比
ForwardReportVO fromParent = leftBomRowIdMap.get(from.getParentRowId()).get(0);
ForwardReportVO toParent = rightBomRowIdMap.get(to.getParentRowId()).get(0);
if (!compareFunc.apply(fromParent).equals(compareFunc.apply(toParent))) {
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ.getValue());
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_PARENT_MaterialNo.getValue());
continue;
}
@ -389,12 +412,12 @@ public class CompareReportService {
} else {
//比较单位
if (!ObjectUtil.equal(from.getMaterialUnit().toUpperCase(), to.getMaterialUnit().toUpperCase())) {
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ.getValue());
if (!StrUtil.equals(from.getMaterialUnit().toUpperCase(), to.getMaterialUnit().toUpperCase())) {
compareReportVO.setSymbol(ReportConstant.SymbolEnum.NON_EQ_UNIT.getValue());
continue;
}
}
//找到相等退出
//上面条件都不满足即为相等
compareReportVO.setSymbol(ReportConstant.SymbolEnum.EQ.getValue());
break;
}