diff --git a/aucma-base/src/main/java/com/aucma/base/controller/BaseQualityInspectionItemController.java b/aucma-base/src/main/java/com/aucma/base/controller/BaseQualityInspectionItemController.java index f9d0636..670e58b 100644 --- a/aucma-base/src/main/java/com/aucma/base/controller/BaseQualityInspectionItemController.java +++ b/aucma-base/src/main/java/com/aucma/base/controller/BaseQualityInspectionItemController.java @@ -46,6 +46,17 @@ public class BaseQualityInspectionItemController extends BaseController { return getDataTable(list); } + /** + * 查询缺陷下拉框 + * @param baseQualityInspectionItem + * @return + */ + @GetMapping("/getDefectList" ) + public AjaxResult getDefectList(BaseQualityInspectionItem baseQualityInspectionItem) { + List list = baseQualityInspectionItemService.selectBaseQualityInspectionItemList(baseQualityInspectionItem); + return success(list); + } + /** * 导出质检项信息维护列表 */ diff --git a/aucma-base/src/main/java/com/aucma/base/controller/StationDefectRelationController.java b/aucma-base/src/main/java/com/aucma/base/controller/StationDefectRelationController.java new file mode 100644 index 0000000..6225986 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/controller/StationDefectRelationController.java @@ -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 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 list = stationDefectRelationService.selectStationDefectRelationList(stationDefectRelation); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/aucma-base/src/main/java/com/aucma/base/domain/BaseProcessStation.java b/aucma-base/src/main/java/com/aucma/base/domain/BaseProcessStation.java index 0affd2b..85445bf 100644 --- a/aucma-base/src/main/java/com/aucma/base/domain/BaseProcessStation.java +++ b/aucma-base/src/main/java/com/aucma/base/domain/BaseProcessStation.java @@ -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; /** diff --git a/aucma-base/src/main/java/com/aucma/base/domain/BaseProductLine.java b/aucma-base/src/main/java/com/aucma/base/domain/BaseProductLine.java index 4bade18..93ca3fc 100644 --- a/aucma-base/src/main/java/com/aucma/base/domain/BaseProductLine.java +++ b/aucma-base/src/main/java/com/aucma/base/domain/BaseProductLine.java @@ -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; } diff --git a/aucma-base/src/main/java/com/aucma/base/domain/StationDefectRelation.java b/aucma-base/src/main/java/com/aucma/base/domain/StationDefectRelation.java new file mode 100644 index 0000000..8e6d9ae --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/domain/StationDefectRelation.java @@ -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(); + } +} diff --git a/aucma-base/src/main/java/com/aucma/base/mapper/StationDefectRelationMapper.java b/aucma-base/src/main/java/com/aucma/base/mapper/StationDefectRelationMapper.java new file mode 100644 index 0000000..07983eb --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/mapper/StationDefectRelationMapper.java @@ -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 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); +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/IStationDefectRelationService.java b/aucma-base/src/main/java/com/aucma/base/service/IStationDefectRelationService.java new file mode 100644 index 0000000..c772f66 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/IStationDefectRelationService.java @@ -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 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); +} diff --git a/aucma-base/src/main/java/com/aucma/base/service/impl/StationDefectRelationServiceImpl.java b/aucma-base/src/main/java/com/aucma/base/service/impl/StationDefectRelationServiceImpl.java new file mode 100644 index 0000000..20f1c64 --- /dev/null +++ b/aucma-base/src/main/java/com/aucma/base/service/impl/StationDefectRelationServiceImpl.java @@ -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 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); + } +} diff --git a/aucma-base/src/main/resources/mapper/base/BaseProductLineMapper.xml b/aucma-base/src/main/resources/mapper/base/BaseProductLineMapper.xml index 9610cf2..80710d6 100644 --- a/aucma-base/src/main/resources/mapper/base/BaseProductLineMapper.xml +++ b/aucma-base/src/main/resources/mapper/base/BaseProductLineMapper.xml @@ -19,6 +19,7 @@ + @@ -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 @@ and bpl.updated_by = #{updatedBy} and bpl.updated_time = #{updatedTime} and bpl.parent_id = #{parentId} + and bpl.station_type = #{stationType} order by bpl.PRODUCT_LINE_CODE @@ -92,6 +95,7 @@ updated_by, updated_time, parent_id, + station_type, #{objId}, @@ -105,6 +109,7 @@ #{updatedBy}, #{updatedTime}, #{parentId}, + #{stationType}, @@ -121,6 +126,7 @@ updated_by = #{updatedBy}, updated_time = #{updatedTime}, parent_id = #{parentId}, + station_type = #{stationType}, where obj_id = #{objId} diff --git a/aucma-base/src/main/resources/mapper/base/BaseQualityInspectionItemMapper.xml b/aucma-base/src/main/resources/mapper/base/BaseQualityInspectionItemMapper.xml index d455088..1ae374c 100644 --- a/aucma-base/src/main/resources/mapper/base/BaseQualityInspectionItemMapper.xml +++ b/aucma-base/src/main/resources/mapper/base/BaseQualityInspectionItemMapper.xml @@ -78,17 +78,20 @@ order by qi.quality_defect_code diff --git a/aucma-base/src/main/resources/mapper/base/StationDefectRelationMapper.xml b/aucma-base/src/main/resources/mapper/base/StationDefectRelationMapper.xml new file mode 100644 index 0000000..1473779 --- /dev/null +++ b/aucma-base/src/main/resources/mapper/base/StationDefectRelationMapper.xml @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + + SELECT seq_station_defect_relation.NEXTVAL as objId FROM DUAL + + insert into station_defect_relation + + obj_id, + station_code, + station_name, + defect_code, + defect_name, + production_line, + is_flag, + created_by, + created_time, + updated_by, + updated_time, + + + #{objId}, + #{stationCode}, + #{stationName}, + #{defectCode}, + #{defectName}, + #{productionLine}, + #{isFlag}, + #{createdBy}, + #{createdTime}, + #{updatedBy}, + #{updatedTime}, + + + + + update station_defect_relation + + station_code = #{stationCode}, + station_name = #{stationName}, + defect_code = #{defectCode}, + defect_name = #{defectName}, + production_line = #{productionLine}, + is_flag = #{isFlag}, + created_by = #{createdBy}, + created_time = #{createdTime}, + updated_by = #{updatedBy}, + updated_time = #{updatedTime}, + + where obj_id = #{objId} + + + + delete from station_defect_relation where obj_id = #{objId} + + + + delete from station_defect_relation where obj_id in + + #{objId} + + + \ No newline at end of file