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

View File

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