update - add质检工位/缺陷维护

master
yinq 10 months ago
parent 12570a5997
commit afff593346

@ -46,6 +46,17 @@ public class BaseQualityInspectionItemController extends BaseController {
return getDataTable(list);
}
/**
*
* @param baseQualityInspectionItem
* @return
*/
@GetMapping("/getDefectList" )
public AjaxResult getDefectList(BaseQualityInspectionItem baseQualityInspectionItem) {
List<BaseQualityInspectionItem> list = baseQualityInspectionItemService.selectBaseQualityInspectionItemList(baseQualityInspectionItem);
return success(list);
}
/**
*
*/

@ -0,0 +1,103 @@
package com.aucma.base.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.aucma.common.utils.DateUtils;
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.aucma.common.annotation.Log;
import com.aucma.common.core.controller.BaseController;
import com.aucma.common.core.domain.AjaxResult;
import com.aucma.common.enums.BusinessType;
import com.aucma.base.domain.StationDefectRelation;
import com.aucma.base.service.IStationDefectRelationService;
import com.aucma.common.utils.poi.ExcelUtil;
import com.aucma.common.core.page.TableDataInfo;
/**
* /Controller
*
* @author Yinq
* @date 2023-11-27
*/
@RestController
@RequestMapping("/base/stationDefectRelation" )
public class StationDefectRelationController extends BaseController {
@Autowired
private IStationDefectRelationService stationDefectRelationService;
/**
* /
*/
@PreAuthorize("@ss.hasPermi('base:stationDefectRelation:list')" )
@GetMapping("/list" )
public TableDataInfo list(StationDefectRelation stationDefectRelation) {
startPage();
List<StationDefectRelation> list = stationDefectRelationService.selectStationDefectRelationList(stationDefectRelation);
return getDataTable(list);
}
/**
* /
*/
@PreAuthorize("@ss.hasPermi('base:stationDefectRelation:export')" )
@Log(title = "质检工位/缺陷维护" , businessType = BusinessType.EXPORT)
@PostMapping("/export" )
public void export(HttpServletResponse response, StationDefectRelation stationDefectRelation) {
List<StationDefectRelation> list = stationDefectRelationService.selectStationDefectRelationList(stationDefectRelation);
ExcelUtil<StationDefectRelation> util = new ExcelUtil<StationDefectRelation>(StationDefectRelation. class);
util.exportExcel(response, list, "质检工位/缺陷维护数据" );
}
/**
* /
*/
@PreAuthorize("@ss.hasPermi('base:stationDefectRelation:query')" )
@GetMapping(value = "/{objId}" )
public AjaxResult getInfo(@PathVariable("objId" ) Long objId) {
return success(stationDefectRelationService.selectStationDefectRelationByObjId(objId));
}
/**
* /
*/
@PreAuthorize("@ss.hasPermi('base:stationDefectRelation:add')" )
@Log(title = "质检工位/缺陷维护" , businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody StationDefectRelation stationDefectRelation) {
stationDefectRelation.setCreatedBy(getUsername());
stationDefectRelation.setCreatedTime(DateUtils.getNowDate());
return toAjax(stationDefectRelationService.insertStationDefectRelation(stationDefectRelation));
}
/**
* /
*/
@PreAuthorize("@ss.hasPermi('base:stationDefectRelation:edit')" )
@Log(title = "质检工位/缺陷维护" , businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody StationDefectRelation stationDefectRelation) {
stationDefectRelation.setUpdatedBy(getUsername());
stationDefectRelation.setUpdatedTime(DateUtils.getNowDate());
return toAjax(stationDefectRelationService.updateStationDefectRelation(stationDefectRelation));
}
/**
* /
*/
@PreAuthorize("@ss.hasPermi('base:stationDefectRelation:remove')" )
@Log(title = "质检工位/缺陷维护" , businessType = BusinessType.DELETE)
@DeleteMapping("/{objIds}" )
public AjaxResult remove(@PathVariable Long[] objIds) {
return toAjax(stationDefectRelationService.deleteStationDefectRelationByObjIds(objIds));
}
}

@ -35,9 +35,9 @@ public class BaseProcessStation extends BaseEntity {
private String processName;
/**
* 1-2-
* 1-2-
*/
@Excel(name = "类别", readConverterExp = "1=-工序2-工位")
@Excel(name = "工序类别")
private Long processType;
/**

@ -43,9 +43,15 @@ public class BaseProductLine extends BaseEntity {
/**
* 线1-线2-
*/
@Excel(name = "类别", readConverterExp = "1=产线2=工位")
@Excel(name = "类别", readConverterExp = "1=产线,2=工位")
private Long productLineType;
/**
* 1=,2=
*/
@Excel(name = "工位类型", readConverterExp = "1=生产工位,2=质检工位")
private Long stationType;
/**
*
*/
@ -95,6 +101,14 @@ public class BaseProductLine extends BaseEntity {
*/
private String processCode;
public Long getStationType() {
return stationType;
}
public void setStationType(Long stationType) {
this.stationType = stationType;
}
public String getProcessCode() {
return processCode;
}

@ -0,0 +1,219 @@
package com.aucma.base.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.aucma.common.annotation.Excel;
import com.aucma.common.core.domain.BaseEntity;
/**
* / station_defect_relation
*
* @author Yinq
* @date 2023-11-27
*/
public class StationDefectRelation extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
*
*/
private Long objId;
/**
*
*/
@Excel(name = "质检工位编号")
private String stationCode;
/**
*
*/
@Excel(name = "质检工位名称")
private String stationName;
/**
*
*/
@Excel(name = "缺陷编号")
private String defectCode;
/**
*
*/
@Excel(name = "缺陷名称")
private String defectName;
/**
* 线
*/
@Excel(name = "所属产线")
private String productionLine;
/**
*
*/
@Excel(name = "启用标识")
private Long isFlag;
/**
*
*/
@Excel(name = "创建人")
private String createdBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date createdTime;
/**
*
*/
@Excel(name = "更新人")
private String updatedBy;
/**
*
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date updatedTime;
/**
*
*/
@Excel(name = "物料大类")
private String materialCategories;
/**
*
*/
@Excel(name = "物料小类")
private String materialSubclass;
public String getMaterialCategories() {
return materialCategories;
}
public void setMaterialCategories(String materialCategories) {
this.materialCategories = materialCategories;
}
public String getMaterialSubclass() {
return materialSubclass;
}
public void setMaterialSubclass(String materialSubclass) {
this.materialSubclass = materialSubclass;
}
public void setObjId(Long objId) {
this.objId = objId;
}
public Long getObjId() {
return objId;
}
public void setStationCode(String stationCode) {
this.stationCode = stationCode;
}
public String getStationCode() {
return stationCode;
}
public void setStationName(String stationName) {
this.stationName = stationName;
}
public String getStationName() {
return stationName;
}
public void setDefectCode(String defectCode) {
this.defectCode = defectCode;
}
public String getDefectCode() {
return defectCode;
}
public void setDefectName(String defectName) {
this.defectName = defectName;
}
public String getDefectName() {
return defectName;
}
public void setProductionLine(String productionLine) {
this.productionLine = productionLine;
}
public String getProductionLine() {
return productionLine;
}
public void setIsFlag(Long isFlag) {
this.isFlag = isFlag;
}
public Long getIsFlag() {
return isFlag;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public String getCreatedBy() {
return createdBy;
}
public void setCreatedTime(Date createdTime) {
this.createdTime = createdTime;
}
public Date getCreatedTime() {
return createdTime;
}
public void setUpdatedBy(String updatedBy) {
this.updatedBy = updatedBy;
}
public String getUpdatedBy() {
return updatedBy;
}
public void setUpdatedTime(Date updatedTime) {
this.updatedTime = updatedTime;
}
public Date getUpdatedTime() {
return updatedTime;
}
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
.append("objId", getObjId())
.append("stationCode", getStationCode())
.append("stationName", getStationName())
.append("defectCode", getDefectCode())
.append("defectName", getDefectName())
.append("productionLine", getProductionLine())
.append("isFlag", getIsFlag())
.append("createdBy", getCreatedBy())
.append("createdTime", getCreatedTime())
.append("updatedBy", getUpdatedBy())
.append("updatedTime", getUpdatedTime())
.toString();
}
}

@ -0,0 +1,61 @@
package com.aucma.base.mapper;
import java.util.List;
import com.aucma.base.domain.StationDefectRelation;
/**
* /Mapper
*
* @author Yinq
* @date 2023-11-27
*/
public interface StationDefectRelationMapper
{
/**
* /
*
* @param objId /
* @return /
*/
public StationDefectRelation selectStationDefectRelationByObjId(Long objId);
/**
* /
*
* @param stationDefectRelation /
* @return /
*/
public List<StationDefectRelation> selectStationDefectRelationList(StationDefectRelation stationDefectRelation);
/**
* /
*
* @param stationDefectRelation /
* @return
*/
public int insertStationDefectRelation(StationDefectRelation stationDefectRelation);
/**
* /
*
* @param stationDefectRelation /
* @return
*/
public int updateStationDefectRelation(StationDefectRelation stationDefectRelation);
/**
* /
*
* @param objId /
* @return
*/
public int deleteStationDefectRelationByObjId(Long objId);
/**
* /
*
* @param objIds
* @return
*/
public int deleteStationDefectRelationByObjIds(Long[] objIds);
}

@ -0,0 +1,61 @@
package com.aucma.base.service;
import java.util.List;
import com.aucma.base.domain.StationDefectRelation;
/**
* /Service
*
* @author Yinq
* @date 2023-11-27
*/
public interface IStationDefectRelationService
{
/**
* /
*
* @param objId /
* @return /
*/
public StationDefectRelation selectStationDefectRelationByObjId(Long objId);
/**
* /
*
* @param stationDefectRelation /
* @return /
*/
public List<StationDefectRelation> selectStationDefectRelationList(StationDefectRelation stationDefectRelation);
/**
* /
*
* @param stationDefectRelation /
* @return
*/
public int insertStationDefectRelation(StationDefectRelation stationDefectRelation);
/**
* /
*
* @param stationDefectRelation /
* @return
*/
public int updateStationDefectRelation(StationDefectRelation stationDefectRelation);
/**
* /
*
* @param objIds /
* @return
*/
public int deleteStationDefectRelationByObjIds(Long[] objIds);
/**
* /
*
* @param objId /
* @return
*/
public int deleteStationDefectRelationByObjId(Long objId);
}

@ -0,0 +1,109 @@
package com.aucma.base.service.impl;
import java.sql.SQLIntegrityConstraintViolationException;
import java.util.List;
import com.aucma.common.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.aucma.base.mapper.StationDefectRelationMapper;
import com.aucma.base.domain.StationDefectRelation;
import com.aucma.base.service.IStationDefectRelationService;
/**
* /Service
*
* @author Yinq
* @date 2023-11-27
*/
@Service
public class StationDefectRelationServiceImpl implements IStationDefectRelationService
{
@Autowired
private StationDefectRelationMapper stationDefectRelationMapper;
/**
* /
*
* @param objId /
* @return /
*/
@Override
public StationDefectRelation selectStationDefectRelationByObjId(Long objId)
{
return stationDefectRelationMapper.selectStationDefectRelationByObjId(objId);
}
/**
* /
*
* @param stationDefectRelation /
* @return /
*/
@Override
public List<StationDefectRelation> selectStationDefectRelationList(StationDefectRelation stationDefectRelation)
{
return stationDefectRelationMapper.selectStationDefectRelationList(stationDefectRelation);
}
/**
* /
*
* @param stationDefectRelation /
* @return
*/
@Override
public int insertStationDefectRelation(StationDefectRelation stationDefectRelation)
{
int i = 0;
try {
i = stationDefectRelationMapper.insertStationDefectRelation(stationDefectRelation);
} catch (Exception e) {
throw new ServiceException("该工位已绑定此缺陷!");
}
return i;
}
/**
* /
*
* @param stationDefectRelation /
* @return
*/
@Override
public int updateStationDefectRelation(StationDefectRelation stationDefectRelation)
{
int i = 0;
try {
i = stationDefectRelationMapper.updateStationDefectRelation(stationDefectRelation);
} catch (Exception e) {
throw new ServiceException("该工位已绑定此缺陷!");
}
return i;
}
/**
* /
*
* @param objIds /
* @return
*/
@Override
public int deleteStationDefectRelationByObjIds(Long[] objIds)
{
return stationDefectRelationMapper.deleteStationDefectRelationByObjIds(objIds);
}
/**
* /
*
* @param objId /
* @return
*/
@Override
public int deleteStationDefectRelationByObjId(Long objId)
{
return stationDefectRelationMapper.deleteStationDefectRelationByObjId(objId);
}
}

@ -19,6 +19,7 @@
<result property="parentId" column="parent_id"/>
<result property="parentName" column="parentName"/>
<result property="processCode" column="processCode"/>
<result property="stationType" column="station_type"/>
</resultMap>
<sql id="selectBaseProductLineVo">
@ -29,6 +30,7 @@
bpl.plant_code,
bf.factory_name plantName,
bpl.is_flag,
bpl.station_type,
bpl.created_by,
bpl.created_time,
bpl.updated_by,
@ -66,6 +68,7 @@
<if test="updatedBy != null and updatedBy != ''">and bpl.updated_by = #{updatedBy}</if>
<if test="updatedTime != null ">and bpl.updated_time = #{updatedTime}</if>
<if test="parentId != null ">and bpl.parent_id = #{parentId}</if>
<if test="stationType != null ">and bpl.station_type = #{stationType}</if>
</where>
order by bpl.PRODUCT_LINE_CODE
</select>
@ -92,6 +95,7 @@
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
<if test="parentId != null">parent_id,</if>
<if test="stationType != null">station_type,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if>
@ -105,6 +109,7 @@
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
<if test="parentId != null">#{parentId},</if>
<if test="stationType != null">#{stationType},</if>
</trim>
</insert>
@ -121,6 +126,7 @@
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="stationType != null">station_type = #{stationType},</if>
</trim>
where obj_id = #{objId}
</update>

@ -78,17 +78,20 @@
order by qi.quality_defect_code
</select>
<select id="getQualityDefects" parameterType="String" resultMap="BaseQualityInspectionItemResult">
select bq2.obj_id,
bq1.quality_defect_code station_code,
bq1.quality_defect_name station_name,
bq2.quality_defect_code,
bq2.quality_defect_name,
bq1.station_code
from base_quality_inspection_item bq1
left join base_quality_inspection_item bq2 on bq2.PARENT_ID = bq1.quality_defect_code
select sdr.obj_id,
bq1.quality_defect_code quality_defect_code,
bq1.quality_defect_name quality_defect_name,
sdr.station_code station_code,
pl.PRODUCT_LINE_NAME station_name,
dl.DICT_LABEL MATERIAL_CATEGORIES,
xl.DICT_LABEL MATERIAL_SUBCLASS
from STATION_DEFECT_RELATION sdr
left join BASE_QUALITY_INSPECTION_ITEM bq1 on sdr.defect_code = bq1.QUALITY_DEFECT_CODE
left join BASE_PRODUCTLINE pl on sdr.station_code = pl.PRODUCT_LINE_CODE
left join SYS_DICT_DATA dl on dl.DICT_TYPE = 'material_categories' and bq1.MATERIAL_CATEGORIES = dl.DICT_VALUE
left join SYS_DICT_DATA xl on xl.DICT_TYPE = 'material_subclass' and bq1.MATERIAL_SUBCLASS = xl.DICT_VALUE
<where>
bq2.quality_defect_code is not null
<if test="stationCode != null ">and bq1.station_code = #{stationCode}</if>
<if test="stationCode != null ">and sdr.station_code = #{stationCode}</if>
</where>
</select>

@ -0,0 +1,123 @@
<?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.aucma.base.mapper.StationDefectRelationMapper">
<resultMap type="StationDefectRelation" id="StationDefectRelationResult">
<result property="objId" column="obj_id" />
<result property="stationCode" column="station_code" />
<result property="stationName" column="station_name" />
<result property="defectCode" column="defect_code" />
<result property="defectName" column="defect_name" />
<result property="productionLine" column="production_line" />
<result property="isFlag" column="is_flag" />
<result property="createdBy" column="created_by" />
<result property="createdTime" column="created_time" />
<result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" />
<result property="materialCategories" column="material_categories" />
<result property="materialSubclass" column="material_subclass" />
</resultMap>
<sql id="selectStationDefectRelationVo">
select sdr.obj_id,
sdr.station_code,
pl.PRODUCT_LINE_NAME station_name,
sdr.defect_code,
qii.QUALITY_DEFECT_NAME defect_name,
pl.PARENT_ID production_line,
qii.MATERIAL_CATEGORIES material_categories,
qii.MATERIAL_SUBCLASS material_subclass,
sdr.is_flag,
sdr.created_by,
sdr.created_time,
sdr.updated_by,
sdr.updated_time
from station_defect_relation sdr
left join BASE_PRODUCTLINE pl on pl.PRODUCT_LINE_CODE = sdr.station_code
left join BASE_QUALITY_INSPECTION_ITEM qii on qii.QUALITY_DEFECT_CODE = sdr.defect_code
</sql>
<select id="selectStationDefectRelationList" parameterType="StationDefectRelation" resultMap="StationDefectRelationResult">
<include refid="selectStationDefectRelationVo"/>
<where>
<if test="stationCode != null and stationCode != ''"> and sdr.station_code = #{stationCode}</if>
<if test="stationName != null and stationName != ''"> and sdr.station_name like concat(concat('%', #{stationName}), '%')</if>
<if test="defectCode != null and defectCode != ''"> and sdr.defect_code = #{defectCode}</if>
<if test="defectName != null and defectName != ''"> and sdr.defect_name like concat(concat('%', #{defectName}), '%')</if>
<if test="productionLine != null and productionLine != ''"> and sdr.production_line = #{productionLine}</if>
<if test="isFlag != null "> and sdr.is_flag = #{isFlag}</if>
<if test="createdBy != null and createdBy != ''"> and sdr.created_by = #{createdBy}</if>
<if test="createdTime != null "> and sdr.created_time = #{createdTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and sdr.updated_by = #{updatedBy}</if>
<if test="updatedTime != null "> and sdr.updated_time = #{updatedTime}</if>
</where>
</select>
<select id="selectStationDefectRelationByObjId" parameterType="Long" resultMap="StationDefectRelationResult">
<include refid="selectStationDefectRelationVo"/>
where sdr.obj_id = #{objId}
</select>
<insert id="insertStationDefectRelation" parameterType="StationDefectRelation">
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
SELECT seq_station_defect_relation.NEXTVAL as objId FROM DUAL
</selectKey>
insert into station_defect_relation
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="objId != null">obj_id,</if>
<if test="stationCode != null">station_code,</if>
<if test="stationName != null">station_name,</if>
<if test="defectCode != null">defect_code,</if>
<if test="defectName != null">defect_name,</if>
<if test="productionLine != null">production_line,</if>
<if test="isFlag != null">is_flag,</if>
<if test="createdBy != null">created_by,</if>
<if test="createdTime != null">created_time,</if>
<if test="updatedBy != null">updated_by,</if>
<if test="updatedTime != null">updated_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="objId != null">#{objId},</if>
<if test="stationCode != null">#{stationCode},</if>
<if test="stationName != null">#{stationName},</if>
<if test="defectCode != null">#{defectCode},</if>
<if test="defectName != null">#{defectName},</if>
<if test="productionLine != null">#{productionLine},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="createdBy != null">#{createdBy},</if>
<if test="createdTime != null">#{createdTime},</if>
<if test="updatedBy != null">#{updatedBy},</if>
<if test="updatedTime != null">#{updatedTime},</if>
</trim>
</insert>
<update id="updateStationDefectRelation" parameterType="StationDefectRelation">
update station_defect_relation
<trim prefix="SET" suffixOverrides=",">
<if test="stationCode != null">station_code = #{stationCode},</if>
<if test="stationName != null">station_name = #{stationName},</if>
<if test="defectCode != null">defect_code = #{defectCode},</if>
<if test="defectName != null">defect_name = #{defectName},</if>
<if test="productionLine != null">production_line = #{productionLine},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="createdBy != null">created_by = #{createdBy},</if>
<if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
</trim>
where obj_id = #{objId}
</update>
<delete id="deleteStationDefectRelationByObjId" parameterType="Long">
delete from station_defect_relation where obj_id = #{objId}
</delete>
<delete id="deleteStationDefectRelationByObjIds" parameterType="String">
delete from station_defect_relation where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId}
</foreach>
</delete>
</mapper>
Loading…
Cancel
Save