change - add生产BOM

main
yinq 7 months ago
parent 9b0c7b7636
commit 208f07eeb9

@ -0,0 +1,100 @@
package com.os.ems.record.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.os.common.annotation.Log;
import com.os.common.core.controller.BaseController;
import com.os.common.core.domain.AjaxResult;
import com.os.common.enums.BusinessType;
import com.os.ems.record.domain.EmsRecordDnbInstant;
import com.os.ems.record.service.IEmsRecordDnbInstantService;
import com.os.common.utils.poi.ExcelUtil;
import com.os.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yinq
* @date 2024-05-11
*/
@RestController
@RequestMapping("/ems/record/recordDnbInstant")
public class EmsRecordDnbInstantController extends BaseController {
@Autowired
private IEmsRecordDnbInstantService emsRecordDnbInstantService;
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordDnbInstant:list')")
@GetMapping("/list")
public TableDataInfo list(EmsRecordDnbInstant emsRecordDnbInstant) {
startPage();
List<EmsRecordDnbInstant> list = emsRecordDnbInstantService.selectEmsRecordDnbInstantList(emsRecordDnbInstant);
return getDataTable(list);
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordDnbInstant:export')")
@Log(title = "电实时数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, EmsRecordDnbInstant emsRecordDnbInstant) {
List<EmsRecordDnbInstant> list = emsRecordDnbInstantService.selectEmsRecordDnbInstantList(emsRecordDnbInstant);
ExcelUtil<EmsRecordDnbInstant> util = new ExcelUtil<EmsRecordDnbInstant>(EmsRecordDnbInstant.class);
util.exportExcel(response, list, "电实时数据数据");
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordDnbInstant:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
return success(emsRecordDnbInstantService.selectEmsRecordDnbInstantByObjId(objId));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordDnbInstant:add')")
@Log(title = "电实时数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody EmsRecordDnbInstant emsRecordDnbInstant) {
emsRecordDnbInstant.setCreateBy(getUsername());
return toAjax(emsRecordDnbInstantService.insertEmsRecordDnbInstant(emsRecordDnbInstant));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordDnbInstant:edit')")
@Log(title = "电实时数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody EmsRecordDnbInstant emsRecordDnbInstant) {
emsRecordDnbInstant.setUpdateBy(getUsername());
return toAjax(emsRecordDnbInstantService.updateEmsRecordDnbInstant(emsRecordDnbInstant));
}
/**
*
*/
@PreAuthorize("@ss.hasPermi('ems/record:recordDnbInstant:remove')")
@Log(title = "电实时数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(emsRecordDnbInstantService.deleteEmsRecordDnbInstantByObjIds(objIds));
}
}

@ -0,0 +1,251 @@
package com.os.ems.record.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.os.common.annotation.Excel;
import com.os.common.core.domain.BaseEntity;
/**
* ems_record_dnb_instant
*
* @author Yinq
* @date 2024-05-11
*/
public class EmsRecordDnbInstant extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
*
*/
@Excel(name = "计量设备编号")
private String monitorId;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "采集时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date collectTime;
/**
* A
*/
@Excel(name = "A项电压")
private Long vA;
/**
* B
*/
@Excel(name = "B项电压")
private Long vB;
/**
* C
*/
@Excel(name = "C项电压")
private Long vC;
/**
* A
*/
@Excel(name = "A项电流")
private Long iA;
/**
* B
*/
@Excel(name = "B项电流")
private Long iB;
/**
* C
*/
@Excel(name = "C项电流")
private Long iC;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "记录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date recordTime;
/**
*
*/
@Excel(name = "功率因数")
private Long glys;
/**
*
*/
@Excel(name = "正向有功")
private Long zxyg;
/**
*
*/
@Excel(name = "有功功率")
private Long activePower;
/**
*
*/
@Excel(name = "无功功率")
private Long reactivePower;
/**
* 0 1
*/
@Excel(name = "采集方式", readConverterExp = "0=自动,1=手动")
private Long collectType;
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setMonitorId(String monitorId) {
this.monitorId = monitorId;
}
public String getMonitorId() {
return monitorId;
}
public void setCollectTime(Date collectTime) {
this.collectTime = collectTime;
}
public Date getCollectTime() {
return collectTime;
}
public void setVA(Long vA) {
this.vA = vA;
}
public Long getVA() {
return vA;
}
public void setVB(Long vB) {
this.vB = vB;
}
public Long getVB() {
return vB;
}
public void setVC(Long vC) {
this.vC = vC;
}
public Long getVC() {
return vC;
}
public void setIA(Long iA) {
this.iA = iA;
}
public Long getIA() {
return iA;
}
public void setIB(Long iB) {
this.iB = iB;
}
public Long getIB() {
return iB;
}
public void setIC(Long iC) {
this.iC = iC;
}
public Long getIC() {
return iC;
}
public void setRecordTime(Date recordTime) {
this.recordTime = recordTime;
}
public Date getRecordTime() {
return recordTime;
}
public void setGlys(Long glys) {
this.glys = glys;
}
public Long getGlys() {
return glys;
}
public void setZxyg(Long zxyg) {
this.zxyg = zxyg;
}
public Long getZxyg() {
return zxyg;
}
public void setActivePower(Long activePower) {
this.activePower = activePower;
}
public Long getActivePower() {
return activePower;
}
public void setReactivePower(Long reactivePower) {
this.reactivePower = reactivePower;
}
public Long getReactivePower() {
return reactivePower;
}
public void setCollectType(Long collectType) {
this.collectType = collectType;
}
public Long getCollectType() {
return collectType;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("monitorId", getMonitorId())
.append("collectTime", getCollectTime())
.append("vA", getVA())
.append("vB", getVB())
.append("vC", getVC())
.append("iA", getIA())
.append("iB", getIB())
.append("iC", getIC())
.append("recordTime", getRecordTime())
.append("glys", getGlys())
.append("zxyg", getZxyg())
.append("activePower", getActivePower())
.append("reactivePower", getReactivePower())
.append("collectType", getCollectType())
.toString();
}
}

@ -0,0 +1,61 @@
package com.os.ems.record.mapper;
import java.util.List;
import com.os.ems.record.domain.EmsRecordDnbInstant;
/**
* Mapper
*
* @author Yinq
* @date 2024-05-11
*/
public interface EmsRecordDnbInstantMapper
{
/**
*
*
* @param objId
* @return
*/
public EmsRecordDnbInstant selectEmsRecordDnbInstantByObjId(Long objId);
/**
*
*
* @param emsRecordDnbInstant
* @return
*/
public List<EmsRecordDnbInstant> selectEmsRecordDnbInstantList(EmsRecordDnbInstant emsRecordDnbInstant);
/**
*
*
* @param emsRecordDnbInstant
* @return
*/
public int insertEmsRecordDnbInstant(EmsRecordDnbInstant emsRecordDnbInstant);
/**
*
*
* @param emsRecordDnbInstant
* @return
*/
public int updateEmsRecordDnbInstant(EmsRecordDnbInstant emsRecordDnbInstant);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsRecordDnbInstantByObjId(Long objId);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsRecordDnbInstantByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.os.ems.record.service;
import java.util.List;
import com.os.ems.record.domain.EmsRecordDnbInstant;
/**
* Service
*
* @author Yinq
* @date 2024-05-11
*/
public interface IEmsRecordDnbInstantService {
/**
*
*
* @param objId
* @return
*/
public EmsRecordDnbInstant selectEmsRecordDnbInstantByObjId(Long objId);
/**
*
*
* @param emsRecordDnbInstant
* @return
*/
public List<EmsRecordDnbInstant> selectEmsRecordDnbInstantList(EmsRecordDnbInstant emsRecordDnbInstant);
/**
*
*
* @param emsRecordDnbInstant
* @return
*/
public int insertEmsRecordDnbInstant(EmsRecordDnbInstant emsRecordDnbInstant);
/**
*
*
* @param emsRecordDnbInstant
* @return
*/
public int updateEmsRecordDnbInstant(EmsRecordDnbInstant emsRecordDnbInstant);
/**
*
*
* @param objIds
* @return
*/
public int deleteEmsRecordDnbInstantByObjIds(Long[] objIds);
/**
*
*
* @param objId
* @return
*/
public int deleteEmsRecordDnbInstantByObjId(Long objId);
}

@ -0,0 +1,87 @@
package com.os.ems.record.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.os.ems.record.mapper.EmsRecordDnbInstantMapper;
import com.os.ems.record.domain.EmsRecordDnbInstant;
import com.os.ems.record.service.IEmsRecordDnbInstantService;
/**
* Service
*
* @author Yinq
* @date 2024-05-11
*/
@Service
public class EmsRecordDnbInstantServiceImpl implements IEmsRecordDnbInstantService {
@Autowired
private EmsRecordDnbInstantMapper emsRecordDnbInstantMapper;
/**
*
*
* @param objId
* @return
*/
@Override
public EmsRecordDnbInstant selectEmsRecordDnbInstantByObjId(Long objId) {
return emsRecordDnbInstantMapper.selectEmsRecordDnbInstantByObjId(objId);
}
/**
*
*
* @param emsRecordDnbInstant
* @return
*/
@Override
public List<EmsRecordDnbInstant> selectEmsRecordDnbInstantList(EmsRecordDnbInstant emsRecordDnbInstant) {
return emsRecordDnbInstantMapper.selectEmsRecordDnbInstantList(emsRecordDnbInstant);
}
/**
*
*
* @param emsRecordDnbInstant
* @return
*/
@Override
public int insertEmsRecordDnbInstant(EmsRecordDnbInstant emsRecordDnbInstant) {
return emsRecordDnbInstantMapper.insertEmsRecordDnbInstant(emsRecordDnbInstant);
}
/**
*
*
* @param emsRecordDnbInstant
* @return
*/
@Override
public int updateEmsRecordDnbInstant(EmsRecordDnbInstant emsRecordDnbInstant) {
return emsRecordDnbInstantMapper.updateEmsRecordDnbInstant(emsRecordDnbInstant);
}
/**
*
*
* @param objIds
* @return
*/
@Override
public int deleteEmsRecordDnbInstantByObjIds(Long[] objIds) {
return emsRecordDnbInstantMapper.deleteEmsRecordDnbInstantByObjIds(objIds);
}
/**
*
*
* @param objId
* @return
*/
@Override
public int deleteEmsRecordDnbInstantByObjId(Long objId) {
return emsRecordDnbInstantMapper.deleteEmsRecordDnbInstantByObjId(objId);
}
}

@ -7,7 +7,7 @@
<resultMap type="EmsBaseMonitorWorkUnit" id="EmsBaseMonitorWorkUnitResult">
<result property="objId" column="obj_id"/>
<result property="monitorCode" column="monitor_code"/>
<result property="monitorName" column="monitor_code"/>
<result property="monitorName" column="monitor_name"/>
<result property="workUnitCode" column="work_unit_code"/>
<result property="workUnitName" column="work_unit_name"/>
<result property="monitorStatus" column="monitor_status"/>

@ -0,0 +1,140 @@
<?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.os.ems.record.mapper.EmsRecordDnbInstantMapper">
<resultMap type="EmsRecordDnbInstant" id="EmsRecordDnbInstantResult">
<result property="objId" column="obj_id"/>
<result property="monitorId" column="monitor_id"/>
<result property="collectTime" column="collect_time"/>
<result property="vA" column="v_a"/>
<result property="vB" column="v_b"/>
<result property="vC" column="v_c"/>
<result property="iA" column="i_a"/>
<result property="iB" column="i_b"/>
<result property="iC" column="i_c"/>
<result property="recordTime" column="record_time"/>
<result property="glys" column="glys"/>
<result property="zxyg" column="zxyg"/>
<result property="activePower" column="active_power"/>
<result property="reactivePower" column="reactive_power"/>
<result property="collectType" column="collect_type"/>
</resultMap>
<sql id="selectEmsRecordDnbInstantVo">
select obj_id,
monitor_id,
collect_time,
v_a,
v_b,
v_c,
i_a,
i_b,
i_c,
record_time,
glys,
zxyg,
active_power,
reactive_power,
collect_type
from ems_record_dnb_instant
</sql>
<select id="selectEmsRecordDnbInstantList" parameterType="EmsRecordDnbInstant"
resultMap="EmsRecordDnbInstantResult">
<include refid="selectEmsRecordDnbInstantVo"/>
<where>
<if test="monitorId != null and monitorId != ''">and monitor_id = #{monitorId}</if>
<if test="collectTime != null ">and collect_time = #{collectTime}</if>
<if test="vA != null ">and v_a = #{vA}</if>
<if test="vB != null ">and v_b = #{vB}</if>
<if test="vC != null ">and v_c = #{vC}</if>
<if test="iA != null ">and i_a = #{iA}</if>
<if test="iB != null ">and i_b = #{iB}</if>
<if test="iC != null ">and i_c = #{iC}</if>
<if test="recordTime != null ">and record_time = #{recordTime}</if>
<if test="glys != null ">and glys = #{glys}</if>
<if test="zxyg != null ">and zxyg = #{zxyg}</if>
<if test="activePower != null ">and active_power = #{activePower}</if>
<if test="reactivePower != null ">and reactive_power = #{reactivePower}</if>
<if test="collectType != null ">and collect_type = #{collectType}</if>
</where>
</select>
<select id="selectEmsRecordDnbInstantByObjId" parameterType="Long" resultMap="EmsRecordDnbInstantResult">
<include refid="selectEmsRecordDnbInstantVo"/>
where obj_id = #{objId}
</select>
<insert id="insertEmsRecordDnbInstant" parameterType="EmsRecordDnbInstant" useGeneratedKeys="true"
keyProperty="objId">
insert into ems_record_dnb_instant
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="monitorId != null">monitor_id,</if>
<if test="collectTime != null">collect_time,</if>
<if test="vA != null">v_a,</if>
<if test="vB != null">v_b,</if>
<if test="vC != null">v_c,</if>
<if test="iA != null">i_a,</if>
<if test="iB != null">i_b,</if>
<if test="iC != null">i_c,</if>
<if test="recordTime != null">record_time,</if>
<if test="glys != null">glys,</if>
<if test="zxyg != null">zxyg,</if>
<if test="activePower != null">active_power,</if>
<if test="reactivePower != null">reactive_power,</if>
<if test="collectType != null">collect_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="monitorId != null">#{monitorId},</if>
<if test="collectTime != null">#{collectTime},</if>
<if test="vA != null">#{vA},</if>
<if test="vB != null">#{vB},</if>
<if test="vC != null">#{vC},</if>
<if test="iA != null">#{iA},</if>
<if test="iB != null">#{iB},</if>
<if test="iC != null">#{iC},</if>
<if test="recordTime != null">#{recordTime},</if>
<if test="glys != null">#{glys},</if>
<if test="zxyg != null">#{zxyg},</if>
<if test="activePower != null">#{activePower},</if>
<if test="reactivePower != null">#{reactivePower},</if>
<if test="collectType != null">#{collectType},</if>
</trim>
</insert>
<update id="updateEmsRecordDnbInstant" parameterType="EmsRecordDnbInstant">
update ems_record_dnb_instant
<trim prefix="SET" suffixOverrides=",">
<if test="monitorId != null">monitor_id = #{monitorId},</if>
<if test="collectTime != null">collect_time = #{collectTime},</if>
<if test="vA != null">v_a = #{vA},</if>
<if test="vB != null">v_b = #{vB},</if>
<if test="vC != null">v_c = #{vC},</if>
<if test="iA != null">i_a = #{iA},</if>
<if test="iB != null">i_b = #{iB},</if>
<if test="iC != null">i_c = #{iC},</if>
<if test="recordTime != null">record_time = #{recordTime},</if>
<if test="glys != null">glys = #{glys},</if>
<if test="zxyg != null">zxyg = #{zxyg},</if>
<if test="activePower != null">active_power = #{activePower},</if>
<if test="reactivePower != null">reactive_power = #{reactivePower},</if>
<if test="collectType != null">collect_type = #{collectType},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteEmsRecordDnbInstantByObjId" parameterType="Long">
delete
from ems_record_dnb_instant
where obj_id = #{objId}
</delete>
<delete id="deleteEmsRecordDnbInstantByObjIds" parameterType="String">
delete from ems_record_dnb_instant where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>

@ -76,6 +76,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and datediff(d, create_time, #{params.endTime}) <![CDATA[>=]]> 0
</if>
</where>
order by create_time desc
</select>
<select id="selectDbTableList" parameterType="GenTable" resultMap="GenTableResult">

@ -54,7 +54,7 @@ public class BaseMaterialInfo extends BaseEntity {
private String materialType;
/**
*
* 1 2
*/
@Excel(name = "计量单位")
private String materialUnit;
@ -78,11 +78,17 @@ public class BaseMaterialInfo extends BaseEntity {
private String factoryCode;
/**
*
*
*/
@Excel(name = "所属工位")
@Excel(name = "工位编号")
private String productLineCode;
/**
*
*/
@Excel(name = "生产工位")
private String productLineName;
/**
*
*/
@ -108,6 +114,14 @@ public class BaseMaterialInfo extends BaseEntity {
@Excel(name = "商品名称")
private String productName;
public String getProductLineName() {
return productLineName;
}
public void setProductLineName(String productLineName) {
this.productLineName = productLineName;
}
public void setObjId(Long objId) {
this.objId = objId;
}

@ -0,0 +1,109 @@
package com.os.mes.prod.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
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.os.common.annotation.Log;
import com.os.common.core.controller.BaseController;
import com.os.common.core.domain.AjaxResult;
import com.os.common.enums.BusinessType;
import com.os.mes.prod.domain.ProdBomInfo;
import com.os.mes.prod.service.IProdBomInfoService;
import com.os.common.utils.poi.ExcelUtil;
import com.os.common.core.page.TableDataInfo;
/**
* BOMController
*
* @author Yinq
* @date 2024-05-11
*/
@RestController
@RequestMapping("/mes/prod/prodBomInfo")
public class ProdBomInfoController extends BaseController {
@Autowired
private IProdBomInfoService prodBomInfoService;
/**
* BOM
*/
@PreAuthorize("@ss.hasPermi('mes/prod:prodBomInfo:list')")
@GetMapping("/list")
public TableDataInfo list(ProdBomInfo prodBomInfo) {
startPage();
List<ProdBomInfo> list = prodBomInfoService.selectProdBomInfoList(prodBomInfo);
return getDataTable(list);
}
/**
* BOM
*/
@GetMapping("/findOrderBomList")
public AjaxResult findOrderBomList(ProdBomInfo prodBomInfo) {
List<ProdBomInfo> list = prodBomInfoService.selectProdBomInfoList(prodBomInfo);
return success(list);
}
/**
* BOM
*/
@PreAuthorize("@ss.hasPermi('mes/prod:prodBomInfo:export')")
@Log(title = "生产BOM", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ProdBomInfo prodBomInfo) {
List<ProdBomInfo> list = prodBomInfoService.selectProdBomInfoList(prodBomInfo);
ExcelUtil<ProdBomInfo> util = new ExcelUtil<ProdBomInfo>(ProdBomInfo.class);
util.exportExcel(response, list, "生产BOM数据");
}
/**
* BOM
*/
@PreAuthorize("@ss.hasPermi('mes/prod:prodBomInfo:query')")
@GetMapping(value = "/{objId}")
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
return success(prodBomInfoService.selectProdBomInfoByObjId(objId));
}
/**
* BOM
*/
@PreAuthorize("@ss.hasPermi('mes/prod:prodBomInfo:add')")
@Log(title = "生产BOM", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ProdBomInfo prodBomInfo) {
prodBomInfo.setCreateBy(getUsername());
return toAjax(prodBomInfoService.insertProdBomInfo(prodBomInfo));
}
/**
* BOM
*/
@PreAuthorize("@ss.hasPermi('mes/prod:prodBomInfo:edit')")
@Log(title = "生产BOM", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ProdBomInfo prodBomInfo) {
prodBomInfo.setUpdateBy(getUsername());
return toAjax(prodBomInfoService.updateProdBomInfo(prodBomInfo));
}
/**
* BOM
*/
@PreAuthorize("@ss.hasPermi('mes/prod:prodBomInfo:remove')")
@Log(title = "生产BOM", businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}")
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(prodBomInfoService.deleteProdBomInfoByObjIds(objIds));
}
}

@ -0,0 +1,237 @@
package com.os.mes.prod.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.os.common.annotation.Excel;
import com.os.common.core.domain.BaseEntity;
/**
* BOM prod_bom_info
*
* @author Yinq
* @date 2024-05-11
*/
public class ProdBomInfo extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
* BOM
*/
@Excel(name = "BOM编号")
private String bomCode;
/**
*
*/
@Excel(name = "物料编码")
private String materialCode;
/**
*
*/
@Excel(name = "物料名称")
private String materialName;
/**
*
*/
@Excel(name = "物料类别")
private String materialType;
/**
*
*/
@Excel(name = "标准数量")
private BigDecimal standardAmount;
/**
* ID
*/
@Excel(name = "父物料ID")
private Long parentId;
/**
*
*/
@Excel(name = "父物料名称")
private String parentName;
/**
*
*/
@Excel(name = "工厂编号")
private String factoryCode;
/**
*
*/
@Excel(name = "排序")
private String sort;
/**
*
*/
@Excel(name = "销售凭证")
private String vbeln;
/**
*
*/
@Excel(name = "销售单据项目")
private String vbpos;
/**
*
*/
@Excel(name = "祖级列表")
private String ancestors;
/**
*
*/
@Excel(name = "是否标识")
private String isFlag;
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setBomCode(String bomCode) {
this.bomCode = bomCode;
}
public String getBomCode() {
return bomCode;
}
public void setMaterialCode(String materialCode) {
this.materialCode = materialCode;
}
public String getMaterialCode() {
return materialCode;
}
public void setMaterialName(String materialName) {
this.materialName = materialName;
}
public String getMaterialName() {
return materialName;
}
public void setMaterialType(String materialType) {
this.materialType = materialType;
}
public String getMaterialType() {
return materialType;
}
public void setStandardAmount(BigDecimal standardAmount) {
this.standardAmount = standardAmount;
}
public BigDecimal getStandardAmount() {
return standardAmount;
}
public void setParentId(Long parentId) {
this.parentId = parentId;
}
public Long getParentId() {
return parentId;
}
public void setParentName(String parentName) {
this.parentName = parentName;
}
public String getParentName() {
return parentName;
}
public void setFactoryCode(String factoryCode) {
this.factoryCode = factoryCode;
}
public String getFactoryCode() {
return factoryCode;
}
public void setSort(String sort) {
this.sort = sort;
}
public String getSort() {
return sort;
}
public void setVbeln(String vbeln) {
this.vbeln = vbeln;
}
public String getVbeln() {
return vbeln;
}
public void setVbpos(String vbpos) {
this.vbpos = vbpos;
}
public String getVbpos() {
return vbpos;
}
public void setAncestors(String ancestors) {
this.ancestors = ancestors;
}
public String getAncestors() {
return ancestors;
}
public void setIsFlag(String isFlag) {
this.isFlag = isFlag;
}
public String getIsFlag() {
return isFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("bomCode", getBomCode())
.append("materialCode", getMaterialCode())
.append("materialName", getMaterialName())
.append("materialType", getMaterialType())
.append("standardAmount", getStandardAmount())
.append("parentId", getParentId())
.append("parentName", getParentName())
.append("factoryCode", getFactoryCode())
.append("sort", getSort())
.append("vbeln", getVbeln())
.append("vbpos", getVbpos())
.append("ancestors", getAncestors())
.append("isFlag", getIsFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}

@ -0,0 +1,63 @@
package com.os.mes.prod.mapper;
import java.util.List;
import com.os.mes.prod.domain.ProdBomInfo;
import kotlin.jvm.Synchronized;
/**
* BOMMapper
*
* @author Yinq
* @date 2024-05-11
*/
public interface ProdBomInfoMapper
{
/**
* BOM
*
* @param objId BOM
* @return BOM
*/
public ProdBomInfo selectProdBomInfoByObjId(Long objId);
/**
* BOM
*
* @param prodBomInfo BOM
* @return BOM
*/
public List<ProdBomInfo> selectProdBomInfoList(ProdBomInfo prodBomInfo);
/**
* BOM
*
* @param prodBomInfo BOM
* @return
*/
public int insertProdBomInfo(ProdBomInfo prodBomInfo);
/**
* BOM
*
* @param prodBomInfo BOM
* @return
*/
@Synchronized
public int updateProdBomInfo(ProdBomInfo prodBomInfo);
/**
* BOM
*
* @param objId BOM
* @return
*/
public int deleteProdBomInfoByObjId(Long objId);
/**
* BOM
*
* @param objIds
* @return
*/
public int deleteProdBomInfoByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.os.mes.prod.service;
import java.util.List;
import com.os.mes.prod.domain.ProdBomInfo;
/**
* BOMService
*
* @author Yinq
* @date 2024-05-11
*/
public interface IProdBomInfoService {
/**
* BOM
*
* @param objId BOM
* @return BOM
*/
public ProdBomInfo selectProdBomInfoByObjId(Long objId);
/**
* BOM
*
* @param prodBomInfo BOM
* @return BOM
*/
public List<ProdBomInfo> selectProdBomInfoList(ProdBomInfo prodBomInfo);
/**
* BOM
*
* @param prodBomInfo BOM
* @return
*/
public int insertProdBomInfo(ProdBomInfo prodBomInfo);
/**
* BOM
*
* @param prodBomInfo BOM
* @return
*/
public int updateProdBomInfo(ProdBomInfo prodBomInfo);
/**
* BOM
*
* @param objIds BOM
* @return
*/
public int deleteProdBomInfoByObjIds(Long[] objIds);
/**
* BOM
*
* @param objId BOM
* @return
*/
public int deleteProdBomInfoByObjId(Long objId);
}

@ -0,0 +1,108 @@
package com.os.mes.prod.service.impl;
import java.util.List;
import com.os.common.exception.base.BaseException;
import com.os.common.utils.DateUtils;
import com.os.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.os.mes.prod.mapper.ProdBomInfoMapper;
import com.os.mes.prod.domain.ProdBomInfo;
import com.os.mes.prod.service.IProdBomInfoService;
/**
* BOMService
*
* @author Yinq
* @date 2024-05-11
*/
@Service
public class ProdBomInfoServiceImpl implements IProdBomInfoService {
@Autowired
private ProdBomInfoMapper prodBomInfoMapper;
/**
* BOM
*
* @param objId BOM
* @return BOM
*/
@Override
public ProdBomInfo selectProdBomInfoByObjId(Long objId) {
return prodBomInfoMapper.selectProdBomInfoByObjId(objId);
}
/**
* BOM
*
* @param prodBomInfo BOM
* @return BOM
*/
@Override
public List<ProdBomInfo> selectProdBomInfoList(ProdBomInfo prodBomInfo) {
return prodBomInfoMapper.selectProdBomInfoList(prodBomInfo);
}
/**
* BOM
*
* @param prodBomInfo BOM
* @return
*/
@Override
public int insertProdBomInfo(ProdBomInfo prodBomInfo) {
List<ProdBomInfo> baseBomInfos = prodBomInfoMapper.selectProdBomInfoList(prodBomInfo);
if (baseBomInfos.size() > 0) {
throw new BaseException("该物料编号:" + prodBomInfo.getMaterialCode() + "已存在!");
}
ProdBomInfo info = prodBomInfoMapper.selectProdBomInfoByObjId(prodBomInfo.getParentId());
if (StringUtils.isNull(info)) {
prodBomInfo.setAncestors(prodBomInfo.getParentId().toString());
} else {
prodBomInfo.setAncestors(info.getAncestors() + "," + prodBomInfo.getParentId());
}
prodBomInfo.setCreateTime(DateUtils.getNowDate());
return prodBomInfoMapper.insertProdBomInfo(prodBomInfo);
}
/**
* BOM
*
* @param prodBomInfo BOM
* @return
*/
@Override
public int updateProdBomInfo(ProdBomInfo prodBomInfo) {
prodBomInfo.setUpdateTime(DateUtils.getNowDate());
ProdBomInfo info = prodBomInfoMapper.selectProdBomInfoByObjId(prodBomInfo.getParentId());
if (StringUtils.isNull(info)) {
prodBomInfo.setAncestors(prodBomInfo.getParentId().toString());
} else {
prodBomInfo.setAncestors(info.getAncestors() + "," + prodBomInfo.getParentId());
}
return prodBomInfoMapper.updateProdBomInfo(prodBomInfo);
}
/**
* BOM
*
* @param objIds BOM
* @return
*/
@Override
public int deleteProdBomInfoByObjIds(Long[] objIds) {
return prodBomInfoMapper.deleteProdBomInfoByObjIds(objIds);
}
/**
* BOM
*
* @param objId BOM
* @return
*/
@Override
public int deleteProdBomInfoByObjId(Long objId) {
return prodBomInfoMapper.deleteProdBomInfoByObjId(objId);
}
}

@ -1,58 +1,91 @@
<?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">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.os.mes.base.mapper.BaseMaterialInfoMapper">
<resultMap type="BaseMaterialInfo" id="BaseMaterialInfoResult">
<result property="objId" column="obj_id" />
<result property="materialCode" column="material_code" />
<result property="materialName" column="material_name" />
<result property="materialCategories" column="material_categories" />
<result property="materialSubclass" column="material_subclass" />
<result property="materialType" column="material_type" />
<result property="materialUnit" column="material_unit" />
<result property="unitPrice" column="unit_price" />
<result property="materialSpecifications" column="material_specifications" />
<result property="factoryCode" column="factory_code" />
<result property="productLineCode" column="product_line_code" />
<result property="isFlag" column="is_flag" />
<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="incrementDate" column="increment_date" />
<result property="productCode" column="product_code" />
<result property="productName" column="product_name" />
<result property="objId" column="obj_id"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialCategories" column="material_categories"/>
<result property="materialSubclass" column="material_subclass"/>
<result property="materialType" column="material_type"/>
<result property="materialUnit" column="material_unit"/>
<result property="unitPrice" column="unit_price"/>
<result property="materialSpecifications" column="material_specifications"/>
<result property="factoryCode" column="factory_code"/>
<result property="productLineCode" column="product_line_code"/>
<result property="productLineName" column="product_line_name"/>
<result property="isFlag" column="is_flag"/>
<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="incrementDate" column="increment_date"/>
<result property="productCode" column="product_code"/>
<result property="productName" column="product_name"/>
</resultMap>
<sql id="selectBaseMaterialInfoVo">
select obj_id, material_code, material_name, material_categories, material_subclass, material_type, material_unit, unit_price, material_specifications, factory_code, product_line_code, is_flag, create_by, create_time, update_by, update_time, increment_date, product_code, product_name from base_material_info
select bmi.obj_id,
bmi.material_code,
bmi.material_name,
bmi.material_categories,
bmi.material_subclass,
bmi.material_type,
bmi.material_unit,
bmi.unit_price,
bmi.material_specifications,
bmi.factory_code,
bmi.product_line_code,
pbl.product_line_name,
bmi.is_flag,
bmi.create_by,
bmi.create_time,
bmi.update_by,
bmi.update_time,
bmi.increment_date,
bmi.product_code,
bmi.product_name
from base_material_info bmi
left join base_product_line pbl on pbl.product_line_code = bmi.product_line_code
</sql>
<select id="selectBaseMaterialInfoList" parameterType="BaseMaterialInfo" resultMap="BaseMaterialInfoResult">
<include refid="selectBaseMaterialInfoVo"/>
<where>
<if test="materialCode != null and materialCode != ''"> and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''"> and material_name like concat('%', #{materialName}, '%')</if>
<if test="materialCategories != null and materialCategories != ''"> and material_categories = #{materialCategories}</if>
<if test="materialSubclass != null and materialSubclass != ''"> and material_subclass = #{materialSubclass}</if>
<if test="materialType != null and materialType != ''"> and material_type = #{materialType}</if>
<if test="materialUnit != null and materialUnit != ''"> and material_unit = #{materialUnit}</if>
<if test="unitPrice != null "> and unit_price = #{unitPrice}</if>
<if test="materialSpecifications != null and materialSpecifications != ''"> and material_specifications = #{materialSpecifications}</if>
<if test="factoryCode != null and factoryCode != ''"> and factory_code = #{factoryCode}</if>
<if test="productLineCode != null and productLineCode != ''"> and product_line_code = #{productLineCode}</if>
<if test="isFlag != null and isFlag != ''"> and is_flag = #{isFlag}</if>
<if test="incrementDate != null "> and increment_date = #{incrementDate}</if>
<if test="productCode != null and productCode != ''"> and product_code = #{productCode}</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="materialCode != null and materialCode != ''">and bmi.material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''">and bmi.material_name like concat('%', #{materialName},
'%')
</if>
<if test="materialCategories != null and materialCategories != ''">and bmi.material_categories =
#{materialCategories}
</if>
<if test="materialSubclass != null and materialSubclass != ''">and bmi.material_subclass =
#{materialSubclass}
</if>
<if test="materialType != null and materialType != ''">and bmi.material_type = #{materialType}</if>
<if test="materialUnit != null and materialUnit != ''">and bmi.material_unit = #{materialUnit}</if>
<if test="unitPrice != null ">and bmi.unit_price = #{unitPrice}</if>
<if test="materialSpecifications != null and materialSpecifications != ''">and bmi.material_specifications =
#{materialSpecifications}
</if>
<if test="factoryCode != null and factoryCode != ''">and bmi.factory_code = #{factoryCode}</if>
<if test="productLineCode != null and productLineCode != ''">and bmi.product_line_code = #{productLineCode}
</if>
<if test="isFlag != null and isFlag != ''">and bmi.is_flag = #{isFlag}</if>
<if test="incrementDate != null ">and bmi.increment_date = #{incrementDate}</if>
<if test="productCode != null and productCode != ''">and bmi.product_code = #{productCode}</if>
<if test="productName != null and productName != ''">and bmi.product_name like concat('%', #{productName},
'%')
</if>
</where>
</select>
<select id="selectBaseMaterialInfoByObjId" parameterType="Long" resultMap="BaseMaterialInfoResult">
<include refid="selectBaseMaterialInfoVo"/>
where obj_id = #{objId}
where bmi.obj_id = #{objId}
</select>
<insert id="insertBaseMaterialInfo" parameterType="BaseMaterialInfo" useGeneratedKeys="true" keyProperty="objId">
@ -76,7 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="incrementDate != null">increment_date,</if>
<if test="productCode != null">product_code,</if>
<if test="productName != null">product_name,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
@ -96,7 +129,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="incrementDate != null">#{incrementDate},</if>
<if test="productCode != null">#{productCode},</if>
<if test="productName != null">#{productName},</if>
</trim>
</trim>
</insert>
<update id="updateBaseMaterialInfo" parameterType="BaseMaterialInfo">
@ -125,7 +158,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</update>
<delete id="deleteBaseMaterialInfoByObjId" parameterType="Long">
delete from base_material_info where obj_id = #{objId}
delete
from base_material_info
where obj_id = #{objId}
</delete>
<delete id="deleteBaseMaterialInfoByObjIds" parameterType="String">

@ -0,0 +1,159 @@
<?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.os.mes.prod.mapper.ProdBomInfoMapper">
<resultMap type="ProdBomInfo" id="ProdBomInfoResult">
<result property="objId" column="obj_id"/>
<result property="bomCode" column="bom_code"/>
<result property="materialCode" column="material_code"/>
<result property="materialName" column="material_name"/>
<result property="materialType" column="material_type"/>
<result property="standardAmount" column="standard_amount"/>
<result property="parentId" column="parent_id"/>
<result property="parentName" column="parent_name"/>
<result property="factoryCode" column="factory_code"/>
<result property="sort" column="sort"/>
<result property="vbeln" column="vbeln"/>
<result property="vbpos" column="vbpos"/>
<result property="ancestors" column="ancestors"/>
<result property="isFlag" column="is_flag"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<sql id="selectProdBomInfoVo">
select obj_id,
bom_code,
material_code,
material_name,
material_type,
standard_amount,
parent_id,
parent_name,
factory_code,
sort,
vbeln,
vbpos,
ancestors,
is_flag,
create_by,
create_time,
update_by,
update_time
from prod_bom_info
</sql>
<select id="selectProdBomInfoList" parameterType="ProdBomInfo" resultMap="ProdBomInfoResult">
<include refid="selectProdBomInfoVo"/>
<where>
<if test="bomCode != null and bomCode != ''">and bom_code = #{bomCode}</if>
<if test="materialCode != null and materialCode != ''">and material_code = #{materialCode}</if>
<if test="materialName != null and materialName != ''">and material_name like concat('%', #{materialName},
'%')
</if>
<if test="materialType != null and materialType != ''">and material_type = #{materialType}</if>
<if test="standardAmount != null ">and standard_amount = #{standardAmount}</if>
<if test="parentId != null and parentId != ''">and parent_id = #{parentId}</if>
<if test="parentName != null and parentName != ''">and parent_name like concat('%', #{parentName}, '%')
</if>
<if test="factoryCode != null and factoryCode != ''">and factory_code = #{factoryCode}</if>
<if test="sort != null and sort != ''">and sort = #{sort}</if>
<if test="vbeln != null and vbeln != ''">and vbeln = #{vbeln}</if>
<if test="vbpos != null and vbpos != ''">and vbpos = #{vbpos}</if>
<if test="ancestors != null and ancestors != ''">and ancestors = #{ancestors}</if>
<if test="isFlag != null and isFlag != ''">and is_flag = #{isFlag}</if>
<if test="createBy != null and createBy != ''">and create_by = #{createBy}</if>
<if test="createTime != null ">and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''">and update_by = #{updateBy}</if>
<if test="updateTime != null ">and update_time = #{updateTime}</if>
</where>
</select>
<select id="selectProdBomInfoByObjId" parameterType="Long" resultMap="ProdBomInfoResult">
<include refid="selectProdBomInfoVo"/>
where obj_id = #{objId}
</select>
<insert id="insertProdBomInfo" parameterType="ProdBomInfo" useGeneratedKeys="true" keyProperty="objId">
insert into prod_bom_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="bomCode != null">bom_code,</if>
<if test="materialCode != null and materialCode != ''">material_code,</if>
<if test="materialName != null">material_name,</if>
<if test="materialType != null">material_type,</if>
<if test="standardAmount != null">standard_amount,</if>
<if test="parentId != null">parent_id,</if>
<if test="parentName != null">parent_name,</if>
<if test="factoryCode != null">factory_code,</if>
<if test="sort != null">sort,</if>
<if test="vbeln != null">vbeln,</if>
<if test="vbpos != null">vbpos,</if>
<if test="ancestors != null">ancestors,</if>
<if test="isFlag != null">is_flag,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="bomCode != null">#{bomCode},</if>
<if test="materialCode != null and materialCode != ''">#{materialCode},</if>
<if test="materialName != null">#{materialName},</if>
<if test="materialType != null">#{materialType},</if>
<if test="standardAmount != null">#{standardAmount},</if>
<if test="parentId != null">#{parentId},</if>
<if test="parentName != null">#{parentName},</if>
<if test="factoryCode != null">#{factoryCode},</if>
<if test="sort != null">#{sort},</if>
<if test="vbeln != null">#{vbeln},</if>
<if test="vbpos != null">#{vbpos},</if>
<if test="ancestors != null">#{ancestors},</if>
<if test="isFlag != null">#{isFlag},</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>
</trim>
</insert>
<update id="updateProdBomInfo" parameterType="ProdBomInfo">
update prod_bom_info
<trim prefix="SET" suffixOverrides=",">
<if test="bomCode != null">bom_code = #{bomCode},</if>
<if test="materialCode != null and materialCode != ''">material_code = #{materialCode},</if>
<if test="materialName != null">material_name = #{materialName},</if>
<if test="materialType != null">material_type = #{materialType},</if>
<if test="standardAmount != null">standard_amount = #{standardAmount},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="parentName != null">parent_name = #{parentName},</if>
<if test="factoryCode != null">factory_code = #{factoryCode},</if>
<if test="sort != null">sort = #{sort},</if>
<if test="vbeln != null">vbeln = #{vbeln},</if>
<if test="vbpos != null">vbpos = #{vbpos},</if>
<if test="ancestors != null">ancestors = #{ancestors},</if>
<if test="isFlag != null">is_flag = #{isFlag},</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>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteProdBomInfoByObjId" parameterType="Long">
delete
from prod_bom_info
where obj_id = #{objId}
</delete>
<delete id="deleteProdBomInfoByObjIds" parameterType="String">
delete from prod_bom_info where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save