diff --git a/src/main/java/com/xujie/sys/modules/pms/controller/QcController.java b/src/main/java/com/xujie/sys/modules/pms/controller/QcController.java index c1291b91..8395b22f 100644 --- a/src/main/java/com/xujie/sys/modules/pms/controller/QcController.java +++ b/src/main/java/com/xujie/sys/modules/pms/controller/QcController.java @@ -377,7 +377,7 @@ public class QcController { /** - * @description: 快速获取项目列表 + * @description: 快速获取模板列表 * @author: fengyuan_yang * @date: 2023/3/30 11:29 * @param: [inData] @@ -1334,10 +1334,16 @@ public class QcController { // ======================= FAI检验API ======================= - + /** + * @description: FAI检验记录查询 + * @author: fengyuan_yang + * @date: 2023/4/24 10:10 + * @param: [data] + * @return: com.xujie.sys.common.utils.R + **/ @PostMapping(value="/qcFAIInspectionSearch") - public R qcFAIInspectionSearch(@RequestBody QcSamplingInspectionProgrammeData data){ - PageUtils page = qcService.samplingProgrammeSearch(data); + public R qcFAIInspectionSearch(@RequestBody QcFAIRecordData data){ + PageUtils page = qcService.qcFAIInspectionSearch(data); return R.ok().put("page", page); } diff --git a/src/main/java/com/xujie/sys/modules/pms/data/QcFAIRecordData.java b/src/main/java/com/xujie/sys/modules/pms/data/QcFAIRecordData.java new file mode 100644 index 00000000..d9ad2730 --- /dev/null +++ b/src/main/java/com/xujie/sys/modules/pms/data/QcFAIRecordData.java @@ -0,0 +1,470 @@ +package com.xujie.sys.modules.pms.data; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.xujie.sys.common.utils.QueryPage; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +public class QcFAIRecordData extends QueryPage { + // 检验单号 + private String inspectionNo; + // 工厂号 + private String site; + // soscheduledrouting的主键ID + private String ssrId; + // 状态 + private String state; + // 检验结果 + private String inspectionResult; + // 任务生成日期 + @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone = "GMT+8") + private Date taskDate; + // 检验任务日期(最大) + @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone = "GMT+8") + private Date startDate; + // 检验任务日期(最小) + @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone = "GMT+8") + private Date endDate; + // 检验类型编码 + private String inspectionTypeNo; + // 工单号 + private String orderNo; + // 工序名称 + private String operationDesc; + // 产量 + private Double approveQty; + // 机台号 + private String resourceId; + // 机台名称 + private String resourceDesc; + // 物料编码 + private String partNo; + // 物料名称 + private String partDesc; + // 质检备注 + private String inspectionRemark; + // 送检数量 + private Double rollQty; + // 抽样数量 + private Double samplingQty; + // 处置措施 + private String disposalMeasures; + // 处置说明 + private String disposalRemark; + // 实际检验时间 + @DateTimeFormat(pattern = "yyyy-MM-dd hh:mm:ss") + @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", timezone = "GMT+8") + private Date inspectorDate; + // 质检员工号 + private String inspectorNo; + // 模板编码 + private String templateId; + // 属性编码 + private String attributeNo; + // 属性类型 + private String attributeType; + + // 检验周期 + private Double inspectionCycle; + // 检验水平编码 + private String samplingLevelNo; + // 检验水平名称 + private String samplingLevelDesc; + // 抽样方案编码 + private String samplingProgrammeNo; + // 抽样方案名称 + private String samplingProgrammeDesc; + // AQL + private Double aql; + // AC + private Double ac; + // RE + private Double re; + + // 检验项目编码 + private String itemNo; + // 检验项目名称 + private String itemDesc; + // 检验项目编码 + private String objectId; + // 检验项目名称 + private String objectDesc; + // 默认值 + private String defaultValue; + // 最小值 + private Double minValue; + // 最大值 + private Double maxValue; + // 数字实测值 + private Double numberValue; + // 文本实测值 + private String textValue; + // 不合格数量 + private Double unqualifiedQuantity; + // 项目检验结论 + private String itemResult; + + public String getSamplingLevelNo() { + return samplingLevelNo; + } + + public void setSamplingLevelNo(String samplingLevelNo) { + this.samplingLevelNo = samplingLevelNo; + } + + public String getSamplingProgrammeNo() { + return samplingProgrammeNo; + } + + public void setSamplingProgrammeNo(String samplingProgrammeNo) { + this.samplingProgrammeNo = samplingProgrammeNo; + } + + public Double getAql() { + return aql; + } + + public void setAql(Double aql) { + this.aql = aql; + } + + public Double getAc() { + return ac; + } + + public void setAc(Double ac) { + this.ac = ac; + } + + public Double getRe() { + return re; + } + + public void setRe(Double re) { + this.re = re; + } + + public String getInspectionNo() { + return inspectionNo; + } + + public void setInspectionNo(String inspectionNo) { + this.inspectionNo = inspectionNo; + } + + public String getSite() { + return site; + } + + public void setSite(String site) { + this.site = site; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getInspectionResult() { + return inspectionResult; + } + + public void setInspectionResult(String inspectionResult) { + this.inspectionResult = inspectionResult; + } + + public Date getStartDate() { + return startDate; + } + + public void setStartDate(Date startDate) { + this.startDate = startDate; + } + + public Date getEndDate() { + return endDate; + } + + public void setEndDate(Date endDate) { + this.endDate = endDate; + } + + public String getInspectionTypeNo() { + return inspectionTypeNo; + } + + public void setInspectionTypeNo(String inspectionTypeNo) { + this.inspectionTypeNo = inspectionTypeNo; + } + + public Double getInspectionCycle() { + return inspectionCycle; + } + + public void setInspectionCycle(Double inspectionCycle) { + this.inspectionCycle = inspectionCycle; + } + + public String getOrderNo() { + return orderNo; + } + + public void setOrderNo(String orderNo) { + this.orderNo = orderNo; + } + + public String getOperationDesc() { + return operationDesc; + } + + public void setOperationDesc(String operationDesc) { + this.operationDesc = operationDesc; + } + + public Double getApproveQty() { + return approveQty; + } + + public void setApproveQty(Double approveQty) { + this.approveQty = approveQty; + } + + public String getResourceId() { + return resourceId; + } + + public void setResourceId(String resourceId) { + this.resourceId = resourceId; + } + + public String getResourceDesc() { + return resourceDesc; + } + + public void setResourceDesc(String resourceDesc) { + this.resourceDesc = resourceDesc; + } + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; + } + + public String getPartDesc() { + return partDesc; + } + + public void setPartDesc(String partDesc) { + this.partDesc = partDesc; + } + + public String getInspectionRemark() { + return inspectionRemark; + } + + public void setInspectionRemark(String inspectionRemark) { + this.inspectionRemark = inspectionRemark; + } + + public Double getRollQty() { + return rollQty; + } + + public void setRollQty(Double rollQty) { + this.rollQty = rollQty; + } + + public Double getSamplingQty() { + return samplingQty; + } + + public void setSamplingQty(Double samplingQty) { + this.samplingQty = samplingQty; + } + + public String getDisposalMeasures() { + return disposalMeasures; + } + + public void setDisposalMeasures(String disposalMeasures) { + this.disposalMeasures = disposalMeasures; + } + + public String getDisposalRemark() { + return disposalRemark; + } + + public void setDisposalRemark(String disposalRemark) { + this.disposalRemark = disposalRemark; + } + + public Date getInspectorDate() { + return inspectorDate; + } + + public void setInspectorDate(Date inspectorDate) { + this.inspectorDate = inspectorDate; + } + + public String getInspectorNo() { + return inspectorNo; + } + + public void setInspectorNo(String inspectorNo) { + this.inspectorNo = inspectorNo; + } + + public String getSsrId() { + return ssrId; + } + + public void setSsrId(String ssrId) { + this.ssrId = ssrId; + } + + public Date getTaskDate() { + return taskDate; + } + + public void setTaskDate(Date taskDate) { + this.taskDate = taskDate; + } + + public String getTemplateId() { + return templateId; + } + + public void setTemplateId(String templateId) { + this.templateId = templateId; + } + + public String getAttributeNo() { + return attributeNo; + } + + public void setAttributeNo(String attributeNo) { + this.attributeNo = attributeNo; + } + + public String getAttributeType() { + return attributeType; + } + + public void setAttributeType(String attributeType) { + this.attributeType = attributeType; + } + + public String getSamplingLevelDesc() { + return samplingLevelDesc; + } + + public void setSamplingLevelDesc(String samplingLevelDesc) { + this.samplingLevelDesc = samplingLevelDesc; + } + + public String getSamplingProgrammeDesc() { + return samplingProgrammeDesc; + } + + public void setSamplingProgrammeDesc(String samplingProgrammeDesc) { + this.samplingProgrammeDesc = samplingProgrammeDesc; + } + + public String getItemNo() { + return itemNo; + } + + public void setItemNo(String itemNo) { + this.itemNo = itemNo; + } + + public String getItemDesc() { + return itemDesc; + } + + public void setItemDesc(String itemDesc) { + this.itemDesc = itemDesc; + } + + public String getObjectId() { + return objectId; + } + + public void setObjectId(String objectId) { + this.objectId = objectId; + } + + public String getObjectDesc() { + return objectDesc; + } + + public void setObjectDesc(String objectDesc) { + this.objectDesc = objectDesc; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public Double getMinValue() { + return minValue; + } + + public void setMinValue(Double minValue) { + this.minValue = minValue; + } + + public Double getMaxValue() { + return maxValue; + } + + public void setMaxValue(Double maxValue) { + this.maxValue = maxValue; + } + + public Double getNumberValue() { + return numberValue; + } + + public void setNumberValue(Double numberValue) { + this.numberValue = numberValue; + } + + public String getTextValue() { + return textValue; + } + + public void setTextValue(String textValue) { + this.textValue = textValue; + } + + public Double getUnqualifiedQuantity() { + return unqualifiedQuantity; + } + + public void setUnqualifiedQuantity(Double unqualifiedQuantity) { + this.unqualifiedQuantity = unqualifiedQuantity; + } + + public String getItemResult() { + return itemResult; + } + + public void setItemResult(String itemResult) { + this.itemResult = itemResult; + } +} diff --git a/src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java b/src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java index 8b85b920..62a3b717 100644 --- a/src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java +++ b/src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java @@ -301,4 +301,20 @@ public interface QcMapper { QcTemplateData selectItem(String itemNo, String itemType); QcPartAttributeData selectPartAttributeByNo(QcPartAttributeData data); + + List selectBasicData(); + + QcFAIRecordData selectPartAttributeByPartNo(String partNo, String attributeType); + + String queryLastFAIInspectionNo(QcFAIRecordData data); + + void saveFAIRecord(QcFAIRecordData data); + + void saveFAIDetailedRecord(QcFAIRecordData faiRecordData); + + IPage qcFAIInspectionSearch(Page qcFAIRecordDataPage,@Param("query") QcFAIRecordData data); + + String selectFamilyIdByPartNo(String partNo, String site); + + QcFAIRecordData selectFamilyAttributeByFamilyId(String familyId, String attributeType); } diff --git a/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java b/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java index 346aef49..2d0dc7bb 100644 --- a/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java +++ b/src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java @@ -963,7 +963,7 @@ public class QcServiceImpl implements QcService { qcMapper.samplingInspectionPlanDelete(data); } - // ======================= 检验项目维护 ======================= + // ======================= 检验模板维护 ======================= /** * @description: 查询模板 @@ -1017,7 +1017,7 @@ public class QcServiceImpl implements QcService { } /** - * @description: 检验项目清单 + * @description: 模板中的项目清单 * @author: fengyuan_yang * @date: 2023/4/11 9:41 * @param: [data] @@ -1882,4 +1882,119 @@ public class QcServiceImpl implements QcService { } + // ======================= FAI检验维护 ======================= + + /** + * @description: FAI检验记录查询 + * @author: fengyuan_yang + * @date: 2023/4/24 10:25 + * @param: [data] + * @return: com.xujie.sys.common.utils.PageUtils + **/ + @Override + @Transactional + public PageUtils qcFAIInspectionSearch(QcFAIRecordData data) { + // 查询FAI基础数据 + List basicData = qcMapper.selectBasicData(); + QcFAIRecordData qcFAIRecordData = new QcFAIRecordData(); + qcFAIRecordData.setSite(data.getSite()); + for (int i = 0; i < basicData.size(); i++) { + // 查询最大编码,自增后赋值 + String s = qcMapper.queryLastFAIInspectionNo(qcFAIRecordData); + if (s == null){ + qcFAIRecordData.setInspectionNo("10001"); + }else { + int no = Integer.parseInt(qcMapper.queryLastFAIInspectionNo(qcFAIRecordData)); + qcFAIRecordData.setInspectionNo(String.valueOf(++no)); + } + // 主记录信息赋值 + qcFAIRecordData.setState("W"); // 状态 + qcFAIRecordData.setInspectionTypeNo("102"); // 检验类型编码 + qcFAIRecordData.setOrderNo(basicData.get(i).getOrderNo()); // 工单号 + qcFAIRecordData.setOperationDesc(basicData.get(i).getOperationDesc()); // 工序 + qcFAIRecordData.setResourceId(basicData.get(i).getResourceId()); // 机台号 + qcFAIRecordData.setResourceDesc(basicData.get(i).getResourceDesc()); // 机台名 + qcFAIRecordData.setPartNo(basicData.get(i).getPartNo()); // 物料编码 + qcFAIRecordData.setPartDesc(basicData.get(i).getPartDesc()); // 物料名称 + qcFAIRecordData.setRollQty(basicData.get(i).getRollQty()); // 送检数量 + qcFAIRecordData.setSsrId(basicData.get(i).getSsrId()); // ssr的主键ID + + // 明细记录信息赋值 + String partNo = basicData.get(i).getPartNo(); + String attributeType1 = "A"; + // 获取该物料属性下维护的FAI检验模板 + QcFAIRecordData partAttribute = qcMapper.selectPartAttributeByPartNo(partNo, attributeType1); + if (partAttribute != null){ + qcFAIRecordData.setInspectionCycle(partAttribute.getInspectionCycle()); + // 获取根据该检验模板下维护的检验项目 + QcTemplateData templateData = new QcTemplateData(); + templateData.setTemplateId(partAttribute.getTemplateId()); + templateData.setItemType("D"); + List itemList = qcMapper.ItemDetailsSearch(templateData); + QcFAIRecordData faiRecordData = new QcFAIRecordData(); + faiRecordData.setInspectionNo(qcFAIRecordData.getInspectionNo()); // 检验单号 + faiRecordData.setOrderNo(qcFAIRecordData.getOrderNo()); // 工单号 + faiRecordData.setTemplateId(partAttribute.getTemplateId()); // 模板编码 + faiRecordData.setSamplingLevelNo(partAttribute.getSamplingLevelNo()); // 检验水平编码 + faiRecordData.setSamplingLevelDesc(partAttribute.getSamplingLevelDesc()); // 检验水平名称 + faiRecordData.setSamplingProgrammeNo(partAttribute.getSamplingProgrammeNo()); // 抽样方案编码 + faiRecordData.setSamplingProgrammeDesc(partAttribute.getSamplingProgrammeDesc()); // 抽样方案名称 + faiRecordData.setAql(partAttribute.getAql()); // aql + faiRecordData.setAc(partAttribute.getAc()); // ac + faiRecordData.setRe(partAttribute.getRe()); // re + for (int j = 0; j < itemList.size(); j++) { + faiRecordData.setItemNo(itemList.get(j).getItemNo()); // 项目编码 + faiRecordData.setItemDesc(itemList.get(j).getItemDesc()); // 项目名称 + faiRecordData.setObjectId(itemList.get(j).getObjectID()); // 设备编码 + faiRecordData.setObjectDesc(itemList.get(j).getObjectDesc()); // 设备名称 + faiRecordData.setDefaultValue(itemList.get(j).getDefaultValue()); // 默认值 + faiRecordData.setMinValue(itemList.get(j).getMinValue()); // 最小值 + faiRecordData.setMaxValue(itemList.get(j).getMaxValue()); // 最大值 + // 新增FAI明细记录信息 + qcMapper.saveFAIDetailedRecord(faiRecordData); + } + }else { + // 获取物料的类别编码 + String familyId = qcMapper.selectFamilyIdByPartNo(partNo,data.getSite()); + String attributeType2 = "B"; + // 获取该类别属性下维护的FAI检验模板 + QcFAIRecordData familyAttribute = qcMapper.selectFamilyAttributeByFamilyId(familyId, attributeType2); + qcFAIRecordData.setInspectionCycle(familyAttribute.getInspectionCycle()); + // 获取根据该检验模板下维护的检验项目 + QcTemplateData templateData = new QcTemplateData(); + templateData.setTemplateId(familyAttribute.getTemplateId()); + templateData.setItemType("D"); + List itemList = qcMapper.ItemDetailsSearch(templateData); + QcFAIRecordData faiRecordData = new QcFAIRecordData(); + faiRecordData.setInspectionNo(qcFAIRecordData.getInspectionNo()); // 检验单号 + faiRecordData.setOrderNo(qcFAIRecordData.getOrderNo()); // 工单号 + faiRecordData.setTemplateId(familyAttribute.getTemplateId()); // 模板编码 + faiRecordData.setSamplingLevelNo(familyAttribute.getSamplingLevelNo()); // 检验水平编码 + faiRecordData.setSamplingLevelDesc(familyAttribute.getSamplingLevelDesc()); // 检验水平名称 + faiRecordData.setSamplingProgrammeNo(familyAttribute.getSamplingProgrammeNo()); // 抽样方案编码 + faiRecordData.setSamplingProgrammeDesc(familyAttribute.getSamplingProgrammeDesc()); // 抽样方案名称 + faiRecordData.setAql(familyAttribute.getAql()); // aql + faiRecordData.setAc(familyAttribute.getAc()); // ac + faiRecordData.setRe(familyAttribute.getRe()); // re + for (int j = 0; j < itemList.size(); j++) { + faiRecordData.setItemNo(itemList.get(j).getItemNo()); // 项目编码 + faiRecordData.setItemDesc(itemList.get(j).getItemDesc()); // 项目名称 + faiRecordData.setObjectId(itemList.get(j).getObjectID()); // 设备编码 + faiRecordData.setObjectDesc(itemList.get(j).getObjectDesc()); // 设备名称 + faiRecordData.setDefaultValue(itemList.get(j).getDefaultValue()); // 默认值 + faiRecordData.setMinValue(itemList.get(j).getMinValue()); // 最小值 + faiRecordData.setMaxValue(itemList.get(j).getMaxValue()); // 最大值 + // 新增FAI明细记录信息 + qcMapper.saveFAIDetailedRecord(faiRecordData); + } + } + + // 新增FAI主记录信息 + qcMapper.saveFAIRecord(qcFAIRecordData); + + } + // 查询FAI主记录信息 + IPage resultList = this.qcMapper.qcFAIInspectionSearch(new Page(data.getPage(), data.getLimit()), data); + return new PageUtils(resultList); + } } diff --git a/src/main/java/com/xujie/sys/modules/pms/service/QcService.java b/src/main/java/com/xujie/sys/modules/pms/service/QcService.java index a7b8e328..447952bf 100644 --- a/src/main/java/com/xujie/sys/modules/pms/service/QcService.java +++ b/src/main/java/com/xujie/sys/modules/pms/service/QcService.java @@ -190,4 +190,6 @@ public interface QcService { void uploadPartAttributeExcel(MultipartFile file); void uploadFamilyAttributeExcel(MultipartFile file); + + PageUtils qcFAIInspectionSearch(QcFAIRecordData data); } diff --git a/src/main/resources/mapper/pms/QcMapper.xml b/src/main/resources/mapper/pms/QcMapper.xml index dccc447d..523bab15 100644 --- a/src/main/resources/mapper/pms/QcMapper.xml +++ b/src/main/resources/mapper/pms/QcMapper.xml @@ -933,6 +933,9 @@ template_remark = #{templateRemark}, template_type = #{templateType}, sampling_programme_no = #{samplingProgrammeNo}, + inspection_cycle = #{inspectionCycle}, + inspection_type_no = #{inspectionTypeNo}, + sampling_level_no = #{samplingLevelNo}, AQL = #{aql}, AC = #{ac}, RE = #{re} @@ -1740,6 +1743,157 @@ WHERE sampling_programme_no = #{samplingProgrammeNo} AND sampling_plan_no = #{samplingPlanNo} + + + + + + + + + + + + + + + INSERT INTO qc_fai_record (inspection_no, site, state, task_date, inspection_type_no, inspection_cycle, order_no, operation_desc, resource_id, resource_desc, part_no, part_desc, roll_qty, sampling_qty, ssr_id) + VALUES(#{inspectionNo}, #{site}, #{state}, getDate(), #{inspectionTypeNo}, #{inspectionCycle,jdbcType=FLOAT}, #{orderNo}, #{operationDesc}, #{resourceId}, #{resourceDesc}, #{partNo}, #{partDesc}, #{rollQty}, #{samplingQty,jdbcType=FLOAT}, #{ssrId}) + + + + + INSERT INTO qc_fai_detailed_record (inspection_no, order_no, template_id, sampling_level_no, sampling_level_desc, sampling_programme_no, sampling_programme_desc, AQL, AC, RE, item_no, item_desc, object_id, object_desc, default_value, min_value, max_value) + VALUES(#{inspectionNo}, #{orderNo}, #{templateId}, #{samplingLevelNo}, #{samplingLevelDesc}, #{samplingProgrammeNo}, #{samplingProgrammeDesc}, #{aql,jdbcType=FLOAT}, #{ac,jdbcType=FLOAT}, #{re,jdbcType=FLOAT}, #{itemNo}, #{itemDesc}, #{objectId}, #{objectDesc}, #{defaultValue}, #{minValue,jdbcType=FLOAT}, #{maxValue,jdbcType=FLOAT}) + + + + + + + + + +