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
51e5fcfd
Commit
51e5fcfd
authored
May 24, 2024
by
wuwenlong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
物料清单删除同步生产计划优化
parent
73224a31
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
2 deletions
+36
-2
HGSC005.java
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005.java
+2
-0
HGSC005A.java
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005A.java
+1
-0
HGSC005.xml
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005.xml
+5
-0
HGSC005A.xml
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005A.xml
+5
-0
HGSCTools.java
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
+23
-2
No files found.
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005.java
View file @
51e5fcfd
...
...
@@ -71,6 +71,8 @@ public class HGSC005 extends DaoEPBase {
public
static
final
String
UPDATE
=
"HGSC005.update"
;
public
static
final
String
DELETE
=
"HGSC005.delete"
;
public
static
final
String
BATCH_COMMIT
=
"HGSC005.batch_commit"
;
public
static
final
String
DELETE_BY_MAT_ID
=
"HGSC005.delete_by_mat_id"
;
private
Long
id
=
new
Long
(
0
);
private
Long
matId
=
new
Long
(
0
);
/* 物料清单ID*/
...
...
src/main/java/com/baosight/hggp/hg/sc/domain/HGSC005A.java
View file @
51e5fcfd
...
...
@@ -102,6 +102,7 @@ public class HGSC005A extends DaoEPBase {
public
static
final
String
INSERT
=
"HGSC005A.insert"
;
public
static
final
String
UPDATE
=
"HGSC005A.update"
;
public
static
final
String
DELETE
=
"HGSC005A.delete"
;
public
static
final
String
BATCH_DELETE
=
"HGSC005.batch_delete"
;
public
static
final
String
UPDATE_PLAN_DATE
=
"HGSC005A.update_plan_date"
;
private
Long
id
=
new
Long
(
0
);
...
...
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005.xml
View file @
51e5fcfd
...
...
@@ -213,6 +213,11 @@
id = #id#
</delete>
<delete
id=
"delete_by_mat_id"
>
DELETE FROM ${hggpSchema}.HGSC005 WHERE
mat_id = #matId#
</delete>
<update
id=
"update"
>
UPDATE ${hggpSchema}.HGSC005
SET
...
...
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC005A.xml
View file @
51e5fcfd
...
...
@@ -367,6 +367,11 @@
id = #id#
</delete>
<delete
id=
"batch_delete"
>
DELETE FROM ${hggpSchema}.HGSC005A WHERE
id IN
<iterate
close=
")"
open=
"("
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
</delete>
<update
id=
"update"
>
UPDATE ${hggpSchema}.HGSC005A
SET
...
...
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
View file @
51e5fcfd
...
...
@@ -294,6 +294,14 @@ public class HGSCTools {
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
public
static
List
<
HGSC005A
>
queryByMatId
(
Long
matId
){
AssertUtils
.
isTrue
(
Objects
.
isNull
(
matId
)||
matId
<=
0
,
"物料清单ID不能为空!"
);
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
HGSC005A
.
FIELD_mat_id
,
matId
);
List
<
HGSC005A
>
results
=
DaoBase
.
getInstance
().
query
(
HGSC005A
.
QUERY
,
paramMap
);
return
CollectionUtils
.
isEmpty
(
results
)
?
null
:
results
;
}
private
static
List
<
HGSC005A
>
generatorNewPlanDetail
(
HGSC005A
hgsc005a
){
//通过存货档案编码查询存货档案工序
...
...
@@ -392,16 +400,29 @@ public class HGSCTools {
public
static
void
delete
(
HGSC005A
hgsc005a
){
checkUpdateData
(
hgsc005a
);
Map
<
Long
,
Optional
<
HGSC005A
>>
oldObjMap
=
queryOldPlanDetail
(
hgsc005a
);
List
<
Long
>
deleteIds
=
new
ArrayList
<>();
List
<
HGSC005A
>
updateList
=
new
ArrayList
<>();
oldObjMap
.
forEach
((
k
,
v
)->{
HGSC005A
oldObj
=
v
.
get
();
if
(
oldObj
.
getQuantity
()-
hgsc005a
.
getQuantity
()<=
0
){
DaoUtils
.
update
(
HGSC005A
.
DELETE
,
new
HashMap
<
String
,
Object
>(){{
put
(
HGSC005A
.
FIELD_id
,
oldObj
.
getId
());}}
);
deleteIds
.
add
(
oldObj
.
getId
()
);
}
else
{
oldObj
.
setQuantity
(
oldObj
.
getQuantity
()-
hgsc005a
.
getQuantity
());
oldObj
.
setUnfinishQuantity
(
oldObj
.
getQuantity
()-
oldObj
.
getFinishQuantity
());
DaoUtils
.
update
(
HGSC005A
.
UPDATE
,
oldObj
);
updateList
.
add
(
oldObj
);
}
});
if
(
CollectionUtils
.
isNotEmpty
(
deleteIds
)){
List
<
HGSC005A
>
dbList
=
queryByMatId
(
hgsc005a
.
getMatId
());
//如果全部删除则删除主表
if
(
deleteIds
.
size
()
==
dbList
.
size
()){
DaoUtils
.
update
(
HGSC005
.
DELETE_BY_MAT_ID
,
new
HashMap
<
String
,
Object
>(){{
put
(
HGSC005
.
FIELD_mat_id
,
hgsc005a
.
getMatId
());}});
}
DaoUtils
.
update
(
HGSC005A
.
BATCH_DELETE
,
new
HashMap
<
String
,
Object
>(){{
put
(
"ids"
,
deleteIds
);}});
}
if
(
CollectionUtils
.
isNotEmpty
(
updateList
)){
DaoUtils
.
updateBatch
(
HGSC005A
.
UPDATE
,
updateList
);
}
}
/**
...
...
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