更新数据表Qo

This commit is contained in:
liuchengqian 2022-02-28 21:32:34 +08:00
parent 7e3f433e16
commit 9d463735c6
8 changed files with 170 additions and 136 deletions

View File

@ -81,7 +81,7 @@ public class DataDictController {
@Transactional(rollbackOn = Exception.class) @Transactional(rollbackOn = Exception.class)
public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo){ public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo){
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
dataDictDao.updateDict(dataDictUpdateQo.getId(),dataDictUpdateQo.getDictChineseName()); dataDictDao.updateDict(dataDictUpdateQo.getId(),dataDictUpdateQo.getInspectionItemName());
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale);
} }
} }

View File

@ -14,7 +14,7 @@ public class DataDictUpdateQo {
private Integer id; private Integer id;
/** /**
* 中文名称 * 质检项名称
*/ */
@NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictUpdateQoUpdate.class}) @NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictUpdateQoUpdate.class})
private String inspectionItemName; private String inspectionItemName;

View File

@ -1,9 +1,7 @@
package com.xkrs.model.qo; package com.xkrs.model.qo;
import com.xkrs.model.validation.DataDictQoInsert;
import com.xkrs.model.validation.DataSourceQoInsert; import com.xkrs.model.validation.DataSourceQoInsert;
import javax.persistence.Column;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
/** /**
@ -11,100 +9,105 @@ import javax.validation.constraints.NotBlank;
* @Date: 2022/1/19 16:37 * @Date: 2022/1/19 16:37
*/ */
public class DataSourceQo { public class DataSourceQo {
/**
* 机种号
*/
@NotBlank(message = "{DataSource.dataModelNumber.blank}",groups={DataSourceQoInsert.class})
private String dataModelNumber;
/** /**
* 批次号 * 批次号
*/ */
@NotBlank(message = "{DataSource.dataBatchNumber.blank}",groups={DataSourceQoInsert.class}) @NotBlank(message = "{DataSource.lotNo.blank}", groups = {DataSourceQoInsert.class})
private String dataBatchNumber; private String lotNo;
/** /**
* 机器号 * 机器号
*/ */
@NotBlank(message = "{DataSource.dataMachineCode.blank}",groups={DataSourceQoInsert.class}) @NotBlank(message = "{DataSource.machineNo.blank}", groups = {DataSourceQoInsert.class})
private String dataMachineCode; private String machineNo;
/** /**
* 模具 * 物料号
*/ */
@NotBlank(message = "{DataSource.productNumber.blank}",groups={DataSourceQoInsert.class}) @NotBlank(message = "{DataSource.materialNo.blank}", groups = {DataSourceQoInsert.class})
private String productNumber; private String materialNo;
/** /**
* 材料 * 模具号
*/ */
private String material; @NotBlank(message = "{DataSource.modelNo.blank}", groups = {DataSourceQoInsert.class})
private String modelNo;
/** /**
* 变量值 * 零件号
*/ */
@NotBlank(message = "{DataSource.dataName.blank}",groups={DataSourceQoInsert.class}) @NotBlank(message = "{DataSource.partNo.blank}", groups = {DataSourceQoInsert.class})
private String dataName; private String partNo;
/** /**
* 监测的数值 * 检验项代码
*/ */
@NotBlank(message = "{DataSource.numericalValue.blank}",groups={DataSourceQoInsert.class}) @NotBlank(message = "{DataSource.inspectionItemCode.blank}", groups = {DataSourceQoInsert.class})
private String numericalValue; private String inspectionItemCode;
public String getDataModelNumber() { /**
return dataModelNumber; * 检验数值
*/
@NotBlank(message = "{DataSource.inspectValue.blank}", groups = {DataSourceQoInsert.class})
private String inspectValue;
public DataSourceQo() {
} }
public void setDataModelNumber(String dataModelNumber) { public String getLotNo() {
this.dataModelNumber = dataModelNumber; return lotNo;
} }
public String getDataBatchNumber() { public void setLotNo(String lotNo) {
return dataBatchNumber; this.lotNo = lotNo;
} }
public void setDataBatchNumber(String dataBatchNumber) { public String getMachineNo() {
this.dataBatchNumber = dataBatchNumber; return machineNo;
} }
public String getDataMachineCode() { public void setMachineNo(String machineNo) {
return dataMachineCode; this.machineNo = machineNo;
} }
public void setDataMachineCode(String dataMachineCode) { public String getMaterialNo() {
this.dataMachineCode = dataMachineCode; return materialNo;
} }
public String getProductNumber() { public void setMaterialNo(String materialNo) {
return productNumber; this.materialNo = materialNo;
} }
public String getMaterial() { public String getModelNo() {
return material; return modelNo;
} }
public void setMaterial(String material) { public void setModelNo(String modelNo) {
this.material = material; this.modelNo = modelNo;
} }
public void setProductNumber(String productNumber) { public String getPartNo() {
this.productNumber = productNumber; return partNo;
} }
public String getDataName() { public void setPartNo(String partNo) {
return dataName; this.partNo = partNo;
} }
public void setDataName(String dataName) { public String getInspectionItemCode() {
this.dataName = dataName; return inspectionItemCode;
} }
public String getNumericalValue() { public void setInspectionItemCode(String inspectionItemCode) {
return numericalValue; this.inspectionItemCode = inspectionItemCode;
} }
public void setNumericalValue(String numericalValue) { public String getInspectValue() {
this.numericalValue = numericalValue; return inspectValue;
}
public void setInspectValue(String inspectValue) {
this.inspectValue = inspectValue;
} }
} }

View File

@ -1,6 +1,7 @@
package com.xkrs.model.qo; package com.xkrs.model.qo;
import com.xkrs.model.validation.FileQoInsert; import com.xkrs.model.validation.FileQoInsert;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
/** /**
@ -9,66 +10,83 @@ import javax.validation.constraints.NotBlank;
*/ */
public class FileQo { public class FileQo {
/**
* 机种号
*/
@NotBlank(message = "{FileEntity.fileModelNumber.blank}",groups={FileQoInsert.class})
private String fileModelNumber;
/** /**
* 批次号 * 批次号
*/ */
@NotBlank(message = "{FileEntity.fileBatchNumber.blank}",groups={FileQoInsert.class}) @NotBlank(message = "{FileEntity.lotNo.blank}", groups = {FileQoInsert.class})
private String fileBatchNumber; private String lotNo;
/** /**
* 机器号 * 机器号
*/ */
@NotBlank(message = "{FileEntity.fileMachineCode.blank}",groups={FileQoInsert.class}) @NotBlank(message = "{FileEntity.machineNo.blank}", groups = {FileQoInsert.class})
private String fileMachineCode; private String machineNo;
/** /**
* 产品编 * 物料
*/ */
@NotBlank(message = "{FileEntity.fileProductNumber.blank}",groups={FileQoInsert.class}) @NotBlank(message = "{FileEntity.materialNo.blank}", groups = {FileQoInsert.class})
private String fileProductNumber; private String materialNo;
/**
* 模具号
*/
@NotBlank(message = "{FileEntity.modelNo.blank}", groups = {FileQoInsert.class})
private String modelNo;
/**
* 零件号
*/
@NotBlank(message = "{FileEntity.partNo.blank}", groups = {FileQoInsert.class})
private String partNo;
/** /**
* 上传模板的路径 * 上传模板的路径
*/ */
@NotBlank(message = "{FileEntity.fileUploadPath.blank}",groups={FileQoInsert.class}) @NotBlank(message = "{FileEntity.fileUploadPath.blank}", groups = {FileQoInsert.class})
private String fileUploadPath; private String fileUploadPath;
public String getFileModelNumber() { public FileQo() {
return fileModelNumber;
} }
public void setFileModelNumber(String fileModelNumber) { public String getLotNo() {
this.fileModelNumber = fileModelNumber; return lotNo;
} }
public String getFileBatchNumber() { public void setLotNo(String lotNo) {
return fileBatchNumber; this.lotNo = lotNo;
} }
public void setFileBatchNumber(String fileBatchNumber) { public String getMachineNo() {
this.fileBatchNumber = fileBatchNumber; return machineNo;
} }
public String getFileMachineCode() { public void setMachineNo(String machineNo) {
return fileMachineCode; this.machineNo = machineNo;
} }
public void setFileMachineCode(String fileMachineCode) { public String getMaterialNo() {
this.fileMachineCode = fileMachineCode; return materialNo;
} }
public String getFileProductNumber() { public void setMaterialNo(String materialNo) {
return fileProductNumber; this.materialNo = materialNo;
} }
public void setFileProductNumber(String fileProductNumber) { public String getModelNo() {
this.fileProductNumber = fileProductNumber; 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 getFileUploadPath() { public String getFileUploadPath() {

View File

@ -11,59 +11,76 @@ import javax.validation.constraints.NotBlank;
*/ */
public class FileUpdateQo { public class FileUpdateQo {
/**
* 机种号
*/
@NotBlank(message = "{FileEntity.fileModelNumber.blank}",groups={FileUpdateQoUpdate.class})
private String fileModelNumber;
/** /**
* 批次号 * 批次号
*/ */
@NotBlank(message = "{FileEntity.fileBatchNumber.blank}",groups={FileUpdateQoUpdate.class}) @NotBlank(message = "{FileEntity.lotNo.blank}", groups = {FileUpdateQoUpdate.class})
private String fileBatchNumber; private String lotNo;
/** /**
* 机器号 * 机器号
*/ */
@NotBlank(message = "{FileEntity.fileMachineCode.blank}",groups={FileUpdateQoUpdate.class}) @NotBlank(message = "{FileEntity.machineNo.blank}", groups = {FileUpdateQoUpdate.class})
private String fileMachineCode; private String machineNo;
/** /**
* 产品编 * 物料
*/ */
@NotBlank(message = "{FileEntity.fileProductNumber.blank}",groups={FileUpdateQoUpdate.class}) @NotBlank(message = "{FileEntity.materialNo.blank}", groups = {FileUpdateQoUpdate.class})
private String fileProductNumber; private String materialNo;
public String getFileModelNumber() { /**
return fileModelNumber; * 模具号
*/
@NotBlank(message = "{FileEntity.modelNo.blank}", groups = {FileUpdateQoUpdate.class})
private String modelNo;
/**
* 零件号
*/
@NotBlank(message = "{FileEntity.partNo.blank}", groups = {FileUpdateQoUpdate.class})
private String partNo;
public FileUpdateQo() {
} }
public void setFileModelNumber(String fileModelNumber) { public String getLotNo() {
this.fileModelNumber = fileModelNumber; return lotNo;
} }
public String getFileBatchNumber() { public void setLotNo(String lotNo) {
return fileBatchNumber; this.lotNo = lotNo;
} }
public void setFileBatchNumber(String fileBatchNumber) { public String getMachineNo() {
this.fileBatchNumber = fileBatchNumber; return machineNo;
} }
public String getFileMachineCode() { public void setMachineNo(String machineNo) {
return fileMachineCode; this.machineNo = machineNo;
} }
public void setFileMachineCode(String fileMachineCode) { public String getMaterialNo() {
this.fileMachineCode = fileMachineCode; return materialNo;
} }
public String getFileProductNumber() { public void setMaterialNo(String materialNo) {
return fileProductNumber; this.materialNo = materialNo;
} }
public void setFileProductNumber(String fileProductNumber) { public String getModelNo() {
this.fileProductNumber = fileProductNumber; return modelNo;
}
public void setModelNo(String modelNo) {
this.modelNo = modelNo;
}
public String getPartNo() {
return partNo;
}
public void setPartNo(String partNo) {
this.partNo = partNo;
} }
} }

View File

@ -25,6 +25,7 @@ public class DataDictServiceImpl implements DataDictService {
/** /**
* 添加字典数据 * 添加字典数据
*
* @param dataDictQo * @param dataDictQo
* @return * @return
*/ */
@ -37,14 +38,14 @@ public class DataDictServiceImpl implements DataDictService {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale); return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale);
}*/ }*/
//DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName()); //DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName());
DataDict englishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName()); DataDict englishName = dataDictDao.findByDictEnglishName(dataDictQo.getInspectionItemCode());
if(englishName != null){ if (englishName != null) {
return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale); return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale);
} }
DataDict dataDict = new DataDict(); DataDict dataDict = new DataDict();
dataDict.setDictChineseName(dataDictQo.getDictChineseName()); dataDict.setInspectionItemName(dataDictQo.getInspectionItemName());
dataDict.setDictEnglishName(dataDictQo.getDictEnglishName()); dataDict.setInspectionItemCode(dataDictQo.getInspectionItemCode());
dataDictDao.save(dataDict); dataDictDao.save(dataDict);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale);
} }
} }

View File

@ -36,23 +36,18 @@ public class DataSourceServiceImpl implements DataSourceService {
@Override @Override
public String insertDataSource(DataSourceQo dataSourceQo) { public String insertDataSource(DataSourceQo dataSourceQo) {
Locale locale = LocaleContextHolder.getLocale(); Locale locale = LocaleContextHolder.getLocale();
DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataSourceQo.getDataName()); DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataSourceQo.getInspectionItemCode());
if(byDictEnglishName == null){ if(byDictEnglishName == null){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"不存在该字典类型!",locale); 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 dataSource = new DataSource();
dataSource.setDataModelNumber(dataSourceQo.getDataModelNumber()); dataSource.setLotNo(dataSourceQo.getLotNo());
dataSource.setDataBatchNumber(dataSourceQo.getDataBatchNumber()); dataSource.setMachineNo(dataSourceQo.getMachineNo());
dataSource.setDataMachineCode(dataSourceQo.getDataMachineCode()); dataSource.setMaterialNo(dataSourceQo.getMaterialNo());
dataSource.setProductNumber(dataSourceQo.getProductNumber()); dataSource.setModelNo(dataSourceQo.getModelNo());
dataSource.setMaterial(dataSourceQo.getMaterial()); dataSource.setPartNo(dataSourceQo.getPartNo());
dataSource.setDataName(dataSourceQo.getDataName()); dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode());
dataSource.setNumericalValue(dataSourceQo.getNumericalValue()); dataSource.setInspectValue(dataSourceQo.getInspectValue());
dataSourceDao.save(dataSource); dataSourceDao.save(dataSource);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale);
} }

View File

@ -58,12 +58,12 @@ public class FileServiceImpl implements FileService {
} }
String file = ExcelUploadUtil.memoryFile(fileExcel); String file = ExcelUploadUtil.memoryFile(fileExcel);
FileEntity fileEntity1 = new FileEntity(); FileEntity fileEntity1 = new FileEntity();
fileEntity1.setFileModelNumber(fileQo.getFileModelNumber()); fileEntity1.setLotNo(fileQo.getLotNo());
fileEntity1.setFileBatchNumber(fileQo.getFileBatchNumber()); fileEntity1.setMachineNo(fileQo.getMachineNo());
fileEntity1.setFileMachineCode(fileQo.getFileMachineCode()); fileEntity1.setMaterialNo(fileQo.getMaterialNo());
fileEntity1.setFileProductNumber(fileQo.getFileProductNumber()); fileEntity1.setModelNo(fileQo.getModelNo());
fileEntity1.setPartNo(fileQo.getPartNo());
fileEntity1.setFileUploadPath(file); fileEntity1.setFileUploadPath(file);
fileDao.save(fileEntity1); fileDao.save(fileEntity1);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale);
} }
@ -86,7 +86,7 @@ public class FileServiceImpl implements FileService {
if(maps == null || maps.size() == 0){ if(maps == null || maps.size() == 0){
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的信息!",locale); return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的信息!",locale);
} }
Map<String,String> map = new HashMap<String,String>(); Map<String,String> map = new HashMap<>();
for(Map<String,String> stringMap : maps){ for(Map<String,String> stringMap : maps){
map.put(stringMap.get("dataname"),stringMap.get("numericalvalue")); map.put(stringMap.get("dataname"),stringMap.get("numericalvalue"));
} }