Commit 06058d11 by lijingjing

手动填写样品编号默认大写;

parent 997ba7f3
......@@ -202,9 +202,28 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
return HmConst.EXIST_CODE_MATERIALS.equals(chemicalCategory.getName());
}
/**
* 转换自动大写编号
* @param sample
*/
private void toSampleCodeUpperCase(EntrustSample sample) {
String code = sample.getCode(), firstCode = sample.getFirstCode(),
secondCode = sample.getSecondCode(), thirdCode = sample.getThirdCode();
if (StringUtils.isNotBlank(code)) {
sample.setCode(code.toUpperCase());
}
if (StringUtils.isNotBlank(firstCode)) {
sample.setFirstCode(firstCode.toUpperCase());
}
if (StringUtils.isNotBlank(secondCode)) {
sample.setFirstCode(secondCode.toUpperCase());
}
if (StringUtils.isNotBlank(thirdCode)) {
sample.setFirstCode(thirdCode.toUpperCase());
}
}
public void initSampleCode(Entrust entrust, EntrustSample sample) {
// 如果合同编号不为空,样品编号不为空,一级编号不为空,则不进行编号生成
if (null != sample.getContractSampleId() && StringUtils.isNotBlank(sample.getCode()) && StringUtils.isNotBlank(sample.getFirstCode())) {
return;
......@@ -262,7 +281,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
String replaceStr = "XX", inspectNo = "", secondCode = "", thirdCode = "";
// ==
if (HmConst.EXIST_CODE_MATERIALS.equals(parentCategory)) {
sampleCode = sample.getCode();
sampleCode = sample.getCode().toUpperCase();
} else {
Integer codeTypeVal = (Integer) codeType.getValue();
sampleCode = codeRuleService.getKey(codeTypeVal, codeType.getName(), sample);
......@@ -323,18 +342,18 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
if (StringUtils.isNotBlank(sampleCode)) {
sample.setCode(sampleCode);
sample.setFirstCode(sampleCode);
sample.setCode(sampleCode.toUpperCase());
sample.setFirstCode(sampleCode.toUpperCase());
// 默认一级编码
sample.setCodeType(codeTypeNo);
// 若为三级编号,修改对应类别
if (codeType == CodeTypeEnum.SAMPLE_WWJC_CODE) {
sample.setCodeType(2);
sample.setSecondCode(secondCode);
sample.setSecondCode(secondCode.toUpperCase(Locale.ROOT));
} else if (codeType == CodeTypeEnum.SAMPLE_YFL_CODE) {
sample.setCodeType(3);
sample.setSecondCode(secondCode);
sample.setThirdCode(thirdCode);
sample.setSecondCode(secondCode.toUpperCase(Locale.ROOT));
sample.setThirdCode(thirdCode.toUpperCase(Locale.ROOT));
}
}
}
......@@ -386,6 +405,8 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
sample.setThirdCode(thirdCode);
}
}
// 自动大写
toSampleCodeUpperCase(sample);
}
private String getSampleThirdCode(EntrustSample sample) {
......@@ -459,6 +480,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
EntrustSample sample = sampleDTO.convert(EntrustSample.class);
sample.setEntrustId(entrust.getId());
toSampleCodeUpperCase(sample);
// 只有在提交时,才初始化样品编号
if (isSubmit) {
// 判断是否样品为空时,需要考虑是否进场物资
......@@ -688,6 +710,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
EntrustSample sample = dto.convert(EntrustSample.class);
sample.setEntrustId(entrustId);
sample.setOrderBy(incNum);
toSampleCodeUpperCase(sample);
incNum += 10;
boolean isInsert = false;
// 如果室新增的样品
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment