Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hg-smart
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
platform
hg-smart
Commits
f3aebddc
Commit
f3aebddc
authored
Sep 06, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-09-06 物料清单构件重复校验,零件重复覆盖
parent
1c4509c0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
35 deletions
+56
-35
HGSCTools.java
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
+56
-35
No files found.
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
View file @
f3aebddc
...
@@ -393,39 +393,63 @@ public class HGSCTools {
...
@@ -393,39 +393,63 @@ public class HGSCTools {
}
}
public
static
void
add
(
List
<
HGSC004A
>
arrayList
,
String
materialId
)
{
public
static
void
add
(
List
<
HGSC004A
>
arrayList
,
String
materialId
)
{
List
<
HGSC004
>
results
=
DaoBase
.
getInstance
().
query
(
HGSC004
.
QUERY
,
new
HashMap
<
String
,
Object
>(){
HGSC004
hgsc004
=
Hgsc004
.
getId
(
materialId
);
{
put
(
"id"
,
materialId
);}
List
<
HGSC004A
>
hgsc004aList
=
Optional
.
ofNullable
(
});
list
(
new
HashMap
<
String
,
Object
>(){{
put
(
HGSC004A
.
FIELD_material_id
,
materialId
);}})).
orElse
(
new
ArrayList
<>());
AssertUtils
.
isEmpty
(
results
,
"物料清单不存在!"
);
AssertUtils
.
isEmpty
(
Collections
.
singleton
(
hgsc004
),
"物料清单不存在,添加失败!"
);
AssertUtils
.
isTrue
(
hgsc004
.
getMaterialStatus
()==
2
||
hgsc004
.
getApprovalStatus
()==
2
,
"物料清单已提交或已审核,无法添加!"
);
for
(
HGSC004A
hgsc004a
:
arrayList
){
for
(
HGSC004A
hgsc004a
:
arrayList
){
//HGSC004A hgsc004a = new HGSC004A();
hgsc004a
.
setCompanyCode
(
hgsc004
.
getCompanyCode
());
//hgsc004a.fromMap(resultRow);
hgsc004a
.
setCompanyName
(
hgsc004
.
getCompanyName
());
hgsc004a
.
setCompanyCode
(
results
.
get
(
0
).
getCompanyCode
());
hgsc004a
.
setDepCode
(
hgsc004
.
getDepCode
());
hgsc004a
.
setCompanyName
(
results
.
get
(
0
).
getCompanyName
());
hgsc004a
.
setDepName
(
hgsc004
.
getDepName
());
hgsc004a
.
setDepCode
(
results
.
get
(
0
).
getDepCode
());
hgsc004a
.
setDepName
(
results
.
get
(
0
).
getDepName
());
hgsc004a
.
setProductCode
(
hgsc004a
.
getProjCodePrefix
().
trim
().
concat
(
hgsc004a
.
getProductCode
()));
hgsc004a
.
setProductCode
(
hgsc004a
.
getProjCodePrefix
().
trim
().
concat
(
hgsc004a
.
getProductCode
()));
hgsc004a
.
setProductName
(
hgsc004a
.
getProjNamePrefix
().
trim
().
concat
(
hgsc004a
.
getProductName
()));
hgsc004a
.
setProductName
(
hgsc004a
.
getProjNamePrefix
().
trim
().
concat
(
hgsc004a
.
getProductName
()));
if
(
hgsc004a
.
getParentProdCode
().
trim
().
isEmpty
()){
if
(
hgsc004a
.
getParentProdCode
().
trim
().
isEmpty
()){
hgsc004a
.
setParentProdCode
(
results
.
get
(
0
)
.
getProjCode
());
hgsc004a
.
setParentProdCode
(
hgsc004
.
getProjCode
());
hgsc004a
.
setParentProdName
(
results
.
get
(
0
)
.
getProjName
());
hgsc004a
.
setParentProdName
(
hgsc004
.
getProjName
());
hgsc004a
.
setMaterialId
(
results
.
get
(
0
)
.
getId
());
hgsc004a
.
setMaterialId
(
hgsc004
.
getId
());
hgsc004a
.
setLv
(
3
);
hgsc004a
.
setLv
(
3
);
}
else
{
}
else
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
/*Map<String,Object> paramMap = new HashMap<>();
paramMap
.
put
(
"companyCode"
,
hgsc004a
.
getCompanyCode
());
paramMap.put(HGSC004A.FIELD_company_code, hgsc004a.getCompanyCode());
paramMap
.
put
(
"projCode"
,
hgsc004a
.
getProjCode
());
paramMap.put(HGSC004A.FIELD_proj_code, hgsc004a.getProjCode());
paramMap
.
put
(
"lv"
,
3
);
paramMap.put(HGSC004A.FIELD_lv, 3);
paramMap
.
put
(
"productCode"
,
hgsc004a
.
getProjCodePrefix
().
trim
().
concat
(
hgsc004a
.
getParentProdCode
()));
paramMap.put(HGSC004A.FIELD_product_code, hgsc004a.getProjCodePrefix().trim().concat(hgsc004a.getParentProdCode()));*/
List
<
HGSC004A
>
hgsc004aList
=
list
(
paramMap
);
/*List<HGSC004A> hgsc004as = hgsc004aList.stream().filter(o ->
AssertUtils
.
isEmpty
(
hgsc004aList
,
String
.
format
(
"父节点-产品编号[%s]数据不存在,导入失败!"
,
hgsc004a
.
getProjCodePrefix
().
trim
().
concat
(
hgsc004a
.
getParentProdCode
())));
o.getProductCode().equals(hgsc004a.getProjCodePrefix().trim().concat(hgsc004a.getParentProdCode()))
hgsc004a
.
setMaterialId
(
results
.
get
(
0
).
getId
());
&& o.getLv() == 3
&& o.getProjCode().equals(hgsc004a.getProjCode())
&& o.getCompanyCode().equals(hgsc004a.getCompanyCode())
).collect(Collectors.toList());*/
AssertUtils
.
isEmpty
(
hgsc004a
.
getParentProdCode
(),
String
.
format
(
"父节点-产品编号[%s]数据不存在,导入失败!"
,
hgsc004a
.
getProjCodePrefix
().
trim
().
concat
(
hgsc004a
.
getParentProdCode
())));
hgsc004a
.
setMaterialId
(
hgsc004
.
getId
());
hgsc004a
.
setLv
(
4
);
hgsc004a
.
setLv
(
4
);
hgsc004a
.
setParentProdCode
(
hgsc004a
.
getProjCodePrefix
().
trim
().
concat
(
hgsc004a
.
getParentProdCode
()));
hgsc004a
.
setParentProdCode
(
hgsc004a
.
getProjCodePrefix
().
trim
().
concat
(
hgsc004a
.
getParentProdCode
()));
hgsc004a
.
setParentProdName
(
hgsc004a
.
getProjNamePrefix
().
trim
().
concat
(
hgsc004a
.
getParentProdName
()));
hgsc004a
.
setParentProdName
(
hgsc004a
.
getProjNamePrefix
().
trim
().
concat
(
hgsc004a
.
getParentProdName
()));
}
}
checkSaveData
(
hgsc004a
);
checkSaveData
(
hgsc004a
);
addEntity
(
hgsc004a
);
addEntity
(
hgsc004a
);
if
(
hgsc004a
.
getLv
()
==
3
){
DaoUtils
.
insert
(
HGSC004A
.
INSERT
,
hgsc004a
);
}
else
{
List
<
HGSC004A
>
hgsc004AS
=
hgsc004aList
.
stream
()
.
filter
(
o
->
o
.
getLv
()
==
4
&&
o
.
getCompanyCode
().
equals
(
hgsc004a
.
getCompanyCode
())
&&
o
.
getProjCode
().
equals
(
hgsc004a
.
getProjCode
())
&&
o
.
getParentProdCode
().
equals
(
hgsc004a
.
getParentProdCode
())
&&
o
.
getProductId
().
equals
(
hgsc004a
.
getProductId
())
&&
o
.
getProductCode
().
equals
(
hgsc004a
.
getProductCode
())
).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
hgsc004AS
)){
hgsc004AS
.
get
(
0
).
setQuantity
(
hgsc004a
.
getQuantity
());
hgsc004AS
.
get
(
0
).
setSingleWeight
(
hgsc004a
.
getSingleWeight
());
hgsc004AS
.
get
(
0
).
setTotalWeight
(
hgsc004a
.
getTotalWeight
());
DaoUtils
.
update
(
HGSC004A
.
UPDATE
,
hgsc004a
);
}
else
{
DaoUtils
.
insert
(
HGSC004A
.
INSERT
,
hgsc004a
);
}
}
}
}
}
}
...
@@ -435,15 +459,12 @@ public class HGSCTools {
...
@@ -435,15 +459,12 @@ public class HGSCTools {
/*if(hgsc004a.getLv().intValue() < 4){
/*if(hgsc004a.getLv().intValue() < 4){
hgsc004a.setLv(hgsc004a.getLv() + 1);
hgsc004a.setLv(hgsc004a.getLv() + 1);
}*/
}*/
if
(
hgsc004a
.
getLv
().
intValue
()
==
3
){
hgsc004a
.
setLeaf
(
2
);
}
else
{
hgsc004a
.
setLeaf
(
1
);
}
hgsc004a
.
setProductStatus
(
HGConstant
.
ProductStatus
.
WTJ
);
hgsc004a
.
setProductStatus
(
HGConstant
.
ProductStatus
.
WTJ
);
if
(
hgsc004a
.
getLv
().
intValue
()
==
3
){
if
(
hgsc004a
.
getLv
()
==
3
){
hgsc004a
.
setLeaf
(
2
);
hgsc004a
.
setProductType
(
ProductTypeEnum
.
STRUCT
.
getCode
().
toString
());
hgsc004a
.
setProductType
(
ProductTypeEnum
.
STRUCT
.
getCode
().
toString
());
}
else
{
}
else
{
hgsc004a
.
setLeaf
(
1
);
hgsc004a
.
setProductType
(
ProductTypeEnum
.
PART
.
getCode
().
toString
());
hgsc004a
.
setProductType
(
ProductTypeEnum
.
PART
.
getCode
().
toString
());
}
}
if
(
hgsc004a
.
getQuantity
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
){
if
(
hgsc004a
.
getQuantity
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
){
...
@@ -480,7 +501,7 @@ public class HGSCTools {
...
@@ -480,7 +501,7 @@ public class HGSCTools {
hgsc004a
.
setLength
(
pz005
.
getLength
());
hgsc004a
.
setLength
(
pz005
.
getLength
());
hgsc004a
.
setWidth
(
pz005
.
getWidth
());
hgsc004a
.
setWidth
(
pz005
.
getWidth
());
hgsc004a
.
setThick
(
pz005
.
getThick
());
hgsc004a
.
setThick
(
pz005
.
getThick
());
DaoUtils
.
insert
(
HGSC004A
.
INSERT
,
hgsc004a
);
//
DaoUtils.insert(HGSC004A.INSERT, hgsc004a);
//主表全部提交时需要有改变状态
//主表全部提交时需要有改变状态
/*if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
/*if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.ZJ);
hgsc004a.setChangeType(HGConstant.ChangeType.ZJ);
...
@@ -504,14 +525,14 @@ public class HGSCTools {
...
@@ -504,14 +525,14 @@ public class HGSCTools {
AssertUtils.isTrue(hgsc003.getBlueprintStatus().compareTo(HGConstant.EnablingStatus.TY) == 0,"蓝图已停用不可修改!");
AssertUtils.isTrue(hgsc003.getBlueprintStatus().compareTo(HGConstant.EnablingStatus.TY) == 0,"蓝图已停用不可修改!");
}*/
}*/
//为构件的需要验证是否已经存在了,不能重复添加
//为构件的需要验证是否已经存在了,不能重复添加
if
(
hgsc004a
.
getLv
()
.
intValue
()
==
3
){
if
(
hgsc004a
.
getLv
()
==
3
){
Map
<
String
,
Object
>
mapA
=
new
HashMap
<>();
Map
<
String
,
Object
>
mapA
=
new
HashMap
<>();
mapA
.
put
(
"materialId"
,
hgsc004a
.
getMaterialId
());
mapA
.
put
(
HGSC004A
.
FIELD_material_id
,
hgsc004a
.
getMaterialId
());
mapA
.
put
(
"productId"
,
hgsc004a
.
getProductId
());
//mapA.put(HGSC004A.FIELD_product_id
,hgsc004a.getProductId());
mapA
.
put
(
"parentProdCode"
,
hgsc004a
.
getParentProdCode
());
mapA
.
put
(
HGSC004A
.
FIELD_parent_prod_code
,
hgsc004a
.
getParentProdCode
());
mapA
.
put
(
"notId"
,
hgsc004a
.
getId
());
mapA
.
put
(
HGSC004A
.
FIELD_product_code
,
hgsc004a
.
getProductCode
());
List
<
HGSC004A
>
hgsc004AList
=
DaoBase
.
getInstance
().
query
(
HGSC004A
.
QUERY
,
mapA
);
List
<
HGSC004A
>
hgsc004AList
=
list
(
mapA
);
AssertUtils
.
isTrue
(!
org
.
springframework
.
util
.
CollectionUtils
.
isEmpty
(
hgsc004AList
),
"已存在构建"
+
hgsc004a
.
getProductCode
()+
"-"
+
hgsc004a
.
getProductName
(
));
AssertUtils
.
isTrue
(!
CollectionUtils
.
isEmpty
(
hgsc004AList
),
String
.
format
(
"已存在构建%s-%s"
,
hgsc004a
.
getProductCode
(),
hgsc004a
.
getProductName
()
));
}
}
AssertUtils
.
isEmpty
(
UserSessionUtils
.
getAccountCode
(),
"当前用户未绑定公司,无法操作数据,请联系管理员!"
);
AssertUtils
.
isEmpty
(
UserSessionUtils
.
getAccountCode
(),
"当前用户未绑定公司,无法操作数据,请联系管理员!"
);
//AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
//AssertUtils.isEmpty(UserSessionUtils.getOrgId(), "当前用户未绑定部门,无法操作数据,请联系管理员!");
...
...
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