基础信息后端BOM更改

highway
A0010407 1 year ago
parent a6acdae5c9
commit 4e176bc6ab

@ -0,0 +1,97 @@
package com.op.wms.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.op.common.log.annotation.Log;
import com.op.common.log.enums.BusinessType;
import com.op.common.security.annotation.RequiresPermissions;
import com.op.wms.domain.BaseBom;
import com.op.wms.service.IBaseBomService;
import com.op.common.core.web.controller.BaseController;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.core.utils.poi.ExcelUtil;
import com.op.common.core.web.page.TableDataInfo;
/**
* BOMController
*
* @author Open Platform
* @date 2023-08-02
*/
@RestController
@RequestMapping("/bom")
public class BaseBomController extends BaseController {
@Autowired
private IBaseBomService baseBomService;
/**
* BOM
*/
@RequiresPermissions("wms:bom:list")
@GetMapping("/list")
public TableDataInfo list(BaseBom baseBom) {
startPage();
List<BaseBom> list = baseBomService.selectBaseBomList(baseBom);
return getDataTable(list);
}
/**
* BOM
*/
@RequiresPermissions("wms:bom:export")
@Log(title = "BOM物料管理", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BaseBom baseBom) {
List<BaseBom> list = baseBomService.selectBaseBomList(baseBom);
ExcelUtil<BaseBom> util = new ExcelUtil<BaseBom>(BaseBom.class);
util.exportExcel(response, list, "BOM物料管理数据");
}
/**
* BOM
*/
@RequiresPermissions("wms:bom:query")
@GetMapping(value = "/{factoryCode}")
public AjaxResult getInfo(@PathVariable("factoryCode") String factoryCode) {
return success(baseBomService.selectBaseBomByFactoryCode(factoryCode));
}
/**
* BOM
*/
@RequiresPermissions("wms:bom:add")
@Log(title = "BOM物料管理", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BaseBom baseBom) {
return toAjax(baseBomService.insertBaseBom(baseBom));
}
/**
* BOM
*/
@RequiresPermissions("wms:bom:edit")
@Log(title = "BOM物料管理", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BaseBom baseBom) {
return toAjax(baseBomService.updateBaseBom(baseBom));
}
/**
* BOM
*/
@RequiresPermissions("wms:bom:remove")
@Log(title = "BOM物料管理", businessType = BusinessType.DELETE)
@DeleteMapping("/{factoryCodes}")
public AjaxResult remove(@PathVariable String[] factoryCodes) {
return toAjax(baseBomService.deleteBaseBomByFactoryCodes(factoryCodes));
}
}

@ -0,0 +1,261 @@
package com.op.wms.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.op.common.core.annotation.Excel;
import com.op.common.core.web.domain.BaseEntity;
/**
* BOM base_bom
*
* @author Open Platform
* @date 2023-08-02
*/
public class BaseBom extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 工厂 */
@Excel(name = "工厂")
private String factoryCode;
/** 生产版本 */
@Excel(name = "生产版本")
private String productionVersion;
/** BOM单号 */
@Excel(name = "BOM单号")
private String bomCode;
/** 可选BOM */
@Excel(name = "可选BOM")
private String optionalBom;
/** 可选BOM文本 */
@Excel(name = "可选BOM文本")
private String optionalBomText;
/** 生产版本有效期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产版本有效期", width = 30, dateFormat = "yyyy-MM-dd")
private Date pvvd;
/** 生产版本截止日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产版本截止日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date pved;
/** BOM计算数量 */
@Excel(name = "BOM计算数量")
private Long bomCalculateNumber;
/** BOM计算单位 */
@Excel(name = "BOM计算单位")
private String bomCalculateUnit;
/** BOM基本数量 */
@Excel(name = "BOM基本数量")
private Long bomBaseNumber;
/** BOM基本单位 */
@Excel(name = "BOM基本单位")
private String bomBaseUnit;
/** 组件数量单位 */
@Excel(name = "组件数量单位")
private String componentUnit;
/** 组件采购标志 */
@Excel(name = "组件采购标志")
private String componentProFlag;
/** 物料供应标识 */
@Excel(name = "物料供应标识")
private String msi;
/** 成本核算标识相关 */
@Excel(name = "成本核算标识相关")
private String sanka;
/** 预留字段1 */
@Excel(name = "预留字段1")
private String attr1;
/** 预留字段2 */
@Excel(name = "预留字段2")
private String attr2;
/** 预留字段3 */
@Excel(name = "预留字段3")
private String attr3;
/** 是否在用 */
@Excel(name = "是否在用")
private String currentVersion;
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setProductionVersion(String productionVersion) {
this.productionVersion = productionVersion;
}
public String getProductionVersion() {
return productionVersion;
}
public void setBomCode(String bomCode) {
this.bomCode = bomCode;
}
public String getBomCode() {
return bomCode;
}
public void setOptionalBom(String optionalBom) {
this.optionalBom = optionalBom;
}
public String getOptionalBom() {
return optionalBom;
}
public void setOptionalBomText(String optionalBomText) {
this.optionalBomText = optionalBomText;
}
public String getOptionalBomText() {
return optionalBomText;
}
public void setPvvd(Date pvvd) {
this.pvvd = pvvd;
}
public Date getPvvd() {
return pvvd;
}
public void setPved(Date pved) {
this.pved = pved;
}
public Date getPved() {
return pved;
}
public void setBomCalculateNumber(Long bomCalculateNumber) {
this.bomCalculateNumber = bomCalculateNumber;
}
public Long getBomCalculateNumber() {
return bomCalculateNumber;
}
public void setBomCalculateUnit(String bomCalculateUnit) {
this.bomCalculateUnit = bomCalculateUnit;
}
public String getBomCalculateUnit() {
return bomCalculateUnit;
}
public void setBomBaseNumber(Long bomBaseNumber) {
this.bomBaseNumber = bomBaseNumber;
}
public Long getBomBaseNumber() {
return bomBaseNumber;
}
public void setBomBaseUnit(String bomBaseUnit) {
this.bomBaseUnit = bomBaseUnit;
}
public String getBomBaseUnit() {
return bomBaseUnit;
}
public void setComponentUnit(String componentUnit) {
this.componentUnit = componentUnit;
}
public String getComponentUnit() {
return componentUnit;
}
public void setComponentProFlag(String componentProFlag) {
this.componentProFlag = componentProFlag;
}
public String getComponentProFlag() {
return componentProFlag;
}
public void setMsi(String msi) {
this.msi = msi;
}
public String getMsi() {
return msi;
}
public void setSanka(String sanka) {
this.sanka = sanka;
}
public String getSanka() {
return sanka;
}
public void setAttr1(String attr1) {
this.attr1 = attr1;
}
public String getAttr1() {
return attr1;
}
public void setAttr2(String attr2) {
this.attr2 = attr2;
}
public String getAttr2() {
return attr2;
}
public void setAttr3(String attr3) {
this.attr3 = attr3;
}
public String getAttr3() {
return attr3;
}
public void setCurrentVersion(String currentVersion) {
this.currentVersion = currentVersion;
}
public String getCurrentVersion() {
return currentVersion;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("factoryCode", getFactoryCode())
.append("productionVersion", getProductionVersion())
.append("bomCode", getBomCode())
.append("optionalBom", getOptionalBom())
.append("optionalBomText", getOptionalBomText())
.append("pvvd", getPvvd())
.append("pved", getPved())
.append("bomCalculateNumber", getBomCalculateNumber())
.append("bomCalculateUnit", getBomCalculateUnit())
.append("bomBaseNumber", getBomBaseNumber())
.append("bomBaseUnit", getBomBaseUnit())
.append("componentUnit", getComponentUnit())
.append("componentProFlag", getComponentProFlag())
.append("msi", getMsi())
.append("sanka", getSanka())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("currentVersion", getCurrentVersion())
.toString();
}
}

@ -0,0 +1,61 @@
package com.op.wms.mapper;
import java.util.List;
import com.op.wms.domain.BaseBom;
/**
* BOMMapper
*
* @author Open Platform
* @date 2023-08-02
*/
public interface BaseBomMapper {
/**
* BOM
*
* @param factoryCode BOM
* @return BOM
*/
public BaseBom selectBaseBomByFactoryCode(String factoryCode);
/**
* BOM
*
* @param baseBom BOM
* @return BOM
*/
public List<BaseBom> selectBaseBomList(BaseBom baseBom);
/**
* BOM
*
* @param baseBom BOM
* @return
*/
public int insertBaseBom(BaseBom baseBom);
/**
* BOM
*
* @param baseBom BOM
* @return
*/
public int updateBaseBom(BaseBom baseBom);
/**
* BOM
*
* @param factoryCode BOM
* @return
*/
public int deleteBaseBomByFactoryCode(String factoryCode);
/**
* BOM
*
* @param factoryCodes
* @return
*/
public int deleteBaseBomByFactoryCodes(String[] factoryCodes);
}

@ -0,0 +1,60 @@
package com.op.wms.service;
import java.util.List;
import com.op.wms.domain.BaseBom;
/**
* BOMService
*
* @author Open Platform
* @date 2023-08-02
*/
public interface IBaseBomService {
/**
* BOM
*
* @param factoryCode BOM
* @return BOM
*/
public BaseBom selectBaseBomByFactoryCode(String factoryCode);
/**
* BOM
*
* @param baseBom BOM
* @return BOM
*/
public List<BaseBom> selectBaseBomList(BaseBom baseBom);
/**
* BOM
*
* @param baseBom BOM
* @return
*/
public int insertBaseBom(BaseBom baseBom);
/**
* BOM
*
* @param baseBom BOM
* @return
*/
public int updateBaseBom(BaseBom baseBom);
/**
* BOM
*
* @param factoryCodes BOM
* @return
*/
public int deleteBaseBomByFactoryCodes(String[] factoryCodes);
/**
* BOM
*
* @param factoryCode BOM
* @return
*/
public int deleteBaseBomByFactoryCode(String factoryCode);
}

@ -0,0 +1,97 @@
package com.op.wms.service.impl;
import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.wms.mapper.BaseBomMapper;
import com.op.wms.domain.BaseBom;
import com.op.wms.service.IBaseBomService;
/**
* BOMService
*
* @author Open Platform
* @date 2023-08-02
*/
@Service
public class BaseBomServiceImpl implements IBaseBomService {
@Autowired
private BaseBomMapper baseBomMapper;
/**
* BOM
*
* @param factoryCode BOM
* @return BOM
*/
@Override
@DS("#header.poolName")
public BaseBom selectBaseBomByFactoryCode(String factoryCode) {
return baseBomMapper.selectBaseBomByFactoryCode(factoryCode);
}
/**
* BOM
*
* @param baseBom BOM
* @return BOM
*/
@Override
@DS("#header.poolName")
public List<BaseBom> selectBaseBomList(BaseBom baseBom) {
return baseBomMapper.selectBaseBomList(baseBom);
}
/**
* BOM
*
* @param baseBom BOM
* @return
*/
@Override
@DS("#header.poolName")
public int insertBaseBom(BaseBom baseBom) {
baseBom.setCreateTime(DateUtils.getNowDate());
return baseBomMapper.insertBaseBom(baseBom);
}
/**
* BOM
*
* @param baseBom BOM
* @return
*/
@Override
@DS("#header.poolName")
public int updateBaseBom(BaseBom baseBom) {
baseBom.setUpdateTime(DateUtils.getNowDate());
return baseBomMapper.updateBaseBom(baseBom);
}
/**
* BOM
*
* @param factoryCodes BOM
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseBomByFactoryCodes(String[] factoryCodes) {
return baseBomMapper.deleteBaseBomByFactoryCodes(factoryCodes);
}
/**
* BOM
*
* @param factoryCode BOM
* @return
*/
@Override
@DS("#header.poolName")
public int deleteBaseBomByFactoryCode(String factoryCode) {
return baseBomMapper.deleteBaseBomByFactoryCode(factoryCode);
}
}

@ -0,0 +1,164 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.op.wms.mapper.BaseBomMapper">
<resultMap type="BaseBom" id="BaseBomResult">
<result property="factoryCode" column="factory_code" />
<result property="productionVersion" column="production_version" />
<result property="bomCode" column="bom_code" />
<result property="optionalBom" column="optional_bom" />
<result property="optionalBomText" column="optional_bom_text" />
<result property="pvvd" column="pvvd" />
<result property="pved" column="pved" />
<result property="bomCalculateNumber" column="bom_calculate_number" />
<result property="bomCalculateUnit" column="bom_calculate_unit" />
<result property="bomBaseNumber" column="bom_base_number" />
<result property="bomBaseUnit" column="bom_base_unit" />
<result property="componentUnit" column="component_unit" />
<result property="componentProFlag" column="component_pro_flag" />
<result property="msi" column="msi" />
<result property="sanka" column="sanka" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="currentVersion" column="current_version" />
</resultMap>
<sql id="selectBaseBomVo">
select factory_code, production_version, bom_code, optional_bom, optional_bom_text, pvvd, pved, bom_calculate_number, bom_calculate_unit, bom_base_number, bom_base_unit, component_unit, component_pro_flag, msi, sanka, attr1, attr2, attr3, create_by, create_time, update_by, update_time, remark, current_version from base_bom
</sql>
<select id="selectBaseBomList" parameterType="BaseBom" resultMap="BaseBomResult">
<include refid="selectBaseBomVo"/>
<where>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="productionVersion != null and productionVersion != ''"> and production_version = #{productionVersion}</if>
<if test="bomCode != null and bomCode != ''"> and bom_code = #{bomCode}</if>
<if test="optionalBom != null and optionalBom != ''"> and optional_bom = #{optionalBom}</if>
<if test="optionalBomText != null and optionalBomText != ''"> and optional_bom_text = #{optionalBomText}</if>
<if test="pvvd != null "> and pvvd = #{pvvd}</if>
<if test="pved != null "> and pved = #{pved}</if>
<if test="bomCalculateNumber != null "> and bom_calculate_number = #{bomCalculateNumber}</if>
<if test="bomCalculateUnit != null and bomCalculateUnit != ''"> and bom_calculate_unit = #{bomCalculateUnit}</if>
<if test="bomBaseNumber != null "> and bom_base_number = #{bomBaseNumber}</if>
<if test="bomBaseUnit != null and bomBaseUnit != ''"> and bom_base_unit = #{bomBaseUnit}</if>
<if test="componentUnit != null and componentUnit != ''"> and component_unit = #{componentUnit}</if>
<if test="componentProFlag != null and componentProFlag != ''"> and component_pro_flag = #{componentProFlag}</if>
<if test="msi != null and msi != ''"> and msi = #{msi}</if>
<if test="sanka != null and sanka != ''"> and sanka = #{sanka}</if>
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
<if test="currentVersion != null and currentVersion != ''"> and current_version = #{currentVersion}</if>
</where>
</select>
<select id="selectBaseBomByFactoryCode" parameterType="String" resultMap="BaseBomResult">
<include refid="selectBaseBomVo"/>
where factory_code = #{factoryCode}
</select>
<insert id="insertBaseBom" parameterType="BaseBom">
insert into base_bom
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="factoryCode != null">factory_code,</if>
<if test="productionVersion != null">production_version,</if>
<if test="bomCode != null">bom_code,</if>
<if test="optionalBom != null">optional_bom,</if>
<if test="optionalBomText != null">optional_bom_text,</if>
<if test="pvvd != null">pvvd,</if>
<if test="pved != null">pved,</if>
<if test="bomCalculateNumber != null">bom_calculate_number,</if>
<if test="bomCalculateUnit != null">bom_calculate_unit,</if>
<if test="bomBaseNumber != null">bom_base_number,</if>
<if test="bomBaseUnit != null">bom_base_unit,</if>
<if test="componentUnit != null">component_unit,</if>
<if test="componentProFlag != null">component_pro_flag,</if>
<if test="msi != null">msi,</if>
<if test="sanka != null">sanka,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="currentVersion != null">current_version,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="factoryCode != null">#{factoryCode},</if>
<if test="productionVersion != null">#{productionVersion},</if>
<if test="bomCode != null">#{bomCode},</if>
<if test="optionalBom != null">#{optionalBom},</if>
<if test="optionalBomText != null">#{optionalBomText},</if>
<if test="pvvd != null">#{pvvd},</if>
<if test="pved != null">#{pved},</if>
<if test="bomCalculateNumber != null">#{bomCalculateNumber},</if>
<if test="bomCalculateUnit != null">#{bomCalculateUnit},</if>
<if test="bomBaseNumber != null">#{bomBaseNumber},</if>
<if test="bomBaseUnit != null">#{bomBaseUnit},</if>
<if test="componentUnit != null">#{componentUnit},</if>
<if test="componentProFlag != null">#{componentProFlag},</if>
<if test="msi != null">#{msi},</if>
<if test="sanka != null">#{sanka},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="currentVersion != null">#{currentVersion},</if>
</trim>
</insert>
<update id="updateBaseBom" parameterType="BaseBom">
update base_bom
<trim prefix="SET" suffixOverrides=",">
<if test="productionVersion != null">production_version = #{productionVersion},</if>
<if test="bomCode != null">bom_code = #{bomCode},</if>
<if test="optionalBom != null">optional_bom = #{optionalBom},</if>
<if test="optionalBomText != null">optional_bom_text = #{optionalBomText},</if>
<if test="pvvd != null">pvvd = #{pvvd},</if>
<if test="pved != null">pved = #{pved},</if>
<if test="bomCalculateNumber != null">bom_calculate_number = #{bomCalculateNumber},</if>
<if test="bomCalculateUnit != null">bom_calculate_unit = #{bomCalculateUnit},</if>
<if test="bomBaseNumber != null">bom_base_number = #{bomBaseNumber},</if>
<if test="bomBaseUnit != null">bom_base_unit = #{bomBaseUnit},</if>
<if test="componentUnit != null">component_unit = #{componentUnit},</if>
<if test="componentProFlag != null">component_pro_flag = #{componentProFlag},</if>
<if test="msi != null">msi = #{msi},</if>
<if test="sanka != null">sanka = #{sanka},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="currentVersion != null">current_version = #{currentVersion},</if>
</trim>
where factory_code = #{factoryCode}
</update>
<delete id="deleteBaseBomByFactoryCode" parameterType="String">
delete from base_bom where factory_code = #{factoryCode}
</delete>
<delete id="deleteBaseBomByFactoryCodes" parameterType="String">
delete from base_bom where factory_code in
<foreach item="factoryCode" collection="array" open="(" separator="," close=")">
#{factoryCode}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save