Commit 5cffced4 by lijingjing

修约问题修改;

parent 39a65541
...@@ -13,6 +13,7 @@ public interface Operation { ...@@ -13,6 +13,7 @@ public interface Operation {
/** /**
* 对从直读光谱中抓取过来的原铝分析结果,进行修约 * 对从直读光谱中抓取过来的原铝分析结果,进行修约
*
* @param cell * @param cell
* @param value * @param value
* @param roundNum * @param roundNum
...@@ -32,21 +33,22 @@ public interface Operation { ...@@ -32,21 +33,22 @@ public interface Operation {
// CEILING(ABS(TRUNC(A1,B1+1)-0.5*10^(-B1),2*10^(-B1)*SIGN(A1))) // CEILING(ABS(TRUNC(A1,B1+1)-0.5*10^(-B1),2*10^(-B1)*SIGN(A1)))
int beginIndex = value.lastIndexOf(".") + 1, valueLength = value.length(); int beginIndex = value.lastIndexOf(".") + 1, valueLength = value.length();
String intVal = value.substring(0, value.indexOf(".") + 1);
int remindLength = valueLength - beginIndex; int remindLength = valueLength - beginIndex;
String truncValue = "", zeroStr = "000000000"; String truncValue = "", zeroStr = "000000000";
// bdA = TRUNC(A1,B1+5)*10^B1 // bdA = TRUNC(A1,B1+5)*10^B1
if (remindLength >= roundNum + 5) { if (remindLength >= roundNum + 5) {
truncValue = "0." + value.substring(beginIndex, beginIndex + roundNum + 5); truncValue = intVal + value.substring(beginIndex, beginIndex + roundNum + 5);
} else { } else {
truncValue = "0." + value.substring(beginIndex) + zeroStr.substring(0, roundNum + 5 - remindLength); truncValue = intVal + value.substring(beginIndex) + zeroStr.substring(0, roundNum + 5 - remindLength);
} }
BigDecimal bdDiff = new BigDecimal(truncValue).scaleByPowerOfTen(roundNum); BigDecimal bdDiff = new BigDecimal(truncValue).scaleByPowerOfTen(roundNum);
// bdB = TRUNC(A1,B1+5)*10^B1 // bdB = TRUNC(A1,B1+5)*10^B1
if (remindLength >= roundNum) { if (remindLength >= roundNum) {
truncValue = "0." + value.substring(beginIndex, beginIndex + roundNum); truncValue = intVal + value.substring(beginIndex, beginIndex + roundNum);
} else { } else {
truncValue = "0." + value.substring(beginIndex) + zeroStr.substring(0, roundNum - remindLength); truncValue = intVal + value.substring(beginIndex) + zeroStr.substring(0, roundNum - remindLength);
} }
bdDiff = bdDiff.subtract(new BigDecimal(truncValue).scaleByPowerOfTen(roundNum)).abs(); bdDiff = bdDiff.subtract(new BigDecimal(truncValue).scaleByPowerOfTen(roundNum)).abs();
...@@ -59,9 +61,9 @@ public interface Operation { ...@@ -59,9 +61,9 @@ public interface Operation {
// 处理第三种情况 // 处理第三种情况
// CEILING(ABS(TRUNC(A1,B1+1)-0.5*10^(-B1),2*10^(-B1)*SIGN(A1)) // CEILING(ABS(TRUNC(A1,B1+1)-0.5*10^(-B1),2*10^(-B1)*SIGN(A1))
if (remindLength >= roundNum + 1) { if (remindLength >= roundNum + 1) {
truncValue = "0." + value.substring(beginIndex, beginIndex + roundNum + 1); truncValue = intVal + value.substring(beginIndex, beginIndex + roundNum + 1);
} else { } else {
truncValue = "0." + value.substring(beginIndex) + zeroStr.substring(0, roundNum + 1 - remindLength); truncValue = intVal + value.substring(beginIndex) + zeroStr.substring(0, roundNum + 1 - remindLength);
} }
bdDiff = new BigDecimal(truncValue); bdDiff = new BigDecimal(truncValue);
......
...@@ -329,7 +329,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -329,7 +329,14 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
if (null != samplingId) { if (null != samplingId) {
ContractSampling sampling = contractSamplingService.getById(samplingId); ContractSampling sampling = contractSamplingService.getById(samplingId);
sample.setCode(sampling.getCode()).setFirstCode(sampling.getFirstCode()) sample.setCode(sampling.getCode()).setFirstCode(sampling.getFirstCode())
.setSecondCode(sampling.getSecondCode()).setThirdCode(sampling.getThirdCode()); .setSecondCode(sampling.getSecondCode());
// 进场物资,使用针对进场物资的生成规则
if (1 == entrust.getType()) {
thirdCode = getSampleThirdCode(sample);
} else {
thirdCode = sampling.getThirdCode();
}
sample.setThirdCode(thirdCode);
} else { } else {
initSampleCode(entrust, sample); initSampleCode(entrust, sample);
if (StringUtils.isNotBlank(sampleCode)) { if (StringUtils.isNotBlank(sampleCode)) {
...@@ -340,6 +347,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -340,6 +347,9 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
sample.setSecondCode(secondCode); sample.setSecondCode(secondCode);
} }
if (StringUtils.isNotBlank(thirdCode)) { if (StringUtils.isNotBlank(thirdCode)) {
if (1 == entrust.getType()) {
thirdCode = getSampleThirdCode(sample);
}
sample.setThirdCode(thirdCode); sample.setThirdCode(thirdCode);
} }
} }
...@@ -1114,7 +1124,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust> ...@@ -1114,7 +1124,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
String sampleCode = sample.getCode(); String sampleCode = sample.getCode();
sample.setId(null); sample.setId(null);
sample.setId(IdWorker.getId()); sample.setId(IdWorker.getId());
sample.setCode(null); sample.setCode(null).setFirstCode(null).setSecondCode(null).setThirdCode(null);
//生成样品编号,可能存在为空的情况 //生成样品编号,可能存在为空的情况
initSampleCode(entrust, sample); initSampleCode(entrust, sample);
// 样品编号问题,手填的样品编号不清空 // 样品编号问题,手填的样品编号不清空
......
...@@ -243,35 +243,23 @@ ...@@ -243,35 +243,23 @@
WHERE e.deleted = 0 WHERE e.deleted = 0
<include refid="basicCondition"/> <include refid="basicCondition"/>
<if test="null!=vo.itemStatus"> <if test=" null != vo.itemStatus || null != vo.itemStatusEnumList || null != vo.testerId ">
and exists ( and exists (
select 1 from entrust_sample es select 1 from entrust_sample es
join entrust_sample_item esi on esi.entrust_sample_id = es.id join entrust_sample_item esi on esi.entrust_sample_id = es.id and esi.deleted = 0
where es.deleted = 0 and esi.deleted = 0 and es.entrust_id = e.id where es.entrust_id = e.id and es.deleted = 0
and esi.status = #{vo.itemStatus}
)
</if>
<if test="null!=vo.itemStatusEnumList">
and exists (
select 1 from entrust_sample es
join entrust_sample_item esi on esi.entrust_sample_id = es.id
where es.deleted = 0 and esi.deleted = 0 and es.entrust_id = e.id
and esi.status IN
<foreach collection="vo.itemStatusEnumList" index="index" item="status" open="(" separator="," close=")">
#{status}
</foreach>
)
</if>
<if test="null!=vo.testerId">
and exists (
select 1 from entrust_sample es
join entrust_sample_item esi on esi.entrust_sample_id = es.id
where es.deleted = 0 and esi.deleted = 0 and es.entrust_id = e.id
and esi.tester_id = #{vo.testerId}
-- 数据录入节点,处理完成的数据不再显示
<if test="null != vo.itemStatus"> <if test="null != vo.itemStatus">
and esi.status = #{vo.itemStatus} and esi.status = #{vo.itemStatus}
</if> </if>
<if test="null != vo.itemStatusEnumList">
and esi.status IN
<foreach collection="vo.itemStatusEnumList" index="index" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
<if test="null!=vo.testerId">
and esi.tester_id = #{vo.testerId}
</if>
) )
</if> </if>
order by e.entrust_time desc,e.code desc order by e.entrust_time desc,e.code desc
......
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