添加工艺项目

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") @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) { 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); return qcSourceService.queryQcSource(batchNo, machineNo, materialNo, mouldNo, varietyNo, craftItemNo);
} }
} }

View File

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

View File

@ -18,19 +18,19 @@ import java.util.Optional;
@Component @Component
public interface CraftItemDao extends JpaRepository<CraftItemEntity, Integer>, JpaSpecificationExecutor<CraftItemEntity> { public interface CraftItemDao extends JpaRepository<CraftItemEntity, Integer>, JpaSpecificationExecutor<CraftItemEntity> {
Optional<CraftItemEntity> findByNo(String no); Optional<CraftItemEntity> findByCraftItemNo(String no);
/** /**
* 更新工艺项目名称 * 更新工艺项目名称
*/ */
@Transactional(rollbackOn = Exception.class) @Transactional(rollbackOn = Exception.class)
@Modifying(clearAutomatically = true) @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); 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); List<Map<String, Object>> queryCraftItem(String no, String name);
} }

View File

@ -17,18 +17,18 @@ import java.util.Optional;
@Component @Component
public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpecificationExecutor<QcItemEntity> { public interface QcItemDao extends JpaRepository<QcItemEntity, Integer>, JpaSpecificationExecutor<QcItemEntity> {
Optional<QcItemEntity> findByNo(String no); Optional<QcItemEntity> findByQcItemNo(String no);
/** /**
* 更新检验项目名称 * 更新检验项目名称
*/ */
@Modifying(clearAutomatically = true) @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); 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); List<Map<String, Object>> queryQcItem(String no, String name);
} }

View File

@ -15,7 +15,7 @@ import java.util.Map;
@Component @Component
public interface QcSourceDao extends JpaRepository<QcSourceEntity, Integer>, JpaSpecificationExecutor<QcSourceEntity> { 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) @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); 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 @Component
public interface QcSpecDao extends JpaRepository<QcSpecEntity, Integer>, JpaSpecificationExecutor<QcSpecEntity> { 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) @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 qcItemNo); 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)") @Column(length = 85, columnDefinition = "varchar(85)")
private String no; private String craftItemNo;
/** /**
* 名称 * 名称
*/ */
@Column(length = 85, columnDefinition = "varchar(85)") @Column(length = 85, columnDefinition = "varchar(85)")
private String name; private String craftItemName;
public CraftItemEntity() { public CraftItemEntity() {
} }
@ -68,24 +68,24 @@ public class CraftItemEntity {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getNo() { public String getCraftItemNo() {
return no; return craftItemNo;
} }
public void setNo(String no) { public void setCraftItemNo(String craftItemNo) {
this.no = no; this.craftItemNo = craftItemNo;
} }
public String getName() { public String getCraftItemName() {
return name; return craftItemName;
} }
public void setName(String name) { public void setCraftItemName(String craftItemName) {
this.name = name; this.craftItemName = craftItemName;
} }
@Override @Override
public String toString() { 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)") @Column(length = 85, columnDefinition = "varchar(85)")
private String no; private String qcItemNo;
/** /**
* 名称 * 名称
*/ */
@Column(length = 85, columnDefinition = "varchar(85)") @Column(length = 85, columnDefinition = "varchar(85)")
private String name; private String qcItemName;
/** /**
* 类型 * 类型
@ -47,7 +47,7 @@ public class QcItemEntity {
* "1":图片格式 * "1":图片格式
*/ */
@Column(length = 85, columnDefinition = "varchar(85)") @Column(length = 85, columnDefinition = "varchar(85)")
private String type; private String qcItemType;
public QcItemEntity() { public QcItemEntity() {
} }
@ -76,32 +76,32 @@ public class QcItemEntity {
this.updateTime = updateTime; this.updateTime = updateTime;
} }
public String getNo() { public String getQcItemNo() {
return no; return qcItemNo;
} }
public void setNo(String no) { public void setQcItemNo(String qcItemNo) {
this.no = no; this.qcItemNo = qcItemNo;
} }
public String getName() { public String getQcItemName() {
return name; return qcItemName;
} }
public void setName(String name) { public void setQcItemName(String qcItemName) {
this.name = name; this.qcItemName = qcItemName;
} }
public String getType() { public String getQcItemType() {
return type; return qcItemType;
} }
public void setType(String type) { public void setQcItemType(String qcItemType) {
this.type = type; this.qcItemType = qcItemType;
} }
@Override @Override
public String toString() { 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)") @Column(length = 85, columnDefinition = "varchar(85)")
private String varietyNo; private String varietyNo;
/**
* 工艺项目编号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String craftItemNo;
/** /**
* 检验项目编号 * 检验项目编号
*/ */
@ -124,6 +130,14 @@ public class QcSourceEntity {
this.varietyNo = varietyNo; this.varietyNo = varietyNo;
} }
public String getCraftItemNo() {
return craftItemNo;
}
public void setCraftItemNo(String craftItemNo) {
this.craftItemNo = craftItemNo;
}
public String getQcItemNo() { public String getQcItemNo() {
return qcItemNo; return qcItemNo;
} }
@ -142,6 +156,6 @@ public class QcSourceEntity {
@Override @Override
public String toString() { 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)") @Column(length = 85, columnDefinition = "varchar(85)")
private String varietyNo; private String varietyNo;
/**
* 工艺项目编号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String craftItemNo;
/** /**
* 检验项目编号 * 检验项目编号
*/ */
@ -118,6 +124,14 @@ public class QcSpecEntity {
this.varietyNo = varietyNo; this.varietyNo = varietyNo;
} }
public String getCraftItemNo() {
return craftItemNo;
}
public void setCraftItemNo(String craftItemNo) {
this.craftItemNo = craftItemNo;
}
public String getQcItemNo() { public String getQcItemNo() {
return qcItemNo; return qcItemNo;
} }
@ -184,6 +198,6 @@ public class QcSpecEntity {
@Override @Override
public String toString() { 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}) @NotBlank(message = "{QcSourceEntity.varietyNo.blank}", groups = {QcSourceQoInsertVa.class})
private String varietyNo; private String varietyNo;
/**
* 机种号
*/
@NotBlank(message = "{QcSourceEntity.craftItemNo.blank}", groups = {QcSourceQoInsertVa.class})
private String craftItemNo;
/** /**
* 检验项目编号 * 检验项目编号
*/ */
@ -93,6 +99,14 @@ public class QcSourceQoInsert {
this.varietyNo = varietyNo; this.varietyNo = varietyNo;
} }
public String getCraftItemNo() {
return craftItemNo;
}
public void setCraftItemNo(String craftItemNo) {
this.craftItemNo = craftItemNo;
}
public String getQcItemNo() { public String getQcItemNo() {
return qcItemNo; return qcItemNo;
} }
@ -111,6 +125,6 @@ public class QcSourceQoInsert {
@Override @Override
public String toString() { 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}) @NotBlank(message = "{QcSpecEntity.varietyNo.blank}", groups = {QcSpecQoInsertVa.class})
private String varietyNo; private String varietyNo;
/**
* 工艺项目编号
*/
@NotBlank(message = "{QcSpecEntity.craftItemNo.blank}", groups = {QcSpecQoInsertVa.class})
private String craftItemNo;
/** /**
* 检验项目编号 * 检验项目编号
*/ */
@ -67,6 +73,14 @@ public class QcSpecQoInsert {
this.varietyNo = varietyNo; this.varietyNo = varietyNo;
} }
public String getCraftItemNo() {
return craftItemNo;
}
public void setCraftItemNo(String craftItemNo) {
this.craftItemNo = craftItemNo;
}
public String getQcItemNo() { public String getQcItemNo() {
return qcItemNo; return qcItemNo;
} }
@ -133,6 +147,6 @@ public class QcSpecQoInsert {
@Override @Override
public String toString() { 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) { public String insertCraftItem(CraftItemQoInsert insertQo) {
String no = insertQo.getNo(); String no = insertQo.getNo();
String name = insertQo.getName(); String name = insertQo.getName();
Optional<CraftItemEntity> entityByNo = craftItemDao.findByNo(no); Optional<CraftItemEntity> entityByNo = craftItemDao.findByCraftItemNo(no);
if (entityByNo.isPresent()) { if (entityByNo.isPresent()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该工艺项目已存在,请勿重复添加!", locale); return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该工艺项目已存在,请勿重复添加!", locale);
} }
CraftItemEntity entity = new CraftItemEntity(); CraftItemEntity entity = new CraftItemEntity();
entity.setCreateTime(LocalDateUtils.getCurrentSecond()); entity.setCreateTime(LocalDateUtils.getCurrentSecond());
entity.setUpdateTime(""); entity.setUpdateTime("");
entity.setNo(LocalStringUtils.formatEmptyValue(no)); entity.setCraftItemNo(LocalStringUtils.formatEmptyValue(no));
entity.setName(LocalStringUtils.formatEmptyValue(name)); entity.setCraftItemName(LocalStringUtils.formatEmptyValue(name));
craftItemDao.save(entity); craftItemDao.save(entity);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
} }

View File

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

View File

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

View File

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

View File

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