Commit 2f39ea94 by lijingjing

修复三级编码 三期编码问题;

parent 72464a23
...@@ -13,18 +13,13 @@ import com.patzn.cloud.commons.service.impl.BaseServiceImpl; ...@@ -13,18 +13,13 @@ import com.patzn.cloud.commons.service.impl.BaseServiceImpl;
import com.patzn.cloud.feign.base.client.SysOrgClient; import com.patzn.cloud.feign.base.client.SysOrgClient;
import com.patzn.cloud.feign.lims.hmhj.client.LmsChemicalCategoryClient; import com.patzn.cloud.feign.lims.hmhj.client.LmsChemicalCategoryClient;
import com.patzn.cloud.service.base.entity.SysOrg; import com.patzn.cloud.service.base.entity.SysOrg;
import com.patzn.cloud.service.hmhj.entity.ContractSample; import com.patzn.cloud.service.hmhj.entity.*;
import com.patzn.cloud.service.hmhj.entity.ContractSampling;
import com.patzn.cloud.service.hmhj.entity.UserInspectionCode;
import com.patzn.cloud.service.hmhj.enums.CodeTypeEnum; import com.patzn.cloud.service.hmhj.enums.CodeTypeEnum;
import com.patzn.cloud.service.hmhj.vo.ContractSamplingVO; import com.patzn.cloud.service.hmhj.vo.ContractSamplingVO;
import com.patzn.cloud.service.lims.chemical.entity.LmsChemicalCategory; import com.patzn.cloud.service.lims.chemical.entity.LmsChemicalCategory;
import com.patzn.cloud.service.lims.hmhj.common.consts.HmConst; import com.patzn.cloud.service.lims.hmhj.common.consts.HmConst;
import com.patzn.cloud.service.lims.hmhj.mapper.ContractSamplingMapper; import com.patzn.cloud.service.lims.hmhj.mapper.ContractSamplingMapper;
import com.patzn.cloud.service.lims.hmhj.service.ICodeRuleService; import com.patzn.cloud.service.lims.hmhj.service.*;
import com.patzn.cloud.service.lims.hmhj.service.IContractSampleService;
import com.patzn.cloud.service.lims.hmhj.service.IContractSamplingService;
import com.patzn.cloud.service.lims.hmhj.service.IUserInspectionCodeService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -46,9 +41,15 @@ public class ContractSamplingServiceImpl extends BaseServiceImpl<ContractSamplin ...@@ -46,9 +41,15 @@ public class ContractSamplingServiceImpl extends BaseServiceImpl<ContractSamplin
private SysOrgClient sysOrgClient; private SysOrgClient sysOrgClient;
@Autowired @Autowired
private UserInfoServiceImpl userInfoService;
@Autowired
private ICodeRuleService codeRuleService; private ICodeRuleService codeRuleService;
@Autowired @Autowired
private IMaterialService materialService;
@Autowired
private IContractSampleService contractSampleService; private IContractSampleService contractSampleService;
@Autowired @Autowired
...@@ -101,6 +102,26 @@ public class ContractSamplingServiceImpl extends BaseServiceImpl<ContractSamplin ...@@ -101,6 +102,26 @@ public class ContractSamplingServiceImpl extends BaseServiceImpl<ContractSamplin
return saveOrUpdateBatch(sampleList); return saveOrUpdateBatch(sampleList);
} }
private String getSampleThirdCode(EntrustSample sample) {
RestAssert.fail(null == sample.getMaterialId(), "样品库-物资ID为空");
Material material = materialService.getById(sample.getMaterialId());
RestAssert.fail(null == material, "样品库-物资为空");
String factoryArea = material.getFactoryArea(), abbr = material.getAbbr();
RestAssert.fail(StringUtils.isBlank(factoryArea), "样品库-物资厂区为空");
RestAssert.fail(StringUtils.isBlank(abbr), "样品库-物资简写为空");
String type = "";
// type 处理
if (factoryArea.contains("二三期")) {
String period = userInfoService.getUserPeriod(LoginHelper.getAccount());
type = HmConst.SECOND_PERIOD.equals(period) ? "A" : "B";
type = type + (abbr.length() > 2 ? abbr : abbr + "0");
} else {
type = type + abbr;
}
String code = codeRuleService.getKey(type.toUpperCase(), "SN&@yyMMdd", sample);
return code;
}
@Override @Override
public boolean updateSampling(ContractSampling contractSampling) { public boolean updateSampling(ContractSampling contractSampling) {
return updateById(contractSampling); return updateById(contractSampling);
......
...@@ -340,8 +340,10 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -340,8 +340,10 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if (factoryArea.contains("二三期")) { if (factoryArea.contains("二三期")) {
String period = userInfoService.getUserPeriod(LoginHelper.getAccount()); String period = userInfoService.getUserPeriod(LoginHelper.getAccount());
type = HmConst.SECOND_PERIOD.equals(period) ? "A" : "B"; type = HmConst.SECOND_PERIOD.equals(period) ? "A" : "B";
type = type + (abbr.length() > 2 ? abbr : abbr + "0");
} else {
type = abbr;
} }
type = type + (abbr.length() > 2 ? abbr : abbr + "0");
String code = codeRuleService.getKey(type.toUpperCase(), "SN&@yyMMdd", sample); String code = codeRuleService.getKey(type.toUpperCase(), "SN&@yyMMdd", sample);
return code; return code;
} }
......
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