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
b3e323f3
Commit
b3e323f3
authored
Aug 03, 2024
by
liuyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-08-02 新增物料清单详情按照层级导入
parent
4950663e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
54 additions
and
26 deletions
+54
-26
ServiceHGSC004A.java
...java/com/baosight/hggp/hg/sc/service/ServiceHGSC004A.java
+6
-6
HGSCTools.java
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
+48
-20
HGSC004A_物料清单.xls
src/main/webapp/common/template/SC/HGSC004A_物料清单.xls
+0
-0
No files found.
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC004A.java
View file @
b3e323f3
...
...
@@ -558,17 +558,17 @@ public class ServiceHGSC004A extends ServiceBase {
String
fileName
=
inInfo
.
getString
(
ACConstants
.
FILE_NAME
);
String
projCode
=
inInfo
.
getString
(
HGSC004A
.
FIELD_proj_code
);
String
projName
=
inInfo
.
getString
(
HGSC004A
.
FIELD_proj_name
);
String
parentProdCode
=
inInfo
.
getString
(
HGSC004A
.
FIELD_parent_prod_code
);
String
parentProdName
=
inInfo
.
getString
(
HGSC004A
.
FIELD_parent_prod_name
);
String
lv
=
inInfo
.
getString
(
HGSC004A
.
FIELD_lv
);
//
String parentProdCode = inInfo.getString(HGSC004A.FIELD_parent_prod_code);
//
String parentProdName = inInfo.getString(HGSC004A.FIELD_parent_prod_name);
//
String lv = inInfo.getString(HGSC004A.FIELD_lv);
String
materialId
=
inInfo
.
getString
(
HGSC004A
.
FIELD_material_id
);
params
.
put
(
HGSC004A
.
FIELD_account_code
,
UserSessionUtils
.
getAccountCode
());
params
.
put
(
HGSC004A
.
FIELD_proj_code
,
projCode
);
params
.
put
(
HGSC004A
.
FIELD_proj_name
,
projName
);
params
.
put
(
HGSC004A
.
FIELD_parent_prod_code
,
parentProdCode
);
params
.
put
(
HGSC004A
.
FIELD_parent_prod_name
,
parentProdName
);
params
.
put
(
HGSC004A
.
FIELD_lv
,
lv
);
//
params.put(HGSC004A.FIELD_parent_prod_code, parentProdCode);
//
params.put(HGSC004A.FIELD_parent_prod_name, parentProdName);
//
params.put(HGSC004A.FIELD_lv, lv);
params
.
put
(
HGSC004A
.
FIELD_material_id
,
materialId
);
//解析文件,将文件中数据传入到inInfo中
ExcelUtils
.
importFromExcel
(
inInfo
,
fileName
,
params
,
new
HGSC004A
());
...
...
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
View file @
b3e323f3
...
...
@@ -313,28 +313,56 @@ public class HGSCTools {
AssertUtils
.
isTrue
(
hgsc005
.
getCommitStatus
().
compareTo
(
CommonConstant
.
YesNo
.
NO_0
)==
1
,
"生产计划已提交,不能操作!"
);
}
public
static
List
<
HGSC004A
>
list
(
Map
paramMap
)
{
AssertUtils
.
isNull
(
paramMap
,
"物料清单id不能为空!"
);
return
DaoBase
.
getInstance
().
query
(
HGSC004A
.
QUERY
,
paramMap
);
}
public
static
void
add
(
List
<
Map
>
arrayList
,
String
materialId
)
{
HGSC004
hgsc004
=
Hgsc004
.
getId
(
materialId
);
AssertUtils
.
isEmpty
(
Collections
.
singleton
(
hgsc004
),
"物料清单不存在!"
);
List
<
HGSC004
>
results
=
DaoBase
.
getInstance
().
query
(
HGSC004
.
QUERY
,
new
HashMap
<
String
,
Object
>(){
{
put
(
"id"
,
materialId
);}
});
AssertUtils
.
isEmpty
(
results
,
"物料清单不存在!"
);
for
(
Map
resultRow
:
arrayList
){
HGSC004A
hgsc004a
=
new
HGSC004A
();
hgsc004a
.
fromMap
(
resultRow
);
hgsc004a
.
setCompanyCode
(
hgsc004
.
getCompanyCode
());
hgsc004a
.
setCompanyName
(
hgsc004
.
getCompanyName
());
hgsc004a
.
setDepCode
(
hgsc004
.
getDepCode
());
hgsc004a
.
setDepName
(
hgsc004
.
getDepName
());
hgsc004a
.
setMaterialId
(
hgsc004
.
getId
());
checkSaveData
(
hgsc004a
,
hgsc004
);
addEntity
(
hgsc004a
,
hgsc004
);
hgsc004a
.
setCompanyCode
(
results
.
get
(
0
).
getCompanyCode
());
hgsc004a
.
setCompanyName
(
results
.
get
(
0
).
getCompanyName
());
hgsc004a
.
setDepCode
(
results
.
get
(
0
).
getDepCode
());
hgsc004a
.
setDepName
(
results
.
get
(
0
).
getDepName
());
if
(
hgsc004a
.
getLv
()==
3
){
hgsc004a
.
setParentProdCode
(
results
.
get
(
0
).
getProjCode
());
hgsc004a
.
setParentProdName
(
results
.
get
(
0
).
getProjName
());
hgsc004a
.
setMaterialId
(
results
.
get
(
0
).
getId
());
checkSaveData
(
hgsc004a
);
}
else
if
(
hgsc004a
.
getLv
()==
4
){
if
(
hgsc004a
.
getParentProdCode
().
length
()==
0
){
AssertUtils
.
isTrue
(
true
,
"层级为4级,父节点-产品编号不能为空!"
);
}
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"companyCode"
,
hgsc004a
.
getCompanyCode
());
paramMap
.
put
(
"projCode"
,
hgsc004a
.
getProjCode
());
paramMap
.
put
(
"lv"
,
3
);
paramMap
.
put
(
"productCode"
,
hgsc004a
.
getParentProdCode
());
List
<
HGSC004A
>
hgsc004aList
=
list
(
paramMap
);
AssertUtils
.
isEmpty
(
hgsc004aList
,
String
.
format
(
"父节点-产品编号[%s]数据不存在,导入失败!"
,
hgsc004a
.
getParentProdCode
()));
hgsc004a
.
setMaterialId
(
results
.
get
(
0
).
getId
());
checkSaveData
(
hgsc004a
);
}
else
{
AssertUtils
.
isTrue
(
true
,
"层级不能为空!"
);
}
addEntity
(
hgsc004a
);
}
}
public
static
void
addEntity
(
HGSC004A
hgsc004a
,
HGSC004
hgsc004
)
{
public
static
void
addEntity
(
HGSC004A
hgsc004a
)
{
//不为4级都有叶子节点,父节点需要+1
if
(
hgsc004a
.
getLv
().
intValue
()
<
4
){
/*
if(hgsc004a.getLv().intValue() < 4){
hgsc004a.setLv(hgsc004a.getLv() + 1);
}
}
*/
if
(
hgsc004a
.
getLv
().
intValue
()
==
3
){
hgsc004a
.
setLeaf
(
2
);
}
else
{
...
...
@@ -347,12 +375,12 @@ public class HGSCTools {
hgsc004a
.
setProductType
(
ProductTypeEnum
.
PART
.
getCode
().
toString
());
}
if
(
hgsc004a
.
getQuantity
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
){
AssertUtils
.
isTrue
(
fals
e
,
"数量不能为0!"
);
AssertUtils
.
isTrue
(
tru
e
,
"数量不能为0!"
);
}
hgsc004a
.
setTotalWeight
(
hgsc004a
.
getQuantity
().
multiply
(
hgsc004a
.
getSingleWeight
()));
HGPZ005
hgpz005
=
HGPZTools
.
HgPz005
.
get
(
hgsc004a
.
getProductCode
());
if
(
Objects
.
isNull
(
hgpz005
)){
AssertUtils
.
isTrue
(
fals
e
,
"产品编号不存在!"
);
AssertUtils
.
isTrue
(
tru
e
,
"产品编号不存在!"
);
}
hgsc004a
.
setProductId
(
hgpz005
.
getId
());
hgsc004a
.
setInventType
(
hgpz005
.
getInventType
()+
""
);
...
...
@@ -360,8 +388,9 @@ public class HGSCTools {
hgsc004a
.
setLength
(
hgpz005
.
getLength
());
hgsc004a
.
setWidth
(
hgpz005
.
getWidth
());
hgsc004a
.
setThick
(
hgpz005
.
getThick
());
DaoUtils
.
insert
(
HGSC004A
.
INSERT
,
hgsc004a
);
//主表全部提交时需要有改变状态
if
(
hgsc004
.
getMaterialStatus
().
intValue
()
==
HGConstant
.
MaterialStatus
.
QBTJ
){
/*
if(hgsc004.getMaterialStatus().intValue() == HGConstant.MaterialStatus.QBTJ){
hgsc004a.setChangeType(HGConstant.ChangeType.ZJ);
//Long maxId = (Long) super.dao.get(HGSC004A.MAX_ID,null,null);
//hgsc004a.setId(maxId+1);
...
...
@@ -369,20 +398,19 @@ public class HGSCTools {
HGSCTools.THGSC004B.save(null,hgsc004a);
}else {
DaoUtils.insert(HGSC004A.INSERT, hgsc004a);
}
}
*/
}
/**
* 校验保存的数据
* @param hgsc004a 物料清单详情
* @param hgsc004 物料清单
*/
public
static
void
checkSaveData
(
HGSC004A
hgsc004a
,
HGSC004
hgsc004
)
{
if
(
Objects
.
nonNull
(
hgsc004a
.
getId
())&&
hgsc004a
.
getId
()>
0
){
public
static
void
checkSaveData
(
HGSC004A
hgsc004a
)
{
/*
if(Objects.nonNull(hgsc004a.getId())&&hgsc004a.getId()>0){
//蓝图信息,用于蓝图状态校验
HGSC003 hgsc003 = Hgsc003.getId(hgsc004.getBlueprintId());
AssertUtils.isTrue(hgsc003.getBlueprintStatus().compareTo(HGConstant.EnablingStatus.TY) == 0,"蓝图已停用不可修改!");
}
}
*/
//为构件的需要验证是否已经存在了,不能重复添加
if
(
hgsc004a
.
getLv
().
intValue
()
==
3
){
Map
<
String
,
Object
>
mapA
=
new
HashMap
<>();
...
...
src/main/webapp/common/template/SC/HGSC004A_物料清单.xls
View file @
b3e323f3
No preview for this file type
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