diff --git a/src/main/java/com/xkrs/newpro/dao/QcItemDao.java b/src/main/java/com/xkrs/newpro/dao/QcItemDao.java index 5f6fef7..96c8852 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcItemDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcItemDao.java @@ -26,6 +26,6 @@ public interface QcItemDao extends JpaRepository, JpaSpec /** * 查询质检项 */ - @Query(value = "SELECT id, no, name, type FROM qc_item ORDER BY create_time ASC", nativeQuery = true) + @Query(value = "SELECT id, no, name, type FROM qc_item WHERE no = ?1 AND name = ?2 ORDER BY create_time ASC", nativeQuery = true) List> queryQcItem(String no, String name); } diff --git a/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java b/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java index 7ca02a3..cb1d55b 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcSourceDao.java @@ -3,8 +3,16 @@ package com.xkrs.newpro.dao; import com.xkrs.newpro.model.entity.QcSourceEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Map; + @Component public interface QcSourceDao extends JpaRepository, JpaSpecificationExecutor { + + @Query(value = "SELECT id, batch_no AS batchNo, machine_no AS machineNo, material_no AS materialNo, mould_no AS mouldNo, variety_no AS varietyNo, qc_item_no AS qcItemNo, qc_value AS qcValue FROM qc_source WHERE batch_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND mould_no = ?4 AND variety_no = ?5 ORDER BY create_time DESC", nativeQuery = true) + List> queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo); + } \ No newline at end of file diff --git a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java index c857685..56c0015 100644 --- a/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java +++ b/src/main/java/com/xkrs/newpro/dao/QcSpecDao.java @@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; +import java.util.List; +import java.util.Map; import java.util.Optional; @Component @@ -21,4 +23,9 @@ public interface QcSpecDao extends JpaRepository, JpaSpec @Query(value = "UPDATE qc_spec SET update_time = ?2, max = ?3, mean = ?4, min = ?5, unit = ?6, method = ?7, standard = ?8, remark = ?9 WHERE id = ?1", nativeQuery = true) void updateQcSpecById(Integer id, String updateTime, String max, String mean, String min, String unit, String method, String standard, String remark); + /** + * 查询质检规格 + */ + @Query(value = "SELECT id, variety_no AS varietyNo, qc_item_no AS qcItemNo, max, mean, min, unit, method, standard, remark FROM qc_spec WHERE variety_no = ? AND qc_item_no = ? ORDER BY create_time ASC", nativeQuery = true) + List> queryQcSpec(String varietyNo, String qcItemNo); } \ No newline at end of file diff --git a/src/main/java/com/xkrs/newpro/service/QcItemService.java b/src/main/java/com/xkrs/newpro/service/QcItemService.java index 02fa2ce..ee0eba0 100644 --- a/src/main/java/com/xkrs/newpro/service/QcItemService.java +++ b/src/main/java/com/xkrs/newpro/service/QcItemService.java @@ -7,17 +7,17 @@ import com.xkrs.newpro.model.qo.QcItemQoUpdate; public interface QcItemService { /** - * 添加质检项 + * 添加检验项目 */ String insertQcItem(QcItemQoInsert insertQo); /** - * 更新质检项名称 + * 更新检验项目名称 */ String updateQcItem(QcItemQoUpdate updateQo); /** - * 查询质检项 + * 查询检验项目 */ String queryQcItem(QcItemQoQuery queryQo); diff --git a/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java b/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java index 0081337..8c81a04 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcItemServiceImpl.java @@ -8,6 +8,7 @@ import com.xkrs.newpro.model.qo.QcItemQoQuery; import com.xkrs.newpro.model.qo.QcItemQoUpdate; import com.xkrs.newpro.service.QcItemService; import com.xkrs.newpro.utils.LocalDateUtils; +import com.xkrs.newpro.utils.LocalStringUtils; import org.springframework.context.i18n.LocaleContextHolder; import javax.annotation.Resource; @@ -27,7 +28,7 @@ public class QcItemServiceImpl implements QcItemService { private QcItemDao qcItemDao; /** - * 添加质检项 + * 添加检验项目 */ @Override public String insertQcItem(QcItemQoInsert insertQo) { @@ -53,7 +54,7 @@ public class QcItemServiceImpl implements QcItemService { } /** - * 更新质检项名称 + * 更新检验项目名称 */ @Transactional(rollbackOn = Exception.class) @Override @@ -73,16 +74,16 @@ public class QcItemServiceImpl implements QcItemService { } /** - * 查询质检项 + * 查询检验项目 */ @Override public String queryQcItem(QcItemQoQuery queryQo) { String no = queryQo.getNo(); String name = queryQo.getName(); - List> resultList = qcItemDao.queryQcItem(no, name); + List> resultList = qcItemDao.queryQcItem(LocalStringUtils.formatEmptyValue(no), LocalStringUtils.formatEmptyValue(name)); if (resultList == null || resultList.isEmpty()) { - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该质检项的信息!", locale); + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验项目的信息!", locale); } return outputEncapsulationObject(PromptMessageEnum.SUCCESS, resultList, locale); } diff --git a/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java b/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java index 45964f4..02fc604 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcSourceServiceImpl.java @@ -7,6 +7,7 @@ import com.xkrs.newpro.model.qo.QcSourceQoInsert; import com.xkrs.newpro.model.qo.QcSourceQoQuery; import com.xkrs.newpro.service.QcSourceService; import com.xkrs.newpro.utils.LocalDateUtils; +import com.xkrs.newpro.utils.LocalStringUtils; import org.springframework.context.i18n.LocaleContextHolder; import javax.annotation.Resource; @@ -54,6 +55,15 @@ public class QcSourceServiceImpl implements QcSourceService { */ @Override public String queryQcSource(QcSourceQoQuery queryQo) { + + String batchNo = queryQo.getBatchNo(); + String machineNo = queryQo.getMachineNo(); + String materialNo = queryQo.getMaterialNo(); + String mouldNo = queryQo.getMouldNo(); + String varietyNo = queryQo.getVarietyNo(); + qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo)); + + return null; } } diff --git a/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java b/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java index 90c17c4..e1a2013 100644 --- a/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java +++ b/src/main/java/com/xkrs/newpro/service/impl/QcSpecServiceImpl.java @@ -14,7 +14,9 @@ import com.xkrs.newpro.utils.LocalStringUtils; import org.springframework.context.i18n.LocaleContextHolder; import javax.annotation.Resource; +import java.util.List; import java.util.Locale; +import java.util.Map; import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -109,6 +111,13 @@ public class QcSpecServiceImpl implements QcSpecService { */ @Override public String queryQcSpec(QcSpecQoQuery queryQo) { - return null; + + String varietyNo = queryQo.getVarietyNo(); + String qcItemNo = queryQo.getQcItemNo(); + List> resultList = qcSpecDao.queryQcSpec(LocalStringUtils.formatEmptyValue(varietyNo), LocalStringUtils.formatEmptyValue(qcItemNo)); + if (resultList == null || resultList.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验规格的信息!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, resultList, locale); } }