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
3d819ae6
Commit
3d819ae6
authored
Sep 13, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修复采购收货问题
parent
2a1f8824
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
275 additions
and
118 deletions
+275
-118
HGCG003A.xml
src/main/java/com/baosight/hggp/hg/cg/sql/HGCG003A.xml
+3
-0
HGCGTools.java
src/main/java/com/baosight/hggp/hg/cg/tools/HGCGTools.java
+166
-14
HGCGUtils.java
src/main/java/com/baosight/hggp/hg/cg/utils/HGCGUtils.java
+52
-0
ServiceHGKC001.java
.../java/com/baosight/hggp/hg/kc/service/ServiceHGKC001.java
+5
-2
HGKCTools.java
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
+8
-3
HGKCUtils.java
src/main/java/com/baosight/hggp/hg/kc/utils/HGKCUtils.java
+0
-0
ServiceHGSC003.java
.../java/com/baosight/hggp/hg/sc/service/ServiceHGSC003.java
+7
-11
HGSC001.xml
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC001.xml
+1
-1
HGSCTools.java
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
+2
-1
HGXSUser.xml
src/main/java/com/baosight/hggp/hg/xs/sql/HGXSUser.xml
+3
-0
ServiceHGZL001.java
.../java/com/baosight/hggp/hg/zl/service/ServiceHGZL001.java
+28
-86
No files found.
src/main/java/com/baosight/hggp/hg/cg/sql/HGCG003A.xml
View file @
3d819ae6
...
...
@@ -189,6 +189,9 @@
<isNotEmpty
prepend=
" AND "
property=
"primaryIds"
>
PRIMARY_ID IN
<iterate
open=
"("
close=
")"
conjunction=
","
property=
"primaryIds"
>
#primaryIds[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"receiveNos"
>
RECEIVE_NO IN
<iterate
open=
"("
close=
")"
conjunction=
","
property=
"receiveNos"
>
#receiveNos[]#
</iterate>
</isNotEmpty>
</sql>
<sql
id=
"updateRevise"
>
...
...
src/main/java/com/baosight/hggp/hg/cg/tools/HGCGTools.java
View file @
3d819ae6
...
...
@@ -3,13 +3,16 @@ package com.baosight.hggp.hg.cg.tools;
import
com.baosight.hggp.core.dao.DaoBase
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.enums.DeleteFlagEnum
;
import
com.baosight.hggp.hg.cg.constant.HgCgConst
;
import
com.baosight.hggp.hg.cg.domain.*
;
import
com.baosight.hggp.hg.cg.utils.HGCGUtils
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.constant.HGSqlConstant
;
import
com.baosight.hggp.hg.cw.domain.HGCW013
;
import
com.baosight.hggp.hg.kc.tools.HGKCTools
;
import
com.baosight.hggp.hg.zl.domain.HGZL001
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.ObjectUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.math.BigDecimal
;
...
...
@@ -260,6 +263,22 @@ public class HGCGTools {
AssertUtils
.
isEmpty
(
results
,
String
.
format
(
"采购合同[%s]不存在"
,
id
));
return
results
.
get
(
0
);
}
/**
* 锁
*
* @param ids
* @return
*/
public
static
void
lockById
(
List
<
Long
>
ids
)
{
if
(
CollectionUtils
.
isEmpty
(
ids
))
{
return
;
}
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"ids"
,
ids
);
DaoBase
.
getInstance
().
update
(
HGSqlConstant
.
HgCg002
.
LOCK
,
paramMap
);
}
/**
* 锁
*
...
...
@@ -314,12 +333,57 @@ public class HGCGTools {
}
/**
* 修改状态
*
* @param dbCg002
* @param receiveQty
* @param receiveWeight
*/
public
static
void
updateReceiveMain
(
HGCG002
dbCg002
,
BigDecimal
receiveQty
,
BigDecimal
receiveWeight
)
{
AssertUtils
.
isNull
(
dbCg002
,
"合同号不能为空!"
);
AssertUtils
.
isNull
(
receiveQty
,
"收货数量不能为空!"
);
Integer
status
=
dbCg002
.
getPurQty
().
compareTo
(
receiveQty
)
==
0
?
HGConstant
.
CgContractStatus
.
S_5
:
HGConstant
.
CgContractStatus
.
S_4
;
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
HGCG002
.
FIELD_CONTRACT_NO
,
dbCg002
.
getContractNo
());
paramMap
.
put
(
HGCG002
.
FIELD_STATUS
,
status
);
paramMap
.
put
(
HGCG002
.
FIELD_RECEIVE_QTY
,
receiveQty
);
paramMap
.
put
(
HGCG002
.
FIELD_RECEIVE_WEIGHT
,
receiveWeight
);
DaoUtils
.
update
(
HGSqlConstant
.
HgCg002
.
UPDATE_RECEIVE
,
paramMap
);
}
/**
* 更新合同状态
*
* @param dbCg002As
*/
public
static
void
updateReceiveMain
(
List
<
HGCG002A
>
dbCg002As
)
{
if
(
CollectionUtils
.
isEmpty
(
dbCg002As
))
{
return
;
}
List
<
Long
>
ids
=
ObjectUtils
.
listEpKey
(
dbCg002As
,
"id"
);
// 合同明细信息
Map
<
Long
,
List
<
HGCG002B
>>
dbCg002BMap
=
HGCGTools
.
HgCg002B
.
mapByPrimaryId
(
ids
);
for
(
HGCG002A
dbCg002A
:
dbCg002As
)
{
List
<
HGCG002B
>
dbCg002Bs
=
dbCg002BMap
==
null
?
null
:
dbCg002BMap
.
get
(
dbCg002A
.
getId
());
AssertUtils
.
isEmpty
(
dbCg002Bs
,
String
.
format
(
"采购合同【%s】无明细数据,请检查"
,
dbCg002A
.
getContractNo
()));
// 收货数量
BigDecimal
receiveQtySum
=
dbCg002Bs
.
stream
().
map
(
HGCG002B:
:
getReceiveQty
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
// 收货重量
BigDecimal
receiveWeightSum
=
dbCg002Bs
.
stream
().
map
(
HGCG002B:
:
getReceiveWeight
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
updateReceiveMain
(
dbCg002A
,
receiveQtySum
,
receiveWeightSum
);
}
}
/**
* 查询
*
* @param ids
* @return
*/
public
static
List
<
HGCG002
>
listByIds
(
List
<
Long
>
ids
)
{
public
static
List
<
HGCG002
A
>
listByIds
(
List
<
Long
>
ids
)
{
AssertUtils
.
isEmpty
(
ids
,
"合同号不能为空"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"ids"
,
ids
);
...
...
@@ -332,9 +396,9 @@ public class HGCGTools {
* @param ids
* @return
*/
public
static
Map
<
Long
,
HGCG002
>
mapByIds
(
List
<
Long
>
ids
)
{
List
<
HGCG002
>
results
=
listByIds
(
ids
);
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGCG002:
:
getId
,
item
->
item
));
public
static
Map
<
Long
,
HGCG002
A
>
mapByIds
(
List
<
Long
>
ids
)
{
List
<
HGCG002
A
>
results
=
listByIds
(
ids
);
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGCG002
A
:
:
getId
,
item
->
item
));
}
/**
...
...
@@ -371,12 +435,11 @@ public class HGCGTools {
Map
<
Long
,
List
<
HGCG002B
>>
dbCg002BMap
=
HGCGTools
.
HgCg002B
.
mapByPrimaryId
(
primaryIds
);
cg002s
.
forEach
(
cg002
->
{
List
<
HGCG002B
>
dbCg002Bs
=
dbCg002BMap
.
get
(
cg002
.
getId
());
//修改主表信息
//采购数量
// 采购数量
BigDecimal
purQtySum
=
dbCg002Bs
.
stream
().
map
(
HGCG002B:
:
getPurQty
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
cg002
.
setPurQty
(
purQtySum
);
//采购重量
//
采购重量
BigDecimal
purWeightSum
=
dbCg002Bs
.
stream
().
map
(
HGCG002B:
:
getPurWeight
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
cg002
.
setPurWeight
(
purWeightSum
);
...
...
@@ -695,18 +758,19 @@ public class HGCGTools {
/**
* 修改是否开票
*
* @param hgcw013
*/
public
static
void
updateIsInvoicing
(
HGCW013
hgcw013
)
{
AssertUtils
.
isNull
(
hgcw013
,
"采购收货详情不能为空!"
);
List
<
HGCG003B
>
hgcg003Bs
=
DaoBase
.
getInstance
().
query
(
HGCG003B
.
QUERY
,
new
HashMap
<
String
,
Object
>()
{{
List
<
HGCG003B
>
hgcg003Bs
=
DaoBase
.
getInstance
().
query
(
HGCG003B
.
QUERY
,
new
HashMap
<
String
,
Object
>()
{{
put
(
HGCG003B
.
FIELD_RECEIVE_NO
,
hgcw013
.
getSettlementNumber
());
}});
List
<
HGCG003B
>
hgcg003BList
=
hgcg003Bs
.
stream
().
filter
(
item
->
List
<
HGCG003B
>
hgcg003BList
=
hgcg003Bs
.
stream
().
filter
(
item
->
item
.
getInventCode
().
equals
(
hgcw013
.
getInventCode
())
&&
item
.
getSpec
().
equals
(
hgcw013
.
getSpec
())
).
collect
(
Collectors
.
toList
());
if
(
hgcg003BList
.
size
()
>
0
){
if
(
hgcg003BList
.
size
()
>
0
)
{
HGCG003B
hgcg003B
=
hgcg003BList
.
get
(
0
);
hgcg003B
.
setIsInvoicing
(
HGConstant
.
CgIsInvoicing
.
S_0
);
hgcg003B
.
setCancelAmount
(
hgcg003B
.
getCancelAmount
().
subtract
(
hgcw013
.
getTotalContractPriceIncluding
()));
...
...
@@ -717,6 +781,51 @@ public class HGCGTools {
}
/**
* 修改收货信息
*
* @param receiveNo
* @param depositQty
* @param deliverQty
* @param status
*/
public
static
void
updateDeposit
(
String
receiveNo
,
BigDecimal
depositQty
,
BigDecimal
deliverQty
,
Integer
status
)
{
Map
<
String
,
Object
>
paramDetailMap
=
new
HashMap
<>();
paramDetailMap
.
put
(
HGCG003
.
FIELD_RECEIVE_NO
,
receiveNo
);
paramDetailMap
.
put
(
HGCG003
.
FIELD_DEPOSIT_QTY
,
depositQty
);
paramDetailMap
.
put
(
HGCG003
.
FIELD_DELIVER_QTY
,
deliverQty
);
paramDetailMap
.
put
(
HGCG003
.
FIELD_STATUS
,
status
);
DaoUtils
.
update
(
HGSqlConstant
.
HgCg003
.
UPDATE_CONFIRM
,
paramDetailMap
);
}
/**
* 更新收货单状态
*
* @param receiveNos
*/
public
static
void
updateReceiveMain
(
List
<
String
>
receiveNos
)
{
if
(
CollectionUtils
.
isEmpty
(
receiveNos
))
{
return
;
}
// 收货单子表信息
Map
<
String
,
List
<
HGCG003B
>>
dbCg003BMap
=
HGCGTools
.
HgCg003B
.
mapByReceiveNo
(
receiveNos
);
for
(
String
receiveNo
:
receiveNos
)
{
List
<
HGCG003B
>
dbCg003Bs
=
dbCg003BMap
==
null
?
null
:
dbCg003BMap
.
get
(
receiveNo
);
AssertUtils
.
isEmpty
(
dbCg003Bs
,
String
.
format
(
"采购收货单【%s】无明细数据,请检查"
,
receiveNo
));
// 明细状态去重
List
<
Integer
>
statuses
=
dbCg003Bs
.
stream
().
map
(
HGCG003B:
:
getStatus
).
distinct
()
.
collect
(
Collectors
.
toList
());
// 如果存在收货中,则主状态为收货中
Integer
status
=
HGCGUtils
.
HgCg003
.
calcStatus
(
statuses
);
BigDecimal
depositQtySum
=
dbCg003Bs
.
stream
().
map
(
HGCG003B:
:
getDepositQty
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
BigDecimal
deliverQtySum
=
dbCg003Bs
.
stream
().
map
(
HGCG003B:
:
getDeliverQty
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
updateDeposit
(
receiveNo
,
depositQtySum
,
deliverQtySum
,
status
);
}
}
/**
* 修改状态
*
* @param zl001
...
...
@@ -872,6 +981,19 @@ public class HGCGTools {
* @param ids
* @return
*/
public
static
List
<
HGCG003B
>
list
(
List
<
Long
>
ids
)
{
AssertUtils
.
isEmpty
(
ids
,
"合同明细iD不能为空"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"ids"
,
ids
);
return
DaoBase
.
getInstance
().
query
(
HGCG003B
.
QUERY
,
paramMap
);
}
/**
* 查询
*
* @param ids
* @return
*/
public
static
Map
<
Long
,
HGCG003B
>
map
(
List
<
Long
>
ids
)
{
List
<
HGCG003B
>
results
=
list
(
ids
);
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGCG003B:
:
getId
,
item
->
item
));
...
...
@@ -880,17 +1002,28 @@ public class HGCGTools {
/**
* 查询
*
* @param
id
s
* @param
receiveNo
s
* @return
*/
public
static
List
<
HGCG003B
>
list
(
List
<
Long
>
id
s
)
{
AssertUtils
.
isEmpty
(
id
s
,
"合同明细iD不能为空"
);
public
static
List
<
HGCG003B
>
list
ByReceiveNo
(
List
<
String
>
receiveNo
s
)
{
AssertUtils
.
isEmpty
(
receiveNo
s
,
"合同明细iD不能为空"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"
ids"
,
id
s
);
paramMap
.
put
(
"
receiveNos"
,
receiveNo
s
);
return
DaoBase
.
getInstance
().
query
(
HGCG003B
.
QUERY
,
paramMap
);
}
/**
* 查询
*
* @param receiveNos
* @return
*/
public
static
Map
<
String
,
List
<
HGCG003B
>>
mapByReceiveNo
(
List
<
String
>
receiveNos
)
{
List
<
HGCG003B
>
results
=
listByReceiveNo
(
receiveNos
);
return
results
.
stream
().
collect
(
Collectors
.
groupingBy
(
HGCG003B:
:
getReceiveNo
));
}
/**
* 修改状态
*
* @param receiveDetailId
...
...
@@ -905,6 +1038,25 @@ public class HGCGTools {
DaoUtils
.
update
(
HGSqlConstant
.
HgCg003B
.
UPDATE_STATUS
,
paramMap
);
}
/**
* 修改收货信息
*
* @param id
* @param depositQty
* @param deliverQty
*/
public
static
void
updateDeposit
(
Long
id
,
BigDecimal
depositQty
,
BigDecimal
deliverQty
)
{
Map
<
String
,
Object
>
paramDetailMap
=
new
HashMap
<>();
paramDetailMap
.
put
(
HGCG003B
.
FIELD_ID
,
id
);
paramDetailMap
.
put
(
HGCG003B
.
FIELD_DEPOSIT_QTY
,
depositQty
);
paramDetailMap
.
put
(
HGCG003B
.
FIELD_DELIVER_QTY
,
deliverQty
);
if
(
depositQty
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
&&
deliverQty
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
paramDetailMap
.
put
(
HGCG003B
.
FIELD_STATUS
,
HGConstant
.
CgReceiveStatus
.
S_2
);
}
else
{
paramDetailMap
.
put
(
HGCG003B
.
FIELD_STATUS
,
HGConstant
.
CgReceiveStatus
.
S_4
);
}
DaoUtils
.
update
(
HGSqlConstant
.
HgCg003B
.
UPDATE_CONFIRM
,
paramDetailMap
);
}
}
}
src/main/java/com/baosight/hggp/hg/cg/utils/HGCGUtils.java
View file @
3d819ae6
...
...
@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.cg.utils;
import
com.baosight.hggp.hg.cg.domain.*
;
import
com.baosight.hggp.hg.cg.tools.HGCGTools
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.utils.HGUtils
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.MapUtils
;
...
...
@@ -88,6 +89,32 @@ public class HGCGUtils {
return
HGCGTools
.
HgCg002
.
map
(
contractNos
);
}
/**
* 锁并且获取数据
*
* @param ids
* @return
*/
public
static
Map
<
Long
,
HGCG002A
>
lockGetDataById
(
List
<
Long
>
ids
)
{
// 锁
HGCGTools
.
HgCg002
.
lockById
(
ids
);
// db数据
return
HGCGTools
.
HgCg002
.
mapByIds
(
ids
);
}
/**
* 锁并且获取数据
*
* @param ids
* @return
*/
public
static
List
<
HGCG002A
>
lockGetDatasById
(
List
<
Long
>
ids
)
{
// 锁
HGCGTools
.
HgCg002
.
lockById
(
ids
);
// db数据
return
HGCGTools
.
HgCg002
.
listByIds
(
ids
);
}
}
/**
...
...
@@ -169,6 +196,31 @@ public class HGCGUtils {
return
HGCGTools
.
HgCg003
.
map
(
receiveNos
);
}
/**
* 根据明细状态计算主状态
*
* @param statuses
* @return
*/
public
static
Integer
calcStatus
(
List
<
Integer
>
statuses
)
{
Integer
status
;
// 明细只有一种状态时,主状态与明细一致;明细状态存在多种时,取最低的状态
if
(
statuses
.
size
()
!=
1
)
{
if
(
statuses
.
contains
(
HGConstant
.
CgReceiveStatus
.
S_2
))
{
status
=
HGConstant
.
CgReceiveStatus
.
S_2
;
}
else
if
(
statuses
.
contains
(
HGConstant
.
CgReceiveStatus
.
S_3
))
{
status
=
HGConstant
.
CgReceiveStatus
.
S_3
;
}
else
if
(
statuses
.
contains
(
HGConstant
.
CgReceiveStatus
.
S_4
))
{
status
=
HGConstant
.
CgReceiveStatus
.
S_4
;
}
else
{
status
=
HGConstant
.
CgReceiveStatus
.
S_5
;
}
}
else
{
status
=
statuses
.
get
(
0
);
}
return
status
;
}
}
/**
...
...
src/main/java/com/baosight/hggp/hg/kc/service/ServiceHGKC001.java
View file @
3d819ae6
...
...
@@ -189,11 +189,14 @@ public class ServiceHGKC001 extends ServiceBase {
HGKC001
dbKc001
=
dbKc001Map
.
get
(
depositNo
);
dbKc001
.
setDeleteFlag
(
DeleteFlagEnum
.
REMOVE
.
getCode
());
DaoUtils
.
update
(
HGKC001
.
DELETE
,
dbKc001
);
// 扣减库存
// 已提交状态需要扣减库存
if
(
HGConstant
.
ProductStatus
.
YTJ
.
equals
(
dbKc001
.
getSubmitStatus
()))
{
HGKCUtils
.
HgKc010
.
updateInv
(
dbKc001
.
getCompanyCode
(),
dbKc001
.
getWhCode
(),
dbKc001
.
getInventCode
(),
dbKc001
.
getDepositQty
().
negate
(),
dbKc001
.
getDepositWeight
().
negate
());
}
// 更新收货单状态
HGCGTools
.
HgCg003
.
updateStatus
(
dbKc001
.
getReceiveNo
(),
HGConstant
.
CgReceiveStatus
.
S_2
);
HGCGTools
.
HgCg003
.
updateStatus
(
dbKc001
.
getReceiveNo
(),
HGConstant
.
CgReceiveStatus
.
S_0
);
HGCGTools
.
HgCg003B
.
updateStatus
(
dbKc001
.
getReceiveDetailId
(),
HGConstant
.
CgReceiveStatus
.
S_2
);
}
}
...
...
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
View file @
3d819ae6
...
...
@@ -21,6 +21,7 @@ import com.baosight.hggp.hg.pz.domain.HGPZ007;
import
com.baosight.hggp.hg.pz.tools.HGPZTools
;
import
com.baosight.hggp.hg.sc.domain.HGSC008
;
import
com.baosight.hggp.hg.sc.tools.HGSCTools
;
import
com.baosight.hggp.hg.zl.domain.HGZL001
;
import
com.baosight.hggp.hg.zl.domain.HGZL002
;
import
com.baosight.hggp.hg.zl.domain.HGZL004
;
import
com.baosight.hggp.util.AssertUtils
;
...
...
@@ -111,13 +112,17 @@ public class HGKCTools {
*
* @param dbCg003B
*/
public
static
void
putInStorageData
(
HGCG003B
dbCg003B
)
{
public
static
void
putInStorageData
(
HGZL001
fZl001
,
HGCG003B
dbCg003B
)
{
// 无合格数量时,不入库
if
(
fZl001
.
getQualifyQty
().
compareTo
(
BigDecimal
.
ZERO
)
<
1
)
{
return
;
}
HGKC001
newKc001
=
BeanUtils
.
copy
(
dbCg003B
,
HGKC001
.
class
);
newKc001
.
setDepositDate
(
DateUtils
.
shortDate
());
newKc001
.
setDepositNo
(
SequenceGenerator
.
getNextSequence
(
HGConstant
.
SequenceId
.
CG_DEPOSIT_NO
));
newKc001
.
setDepositQty
(
dbCg003B
.
getDeposit
Qty
());
newKc001
.
setDepositQty
(
fZl001
.
getQualify
Qty
());
newKc001
.
setDepositUnitWeight
(
dbCg003B
.
getReceiveUnitWeight
());
newKc001
.
setDepositWeight
(
dbCg003B
.
getDeposit
Qty
().
multiply
(
dbCg003B
.
getReceiveUnitWeight
()));
newKc001
.
setDepositWeight
(
fZl001
.
getQualify
Qty
().
multiply
(
dbCg003B
.
getReceiveUnitWeight
()));
newKc001
.
setDeleteFlag
(
DeleteFlagEnum
.
UN_REMOVE
.
getCode
());
newKc001
.
setSubmitStatus
(
HGConstant
.
ProductStatus
.
WTJ
);
newKc001
.
setStorageType
(
HGConstant
.
StorageType
.
RK
);
...
...
src/main/java/com/baosight/hggp/hg/kc/utils/HGKCUtils.java
View file @
3d819ae6
src/main/java/com/baosight/hggp/hg/sc/service/ServiceHGSC003.java
View file @
3d819ae6
...
...
@@ -163,7 +163,7 @@ public class ServiceHGSC003 extends ServiceBase {
}
catch
(
PlatException
e
)
{
e
.
printStackTrace
();
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
ErrorCodeUtils
.
handleUpdateException
(
inInfo
,
i
,
e
);
ErrorCodeUtils
.
handleUpdateException
(
inInfo
,
i
,
e
);
logError
(
"修改失败"
,
e
.
getMessage
());
return
inInfo
;
}
...
...
@@ -172,28 +172,24 @@ public class ServiceHGSC003 extends ServiceBase {
/**
* 项目档案下拉框
*
* @param inInfo
* @return
*/
public
EiInfo
projComboBox
(
EiInfo
inInfo
)
{
public
EiInfo
projComboBox
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
companyCode
=
MapUtils
.
getString
(
queryMap
,
HGSC001
.
FIELD_company_code
);
String
approvalStatus
=
MapUtils
.
getString
(
queryMap
,
HGSC001
.
FIELD_approval_status
);
Map
map
=
new
HashMap
();
map
.
put
(
HGSC001
.
FIELD_account_code
,
UserSessionUtils
.
getAccountCode
());
map
.
put
(
HGSC001
.
FIELD_company_code
,
companyCode
);
map
.
put
(
HGSC001
.
FIELD_approval_status
,
approvalStatus
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
PROJ_RECORD_BY_ROLE_BLOCK_ID
),
map
,
false
);
queryMap
.
put
(
HGSC001
.
FIELD_account_code
,
UserSessionUtils
.
getAccountCode
());
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
PROJ_RECORD_BY_ROLE_BLOCK_ID
),
queryMap
,
false
);
return
inInfo
;
}
/**
* 蓝图查询下拉框
*
* @param inInfo
* @return
*/
public
EiInfo
blueprintComboBox
(
EiInfo
inInfo
)
{
public
EiInfo
blueprintComboBox
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
companyCode
=
MapUtils
.
getString
(
queryMap
,
HGSC003
.
FIELD_company_code
);
String
blueprintStatus
=
MapUtils
.
getString
(
queryMap
,
HGSC003
.
FIELD_blueprint_status
);
...
...
src/main/java/com/baosight/hggp/hg/sc/sql/HGSC001.xml
View file @
3d819ae6
...
...
@@ -78,7 +78,7 @@
proj_code = #projCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projName"
>
proj_name like
('%$projName$%')
proj_name like
'%$projName$%'
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projType"
>
proj_type = #projType#
...
...
src/main/java/com/baosight/hggp/hg/sc/tools/HGSCTools.java
View file @
3d819ae6
...
...
@@ -1329,7 +1329,8 @@ public class HGSCTools {
}
}
}
return
workHour
.
get
().
divide
(
baseWorkHour
,
0
,
ROUND_DOWN
);
System
.
out
.
println
(
workHour
.
toString
());
return
workHour
.
get
();
}
/**
...
...
src/main/java/com/baosight/hggp/hg/xs/sql/HGXSUser.xml
View file @
3d819ae6
...
...
@@ -29,6 +29,9 @@
<isNotEmpty
prepend=
" AND "
property=
"accountCode"
>
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"receiveUserName"
>
USER_NAME LIKE CONCAT('%', #accountCode#, '%')
</isNotEmpty>
</sql>
<!-- 查询用户信息 -->
...
...
src/main/java/com/baosight/hggp/hg/zl/service/ServiceHGZL001.java
View file @
3d819ae6
...
...
@@ -7,6 +7,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import
com.baosight.hggp.core.enums.DeleteFlagEnum
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.cg.domain.HGCG002
;
import
com.baosight.hggp.hg.cg.domain.HGCG002A
;
import
com.baosight.hggp.hg.cg.domain.HGCG002B
;
import
com.baosight.hggp.hg.cg.domain.HGCG003
;
import
com.baosight.hggp.hg.cg.domain.HGCG003B
;
...
...
@@ -23,6 +24,7 @@ import com.baosight.hggp.util.CommonMethod;
import
com.baosight.hggp.util.EiInfoUtils
;
import
com.baosight.hggp.util.LogUtils
;
import
com.baosight.hggp.util.MapUtils
;
import
com.baosight.hggp.util.ObjectUtils
;
import
com.baosight.iplat4j.core.ei.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
...
...
@@ -206,13 +208,18 @@ public class ServiceHGZL001 extends ServiceBase {
List
<
HGZL001
>
fZl001s
=
MapUtils
.
toDaoEPBases
(
inInfo
,
HGZL001
.
class
);
Map
<
String
,
HGZL001
>
dbZl001Map
=
HGZLUtils
.
HgZl001
.
lockGetDataEp
(
fZl001s
);
// 获取收货明细数据
List
<
Long
>
receiveDetailIds
=
fZl001s
.
stream
().
map
(
HGZL001:
:
getReceiveDetailId
)
.
collect
(
Collectors
.
toList
());
List
<
Long
>
receiveDetailIds
=
ObjectUtils
.
listEpKey
(
fZl001s
,
"receiveDetailId"
);
Map
<
Long
,
HGCG003B
>
dbCg003BMap
=
HGCGUtils
.
HgCg003B
.
lockGetData
(
receiveDetailIds
);
// 合同明细数据
List
<
Long
>
contractDetailIds
=
ObjectUtils
.
listEpKey
(
dbCg003BMap
.
values
(),
"contractDetailId"
);
Map
<
Long
,
HGCG002B
>
dbCg002BMap
=
HGCGUtils
.
HgCg002B
.
lockGetData
(
contractDetailIds
);
// 合同主信息
List
<
Long
>
primaryIds
=
ObjectUtils
.
listEpKey
(
dbCg002BMap
.
values
(),
"primaryId"
);
List
<
HGCG002A
>
dbCg002As
=
HGCGUtils
.
HgCg002
.
lockGetDatasById
(
primaryIds
);
// 数据校验
this
.
checkProcessData
(
fZl001s
,
dbZl001Map
,
dbCg003BMap
);
// 保存数据
this
.
saveProcessData
(
fZl001s
,
dbZl001Map
,
dbCg003BMap
);
this
.
saveProcessData
(
fZl001s
,
dbZl001Map
,
dbCg003BMap
,
dbCg002BMap
,
dbCg002As
);
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
fZl001s
.
size
()
+
"]条数据处理成功!"
);
...
...
@@ -253,9 +260,11 @@ public class ServiceHGZL001 extends ServiceBase {
* @param fZl001s
* @param dbZl001Map
* @param dbCg003BMap
* @param dbCg002BMap
* @param dbCg002As
*/
private
void
saveProcessData
(
List
<
HGZL001
>
fZl001s
,
Map
<
String
,
HGZL001
>
dbZl001Map
,
Map
<
Long
,
HGCG003B
>
dbCg003BMap
)
{
Map
<
Long
,
HGCG003B
>
dbCg003BMap
,
Map
<
Long
,
HGCG002B
>
dbCg002BMap
,
List
<
HGCG002A
>
dbCg002As
)
{
for
(
HGZL001
fZl001
:
fZl001s
)
{
// 更新质检单状态
String
checkNo
=
fZl001
.
getCheckNo
();
...
...
@@ -264,13 +273,14 @@ public class ServiceHGZL001 extends ServiceBase {
dbZl001
.
setUnqualifyQty
(
fZl001
.
getUnqualifyQty
());
dbZl001
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
);
DaoUtils
.
update
(
HGSqlConstant
.
HgZl001
.
PROCESS
,
dbZl001
);
// 更新收货
单
明细
this
.
updateReceiveDetail
(
fZl001
,
dbCg003BMap
);
// 更新收货明细
this
.
updateReceiveDetail
(
fZl001
,
dbCg003BMap
,
dbCg002BMap
);
}
// 更新收货单主表信息
this
.
updateReceiveMain
(
fZl001s
);
// 质检修改合同状态
this
.
updateContract
(
fZl001s
,
dbCg003BMap
);
// 更新收货单主表信息,收货单号去重
List
<
String
>
receiveNos
=
ObjectUtils
.
listEpKey
(
fZl001s
,
"receiveNo"
);
HGCGTools
.
HgCg003
.
updateReceiveMain
(
receiveNos
);
// 质检修改主合同状态
HGCGTools
.
HgCg002
.
updateReceiveMain
(
dbCg002As
);
}
/**
...
...
@@ -278,88 +288,20 @@ public class ServiceHGZL001 extends ServiceBase {
*
* @param fZl001
* @param dbCg003BMap
* @param dbCg002BMap
*/
private
void
updateReceiveDetail
(
HGZL001
fZl001
,
Map
<
Long
,
HGCG003B
>
dbCg003BMap
)
{
private
void
updateReceiveDetail
(
HGZL001
fZl001
,
Map
<
Long
,
HGCG003B
>
dbCg003BMap
,
Map
<
Long
,
HGCG002B
>
dbCg002BMap
)
{
Long
receiveDetailId
=
fZl001
.
getReceiveDetailId
();
HGCG003B
dbCg003B
=
dbCg003BMap
.
get
(
receiveDetailId
);
// 更新采购收货明细的入库数量
Map
<
String
,
Object
>
paramDetailMap
=
new
HashMap
<>();
paramDetailMap
.
put
(
HGCG003B
.
FIELD_ID
,
receiveDetailId
);
paramDetailMap
.
put
(
HGCG003B
.
FIELD_STATUS
,
HGConstant
.
CgReceiveStatus
.
S_4
);
paramDetailMap
.
put
(
HGCG003B
.
FIELD_DELIVER_QTY
,
fZl001
.
getUnqualifyQty
());
paramDetailMap
.
put
(
HGCG003B
.
FIELD_DEPOSIT_QTY
,
fZl001
.
getQualifyQty
());
DaoUtils
.
update
(
HGSqlConstant
.
HgCg003B
.
UPDATE_CONFIRM
,
paramDetailMap
);
// 生成采购入库单
HGKCTools
.
HgKc001
.
putInStorageData
(
dbCg003BMap
.
get
(
receiveDetailId
));
}
/**
* 更新收货单状态
*
* @param fZl001s
*/
public
void
updateReceiveMain
(
List
<
HGZL001
>
fZl001s
)
{
// 收货单号去重
List
<
String
>
receiveNos
=
fZl001s
.
stream
().
map
(
item
->
item
.
getReceiveNo
()).
distinct
()
.
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
receiveNos
))
{
return
;
}
// 收货单主表信息
List
<
HGCG003
>
dbCg003s
=
HGCGTools
.
HgCg003
.
list
(
receiveNos
);
// 收货单子表信息
List
<
Long
>
primaryIds
=
dbCg003s
.
stream
().
map
(
item
->
item
.
getId
()).
collect
(
Collectors
.
toList
());
Map
<
Long
,
List
<
HGCG003B
>>
dbCg003BMap
=
HGCGTools
.
HgCg003B
.
mapByPrimaryIds
(
primaryIds
);
for
(
HGCG003
dbCg003
:
dbCg003s
)
{
List
<
HGCG003B
>
dbCg003Bs
=
dbCg003BMap
==
null
?
null
:
dbCg003BMap
.
get
(
dbCg003
.
getId
());
AssertUtils
.
isEmpty
(
dbCg003Bs
,
String
.
format
(
"采购收货单【%s】无明细数据,请检查"
,
dbCg003
.
getReceiveNo
()));
// 过滤出质检中的收货单
boolean
bool
=
dbCg003Bs
.
stream
().
anyMatch
(
dbCg003B
->
HGConstant
.
CgReceiveStatus
.
S_3
.
equals
(
dbCg003B
.
getStatus
()));
// 如果不存在质检中的收货明细了,则主表为质检完成
if
(!
bool
)
{
Map
<
String
,
Object
>
paramDetailMap
=
new
HashMap
<>();
paramDetailMap
.
put
(
HGCG003
.
FIELD_RECEIVE_NO
,
dbCg003
.
getReceiveNo
());
paramDetailMap
.
put
(
HGCG003
.
FIELD_STATUS
,
HGConstant
.
CgReceiveStatus
.
S_4
);
BigDecimal
depositQtySum
=
dbCg003Bs
.
stream
().
map
(
HGCG003B:
:
getDepositQty
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
paramDetailMap
.
put
(
HGCG003
.
FIELD_DEPOSIT_QTY
,
depositQtySum
);
BigDecimal
deliverQtySum
=
dbCg003Bs
.
stream
().
map
(
HGCG003B:
:
getDeliverQty
)
.
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
paramDetailMap
.
put
(
HGCG003
.
FIELD_DELIVER_QTY
,
deliverQtySum
);
DaoUtils
.
update
(
HGSqlConstant
.
HgCg003
.
UPDATE_CONFIRM
,
paramDetailMap
);
}
}
}
/**
* 修改合同状态
*
* @param fZl001s
* @param dbCg003BMap
*/
public
void
updateContract
(
List
<
HGZL001
>
fZl001s
,
Map
<
Long
,
HGCG003B
>
dbCg003BMap
)
{
// 获取收货明细数据
List
<
HGCG003B
>
dbCg003Bs
=
dbCg003BMap
.
values
().
stream
().
collect
(
Collectors
.
toList
());
// 获取合同明细
List
<
Long
>
contractDetailIds
=
dbCg003Bs
.
stream
().
map
(
HGCG003B:
:
getContractDetailId
).
distinct
()
.
collect
(
Collectors
.
toList
());
Map
<
Long
,
HGCG002B
>
dbCg002BMap
=
HGCGTools
.
HgCg002B
.
map
(
contractDetailIds
);
// 合同主表信息
List
<
Long
>
contractIds
=
dbCg002BMap
.
values
().
stream
().
map
(
item
->
item
.
getPrimaryId
())
.
collect
(
Collectors
.
toList
());
Map
<
Long
,
HGCG002
>
dbCg002Map
=
HGCGTools
.
HgCg002
.
mapByIds
(
contractIds
);
for
(
HGZL001
fZl001
:
fZl001s
)
{
// 关联获取到收货明细
HGCG003B
dbCg003B
=
dbCg003BMap
.
get
(
fZl001
.
getReceiveDetailId
());
HGCGTools
.
HgCg003B
.
updateDeposit
(
receiveDetailId
,
fZl001
.
getQualifyQty
(),
fZl001
.
getUnqualifyQty
());
// 更新合同明细的收货数量
HGCG002B
dbCg002B
=
dbCg002BMap
.
get
(
dbCg003B
.
getContractDetailId
());
BigDecimal
unqualifyQty
=
fZl001
.
getUnqualifyQty
().
negate
();
BigDecimal
unqualifyWeight
=
unqualifyQty
.
multiply
(
dbCg003B
.
getReceiveUnitWeight
());
// 关联获取到合同明细
HGCG002B
dbCg002B
=
dbCg002BMap
.
get
(
dbCg003B
.
getContractDetailId
());
HGCGTools
.
HgCg002B
.
updateReceive
(
dbCg002B
,
unqualifyQty
,
unqualifyWeight
);
// 修改主表信息
HGCG002
dbCg002
=
dbCg002Map
.
get
(
dbCg002B
.
getPrimaryId
());
HGCGTools
.
HgCg002
.
updateReceive
(
dbCg002
,
unqualifyQty
,
unqualifyWeight
);
}
// 生成采购入库单
HGKCTools
.
HgKc001
.
putInStorageData
(
fZl001
,
dbCg003B
);
}
}
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