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

This commit is contained in:
曹鹏飞 2024-05-31 17:44:27 +08:00
commit 77a87fb2f9
8 changed files with 88 additions and 50 deletions

View File

@ -12,9 +12,6 @@ import java.util.List;
*/ */
public interface BomNewDQbomChildMapper extends BaseMapper<BomNewDQbomChildEntity> { public interface BomNewDQbomChildMapper extends BaseMapper<BomNewDQbomChildEntity> {
void deleteAllChildren(Long parentRowId);
List<BomNewDQbomVO> getBomsByParentRowId(Long rowId); List<BomNewDQbomVO> getBomsByParentRowId(Long rowId);
List<BomNewDQbomVO> getBom(Long parentRowId, String materialNo); List<BomNewDQbomVO> getBom(Long parentRowId, String materialNo);

View File

@ -7,55 +7,55 @@ import lombok.Data;
@Data @Data
public class T1DTO { public class T1DTO {
@ApiModelProperty("客户端") // @ApiModelProperty("客户端")
private String MANDT=""; // private String MANDT="";
@ApiModelProperty("流程标题") // @ApiModelProperty("流程标题")
private String ZLCBT=""; // private String ZLCBT="";
@ApiModelProperty("--序号") @ApiModelProperty("--序号")
private String ID=""; protected String ID = "";
@ApiModelProperty("日期") @ApiModelProperty("日期")
private String DATUM="99991231"; protected String DATUM = "99991231";
@ApiModelProperty("日期") // @ApiModelProperty("日期")
private String UZEIT=""; // private String UZEIT="";
@ApiModelProperty("父级物料") @ApiModelProperty("父级物料")
private String MATNR=""; protected String MATNR = "";
@ApiModelProperty("物料描述") // @ApiModelProperty("物料描述")
private String MAKTX=""; // private String MAKTX="";
@ApiModelProperty("项目类别") @ApiModelProperty("项目类别")
private String POSTP=""; protected String POSTP = "";
@ApiModelProperty("子级物料") @ApiModelProperty("子级物料")
private String IDNRK; protected String IDNRK;
@ApiModelProperty("子级物料描述") // @ApiModelProperty("子级物料描述")
private String MAKTX1; // private String MAKTX1;
@ApiModelProperty("组件数量") @ApiModelProperty("组件数量")
private String MENGE; protected String MENGE;
@ApiModelProperty("单位") @ApiModelProperty("单位")
private String MEINS; protected String MEINS;
@ApiModelProperty("bom项目文本") @ApiModelProperty("bom项目文本")
private String POTX1=""; protected String POTX1 = "";
@ApiModelProperty("是否发货") // @ApiModelProperty("是否发货")
private String SFFH=""; // private String SFFH="";
@ApiModelProperty("物料检查结果") // @ApiModelProperty("物料检查结果")
private String ZCHECK=""; // private String ZCHECK="";
@ApiModelProperty("导入状态描述") // @ApiModelProperty("导入状态描述")
private String STATUS=""; // private String STATUS="";
@ApiModelProperty("导入标志") // @ApiModelProperty("导入标志")
private String FLAG=""; // private String FLAG="";
} }

View File

@ -0,0 +1,18 @@
package com.nflg.product.bomnew.pojo.dto.sap.impart2;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author 曹鹏飞
* @date 2024/5/31 09:42:50
*/
@Data
public class T1ResultDTO extends T1DTO {
@ApiModelProperty("导入状态描述")
private String STATUS = "";
@ApiModelProperty("导入标志")
private String FLAG = "";
}

View File

@ -294,8 +294,8 @@ public class BomNewMbomParentService extends ServiceImpl<BomNewMbomParentMapper,
t1.setMENGE("1"); t1.setMENGE("1");
t1.setPOSTP(child.getProjectType()); t1.setPOSTP(child.getProjectType());
t1.setDATUM(dateYMD); t1.setDATUM(dateYMD);
t1.setMAKTX(parent.getMaterialDesc()); // t1.setMAKTX(parent.getMaterialDesc());
t1.setMAKTX1(child.getMaterialDesc()); // t1.setMAKTX1(child.getMaterialDesc());
result.getT1().add(t1); result.getT1().add(t1);
} }

View File

@ -155,8 +155,8 @@ public class OptionalMbomMaterialService extends ServiceImpl<OptionalMbomMateria
t1.setMENGE(child.getExistStatus().toString()); t1.setMENGE(child.getExistStatus().toString());
t1.setPOSTP("L"); t1.setPOSTP("L");
t1.setDATUM(dateYMD); t1.setDATUM(dateYMD);
t1.setMAKTX(parent.getMaterialDesc()); // t1.setMAKTX(parent.getMaterialDesc());
t1.setMAKTX1(child.getMaterialDesc()); // t1.setMAKTX1(child.getMaterialDesc());
result.getT1().add(t1); result.getT1().add(t1);
} }

View File

@ -14,6 +14,7 @@ import com.nflg.product.bomnew.pojo.dto.sap.SapResult;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParam2DTO; import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParam2DTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.ImportSapParamDTO; 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.T1DTO;
import com.nflg.product.bomnew.pojo.dto.sap.impart2.T1ResultDTO;
import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO; import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO;
import com.nflg.product.bomnew.util.VUtils; import com.nflg.product.bomnew.util.VUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -24,11 +25,9 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.*;
import java.util.List; import java.util.regex.Matcher;
import java.util.Map; import java.util.regex.Pattern;
import java.util.Objects;
import java.util.stream.Collectors;
@Service @Service
@Slf4j @Slf4j
@ -37,6 +36,7 @@ public class SapOpUtilService {
@Resource @Resource
SapService sapService; SapService sapService;
private final static Pattern PATTERN = Pattern.compile("\\d{10}");
/** /**
* sap 创建 * sap 创建
@ -154,9 +154,22 @@ public class SapOpUtilService {
params.setInputParams(parentMap); params.setInputParams(parentMap);
Map<String, List<Map<String, String>>> inputTables = new HashMap<>(); Map<String, List<Map<String, String>>> inputTables = new HashMap<>();
List<Map<String, String>> childMapList = Convert.convert(new TypeReference<List<Map<String, String>>>() { // List<Map<String, String>> childMapList = Convert.convert(new TypeReference<List<Map<String, String>>>() {
} // }
, impartSapParamDTO.getT1()); // , impartSapParamDTO.getT1());
List<Map<String, String>> childMapList = new ArrayList<>();
impartSapParamDTO.getT1().forEach(t -> {
// 项目类别如果是Z则改为L
if (StrUtil.equals(t.getPOSTP(), "Z", true)) {
t.setPOSTP("L");
}
//如果单位是ST则改为PC
if (StrUtil.equals("ST", t.getMEINS(), true)) {
t.setMEINS("PC");
}
childMapList.add(Convert.convert(new TypeReference<Map<String, String>>() {
}, t));
});
inputTables.put("T1", childMapList); inputTables.put("T1", childMapList);
params.setInputTables(inputTables); params.setInputTables(inputTables);
@ -168,9 +181,9 @@ public class SapOpUtilService {
Map<String, List<Map<String, Object>>> outTablesMap = sapResult.getOutTablesMap(); Map<String, List<Map<String, Object>>> outTablesMap = sapResult.getOutTablesMap();
log.info("导入到SAP--返回值:" + JSON.toJSONString(outTablesMap)); log.info("导入到SAP--返回值:" + JSON.toJSONString(outTablesMap));
List<Map<String, Object>> tOut = outTablesMap.get("T1"); List<Map<String, Object>> tOut = outTablesMap.get("T1");
List<T1DTO> list = null; List<T1ResultDTO> list = null;
if (!CollectionUtils.isEmpty(tOut)) { if (!CollectionUtils.isEmpty(tOut)) {
list = Convert.convert(new TypeReference<List<T1DTO>>() { list = Convert.convert(new TypeReference<List<T1ResultDTO>>() {
}, tOut); }, tOut);
} }
if (CollUtil.isEmpty(list)) { if (CollUtil.isEmpty(list)) {
@ -180,10 +193,21 @@ public class SapOpUtilService {
backList.addAll(list); backList.addAll(list);
} }
//"FLAG": "1" -- 0 失败1 成功 //"FLAG": "1" -- 0 失败1 成功
return list.stream() List<OperationErrorMsgVO> errorMsgVOS = new ArrayList<>();
list.stream()
.filter(f -> f.getFLAG().equals("0")) .filter(f -> f.getFLAG().equals("0"))
.map(item -> OperationErrorMsgVO.create(buildErrCol1(item), item.getSTATUS())) .forEach(it -> {
.collect(Collectors.toList()); Matcher matcher = PATTERN.matcher(it.getSTATUS());
if (matcher.find()) {
if (errorMsgVOS.stream().noneMatch(f -> StrUtil.equals(f.getPrimaryKey(), matcher.group()))) {
errorMsgVOS.add(OperationErrorMsgVO.create(matcher.group(), it.getSTATUS()));
}
} else {
errorMsgVOS.add(OperationErrorMsgVO.create(buildErrCol1(it), it.getSTATUS()));
}
});
return errorMsgVOS;
} }
private String buildErrCol1(T1DTO item) { private String buildErrCol1(T1DTO item) {

View File

@ -7,7 +7,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.T1DTO;
import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity; import com.nflg.product.bomnew.pojo.entity.BomNewPbomParentEntity;
import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO; import com.nflg.product.bomnew.pojo.vo.BomNewPbomParentVO;
import org.apache.http.util.Args;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -48,8 +47,8 @@ public class Sap {
t1.setMEINS(child.getMaterialUnit()); t1.setMEINS(child.getMaterialUnit());
t1.setMENGE(child.getNum().toString()); t1.setMENGE(child.getNum().toString());
t1.setPOSTP(child.getProjectType()); t1.setPOSTP(child.getProjectType());
t1.setMAKTX(parentBom.getMaterialDesc()); // t1.setMAKTX(parentBom.getMaterialDesc());
t1.setMAKTX1(child.getMaterialDesc()); // t1.setMAKTX1(child.getMaterialDesc());
result.getT1().add(t1); result.getT1().add(t1);
} }
} }

View File

@ -4,7 +4,7 @@
<select id="getBomsByParentRowId" resultType="com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO"> <select id="getBomsByParentRowId" resultType="com.nflg.product.bomnew.pojo.vo.BomNewDQbomVO">
SELECT c.*, p.row_id AS bomRowId, p.created_by AS bomCreateBy SELECT c.*, p.row_id AS bomRowId, p.created_by AS bomCreateBy
FROM t_bom_new_dqbom_child c FROM t_bom_new_dqbom_child c
LEFT JOIN t_bom_new_dqbom_parent p ON p.material_no = c.material_no LEFT JOIN t_bom_new_dqbom_parent p ON p.material_no = c.material_no AND p.`status` = 1
WHERE c.parent_row_id = #{rowId}; WHERE c.parent_row_id = #{rowId};
</select> </select>