From 6842982f9a5967fad14c8abe2ce0b6d00f09e48f Mon Sep 17 00:00:00 2001 From: yinq <1345442242@qq.com> Date: Tue, 10 Oct 2023 09:23:23 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E8=AE=A2=E5=8D=95BOM=E5=8A=A0?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=E5=88=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OrderBomInfoController.java | 6 +- .../aucma/production/domain/BaseBomInfo.java | 29 +++++++++- .../service/impl/BaseBomInfoServiceImpl.java | 13 +++-- .../mapper/production/BaseBomInfoMapper.xml | 57 +++++++++++++------ 4 files changed, 80 insertions(+), 25 deletions(-) diff --git a/aucma-base/src/main/java/com/aucma/base/controller/OrderBomInfoController.java b/aucma-base/src/main/java/com/aucma/base/controller/OrderBomInfoController.java index b1ed300..2131c50 100644 --- a/aucma-base/src/main/java/com/aucma/base/controller/OrderBomInfoController.java +++ b/aucma-base/src/main/java/com/aucma/base/controller/OrderBomInfoController.java @@ -3,6 +3,7 @@ package com.aucma.base.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; +import com.aucma.common.core.page.TableDataInfo; import com.aucma.common.utils.DateUtils; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; @@ -39,9 +40,10 @@ public class OrderBomInfoController extends BaseController { */ @PreAuthorize("@ss.hasPermi('base:orderBomInfo:list')") @GetMapping("/list") - public AjaxResult list(OrderBomInfo orderBomInfo) { + public TableDataInfo list(OrderBomInfo orderBomInfo) { + startPage(); List list = orderBomInfoService.selectOrderBomInfoList(orderBomInfo); - return success(list); + return getDataTable(list); } /** diff --git a/aucma-production/src/main/java/com/aucma/production/domain/BaseBomInfo.java b/aucma-production/src/main/java/com/aucma/production/domain/BaseBomInfo.java index c860458..4eca4ac 100644 --- a/aucma-production/src/main/java/com/aucma/production/domain/BaseBomInfo.java +++ b/aucma-production/src/main/java/com/aucma/production/domain/BaseBomInfo.java @@ -64,12 +64,24 @@ public class BaseBomInfo extends TreeStringEntity { @Excel(name = "工厂编号") private String plantCode; + /** + * 工厂名称 + */ + @Excel(name = "工厂名称") + private String plantName; + /** * 产线/工位 */ - @Excel(name = "产线/工位") + @Excel(name = "产线/工位编号") private String productLineCode; + /** + * 产线/工位名称 + */ + @Excel(name = "产线/工位名称") + private String productLineName; + /** * 是否标识 */ @@ -102,6 +114,21 @@ public class BaseBomInfo extends TreeStringEntity { @Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date updatedTime; + public String getPlantName() { + return plantName; + } + + public void setPlantName(String plantName) { + this.plantName = plantName; + } + + public String getProductLineName() { + return productLineName; + } + + public void setProductLineName(String productLineName) { + this.productLineName = productLineName; + } public void setObjId(Long objId) { this.objId = objId; diff --git a/aucma-production/src/main/java/com/aucma/production/service/impl/BaseBomInfoServiceImpl.java b/aucma-production/src/main/java/com/aucma/production/service/impl/BaseBomInfoServiceImpl.java index 2a97b66..a7289c0 100644 --- a/aucma-production/src/main/java/com/aucma/production/service/impl/BaseBomInfoServiceImpl.java +++ b/aucma-production/src/main/java/com/aucma/production/service/impl/BaseBomInfoServiceImpl.java @@ -3,6 +3,7 @@ package com.aucma.production.service.impl; import java.util.List; import com.aucma.common.core.domain.entity.SysDept; +import com.aucma.common.exception.base.BaseException; import com.aucma.common.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -55,11 +56,15 @@ public class BaseBomInfoServiceImpl implements IBaseBomInfoService @Override public int insertBaseBomInfo(BaseBomInfo baseBomInfo) { - BaseBomInfo info = baseBomInfoMapper.selectBaseBomInfoByMaterialCode(baseBomInfo.getParentId()); - if (StringUtils.isNull(info)){ - baseBomInfo.setAncestors(baseBomInfo.getMaterialCode()); - }else { + BaseBomInfo bomInfo = baseBomInfoMapper.selectBaseBomInfoByMaterialCode(baseBomInfo.getMaterialCode()); + if (StringUtils.isNotNull(bomInfo)){ + throw new BaseException("该物料编号:" + baseBomInfo.getMaterialCode() + "已存在!"); + } + if (StringUtils.isNotNull(baseBomInfo.getParentId())){ + BaseBomInfo info = baseBomInfoMapper.selectBaseBomInfoByMaterialCode(baseBomInfo.getParentId()); baseBomInfo.setAncestors(info.getAncestors() + "," + baseBomInfo.getMaterialCode()); + }else { + baseBomInfo.setAncestors(baseBomInfo.getMaterialCode()); } return baseBomInfoMapper.insertBaseBomInfo(baseBomInfo); } diff --git a/aucma-production/src/main/resources/mapper/production/BaseBomInfoMapper.xml b/aucma-production/src/main/resources/mapper/production/BaseBomInfoMapper.xml index 0c2a257..dca10e3 100644 --- a/aucma-production/src/main/resources/mapper/production/BaseBomInfoMapper.xml +++ b/aucma-production/src/main/resources/mapper/production/BaseBomInfoMapper.xml @@ -14,46 +14,67 @@ + + - select obj_id, bom_code, material_code, material_name, material_type, standard_amount, parent_id, - plant_code, product_line_code, is_flag, created_by, created_time, updated_by, updated_time, ancestors from base_bominfo + select bb.obj_id, + bb.bom_code, + bb.material_code, + bb.material_name, + bb.material_type, + bb.standard_amount, + bb.parent_id, + bb.plant_code, + bb.product_line_code, + bb.is_flag, + bb.created_by, + bb.created_time, + bb.updated_by, + bb.updated_time, + bb.ancestors, + bf.factory_name, + bpl.PRODUCT_LINE_NAME + from base_bominfo bb + left join base_factory bf on bf.factory_code = plant_code + left join BASE_PRODUCTLINE bpl on bpl.PRODUCT_LINE_CODE = bb.product_line_code