Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
patzn-cloud-service-hmhj
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangweidong
patzn-cloud-service-hmhj
Commits
5cffced4
Commit
5cffced4
authored
Jan 05, 2022
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修约问题修改;
parent
39a65541
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
104 additions
and
33 deletions
+104
-33
Operation.java
...com/patzn/cloud/service/lims/hmhj/original/Operation.java
+8
-6
EntrustSampleItemServiceImpl.java
.../lims/hmhj/service/impl/EntrustSampleItemServiceImpl.java
+79
-8
EntrustServiceImpl.java
...ud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
+12
-2
EntrustMapper.xml
src/main/resources/mapper/hmhj/EntrustMapper.xml
+5
-17
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/original/Operation.java
View file @
5cffced4
...
@@ -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
);
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleItemServiceImpl.java
View file @
5cffced4
...
@@ -972,6 +972,8 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -972,6 +972,8 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
@Override
@Override
public
boolean
updateQualityJudge
(
Long
[]
ids
,
Account
account
)
{
public
boolean
updateQualityJudge
(
Long
[]
ids
,
Account
account
)
{
logger
.
error
(
"======================质量判定开始========================"
);
RestAssert
.
fail
(
null
==
ids
||
ids
.
length
==
0
,
"样品编号不能为空"
);
RestAssert
.
fail
(
null
==
ids
||
ids
.
length
==
0
,
"样品编号不能为空"
);
// ==
// ==
List
<
EntrustSampleVO
>
sampleList
=
entrustSampleService
.
getVOListByIds
(
Arrays
.
asList
(
ids
));
List
<
EntrustSampleVO
>
sampleList
=
entrustSampleService
.
getVOListByIds
(
Arrays
.
asList
(
ids
));
...
@@ -990,13 +992,16 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -990,13 +992,16 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
List
<
String
>
otherYsList
=
Arrays
.
asList
(
"Mn"
,
"V"
,
"Ni"
);
List
<
String
>
otherYsList
=
Arrays
.
asList
(
"Mn"
,
"V"
,
"Ni"
);
List
<
EntrustSample
>
updateSampleList
=
new
ArrayList
<>();
List
<
EntrustSample
>
updateSampleList
=
new
ArrayList
<>();
// 是否外委数据
boolean
isOutEntrustData
=
contractSampleService
.
isOutEntrustData
(
sampleList
.
get
(
0
).
getContractSampleId
());
boolean
isOutEntrustData
=
contractSampleService
.
isOutEntrustData
(
sampleList
.
get
(
0
).
getContractSampleId
());
logger
.
error
(
"是否外委数据:"
+
isOutEntrustData
);
for
(
EntrustSampleVO
sampleVO
:
sampleList
)
{
for
(
EntrustSampleVO
sampleVO
:
sampleList
)
{
EntrustSample
sample
=
sampleVO
.
convert
(
EntrustSample
.
class
);
EntrustSample
sample
=
sampleVO
.
convert
(
EntrustSample
.
class
);
logger
.
error
(
"====样品编号:{},样品名称:{}"
,
sample
.
getCode
(),
sample
.
getName
());
// 若为此标准,需要判断是否需要过滤掉稀有元素的判断
// 若为此标准,需要判断是否需要过滤掉稀有元素的判断
boolean
isSpecStandard
=
sampleVO
.
getProductCode
().
contains
(
"GB/T 1196 2017"
);
boolean
isSpecStandard
=
sampleVO
.
getProductCode
().
contains
(
"GB/T 1196 2017"
);
logger
.
error
(
"====是否GB/T 1196 2017标准:"
+
isSpecStandard
);
// 检测值【内部检测值实际为指标表中数据,外委检测值为检测项目数据】
// 检测值【内部检测值实际为指标表中数据,外委检测值为检测项目数据】
List
<
EntrustSampleItemVO
>
sampleItemList
;
List
<
EntrustSampleItemVO
>
sampleItemList
;
// 若为外部检测
// 若为外部检测
...
@@ -1008,13 +1013,20 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1008,13 +1013,20 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
}
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleItemList
),
"样品检测项目及内容不能为空"
);
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleItemList
),
"样品检测项目及内容不能为空"
);
StringBuffer
sb
=
new
StringBuffer
(
"====检测项目检测值:\r\n"
);
for
(
EntrustSampleItemVO
item
:
sampleItemList
)
{
sb
.
append
(
String
.
format
(
"itemName=%s,testValue=%s\r\n"
,
item
.
getName
(),
item
.
getTestValue
()));
}
logger
.
error
(
sb
.
toString
());
// 获得产品标准信息 -- 实时最新不是根据样品中的是否组合判定进行判定
// 获得产品标准信息 -- 实时最新不是根据样品中的是否组合判定进行判定
// 可能需要根据样品中的字段进行判断是否需要组合判定composeJudge
// 可能需要根据样品中的字段进行判断是否需要组合判定composeJudge
GradingStandard
standard
=
gradingStandardService
.
getById
(
sampleVO
.
getProductStandardId
());
GradingStandard
standard
=
gradingStandardService
.
getById
(
sampleVO
.
getProductStandardId
());
RestAssert
.
fail
(
null
==
standard
,
"产品标准不能为空"
);
RestAssert
.
fail
(
null
==
standard
,
"产品标准不能为空"
);
logger
.
error
(
"====检验标准,名称:{},编号:{},组合标识:{}"
,
standard
.
getName
(),
standard
.
getCode
(),
standard
.
getComposeJudge
());
// 是否组合判定
// 是否组合判定
boolean
isComposeJudgment
=
null
!=
standard
.
getComposeJudge
()
&&
1
==
standard
.
getComposeJudge
().
intValue
();
boolean
isComposeJudgment
=
null
!=
standard
.
getComposeJudge
()
&&
1
==
standard
.
getComposeJudge
().
intValue
();
logger
.
error
(
"====检验标准,是否组合判定:{}"
,
isComposeJudgment
);
// 计算合计-组合判定合计值
// 计算合计-组合判定合计值
BigDecimal
totalDecimal
=
sampleItemList
.
stream
().
map
(
t
->
{
BigDecimal
totalDecimal
=
sampleItemList
.
stream
().
map
(
t
->
{
if
(
StringUtils
.
isBlank
(
t
.
getTestValue
()))
{
if
(
StringUtils
.
isBlank
(
t
.
getTestValue
()))
{
...
@@ -1031,9 +1043,12 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1031,9 +1043,12 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
}
return
BigDecimal
.
ZERO
;
return
BigDecimal
.
ZERO
;
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
}).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
logger
.
error
(
"====杂质值:{}"
,
totalDecimal
);
// 杂质合计值修约
// 杂质合计值修约
double
totalValue
=
totalDecimal
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_EVEN
).
doubleValue
();
double
totalValue
=
totalDecimal
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_EVEN
).
doubleValue
();
logger
.
error
(
"====修约杂质值:{}"
,
totalValue
);
logger
.
error
(
"====检测项目值比较对象====="
);
// 获取检测项目值对象
// 获取检测项目值对象
Map
<
String
,
Double
>
itemDataMap
=
sampleItemList
.
stream
().
filter
(
t
->
{
Map
<
String
,
Double
>
itemDataMap
=
sampleItemList
.
stream
().
filter
(
t
->
{
// 如果检测项目为空气反应性或者是CO2反应性,则只比较残极率
// 如果检测项目为空气反应性或者是CO2反应性,则只比较残极率
...
@@ -1046,6 +1061,13 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1046,6 +1061,13 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
return
true
;
return
true
;
}).
collect
(
Collectors
.
toMap
(
EntrustSampleItemVO:
:
getName
,
t
->
Double
.
parseDouble
(
t
.
getTestValue
())));
}).
collect
(
Collectors
.
toMap
(
EntrustSampleItemVO:
:
getName
,
t
->
Double
.
parseDouble
(
t
.
getTestValue
())));
sb
=
new
StringBuffer
(
"====实际比较的检测项目:\r\n"
);
for
(
Map
.
Entry
<
String
,
Double
>
entry
:
itemDataMap
.
entrySet
())
{
sb
.
append
(
String
.
format
(
"检测项目,name:%s,testValue:%f"
,
entry
.
getKey
(),
entry
.
getValue
())).
append
(
"\r\n"
);
}
logger
.
error
(
sb
.
toString
());
// 获得产品等级信息
// 获得产品等级信息
List
<
GradingProduct
>
gradingProductList
=
gradingProductService
.
list
(
Condition
.
create
()
List
<
GradingProduct
>
gradingProductList
=
gradingProductService
.
list
(
Condition
.
create
()
.
eq
(
"grading_standard_id"
,
standard
.
getId
())
.
eq
(
"grading_standard_id"
,
standard
.
getId
())
...
@@ -1054,7 +1076,13 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1054,7 +1076,13 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
gradingProductList
),
"产品标准不能为空"
);
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
gradingProductList
),
"产品标准不能为空"
);
sb
=
new
StringBuffer
(
"====产品标准:\r\n"
);
for
(
GradingProduct
gp
:
gradingProductList
)
{
sb
.
append
(
String
.
format
(
"grade:%s,sumVal:%f,symbol:%s"
,
gp
.
getProductGrade
(),
gp
.
getSumValue
(),
gp
.
getSumCompare
())).
append
(
"\r\n"
);
}
logger
.
error
(
sb
.
toString
());
logger
.
error
(
"==== 循环产品等级 ==== "
);
// 循环产品标准依次判定级别
// 循环产品标准依次判定级别
for
(
int
i
=
0
;
i
<
gradingProductList
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
gradingProductList
.
size
();
i
++)
{
// 最后一个判定级别
// 最后一个判定级别
...
@@ -1062,14 +1090,22 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1062,14 +1090,22 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
// ==
// ==
GradingProduct
product
=
gradingProductList
.
get
(
i
);
GradingProduct
product
=
gradingProductList
.
get
(
i
);
logger
.
error
(
"==== GradingProduct, grade:{},sumVal:{},symbol:{}"
,
product
.
getProductGrade
(),
product
.
getSumValue
(),
product
.
getSumCompare
());
// 比较单个大小是否都符合
// 比较单个大小是否都符合
List
<
GradingItem
>
gradingItemList
=
gradingItemService
.
list
(
Condition
.
create
().
eq
(
"grading_product_id"
,
product
.
getId
()).
isNotNull
(
"limit_value"
));
List
<
GradingItem
>
gradingItemList
=
gradingItemService
.
list
(
Condition
.
create
().
eq
(
"grading_product_id"
,
product
.
getId
()).
isNotNull
(
"limit_value"
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
gradingItemList
),
"产品等级【"
+
product
.
getProductGrade
()
+
"】下的检测项目为空"
);
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
gradingItemList
),
"产品等级【"
+
product
.
getProductGrade
()
+
"】下的检测项目为空"
);
sb
=
new
StringBuffer
(
"====过滤前产品下检测项目:\r\n"
);
// 若存在
// 若存在
gradingItemList
.
forEach
(
t
->
{
for
(
GradingItem
t
:
gradingItemList
)
{
RestAssert
.
fail
(
StringUtils
.
isBlank
(
t
.
getDecisionSymbol
()),
"产品等级下产品检测项目比较符为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
t
.
getDecisionSymbol
()),
"产品等级下产品检测项目比较符为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
t
.
getLimitValue
()),
"产品等级下产品检测项目限制值为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
t
.
getLimitValue
()),
"产品等级下产品检测项目限制值为空"
);
});
sb
.
append
(
String
.
format
(
"name:%s,symbol:%s,limitVal:%s"
,
t
.
getName
(),
t
.
getDecisionSymbol
(),
t
.
getLimitValue
())).
append
(
"\r\n"
);
}
logger
.
error
(
sb
.
toString
());
// 过滤 只要名称包含
// 过滤 只要名称包含
List
<
GradingItem
>
gradingItems
=
gradingItemList
.
stream
().
filter
(
t
->
{
List
<
GradingItem
>
gradingItems
=
gradingItemList
.
stream
().
filter
(
t
->
{
// 不包含的检测项目,过滤掉
// 不包含的检测项目,过滤掉
...
@@ -1079,17 +1115,33 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1079,17 +1115,33 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
return
true
;
return
true
;
}).
collect
(
Collectors
.
toList
());
}).
collect
(
Collectors
.
toList
());
sb
=
new
StringBuffer
(
"====过滤后产品下检测项目:\r\n"
);
for
(
GradingItem
t
:
gradingItemList
)
{
sb
.
append
(
String
.
format
(
"name:%s,symbol:%s,limitVal:%s"
,
t
.
getName
(),
t
.
getDecisionSymbol
(),
t
.
getLimitValue
())).
append
(
"\r\n"
);
}
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
gradingItems
),
"产品等级【"
+
product
.
getProductGrade
()
+
"】下的检测项目过滤后为空"
);
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
gradingItems
),
"产品等级【"
+
product
.
getProductGrade
()
+
"】下的检测项目过滤后为空"
);
logger
.
error
(
sb
.
toString
());
logger
.
error
(
"==== 循环判断是否符合判定 ===="
);
logger
.
error
(
"==== gradingItems.stream().anyMatch ===="
);
logger
.
error
(
"==== 若一直失败,匹配的是失败结果"
);
// 若失败,则进入下一判级
// 若失败,则进入下一判级
if
(
gradingItems
.
stream
().
anyMatch
(
t
->
{
if
(
gradingItems
.
stream
().
anyMatch
(
t
->
{
// 获取填写检测值
// 获取填写检测值
double
testValue
=
getValue
(
itemDataMap
,
t
.
getName
());
double
testValue
=
getValue
(
itemDataMap
,
t
.
getName
());
logger
.
error
(
"==== name:{},testValue:{}"
,
t
.
getName
(),
testValue
);
// 若不包含正常的比较符,那么则为区间比较符
// 若不包含正常的比较符,那么则为区间比较符
if
(!
CompareUtils
.
Comparator
.
containsKey
(
t
.
getDecisionSymbol
()))
{
if
(!
CompareUtils
.
Comparator
.
containsKey
(
t
.
getDecisionSymbol
()))
{
logger
.
error
(
"====区间判定"
);
String
[]
dataArr
=
t
.
getLimitValue
().
split
(
","
);
String
[]
dataArr
=
t
.
getLimitValue
().
split
(
","
);
RestAssert
.
fail
(
dataArr
.
length
!=
2
,
String
.
format
(
"样品编号【%s】缺失检测范围值"
,
sample
.
getCode
()));
RestAssert
.
fail
(
dataArr
.
length
!=
2
,
String
.
format
(
"样品编号【%s】缺失检测范围值"
,
sample
.
getCode
()));
try
{
try
{
double
minV
=
Double
.
parseDouble
(
dataArr
[
0
].
trim
()),
maxV
=
Double
.
parseDouble
(
dataArr
[
1
].
trim
());
double
minV
=
Double
.
parseDouble
(
dataArr
[
0
].
trim
()),
maxV
=
Double
.
parseDouble
(
dataArr
[
1
].
trim
());
logger
.
error
(
"==== minVal:{},maxVal:{},testValue:{}"
,
minV
,
maxV
,
testValue
);
logger
.
error
(
"==== 计算公式:testValue < minV || testValue > maxV"
);
logger
.
error
(
"==== 结果:{}"
,
(
testValue
<
minV
||
testValue
>
maxV
));
// 小于最小值 or 大于最大值
// 小于最小值 or 大于最大值
return
testValue
<
minV
||
testValue
>
maxV
;
return
testValue
<
minV
||
testValue
>
maxV
;
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
...
@@ -1098,12 +1150,17 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1098,12 +1150,17 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
}
return
false
;
return
false
;
}
else
{
}
else
{
return
!
CompareUtils
.
Comparator
.
get
(
t
.
getDecisionSymbol
()).
calc
(
testValue
,
Double
.
parseDouble
(
t
.
getLimitValue
()));
logger
.
error
(
"==== 正常符号比较判定"
);
logger
.
error
(
"==== symbol:{},testValue:{},limitValue:{}"
,
t
.
getDecisionSymbol
(),
testValue
,
t
.
getLimitValue
());
boolean
res
=
CompareUtils
.
Comparator
.
get
(
t
.
getDecisionSymbol
()).
calc
(
testValue
,
Double
.
parseDouble
(
t
.
getLimitValue
()));
logger
.
error
(
"==== 判定结果:{}"
,
res
);
return
!
res
;
}
}
}
}
))
{
))
{
// 若为最后一个级别,那么判定结果
// 若为最后一个级别,那么判定结果
if
(
isLastGrading
)
{
if
(
isLastGrading
)
{
logger
.
error
(
"==== 最后一条标准,结论不合格"
);
updateJudgeNoPass
(
sample
,
account
,
updateSampleList
);
updateJudgeNoPass
(
sample
,
account
,
updateSampleList
);
break
;
break
;
}
}
...
@@ -1112,33 +1169,47 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
...
@@ -1112,33 +1169,47 @@ public class EntrustSampleItemServiceImpl extends BaseServiceImpl<EntrustSampleI
}
}
// 继续判定是否为组合判定,若为组合判定,那么需要判定组合结果是否符合限定值
// 继续判定是否为组合判定,若为组合判定,那么需要判定组合结果是否符合限定值
logger
.
error
(
"==== 是否组合判定:{}"
,
isComposeJudgment
);
if
(
isComposeJudgment
)
{
if
(
isComposeJudgment
)
{
RestAssert
.
fail
(
null
==
product
.
getSumValue
(),
"产品标准合计值不能为空"
);
RestAssert
.
fail
(
null
==
product
.
getSumValue
(),
"产品标准合计值不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
product
.
getSumCompare
()),
"产品标准比较符不能为空"
);
RestAssert
.
fail
(
StringUtils
.
isBlank
(
product
.
getSumCompare
()),
"产品标准比较符不能为空"
);
// 根据比较符类型比较大小
if
(!
CompareUtils
.
Comparator
.
get
(
product
.
getSumCompare
()).
calc
(
totalValue
,
product
.
getSumValue
().
doubleValue
()))
{
logger
.
error
(
"==== 组合比较判定 ==== "
);
logger
.
error
(
"==== symbol:{},totalValue:{},sumValue:{}"
,
product
.
getSumCompare
(),
totalValue
,
product
.
getSumValue
());
boolean
res
=
CompareUtils
.
Comparator
.
get
(
product
.
getSumCompare
()).
calc
(
totalValue
,
product
.
getSumValue
().
doubleValue
());
logger
.
error
(
"==== 判定结果:{}"
,
res
);
// 根据比较符类型比较大小,若不符合,继续下一个
if
(!
res
)
{
if
(!
isLastGrading
)
{
if
(!
isLastGrading
)
{
continue
;
continue
;
}
}
logger
.
error
(
"==== 组合判定最后一个仍旧不合格"
);
updateJudgeNoPass
(
sample
,
account
,
updateSampleList
);
updateJudgeNoPass
(
sample
,
account
,
updateSampleList
);
break
;
break
;
}
}
}
}
logger
.
error
(
"====############# 组合判定合格 #############==== "
);
// 样品判定合格
// 样品判定合格
updateSampleList
.
add
(
sample
.
setOkJudge
(
"合格"
).
setJudger
(
account
.
getUserName
()).
setJudgerId
(
account
.
getUserId
())
updateSampleList
.
add
(
sample
.
setOkJudge
(
"合格"
).
setJudger
(
account
.
getUserName
()).
setJudgerId
(
account
.
getUserId
())
.
setJudgeTime
(
new
Date
()).
setJudgeStatus
(
0
).
setJudgeProgress
(
0
)
.
setJudgeTime
(
new
Date
()).
setJudgeStatus
(
0
).
setJudgeProgress
(
0
)
.
setSampleGrading
(
product
.
getProductGrade
()));
.
setSampleGrading
(
product
.
getProductGrade
()));
logger
.
error
(
"====判定合格品级:sampleId:{},sampleName:{},sampleCode:{},grading:{}"
,
sample
.
getId
(),
sample
.
getName
(),
sample
.
getCode
(),
sample
.
getSampleGrading
());
break
;
break
;
}
}
}
}
if
(
updateSampleList
.
size
()
>
0
)
{
if
(
updateSampleList
.
size
()
>
0
)
{
entrustSampleService
.
updateBatchById
(
updateSampleList
);
entrustSampleService
.
updateBatchById
(
updateSampleList
);
logger
.
error
(
"====更新样品判级:]\r\n"
);
for
(
EntrustSample
s
:
updateSampleList
){
logger
.
error
(
"====判定合格品级:sampleId:{},sampleName:{},sampleCode:{},grading:{}"
,
s
.
getId
(),
s
.
getName
(),
s
.
getCode
(),
s
.
getSampleGrading
());
}
}
}
// 处理正常的报告文件
// 处理正常的报告文件
handleSampleBrand
(
ids
,
false
);
handleSampleBrand
(
ids
,
false
);
// 处理一级编码的报告文件
// 处理一级编码的报告文件
handleSampleBrand
(
ids
,
true
);
handleSampleBrand
(
ids
,
true
);
logger
.
error
(
"======================质量判定结束========================"
);
return
true
;
return
true
;
}
}
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
View file @
5cffced4
...
@@ -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
);
// 样品编号问题,手填的样品编号不清空
// 样品编号问题,手填的样品编号不清空
...
...
src/main/resources/mapper/hmhj/EntrustMapper.xml
View file @
5cffced4
...
@@ -243,34 +243,22 @@
...
@@ -243,34 +243,22 @@
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
<if
test=
"null != vo.itemStatus"
>
and esi.status = #{vo.itemStatus}
and esi.status = #{vo.itemStatus}
)
</if>
</if>
<if
test=
"null!=vo.itemStatusEnumList"
>
<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
and esi.status IN
<foreach
collection=
"vo.itemStatusEnumList"
index=
"index"
item=
"status"
open=
"("
separator=
","
close=
")"
>
<foreach
collection=
"vo.itemStatusEnumList"
index=
"index"
item=
"status"
open=
"("
separator=
","
close=
")"
>
#{status}
#{status}
</foreach>
</foreach>
)
</if>
</if>
<if
test=
"null!=vo.testerId"
>
<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}
and esi.tester_id = #{vo.testerId}
-- 数据录入节点,处理完成的数据不再显示
<if
test=
"null != vo.itemStatus"
>
and esi.status = #{vo.itemStatus}
</if>
</if>
)
)
</if>
</if>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment