|
|
|
@ -9,6 +9,7 @@ import com.xujie.sys.modules.pms.entity.vo.CheckSubDetailValueVo; |
|
|
|
import com.xujie.sys.modules.pms.mapper.QcMapper; |
|
|
|
import com.xujie.sys.modules.pms.service.QcService; |
|
|
|
import com.xujie.sys.modules.pms.util.ResponseData; |
|
|
|
import com.xujie.sys.modules.sys.entity.SysSceneDynamicControlModelEntity; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFRow; |
|
|
|
import org.apache.poi.xssf.usermodel.XSSFSheet; |
|
|
|
@ -1499,20 +1500,15 @@ public class QcServiceImpl implements QcService { |
|
|
|
String InspectionNo = qcMapper.selectFAIInspectionNo(data); |
|
|
|
data.setInspectionNo("FAI" + InspectionNo); |
|
|
|
data.setState("待检验"); |
|
|
|
// 明细记录信息赋值 |
|
|
|
String partNo = data.getPartNo(); |
|
|
|
String attributeType1 = "A"; |
|
|
|
// 获取该物料属性下维护的FAI检验模板 |
|
|
|
String operationDesc = ""; |
|
|
|
String resourceId = ""; |
|
|
|
if (StringUtils.isNotBlank(data.getOperationDesc())) { |
|
|
|
operationDesc = data.getOperationDesc(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getResourceId())) { |
|
|
|
resourceId = data.getResourceId(); |
|
|
|
} |
|
|
|
List<QcFAIRecordData> partAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), partNo, attributeType1, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (partAttribute.size() > 0) { |
|
|
|
List<QcFAIRecordData> partAttribute; |
|
|
|
// 检查动控是否已开启 |
|
|
|
SysSceneDynamicControlModelEntity controlModel = new SysSceneDynamicControlModelEntity(); |
|
|
|
controlModel.setSite(data.getSite()); |
|
|
|
controlModel.setControlNo("10004"); |
|
|
|
List<SysSceneDynamicControlModelEntity> controlList = qcMapper.queryController(controlModel); |
|
|
|
if ("控制".equals(controlList.get(0).getBaseData())) { |
|
|
|
// 根据用户选择的模板编码获取模板详情 |
|
|
|
partAttribute = qcMapper.selectTemplate(data); |
|
|
|
// 获取检验周期 |
|
|
|
if (partAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(partAttribute.get(0).getInspectionCycle()); |
|
|
|
@ -1566,59 +1562,69 @@ public class QcServiceImpl implements QcService { |
|
|
|
faiRecordData.setMaxValue(itemList.get(j).getMaxValue()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
faiRecordData.setRollQty(data.getRollQty()); // 送检数量 |
|
|
|
// 新增FAI明细记录信息 |
|
|
|
qcMapper.saveFAIDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 获取物料的类别编码 |
|
|
|
String familyId = qcMapper.selectFamilyIdByPartNo(partNo,data.getSite()); |
|
|
|
String attributeType2 = "B"; |
|
|
|
// 获取该类别属性下维护的FAI检验模板 |
|
|
|
List<QcFAIRecordData> familyAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), familyId, attributeType2, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (familyAttribute.size() > 0) { |
|
|
|
// 明细记录信息赋值 |
|
|
|
String partNo = data.getPartNo(); |
|
|
|
String attributeType1 = "A"; |
|
|
|
// 获取该物料属性下维护的FAI检验模板 |
|
|
|
String operationDesc = ""; |
|
|
|
String resourceId = ""; |
|
|
|
if (StringUtils.isNotBlank(data.getOperationDesc())) { |
|
|
|
operationDesc = data.getOperationDesc(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getResourceId())) { |
|
|
|
resourceId = data.getResourceId(); |
|
|
|
} |
|
|
|
partAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), partNo, attributeType1, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
|
|
|
|
if (partAttribute.size() > 0) { |
|
|
|
// 获取检验周期 |
|
|
|
if (familyAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(familyAttribute.get(0).getInspectionCycle()); |
|
|
|
if (partAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(partAttribute.get(0).getInspectionCycle()); |
|
|
|
} |
|
|
|
// 获取抽样数量 |
|
|
|
// 如果该检验模板有维护抽样方案 |
|
|
|
if (StringUtils.isNotBlank(familyAttribute.get(0).getSamplingProgrammeNo())) { |
|
|
|
if (StringUtils.isNotBlank(partAttribute.get(0).getSamplingProgrammeNo())) { |
|
|
|
QcSamplingInspectionProgrammeData samplingInspectionProgrammeData = new QcSamplingInspectionProgrammeData(); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(partAttribute.get(0).getSamplingProgrammeNo()); |
|
|
|
// 获取抽样方案维护的矩阵详情 |
|
|
|
List<QcSamplingInspectionProgrammeData> dataList = qcMapper.searchSamplingProgrammeDetails(samplingInspectionProgrammeData); |
|
|
|
// 根据抽样方案确定抽样数 |
|
|
|
for (QcSamplingInspectionProgrammeData programmeData : dataList) { |
|
|
|
if (programmeData.getSamplingLevelNo().equals(familyAttribute.get(0).getSamplingLevelNo()) && (data.getRollQty().compareTo(programmeData.getMinQty()) == 1 || data.getRollQty().compareTo(programmeData.getMinQty()) == 0) && (data.getRollQty().compareTo(programmeData.getMaxQty()) == -1 || data.getRollQty().compareTo(programmeData.getMaxQty()) == 0) ){ |
|
|
|
if (programmeData.getSamplingLevelNo().equals(partAttribute.get(0).getSamplingLevelNo()) && (data.getRollQty().compareTo(programmeData.getMinQty()) == 1 || data.getRollQty().compareTo(programmeData.getMinQty()) == 0) && (data.getRollQty().compareTo(programmeData.getMaxQty()) == -1 || data.getRollQty().compareTo(programmeData.getMaxQty()) == 0) ){ |
|
|
|
data.setSamplingQty(programmeData.getSamplingQty()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingQuantity() != null) { |
|
|
|
} else if (partAttribute.get(0).getDefaultSamplingQuantity() != null) { |
|
|
|
// 没有维护抽样方案,再根据默认抽样数来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingQuantity()); |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingProportion() != null) { |
|
|
|
data.setSamplingQty(partAttribute.get(0).getDefaultSamplingQuantity()); |
|
|
|
} else if (partAttribute.get(0).getDefaultSamplingProportion() != null) { |
|
|
|
// 也没有维护默认抽样数,最后根据默认抽样比例来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
data.setSamplingQty(partAttribute.get(0).getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取根据该检验模板下维护的检验项目 |
|
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
|
templateData.setSite(data.getSite()); |
|
|
|
templateData.setTemplateId(familyAttribute.get(0).getTemplateId()); |
|
|
|
templateData.setTemplateId(partAttribute.get(0).getTemplateId()); |
|
|
|
templateData.setItemType("D"); |
|
|
|
List<QcTemplateData> itemList = qcMapper.templateDetailsSearch(templateData); |
|
|
|
QcFAIRecordData faiRecordData = new QcFAIRecordData(); |
|
|
|
faiRecordData.setSite(data.getSite()); // 工厂 |
|
|
|
faiRecordData.setInspectionNo(data.getInspectionNo()); // 检验单号 |
|
|
|
faiRecordData.setOrderNo(data.getOrderNo()); // 工单号 |
|
|
|
faiRecordData.setTemplateId(familyAttribute.get(0).getTemplateId()); // 模板编码 |
|
|
|
faiRecordData.setSamplingLevelNo(familyAttribute.get(0).getSamplingLevelNo()); // 检验水平编码 |
|
|
|
faiRecordData.setSamplingLevelDesc(familyAttribute.get(0).getSamplingLevelDesc()); // 检验水平名称 |
|
|
|
faiRecordData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); // 抽样方案编码 |
|
|
|
faiRecordData.setSamplingProgrammeDesc(familyAttribute.get(0).getSamplingProgrammeDesc()); // 抽样方案名称 |
|
|
|
faiRecordData.setAql(familyAttribute.get(0).getAql()); // aql |
|
|
|
faiRecordData.setAc(familyAttribute.get(0).getAc()); // ac |
|
|
|
faiRecordData.setRe(familyAttribute.get(0).getRe()); // re |
|
|
|
faiRecordData.setTemplateId(partAttribute.get(0).getTemplateId()); // 模板编码 |
|
|
|
faiRecordData.setSamplingLevelNo(partAttribute.get(0).getSamplingLevelNo()); // 检验水平编码 |
|
|
|
faiRecordData.setSamplingLevelDesc(partAttribute.get(0).getSamplingLevelDesc()); // 检验水平名称 |
|
|
|
faiRecordData.setSamplingProgrammeNo(partAttribute.get(0).getSamplingProgrammeNo()); // 抽样方案编码 |
|
|
|
faiRecordData.setSamplingProgrammeDesc(partAttribute.get(0).getSamplingProgrammeDesc()); // 抽样方案名称 |
|
|
|
faiRecordData.setAql(partAttribute.get(0).getAql()); // aql |
|
|
|
faiRecordData.setAc(partAttribute.get(0).getAc()); // ac |
|
|
|
faiRecordData.setRe(partAttribute.get(0).getRe()); // re |
|
|
|
for (int j = 0; j < itemList.size(); j++) { |
|
|
|
faiRecordData.setItemNo(itemList.get(j).getItemNo()); // 项目编码 |
|
|
|
faiRecordData.setItemDesc(itemList.get(j).getItemDesc()); // 项目名称 |
|
|
|
@ -1629,9 +1635,75 @@ public class QcServiceImpl implements QcService { |
|
|
|
faiRecordData.setMaxValue(itemList.get(j).getMaxValue()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
// 新增IPQC明细记录信息 |
|
|
|
faiRecordData.setRollQty(data.getRollQty()); // 送检数量 |
|
|
|
// 新增FAI明细记录信息 |
|
|
|
qcMapper.saveFAIDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 获取物料的类别编码 |
|
|
|
String familyId = qcMapper.selectFamilyIdByPartNo(partNo,data.getSite()); |
|
|
|
String attributeType2 = "B"; |
|
|
|
// 获取该类别属性下维护的FAI检验模板 |
|
|
|
List<QcFAIRecordData> familyAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), familyId, attributeType2, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (familyAttribute.size() > 0) { |
|
|
|
// 获取检验周期 |
|
|
|
if (familyAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(familyAttribute.get(0).getInspectionCycle()); |
|
|
|
} |
|
|
|
// 获取抽样数量 |
|
|
|
// 如果该检验模板有维护抽样方案 |
|
|
|
if (StringUtils.isNotBlank(familyAttribute.get(0).getSamplingProgrammeNo())) { |
|
|
|
QcSamplingInspectionProgrammeData samplingInspectionProgrammeData = new QcSamplingInspectionProgrammeData(); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); |
|
|
|
// 获取抽样方案维护的矩阵详情 |
|
|
|
List<QcSamplingInspectionProgrammeData> dataList = qcMapper.searchSamplingProgrammeDetails(samplingInspectionProgrammeData); |
|
|
|
// 根据抽样方案确定抽样数 |
|
|
|
for (QcSamplingInspectionProgrammeData programmeData : dataList) { |
|
|
|
if (programmeData.getSamplingLevelNo().equals(familyAttribute.get(0).getSamplingLevelNo()) && (data.getRollQty().compareTo(programmeData.getMinQty()) == 1 || data.getRollQty().compareTo(programmeData.getMinQty()) == 0) && (data.getRollQty().compareTo(programmeData.getMaxQty()) == -1 || data.getRollQty().compareTo(programmeData.getMaxQty()) == 0) ){ |
|
|
|
data.setSamplingQty(programmeData.getSamplingQty()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingQuantity() != null) { |
|
|
|
// 没有维护抽样方案,再根据默认抽样数来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingQuantity()); |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingProportion() != null) { |
|
|
|
// 也没有维护默认抽样数,最后根据默认抽样比例来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取根据该检验模板下维护的检验项目 |
|
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
|
templateData.setSite(data.getSite()); |
|
|
|
templateData.setTemplateId(familyAttribute.get(0).getTemplateId()); |
|
|
|
templateData.setItemType("D"); |
|
|
|
List<QcTemplateData> itemList = qcMapper.templateDetailsSearch(templateData); |
|
|
|
QcFAIRecordData faiRecordData = new QcFAIRecordData(); |
|
|
|
faiRecordData.setSite(data.getSite()); // 工厂 |
|
|
|
faiRecordData.setInspectionNo(data.getInspectionNo()); // 检验单号 |
|
|
|
faiRecordData.setOrderNo(data.getOrderNo()); // 工单号 |
|
|
|
faiRecordData.setTemplateId(familyAttribute.get(0).getTemplateId()); // 模板编码 |
|
|
|
faiRecordData.setSamplingLevelNo(familyAttribute.get(0).getSamplingLevelNo()); // 检验水平编码 |
|
|
|
faiRecordData.setSamplingLevelDesc(familyAttribute.get(0).getSamplingLevelDesc()); // 检验水平名称 |
|
|
|
faiRecordData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); // 抽样方案编码 |
|
|
|
faiRecordData.setSamplingProgrammeDesc(familyAttribute.get(0).getSamplingProgrammeDesc()); // 抽样方案名称 |
|
|
|
faiRecordData.setAql(familyAttribute.get(0).getAql()); // aql |
|
|
|
faiRecordData.setAc(familyAttribute.get(0).getAc()); // ac |
|
|
|
faiRecordData.setRe(familyAttribute.get(0).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()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
faiRecordData.setRollQty(data.getRollQty()); // 送检数量 |
|
|
|
// 新增IPQC明细记录信息 |
|
|
|
qcMapper.saveFAIDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 新增FAI主记录信息 |
|
|
|
@ -1818,21 +1890,16 @@ public class QcServiceImpl implements QcService { |
|
|
|
String InspectionNo = qcMapper.selectFQCInspectionNo(data); |
|
|
|
data.setInspectionNo("FQC" + InspectionNo); |
|
|
|
data.setState("待检验"); |
|
|
|
// 明细记录信息赋值 |
|
|
|
String partNo = data.getPartNo(); |
|
|
|
String attributeType1 = "A"; |
|
|
|
// 获取该物料属性下维护的FQC检验模板 |
|
|
|
String operationDesc = ""; |
|
|
|
String resourceId = ""; |
|
|
|
if (StringUtils.isNotBlank(data.getOperationDesc())) { |
|
|
|
operationDesc = data.getOperationDesc(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getResourceId())) { |
|
|
|
resourceId = data.getResourceId(); |
|
|
|
} |
|
|
|
List<QcFAIRecordData> partAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), partNo, attributeType1, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (partAttribute.size() > 0) { |
|
|
|
// 获取抽样数量 |
|
|
|
List<QcFAIRecordData> partAttribute; |
|
|
|
// 检查动控是否已开启 |
|
|
|
SysSceneDynamicControlModelEntity controlModel = new SysSceneDynamicControlModelEntity(); |
|
|
|
controlModel.setSite(data.getSite()); |
|
|
|
controlModel.setControlNo("10004"); |
|
|
|
List<SysSceneDynamicControlModelEntity> controlList = qcMapper.queryController(controlModel); |
|
|
|
if ("控制".equals(controlList.get(0).getBaseData())) { |
|
|
|
// 根据用户选择的模板编码获取模板详情 |
|
|
|
partAttribute = qcMapper.selectTemplate(data); |
|
|
|
// 获取检验周期 |
|
|
|
if (partAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(partAttribute.get(0).getInspectionCycle()); |
|
|
|
} |
|
|
|
@ -1885,59 +1952,68 @@ public class QcServiceImpl implements QcService { |
|
|
|
faiRecordData.setMaxValue(itemList.get(j).getMaxValue()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
faiRecordData.setRollQty(data.getRollQty()); // 送检数量 |
|
|
|
// 新增FQC明细记录信息 |
|
|
|
qcMapper.saveFQCDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 获取物料的类别编码 |
|
|
|
String familyId = qcMapper.selectFamilyIdByPartNo(partNo,data.getSite()); |
|
|
|
String attributeType2 = "B"; |
|
|
|
// 获取该类别属性下维护的FQC检验模板 |
|
|
|
List<QcFAIRecordData> familyAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), familyId, attributeType2, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (familyAttribute.size() > 0) { |
|
|
|
// 明细记录信息赋值 |
|
|
|
String partNo = data.getPartNo(); |
|
|
|
String attributeType1 = "A"; |
|
|
|
// 获取该物料属性下维护的FQC检验模板 |
|
|
|
String operationDesc = ""; |
|
|
|
String resourceId = ""; |
|
|
|
if (StringUtils.isNotBlank(data.getOperationDesc())) { |
|
|
|
operationDesc = data.getOperationDesc(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getResourceId())) { |
|
|
|
resourceId = data.getResourceId(); |
|
|
|
} |
|
|
|
partAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), partNo, attributeType1, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (partAttribute.size() > 0) { |
|
|
|
// 获取检验周期 |
|
|
|
if (familyAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(familyAttribute.get(0).getInspectionCycle()); |
|
|
|
if (partAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(partAttribute.get(0).getInspectionCycle()); |
|
|
|
} |
|
|
|
// 获取抽样数量 |
|
|
|
// 如果该检验模板有维护抽样方案 |
|
|
|
if (StringUtils.isNotBlank(familyAttribute.get(0).getSamplingProgrammeNo())) { |
|
|
|
if (StringUtils.isNotBlank(partAttribute.get(0).getSamplingProgrammeNo())) { |
|
|
|
QcSamplingInspectionProgrammeData samplingInspectionProgrammeData = new QcSamplingInspectionProgrammeData(); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(partAttribute.get(0).getSamplingProgrammeNo()); |
|
|
|
// 获取抽样方案维护的矩阵详情 |
|
|
|
List<QcSamplingInspectionProgrammeData> dataList = qcMapper.searchSamplingProgrammeDetails(samplingInspectionProgrammeData); |
|
|
|
// 根据抽样方案确定抽样数 |
|
|
|
for (QcSamplingInspectionProgrammeData programmeData : dataList) { |
|
|
|
if (programmeData.getSamplingLevelNo().equals(familyAttribute.get(0).getSamplingLevelNo()) && (data.getRollQty().compareTo(programmeData.getMinQty()) == 1 || data.getRollQty().compareTo(programmeData.getMinQty()) == 0) && (data.getRollQty().compareTo(programmeData.getMaxQty()) == -1 || data.getRollQty().compareTo(programmeData.getMaxQty()) == 0) ){ |
|
|
|
if (programmeData.getSamplingLevelNo().equals(partAttribute.get(0).getSamplingLevelNo()) && (data.getRollQty().compareTo(programmeData.getMinQty()) == 1 || data.getRollQty().compareTo(programmeData.getMinQty()) == 0) && (data.getRollQty().compareTo(programmeData.getMaxQty()) == -1 || data.getRollQty().compareTo(programmeData.getMaxQty()) == 0) ){ |
|
|
|
data.setSamplingQty(programmeData.getSamplingQty()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingQuantity() != null) { |
|
|
|
} else if (partAttribute.get(0).getDefaultSamplingQuantity() != null) { |
|
|
|
// 没有维护抽样方案,再根据默认抽样数来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingQuantity()); |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingProportion() != null) { |
|
|
|
data.setSamplingQty(partAttribute.get(0).getDefaultSamplingQuantity()); |
|
|
|
} else if (partAttribute.get(0).getDefaultSamplingProportion() != null) { |
|
|
|
// 也没有维护默认抽样数,最后根据默认抽样比例来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
data.setSamplingQty(partAttribute.get(0).getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取根据该检验模板下维护的检验项目 |
|
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
|
templateData.setSite(data.getSite()); |
|
|
|
templateData.setTemplateId(familyAttribute.get(0).getTemplateId()); |
|
|
|
templateData.setTemplateId(partAttribute.get(0).getTemplateId()); |
|
|
|
templateData.setItemType("D"); |
|
|
|
List<QcTemplateData> itemList = qcMapper.templateDetailsSearch(templateData); |
|
|
|
QcFAIRecordData faiRecordData = new QcFAIRecordData(); |
|
|
|
faiRecordData.setSite(data.getSite()); // 工厂 |
|
|
|
faiRecordData.setInspectionNo(data.getInspectionNo()); // 检验单号 |
|
|
|
faiRecordData.setOrderNo(data.getOrderNo()); // 工单号 |
|
|
|
faiRecordData.setTemplateId(familyAttribute.get(0).getTemplateId()); // 模板编码 |
|
|
|
faiRecordData.setSamplingLevelNo(familyAttribute.get(0).getSamplingLevelNo()); // 检验水平编码 |
|
|
|
faiRecordData.setSamplingLevelDesc(familyAttribute.get(0).getSamplingLevelDesc()); // 检验水平名称 |
|
|
|
faiRecordData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); // 抽样方案编码 |
|
|
|
faiRecordData.setSamplingProgrammeDesc(familyAttribute.get(0).getSamplingProgrammeDesc()); // 抽样方案名称 |
|
|
|
faiRecordData.setAql(familyAttribute.get(0).getAql()); // aql |
|
|
|
faiRecordData.setAc(familyAttribute.get(0).getAc()); // ac |
|
|
|
faiRecordData.setRe(familyAttribute.get(0).getRe()); // re |
|
|
|
faiRecordData.setTemplateId(partAttribute.get(0).getTemplateId()); // 模板编码 |
|
|
|
faiRecordData.setSamplingLevelNo(partAttribute.get(0).getSamplingLevelNo()); // 检验水平编码 |
|
|
|
faiRecordData.setSamplingLevelDesc(partAttribute.get(0).getSamplingLevelDesc()); // 检验水平名称 |
|
|
|
faiRecordData.setSamplingProgrammeNo(partAttribute.get(0).getSamplingProgrammeNo()); // 抽样方案编码 |
|
|
|
faiRecordData.setSamplingProgrammeDesc(partAttribute.get(0).getSamplingProgrammeDesc()); // 抽样方案名称 |
|
|
|
faiRecordData.setAql(partAttribute.get(0).getAql()); // aql |
|
|
|
faiRecordData.setAc(partAttribute.get(0).getAc()); // ac |
|
|
|
faiRecordData.setRe(partAttribute.get(0).getRe()); // re |
|
|
|
for (int j = 0; j < itemList.size(); j++) { |
|
|
|
faiRecordData.setItemNo(itemList.get(j).getItemNo()); // 项目编码 |
|
|
|
faiRecordData.setItemDesc(itemList.get(j).getItemDesc()); // 项目名称 |
|
|
|
@ -1948,9 +2024,75 @@ public class QcServiceImpl implements QcService { |
|
|
|
faiRecordData.setMaxValue(itemList.get(j).getMaxValue()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
faiRecordData.setRollQty(data.getRollQty()); // 送检数量 |
|
|
|
// 新增FQC明细记录信息 |
|
|
|
qcMapper.saveFQCDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 获取物料的类别编码 |
|
|
|
String familyId = qcMapper.selectFamilyIdByPartNo(partNo,data.getSite()); |
|
|
|
String attributeType2 = "B"; |
|
|
|
// 获取该类别属性下维护的FQC检验模板 |
|
|
|
List<QcFAIRecordData> familyAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), familyId, attributeType2, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (familyAttribute.size() > 0) { |
|
|
|
// 获取检验周期 |
|
|
|
if (familyAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(familyAttribute.get(0).getInspectionCycle()); |
|
|
|
} |
|
|
|
// 获取抽样数量 |
|
|
|
// 如果该检验模板有维护抽样方案 |
|
|
|
if (StringUtils.isNotBlank(familyAttribute.get(0).getSamplingProgrammeNo())) { |
|
|
|
QcSamplingInspectionProgrammeData samplingInspectionProgrammeData = new QcSamplingInspectionProgrammeData(); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); |
|
|
|
// 获取抽样方案维护的矩阵详情 |
|
|
|
List<QcSamplingInspectionProgrammeData> dataList = qcMapper.searchSamplingProgrammeDetails(samplingInspectionProgrammeData); |
|
|
|
// 根据抽样方案确定抽样数 |
|
|
|
for (QcSamplingInspectionProgrammeData programmeData : dataList) { |
|
|
|
if (programmeData.getSamplingLevelNo().equals(familyAttribute.get(0).getSamplingLevelNo()) && (data.getRollQty().compareTo(programmeData.getMinQty()) == 1 || data.getRollQty().compareTo(programmeData.getMinQty()) == 0) && (data.getRollQty().compareTo(programmeData.getMaxQty()) == -1 || data.getRollQty().compareTo(programmeData.getMaxQty()) == 0) ){ |
|
|
|
data.setSamplingQty(programmeData.getSamplingQty()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingQuantity() != null) { |
|
|
|
// 没有维护抽样方案,再根据默认抽样数来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingQuantity()); |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingProportion() != null) { |
|
|
|
// 也没有维护默认抽样数,最后根据默认抽样比例来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取根据该检验模板下维护的检验项目 |
|
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
|
templateData.setSite(data.getSite()); |
|
|
|
templateData.setTemplateId(familyAttribute.get(0).getTemplateId()); |
|
|
|
templateData.setItemType("D"); |
|
|
|
List<QcTemplateData> itemList = qcMapper.templateDetailsSearch(templateData); |
|
|
|
QcFAIRecordData faiRecordData = new QcFAIRecordData(); |
|
|
|
faiRecordData.setSite(data.getSite()); // 工厂 |
|
|
|
faiRecordData.setInspectionNo(data.getInspectionNo()); // 检验单号 |
|
|
|
faiRecordData.setOrderNo(data.getOrderNo()); // 工单号 |
|
|
|
faiRecordData.setTemplateId(familyAttribute.get(0).getTemplateId()); // 模板编码 |
|
|
|
faiRecordData.setSamplingLevelNo(familyAttribute.get(0).getSamplingLevelNo()); // 检验水平编码 |
|
|
|
faiRecordData.setSamplingLevelDesc(familyAttribute.get(0).getSamplingLevelDesc()); // 检验水平名称 |
|
|
|
faiRecordData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); // 抽样方案编码 |
|
|
|
faiRecordData.setSamplingProgrammeDesc(familyAttribute.get(0).getSamplingProgrammeDesc()); // 抽样方案名称 |
|
|
|
faiRecordData.setAql(familyAttribute.get(0).getAql()); // aql |
|
|
|
faiRecordData.setAc(familyAttribute.get(0).getAc()); // ac |
|
|
|
faiRecordData.setRe(familyAttribute.get(0).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()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
faiRecordData.setRollQty(data.getRollQty()); // 送检数量 |
|
|
|
// 新增FQC明细记录信息 |
|
|
|
qcMapper.saveFQCDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 新增FQC主记录信息 |
|
|
|
@ -2018,7 +2160,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
@Override |
|
|
|
@Transactional |
|
|
|
public void saveFQCSubmitResult(QcFAIRecordData data) { |
|
|
|
for (QcFAIRecordData qcData : data.getSubmitList()){ |
|
|
|
for (QcFAIRecordData qcData : data.getSubmitList()) { |
|
|
|
// 修改主记录标识为已提交 |
|
|
|
qcMapper.updateFQCMasterSubmitFlag(qcData); |
|
|
|
// 修改明细记录标识为已提交 |
|
|
|
@ -2119,6 +2261,32 @@ public class QcServiceImpl implements QcService { |
|
|
|
return new PageUtils(resultList); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 检查动控是否开启 |
|
|
|
* @author: fengyuan_yang |
|
|
|
* @date: 2023/10/18 13:23 |
|
|
|
* @param: [data] |
|
|
|
* @return: com.xujie.sys.modules.sys.entity.SysSceneDynamicControlModelEntity |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public List<SysSceneDynamicControlModelEntity> queryController(SysSceneDynamicControlModelEntity data) { |
|
|
|
List<SysSceneDynamicControlModelEntity> list = qcMapper.queryController(data); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 获取检验模板列表 |
|
|
|
* @author: fengyuan_yang |
|
|
|
* @date: 2023/10/18 13:51 |
|
|
|
* @param: [data] |
|
|
|
* @return: java.util.List<com.xujie.sys.modules.pms.data.QcTemplateData> |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public List<QcTemplateData> queryTemplateList(QcTemplateData data) { |
|
|
|
List<QcTemplateData> list = qcMapper.queryTemplateList(data); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 新增IPQC记录 |
|
|
|
* @author: fengyuan_yang |
|
|
|
@ -2131,20 +2299,15 @@ public class QcServiceImpl implements QcService { |
|
|
|
String InspectionNo = qcMapper.selectIPQCInspectionNo(data); |
|
|
|
data.setInspectionNo("IPQC" + InspectionNo); |
|
|
|
data.setState("待检验"); |
|
|
|
// 明细记录信息赋值 |
|
|
|
String partNo = data.getPartNo(); |
|
|
|
String attributeType1 = "A"; |
|
|
|
// 获取该物料属性下维护的IPQC检验模板 |
|
|
|
String operationDesc = ""; |
|
|
|
String resourceId = ""; |
|
|
|
if (StringUtils.isNotBlank(data.getOperationDesc())) { |
|
|
|
operationDesc = data.getOperationDesc(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getResourceId())) { |
|
|
|
resourceId = data.getResourceId(); |
|
|
|
} |
|
|
|
List<QcFAIRecordData> partAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), partNo, attributeType1, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (partAttribute.size() > 0) { |
|
|
|
List<QcFAIRecordData> partAttribute; |
|
|
|
// 检查动控是否已开启 |
|
|
|
SysSceneDynamicControlModelEntity controlModel = new SysSceneDynamicControlModelEntity(); |
|
|
|
controlModel.setSite(data.getSite()); |
|
|
|
controlModel.setControlNo("10004"); |
|
|
|
List<SysSceneDynamicControlModelEntity> controlList = qcMapper.queryController(controlModel); |
|
|
|
if ("控制".equals(controlList.get(0).getBaseData())) { |
|
|
|
// 根据用户选择的模板编码获取模板详情 |
|
|
|
partAttribute = qcMapper.selectTemplate(data); |
|
|
|
// 获取检验周期 |
|
|
|
if (partAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(partAttribute.get(0).getInspectionCycle()); |
|
|
|
@ -2198,59 +2361,68 @@ public class QcServiceImpl implements QcService { |
|
|
|
faiRecordData.setMaxValue(itemList.get(j).getMaxValue()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
faiRecordData.setRollQty(data.getRollQty()); // 送检数量 |
|
|
|
// 新增IPQC明细记录信息 |
|
|
|
qcMapper.saveIPQCDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 获取物料的类别编码 |
|
|
|
String familyId = qcMapper.selectFamilyIdByPartNo(partNo,data.getSite()); |
|
|
|
String attributeType2 = "B"; |
|
|
|
// 获取该类别属性下维护的IPQC检验模板 |
|
|
|
List<QcFAIRecordData> familyAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), familyId, attributeType2, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (familyAttribute.size() > 0) { |
|
|
|
} else { // 动控未开启 |
|
|
|
// 明细记录信息赋值 |
|
|
|
String partNo = data.getPartNo(); |
|
|
|
String attributeType1 = "A"; |
|
|
|
// 获取该物料属性下维护的IPQC检验模板 |
|
|
|
String operationDesc = ""; |
|
|
|
String resourceId = ""; |
|
|
|
if (StringUtils.isNotBlank(data.getOperationDesc())) { |
|
|
|
operationDesc = data.getOperationDesc(); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(data.getResourceId())) { |
|
|
|
resourceId = data.getResourceId(); |
|
|
|
} |
|
|
|
partAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), partNo, attributeType1, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (partAttribute.size() > 0) { |
|
|
|
// 获取检验周期 |
|
|
|
if (familyAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(familyAttribute.get(0).getInspectionCycle()); |
|
|
|
if (partAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(partAttribute.get(0).getInspectionCycle()); |
|
|
|
} |
|
|
|
// 获取抽样数量 |
|
|
|
// 如果该检验模板有维护抽样方案 |
|
|
|
if (StringUtils.isNotBlank(familyAttribute.get(0).getSamplingProgrammeNo())) { |
|
|
|
if (StringUtils.isNotBlank(partAttribute.get(0).getSamplingProgrammeNo())) { |
|
|
|
QcSamplingInspectionProgrammeData samplingInspectionProgrammeData = new QcSamplingInspectionProgrammeData(); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(partAttribute.get(0).getSamplingProgrammeNo()); |
|
|
|
// 获取抽样方案维护的矩阵详情 |
|
|
|
List<QcSamplingInspectionProgrammeData> dataList = qcMapper.searchSamplingProgrammeDetails(samplingInspectionProgrammeData); |
|
|
|
// 根据抽样方案确定抽样数 |
|
|
|
for (QcSamplingInspectionProgrammeData programmeData : dataList) { |
|
|
|
if (programmeData.getSamplingLevelNo().equals(familyAttribute.get(0).getSamplingLevelNo()) && (data.getRollQty().compareTo(programmeData.getMinQty()) == 1 || data.getRollQty().compareTo(programmeData.getMinQty()) == 0) && (data.getRollQty().compareTo(programmeData.getMaxQty()) == -1 || data.getRollQty().compareTo(programmeData.getMaxQty()) == 0) ){ |
|
|
|
if (programmeData.getSamplingLevelNo().equals(partAttribute.get(0).getSamplingLevelNo()) && (data.getRollQty().compareTo(programmeData.getMinQty()) == 1 || data.getRollQty().compareTo(programmeData.getMinQty()) == 0) && (data.getRollQty().compareTo(programmeData.getMaxQty()) == -1 || data.getRollQty().compareTo(programmeData.getMaxQty()) == 0) ){ |
|
|
|
data.setSamplingQty(programmeData.getSamplingQty()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingQuantity() != null) { |
|
|
|
} else if (partAttribute.get(0).getDefaultSamplingQuantity() != null) { |
|
|
|
// 没有维护抽样方案,再根据默认抽样数来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingQuantity()); |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingProportion() != null) { |
|
|
|
data.setSamplingQty(partAttribute.get(0).getDefaultSamplingQuantity()); |
|
|
|
} else if (partAttribute.get(0).getDefaultSamplingProportion() != null) { |
|
|
|
// 也没有维护默认抽样数,最后根据默认抽样比例来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
data.setSamplingQty(partAttribute.get(0).getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取根据该检验模板下维护的检验项目 |
|
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
|
templateData.setSite(data.getSite()); |
|
|
|
templateData.setTemplateId(familyAttribute.get(0).getTemplateId()); |
|
|
|
templateData.setTemplateId(partAttribute.get(0).getTemplateId()); |
|
|
|
templateData.setItemType("D"); |
|
|
|
List<QcTemplateData> itemList = qcMapper.templateDetailsSearch(templateData); |
|
|
|
QcFAIRecordData faiRecordData = new QcFAIRecordData(); |
|
|
|
faiRecordData.setSite(data.getSite()); // 工厂 |
|
|
|
faiRecordData.setInspectionNo(data.getInspectionNo()); // 检验单号 |
|
|
|
faiRecordData.setOrderNo(data.getOrderNo()); // 工单号 |
|
|
|
faiRecordData.setTemplateId(familyAttribute.get(0).getTemplateId()); // 模板编码 |
|
|
|
faiRecordData.setSamplingLevelNo(familyAttribute.get(0).getSamplingLevelNo()); // 检验水平编码 |
|
|
|
faiRecordData.setSamplingLevelDesc(familyAttribute.get(0).getSamplingLevelDesc()); // 检验水平名称 |
|
|
|
faiRecordData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); // 抽样方案编码 |
|
|
|
faiRecordData.setSamplingProgrammeDesc(familyAttribute.get(0).getSamplingProgrammeDesc()); // 抽样方案名称 |
|
|
|
faiRecordData.setAql(familyAttribute.get(0).getAql()); // aql |
|
|
|
faiRecordData.setAc(familyAttribute.get(0).getAc()); // ac |
|
|
|
faiRecordData.setRe(familyAttribute.get(0).getRe()); // re |
|
|
|
faiRecordData.setTemplateId(partAttribute.get(0).getTemplateId()); // 模板编码 |
|
|
|
faiRecordData.setSamplingLevelNo(partAttribute.get(0).getSamplingLevelNo()); // 检验水平编码 |
|
|
|
faiRecordData.setSamplingLevelDesc(partAttribute.get(0).getSamplingLevelDesc()); // 检验水平名称 |
|
|
|
faiRecordData.setSamplingProgrammeNo(partAttribute.get(0).getSamplingProgrammeNo()); // 抽样方案编码 |
|
|
|
faiRecordData.setSamplingProgrammeDesc(partAttribute.get(0).getSamplingProgrammeDesc()); // 抽样方案名称 |
|
|
|
faiRecordData.setAql(partAttribute.get(0).getAql()); // aql |
|
|
|
faiRecordData.setAc(partAttribute.get(0).getAc()); // ac |
|
|
|
faiRecordData.setRe(partAttribute.get(0).getRe()); // re |
|
|
|
for (int j = 0; j < itemList.size(); j++) { |
|
|
|
faiRecordData.setItemNo(itemList.get(j).getItemNo()); // 项目编码 |
|
|
|
faiRecordData.setItemDesc(itemList.get(j).getItemDesc()); // 项目名称 |
|
|
|
@ -2261,9 +2433,75 @@ public class QcServiceImpl implements QcService { |
|
|
|
faiRecordData.setMaxValue(itemList.get(j).getMaxValue()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
faiRecordData.setRollQty(data.getRollQty()); // 送检数量 |
|
|
|
// 新增IPQC明细记录信息 |
|
|
|
qcMapper.saveIPQCDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// 获取物料的类别编码 |
|
|
|
String familyId = qcMapper.selectFamilyIdByPartNo(partNo,data.getSite()); |
|
|
|
String attributeType2 = "B"; |
|
|
|
// 获取该类别属性下维护的IPQC检验模板 |
|
|
|
List<QcFAIRecordData> familyAttribute = qcMapper.selectPartAttributeByOperationAndResource(data.getSite(), familyId, attributeType2, data.getInspectionTypeNo(),operationDesc, resourceId); |
|
|
|
if (familyAttribute.size() > 0) { |
|
|
|
// 获取检验周期 |
|
|
|
if (familyAttribute.get(0).getInspectionCycle() != null) { |
|
|
|
data.setInspectionCycle(familyAttribute.get(0).getInspectionCycle()); |
|
|
|
} |
|
|
|
// 获取抽样数量 |
|
|
|
// 如果该检验模板有维护抽样方案 |
|
|
|
if (StringUtils.isNotBlank(familyAttribute.get(0).getSamplingProgrammeNo())) { |
|
|
|
QcSamplingInspectionProgrammeData samplingInspectionProgrammeData = new QcSamplingInspectionProgrammeData(); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); |
|
|
|
// 获取抽样方案维护的矩阵详情 |
|
|
|
List<QcSamplingInspectionProgrammeData> dataList = qcMapper.searchSamplingProgrammeDetails(samplingInspectionProgrammeData); |
|
|
|
// 根据抽样方案确定抽样数 |
|
|
|
for (QcSamplingInspectionProgrammeData programmeData : dataList) { |
|
|
|
if (programmeData.getSamplingLevelNo().equals(familyAttribute.get(0).getSamplingLevelNo()) && (data.getRollQty().compareTo(programmeData.getMinQty()) == 1 || data.getRollQty().compareTo(programmeData.getMinQty()) == 0) && (data.getRollQty().compareTo(programmeData.getMaxQty()) == -1 || data.getRollQty().compareTo(programmeData.getMaxQty()) == 0) ){ |
|
|
|
data.setSamplingQty(programmeData.getSamplingQty()); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingQuantity() != null) { |
|
|
|
// 没有维护抽样方案,再根据默认抽样数来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingQuantity()); |
|
|
|
} else if (familyAttribute.get(0).getDefaultSamplingProportion() != null) { |
|
|
|
// 也没有维护默认抽样数,最后根据默认抽样比例来确定 |
|
|
|
data.setSamplingQty(familyAttribute.get(0).getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取根据该检验模板下维护的检验项目 |
|
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
|
templateData.setSite(data.getSite()); |
|
|
|
templateData.setTemplateId(familyAttribute.get(0).getTemplateId()); |
|
|
|
templateData.setItemType("D"); |
|
|
|
List<QcTemplateData> itemList = qcMapper.templateDetailsSearch(templateData); |
|
|
|
QcFAIRecordData faiRecordData = new QcFAIRecordData(); |
|
|
|
faiRecordData.setSite(data.getSite()); // 工厂 |
|
|
|
faiRecordData.setInspectionNo(data.getInspectionNo()); // 检验单号 |
|
|
|
faiRecordData.setOrderNo(data.getOrderNo()); // 工单号 |
|
|
|
faiRecordData.setTemplateId(familyAttribute.get(0).getTemplateId()); // 模板编码 |
|
|
|
faiRecordData.setSamplingLevelNo(familyAttribute.get(0).getSamplingLevelNo()); // 检验水平编码 |
|
|
|
faiRecordData.setSamplingLevelDesc(familyAttribute.get(0).getSamplingLevelDesc()); // 检验水平名称 |
|
|
|
faiRecordData.setSamplingProgrammeNo(familyAttribute.get(0).getSamplingProgrammeNo()); // 抽样方案编码 |
|
|
|
faiRecordData.setSamplingProgrammeDesc(familyAttribute.get(0).getSamplingProgrammeDesc()); // 抽样方案名称 |
|
|
|
faiRecordData.setAql(familyAttribute.get(0).getAql()); // aql |
|
|
|
faiRecordData.setAc(familyAttribute.get(0).getAc()); // ac |
|
|
|
faiRecordData.setRe(familyAttribute.get(0).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()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
faiRecordData.setRollQty(data.getRollQty()); // 送检数量 |
|
|
|
// 新增IPQC明细记录信息 |
|
|
|
qcMapper.saveIPQCDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
// 新增IPQC主记录信息 |
|
|
|
@ -2406,7 +2644,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
@Override |
|
|
|
public Integer checkIPQCSubDetailValue(CheckSubDetailValueVo data) { |
|
|
|
// 获取该项目的子明细值 |
|
|
|
List<SubDetailValues> list = qcMapper.selectIPQCSubDetailValue(data.getInspectionNo(), data.getItemNo()); |
|
|
|
List<SubDetailValues> list = qcMapper.selectIPQCSubDetailValue(data.getInspectionNo(), data.getItemNo(), data.getSite()); |
|
|
|
for (int i = 0; i < list.size(); i++) { |
|
|
|
if (Double.parseDouble(list.get(i).getSubDetailValue()) > data.getMaxValue() || Double.parseDouble(list.get(i).getSubDetailValue()) < data.getMinValue()){ |
|
|
|
return 2; |
|
|
|
|