From 53974c8cf6ac52f07585d6eaeebf22919f36d9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Sun, 28 Apr 2024 09:01:18 +0800 Subject: [PATCH 1/4] =?UTF-8?q?optimize:=20=E5=AF=BC=E5=85=A5sap=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E5=A6=82=E6=9E=9C=E6=98=AFT=E9=A1=B9=EF=BC=8C?= =?UTF-8?q?=E5=88=99=E9=9C=80=E8=A6=81=E8=AE=BE=E7=BD=AEPOTX1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nflg/product/bomnew/service/BomNewEbomParentService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 9d089bf7..1aa6202c 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -964,6 +964,9 @@ public class BomNewEbomParentService extends ServiceImpl Date: Sun, 28 Apr 2024 09:32:08 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E7=89=A9=E6=96=99?= =?UTF-8?q?=E8=A1=8C=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/BomNewEbomParentService.java | 3 ++- .../product/bomnew/service/DQBomService.java | 23 +++---------------- 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index 1aa6202c..a44111f7 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -964,7 +964,8 @@ public class BomNewEbomParentService extends ServiceImpl changeMaterial(BomNewDQbomQuery query) { VUtils.isTure(Objects.isNull(query.getParent())).throwMessage("父级节点不能为空"); - if (CollUtil.isNotEmpty(query.getDatas())) return query.getDatas(); - List materialNos = query.getDatas().stream() - .map(BomNewDQbomVO::getMaterialNo) - .filter(StrUtil::isNotBlank) - .distinct() - .collect(Collectors.toList()); - List materialBaseInfos = materialMainService.getMaterialBaseInfo(materialNos); - query.getDatas().forEach(c -> { - BaseMaterialVO vo = materialBaseInfos.stream() - .filter(m -> m.getMaterialNo().equals(c.getMaterialNo())) - .findFirst() - .orElse(null); - if (vo != null) { - c.setUnitWeight(vo.getMaterialWeight()); - c.setTotalWeight(BomUtil.calculateTotalWeight(c.getNum(), c.getUnitWeight())); - c.setMaterialName(vo.getMaterialName()); - c.setMaterialUnit(vo.getMaterialUnit()); - c.setMaterialTexture(vo.getMaterialTexture()); - } - }); + if (CollUtil.isEmpty(query.getDatas())) return query.getDatas(); + + initMaterialInfo(query.getDatas()); return query.getDatas(); } From 7545e35fbf5b27edb2df2f00c28b310e9f7a04d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Sun, 28 Apr 2024 10:54:37 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=94=B5=E6=B0=94?= =?UTF-8?q?bom=E5=AF=BC=E5=85=A5sap=E6=88=90=E5=8A=9F=E5=90=8E=EF=BC=8Cbom?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E4=BC=9A=E5=8F=98=E6=88=90=E5=BE=85=E8=BD=AC?= =?UTF-8?q?=E6=8D=A2=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9B=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E5=88=B0sap=E7=9A=84=E7=89=A9=E6=96=99=E5=8D=95=E4=BD=8D?= =?UTF-8?q?=E6=94=B9=E4=B8=BA=E4=BD=BF=E7=94=A8=E4=B8=BB=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=8D=95=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/service/DQBomService.java | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java index 50ebaa40..5154205e 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java @@ -3,7 +3,6 @@ package com.nflg.product.bomnew.service; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; @@ -387,6 +386,8 @@ public class DQBomService { List datas = getAll(rootBomRowId); datas.remove(0); + List materialNos = datas.stream().map(BomNewDQbomVO::getMaterialNo).collect(Collectors.toList()); + List materialBaseInfos = materialMainService.getMaterialBaseInfo(materialNos); ImportSapParamDTO sapDto = new ImportSapParamDTO(); sapDto.setZID(RandomUtil.randomNumbers(5)); sapDto.setI_WERKS("1"); @@ -397,28 +398,35 @@ public class DQBomService { T1DTO t1 = new T1DTO(); t1.setID(RandomUtil.randomNumbers(5)); t1.setMATNR(d.getParentMaterialNo()); - t1.setMEINS(d.getMaterialUnit()); t1.setMENGE(d.getNum().toString()); t1.setPOSTP(d.getProjectType()); + t1.setDATUM(dateYMD); + + t1.setMEINS(d.getMaterialUnit()); if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(d.getProjectType())) { t1.setIDNRK(""); t1.setPOTX1(d.getMaterialName()); } else { t1.setIDNRK(d.getMaterialNo()); + BaseMaterialVO bm = materialBaseInfos.stream().filter(m -> m.getMaterialNo().equals(d.getMaterialNo())).findFirst().orElse(null); + if (!Objects.isNull(bm)) { + t1.setMEINS(bm.getMaterialUnit()); + } } - t1.setDATUM(dateYMD); + t1s.add(t1); }); sapDto.setT1(t1s); ResultVO resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null); - if (resultVO.getState().equals(STATE.Success.getState())) { - BomNewDQbomParentEntity parentEntity = new BomNewDQbomParentEntity(); - parentEntity.setRowId(rootBomRowId); - parentEntity.setSapState(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue()); - parentEntity.setSapTime(LocalDateTimeUtil.now()); - dQBomParentService.updateById(parentEntity); - } - return resultVO; + boolean update = dQBomParentService.lambdaUpdate() + .eq(BomNewDQbomParentEntity::getRowId, rootBomRowId) + .set(BomNewDQbomParentEntity::getSapTime, LocalDateTime.now()) + .set(resultVO.getState().equals(STATE.Success.getState()) + , BomNewDQbomParentEntity::getSapState, MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue()) + .set(!resultVO.getState().equals(STATE.Success.getState()) + , BomNewDQbomParentEntity::getSapState, MBomConstantEnum.MBomStatusEnum.PUB_ERROR.getValue()) + .update(); + return update ? resultVO : ResultVO.error("更新数据失败"); } public BomDQbomEditDetailVO editDetail(Long rowId, Long bomRowId) { From 58c4a166d4df9b54ab57c86425f2143b8784539e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9B=B9=E9=B9=8F=E9=A3=9E?= Date: Sun, 28 Apr 2024 17:59:15 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E5=AF=BC=E5=85=A5?= =?UTF-8?q?sap?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/bomnew/api/user/DQBomApi.java | 2 +- .../nflg/product/bomnew/api/user/EbomApi.java | 3 +- .../nflg/product/bomnew/api/user/MBomApi.java | 23 +++---- .../bomnew/api/user/OptionalMbomApi.java | 16 ++--- .../nflg/product/bomnew/api/user/TestApi.java | 3 +- .../bomnew/constant/MBomConstantEnum.java | 8 ++- .../pojo/entity/BomNewDQbomChildEntity.java | 8 +-- .../pojo/entity/BomNewDQbomParentEntity.java | 8 +-- .../product/bomnew/pojo/vo/BomNewDQbomVO.java | 6 +- .../BomNewDQbomExceptionCheckService.java | 13 ++-- .../service/BomNewEbomParentService.java | 23 +++---- .../service/BomNewMbomParentService.java | 42 +++++++------ .../bomnew/service/DQBomImportService.java | 4 +- .../product/bomnew/service/DQBomService.java | 61 ++++++++++++++----- .../service/OptionalMbomMaterialService.java | 8 +-- .../bomnew/service/SapOpUtilService.java | 6 +- .../mapper/master/BomNewDQbomParentMapper.xml | 10 +-- .../java/nflg/product/common/vo/ResultVO.java | 4 +- 18 files changed, 138 insertions(+), 110 deletions(-) diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/DQBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/DQBomApi.java index efad7653..0cf761ef 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/DQBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/DQBomApi.java @@ -212,7 +212,7 @@ public class DQBomApi extends BaseApi { */ @PostMapping("importToSAP") @ApiOperation("导入到SAP") - public ResultVO importToSAP(@Valid @RequestBody @NotEmpty List rootBomRowIds) { + public ResultVO> importToSAP(@Valid @RequestBody @NotEmpty List rootBomRowIds) { VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条"); return dQBomService.importToSAP(rootBomRowIds.get(0)); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java index d9c5fcc3..51517b7a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/EbomApi.java @@ -15,6 +15,7 @@ import com.nflg.product.bomnew.pojo.query.BomNewEbomParentQuery; import com.nflg.product.bomnew.pojo.vo.BomNewEbomEditDetailVO; import com.nflg.product.bomnew.pojo.vo.BomNewEbomParentVO; import com.nflg.product.bomnew.pojo.vo.BomNewEbomUpgradeChangeVO; +import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO; import com.nflg.product.bomnew.service.*; import com.nflg.product.bomnew.util.EecExcelUtil; import com.nflg.product.bomnew.util.VUtils; @@ -459,7 +460,7 @@ public class EbomApi extends BaseApi { */ @PostMapping("importToSAP") @ApiOperation("导入到SAP") - public ResultVO importToSAP(@Valid @RequestBody @NotEmpty List rootBomRowIds) { + public ResultVO> importToSAP(@Valid @RequestBody @NotEmpty List rootBomRowIds) { VUtils.isTure(rootBomRowIds.size() > 1).throwMessage("每次只能导入1条"); return bomNewEbomParentService.importToSAP(rootBomRowIds.get(0)); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/MBomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/MBomApi.java index 159efe2f..0c23ceca 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/MBomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/MBomApi.java @@ -1,23 +1,22 @@ package com.nflg.product.bomnew.api.user; -import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; -import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzt.logapi.starter.annotation.LogRecord; import com.nflg.product.base.core.api.BaseApi; import com.nflg.product.base.core.exception.NflgBusinessException; import com.nflg.product.bomnew.constant.FactoryCodeEnum; import com.nflg.product.bomnew.constant.MBomConstantEnum; -import com.nflg.product.bomnew.constant.ValueEnum; -import com.nflg.product.bomnew.pojo.dto.*; +import com.nflg.product.bomnew.pojo.dto.BomNewMBomChildDTO; +import com.nflg.product.bomnew.pojo.dto.BomNewMbomApplyBackMaterialDTO; +import com.nflg.product.bomnew.pojo.dto.BomNewMbomDetailDTO; +import com.nflg.product.bomnew.pojo.dto.BomNewMbomSuperStatusDTO; import com.nflg.product.bomnew.pojo.query.BomNewMbomBackMaterialQuery; import com.nflg.product.bomnew.pojo.query.BomNewMbomParentQuery; import com.nflg.product.bomnew.pojo.vo.BomNewMbomBackMaterialVO; -import com.nflg.product.bomnew.pojo.vo.BomNewMbomDetailVO; import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO; -import com.nflg.product.bomnew.pojo.vo.BomNewMbomParentVO; +import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO; import com.nflg.product.bomnew.service.BomNewMbomBackMaterialService; import com.nflg.product.bomnew.service.BomNewMbomDetailService; import com.nflg.product.bomnew.service.BomNewMbomParentService; @@ -225,15 +224,11 @@ public class MBomApi extends BaseApi { @ApiOperation("导入sap") @LogRecord(success = "Mbom-导入sap,操作结果:{{#_ret}}", bizNo = "", extra = "{{#rowId}}" ,type = "Mbom-导入sap") - public ResultVO importSap(@ApiParam("行Id") @RequestParam("rowId") Long rowId) { - - if(Objects.isNull(rowId)){ - throw new NflgBusinessException(STATE.Error, "选择行操作" ); - + public ResultVO> importSap(@ApiParam("行Id") @RequestParam("rowId") Long rowId) { + if (Objects.isNull(rowId)) { + throw new NflgBusinessException(STATE.Error, "选择行操作"); } - return bomNewMbomParentService.importSap(rowId) ; - - + return bomNewMbomParentService.importSap(rowId); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OptionalMbomApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OptionalMbomApi.java index 4842c22e..ebfe6231 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OptionalMbomApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/OptionalMbomApi.java @@ -3,20 +3,19 @@ package com.nflg.product.bomnew.api.user; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; -import cn.hutool.crypto.digest.MD5; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.mzt.logapi.starter.annotation.LogRecord; import com.nflg.product.base.core.api.BaseApi; import com.nflg.product.base.core.conmon.util.SessionUtil; import com.nflg.product.base.core.exception.NflgBusinessException; -import com.nflg.product.bomnew.constant.OptionalBomConstant; -import com.nflg.product.bomnew.pojo.dto.*; +import com.nflg.product.bomnew.pojo.dto.OptionalMbomMaterialAddDTO; import com.nflg.product.bomnew.pojo.query.OptionalEbomConfigListQuery; -import com.nflg.product.bomnew.pojo.query.OptionalEbomMainListQuery; import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialListQuery; import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialQuery; -import com.nflg.product.bomnew.pojo.vo.*; +import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO; +import com.nflg.product.bomnew.pojo.vo.OptionalEbomConfigVO; +import com.nflg.product.bomnew.pojo.vo.OptionalMbomMaterialListVO; import com.nflg.product.bomnew.service.OptionalEbomConfigService; import com.nflg.product.bomnew.service.OptionalEbomImportChildService; import com.nflg.product.bomnew.service.OptionalEbomMainService; @@ -30,7 +29,6 @@ import nflg.product.common.vo.ResultVO; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; -import java.util.Date; import java.util.List; import java.util.Objects; @@ -161,16 +159,12 @@ public class OptionalMbomApi extends BaseApi { @ApiOperation("导入sap") @LogRecord(success = "移动破-导入sap,操作结果:{{#_ret}}", bizNo = "", extra = "{{#rowId}}" ,type = "移动破-导入sap") - public ResultVO importSap(@ApiParam("行Id") @RequestParam("rowId") Long rowId) { - + public ResultVO> importSap(@ApiParam("行Id") @RequestParam("rowId") Long rowId) { if(Objects.isNull(rowId)){ throw new NflgBusinessException(STATE.Error, "选择行操作" ); - } return optionalMbomMaterialService.importSap(rowId); } - - } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/TestApi.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/TestApi.java index 238fe4cc..96983389 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/TestApi.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/api/user/TestApi.java @@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.RandomUtil; 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.vo.OperationErrorMsgVO; import com.nflg.product.bomnew.service.SapOpUtilService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -31,7 +32,7 @@ public class TestApi { @GetMapping("sap") @ApiOperation("sap接口测试") - public ResultVO workDetailsListByPage() { + public ResultVO> workDetailsListByPage() { String dateYMD = DateUtil.format(new Date(), "yyyyMMdd"); ImportSapParamDTO sapDto = new ImportSapParamDTO(); sapDto.setZID(RandomUtil.randomNumbers(5)); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/MBomConstantEnum.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/MBomConstantEnum.java index 49a136aa..7af08f0c 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/MBomConstantEnum.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/constant/MBomConstantEnum.java @@ -11,9 +11,11 @@ public class MBomConstantEnum { @Getter public enum MBomStatusEnum implements ValueEnum { //1、待发布(sap)、3=已发布 - UNPUB_SAP(1, "未发布"), - - PUB_SAP(3, "已导入"); + UNPUB_SAP(1, "未导入"), + PUB_RUNNING(2, "导入中"), + PUB_SAP(3, "已导入"), + PUB_ERROR(4, "部分导入失败"), + PUB_ERROR_ALL(5, "全部导入失败"); private final Integer value; private final String description; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewDQbomChildEntity.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewDQbomChildEntity.java index f5934e30..e0c3e6e4 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewDQbomChildEntity.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewDQbomChildEntity.java @@ -77,11 +77,11 @@ public class BomNewDQbomChildEntity extends BomNewDQbomBaseEntity { // private String materialNo; /** - * 物料名称 + * 物料描述 */ - @TableField(value = "material_name") - @ApiModelProperty(value = "物料名称") - private String materialName; + @TableField(value = "material_desc") + @ApiModelProperty(value = "物料描述") + private String materialDesc; // /** // * 材质 diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewDQbomParentEntity.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewDQbomParentEntity.java index 2515cdb0..10ffba1c 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewDQbomParentEntity.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/entity/BomNewDQbomParentEntity.java @@ -49,11 +49,11 @@ public class BomNewDQbomParentEntity extends BomNewDQbomBaseEntity { // private String materialNo; /** - * 物料名称 + * 物料描述 */ - @TableField(value = "material_name") - @ApiModelProperty(value = "物料名称") - private String materialName; + @TableField(value = "material_desc") + @ApiModelProperty(value = "物料描述") + private String materialDesc; // /** // * 材质 diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewDQbomVO.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewDQbomVO.java index 99cfdf69..261c7f73 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewDQbomVO.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/pojo/vo/BomNewDQbomVO.java @@ -39,10 +39,10 @@ public class BomNewDQbomVO extends BomNewDQbomChildEntity implements Serializabl private Long materialRowId; /** - * 物料信息表中的物料名称 + * 物料信息表中的物料描述 */ - @ApiModelProperty(value = "物料名称(系统)") - private String systemMaterialName; + @ApiModelProperty(value = "物料描述(系统)") + private String systemMaterialDesc; /** * 物料类别 diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewDQbomExceptionCheckService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewDQbomExceptionCheckService.java index 80f688dd..31cc17d5 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewDQbomExceptionCheckService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewDQbomExceptionCheckService.java @@ -1,6 +1,7 @@ package com.nflg.product.bomnew.service; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.StrUtil; import com.nflg.product.bomnew.constant.BomConstant; @@ -125,7 +126,7 @@ public class BomNewDQbomExceptionCheckService { EBomExceptionStatusEnum status = EBomExceptionStatusEnum.OK; if (parent.getRootIs() == 1 || parent.getUserRootIs() == 1) { if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, parent.getProjectType())) { - if (StrUtil.isBlank(parent.getMaterialName())) { + if (StrUtil.isBlank(parent.getMaterialDesc())) { status = EBomExceptionStatusEnum.EXCEPT_NO_4; } } else { @@ -137,9 +138,9 @@ public class BomNewDQbomExceptionCheckService { status = EBomExceptionStatusEnum.EXCEPT_NO_7; } else if (materialVO.getMaterialState().equals(MaterialGetEnum.MaterialStateEnum.STATE_NO_4.getValue())) { status = EBomExceptionStatusEnum.EXCEPT_NO_2; - } else if (!materialVO.getMaterialDesc().equals(parent.getMaterialName())) { + } else if (!materialVO.getMaterialDesc().equals(parent.getMaterialDesc())) { status = EBomExceptionStatusEnum.EXCEPT_NO_15; - } else if (Objects.isNull(parent.getNum()) || parent.getNum().equals(BigDecimal.ZERO)) { + } else if (Objects.isNull(parent.getNum()) || NumberUtil.equals(parent.getNum(), BigDecimal.ZERO)) { status = EBomExceptionStatusEnum.EXCEPT_NO_4; } else if (!Objects.equals(materialVO.getMaterialUnit(), parent.getMaterialUnit())) { status = EBomExceptionStatusEnum.EXCEPT_NO_16; @@ -166,7 +167,7 @@ public class BomNewDQbomExceptionCheckService { if (StrUtil.isBlank(child.getProjectType())) { status = EBomExceptionStatusEnum.EXCEPT_NO_8; } else if (StrUtil.equals(BomConstant.PROJECT_TYPE_TEMPORARY, child.getProjectType())) { - if (StrUtil.isBlank(child.getMaterialName())) { + if (StrUtil.isBlank(child.getMaterialDesc())) { status = EBomExceptionStatusEnum.EXCEPT_NO_4; } } else { @@ -177,9 +178,9 @@ public class BomNewDQbomExceptionCheckService { status = EBomExceptionStatusEnum.EXCEPT_NO_7; } else if (materialVO.getMaterialState().equals(MaterialGetEnum.MaterialStateEnum.STATE_NO_4.getValue())) { status = EBomExceptionStatusEnum.EXCEPT_NO_2; - } else if (!materialVO.getMaterialDesc().equals(child.getMaterialName())) { + } else if (!materialVO.getMaterialDesc().equals(child.getMaterialDesc())) { status = EBomExceptionStatusEnum.EXCEPT_NO_15; - } else if (Objects.isNull(child.getNum()) || child.getNum().equals(BigDecimal.ZERO)) { + } else if (Objects.isNull(child.getNum()) || NumberUtil.equals(child.getNum(), BigDecimal.ZERO)) { status = EBomExceptionStatusEnum.EXCEPT_NO_4; } else if (!Objects.equals(materialVO.getMaterialUnit(), child.getMaterialUnit())) { status = EBomExceptionStatusEnum.EXCEPT_NO_16; diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java index a44111f7..a7e494b6 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewEbomParentService.java @@ -5,7 +5,6 @@ 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.date.LocalDateTimeUtil; import cn.hutool.core.lang.TypeReference; import cn.hutool.core.util.*; import cn.hutool.extra.spring.SpringUtil; @@ -927,7 +926,7 @@ public class BomNewEbomParentService extends ServiceImpl importToSAP(Long bomRowId) { + public ResultVO> importToSAP(Long bomRowId) { BomNewEbomParentEntity root = this.getById(bomRowId); VUtils.isTure(Objects.isNull(root)).throwMessage("数据不存在"); VUtils.isTure(root.getRootIs() != 1).throwMessage("请选择根节点"); @@ -939,15 +938,17 @@ public class BomNewEbomParentService extends ServiceImpl t1s = new ArrayList<>(); buildChildrenForSap(root, t1s); sapDto.setT1(t1s); - ResultVO resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null); - if (resultVO.getState().equals(STATE.Success.getState())) { - BomNewEbomParentEntity parentEntity = new BomNewEbomParentEntity(); - parentEntity.setRowId(bomRowId); - parentEntity.setSapState(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue()); - parentEntity.setSapTime(LocalDateTimeUtil.now()); - updateById(parentEntity); - } - return resultVO; + ResultVO> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null); + boolean update = lambdaUpdate().eq(BomNewEbomParentEntity::getRowId, bomRowId) + .set(BomNewEbomParentEntity::getSapTime, LocalDateTime.now()) + .set(Objects.equals(resultVO.getState(), STATE.Success.getState()) + , BomNewEbomParentEntity::getSapState, MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue()) + .set(!Objects.equals(resultVO.getState(), STATE.Success.getState()) && t1s.size() == resultVO.getData().size() + , BomNewEbomParentEntity::getSapState, MBomConstantEnum.MBomStatusEnum.PUB_ERROR_ALL.getValue()) + .set(!Objects.equals(resultVO.getState(), STATE.Success.getState()) && t1s.size() != resultVO.getData().size() + , BomNewEbomParentEntity::getSapState, MBomConstantEnum.MBomStatusEnum.PUB_ERROR.getValue()) + .update(); + return update ? resultVO : ResultVO.error("更新数据失败"); } private void buildChildrenForSap(BomNewEbomParentEntity parent, List t1s) { diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomParentService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomParentService.java index 45e35bcd..17926ce6 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomParentService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/BomNewMbomParentService.java @@ -3,7 +3,6 @@ package com.nflg.product.bomnew.service; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.date.LocalDateTimeUtil; import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.StrUtil; @@ -11,7 +10,6 @@ import cn.hutool.extra.spring.SpringUtil; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.google.common.collect.ImmutableList; -import com.nflg.product.base.core.conmon.util.SessionUtil; import com.nflg.product.bomnew.constant.BomConstant; import com.nflg.product.bomnew.constant.EBomConstant; import com.nflg.product.bomnew.constant.EBomSuperMaterialStatusEnum; @@ -22,16 +20,15 @@ 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.BomNewMbomParentEntity; import com.nflg.product.bomnew.pojo.query.BomNewMbomParentQuery; -import com.nflg.product.bomnew.pojo.vo.BomNewMbomIndexVO; import com.nflg.product.bomnew.pojo.vo.BomNewMbomMiddleVO; -import com.nflg.product.bomnew.pojo.vo.ForwardReportVO; +import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO; import com.nflg.product.bomnew.service.domain.MBom.IndexListTree; import com.nflg.product.bomnew.util.VUtils; -import io.swagger.annotations.ApiParam; import nflg.product.common.constant.STATE; import nflg.product.common.vo.ResultVO; import org.springframework.stereotype.Service; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -197,8 +194,7 @@ public class BomNewMbomParentService extends ServiceImpl importSap(Long rowId){ + public ResultVO> importSap(Long rowId) { BomNewMbomMiddleVO parentVO= getParentById(rowId); @@ -303,21 +299,29 @@ public class BomNewMbomParentService extends ServiceImpl resultVO= SpringUtil.getBean(SapOpUtilService.class).importToSapV2(result,null); + ResultVO> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(result, null); //上传成功更新状态 - if(resultVO.getState().equals( STATE.Success.getState())){ - BomNewMbomParentEntity parentEntity=new BomNewMbomParentEntity(); - parentEntity.setRowId(parentVO.getRowId()); - parentEntity.setStatus(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue()); - parentEntity.setSysnSapUserName(SessionUtil.getUserName()); - parentEntity.setSysnSapTime(LocalDateTimeUtil.now()); - parentEntity.setModifyTime(LocalDateTimeUtil.now()); - this.updateById(parentEntity); - } + // if(resultVO.getState().equals( STATE.Success.getState())){ + // BomNewMbomParentEntity parentEntity=new BomNewMbomParentEntity(); + // parentEntity.setRowId(parentVO.getRowId()); + // parentEntity.setStatus(MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue()); + // parentEntity.setSysnSapUserName(SessionUtil.getUserName()); + // parentEntity.setSysnSapTime(LocalDateTimeUtil.now()); + // parentEntity.setModifyTime(LocalDateTimeUtil.now()); + // this.updateById(parentEntity); + // } - return resultVO; - // return null; + boolean update = lambdaUpdate().eq(BomNewMbomParentEntity::getRowId, parentVO.getRowId()) + .set(BomNewMbomParentEntity::getSysnSapTime, LocalDateTime.now()) + .set(Objects.equals(resultVO.getState(), STATE.Success.getState()) + , BomNewMbomParentEntity::getStatus, MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue()) + .set(!Objects.equals(resultVO.getState(), STATE.Success.getState()) && result.getT1().size() == resultVO.getData().size() + , BomNewMbomParentEntity::getStatus, MBomConstantEnum.MBomStatusEnum.PUB_ERROR_ALL.getValue()) + .set(!Objects.equals(resultVO.getState(), STATE.Success.getState()) && result.getT1().size() != resultVO.getData().size() + , BomNewMbomParentEntity::getStatus, MBomConstantEnum.MBomStatusEnum.PUB_ERROR.getValue()) + .update(); + return update ? resultVO : ResultVO.error("更新数据失败"); } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomImportService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomImportService.java index a6098bfb..dde15829 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomImportService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomImportService.java @@ -292,7 +292,7 @@ public class DQBomImportService { parent.setLevel(data.getLevel()); parent.setDrawingNo(data.getDrawingNo()); parent.setMaterialNo(data.getMaterialNo()); - parent.setMaterialName(data.getMaterialName()); + parent.setMaterialDesc(data.getMaterialName()); parent.setMaterialTexture(data.getMaterialTexture()); parent.setMaterialUnit(data.getMaterialUnit()); parent.setUnitWeight(data.getUnitWeight()); @@ -334,7 +334,7 @@ public class DQBomImportService { child.setParentRowId(parentRowIdMap.getOrDefault(data.getLevel() - 1, 0L)); child.setIdentityNo(child.getParentRowId() + "_" + child.getRowId()); child.setLevel(data.getLevel()); - child.setMaterialName(data.getMaterialName()); + child.setMaterialDesc(data.getMaterialName()); child.setMaterialTexture(data.getMaterialTexture()); child.setMaterialUnit(data.getMaterialUnit()); child.setUnitWeight(data.getUnitWeight()); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java index 5154205e..8ad9c87a 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/DQBomService.java @@ -77,7 +77,7 @@ public class DQBomService { List roots = result.getRecords().stream() .filter(r -> StrUtil.equals(r.getMaterialNo(), query.getMaterialNo()) || StrUtil.equals(r.getDrawingNo(), query.getDrawingNo()) - || r.getMaterialName().contains(query.getMaterialName())) + || r.getMaterialDesc().contains(query.getMaterialName())) .collect(Collectors.toList()); roots.forEach(this::buildChildren); //从子级开始查找 @@ -183,7 +183,7 @@ public class DQBomService { BaseMaterialVO bm = materialBaseInfos.stream().filter(m -> m.getMaterialNo().equals(d.getMaterialNo())).findFirst().orElse(null); if (bm != null) { d.setMaterialState(bm.getMaterialState()); - d.setSystemMaterialName(bm.getMaterialDesc()); + d.setSystemMaterialDesc(bm.getMaterialDesc()); d.setSystemMaterialCategoryName(bm.getCategoryName()); d.setSystemMaterialUnit(bm.getMaterialUnit()); d.setMaterialRowId(bm.getMaterialRowId()); @@ -288,7 +288,7 @@ public class DQBomService { .eq(BomNewDQbomParentEntity::getStatus, DQBomStatusEnum.WAIT_CONVERT.getValue()) .one(); if (!Objects.isNull(cp)) { - cp.setMaterialName(c.getMaterialName()); + cp.setMaterialDesc(c.getMaterialDesc()); cp.setUnitWeight(c.getUnitWeight()); cp.setTotalWeight(BomUtil.calculateTotalWeight(cp.getNum(), cp.getUnitWeight())); cp.setModifyTime(LocalDateTime.now()); @@ -378,11 +378,14 @@ public class DQBomService { } } - public ResultVO importToSAP(Long rootBomRowId) { + public ResultVO> importToSAP(Long rootBomRowId) { BomNewDQbomParentEntity root = dQBomParentService.getById(rootBomRowId); VUtils.isTure(Objects.isNull(root)).throwMessage("数据不存在"); VUtils.isTure(root.getRootIs() == 0).throwMessage("请选择根节点"); - VUtils.isTure(root.getSapState() == 3).throwMessage("已导入过了,请勿重复操作"); + VUtils.isTure(Objects.equals(root.getSapState(), MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue())) + .throwMessage("已导入过了,请勿重复操作"); + VUtils.isTure(Objects.equals(root.getSapState(), MBomConstantEnum.MBomStatusEnum.PUB_RUNNING.getValue())) + .throwMessage("正在导入中,请等待操作完成"); List datas = getAll(rootBomRowId); datas.remove(0); @@ -405,7 +408,7 @@ public class DQBomService { t1.setMEINS(d.getMaterialUnit()); if (BomConstant.PROJECT_TYPE_TEMPORARY.equals(d.getProjectType())) { t1.setIDNRK(""); - t1.setPOTX1(d.getMaterialName()); + t1.setPOTX1(d.getMaterialDesc()); } else { t1.setIDNRK(d.getMaterialNo()); BaseMaterialVO bm = materialBaseInfos.stream().filter(m -> m.getMaterialNo().equals(d.getMaterialNo())).findFirst().orElse(null); @@ -417,16 +420,28 @@ public class DQBomService { t1s.add(t1); }); sapDto.setT1(t1s); - ResultVO resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null); - boolean update = dQBomParentService.lambdaUpdate() - .eq(BomNewDQbomParentEntity::getRowId, rootBomRowId) + Set bomRowIds = datas.stream().map(BomNewDQbomVO::getBomRowId).collect(Collectors.toSet()); + bomRowIds.add(rootBomRowId); + updateSapState(bomRowIds, MBomConstantEnum.MBomStatusEnum.PUB_RUNNING); + ResultVO> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(sapDto, null); + MBomConstantEnum.MBomStatusEnum sapState; + if (resultVO.getState().equals(STATE.Success.getState())) { + sapState = MBomConstantEnum.MBomStatusEnum.PUB_SAP; + } else if (t1s.size() == resultVO.getData().size()) { + sapState = MBomConstantEnum.MBomStatusEnum.PUB_ERROR_ALL; + } else { + sapState = MBomConstantEnum.MBomStatusEnum.PUB_ERROR; + } + boolean update = updateSapState(bomRowIds, sapState); + return update ? resultVO : ResultVO.error(STATE.Error, "更新失败"); + } + + private boolean updateSapState(Set bomRowIds, MBomConstantEnum.MBomStatusEnum sapState) { + return dQBomParentService.lambdaUpdate() + .in(BomNewDQbomParentEntity::getRowId, bomRowIds) .set(BomNewDQbomParentEntity::getSapTime, LocalDateTime.now()) - .set(resultVO.getState().equals(STATE.Success.getState()) - , BomNewDQbomParentEntity::getSapState, MBomConstantEnum.MBomStatusEnum.PUB_SAP.getValue()) - .set(!resultVO.getState().equals(STATE.Success.getState()) - , BomNewDQbomParentEntity::getSapState, MBomConstantEnum.MBomStatusEnum.PUB_ERROR.getValue()) + .set(BomNewDQbomParentEntity::getSapState, sapState.getValue()) .update(); - return update ? resultVO : ResultVO.error("更新数据失败"); } public BomDQbomEditDetailVO editDetail(Long rowId, Long bomRowId) { @@ -489,6 +504,7 @@ public class DQBomService { savePbomChildren(children, parents); CompletableFuture.runAsync(() -> { + bomNewPbomParentService.getBaseMapper().updatePBomMaterialUse(); importToSAP(root.getRowId()); }); } @@ -528,6 +544,22 @@ public class DQBomService { private void savePbomParents(List parents) { List pparents = Convert.toList(BomNewPbomParentEntity.class, parents); pparents.forEach(p -> { + if (Objects.equals(p.getRootIs(), 1)) { + //如果pbom中该物料是待发布的子节点,则设置该物料不是根节点 + Set pcParentIds = bomNewPbomChildService.lambdaQuery() + .select(BomNewPbomChildEntity::getParentRowId) + .eq(BomNewPbomChildEntity::getMaterialNo, p.getMaterialNo()) + .list() + .stream() + .map(BomNewPbomChildEntity::getParentRowId) + .collect(Collectors.toSet()); + if (!pcParentIds.isEmpty() && bomNewPbomParentService.lambdaQuery() + .in(BomNewPbomParentEntity::getMaterialNo, pcParentIds) + .eq(BomNewPbomParentEntity::getStatus, PBomStatusEnum.WAIT_PUBLISH.getValue()) + .exists()) { + p.setRootIs(0); + } + } p.setCreatedTime(LocalDateTime.now()); p.setModifyTime(null); p.setEditStatus(PBomEditStatusEnum.HANDLER_FINISHED.getValue()); @@ -634,5 +666,4 @@ public class DQBomService { } return datas; } - } diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/OptionalMbomMaterialService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/OptionalMbomMaterialService.java index f2b8f69c..de03d4e7 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/OptionalMbomMaterialService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/OptionalMbomMaterialService.java @@ -28,6 +28,7 @@ import com.nflg.product.bomnew.pojo.entity.OptionalEbomConfigEntity; import com.nflg.product.bomnew.pojo.entity.OptionalMbomMaterialEntity; import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialListQuery; import com.nflg.product.bomnew.pojo.query.OptionalMbomMaterialQuery; +import com.nflg.product.bomnew.pojo.vo.OperationErrorMsgVO; import com.nflg.product.bomnew.pojo.vo.OptionalMbomMaterialListVO; import lombok.extern.slf4j.Slf4j; import nflg.product.common.constant.STATE; @@ -119,9 +120,7 @@ public class OptionalMbomMaterialService extends ServiceImpl importSap(Long rowId){ + public ResultVO> importSap(Long rowId) { OptionalMbomMaterialEntity entity= getById(rowId); List list=this.baseMapper.getByRootIdList(entity.getRootRowId()); @@ -164,8 +163,7 @@ public ResultVO importSap(Long rowId){ log.info(JSON.toJSONString(result)); - - ResultVO resultVO= SpringUtil.getBean(SapOpUtilService.class).importToSapV2(result,null); + ResultVO> resultVO = SpringUtil.getBean(SapOpUtilService.class).importToSapV2(result, null); if(resultVO.getState().equals( STATE.Success.getState())){ OptionalEbomConfigEntity configEntity=new OptionalEbomConfigEntity(); diff --git a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/SapOpUtilService.java b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/SapOpUtilService.java index bb4e8fb9..41162fcc 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/SapOpUtilService.java +++ b/nflg_project_dev/nflg-bom-new/src/main/java/com/nflg/product/bomnew/service/SapOpUtilService.java @@ -137,8 +137,7 @@ public class SapOpUtilService { } - - public ResultVO importToSapV2(ImportSapParamDTO impartSapParamDTO,List backList) { + public ResultVO> importToSapV2(ImportSapParamDTO impartSapParamDTO, List backList) { if (CollUtil.isEmpty(impartSapParamDTO.getT1())) { return ResultVO.error("同步SAP 参数错误"); } @@ -201,7 +200,8 @@ public class SapOpUtilService { } if (errCount.get() > 0) { //throw new Exception(errBuf.toString()); - throw new ErrorMsgException(STATE.Success, "导入到SAP出错", liError); + //throw new ErrorMsgException(STATE.Success, "导入到SAP出错", liError); + return ResultVO.error(STATE.BusinessError, "导入到SAP出错", liError); } }else{ throw new Exception("获取sap返回数据转换异常"); diff --git a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewDQbomParentMapper.xml b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewDQbomParentMapper.xml index 01ac6e9c..ea7f68a1 100644 --- a/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewDQbomParentMapper.xml +++ b/nflg_project_dev/nflg-bom-new/src/main/resources/mapper/master/BomNewDQbomParentMapper.xml @@ -4,7 +4,7 @@ - + @@ -47,7 +47,7 @@ AND p.material_no = #{query.materialNo} - AND c.project_type='T' AND p.material_name like concat('%', #{query.materialName}, '%') + AND c.project_type='T' AND p.material_desc like concat('%', #{query.materialName}, '%') AND p.created_time = ]]> #{query.startDate} @@ -65,7 +65,7 @@ if(c.exception_status = 1, ifnull(p.exception_status, 1), c.exception_status) exception_status, ifnull(p.exception_tag, c.exception_tag) exception_tag, ifnull(p.bom_exist, 0) bom_exist, - ifnull(p.sap_state, 1) sap_state, + p2.sap_state, ifnull(p.current_version, if(c.status = 1, 'A00', p2.current_version)) current_version, c.* FROM t_bom_new_dqbom_child c @@ -93,7 +93,7 @@ c.level, c.material_no, c.drawing_no, - c.material_name, + c.material_desc, c.material_texture, c.num, ifnull(p.material_unit, c.material_unit) material_unit, @@ -125,7 +125,7 @@ AND c.material_no = #{materialNo} - AND c.project_type='T' AND c.material_name like concat('%', #{materialName}, '%') + AND c.project_type='T' AND c.material_desc like concat('%', #{materialName}, '%') diff --git a/nflg_project_dev/nflg-boot-base/nflg-common/src/main/java/nflg/product/common/vo/ResultVO.java b/nflg_project_dev/nflg-boot-base/nflg-common/src/main/java/nflg/product/common/vo/ResultVO.java index 3fdb48e1..ac3303c5 100644 --- a/nflg_project_dev/nflg-boot-base/nflg-common/src/main/java/nflg/product/common/vo/ResultVO.java +++ b/nflg_project_dev/nflg-boot-base/nflg-common/src/main/java/nflg/product/common/vo/ResultVO.java @@ -70,8 +70,8 @@ public class ResultVO implements Serializable { return error(msg ,STATE.PassportErr.getState()); } - public static ResultVO error(STATE state, String msg, Object value) { - ResultVO vo = new ResultVO<>(); + public static ResultVO error(STATE state, String msg, T value) { + ResultVO vo = new ResultVO(); vo.data = value; vo.state = state.getState(); vo.msg = msg;