Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hp-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
hp-smart
Commits
7d914c17
Commit
7d914c17
authored
Apr 28, 2024
by
wancheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采购计划更新
parent
2781d5ed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
5 deletions
+53
-5
ServiceHPCG002A.java
...java/com/baosight/hpjx/hp/cg/service/ServiceHPCG002A.java
+46
-2
HPCG002A.xml
src/main/java/com/baosight/hpjx/hp/cg/sql/HPCG002A.xml
+5
-3
HPConstant.java
src/main/java/com/baosight/hpjx/hp/constant/HPConstant.java
+2
-0
No files found.
src/main/java/com/baosight/hpjx/hp/cg/service/ServiceHPCG002A.java
View file @
7d914c17
...
...
@@ -3,16 +3,17 @@ package com.baosight.hpjx.hp.cg.service;
import
com.baosight.hpjx.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hpjx.common.DdynamicEnum
;
import
com.baosight.hpjx.common.InventTypeEnum
;
import
com.baosight.hpjx.core.constant.CommonConstant
;
import
com.baosight.hpjx.core.dao.DaoUtils
;
import
com.baosight.hpjx.core.security.UserSessionUtils
;
import
com.baosight.hpjx.hp.cg.domain.HPCG002
;
import
com.baosight.hpjx.hp.cg.domain.HPCG002A
;
import
com.baosight.hpjx.hp.cg.domain.*
;
import
com.baosight.hpjx.hp.constant.HPConstant
;
import
com.baosight.hpjx.hp.kc.domain.HPKC001
;
import
com.baosight.hpjx.hp.xs.domain.HPXS006
;
import
com.baosight.hpjx.util.CommonMethod
;
import
com.baosight.hpjx.util.DateUtils
;
import
com.baosight.hpjx.util.LogUtils
;
import
com.baosight.hpjx.util.StringUtil
;
import
com.baosight.hpjx.util.contants.ACConstants
;
import
com.baosight.iplat4j.core.ei.EiBlock
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
...
...
@@ -22,6 +23,7 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import
com.baosight.iplat4j.ed.util.SequenceGenerator
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
*
...
...
@@ -160,10 +162,12 @@ public class ServiceHPCG002A extends ServiceBase {
}
EiInfo
outInfo
=
super
.
query
(
inInfo
,
HPCG002A
.
QUERY
,
new
HPCG002A
());
EiBlock
outBlock
=
outInfo
.
getBlock
(
EiConstant
.
resultBlock
);
String
inventType
=
""
;
Integer
num
=
0
;
for
(
int
i
=
0
;
i
<
outBlock
.
getRowCount
();
i
++)
{
Map
<?,
?>
map
=
outBlock
.
getRow
(
i
);
hpcg002A
.
fromMap
(
map
);
inventType
=
hpcg002A
.
getInventType
();
if
(
hpcg002A
.
getProApplyStatus
()==
1
){
num
=
num
+
1
;
}
...
...
@@ -172,6 +176,46 @@ public class ServiceHPCG002A extends ServiceBase {
if
(
num
==
outBlock
.
getRowCount
()&&
hpcg002
.
getProPlanStatus
()!=
2
){
hpcg002
.
setProPlanStatus
(
2
);
DaoUtils
.
update
(
HPCG002
.
CHECK
,
hpcg002
.
toMap
());
//全部提交后,生成采购订单
List
<
Map
<
Object
,
Object
>>
list
=
outBlock
.
getRows
();
Map
<
Object
,
List
<
Map
>>
listMap
=
list
.
stream
().
collect
(
Collectors
.
groupingBy
(
map
->
map
.
get
(
HPCG002A
.
FIELD_CUST_CODE
)));
//获取采购计划
List
<
HPCG002
>
hpcg002s
=
this
.
dao
.
query
(
HPCG002
.
QUERY
,
new
HashMap
<
String
,
Object
>(){{
put
(
HPCG002
.
FIELD_ID
,
hpcg002
.
getId
());
}});
for
(
Object
str:
listMap
.
keySet
())
{
HPCG003
hpcg003
=
new
HPCG003
();
hpcg003
.
toMap
();
hpcg003
.
setProOrderDate
(
StringUtil
.
removeHorizontalLine
(
DateUtils
.
date
()));
hpcg003
.
setCustCode
(
str
.
toString
());
hpcg003
.
setInventType
(
inventType
);
hpcg003
.
setProPlanNo
(
hpcg002s
.
get
(
0
).
getProPlanNo
());
//生成采购订单单号
hpcg003
.
setProPlanNo
(
SequenceGenerator
.
getNextSequence
(
HPConstant
.
SequenceId
.
PRO_ORDER_NO
));
//添加采购订单
DaoUtils
.
insert
(
HPCG003
.
INSERT
,
hpcg003
);
List
<
HPCG003
>
hpcg003s
=
this
.
dao
.
query
(
HPCG003
.
QUERY
,
new
HashMap
<
String
,
Object
>(){{
put
(
HPCG003
.
FIELD_INVENT_TYPE
,
hpcg003
.
getInventType
());
put
(
HPCG003
.
FIELD_PRO_ORDER_DATE
,
hpcg003
.
getProOrderDate
());
put
(
HPCG003
.
FIELD_PRO_ORDER_NO
,
hpcg003
.
getProOrderNo
());
put
(
HPCG003
.
FIELD_PRO_PLAN_NO
,
hpcg003
.
getProPlanNo
());
put
(
HPCG003
.
COL_CUST_CODE
,
hpcg003
.
getCustCode
());
}});
List
<
Map
>
hpcg002aList
=
listMap
.
get
(
str
);
for
(
Map
value
:
hpcg002aList
)
{
HPCG002A
hpcg002a
=
new
HPCG002A
();
hpcg002a
.
fromMap
(
value
);
//添加采购订单详情
HPCG003A
hpcg003a
=
new
HPCG003A
();
hpcg003a
.
fromMap
(
value
);
hpcg003a
.
setParentId
(
hpcg003s
.
get
(
0
).
getId
());
hpcg003a
.
setId
(
0L
);
hpcg003a
.
setProAmount
(
hpcg002a
.
getPlanAmount
());
hpcg003a
.
setProWeight
(
hpcg002a
.
getPlanWeight
());
DaoUtils
.
insert
(
HPCG003A
.
INSERT
,
hpcg003a
);
}
}
}
else
if
(
num
!=
outBlock
.
getRowCount
()&&
hpcg002
.
getProPlanStatus
()!=
1
){
hpcg002
.
setProPlanStatus
(
1
);
DaoUtils
.
update
(
HPCG002
.
CHECK
,
hpcg002
.
toMap
());
...
...
src/main/java/com/baosight/hpjx/hp/cg/sql/HPCG002A.xml
View file @
7d914c17
...
...
@@ -134,13 +134,15 @@
A.PARENT_ID as "parentId",
<!-- 父级ID -->
ifnull(B.AMOUNT,0) as "invAmount",
<!-- 库存数量 -->
ifnull(B.WEIGHT,0) as "invWeight",
<!-- 库存重量 -->
case when A.APPLY_AMOUNT > ifnull(B.AMOUNT,0)
A.PLAN_AMOUNT as "planAmount",
<!-- 计划数量 -->
A.PLAN_WEIGHT as "planWeight",
<!-- 计划重量 -->
<!-- case when A.APPLY_AMOUNT > ifnull(B.AMOUNT,0)
then A.APPLY_AMOUNT - ifnull(B.AMOUNT,0)
else A.APPLY_AMOUNT end as "planAmount",
<!-- 计划数量 -->
else A.APPLY_AMOUNT end as "planAmount",
<!– 计划数量 –>
case when A.PLAN_WEIGHT != 0 then A.PLAN_WEIGHT
when A.PLAN_WEIGHT != 0 and A.APPLY_AMOUNT > ifnull(B.AMOUNT,0)
then (A.APPLY_AMOUNT - ifnull(B.AMOUNT,0))*A.APPLY_UNIT_WEIGHT
else A.APPLY_WEIGHT end as "planWeight",
<!-- 计划重量
-->
else A.APPLY_WEIGHT end as "planWeight",
<!– 计划重量 –>
-->
C.PRO_PLAN_STATUS as "proPlanStatus"
<!-- 采购计划提交状态 0-未提交 1-部分提交 2-全部提交 -->
FROM ${hpjxSchema}.T_HPCG002A A
LEFT JOIN ${hpjxSchema}.T_HPKC010 B ON A.WH_CODE = B.WH_CODE AND A.INVENT_CODE = B.INVENT_CODE AND A.INVENT_RECORD_ID = B.INVENT_RECORD_ID
...
...
src/main/java/com/baosight/hpjx/hp/constant/HPConstant.java
View file @
7d914c17
...
...
@@ -70,6 +70,8 @@ public class HPConstant {
public
static
final
String
PRO_APPLY_NO
=
"PRO_APPLY_NO"
;
//采购计划单号
public
static
final
String
PRO_PLAN_NO
=
"PRO_PLAN_NO"
;
//采购订单单号
public
static
final
String
PRO_ORDER_NO
=
"PRO_ORDER_NO"
;
}
/**
...
...
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