Browse Source

2023-11-13,设备和质量修改

java8
杨奉源 2 years ago
parent
commit
8091fc7721
  1. 9
      src/main/java/com/xujie/sys/modules/pms/data/SubDetailValues.java
  2. 2
      src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java
  3. 32
      src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java
  4. 37
      src/main/resources/mapper/pms/QcMapper.xml

9
src/main/java/com/xujie/sys/modules/pms/data/SubDetailValues.java

@ -18,6 +18,15 @@ public class SubDetailValues {
private String isSubmit; private String isSubmit;
// 抽样位置B // 抽样位置B
private String samplingLocationB; private String samplingLocationB;
private String flag;
public String getFlag() {
return flag;
}
public void setFlag(String flag) {
this.flag = flag;
}
public String getSamplingLocationB() { public String getSamplingLocationB() {
return samplingLocationB; return samplingLocationB;

2
src/main/java/com/xujie/sys/modules/pms/mapper/QcMapper.java

@ -432,4 +432,6 @@ public interface QcMapper {
List<QcFAIRecordData> queryPartList(QcFAIRecordData data); List<QcFAIRecordData> queryPartList(QcFAIRecordData data);
List<QcFAIRecordData> umSearch(QcFAIRecordData data); List<QcFAIRecordData> umSearch(QcFAIRecordData data);
SubDetailValues checkItem(SubDetailValues task);
} }

32
src/main/java/com/xujie/sys/modules/pms/service/Impl/QcServiceImpl.java

@ -11,6 +11,9 @@ import com.xujie.sys.modules.pms.service.QcService;
import com.xujie.sys.modules.pms.util.ResponseData; import com.xujie.sys.modules.pms.util.ResponseData;
import com.xujie.sys.modules.sys.entity.SysSceneDynamicControlModelEntity; import com.xujie.sys.modules.sys.entity.SysSceneDynamicControlModelEntity;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -22,6 +25,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.InputStream; import java.io.InputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -3294,8 +3298,11 @@ public class QcServiceImpl implements QcService {
int rows = sheet.getPhysicalNumberOfRows(); int rows = sheet.getPhysicalNumberOfRows();
// 新建集合 // 新建集合
ArrayList<SubDetailValues> SubDetailList = new ArrayList<>(); ArrayList<SubDetailValues> SubDetailList = new ArrayList<>();
// 遍历每一行从第二行开始
for (int j = 1; j < rows; j++) {
// 创建集合存放错误信息
ArrayList<Integer> errInfo1 = new ArrayList<>();
ArrayList<Integer> errInfo2 = new ArrayList<>();
// 遍历每一行, 从第三行开始
for (int j = 2; j < rows; j++) {
// 创建对象 // 创建对象
SubDetailValues task = new SubDetailValues(); SubDetailValues task = new SubDetailValues();
// 获得该行 // 获得该行
@ -3303,28 +3310,43 @@ public class QcServiceImpl implements QcService {
// 为对象赋值 // 为对象赋值
task.setSite(data.getSite()); task.setSite(data.getSite());
task.setInspectionNo(data.getInspectionNo()); task.setInspectionNo(data.getInspectionNo());
if (row.getCell(0) == null) {
task.setItemNo(null);
if (row.getCell(0) == null || "".equals(row.getCell(0).getStringCellValue())) {
// task.setItemNo(null);
errInfo1.add(j + 1);
} else { } else {
row.getCell(0).setCellType(CellType.STRING); // 强转类型为String
task.setItemNo(row.getCell(0).getStringCellValue()); task.setItemNo(row.getCell(0).getStringCellValue());
// 判断项目是否合规
task.setFlag(data.getFlag());
SubDetailValues itemData = qcMapper.checkItem(task);
if (itemData == null) { // 明细中不存在该项目
errInfo2.add(j + 1);
}
} }
if (row.getCell(1) == null) { if (row.getCell(1) == null) {
task.setSamplingLocation(null); task.setSamplingLocation(null);
} else { } else {
row.getCell(1).setCellType(CellType.STRING);
task.setSamplingLocation(row.getCell(1).getStringCellValue()); task.setSamplingLocation(row.getCell(1).getStringCellValue());
} }
if (row.getCell(2) == null) { if (row.getCell(2) == null) {
task.setSamplingLocationB(null); task.setSamplingLocationB(null);
} else { } else {
row.getCell(2).setCellType(CellType.STRING);
task.setSamplingLocationB(row.getCell(2).getStringCellValue()); task.setSamplingLocationB(row.getCell(2).getStringCellValue());
} }
if (row.getCell(3) == null) { if (row.getCell(3) == null) {
task.setSubDetailValue(null); task.setSubDetailValue(null);
} else { } else {
row.getCell(3).setCellType(CellType.STRING);
task.setSubDetailValue(row.getCell(3).getStringCellValue()); task.setSubDetailValue(row.getCell(3).getStringCellValue());
} }
SubDetailList.add(task); SubDetailList.add(task);
} }
// 查看错误信息
if (errInfo1.size() > 0 || errInfo2.size() > 0) {
throw new RuntimeException("请检查:导入模板中的第 " + errInfo1.toString() + " 行项目编码为空;请检查:导入模板中的第 " + errInfo2.toString() + " 行项目编码不在本次检验单中");
}
// 新增子明细 // 新增子明细
if ("IPQC".equals(data.getFlag())) { if ("IPQC".equals(data.getFlag())) {
qcMapper.saveIPQCSubDetailed(SubDetailList); qcMapper.saveIPQCSubDetailed(SubDetailList);
@ -3336,7 +3358,7 @@ public class QcServiceImpl implements QcService {
qcMapper.saveIQCSubDetailed(SubDetailList); qcMapper.saveIQCSubDetailed(SubDetailList);
} }
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException("导入失败:"+e.getMessage());
throw new RuntimeException(e.getMessage());
} }
} }

37
src/main/resources/mapper/pms/QcMapper.xml

@ -1496,10 +1496,10 @@
AND operation_desc LIKE '%' + #{query.operationDesc} + '%' AND operation_desc LIKE '%' + #{query.operationDesc} + '%'
</if> </if>
<if test="query.startDate != null"> <if test="query.startDate != null">
AND task_date >= #{query.startDate}
AND inspector_date >= #{query.startDate}
</if> </if>
<if test="query.endDate != null"> <if test="query.endDate != null">
AND #{query.endDate} >= task_date
AND #{query.endDate} >= inspector_date
</if> </if>
</where> </where>
ORDER BY ORDER BY
@ -1781,10 +1781,10 @@
AND operation_desc LIKE '%' + #{query.operationDesc} + '%' AND operation_desc LIKE '%' + #{query.operationDesc} + '%'
</if> </if>
<if test="query.startDate != null"> <if test="query.startDate != null">
AND task_date >= #{query.startDate}
AND inspector_date >= #{query.startDate}
</if> </if>
<if test="query.endDate != null"> <if test="query.endDate != null">
AND #{query.endDate} >= task_date
AND #{query.endDate} >= inspector_date
</if> </if>
</where> </where>
ORDER BY ORDER BY
@ -2078,10 +2078,10 @@
AND part_desc LIKE '%' + #{query.partDesc} + '%' AND part_desc LIKE '%' + #{query.partDesc} + '%'
</if> </if>
<if test="query.startDate != null"> <if test="query.startDate != null">
AND create_date >= #{query.startDate}
AND inspector_date >= #{query.startDate}
</if> </if>
<if test="query.endDate != null"> <if test="query.endDate != null">
AND #{query.endDate} >= create_date
AND #{query.endDate} >= inspector_date
</if> </if>
</where> </where>
ORDER BY ORDER BY
@ -2367,10 +2367,10 @@
AND operation_desc LIKE '%' + #{query.operationDesc} + '%' AND operation_desc LIKE '%' + #{query.operationDesc} + '%'
</if> </if>
<if test="query.startDate != null"> <if test="query.startDate != null">
AND task_date >= #{query.startDate}
AND inspector_date >= #{query.startDate}
</if> </if>
<if test="query.endDate != null"> <if test="query.endDate != null">
AND #{query.endDate} >= task_date
AND #{query.endDate} >= inspector_date
</if> </if>
</where> </where>
ORDER BY ORDER BY
@ -2733,6 +2733,27 @@
WHERE site = #{site} and active = #{active} WHERE site = #{site} and active = #{active}
</select> </select>
<!-- 查询单位列表 -->
<select id="checkItem" resultType="SubDetailValues" parameterType="SubDetailValues">
SELECT
site,
inspection_no,
item_no
<if test = "flag == 'IPQC'">
FROM qc_ipqc_detailed_record
</if>
<if test = "flag == 'IQC'">
FROM qc_iqc_detailed_record
</if>
<if test = "flag == 'FQC'">
FROM qc_fqc_detailed_record
</if>
<if test = "flag == 'FAI'">
FROM qc_fai_detailed_record
</if>
WHERE site = #{site} and inspection_no = #{inspectionNo} and item_no = #{itemNo}
</select>
</mapper> </mapper>

Loading…
Cancel
Save