optimize(ebom): 导入SAP优化

This commit is contained in:
曹鹏飞 2024-06-27 22:57:34 +08:00
parent 88aa53956b
commit a6869a8a9a
2 changed files with 14 additions and 17 deletions

View File

@ -273,25 +273,22 @@ public class BomNewPbomExportToSAPImpl implements IBomNewPbomExportToSAP {
* @param materialNo 直发包编号
*/
@Override
public void exportFromZFB(String materialNo) {
List<BomNewPbomParentEntity> pfhbs = bomNewPbomParentService.lambdaQuery()
public void exportFromZFB(String materialNo, String facCode) {
BomNewPbomParentEntity pfhb = bomNewPbomParentService.lambdaQuery()
.eq(BomNewPbomParentEntity::getMaterialNo, materialNo)
.eq(BomNewPbomParentEntity::getFacCode, facCode)
.ge(BomNewPbomParentEntity::getStatus, PBomStatusEnum.PUBLISH.getValue())
.list();
VUtils.isTure(Objects.isNull(pfhbs)).throwMessage("没有需要导入的数据");
.one();
VUtils.isTure(Objects.isNull(pfhb)).throwMessage("没有需要导入的数据");
pfhbs.forEach(pfhb -> {
List<OperationErrorMsgVO> errorMsgVOS = export(pfhb.getRowId());
if (CollUtil.isNotEmpty(errorMsgVOS)) {
//如果导入SAP出错了得将该bom提升为用户根节点以便用户手动尝试导入到SAP去
pfhb.setUserRootIs(1);
pfhb.setModifyTime(LocalDateTime.now());
}
});
pfhbs.removeIf(p -> Objects.equals(p.getLastVersionIs(), 0));
if (CollUtil.isNotEmpty(pfhbs)) {
bomNewPbomParentService.updateBatchById(pfhbs);
List<OperationErrorMsgVO> errorMsgVOS = export(pfhb.getRowId());
if (CollUtil.isNotEmpty(errorMsgVOS)) {
//如果导入SAP出错了得将该bom提升为用户根节点以便用户手动尝试导入到SAP去
pfhb.setUserRootIs(1);
pfhb.setModifyTime(LocalDateTime.now());
}
if (Objects.equals(pfhb.getLastVersionIs(), 1)) {
bomNewPbomParentService.updateById(pfhb);
}
}

View File

@ -27,5 +27,5 @@ public interface IBomNewPbomExportToSAP {
* 根据直发包编号导入上级物料到SAP
* @param materialNo 直发包编号
*/
void exportFromZFB(String materialNo);
void exportFromZFB(String materialNo, String facCode);
}