|
|
|
@ -2408,6 +2408,148 @@ public class QcServiceImpl implements QcService { |
|
|
|
return collect; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 新增巡检记录 |
|
|
|
* @author: fengyuan_yang |
|
|
|
* @date: 2023/4/28 8:56 |
|
|
|
* @param: [data] |
|
|
|
* @return: void |
|
|
|
**/ |
|
|
|
@Override |
|
|
|
public void saveOsInspection(QcFAIRecordData data) { |
|
|
|
// 查询最大编码,自增后赋值 |
|
|
|
String s = qcMapper.queryLastIPQCInspectionNo(data); |
|
|
|
if (s == null){ |
|
|
|
data.setInspectionNo("10001"); |
|
|
|
}else { |
|
|
|
int no = Integer.parseInt(qcMapper.queryLastIPQCInspectionNo(data)); |
|
|
|
data.setInspectionNo(String.valueOf(++no)); |
|
|
|
} |
|
|
|
data.setState("待检验"); |
|
|
|
data.setCheckType("巡检"); |
|
|
|
// 查询机台和物料名称 |
|
|
|
QcFAIRecordData resourceData = qcMapper.selectResourceDesc(data); |
|
|
|
QcFAIRecordData partData = qcMapper.selectPartDesc(data); |
|
|
|
data.setPartDesc(partData.getPartDesc()); |
|
|
|
data.setResourceDesc(resourceData.getResourceDesc()); |
|
|
|
// 明细记录信息赋值 |
|
|
|
String partNo = data.getPartNo(); |
|
|
|
String attributeType1 = "A"; |
|
|
|
// 获取该物料属性下维护的IPQC检验模板 |
|
|
|
QcFAIRecordData partAttribute = qcMapper.selectPartAttributeByPartNo(partNo, attributeType1, data.getInspectionTypeNo()); |
|
|
|
if (partAttribute != null){ |
|
|
|
data.setInspectionCycle(partAttribute.getInspectionCycle()); |
|
|
|
// 获取抽样数量 |
|
|
|
QcSamplingInspectionProgrammeData samplingInspectionProgrammeData = new QcSamplingInspectionProgrammeData(); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(partAttribute.getSamplingProgrammeNo()); |
|
|
|
// 获取抽样方案维护的矩阵详情 |
|
|
|
List<QcSamplingInspectionProgrammeData> dataList = qcMapper.searchSamplingProgrammeDetails(samplingInspectionProgrammeData); |
|
|
|
// 先根据抽样方案确定抽样数 |
|
|
|
for (int a = 0; a < dataList.size(); a++) { |
|
|
|
if (dataList.get(a).getSamplingLevelNo() == partAttribute.getSamplingLevelNo() && (data.getRollQty().compareTo(dataList.get(a).getMinQty()) == 1 || data.getRollQty().compareTo(dataList.get(a).getMinQty()) == 0) && (data.getRollQty().compareTo(dataList.get(a).getMaxQty()) == -1 || data.getRollQty().compareTo(dataList.get(a).getMaxQty()) == 0) ){ |
|
|
|
data.setSamplingQty(dataList.get(a).getSamplingQty()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 再根据默认抽样数来确定 |
|
|
|
if (data.getSamplingQty() == null){ |
|
|
|
data.setSamplingQty(partAttribute.getDefaultSamplingQuantity()); |
|
|
|
} |
|
|
|
// 再根据默认抽样比例来确定 |
|
|
|
if (data.getSamplingQty() == null){ |
|
|
|
data.setSamplingQty(partAttribute.getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取根据该检验模板下维护的检验项目 |
|
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
|
templateData.setTemplateId(partAttribute.getTemplateId()); |
|
|
|
templateData.setItemType("D"); |
|
|
|
List<QcTemplateData> itemList = qcMapper.ItemDetailsSearch(templateData); |
|
|
|
QcFAIRecordData faiRecordData = new QcFAIRecordData(); |
|
|
|
faiRecordData.setInspectionNo(data.getInspectionNo()); // 检验单号 |
|
|
|
faiRecordData.setOrderNo(data.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()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
// 新增IPQC明细记录信息 |
|
|
|
qcMapper.saveIPQCDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
}else { |
|
|
|
// 获取物料的类别编码 |
|
|
|
String familyId = qcMapper.selectFamilyIdByPartNo(partNo,data.getSite()); |
|
|
|
String attributeType2 = "B"; |
|
|
|
// 获取该类别属性下维护的IPQC检验模板 |
|
|
|
QcFAIRecordData familyAttribute = qcMapper.selectFamilyAttributeByFamilyId(familyId, attributeType2, data.getInspectionTypeNo()); |
|
|
|
data.setInspectionCycle(familyAttribute.getInspectionCycle()); |
|
|
|
|
|
|
|
// 获取抽样数量 |
|
|
|
QcSamplingInspectionProgrammeData samplingInspectionProgrammeData = new QcSamplingInspectionProgrammeData(); |
|
|
|
samplingInspectionProgrammeData.setSamplingProgrammeNo(familyAttribute.getSamplingProgrammeNo()); |
|
|
|
// 获取抽样方案维护的矩阵详情 |
|
|
|
List<QcSamplingInspectionProgrammeData> dataList = qcMapper.searchSamplingProgrammeDetails(samplingInspectionProgrammeData); |
|
|
|
// 先根据抽样方案确定抽样数 |
|
|
|
for (int a = 0; a < dataList.size(); a++) { |
|
|
|
if (dataList.get(a).getSamplingLevelNo() == familyAttribute.getSamplingLevelNo() && (data.getRollQty().compareTo(dataList.get(a).getMinQty()) == 1 || data.getRollQty().compareTo(dataList.get(a).getMinQty()) == 0) && (data.getRollQty().compareTo(dataList.get(a).getMaxQty()) == -1 || data.getRollQty().compareTo(dataList.get(a).getMaxQty()) == 0) ){ |
|
|
|
data.setSamplingQty(dataList.get(a).getSamplingQty()); |
|
|
|
} |
|
|
|
} |
|
|
|
// 再根据默认抽样数来确定 |
|
|
|
if (data.getSamplingQty() == null){ |
|
|
|
data.setSamplingQty(familyAttribute.getDefaultSamplingQuantity()); |
|
|
|
} |
|
|
|
// 再根据默认抽样比例来确定 |
|
|
|
if (data.getSamplingQty() == null){ |
|
|
|
data.setSamplingQty(familyAttribute.getDefaultSamplingProportion().multiply(data.getRollQty()).divide(new BigDecimal(100),3,BigDecimal.ROUND_HALF_UP)); |
|
|
|
} |
|
|
|
|
|
|
|
// 获取根据该检验模板下维护的检验项目 |
|
|
|
QcTemplateData templateData = new QcTemplateData(); |
|
|
|
templateData.setTemplateId(familyAttribute.getTemplateId()); |
|
|
|
templateData.setItemType("D"); |
|
|
|
List<QcTemplateData> itemList = qcMapper.ItemDetailsSearch(templateData); |
|
|
|
QcFAIRecordData faiRecordData = new QcFAIRecordData(); |
|
|
|
faiRecordData.setInspectionNo(data.getInspectionNo()); // 检验单号 |
|
|
|
faiRecordData.setOrderNo(data.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()); // 最大值 |
|
|
|
faiRecordData.setValueType(itemList.get(j).getValueType()); // 检测值类型 |
|
|
|
faiRecordData.setValueTypeDb(itemList.get(j).getValueTypeDb()); |
|
|
|
// 新增IPQC明细记录信息 |
|
|
|
qcMapper.saveIPQCDetailedRecord(faiRecordData); |
|
|
|
} |
|
|
|
} |
|
|
|
// 新增IPQC主记录信息 |
|
|
|
qcMapper.saveIPQCRecord(data); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|