From 143c71d16f3b2f8e8d266544968ec4545badd0a1 Mon Sep 17 00:00:00 2001 From: yinq Date: Fri, 27 Sep 2024 18:05:56 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E6=8F=90=E8=B5=84=E5=8D=95BOM?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=97=B6=E8=AE=B0=E5=BD=95=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E4=BF=A1=E6=81=AF=E3=80=81=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E6=A8=A1=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hw/mes/domain/MesRaiseCapitalBom.java | 13 +++++++++++ .../hw/mes/service/impl/MesImportImpl.java | 23 +++++++++++-------- .../impl/MesRaiseCapitalBomServiceImpl.java | 12 ++++++++++ .../mapper/mes/MesRaiseCapitalBomMapper.xml | 6 +++++ .../views/mes/mesRaiseCapitalBom/index.vue | 11 ++++++++- 5 files changed, 55 insertions(+), 10 deletions(-) diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesRaiseCapitalBom.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesRaiseCapitalBom.java index 44a4089..21f93ce 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesRaiseCapitalBom.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/domain/MesRaiseCapitalBom.java @@ -119,6 +119,19 @@ public class MesRaiseCapitalBom extends BaseEntity { private String materialSpec; + /** + * 修改标识(1=是;0=否) + */ + private String updateFlag; + + public String getUpdateFlag() { + return updateFlag; + } + + public void setUpdateFlag(String updateFlag) { + this.updateFlag = updateFlag; + } + public String getMaterialCode() { return materialCode; } diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesImportImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesImportImpl.java index 0755750..9885bac 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesImportImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesImportImpl.java @@ -293,7 +293,7 @@ public class MesImportImpl implements IMesImportService { if (rowT == null) { continue; // 如果行为空,跳过 } - Cell cellT = rowT.getCell(2); + Cell cellT = rowT.getCell(0); if (StringUtils.isNull(cellT)) { throw new ServiceException("Excel格式错误!"); } @@ -304,7 +304,7 @@ public class MesImportImpl implements IMesImportService { throw new ServiceException("Excel格式错误:物料编号:" + productBom + "的信息不存在!"); } - i = i + 3;//标题下一行 + i = i + 2;//标题下一行 MesRaiseCapitalBom selectBom = new MesRaiseCapitalBom(); selectBom.setMaterialId(productMaterial.getMaterialId()); selectBom.setMaterialBomDesc(productMaterial.getMaterialName()); @@ -314,13 +314,14 @@ public class MesImportImpl implements IMesImportService { finishedProductNameList.add(productMaterial.getMaterialName()); if (productBomList.size() > 0) { MesRaiseCapitalBom mesMaterialBom = productBomList.get(0); - parentBomId = mesMaterialBom.getRaiseCapitalId(); - MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom(); - materialBom.setParentId(mesMaterialBom.getRaiseCapitalId()); - List mesMaterialBoms = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(materialBom); - for (MesRaiseCapitalBom bom : mesMaterialBoms) { - mesRaiseCapitalBomService.deleteMesRaiseCapitalBomByRaiseCapitalId(bom.getRaiseCapitalId()); - } + throw new ServiceException(mesMaterialBom.getMaterialName() + "已存在!" + "任务编号:" + mesMaterialBom.getTaskCode()); +// parentBomId = mesMaterialBom.getRaiseCapitalId(); +// MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom(); +// materialBom.setParentId(mesMaterialBom.getRaiseCapitalId()); +// List mesMaterialBoms = mesRaiseCapitalBomService.selectMesRaiseCapitalBomList(materialBom); +// for (MesRaiseCapitalBom bom : mesMaterialBoms) { +// mesRaiseCapitalBomService.deleteMesRaiseCapitalBomByRaiseCapitalId(bom.getRaiseCapitalId()); +// } } else { MesRaiseCapitalBom materialBom = new MesRaiseCapitalBom(); materialBom.setTaskCode(taskCode); @@ -354,6 +355,7 @@ public class MesImportImpl implements IMesImportService { materialCode = materialCodeCell.getStringCellValue(); } Cell amountCell = rowC.getCell(5); + Cell brandCell = rowC.getCell(6); if (StringUtils.isNotEmpty(materialCode)) { MesBaseMaterialInfo materialInfo = mesBaseMaterialInfoMapper.selectMesBaseMaterialInfoByMaterialCode(materialCode); if (StringUtils.isNotNull(materialInfo)) { @@ -366,6 +368,9 @@ public class MesImportImpl implements IMesImportService { materialBom.setActiveFlag("1"); materialBom.setStandardAmount(BigDecimal.valueOf(amountCell.getNumericCellValue())); materialBom.setErpMaterialId(materialInfo.getErpId()); + if (brandCell != null){ + materialBom.setBrand(brandCell.getStringCellValue()); + } bomList.add(materialBom); } else { failureMsg.append("物料编号:").append(materialCode).append("|"); diff --git a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesRaiseCapitalBomServiceImpl.java b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesRaiseCapitalBomServiceImpl.java index f52ce15..ce82ca1 100644 --- a/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesRaiseCapitalBomServiceImpl.java +++ b/hw-modules/hw-mes/src/main/java/com/hw/mes/service/impl/MesRaiseCapitalBomServiceImpl.java @@ -3,6 +3,7 @@ package com.hw.mes.service.impl; import java.util.ArrayList; import java.util.List; +import com.hw.common.core.constant.WfConstants; import com.hw.common.core.exception.ServiceException; import com.hw.common.core.utils.DateUtils; import com.hw.common.core.utils.StringUtils; @@ -96,6 +97,16 @@ public class MesRaiseCapitalBomServiceImpl implements IMesRaiseCapitalBomService public int updateMesRaiseCapitalBom(MesRaiseCapitalBom mesRaiseCapitalBom) { mesRaiseCapitalBom.setUpdateBy(SecurityUtils.getUsername()); mesRaiseCapitalBom.setUpdateTime(DateUtils.getNowDate()); + //记录修改前内容 + Long raiseCapitalId = mesRaiseCapitalBom.getRaiseCapitalId(); + MesRaiseCapitalBom raiseCapitalBom = mesRaiseCapitalBomMapper.selectMesRaiseCapitalBomByRaiseCapitalId(raiseCapitalId); + if (!raiseCapitalBom.getMaterialCode().equals(mesRaiseCapitalBom.getMaterialCode()) + || !raiseCapitalBom.getStandardAmount().equals(mesRaiseCapitalBom.getStandardAmount())){ + raiseCapitalBom.setUpdateFlag(WfConstants.PA_UPDATE_FLAG_YES); + mesRaiseCapitalBomMapper.insertMesRaiseCapitalBom(raiseCapitalBom); + mesRaiseCapitalBom.setRemark("已修改,原物料编号:" + raiseCapitalBom.getMaterialCode()); + } + return mesRaiseCapitalBomMapper.updateMesRaiseCapitalBom(mesRaiseCapitalBom); } @@ -126,6 +137,7 @@ public class MesRaiseCapitalBomServiceImpl implements IMesRaiseCapitalBomService public void importRaiseCapitalBom(String taskCode) { MesRaiseCapitalBom raiseCapitalBom = new MesRaiseCapitalBom(); raiseCapitalBom.setTaskCode(taskCode); + raiseCapitalBom.setUpdateFlag(WfConstants.PA_UPDATE_FLAG_NO); List capitalBomList = mesRaiseCapitalBomMapper.selectMesRaiseCapitalBomList(raiseCapitalBom); //TODO 异常处理 diff --git a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesRaiseCapitalBomMapper.xml b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesRaiseCapitalBomMapper.xml index 6847a0f..c265d32 100644 --- a/hw-modules/hw-mes/src/main/resources/mapper/mes/MesRaiseCapitalBomMapper.xml +++ b/hw-modules/hw-mes/src/main/resources/mapper/mes/MesRaiseCapitalBomMapper.xml @@ -29,6 +29,7 @@ + @@ -52,6 +53,7 @@ mrcb.brand, mrcb.material_classfication, mrcb.erp_material_id, + mrcb.update_flag, mbmi.material_code, mbmi.material_name, mbmi.material_spec @@ -82,6 +84,7 @@ #{materialClassfication} and mrcb.erp_material_id = #{erpMaterialId} + and mrcb.update_flag = #{updateFlag} @@ -114,6 +117,7 @@ brand, material_classfication, erp_material_id, + update_flag, #{taskCode}, @@ -136,6 +140,7 @@ #{brand}, #{materialClassfication}, #{erpMaterialId}, + #{updateFlag}, @@ -162,6 +167,7 @@ brand = #{brand}, material_classfication = #{materialClassfication}, erp_material_id = #{erpMaterialId}, + update_flag = #{updateFlag}, where raise_capital_id = #{raiseCapitalId} diff --git a/hw-ui/src/views/mes/mesRaiseCapitalBom/index.vue b/hw-ui/src/views/mes/mesRaiseCapitalBom/index.vue index 0e79cb7..807e629 100644 --- a/hw-ui/src/views/mes/mesRaiseCapitalBom/index.vue +++ b/hw-ui/src/views/mes/mesRaiseCapitalBom/index.vue @@ -86,6 +86,11 @@ + + +