添加工艺项目

This commit is contained in:
liuchengqian 2022-03-16 12:53:49 +08:00
parent a8486953bc
commit 31d41e971c
19 changed files with 157 additions and 76 deletions

View File

@ -34,8 +34,8 @@ public class QcSourceController {
* 查询检验数据
*/
@GetMapping("/queryQcSource")
public String queryQcSource(@RequestParam(required = false, value = "batchNo") String batchNo, @RequestParam(required = false, value = "machineNo") String machineNo, @RequestParam(required = false, value = "materialNo") String materialNo, @RequestParam(required = false, value = "mouldNo") String mouldNo, @RequestParam(required = false, value = "varietyNo") String varietyNo) {
return qcSourceService.queryQcSource(batchNo, machineNo, materialNo, mouldNo, varietyNo);
public String queryQcSource(@RequestParam(required = false, value = "batchNo") String batchNo, @RequestParam(required = false, value = "machineNo") String machineNo, @RequestParam(required = false, value = "materialNo") String materialNo, @RequestParam(required = false, value = "mouldNo") String mouldNo, @RequestParam(required = false, value = "varietyNo") String varietyNo, @RequestParam(required = false, value = "craftItemNo") String craftItemNo) {
return qcSourceService.queryQcSource(batchNo, machineNo, materialNo, mouldNo, varietyNo, craftItemNo);
}
}

View File

@ -42,8 +42,8 @@ public class QcSpecController {
* 查询检验规格
*/
@GetMapping("/queryQcSpec")
public String queryQcSpec(@RequestParam(required = false, value = "varietyNo") String varietyNo, @RequestParam(required = false, value = "qcItemNo") String qcItemNo) {
return qcSpecService.queryQcSpec(varietyNo, qcItemNo);
public String queryQcSpec(@RequestParam(required = false, value = "varietyNo") String varietyNo, @RequestParam(required = false, value = "craftItemNo") String craftItemNo, @RequestParam(required = false, value = "qcItemNo") String qcItemNo) {
return qcSpecService.queryQcSpec(varietyNo, craftItemNo, qcItemNo);
}
}

View File

@ -18,19 +18,19 @@ import java.util.Optional;
@Component
public interface CraftItemDao extends JpaRepository<CraftItemEntity, Integer>, JpaSpecificationExecutor<CraftItemEntity> {
Optional<CraftItemEntity> findByNo(String no);
Optional<CraftItemEntity> findByCraftItemNo(String no);
/**
* 更新工艺项目名称
*/
@Transactional(rollbackOn = Exception.class)
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE craft_item SET update_time = ?2, name = ?3 WHERE id = ?1", nativeQuery = true)
@Query(value = "UPDATE craft_item SET update_time = ?2, craft_item_name = ?3 WHERE id = ?1", nativeQuery = true)
void updateNameById(Integer id, String updateTime, String name);
/**
* 查询工艺项目
*/
@Query(value = "SELECT id, no, name FROM craft_item WHERE no LIKE %?1% AND name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
@Query(value = "SELECT id AS id, craft_item_no AS no, craft_item_name AS name FROM craft_item WHERE craft_item_no LIKE %?1% AND craft_item_name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
List<Map<String, Object>> queryCraftItem(String no, String name);
}

View File

@ -17,18 +17,18 @@ import java.util.Optional;
@Component
public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpecificationExecutor<QcItemEntity> {
Optional<QcItemEntity> findByNo(String no);
Optional<QcItemEntity> findByQcItemNo(String no);
/**
* 更新检验项目名称
*/
@Modifying(clearAutomatically = true)
@Query(value = "UPDATE qc_item SET update_time = ?2, name = ?3 WHERE id = ?1", nativeQuery = true)
@Query(value = "UPDATE qc_item SET update_time = ?2, qc_item_name = ?3 WHERE id = ?1", nativeQuery = true)
void updateNameById(Integer id, String updateTime, String name);
/**
* 查询检验项目
*/
@Query(value = "SELECT id, no, name, type FROM qc_item WHERE no LIKE %?1% AND name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
@Query(value = "SELECT id AS id, qc_item_no AS no, qc_item_name AS name, qc_item_type AS type FROM qc_item WHERE qc_item_no LIKE %?1% AND qc_item_name LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
List<Map<String, Object>> queryQcItem(String no, String name);
}

View File

@ -15,7 +15,7 @@ import java.util.Map;
@Component
public interface QcSourceDao extends JpaRepository<QcSourceEntity, Integer>, JpaSpecificationExecutor<QcSourceEntity> {
@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 LIKE %?1% AND machine_no LIKE %?2% AND material_no LIKE %?3% AND mould_no LIKE %?4% AND variety_no LIKE %?5% ORDER BY create_time DESC", nativeQuery = true)
List<Map<String, Object>> queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo);
@Query(value = "SELECT id, batch_no AS batchNo, machine_no AS machineNo, material_no AS materialNo, mould_no AS mouldNo, variety_no AS varietyNo, craft_item_no AS craftItemNo, qc_item_no AS qcItemNo, qc_value AS qcValue FROM qc_source WHERE batch_no LIKE %?1% AND machine_no LIKE %?2% AND material_no LIKE %?3% AND mould_no LIKE %?4% AND variety_no LIKE %?5% AND craft_item_no LIKE %?6% ORDER BY create_time DESC", nativeQuery = true)
List<Map<String, Object>> queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo, String craftItemNo);
}

View File

@ -14,7 +14,8 @@ import java.util.Optional;
@Component
public interface QcSpecDao extends JpaRepository<QcSpecEntity, Integer>, JpaSpecificationExecutor<QcSpecEntity> {
Optional<QcSpecEntity> findByVarietyNoAndQcItemNo(String varietyNo, String qcItemNo);
@Query(value = "SELECT * FROM qc_spec WHERE variety_no = ?1 AND craft_item_no = ?2 AND qc_item_no = ?3 ORDER BY create_time ASC", nativeQuery = true)
Optional<QcSpecEntity> findExistsQcSpec(String varietyNo, String craftItemNo, String qcItemNo);
/**
* 更新检验规格
@ -26,6 +27,6 @@ public interface QcSpecDao extends JpaRepository<QcSpecEntity, Integer>, JpaSpec
/**
* 查询检验规格
*/
@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 LIKE %?1% AND qc_item_no LIKE %?2% ORDER BY create_time ASC", nativeQuery = true)
List<Map<String, Object>> queryQcSpec(String varietyNo, String qcItemNo);
@Query(value = "SELECT id, variety_no AS varietyNo, craft_item_no AS craftItemNo, qc_item_no AS qcItemNo, max, mean, min, unit, method, standard, remark FROM qc_spec WHERE variety_no LIKE %?1% AND craft_item_no LIKE %?2% AND qc_item_no LIKE %?3% ORDER BY create_time ASC", nativeQuery = true)
List<Map<String, Object>> queryQcSpec(String varietyNo, String craftItemNo, String qcItemNo);
}

View File

@ -33,13 +33,13 @@ public class CraftItemEntity {
* 编号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String no;
private String craftItemNo;
/**
* 名称
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String name;
private String craftItemName;
public CraftItemEntity() {
}
@ -68,24 +68,24 @@ public class CraftItemEntity {
this.updateTime = updateTime;
}
public String getNo() {
return no;
public String getCraftItemNo() {
return craftItemNo;
}
public void setNo(String no) {
this.no = no;
public void setCraftItemNo(String craftItemNo) {
this.craftItemNo = craftItemNo;
}
public String getName() {
return name;
public String getCraftItemName() {
return craftItemName;
}
public void setName(String name) {
this.name = name;
public void setCraftItemName(String craftItemName) {
this.craftItemName = craftItemName;
}
@Override
public String toString() {
return "CraftItemEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", no='" + no + '\'' + ", name='" + name + '\'' + '}';
return "CraftItemEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", craftItemNo='" + craftItemNo + '\'' + ", craftItemName='" + craftItemName + '\'' + '}';
}
}

View File

@ -33,13 +33,13 @@ public class QcItemEntity {
* 编号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String no;
private String qcItemNo;
/**
* 名称
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String name;
private String qcItemName;
/**
* 类型
@ -47,7 +47,7 @@ public class QcItemEntity {
* "1":图片格式
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String type;
private String qcItemType;
public QcItemEntity() {
}
@ -76,32 +76,32 @@ public class QcItemEntity {
this.updateTime = updateTime;
}
public String getNo() {
return no;
public String getQcItemNo() {
return qcItemNo;
}
public void setNo(String no) {
this.no = no;
public void setQcItemNo(String qcItemNo) {
this.qcItemNo = qcItemNo;
}
public String getName() {
return name;
public String getQcItemName() {
return qcItemName;
}
public void setName(String name) {
this.name = name;
public void setQcItemName(String qcItemName) {
this.qcItemName = qcItemName;
}
public String getType() {
return type;
public String getQcItemType() {
return qcItemType;
}
public void setType(String type) {
this.type = type;
public void setQcItemType(String qcItemType) {
this.qcItemType = qcItemType;
}
@Override
public String toString() {
return "QcItemEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", no='" + no + '\'' + ", name='" + name + '\'' + ", type='" + type + '\'' + '}';
return "QcItemEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcItemName='" + qcItemName + '\'' + ", qcItemType='" + qcItemType + '\'' + '}';
}
}

View File

@ -53,6 +53,12 @@ public class QcSourceEntity {
@Column(length = 85, columnDefinition = "varchar(85)")
private String varietyNo;
/**
* 工艺项目编号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String craftItemNo;
/**
* 检验项目编号
*/
@ -124,6 +130,14 @@ public class QcSourceEntity {
this.varietyNo = varietyNo;
}
public String getCraftItemNo() {
return craftItemNo;
}
public void setCraftItemNo(String craftItemNo) {
this.craftItemNo = craftItemNo;
}
public String getQcItemNo() {
return qcItemNo;
}
@ -142,6 +156,6 @@ public class QcSourceEntity {
@Override
public String toString() {
return "QcSourceEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcValue='" + qcValue + '\'' + '}';
return "QcSourceEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", craftItemNo='" + craftItemNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcValue='" + qcValue + '\'' + '}';
}
}

View File

@ -35,6 +35,12 @@ public class QcSpecEntity {
@Column(length = 85, columnDefinition = "varchar(85)")
private String varietyNo;
/**
* 工艺项目编号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String craftItemNo;
/**
* 检验项目编号
*/
@ -118,6 +124,14 @@ public class QcSpecEntity {
this.varietyNo = varietyNo;
}
public String getCraftItemNo() {
return craftItemNo;
}
public void setCraftItemNo(String craftItemNo) {
this.craftItemNo = craftItemNo;
}
public String getQcItemNo() {
return qcItemNo;
}
@ -184,6 +198,6 @@ public class QcSpecEntity {
@Override
public String toString() {
return "QcSpecEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}';
return "QcSpecEntity{" + "id=" + id + ", createTime='" + createTime + '\'' + ", updateTime='" + updateTime + '\'' + ", varietyNo='" + varietyNo + '\'' + ", craftItemNo='" + craftItemNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}';
}
}

View File

@ -39,6 +39,12 @@ public class QcSourceQoInsert {
@NotBlank(message = "{QcSourceEntity.varietyNo.blank}", groups = {QcSourceQoInsertVa.class})
private String varietyNo;
/**
* 机种号
*/
@NotBlank(message = "{QcSourceEntity.craftItemNo.blank}", groups = {QcSourceQoInsertVa.class})
private String craftItemNo;
/**
* 检验项目编号
*/
@ -93,6 +99,14 @@ public class QcSourceQoInsert {
this.varietyNo = varietyNo;
}
public String getCraftItemNo() {
return craftItemNo;
}
public void setCraftItemNo(String craftItemNo) {
this.craftItemNo = craftItemNo;
}
public String getQcItemNo() {
return qcItemNo;
}
@ -111,6 +125,6 @@ public class QcSourceQoInsert {
@Override
public String toString() {
return "QcSourceQoInsert{" + "batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcValue='" + qcValue + '\'' + '}';
return "QcSourceQoInsert{" + "batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", craftItemNo='" + craftItemNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", qcValue='" + qcValue + '\'' + '}';
}
}

View File

@ -15,6 +15,12 @@ public class QcSpecQoInsert {
@NotBlank(message = "{QcSpecEntity.varietyNo.blank}", groups = {QcSpecQoInsertVa.class})
private String varietyNo;
/**
* 工艺项目编号
*/
@NotBlank(message = "{QcSpecEntity.craftItemNo.blank}", groups = {QcSpecQoInsertVa.class})
private String craftItemNo;
/**
* 检验项目编号
*/
@ -67,6 +73,14 @@ public class QcSpecQoInsert {
this.varietyNo = varietyNo;
}
public String getCraftItemNo() {
return craftItemNo;
}
public void setCraftItemNo(String craftItemNo) {
this.craftItemNo = craftItemNo;
}
public String getQcItemNo() {
return qcItemNo;
}
@ -133,6 +147,6 @@ public class QcSpecQoInsert {
@Override
public String toString() {
return "QcSpecQoInsert{" + "varietyNo='" + varietyNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}';
return "QcSpecQoInsert{" + "varietyNo='" + varietyNo + '\'' + ", craftItemNo='" + craftItemNo + '\'' + ", qcItemNo='" + qcItemNo + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", method='" + method + '\'' + ", standard='" + standard + '\'' + ", remark='" + remark + '\'' + '}';
}
}

View File

@ -19,6 +19,6 @@ public interface QcSourceService {
/**
* 查询检验数据
*/
String queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo);
String queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo, String craftItemNo);
}

View File

@ -24,6 +24,6 @@ public interface QcSpecService {
/**
* 查询检验规格
*/
String queryQcSpec(String varietyNo, String qcItemNo);
String queryQcSpec(String varietyNo, String craftItemNo, String qcItemNo);
}

View File

@ -35,15 +35,15 @@ public class CraftItemServiceImpl implements CraftItemService {
public String insertCraftItem(CraftItemQoInsert insertQo) {
String no = insertQo.getNo();
String name = insertQo.getName();
Optional<CraftItemEntity> entityByNo = craftItemDao.findByNo(no);
Optional<CraftItemEntity> entityByNo = craftItemDao.findByCraftItemNo(no);
if (entityByNo.isPresent()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该工艺项目已存在,请勿重复添加!", locale);
}
CraftItemEntity entity = new CraftItemEntity();
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
entity.setUpdateTime("");
entity.setNo(LocalStringUtils.formatEmptyValue(no));
entity.setName(LocalStringUtils.formatEmptyValue(name));
entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(no));
entity.setCraftItemName(LocalStringUtils.formatEmptyValue(name));
craftItemDao.save(entity);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}

View File

@ -88,7 +88,7 @@ public class FileServiceImpl implements FileService {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
}
String fileUploadPath = fileEntity.get().getFileUploadPath();
List<Map<String, Object>> resultList = qcSourceDao.queryQcSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo);
List<Map<String, Object>> resultList = qcSourceDao.queryQcSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, "");
if (resultList == null || resultList.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
}

View File

@ -37,16 +37,16 @@ public class QcItemServiceImpl implements QcItemService {
String no = insertQo.getNo();
String name = insertQo.getName();
String type = insertQo.getType();
Optional<QcItemEntity> entityByNo = qcItemDao.findByNo(no);
Optional<QcItemEntity> entityByNo = qcItemDao.findByQcItemNo(no);
if (entityByNo.isPresent()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该检验项目已存在,请勿重复添加!", locale);
}
QcItemEntity entity = new QcItemEntity();
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
entity.setUpdateTime("");
entity.setNo(LocalStringUtils.formatEmptyValue(no));
entity.setName(LocalStringUtils.formatEmptyValue(name));
entity.setType(LocalStringUtils.formatEmptyValue(type));
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(no));
entity.setQcItemName(LocalStringUtils.formatEmptyValue(name));
entity.setQcItemType(LocalStringUtils.formatEmptyValue(type));
qcItemDao.save(entity);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}

View File

@ -1,9 +1,11 @@
package com.xkrs.service.impl;
import com.xkrs.dao.CraftItemDao;
import com.xkrs.dao.QcItemDao;
import com.xkrs.dao.QcSourceDao;
import com.xkrs.dao.QcSpecDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.CraftItemEntity;
import com.xkrs.model.entity.QcItemEntity;
import com.xkrs.model.entity.QcSourceEntity;
import com.xkrs.model.entity.QcSpecEntity;
@ -31,6 +33,9 @@ public class QcSourceServiceImpl implements QcSourceService {
private Locale locale = LocaleContextHolder.getLocale();
@Resource
private CraftItemDao craftItemDao;
@Resource
private QcItemDao qcItemDao;
@ -50,13 +55,18 @@ public class QcSourceServiceImpl implements QcSourceService {
String materialNo = insertQo.getMaterialNo();
String mouldNo = insertQo.getMouldNo();
String varietyNo = insertQo.getVarietyNo();
String craftItemNo = insertQo.getCraftItemNo();
String qcItemNo = insertQo.getQcItemNo();
String qcValue = insertQo.getQcValue();
Optional<QcItemEntity> qcItemEntityByNo = qcItemDao.findByNo(qcItemNo);
if (qcItemEntityByNo.isEmpty()) {
Optional<CraftItemEntity> craftItemByNo = craftItemDao.findByCraftItemNo(craftItemNo);
if (craftItemByNo.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该工艺项目,请先添加工艺项目!", locale);
}
Optional<QcItemEntity> qcItemByNo = qcItemDao.findByQcItemNo(qcItemNo);
if (qcItemByNo.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale);
}
if (Constant.QC_ITEM_TYPE_STRING.equals(qcItemEntityByNo.get().getType())) {
if (Constant.QC_ITEM_TYPE_STRING.equals(qcItemByNo.get().getQcItemType())) {
QcSourceEntity entity = new QcSourceEntity();
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
entity.setBatchNo(LocalStringUtils.formatEmptyValue(batchNo));
@ -64,12 +74,13 @@ public class QcSourceServiceImpl implements QcSourceService {
entity.setMaterialNo(LocalStringUtils.formatEmptyValue(materialNo));
entity.setMouldNo(LocalStringUtils.formatEmptyValue(mouldNo));
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(craftItemNo));
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
entity.setQcValue(LocalStringUtils.formatEmptyValue(qcValue));
qcSourceDao.save(entity);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
if (Constant.QC_ITEM_TYPE_PICTURE.equals(qcItemEntityByNo.get().getType())) {
if (Constant.QC_ITEM_TYPE_PICTURE.equals(qcItemByNo.get().getQcItemType())) {
if (picture == null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "上传图片不能为空!", locale);
}
@ -87,6 +98,7 @@ public class QcSourceServiceImpl implements QcSourceService {
entity.setMaterialNo(LocalStringUtils.formatEmptyValue(materialNo));
entity.setMouldNo(LocalStringUtils.formatEmptyValue(mouldNo));
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(craftItemNo));
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
entity.setQcValue(LocalStringUtils.formatEmptyValue(picturePath));
qcSourceDao.save(entity);
@ -114,12 +126,12 @@ public class QcSourceServiceImpl implements QcSourceService {
* 查询检验数据
*/
@Override
public String queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo) {
public String queryQcSource(String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo, String craftItemNo) {
List<QcItemEntity> qcItemList = qcItemDao.findAll();
if (qcItemList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "未添加检验项目,请先添加检验项目!", locale);
}
List<Map<String, Object>> sourceList = qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo));
List<Map<String, Object>> sourceList = qcSourceDao.queryQcSource(LocalStringUtils.formatEmptyValue(batchNo), LocalStringUtils.formatEmptyValue(machineNo), LocalStringUtils.formatEmptyValue(materialNo), LocalStringUtils.formatEmptyValue(mouldNo), LocalStringUtils.formatEmptyValue(varietyNo), LocalStringUtils.formatEmptyValue(craftItemNo));
List<Map<String, Object>> resultList = generateResultList(sourceList);
if (resultList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验数据的信息!", locale);
@ -141,12 +153,13 @@ public class QcSourceServiceImpl implements QcSourceService {
String materialNo = (String) source.getOrDefault("materialNo", "");
String mouldNo = (String) source.getOrDefault("mouldNo", "");
String varietyNo = (String) source.getOrDefault("varietyNo", "");
String craftItemNo = (String) source.getOrDefault("craftItemNo", "");
String qcItemNo = (String) source.getOrDefault("qcItemNo", "");
String qcValue = (String) source.getOrDefault("qcValue", "");
if (TextUtils.isEmpty(qcItemNo) || TextUtils.isEmpty(qcValue)) {
continue;
}
String formatValue = getFormatValue(varietyNo, qcItemNo, qcValue);
String formatValue = getFormatValue(varietyNo, craftItemNo, qcItemNo, qcValue);
Map<String, Object> emptyRoom = findEmptyRoom(resultList, batchNo, qcItemNo);
if (emptyRoom == null) {
Map<String, Object> newRoom = new HashMap<>();
@ -155,6 +168,7 @@ public class QcSourceServiceImpl implements QcSourceService {
newRoom.put("materialNo", materialNo);
newRoom.put("mouldNo", mouldNo);
newRoom.put("varietyNo", varietyNo);
newRoom.put("craftItemNo", craftItemNo);
newRoom.put(qcItemNo, formatValue);
resultList.add(newRoom);
} else {
@ -167,14 +181,14 @@ public class QcSourceServiceImpl implements QcSourceService {
/**
* 获取添加了 ##H ##L 后缀的测量值如果可能的话
*/
private String getFormatValue(String varietyNo, String qcItemNo, String qcValue) {
Optional<QcSpecEntity> entityByVarietyNoAndQcItemNo = qcSpecDao.findByVarietyNoAndQcItemNo(varietyNo, qcItemNo);
if (entityByVarietyNoAndQcItemNo.isEmpty()) {
private String getFormatValue(String varietyNo, String craftItemNo, String qcItemNo, String qcValue) {
Optional<QcSpecEntity> existsQcSpecOptional = qcSpecDao.findExistsQcSpec(varietyNo, craftItemNo, qcItemNo);
if (existsQcSpecOptional.isEmpty()) {
return qcValue;
}
QcSpecEntity qcSpec = entityByVarietyNoAndQcItemNo.get();
double valueMax = stringToDouble(qcSpec.getMax());
double valueMin = stringToDouble(qcSpec.getMin());
QcSpecEntity existsQcSpec = existsQcSpecOptional.get();
double valueMax = stringToDouble(existsQcSpec.getMax());
double valueMin = stringToDouble(existsQcSpec.getMin());
double value = stringToDouble(qcValue);
if (valueMax >= 0 && value >= 0 && value >= valueMax) {
return qcValue + "##H";

View File

@ -1,8 +1,10 @@
package com.xkrs.service.impl;
import com.xkrs.dao.CraftItemDao;
import com.xkrs.dao.QcItemDao;
import com.xkrs.dao.QcSpecDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.CraftItemEntity;
import com.xkrs.model.entity.QcItemEntity;
import com.xkrs.model.entity.QcSpecEntity;
import com.xkrs.model.qo.QcSpecQoDelete;
@ -28,6 +30,9 @@ public class QcSpecServiceImpl implements QcSpecService {
private Locale locale = LocaleContextHolder.getLocale();
@Resource
private CraftItemDao craftItemDao;
@Resource
private QcItemDao qcItemDao;
@ -41,6 +46,7 @@ public class QcSpecServiceImpl implements QcSpecService {
public String insertQcSpec(QcSpecQoInsert insertQo) {
String varietyNo = insertQo.getVarietyNo();
String craftItemNo = insertQo.getCraftItemNo();
String qcItemNo = insertQo.getQcItemNo();
String max = insertQo.getMax();
String mean = insertQo.getMean();
@ -50,19 +56,23 @@ public class QcSpecServiceImpl implements QcSpecService {
String standard = insertQo.getStandard();
String remark = insertQo.getRemark();
Optional<QcItemEntity> entityByNo = qcItemDao.findByNo(qcItemNo);
if (entityByNo.isEmpty()) {
Optional<CraftItemEntity> craftItemByNo = craftItemDao.findByCraftItemNo(craftItemNo);
if (craftItemByNo.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该工艺项目,请先添加工艺项目!", locale);
}
Optional<QcItemEntity> qcItemByNo = qcItemDao.findByQcItemNo(qcItemNo);
if (qcItemByNo.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该检验项目,请先添加检验项目!", locale);
}
Optional<QcSpecEntity> entityByVarietyNoAndQcItemNo = qcSpecDao.findByVarietyNoAndQcItemNo(varietyNo, qcItemNo);
if (entityByVarietyNoAndQcItemNo.isPresent()) {
Optional<QcSpecEntity> existsQcSpecOptional = qcSpecDao.findExistsQcSpec(varietyNo, craftItemNo, qcItemNo);
if (existsQcSpecOptional.isPresent()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该检验规格已存在,请勿重复添加!", locale);
}
QcSpecEntity entity = new QcSpecEntity();
entity.setCreateTime(LocalDateUtils.getCurrentSecond());
entity.setUpdateTime("");
entity.setVarietyNo(LocalStringUtils.formatEmptyValue(varietyNo));
entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(craftItemNo));
entity.setQcItemNo(LocalStringUtils.formatEmptyValue(qcItemNo));
entity.setMax(LocalStringUtils.formatEmptyValue(max));
entity.setMean(LocalStringUtils.formatEmptyValue(mean));
@ -121,8 +131,8 @@ public class QcSpecServiceImpl implements QcSpecService {
* 查询检验规格
*/
@Override
public String queryQcSpec(String varietyNo, String qcItemNo) {
List<Map<String, Object>> resultList = qcSpecDao.queryQcSpec(LocalStringUtils.formatEmptyValue(varietyNo), LocalStringUtils.formatEmptyValue(qcItemNo));
public String queryQcSpec(String varietyNo, String craftItemNo, String qcItemNo) {
List<Map<String, Object>> resultList = qcSpecDao.queryQcSpec(LocalStringUtils.formatEmptyValue(varietyNo), LocalStringUtils.formatEmptyValue(craftItemNo), LocalStringUtils.formatEmptyValue(qcItemNo));
if (resultList == null || resultList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该检验规格的信息!", locale);
}