调整数据库表结构

This commit is contained in:
liuchengqian 2022-02-28 13:55:17 +08:00
parent 6ed366abe0
commit 3d053e63de
40 changed files with 1492 additions and 1031 deletions

View File

@ -1,10 +1,9 @@
package com.xkrs.controller;
import com.xkrs.dao.DataDictDao;
import com.xkrs.dao.QcInspectionItemDictDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.DataDict;
import com.xkrs.model.qo.DataDictQo;
import com.xkrs.model.qo.DataDictUpdateQo;
import com.xkrs.model.entity.QcInspectionItemDict;
import com.xkrs.model.qo.QcInspectionItemDictQo;
import com.xkrs.service.DataDictService;
import com.xkrs.util.Query;
import org.springframework.context.i18n.LocaleContextHolder;
@ -28,60 +27,63 @@ public class DataDictController {
private DataDictService dataDictService;
@Resource
private DataDictDao dataDictDao;
private QcInspectionItemDictDao inspectionItemDictDao;
@Resource
private Query query;
/**
* 添加字典变量数据
* @param dataDictQo
*
* @param inspectionItemDictQo
* @return
*/
@PostMapping("/insertDataDict")
public String insertDataDict(@RequestBody DataDictQo dataDictQo){
return dataDictService.insertDataDict(dataDictQo);
public String insertDataDict(@RequestBody QcInspectionItemDictQo inspectionItemDictQo) {
return dataDictService.insertDataDict(inspectionItemDictQo);
}
/**
* 动态多条件查询字典信息
*
* @param dictChineseName
* @param dictEnglishName
* @return
*/
@GetMapping("/selectDataDict")
public String selectDataDict(@RequestParam("dictChineseName") String dictChineseName,
@RequestParam("dictEnglishName") String dictEnglishName){
public String selectDataDict(@RequestParam("dictChineseName") String dictChineseName, @RequestParam("dictEnglishName") String dictEnglishName) {
Locale locale = LocaleContextHolder.getLocale();
List<DataDict> dataDict = query.selectDataDict(dictChineseName, dictEnglishName);
if(dataDict == null || dataDict.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有该型号类型的字典信息!",locale);
List<QcInspectionItemDict> qcInspectionItemDict = query.selectDataDict(dictChineseName, dictEnglishName);
if (qcInspectionItemDict == null || qcInspectionItemDict.size() == 0) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,dataDict,locale);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, qcInspectionItemDict, locale);
}
/**
* 根据id查询字典信息用于数据回显方便进行修改操作
*
* @param id
* @return
*/
@GetMapping("/selectDataDictById")
public String selectDataDictById(@RequestParam("id") Integer id){
public String selectDataDictById(@RequestParam("id") Integer id) {
Locale locale = LocaleContextHolder.getLocale();
DataDict dataDict = dataDictDao.findById(id);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,dataDict,locale);
QcInspectionItemDict qcInspectionItemDict = inspectionItemDictDao.findById(id);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, qcInspectionItemDict, locale);
}
/**
* 根据id修改字典信息
* @param dataDictUpdateQo
*
* @param inspectionItemDictQo
* @return
*/
@PostMapping("/updateDict")
@Transactional(rollbackOn = Exception.class)
public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo){
public String updateDict(@RequestBody QcInspectionItemDictQo inspectionItemDictQo) {
Locale locale = LocaleContextHolder.getLocale();
dataDictDao.updateDict(dataDictUpdateQo.getId(),dataDictUpdateQo.getDictChineseName());
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale);
inspectionItemDictDao.updateDictById(inspectionItemDictQo.getId(), inspectionItemDictQo.getInspectionItemName());
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
}
}

View File

@ -1,16 +1,19 @@
package com.xkrs.controller;
import com.xkrs.dao.DataSourceDao;
import com.xkrs.dao.QcInspectionDataSourceDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.qo.DataSourceQo;
import com.xkrs.model.entity.QcInspectionDataSource;
import com.xkrs.model.qo.QcInspectionDataSourceQo;
import com.xkrs.service.DataSourceService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -25,50 +28,50 @@ public class DataSourceController {
private DataSourceService dataSourceService;
@Resource
private DataSourceDao dataSourceDao;
private QcInspectionDataSourceDao inspectionDataSourceDao;
/**
* 添加测量数据
* @param dataSourceQo
*
* @param inspectionDataSourceQo
* @return
*/
@PostMapping("/insertDataSource")
public String insertDataSource(@RequestBody DataSourceQo dataSourceQo){
return dataSourceService.insertDataSource(dataSourceQo);
public String insertDataSource(@RequestBody QcInspectionDataSourceQo inspectionDataSourceQo) {
return dataSourceService.insertDataSource(inspectionDataSourceQo);
}
/**
* 查询某一产品的测量信息
* @param dataModelNumber
* @param dataBatchNumber
* @param dataMachineCode
* @param productNumber
* @return
* 根据 批次号机器号物料号模具号零件号
*/
@GetMapping("/selectDataSource")
public String selectDataSource(@RequestParam("dataModelNumber") String dataModelNumber,
@RequestParam("dataBatchNumber") String dataBatchNumber,
@RequestParam("dataMachineCode") String dataMachineCode,
@RequestParam("productNumber") String productNumber){
public String selectDataSource(@RequestBody QcInspectionDataSourceQo inspectionDataSourceQo) {
String lotNo = inspectionDataSourceQo.getLotNo();
String machineNo = inspectionDataSourceQo.getMachineNo();
String materialNo = inspectionDataSourceQo.getMaterialNo();
String modelNo = inspectionDataSourceQo.getModelNo();
String partNo = inspectionDataSourceQo.getPartNo();
Locale locale = LocaleContextHolder.getLocale();
List<Map<String, String>> maps = dataSourceDao.selectDataSource(dataModelNumber, dataBatchNumber, dataMachineCode, productNumber);
if(maps == null || maps.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的测量信息!",locale);
List<QcInspectionDataSource> inspectionDataSources = inspectionDataSourceDao.selectDataSource(lotNo, machineNo, materialNo, modelNo, partNo);
if (inspectionDataSources == null || inspectionDataSources.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, inspectionDataSources, locale);
}
/**
* 查询全部的测量信息
*
* @return
*/
@GetMapping("/selectAllSource")
public String selectAllSource(){
public String selectAllSource() {
Locale locale = LocaleContextHolder.getLocale();
List<Map<String, String>> maps = dataSourceDao.selectAllSource();
if(maps == null || maps.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的测量信息!",locale);
List<QcInspectionDataSource> dataSourceAll = inspectionDataSourceDao.findAll();
if (dataSourceAll == null || dataSourceAll.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale);
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataSourceAll, locale);
}
}

View File

@ -1,18 +1,19 @@
package com.xkrs.controller;
import com.xkrs.dao.FileDao;
import com.xkrs.dao.QcInspectionFileDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.qo.FileQo;
import com.xkrs.model.qo.FileUpdateQo;
import com.xkrs.model.qo.QcInspectionFileQo;
import com.xkrs.service.FileService;
import com.xkrs.util.ExcelUploadUtil;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional;
import java.io.IOException;
import java.util.Locale;
@ -30,44 +31,51 @@ public class FileController {
private FileService fileService;
@Resource
private FileDao fileDao;
private QcInspectionFileDao inspectionFileDao;
/**
* 上传模板信息
* @param fileQo
*
* @param inspectionFileQo
* @param fileExcel
* @return
* @throws IOException
*/
@PostMapping("/insertFileExcel")
public String insertFileExcel(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
return fileService.insertFileExcel(fileQo,fileExcel);
public String insertFileExcel(QcInspectionFileQo inspectionFileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
return fileService.insertFileExcel(inspectionFileQo, fileExcel);
}
/**
* 修改上传的模板信息
* @param fileUpdateQo
*
* @param inspectionFileQo
* @param fileExcel
* @return
* @throws IOException
*/
@PostMapping("/updateFileUploadPath")
@Transactional(rollbackOn = Exception.class)
public String updateFileUploadPath(FileUpdateQo fileUpdateQo,@RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
public String updateFileUploadPath(QcInspectionFileQo inspectionFileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException {
String lotNo = inspectionFileQo.getLotNo();
String machineNo = inspectionFileQo.getMachineNo();
String materialNo = inspectionFileQo.getMaterialNo();
String modelNo = inspectionFileQo.getModelNo();
String partNo = inspectionFileQo.getPartNo();
Locale locale = LocaleContextHolder.getLocale();
String file = ExcelUploadUtil.memoryFile(fileExcel);
fileDao.updateFileUploadPath(fileUpdateQo.getFileModelNumber(),fileUpdateQo.getFileBatchNumber(),fileUpdateQo.getFileMachineCode(),fileUpdateQo.getFileProductNumber(),file);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale);
inspectionFileDao.updateTemplatePath(lotNo, machineNo, materialNo, modelNo, partNo, file);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale);
}
/**
* 导出excel
*
* @param fileQo
* @param inspectionFileQo
* @return
*/
@PostMapping("/exportExcel")
public String exportExcel(@RequestBody FileQo fileQo) throws IOException, InvalidFormatException {
return fileService.exportExcel(fileQo);
public String exportExcel(@RequestBody QcInspectionFileQo inspectionFileQo) throws IOException, InvalidFormatException {
return fileService.exportExcel(inspectionFileQo);
}
}

View File

@ -1,48 +0,0 @@
package com.xkrs.dao;
import com.xkrs.model.entity.DataDict;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:03
*/
@Component
public interface DataDictDao extends JpaRepository<DataDict,Long>, JpaSpecificationExecutor<DataDict> {
/**
* 通过中文名称查询字典表数据
* @param chineseName
* @return
*/
DataDict findByDictChineseName(String chineseName);
/**
* 通过英文变量查询字典表的数据
* @param englishName
* @return
*/
DataDict findByDictEnglishName(String englishName);
/**
* 根据id查询字典信息
* @param id
* @return
*/
DataDict findById(Integer id);
/**
* 根据id修改字典的信息
* @param id
* @param chineseName
*/
@Modifying(clearAutomatically=true)
@Query(value = "update data_dict set dict_chinese_name = ?2 where id = ?1",nativeQuery = true)
void updateDict(Integer id, String chineseName);
}

View File

@ -1,64 +0,0 @@
package com.xkrs.dao;
import com.xkrs.model.entity.DataSource;
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;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:41
*/
@Component
public interface DataSourceDao extends JpaRepository<DataSource,Long>, JpaSpecificationExecutor<DataSource> {
/**
* 查询测量数据信息
* @param dataModelNumber
* @param dataBatchNumber
* @param dataMachineCode
* @param productNumber
* @return
*/
@Query(value = "select ds.data_model_number datamodelnumber, ds.data_batch_number databatchnumber, " +
"ds.data_machine_code datamachinecode, ds.product_number productnumber, ds.material material, dd.dict_chinese_name chinesename, " +
"ds.data_name dataname,ds.numerical_value numericalvalue " +
"from data_dict dd,data_source ds where ds.data_name = dd.dict_english_name and " +
"ds.data_model_number = :dataModelNumber and ds.data_batch_number = :dataBatchNumber and " +
"ds.data_machine_code = :dataMachineCode and ds.product_number = :productNumber",nativeQuery = true)
List<Map<String,String>> selectDataSource(String dataModelNumber, String dataBatchNumber, String dataMachineCode, String productNumber);
/**
* 查询测量信息变量和测量值用于模板的导入
* @param dataModelNumber
* @param dataBatchNumber
* @param dataMachineCode
* @param productNumber
* @return
*/
@Query(value = "select data_name dataname,numerical_value numericalvalue from data_source " +
"where data_model_number = :dataModelNumber and data_batch_number = :dataBatchNumber " +
"and data_machine_code = :dataMachineCode and product_number = :productNumber",nativeQuery = true)
List<Map<String,String>> selectDataNameAndData(String dataModelNumber, String dataBatchNumber, String dataMachineCode, String productNumber);
/**
* 通过英文变量查询信息
* @param dataname
* @return
*/
DataSource findByDataName(String dataname);
/**
* 查询全部的测量信息
* @return
*/
@Query(value = "select ds.data_model_number datamodelnumber, ds.data_batch_number databatchnumber, " +
"ds.data_machine_code datamachinecode, ds.product_number productnumber, ds.material material, dd.dict_chinese_name chinesename," +
"ds.data_name dataname,ds.numerical_value numericalvalue from data_dict dd,data_source ds " +
"where ds.data_name = dd.dict_english_name",nativeQuery = true)
List<Map<String,String>> selectAllSource();
}

View File

@ -0,0 +1,27 @@
package com.xkrs.dao;
import com.xkrs.model.entity.QcInspectionDataSource;
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;
@Component
public interface QcInspectionDataSourceDao extends JpaRepository<QcInspectionDataSource, Long>, JpaSpecificationExecutor<QcInspectionDataSource> {
/**
* 查询质检数据源
*
* @param lotNo 批次号
* @param machineNo 机器号
* @param materialNo 物料号
* @param modelNo 模具号
* @param partNo 零件号
* @return
*/
@Query(value = "from QcInspectionDataSource where lotNo = ? and machineNo = ?and materialNo = ?and modelNo = ?and partNo = ?")
List<QcInspectionDataSource> selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String partNo);
}

View File

@ -0,0 +1,58 @@
package com.xkrs.dao;
import com.xkrs.model.entity.QcInspectionFile;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 15:23
*/
@Component
public interface QcInspectionFileDao extends JpaRepository<QcInspectionFile, Long>, JpaSpecificationExecutor<QcInspectionFile> {
/**
* 查询文件信息
*
* @param lotNo 批次号
* @param machineNo 机器号
* @param materialNo 物料号
* @param modelNo 模具号
* @param partNo 零件号
* @return
*/
QcInspectionFile selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String partNo);
/**
* 修改模板上传信息
*
* @param lotNo 批次号
* @param machineNo 机器号
* @param materialNo 物料号
* @param modelNo 模具号
* @param partNo 零件号
* @param templatePath 模版路径
*/
@Modifying(clearAutomatically = true)
@Query(value = "update QcInspectionFile set templatePath = ?6 where lotNo = ?1 and machineNo = ?2 and materialNo = ?3 and modelNo = ?4 and partNo = ?5")
void updateTemplatePath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String templatePath);
/**
* 修改模板载下信息
*
* @param lotNo 批次号
* @param machineNo 机器号
* @param materialNo 物料号
* @param modelNo 模具号
* @param partNo 零件号
* @param filePath 文件路径
*/
@Modifying(clearAutomatically = true)
@Query(value = "update QcInspectionFile set filePath = ?6 where lotNo = ?1 and machineNo = ?2 and materialNo = ?3 and modelNo = ?4 and partNo = ?5")
void updateFilePath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String filePath);
}

View File

@ -0,0 +1,35 @@
package com.xkrs.dao;
import com.xkrs.model.entity.QcInspectionItemDict;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
@Component
public interface QcInspectionItemDictDao extends JpaRepository<QcInspectionItemDict, Long>, JpaSpecificationExecutor<QcInspectionItemDict> {
/**
* 通过检验项代码查询字典表的数据
* @param inspectionItemCode
* @return
*/
QcInspectionItemDict findByInspectionItemCode(String inspectionItemCode);
/**
* 根据id查询字典信息
* @param id
* @return
*/
QcInspectionItemDict findById(Integer id);
/**
* 根据id修改字典的信息
* @param id
* @param inspectionItemName
*/
@Modifying(clearAutomatically=true)
@Query(value = "update QcInspectionItemDict set inspectionItemName = ?2 where id = ?1")
void updateDictById(Integer id, String inspectionItemName);
}

View File

@ -1,52 +1,52 @@
package com.xkrs.dao;
import com.xkrs.model.entity.FileEntity;
import com.xkrs.model.entity.QcInspectionFile;
import com.xkrs.model.entity.QcInspectionPicture;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 15:23
*/
@Component
public interface FileDao extends JpaRepository<FileEntity,Long>, JpaSpecificationExecutor<FileEntity> {
public interface QcInspectionPictureDao extends JpaRepository<QcInspectionPicture, Long>, JpaSpecificationExecutor<QcInspectionPicture> {
/**
* 根据机种号批次号机器号产品号查询文件信息
*
* @param fileModelNumber
* @param fileBatchNumber
* @param fileMachineCode
* @param fileProductNumber
* @return
*/
FileEntity findByFileModelNumberAndFileBatchNumberAndFileMachineCodeAndFileProductNumber(String fileModelNumber,String fileBatchNumber,String fileMachineCode,String fileProductNumber);
QcInspectionFile findByFileModelNumberAndFileBatchNumberAndFileMachineCodeAndFileProductNumber(String fileModelNumber, String fileBatchNumber, String fileMachineCode, String fileProductNumber);
/**
* 根据机种号批次号机器号产品号修改模板上传信息
*
* @param fileModelNumber
* @param fileBatchNumber
* @param fileMachineCode
* @param fileProductNumber
* @param fileUploadPath
*/
@Modifying(clearAutomatically=true)
@Query(value = "update file set file_upload_path = ?5 where file_model_number = ?1 and file_batch_number = ?2 and file_machine_code = ?3 and file_product_number = ?4",nativeQuery = true)
void updateFileUploadPath(String fileModelNumber,String fileBatchNumber,String fileMachineCode,String fileProductNumber,String fileUploadPath);
@Modifying(clearAutomatically = true)
@Query(value = "update file set file_upload_path = ?5 where file_model_number = ?1 and file_batch_number = ?2 and file_machine_code = ?3 and file_product_number = ?4", nativeQuery = true)
void updateFileUploadPath(String fileModelNumber, String fileBatchNumber, String fileMachineCode, String fileProductNumber, String fileUploadPath);
/**
* 根据机种号批次号机器号产品号修改模板下载信息
* 根据机种号批次号机器号产品号修改模板载下信息
*
* @param fileModelNumber
* @param fileBatchNumber
* @param fileMachineCode
* @param fileProductNumber
* @param fileDownloadPath
*/
@Modifying(clearAutomatically=true)
@Query(value = "update file set file_download_path = ?5 where file_model_number = ?1 and file_batch_number = ?2 and file_machine_code = ?3 and file_product_number = ?4",nativeQuery = true)
void updateFileDownloadPath(String fileModelNumber,String fileBatchNumber,String fileMachineCode,String fileProductNumber,String fileDownloadPath);
@Modifying(clearAutomatically = true)
@Query(value = "update file set file_download_path = ?5 where file_model_number = ?1 and file_batch_number = ?2 and file_machine_code = ?3 and file_product_number = ?4", nativeQuery = true)
void updateFileDownloadPath(String fileModelNumber, String fileBatchNumber, String fileMachineCode, String fileProductNumber, String fileDownloadPath);
}

View File

@ -0,0 +1,10 @@
package com.xkrs.dao;
import com.xkrs.model.entity.QcInspectionSpec;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Component;
@Component
public interface QcInspectionSpecDao extends JpaRepository<QcInspectionSpec, Long>, JpaSpecificationExecutor<QcInspectionSpec> {
}

View File

@ -1,73 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 9:26
*/
@Entity
@Table(name = "data_dict")
public class DataDict {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "data_dict_seq_gen")
@SequenceGenerator(name = "data_dict_seq_gen", sequenceName = "data_dict_id_seq",allocationSize = 1)
private Integer id;
/**
* 中文名称
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String dictChineseName;
/**
* 英文变量值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String dictEnglishName;
public DataDict() {
}
public DataDict(Integer id, String dictChineseName, String dictEnglishName) {
this.id = id;
this.dictChineseName = dictChineseName;
this.dictEnglishName = dictEnglishName;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDictChineseName() {
return dictChineseName;
}
public void setDictChineseName(String dictChineseName) {
this.dictChineseName = dictChineseName;
}
public String getDictEnglishName() {
return dictEnglishName;
}
public void setDictEnglishName(String dictEnglishName) {
this.dictEnglishName = dictEnglishName;
}
@Override
public String toString() {
return "DataDict{" +
"id=" + id +
", dictChineseName='" + dictChineseName + '\'' +
", dictEnglishName='" + dictEnglishName + '\'' +
'}';
}
}

View File

@ -1,152 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 14:08
*/
@Entity
@Table(name = "data_source")
public class DataSource {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "data_source_seq_gen")
@SequenceGenerator(name = "data_source_seq_gen", sequenceName = "data_source_id_seq",allocationSize = 1)
private Integer id;
/**
* 机种
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String dataModelNumber;
/**
* 成型批号
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String dataBatchNumber;
/**
* 机器
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String dataMachineCode;
/**
* 模具
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String productNumber;
/**
* 材料
*/
private String material;
/**
* 变量值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String dataName;
/**
* 监测的数值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String numericalValue;
public DataSource() {
}
public DataSource(Integer id, String dataModelNumber, String dataBatchNumber, String dataMachineCode, String productNumber, String material, String dataName, String numericalValue) {
this.id = id;
this.dataModelNumber = dataModelNumber;
this.dataBatchNumber = dataBatchNumber;
this.dataMachineCode = dataMachineCode;
this.productNumber = productNumber;
this.material = material;
this.dataName = dataName;
this.numericalValue = numericalValue;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDataModelNumber() {
return dataModelNumber;
}
public void setDataModelNumber(String dataModelNumber) {
this.dataModelNumber = dataModelNumber;
}
public String getDataBatchNumber() {
return dataBatchNumber;
}
public void setDataBatchNumber(String dataBatchNumber) {
this.dataBatchNumber = dataBatchNumber;
}
public String getDataMachineCode() {
return dataMachineCode;
}
public void setDataMachineCode(String dataMachineCode) {
this.dataMachineCode = dataMachineCode;
}
public String getProductNumber() {
return productNumber;
}
public void setProductNumber(String productNumber) {
this.productNumber = productNumber;
}
public String getMaterial() {
return material;
}
public void setMaterial(String material) {
this.material = material;
}
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getNumericalValue() {
return numericalValue;
}
public void setNumericalValue(String numericalValue) {
this.numericalValue = numericalValue;
}
@Override
public String toString() {
return "DataSource{" +
"id=" + id +
", dataModelNumber='" + dataModelNumber + '\'' +
", dataBatchNumber='" + dataBatchNumber + '\'' +
", dataMachineCode='" + dataMachineCode + '\'' +
", productNumber='" + productNumber + '\'' +
", material='" + material + '\'' +
", dataName='" + dataName + '\'' +
", numericalValue='" + numericalValue + '\'' +
'}';
}
}

View File

@ -1,135 +0,0 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 15:01
*/
@Entity
@Table(name = "file")
public class FileEntity {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "file_seq_gen")
@SequenceGenerator(name = "file_seq_gen", sequenceName = "file_id_seq",allocationSize = 1)
private Integer id;
/**
* 机种号
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String fileModelNumber;
/**
* 批次号
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String fileBatchNumber;
/**
* 机器号
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String fileMachineCode;
/**
* 产品编号
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String fileProductNumber;
/**
* 上传模板的路径
*/
private String fileUploadPath;
/**
* 下载路径
*/
private String fileDownloadPath;
public FileEntity() {
}
public FileEntity(Integer id, String fileModelNumber, String fileBatchNumber, String fileMachineCode, String fileProductNumber, String fileUploadPath, String fileDownloadPath) {
this.id = id;
this.fileModelNumber = fileModelNumber;
this.fileBatchNumber = fileBatchNumber;
this.fileMachineCode = fileMachineCode;
this.fileProductNumber = fileProductNumber;
this.fileUploadPath = fileUploadPath;
this.fileDownloadPath = fileDownloadPath;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getFileModelNumber() {
return fileModelNumber;
}
public void setFileModelNumber(String fileModelNumber) {
this.fileModelNumber = fileModelNumber;
}
public String getFileBatchNumber() {
return fileBatchNumber;
}
public void setFileBatchNumber(String fileBatchNumber) {
this.fileBatchNumber = fileBatchNumber;
}
public String getFileMachineCode() {
return fileMachineCode;
}
public void setFileMachineCode(String fileMachineCode) {
this.fileMachineCode = fileMachineCode;
}
public String getFileProductNumber() {
return fileProductNumber;
}
public void setFileProductNumber(String fileProductNumber) {
this.fileProductNumber = fileProductNumber;
}
public String getFileUploadPath() {
return fileUploadPath;
}
public void setFileUploadPath(String fileUploadPath) {
this.fileUploadPath = fileUploadPath;
}
public String getFileDownloadPath() {
return fileDownloadPath;
}
public void setFileDownloadPath(String fileDownloadPath) {
this.fileDownloadPath = fileDownloadPath;
}
@Override
public String toString() {
return "FileEntity{" +
"id=" + id +
", fileModelNumber='" + fileModelNumber + '\'' +
", fileBatchNumber='" + fileBatchNumber + '\'' +
", fileMachineCode='" + fileMachineCode + '\'' +
", fileProductNumber='" + fileProductNumber + '\'' +
", fileUploadPath='" + fileUploadPath + '\'' +
", fileDownloadPath='" + fileDownloadPath + '\'' +
'}';
}
}

View File

@ -0,0 +1,146 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* 质检采集数据表
*/
@Entity
@Table(name = "qc_inspection_data_source")
public class QcInspectionDataSource {
/**
* 采集数据编号
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 批次号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String lotNo;
/**
* 机器号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String machineNo;
/**
* 物料号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String materialNo;
/**
* 模具号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String modelNo;
/**
* 零件号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String partNo;
/**
* 检验项代码
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionItemCode;
/**
* 检验数值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectValue;
/**
* 质检规格编号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionSpecNo;
public QcInspectionDataSource() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getInspectValue() {
return inspectValue;
}
public void setInspectValue(String inspectValue) {
this.inspectValue = inspectValue;
}
public String getInspectionSpecNo() {
return inspectionSpecNo;
}
public void setInspectionSpecNo(String inspectionSpecNo) {
this.inspectionSpecNo = inspectionSpecNo;
}
@Override
public String toString() {
return "QcInspectionDataSource{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", inspectValue='" + inspectValue + '\'' + ", inspectionSpecNo='" + inspectionSpecNo + '\'' + '}';
}
}

View File

@ -0,0 +1,130 @@
package com.xkrs.model.entity;
import javax.persistence.*;
@Entity
@Table(name = "file")
public class QcInspectionFile {
/**
* 编号
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 批次号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String lotNo;
/**
* 机器号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String machineNo;
/**
* 物料号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String materialNo;
/**
* 模具号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String modelNo;
/**
* 零件号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String partNo;
/**
* 模版路径
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String templatePath;
/**
* 文件路径
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String filePath;
public QcInspectionFile() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getTemplatePath() {
return templatePath;
}
public void setTemplatePath(String templatePath) {
this.templatePath = templatePath;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
@Override
public String toString() {
return "QcInspectionFile{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", templatePath='" + templatePath + '\'' + ", filePath='" + filePath + '\'' + '}';
}
}

View File

@ -0,0 +1,78 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 9:26
* <p>
* 1实体类和表的映射关系
* @Entity声明实体类
* @Table配置实体类和表的映射关系 name配置数据库表的名称
* 2实体类中属性和表中字段的映射关系
* @Id声明主键的配置
* @GeneratedValue配置主键的生成策略 GenerationType.SEQUENCE序列
* @Column配置属性和字段的映射关系 name数据库表中的字段名称
*/
@Entity
@Table(name = "qc_inspection_item_dict")
public class QcInspectionItemDict {
/**
* 索引
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 检验项代码
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionItemCode;
/**
* 检验项名称
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionItemName;
public QcInspectionItemDict() {
}
public QcInspectionItemDict(Integer id, String inspectionItemCode, String inspectionItemName) {
this.id = id;
this.inspectionItemCode = inspectionItemCode;
this.inspectionItemName = inspectionItemName;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getInspectionItemName() {
return inspectionItemName;
}
public void setInspectionItemName(String inspectionItemName) {
this.inspectionItemName = inspectionItemName;
}
@Override
public String toString() {
return "DataDict{" + "id=" + id + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", inspectionItemName='" + inspectionItemName + '\'' + '}';
}
}

View File

@ -0,0 +1,119 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* 质检图片表
*/
@Entity
@Table(name = "qc_inspection_picture")
public class QcInspectionPicture {
/**
* 编号
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 批次号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String lotNo;
/**
* 机器号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String machineNo;
/**
* 物料号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String materialNo;
/**
* 模具号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String modelNo;
/**
* 零件号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String partNo;
/**
* 图片路径
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String picturePath;
public QcInspectionPicture() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getPicturePath() {
return picturePath;
}
public void setPicturePath(String picturePath) {
this.picturePath = picturePath;
}
@Override
public String toString() {
return "QcInspectionPicture{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", picturePath='" + picturePath + '\'' + '}';
}
}

View File

@ -0,0 +1,172 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* 检验规格实体类
*/
@Entity
@Table(name = "qc_inspection_spec")
public class QcInspectionSpec {
/**
* 规格编号
*/
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Integer id;
/**
* 零件号
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String partNo;
/**
* 检验项代码
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionItemCode;
/**
* 最大值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String max;
/**
* 平均值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String mean;
/**
* 最小值
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String min;
/**
* 单位
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String unit;
/**
* 检验方法
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionMethod;
/**
* 检验标准
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String inspectionStandard;
/**
* 备注
*/
@Column(length = 85, columnDefinition = "varchar(85)")
private String remark;
public QcInspectionSpec() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public String getMean() {
return mean;
}
public void setMean(String mean) {
this.mean = mean;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getInspectionMethod() {
return inspectionMethod;
}
public void setInspectionMethod(String inspectionMethod) {
this.inspectionMethod = inspectionMethod;
}
public String getInspectionStandard() {
return inspectionStandard;
}
public void setInspectionStandard(String inspectionStandard) {
this.inspectionStandard = inspectionStandard;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
@Override
public String toString() {
return "QcInspectionSpec{" +
"id=" + id +
", partNo='" + partNo + '\'' +
", inspectionItemCode='" + inspectionItemCode + '\'' +
", max='" + max + '\'' +
", mean='" + mean + '\'' +
", min='" + min + '\'' +
", unit='" + unit + '\'' +
", inspectionMethod='" + inspectionMethod + '\'' +
", inspectionStandard='" + inspectionStandard + '\'' +
", remark='" + remark + '\'' +
'}';
}
}

View File

@ -1,39 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.DataDictQoInsert;
import javax.validation.constraints.NotBlank;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:14
*/
public class DataDictQo {
/**
* 中文名称
*/
@NotBlank(message = "{DataDict.dictChineseName.blank}",groups={DataDictQoInsert.class})
private String dictChineseName;
/**
* 英文变量值
*/
@NotBlank(message = "{DataDict.dictEnglishName.blank}",groups={DataDictQoInsert.class})
private String dictEnglishName;
public String getDictChineseName() {
return dictChineseName;
}
public void setDictChineseName(String dictChineseName) {
this.dictChineseName = dictChineseName;
}
public String getDictEnglishName() {
return dictEnglishName;
}
public void setDictEnglishName(String dictEnglishName) {
this.dictEnglishName = dictEnglishName;
}
}

View File

@ -1,37 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.DataDictUpdateQoUpdate;
import javax.validation.constraints.NotBlank;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 11:23
*/
public class DataDictUpdateQo {
@NotBlank(message = "{DataDict.id.blank}",groups={DataDictUpdateQoUpdate.class})
private Integer id;
/**
* 中文名称
*/
@NotBlank(message = "{DataDict.dictChineseName.blank}",groups={DataDictUpdateQoUpdate.class})
private String dictChineseName;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDictChineseName() {
return dictChineseName;
}
public void setDictChineseName(String dictChineseName) {
this.dictChineseName = dictChineseName;
}
}

View File

@ -1,110 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.DataDictQoInsert;
import com.xkrs.model.validation.DataSourceQoInsert;
import javax.persistence.Column;
import javax.validation.constraints.NotBlank;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:37
*/
public class DataSourceQo {
/**
* 机种号
*/
@NotBlank(message = "{DataSource.dataModelNumber.blank}",groups={DataSourceQoInsert.class})
private String dataModelNumber;
/**
* 批次号
*/
@NotBlank(message = "{DataSource.dataBatchNumber.blank}",groups={DataSourceQoInsert.class})
private String dataBatchNumber;
/**
* 机器号
*/
@NotBlank(message = "{DataSource.dataMachineCode.blank}",groups={DataSourceQoInsert.class})
private String dataMachineCode;
/**
* 模具
*/
@NotBlank(message = "{DataSource.productNumber.blank}",groups={DataSourceQoInsert.class})
private String productNumber;
/**
* 材料
*/
private String material;
/**
* 变量值
*/
@NotBlank(message = "{DataSource.dataName.blank}",groups={DataSourceQoInsert.class})
private String dataName;
/**
* 监测的数值
*/
@NotBlank(message = "{DataSource.numericalValue.blank}",groups={DataSourceQoInsert.class})
private String numericalValue;
public String getDataModelNumber() {
return dataModelNumber;
}
public void setDataModelNumber(String dataModelNumber) {
this.dataModelNumber = dataModelNumber;
}
public String getDataBatchNumber() {
return dataBatchNumber;
}
public void setDataBatchNumber(String dataBatchNumber) {
this.dataBatchNumber = dataBatchNumber;
}
public String getDataMachineCode() {
return dataMachineCode;
}
public void setDataMachineCode(String dataMachineCode) {
this.dataMachineCode = dataMachineCode;
}
public String getProductNumber() {
return productNumber;
}
public String getMaterial() {
return material;
}
public void setMaterial(String material) {
this.material = material;
}
public void setProductNumber(String productNumber) {
this.productNumber = productNumber;
}
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
public String getNumericalValue() {
return numericalValue;
}
public void setNumericalValue(String numericalValue) {
this.numericalValue = numericalValue;
}
}

View File

@ -1,81 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.FileQoInsert;
import javax.validation.constraints.NotBlank;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 15:26
*/
public class FileQo {
/**
* 机种号
*/
@NotBlank(message = "{FileEntity.fileModelNumber.blank}",groups={FileQoInsert.class})
private String fileModelNumber;
/**
* 批次号
*/
@NotBlank(message = "{FileEntity.fileBatchNumber.blank}",groups={FileQoInsert.class})
private String fileBatchNumber;
/**
* 机器号
*/
@NotBlank(message = "{FileEntity.fileMachineCode.blank}",groups={FileQoInsert.class})
private String fileMachineCode;
/**
* 产品编号
*/
@NotBlank(message = "{FileEntity.fileProductNumber.blank}",groups={FileQoInsert.class})
private String fileProductNumber;
/**
* 上传模板的路径
*/
@NotBlank(message = "{FileEntity.fileUploadPath.blank}",groups={FileQoInsert.class})
private String fileUploadPath;
public String getFileModelNumber() {
return fileModelNumber;
}
public void setFileModelNumber(String fileModelNumber) {
this.fileModelNumber = fileModelNumber;
}
public String getFileBatchNumber() {
return fileBatchNumber;
}
public void setFileBatchNumber(String fileBatchNumber) {
this.fileBatchNumber = fileBatchNumber;
}
public String getFileMachineCode() {
return fileMachineCode;
}
public void setFileMachineCode(String fileMachineCode) {
this.fileMachineCode = fileMachineCode;
}
public String getFileProductNumber() {
return fileProductNumber;
}
public void setFileProductNumber(String fileProductNumber) {
this.fileProductNumber = fileProductNumber;
}
public String getFileUploadPath() {
return fileUploadPath;
}
public void setFileUploadPath(String fileUploadPath) {
this.fileUploadPath = fileUploadPath;
}
}

View File

@ -1,69 +0,0 @@
package com.xkrs.model.qo;
import com.xkrs.model.validation.FileUpdateQoUpdate;
import javax.validation.constraints.NotBlank;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 16:20
*/
public class FileUpdateQo {
/**
* 机种号
*/
@NotBlank(message = "{FileEntity.fileModelNumber.blank}",groups={FileUpdateQoUpdate.class})
private String fileModelNumber;
/**
* 批次号
*/
@NotBlank(message = "{FileEntity.fileBatchNumber.blank}",groups={FileUpdateQoUpdate.class})
private String fileBatchNumber;
/**
* 机器号
*/
@NotBlank(message = "{FileEntity.fileMachineCode.blank}",groups={FileUpdateQoUpdate.class})
private String fileMachineCode;
/**
* 产品编号
*/
@NotBlank(message = "{FileEntity.fileProductNumber.blank}",groups={FileUpdateQoUpdate.class})
private String fileProductNumber;
public String getFileModelNumber() {
return fileModelNumber;
}
public void setFileModelNumber(String fileModelNumber) {
this.fileModelNumber = fileModelNumber;
}
public String getFileBatchNumber() {
return fileBatchNumber;
}
public void setFileBatchNumber(String fileBatchNumber) {
this.fileBatchNumber = fileBatchNumber;
}
public String getFileMachineCode() {
return fileMachineCode;
}
public void setFileMachineCode(String fileMachineCode) {
this.fileMachineCode = fileMachineCode;
}
public String getFileProductNumber() {
return fileProductNumber;
}
public void setFileProductNumber(String fileProductNumber) {
this.fileProductNumber = fileProductNumber;
}
}

View File

@ -0,0 +1,124 @@
package com.xkrs.model.qo;
public class QcInspectionDataSourceQo {
/**
* 采集数据编号
*/
private Integer id;
/**
* 批次号
*/
private String lotNo;
/**
* 机器号
*/
private String machineNo;
/**
* 物料号
*/
private String materialNo;
/**
* 模具号
*/
private String modelNo;
/**
* 零件号
*/
private String partNo;
/**
* 检验项代码
*/
private String inspectionItemCode;
/**
* 检验数值
*/
private String inspectValue;
/**
* 质检规格编号
*/
private String inspectionSpecNo;
public QcInspectionDataSourceQo() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getInspectValue() {
return inspectValue;
}
public void setInspectValue(String inspectValue) {
this.inspectValue = inspectValue;
}
public String getInspectionSpecNo() {
return inspectionSpecNo;
}
public void setInspectionSpecNo(String inspectionSpecNo) {
this.inspectionSpecNo = inspectionSpecNo;
}
}

View File

@ -0,0 +1,111 @@
package com.xkrs.model.qo;
public class QcInspectionFileQo {
/**
* 编号
*/
private Integer id;
/**
* 批次号
*/
private String lotNo;
/**
* 机器号
*/
private String machineNo;
/**
* 物料号
*/
private String materialNo;
/**
* 模具号
*/
private String modelNo;
/**
* 零件号
*/
private String partNo;
/**
* 模板路径
*/
private String templatePath;
/**
* 文件路径
*/
private String filePath;
public QcInspectionFileQo() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getTemplatePath() {
return templatePath;
}
public void setTemplatePath(String templatePath) {
this.templatePath = templatePath;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
}

View File

@ -0,0 +1,46 @@
package com.xkrs.model.qo;
public class QcInspectionItemDictQo {
/**
* 索引
*/
private Integer id;
/**
* 检验项代码
*/
private String inspectionItemCode;
/**
* 检验项名称
*/
private String inspectionItemName;
public QcInspectionItemDictQo() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getInspectionItemName() {
return inspectionItemName;
}
public void setInspectionItemName(String inspectionItemName) {
this.inspectionItemName = inspectionItemName;
}
}

View File

@ -0,0 +1,98 @@
package com.xkrs.model.qo;
public class QcInspectionPictureQo {
/**
* 编号
*/
private Integer id;
/**
* 批次号
*/
private String lotNo;
/**
* 机器号
*/
private String machineNo;
/**
* 物料号
*/
private String materialNo;
/**
* 模具号
*/
private String modelNo;
/**
* 零件号
*/
private String partNo;
/**
* 图片路径
*/
private String picturePath;
public QcInspectionPictureQo() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getLotNo() {
return lotNo;
}
public void setLotNo(String lotNo) {
this.lotNo = lotNo;
}
public String getMachineNo() {
return machineNo;
}
public void setMachineNo(String machineNo) {
this.machineNo = machineNo;
}
public String getMaterialNo() {
return materialNo;
}
public void setMaterialNo(String materialNo) {
this.materialNo = materialNo;
}
public String getModelNo() {
return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getPicturePath() {
return picturePath;
}
public void setPicturePath(String picturePath) {
this.picturePath = picturePath;
}
}

View File

@ -0,0 +1,137 @@
package com.xkrs.model.qo;
public class QcInspectionSpecQo {
/**
* 规格编号
*/
private Integer id;
/**
* 零件号
*/
private String partNo;
/**
* 检验项代码
*/
private String inspectionItemCode;
/**
* 最大值
*/
private String max;
/**
* 平均值
*/
private String mean;
/**
* 最小值
*/
private String min;
/**
* 单位
*/
private String unit;
/**
* 检验方法
*/
private String inspectionMethod;
/**
* 检验标准
*/
private String inspectionStandard;
/**
* 备注
*/
private String remark;
public QcInspectionSpecQo() {
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
}
public String getInspectionItemCode() {
return inspectionItemCode;
}
public void setInspectionItemCode(String inspectionItemCode) {
this.inspectionItemCode = inspectionItemCode;
}
public String getMax() {
return max;
}
public void setMax(String max) {
this.max = max;
}
public String getMean() {
return mean;
}
public void setMean(String mean) {
this.mean = mean;
}
public String getMin() {
return min;
}
public void setMin(String min) {
this.min = min;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
public String getInspectionMethod() {
return inspectionMethod;
}
public void setInspectionMethod(String inspectionMethod) {
this.inspectionMethod = inspectionMethod;
}
public String getInspectionStandard() {
return inspectionStandard;
}
public void setInspectionStandard(String inspectionStandard) {
this.inspectionStandard = inspectionStandard;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 10:22
*/
public interface DataDictQoInsert {
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 11:23
*/
public interface DataDictUpdateQoUpdate {
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/19 16:39
*/
public interface DataSourceQoInsert {
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 15:26
*/
public interface FileQoInsert {
}

View File

@ -1,8 +0,0 @@
package com.xkrs.model.validation;
/**
* @Author: XinYi Song
* @Date: 2022/1/20 16:21
*/
public interface FileUpdateQoUpdate {
}

View File

@ -1,7 +1,6 @@
package com.xkrs.service;
import com.xkrs.model.entity.DataDict;
import com.xkrs.model.qo.DataDictQo;
import com.xkrs.model.qo.QcInspectionItemDictQo;
/**
* @Author: XinYi Song
@ -11,8 +10,8 @@ public interface DataDictService {
/**
* 添加字典数据
* @param dataDictQo
* @param inspectionItemDictQo
* @return
*/
String insertDataDict(DataDictQo dataDictQo);
String insertDataDict(QcInspectionItemDictQo inspectionItemDictQo);
}

View File

@ -1,6 +1,6 @@
package com.xkrs.service;
import com.xkrs.model.qo.DataSourceQo;
import com.xkrs.model.qo.QcInspectionDataSourceQo;
/**
* @Author: XinYi Song
@ -10,8 +10,9 @@ public interface DataSourceService {
/**
* 添加测量数据
* @param dataSourceQo
*
* @param inspectionDataSourceQo
* @return
*/
String insertDataSource(DataSourceQo dataSourceQo);
String insertDataSource(QcInspectionDataSourceQo inspectionDataSourceQo);
}

View File

@ -1,10 +1,9 @@
package com.xkrs.service;
import com.xkrs.model.qo.FileQo;
import com.xkrs.model.qo.QcInspectionFileQo;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
@ -15,15 +14,17 @@ public interface FileService {
/**
* 添加模板信息
* @param fileQo
*
* @param inspectionFileQo
* @return
*/
String insertFileExcel(FileQo fileQo,MultipartFile fileExcel) throws IOException;
String insertFileExcel(QcInspectionFileQo inspectionFileQo, MultipartFile fileExcel) throws IOException;
/**
* 导出excel
* @param fileQo
*
* @param inspectionFileQo
* @return
*/
String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException;
String exportExcel(QcInspectionFileQo inspectionFileQo) throws IOException, InvalidFormatException;
}

View File

@ -1,9 +1,9 @@
package com.xkrs.service.impl;
import com.xkrs.dao.DataDictDao;
import com.xkrs.dao.QcInspectionItemDictDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.DataDict;
import com.xkrs.model.qo.DataDictQo;
import com.xkrs.model.entity.QcInspectionItemDict;
import com.xkrs.model.qo.QcInspectionItemDictQo;
import com.xkrs.service.DataDictService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
@ -21,30 +21,31 @@ import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObje
public class DataDictServiceImpl implements DataDictService {
@Resource
private DataDictDao dataDictDao;
private QcInspectionItemDictDao inspectionItemDictDao;
/**
* 添加字典数据
* @param dataDictQo
*
* @param inspectionItemDictQo
* @return
*/
@Override
public String insertDataDict(DataDictQo dataDictQo) {
public String insertDataDict(QcInspectionItemDictQo inspectionItemDictQo) {
Locale locale = LocaleContextHolder.getLocale();
//DataDict byDictChineseName = dataDictDao.findByDictChineseName(dataDictQo.getDictChineseName());
/*DataDict chineseName = dataDictDao.findByModelNumberAndBatchNumberAndMachineCodeAndDictProductNumberAndDictChineseName(dataDictQo.getModelNumber(), dataDictQo.getBatchNumber(), dataDictQo.getMachineCode(), dataDictQo.getDictProductNumber(), dataDictQo.getDictChineseName());
//DataDict byDictChineseName = inspectionItemDictDao.findByDictChineseName(dataDictQo.getDictChineseName());
/*DataDict chineseName = inspectionItemDictDao.findByModelNumberAndBatchNumberAndMachineCodeAndDictProductNumberAndDictChineseName(dataDictQo.getModelNumber(), dataDictQo.getBatchNumber(), dataDictQo.getMachineCode(), dataDictQo.getDictProductNumber(), dataDictQo.getDictChineseName());
if(chineseName != null){
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale);
}*/
//DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName());
DataDict englishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName());
if(englishName != null){
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale);
//DataDict byDictEnglishName = inspectionItemDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName());
QcInspectionItemDict englishName = inspectionItemDictDao.findByInspectionItemCode(inspectionItemDictQo.getInspectionItemCode());
if (englishName != null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale);
}
DataDict dataDict = new DataDict();
dataDict.setDictChineseName(dataDictQo.getDictChineseName());
dataDict.setDictEnglishName(dataDictQo.getDictEnglishName());
dataDictDao.save(dataDict);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale);
QcInspectionItemDict qcInspectionItemDict = new QcInspectionItemDict();
qcInspectionItemDict.setInspectionItemName(inspectionItemDictQo.getInspectionItemName());
qcInspectionItemDict.setInspectionItemCode(inspectionItemDictQo.getInspectionItemCode());
inspectionItemDictDao.save(qcInspectionItemDict);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
}

View File

@ -1,11 +1,11 @@
package com.xkrs.service.impl;
import com.xkrs.dao.DataDictDao;
import com.xkrs.dao.DataSourceDao;
import com.xkrs.dao.QcInspectionDataSourceDao;
import com.xkrs.dao.QcInspectionItemDictDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.DataDict;
import com.xkrs.model.entity.DataSource;
import com.xkrs.model.qo.DataSourceQo;
import com.xkrs.model.entity.QcInspectionDataSource;
import com.xkrs.model.entity.QcInspectionItemDict;
import com.xkrs.model.qo.QcInspectionDataSourceQo;
import com.xkrs.service.DataSourceService;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
@ -23,37 +23,27 @@ import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObje
public class DataSourceServiceImpl implements DataSourceService {
@Resource
private DataSourceDao dataSourceDao;
private QcInspectionDataSourceDao inspectionDataSourceDao;
@Resource
private DataDictDao dataDictDao;
private QcInspectionItemDictDao inspectionItemDictDao;
/**
* 添加测量数据
* @param dataSourceQo
*
* @param inspectionDataSourceQo
* @return
*/
@Override
public String insertDataSource(DataSourceQo dataSourceQo) {
public String insertDataSource(QcInspectionDataSourceQo inspectionDataSourceQo) {
Locale locale = LocaleContextHolder.getLocale();
DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataSourceQo.getDataName());
if(byDictEnglishName == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"不存在该字典类型!",locale);
QcInspectionItemDict byDictEnglishName = inspectionItemDictDao.findByInspectionItemCode(inspectionDataSourceQo.getInspectionItemCode());
if (byDictEnglishName == null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该字典类型!", locale);
}
/*DataSource byDataName = dataSourceDao.findByDataName(dataSourceQo.getDataName());
if(byDataName != null){
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该字典类型数据已添加,请勿重复添加!",locale);
}*/
DataSource dataSource = new DataSource();
dataSource.setDataModelNumber(dataSourceQo.getDataModelNumber());
dataSource.setDataBatchNumber(dataSourceQo.getDataBatchNumber());
dataSource.setDataMachineCode(dataSourceQo.getDataMachineCode());
dataSource.setProductNumber(dataSourceQo.getProductNumber());
dataSource.setMaterial(dataSourceQo.getMaterial());
dataSource.setDataName(dataSourceQo.getDataName());
dataSource.setNumericalValue(dataSourceQo.getNumericalValue());
dataSourceDao.save(dataSource);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale);
QcInspectionDataSource qcInspectionDataSource = new QcInspectionDataSource();
//TODO 补充字段
inspectionDataSourceDao.save(qcInspectionDataSource);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
}

View File

@ -1,11 +1,12 @@
package com.xkrs.service.impl;
import com.xkrs.dao.DataDictDao;
import com.xkrs.dao.DataSourceDao;
import com.xkrs.dao.FileDao;
import com.xkrs.dao.QcInspectionDataSourceDao;
import com.xkrs.dao.QcInspectionFileDao;
import com.xkrs.encapsulation.PromptMessageEnum;
import com.xkrs.model.entity.FileEntity;
import com.xkrs.model.qo.FileQo;
import com.xkrs.model.entity.QcInspectionDataSource;
import com.xkrs.model.entity.QcInspectionFile;
import com.xkrs.model.entity.QcInspectionItemDict;
import com.xkrs.model.qo.QcInspectionFileQo;
import com.xkrs.service.FileService;
import com.xkrs.util.ExcelUploadUtil;
import com.xkrs.util.ExportExcel;
@ -15,7 +16,6 @@ import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.transaction.Transactional;
import java.io.IOException;
import java.util.HashMap;
@ -33,65 +33,78 @@ import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObje
public class FileServiceImpl implements FileService {
@Resource
private FileDao fileDao;
private QcInspectionFileDao inspectionFileDao;
@Resource
private DataDictDao dataDictDao;
private QcInspectionItemDict inspectionItemDict;
@Resource
private DataSourceDao dataSourceDao;
private QcInspectionDataSourceDao inspectionDataSourceDao;
/**
* 添加模板信息
* @param fileQo
*
* @param inspectionFileQo
* @return
*/
@Override
public String insertFileExcel(FileQo fileQo, MultipartFile fileExcel) throws IOException {
public String insertFileExcel(QcInspectionFileQo inspectionFileQo, MultipartFile fileExcel) throws IOException {
String lotNo = inspectionFileQo.getLotNo();
String machineNo = inspectionFileQo.getMachineNo();
String materialNo = inspectionFileQo.getMaterialNo();
String modelNo = inspectionFileQo.getModelNo();
String partNo = inspectionFileQo.getPartNo();
Locale locale = LocaleContextHolder.getLocale();
FileEntity fileEntity = fileDao.findByFileModelNumberAndFileBatchNumberAndFileMachineCodeAndFileProductNumber(fileQo.getFileModelNumber(), fileQo.getFileBatchNumber(), fileQo.getFileMachineCode(), fileQo.getFileProductNumber());
if(fileEntity != null){
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"已存在该产品的模板!",locale);
QcInspectionFile qcInspectionFile = inspectionFileDao.selectFile(lotNo, machineNo, materialNo, modelNo, partNo);
if (qcInspectionFile != null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该产品的模板!", locale);
}
if(fileExcel == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"模板不能为空!",locale);
if (fileExcel == null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "模板不能为空!", locale);
}
String file = ExcelUploadUtil.memoryFile(fileExcel);
FileEntity fileEntity1 = new FileEntity();
fileEntity1.setFileModelNumber(fileQo.getFileModelNumber());
fileEntity1.setFileBatchNumber(fileQo.getFileBatchNumber());
fileEntity1.setFileMachineCode(fileQo.getFileMachineCode());
fileEntity1.setFileProductNumber(fileQo.getFileProductNumber());
fileEntity1.setFileUploadPath(file);
QcInspectionFile fileEntity1 = new QcInspectionFile();
//TODO 补充字段
// fileEntity1.setFileModelNumber(fileQo.getFileModelNumber());
// fileEntity1.setFileBatchNumber(fileQo.getFileBatchNumber());
// fileEntity1.setFileMachineCode(fileQo.getFileMachineCode());
// fileEntity1.setFileProductNumber(fileQo.getFileProductNumber());
// fileEntity1.setFileUploadPath(file);
fileDao.save(fileEntity1);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale);
inspectionFileDao.save(fileEntity1);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
}
/**
* 导出excel
* @param fileQo
*
* @param inspectionFileQo
* @return
*/
@Transactional(rollbackOn = Exception.class)
@Override
public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException {
public String exportExcel(QcInspectionFileQo inspectionFileQo) throws IOException, InvalidFormatException {
String lotNo = inspectionFileQo.getLotNo();
String machineNo = inspectionFileQo.getMachineNo();
String materialNo = inspectionFileQo.getMaterialNo();
String modelNo = inspectionFileQo.getModelNo();
String partNo = inspectionFileQo.getPartNo();
Locale locale = LocaleContextHolder.getLocale();
FileEntity entity = fileDao.findByFileModelNumberAndFileBatchNumberAndFileMachineCodeAndFileProductNumber(fileQo.getFileModelNumber(), fileQo.getFileBatchNumber(), fileQo.getFileMachineCode(), fileQo.getFileProductNumber());
if(entity == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的模板,请添加!",locale);
QcInspectionFile inspectionFile = inspectionFileDao.selectFile(lotNo, machineNo, materialNo, modelNo, partNo);
if (inspectionFile == null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale);
}
String fileUploadPath = entity.getFileUploadPath();
List<Map<String, String>> maps = dataSourceDao.selectDataNameAndData(fileQo.getFileModelNumber(), fileQo.getFileBatchNumber(), fileQo.getFileMachineCode(), fileQo.getFileProductNumber());
if(maps == null || maps.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的信息!",locale);
String templatePath = inspectionFile.getTemplatePath();
List<QcInspectionDataSource> inspectionDataSources = inspectionDataSourceDao.selectDataSource(lotNo, machineNo, materialNo, modelNo, partNo);
if (inspectionDataSources == null || inspectionDataSources.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale);
}
Map<String,String> map = new HashMap<String,String>();
for(Map<String,String> stringMap : maps){
map.put(stringMap.get("dataname"),stringMap.get("numericalvalue"));
Map<String, String> map = new HashMap<>();
for (QcInspectionDataSource inspectionDataSource : inspectionDataSources) {
map.put(inspectionDataSource.getInspectionItemCode(), inspectionDataSource.getInspectValue());
}
String fill = ExportExcel.exportToProveExcel(map,fileUploadPath);
fileDao.updateFileDownloadPath(fileQo.getFileModelNumber(), fileQo.getFileBatchNumber(), fileQo.getFileMachineCode(), fileQo.getFileProductNumber(),fill);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,fill,locale);
String fill = ExportExcel.exportToProveExcel(map, templatePath);
inspectionFileDao.updateFilePath(lotNo, machineNo, materialNo, modelNo, partNo, fill);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale);
}
}

View File

@ -1,10 +1,9 @@
package com.xkrs.util;
import com.xkrs.dao.DataDictDao;
import com.xkrs.model.entity.DataDict;
import com.xkrs.dao.QcInspectionItemDictDao;
import com.xkrs.model.entity.QcInspectionItemDict;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import javax.persistence.criteria.CriteriaBuilder;
@ -22,27 +21,28 @@ import java.util.List;
public class Query {
@Resource
private DataDictDao dataDictDao;
private QcInspectionItemDictDao inspectionItemDictDao;
/**
* 动态多条件查询字典信息
*
* @return
*/
public List<DataDict> selectDataDict(String dictChineseName,String dictEnglishName) {
Specification<DataDict> specification = new Specification<DataDict>() {
public List<QcInspectionItemDict> selectDataDict(String dictChineseName, String dictEnglishName) {
Specification<QcInspectionItemDict> specification = new Specification<QcInspectionItemDict>() {
@Override
public Predicate toPredicate(Root<DataDict> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
public Predicate toPredicate(Root<QcInspectionItemDict> root, CriteriaQuery<?> criteriaQuery, CriteriaBuilder criteriaBuilder) {
List<Predicate> list = new ArrayList<>();
if(dictChineseName != null && !"".equals(dictChineseName)){
if (dictChineseName != null && !"".equals(dictChineseName)) {
list.add(criteriaBuilder.equal(root.get("dictChineseName").as(String.class), dictChineseName));
}
if(dictEnglishName != null && !"".equals(dictEnglishName)){
if (dictEnglishName != null && !"".equals(dictEnglishName)) {
list.add(criteriaBuilder.equal(root.get("dictEnglishName").as(String.class), dictEnglishName));
}
Predicate[] predicates = new Predicate[list.size()];
return criteriaBuilder.and(list.toArray(predicates));
}
};
return dataDictDao.findAll(specification);
return inspectionItemDictDao.findAll(specification);
}
}