From 39f67f504e62f7e005ec81ce38b7b2c1a29a9d03 Mon Sep 17 00:00:00 2001 From: "JinLu.Yin" <411641505@qq.com> Date: Mon, 9 May 2022 21:46:54 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99BOM=E6=B7=BB=E5=8A=A0itemOrPr?= =?UTF-8?q?oduct=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../md/controller/MdProductBomController.java | 30 +++++++++++-------- .../com/ktg/mes/md/domain/MdProductBom.java | 29 +++++++++++------- .../ktg/mes/md/mapper/MdProductBomMapper.java | 13 ++------ .../mes/md/service/IMdProductBomService.java | 12 ++------ .../service/impl/MdProductBomServiceImpl.java | 19 ++---------- .../mapper/md/MdProductBomMapper.xml | 18 +++++------ 6 files changed, 49 insertions(+), 72 deletions(-) diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductBomController.java b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductBomController.java index 442dca8..158e28f 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductBomController.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/controller/MdProductBomController.java @@ -1,26 +1,33 @@ package com.ktg.mes.md.controller; +import java.util.List; +import javax.servlet.http.HttpServletResponse; + import com.ktg.mes.md.service.IMdProductBomService; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import com.ktg.common.annotation.Log; -import com.ktg.common.constant.UserConstants; import com.ktg.common.core.controller.BaseController; import com.ktg.common.core.domain.AjaxResult; -import com.ktg.common.core.page.TableDataInfo; import com.ktg.common.enums.BusinessType; -import com.ktg.common.utils.poi.ExcelUtil; import com.ktg.mes.md.domain.MdProductBom; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.web.bind.annotation.*; - -import javax.servlet.http.HttpServletResponse; -import java.util.List; +import com.ktg.mes.md.service.IMdProductBomService; +import com.ktg.common.utils.poi.ExcelUtil; +import com.ktg.common.core.page.TableDataInfo; /** * 产品BOM关系Controller * * @author yinjinlu - * @date 2022-05-05 + * @date 2022-05-09 */ @RestController @RequestMapping("/mes/md/bom") @@ -72,9 +79,6 @@ public class MdProductBomController extends BaseController @PostMapping public AjaxResult add(@RequestBody MdProductBom mdProductBom) { - if(UserConstants.NOT_UNIQUE.equals(mdProductBomService.checkBomExist(mdProductBom))){ - return AjaxResult.error("物料"+mdProductBom.getBomItemCode()+"已存在!"); - } return toAjax(mdProductBomService.insertMdProductBom(mdProductBom)); } diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductBom.java b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductBom.java index d3ff8e9..e42098e 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductBom.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/domain/MdProductBom.java @@ -1,17 +1,16 @@ package com.ktg.mes.md.domain; -import com.ktg.common.annotation.Excel; -import com.ktg.common.core.domain.BaseEntity; +import java.math.BigDecimal; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; - -import java.math.BigDecimal; +import com.ktg.common.annotation.Excel; +import com.ktg.common.core.domain.BaseEntity; /** * 产品BOM关系对象 md_product_bom * * @author yinjinlu - * @date 2022-05-05 + * @date 2022-05-09 */ public class MdProductBom extends BaseEntity { @@ -40,12 +39,14 @@ public class MdProductBom extends BaseEntity @Excel(name = "BOM物料规格") private String bomItemSpec; - - /** BOM物料单位 */ @Excel(name = "BOM物料单位") private String unitOfMeasure; + /** 产品物料标识 */ + @Excel(name = "产品物料标识") + private String itemOrProduct; + /** 物料使用比例 */ @Excel(name = "物料使用比例") private BigDecimal quantity; @@ -55,19 +56,15 @@ public class MdProductBom extends BaseEntity private String enableFlag; /** 预留字段1 */ - @Excel(name = "预留字段1") private String attr1; /** 预留字段2 */ - @Excel(name = "预留字段2") private String attr2; /** 预留字段3 */ - @Excel(name = "预留字段3") private Long attr3; /** 预留字段4 */ - @Excel(name = "预留字段4") private Long attr4; public void setBomId(Long bomId) @@ -133,6 +130,15 @@ public class MdProductBom extends BaseEntity { return unitOfMeasure; } + public void setItemOrProduct(String itemOrProduct) + { + this.itemOrProduct = itemOrProduct; + } + + public String getItemOrProduct() + { + return itemOrProduct; + } public void setQuantity(BigDecimal quantity) { this.quantity = quantity; @@ -198,6 +204,7 @@ public class MdProductBom extends BaseEntity .append("bomItemName", getBomItemName()) .append("bomItemSpec", getBomItemSpec()) .append("unitOfMeasure", getUnitOfMeasure()) + .append("itemOrProduct", getItemOrProduct()) .append("quantity", getQuantity()) .append("enableFlag", getEnableFlag()) .append("remark", getRemark()) diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductBomMapper.java b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductBomMapper.java index 3e7b85d..bace5fb 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductBomMapper.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/mapper/MdProductBomMapper.java @@ -1,14 +1,13 @@ package com.ktg.mes.md.mapper; -import com.ktg.mes.md.domain.MdProductBom; - import java.util.List; +import com.ktg.mes.md.domain.MdProductBom; /** * 产品BOM关系Mapper接口 * * @author yinjinlu - * @date 2022-05-05 + * @date 2022-05-09 */ public interface MdProductBomMapper { @@ -28,14 +27,6 @@ public interface MdProductBomMapper */ public List selectMdProductBomList(MdProductBom mdProductBom); - - /** - * 检查物料BOM是否已经存在 - * @param mdProductBom - * @return - */ - public MdProductBom checkBomExist(MdProductBom mdProductBom); - /** * 新增产品BOM关系 * diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductBomService.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductBomService.java index 5c324de..e0eb80d 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductBomService.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/IMdProductBomService.java @@ -1,14 +1,13 @@ package com.ktg.mes.md.service; -import com.ktg.mes.md.domain.MdProductBom; - import java.util.List; +import com.ktg.mes.md.domain.MdProductBom; /** * 产品BOM关系Service接口 * * @author yinjinlu - * @date 2022-05-05 + * @date 2022-05-09 */ public interface IMdProductBomService { @@ -28,13 +27,6 @@ public interface IMdProductBomService */ public List selectMdProductBomList(MdProductBom mdProductBom); - /** - * 检查物料BOM是否已经存在 - * @param mdProductBom - * @return - */ - public String checkBomExist(MdProductBom mdProductBom); - /** * 新增产品BOM关系 * diff --git a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductBomServiceImpl.java b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductBomServiceImpl.java index c7b60cd..a8d8013 100644 --- a/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductBomServiceImpl.java +++ b/ktg-mes/src/main/java/com/ktg/mes/md/service/impl/MdProductBomServiceImpl.java @@ -1,24 +1,21 @@ package com.ktg.mes.md.service.impl; import java.util.List; - -import com.ktg.mes.md.service.IMdProductBomService; -import com.ktg.common.constant.UserConstants; import com.ktg.common.utils.DateUtils; -import com.ktg.common.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.ktg.mes.md.mapper.MdProductBomMapper; import com.ktg.mes.md.domain.MdProductBom; +import com.ktg.mes.md.service.IMdProductBomService; /** * 产品BOM关系Service业务层处理 * * @author yinjinlu - * @date 2022-05-05 + * @date 2022-05-09 */ @Service -public class MdProductBomServiceImpl implements IMdProductBomService +public class MdProductBomServiceImpl implements IMdProductBomService { @Autowired private MdProductBomMapper mdProductBomMapper; @@ -47,16 +44,6 @@ public class MdProductBomServiceImpl implements IMdProductBomService return mdProductBomMapper.selectMdProductBomList(mdProductBom); } - @Override - public String checkBomExist(MdProductBom mdProductBom) { - MdProductBom bom = mdProductBomMapper.checkBomExist(mdProductBom); - Long bomId = mdProductBom.getBomId()==null?-1L:mdProductBom.getBomId(); - if(StringUtils.isNotNull(bom) && bom.getBomId().longValue() != bomId.longValue()){ - return UserConstants.NOT_UNIQUE; - } - return UserConstants.UNIQUE; - } - /** * 新增产品BOM关系 * diff --git a/ktg-mes/src/main/resources/mapper/md/MdProductBomMapper.xml b/ktg-mes/src/main/resources/mapper/md/MdProductBomMapper.xml index 3a84fe0..d656b71 100644 --- a/ktg-mes/src/main/resources/mapper/md/MdProductBomMapper.xml +++ b/ktg-mes/src/main/resources/mapper/md/MdProductBomMapper.xml @@ -12,6 +12,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + @@ -26,7 +27,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select bom_id, item_id, bom_item_id, bom_item_code, bom_item_name, bom_item_spec, unit_of_measure, quantity, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_product_bom + select bom_id, item_id, bom_item_id, bom_item_code, bom_item_name, bom_item_spec, unit_of_measure, item_or_product, quantity, enable_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from md_product_bom @@ -51,12 +49,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where bom_id = #{bomId} - - - + insert into md_product_bom @@ -66,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bom_item_name, bom_item_spec, unit_of_measure, + item_or_product, quantity, enable_flag, remark, @@ -85,6 +79,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{bomItemName}, #{bomItemSpec}, #{unitOfMeasure}, + #{itemOrProduct}, #{quantity}, #{enableFlag}, #{remark}, @@ -108,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" bom_item_name = #{bomItemName}, bom_item_spec = #{bomItemSpec}, unit_of_measure = #{unitOfMeasure}, + item_or_product = #{itemOrProduct}, quantity = #{quantity}, enable_flag = #{enableFlag}, remark = #{remark},