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
Expand all
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 @@
...
@@ -189,6 +189,9 @@
<isNotEmpty
prepend=
" AND "
property=
"primaryIds"
>
<isNotEmpty
prepend=
" AND "
property=
"primaryIds"
>
PRIMARY_ID IN
<iterate
open=
"("
close=
")"
conjunction=
","
property=
"primaryIds"
>
#primaryIds[]#
</iterate>
PRIMARY_ID IN
<iterate
open=
"("
close=
")"
conjunction=
","
property=
"primaryIds"
>
#primaryIds[]#
</iterate>
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"receiveNos"
>
RECEIVE_NO IN
<iterate
open=
"("
close=
")"
conjunction=
","
property=
"receiveNos"
>
#receiveNos[]#
</iterate>
</isNotEmpty>
</sql>
</sql>
<sql
id=
"updateRevise"
>
<sql
id=
"updateRevise"
>
...
...
src/main/java/com/baosight/hggp/hg/cg/tools/HGCGTools.java
View file @
3d819ae6
This diff is collapsed.
Click to expand it.
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;
...
@@ -2,6 +2,7 @@ package com.baosight.hggp.hg.cg.utils;
import
com.baosight.hggp.hg.cg.domain.*
;
import
com.baosight.hggp.hg.cg.domain.*
;
import
com.baosight.hggp.hg.cg.tools.HGCGTools
;
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.hg.utils.HGUtils
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.DateUtils
;
import
com.baosight.hggp.util.MapUtils
;
import
com.baosight.hggp.util.MapUtils
;
...
@@ -88,6 +89,32 @@ public class HGCGUtils {
...
@@ -88,6 +89,32 @@ public class HGCGUtils {
return
HGCGTools
.
HgCg002
.
map
(
contractNos
);
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 {
...
@@ -169,6 +196,31 @@ public class HGCGUtils {
return
HGCGTools
.
HgCg003
.
map
(
receiveNos
);
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 {
...
@@ -189,11 +189,14 @@ public class ServiceHGKC001 extends ServiceBase {
HGKC001
dbKc001
=
dbKc001Map
.
get
(
depositNo
);
HGKC001
dbKc001
=
dbKc001Map
.
get
(
depositNo
);
dbKc001
.
setDeleteFlag
(
DeleteFlagEnum
.
REMOVE
.
getCode
());
dbKc001
.
setDeleteFlag
(
DeleteFlagEnum
.
REMOVE
.
getCode
());
DaoUtils
.
update
(
HGKC001
.
DELETE
,
dbKc001
);
DaoUtils
.
update
(
HGKC001
.
DELETE
,
dbKc001
);
// 扣减库存
// 已提交状态需要扣减库存
if
(
HGConstant
.
ProductStatus
.
YTJ
.
equals
(
dbKc001
.
getSubmitStatus
()))
{
HGKCUtils
.
HgKc010
.
updateInv
(
dbKc001
.
getCompanyCode
(),
dbKc001
.
getWhCode
(),
dbKc001
.
getInventCode
(),
HGKCUtils
.
HgKc010
.
updateInv
(
dbKc001
.
getCompanyCode
(),
dbKc001
.
getWhCode
(),
dbKc001
.
getInventCode
(),
dbKc001
.
getDepositQty
().
negate
(),
dbKc001
.
getDepositWeight
().
negate
());
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;
...
@@ -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.pz.tools.HGPZTools
;
import
com.baosight.hggp.hg.sc.domain.HGSC008
;
import
com.baosight.hggp.hg.sc.domain.HGSC008
;
import
com.baosight.hggp.hg.sc.tools.HGSCTools
;
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.HGZL002
;
import
com.baosight.hggp.hg.zl.domain.HGZL004
;
import
com.baosight.hggp.hg.zl.domain.HGZL004
;
import
com.baosight.hggp.util.AssertUtils
;
import
com.baosight.hggp.util.AssertUtils
;
...
@@ -111,13 +112,17 @@ public class HGKCTools {
...
@@ -111,13 +112,17 @@ public class HGKCTools {
*
*
* @param dbCg003B
* @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
);
HGKC001
newKc001
=
BeanUtils
.
copy
(
dbCg003B
,
HGKC001
.
class
);
newKc001
.
setDepositDate
(
DateUtils
.
shortDate
());
newKc001
.
setDepositDate
(
DateUtils
.
shortDate
());
newKc001
.
setDepositNo
(
SequenceGenerator
.
getNextSequence
(
HGConstant
.
SequenceId
.
CG_DEPOSIT_NO
));
newKc001
.
setDepositNo
(
SequenceGenerator
.
getNextSequence
(
HGConstant
.
SequenceId
.
CG_DEPOSIT_NO
));
newKc001
.
setDepositQty
(
dbCg003B
.
getDeposit
Qty
());
newKc001
.
setDepositQty
(
fZl001
.
getQualify
Qty
());
newKc001
.
setDepositUnitWeight
(
dbCg003B
.
getReceiveUnitWeight
());
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
.
setDeleteFlag
(
DeleteFlagEnum
.
UN_REMOVE
.
getCode
());
newKc001
.
setSubmitStatus
(
HGConstant
.
ProductStatus
.
WTJ
);
newKc001
.
setSubmitStatus
(
HGConstant
.
ProductStatus
.
WTJ
);
newKc001
.
setStorageType
(
HGConstant
.
StorageType
.
RK
);
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 {
...
@@ -163,7 +163,7 @@ public class ServiceHGSC003 extends ServiceBase {
}
catch
(
PlatException
e
)
{
}
catch
(
PlatException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_FAILURE
);
ErrorCodeUtils
.
handleUpdateException
(
inInfo
,
i
,
e
);
ErrorCodeUtils
.
handleUpdateException
(
inInfo
,
i
,
e
);
logError
(
"修改失败"
,
e
.
getMessage
());
logError
(
"修改失败"
,
e
.
getMessage
());
return
inInfo
;
return
inInfo
;
}
}
...
@@ -172,28 +172,24 @@ public class ServiceHGSC003 extends ServiceBase {
...
@@ -172,28 +172,24 @@ public class ServiceHGSC003 extends ServiceBase {
/**
/**
* 项目档案下拉框
* 项目档案下拉框
*
* @param inInfo
* @param inInfo
* @return
* @return
*/
*/
public
EiInfo
projComboBox
(
EiInfo
inInfo
)
{
public
EiInfo
projComboBox
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
companyCode
=
MapUtils
.
getString
(
queryMap
,
HGSC001
.
FIELD_company_code
);
queryMap
.
put
(
HGSC001
.
FIELD_account_code
,
UserSessionUtils
.
getAccountCode
());
String
approvalStatus
=
MapUtils
.
getString
(
queryMap
,
HGSC001
.
FIELD_approval_status
);
CommonMethod
.
initBlock
(
inInfo
,
Arrays
.
asList
(
DdynamicEnum
.
PROJ_RECORD_BY_ROLE_BLOCK_ID
),
queryMap
,
false
);
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
);
return
inInfo
;
return
inInfo
;
}
}
/**
/**
* 蓝图查询下拉框
* 蓝图查询下拉框
*
* @param inInfo
* @param inInfo
* @return
* @return
*/
*/
public
EiInfo
blueprintComboBox
(
EiInfo
inInfo
)
{
public
EiInfo
blueprintComboBox
(
EiInfo
inInfo
)
{
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
Map
queryMap
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
String
companyCode
=
MapUtils
.
getString
(
queryMap
,
HGSC003
.
FIELD_company_code
);
String
companyCode
=
MapUtils
.
getString
(
queryMap
,
HGSC003
.
FIELD_company_code
);
String
blueprintStatus
=
MapUtils
.
getString
(
queryMap
,
HGSC003
.
FIELD_blueprint_status
);
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 @@
...
@@ -78,7 +78,7 @@
proj_code = #projCode#
proj_code = #projCode#
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projName"
>
<isNotEmpty
prepend=
" AND "
property=
"projName"
>
proj_name like
('%$projName$%')
proj_name like
'%$projName$%'
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"projType"
>
<isNotEmpty
prepend=
" AND "
property=
"projType"
>
proj_type = #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 {
...
@@ -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 @@
...
@@ -29,6 +29,9 @@
<isNotEmpty
prepend=
" AND "
property=
"accountCode"
>
<isNotEmpty
prepend=
" AND "
property=
"accountCode"
>
ACCOUNT_CODE = #accountCode#
ACCOUNT_CODE = #accountCode#
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"receiveUserName"
>
USER_NAME LIKE CONCAT('%', #accountCode#, '%')
</isNotEmpty>
</sql>
</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;
...
@@ -7,6 +7,7 @@ import com.baosight.hggp.core.dao.DaoUtils;
import
com.baosight.hggp.core.enums.DeleteFlagEnum
;
import
com.baosight.hggp.core.enums.DeleteFlagEnum
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.core.security.UserSessionUtils
;
import
com.baosight.hggp.hg.cg.domain.HGCG002
;
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.HGCG002B
;
import
com.baosight.hggp.hg.cg.domain.HGCG003
;
import
com.baosight.hggp.hg.cg.domain.HGCG003
;
import
com.baosight.hggp.hg.cg.domain.HGCG003B
;
import
com.baosight.hggp.hg.cg.domain.HGCG003B
;
...
@@ -23,6 +24,7 @@ import com.baosight.hggp.util.CommonMethod;
...
@@ -23,6 +24,7 @@ import com.baosight.hggp.util.CommonMethod;
import
com.baosight.hggp.util.EiInfoUtils
;
import
com.baosight.hggp.util.EiInfoUtils
;
import
com.baosight.hggp.util.LogUtils
;
import
com.baosight.hggp.util.LogUtils
;
import
com.baosight.hggp.util.MapUtils
;
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.EiConstant
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.ei.EiInfo
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
import
com.baosight.iplat4j.core.service.impl.ServiceBase
;
...
@@ -206,13 +208,18 @@ public class ServiceHGZL001 extends ServiceBase {
...
@@ -206,13 +208,18 @@ public class ServiceHGZL001 extends ServiceBase {
List
<
HGZL001
>
fZl001s
=
MapUtils
.
toDaoEPBases
(
inInfo
,
HGZL001
.
class
);
List
<
HGZL001
>
fZl001s
=
MapUtils
.
toDaoEPBases
(
inInfo
,
HGZL001
.
class
);
Map
<
String
,
HGZL001
>
dbZl001Map
=
HGZLUtils
.
HgZl001
.
lockGetDataEp
(
fZl001s
);
Map
<
String
,
HGZL001
>
dbZl001Map
=
HGZLUtils
.
HgZl001
.
lockGetDataEp
(
fZl001s
);
// 获取收货明细数据
// 获取收货明细数据
List
<
Long
>
receiveDetailIds
=
fZl001s
.
stream
().
map
(
HGZL001:
:
getReceiveDetailId
)
List
<
Long
>
receiveDetailIds
=
ObjectUtils
.
listEpKey
(
fZl001s
,
"receiveDetailId"
);
.
collect
(
Collectors
.
toList
());
Map
<
Long
,
HGCG003B
>
dbCg003BMap
=
HGCGUtils
.
HgCg003B
.
lockGetData
(
receiveDetailIds
);
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
.
checkProcessData
(
fZl001s
,
dbZl001Map
,
dbCg003BMap
);
// 保存数据
// 保存数据
this
.
saveProcessData
(
fZl001s
,
dbZl001Map
,
dbCg003BMap
);
this
.
saveProcessData
(
fZl001s
,
dbZl001Map
,
dbCg003BMap
,
dbCg002BMap
,
dbCg002As
);
inInfo
=
this
.
query
(
inInfo
);
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
fZl001s
.
size
()
+
"]条数据处理成功!"
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
fZl001s
.
size
()
+
"]条数据处理成功!"
);
...
@@ -253,9 +260,11 @@ public class ServiceHGZL001 extends ServiceBase {
...
@@ -253,9 +260,11 @@ public class ServiceHGZL001 extends ServiceBase {
* @param fZl001s
* @param fZl001s
* @param dbZl001Map
* @param dbZl001Map
* @param dbCg003BMap
* @param dbCg003BMap
* @param dbCg002BMap
* @param dbCg002As
*/
*/
private
void
saveProcessData
(
List
<
HGZL001
>
fZl001s
,
Map
<
String
,
HGZL001
>
dbZl001Map
,
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
)
{
for
(
HGZL001
fZl001
:
fZl001s
)
{
// 更新质检单状态
// 更新质检单状态
String
checkNo
=
fZl001
.
getCheckNo
();
String
checkNo
=
fZl001
.
getCheckNo
();
...
@@ -264,13 +273,14 @@ public class ServiceHGZL001 extends ServiceBase {
...
@@ -264,13 +273,14 @@ public class ServiceHGZL001 extends ServiceBase {
dbZl001
.
setUnqualifyQty
(
fZl001
.
getUnqualifyQty
());
dbZl001
.
setUnqualifyQty
(
fZl001
.
getUnqualifyQty
());
dbZl001
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
);
dbZl001
.
setStatus
(
CommonConstant
.
YesNo
.
YES_1
);
DaoUtils
.
update
(
HGSqlConstant
.
HgZl001
.
PROCESS
,
dbZl001
);
DaoUtils
.
update
(
HGSqlConstant
.
HgZl001
.
PROCESS
,
dbZl001
);
// 更新收货
单
明细
// 更新收货明细
this
.
updateReceiveDetail
(
fZl001
,
dbCg003BMap
);
this
.
updateReceiveDetail
(
fZl001
,
dbCg003BMap
,
dbCg002BMap
);
}
}
// 更新收货单主表信息
// 更新收货单主表信息,收货单号去重
this
.
updateReceiveMain
(
fZl001s
);
List
<
String
>
receiveNos
=
ObjectUtils
.
listEpKey
(
fZl001s
,
"receiveNo"
);
// 质检修改合同状态
HGCGTools
.
HgCg003
.
updateReceiveMain
(
receiveNos
);
this
.
updateContract
(
fZl001s
,
dbCg003BMap
);
// 质检修改主合同状态
HGCGTools
.
HgCg002
.
updateReceiveMain
(
dbCg002As
);
}
}
/**
/**
...
@@ -278,88 +288,20 @@ public class ServiceHGZL001 extends ServiceBase {
...
@@ -278,88 +288,20 @@ public class ServiceHGZL001 extends ServiceBase {
*
*
* @param fZl001
* @param fZl001
* @param dbCg003BMap
* @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
();
Long
receiveDetailId
=
fZl001
.
getReceiveDetailId
();
HGCG003B
dbCg003B
=
dbCg003BMap
.
get
(
receiveDetailId
);
// 更新采购收货明细的入库数量
// 更新采购收货明细的入库数量
Map
<
String
,
Object
>
paramDetailMap
=
new
HashMap
<>();
HGCGTools
.
HgCg003B
.
updateDeposit
(
receiveDetailId
,
fZl001
.
getQualifyQty
(),
fZl001
.
getUnqualifyQty
());
paramDetailMap
.
put
(
HGCG003B
.
FIELD_ID
,
receiveDetailId
);
// 更新合同明细的收货数量
paramDetailMap
.
put
(
HGCG003B
.
FIELD_STATUS
,
HGConstant
.
CgReceiveStatus
.
S_4
);
HGCG002B
dbCg002B
=
dbCg002BMap
.
get
(
dbCg003B
.
getContractDetailId
());
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
());
BigDecimal
unqualifyQty
=
fZl001
.
getUnqualifyQty
().
negate
();
BigDecimal
unqualifyQty
=
fZl001
.
getUnqualifyQty
().
negate
();
BigDecimal
unqualifyWeight
=
unqualifyQty
.
multiply
(
dbCg003B
.
getReceiveUnitWeight
());
BigDecimal
unqualifyWeight
=
unqualifyQty
.
multiply
(
dbCg003B
.
getReceiveUnitWeight
());
// 关联获取到合同明细
HGCG002B
dbCg002B
=
dbCg002BMap
.
get
(
dbCg003B
.
getContractDetailId
());
HGCGTools
.
HgCg002B
.
updateReceive
(
dbCg002B
,
unqualifyQty
,
unqualifyWeight
);
HGCGTools
.
HgCg002B
.
updateReceive
(
dbCg002B
,
unqualifyQty
,
unqualifyWeight
);
// 修改主表信息
// 生成采购入库单
HGCG002
dbCg002
=
dbCg002Map
.
get
(
dbCg002B
.
getPrimaryId
());
HGKCTools
.
HgKc001
.
putInStorageData
(
fZl001
,
dbCg003B
);
HGCGTools
.
HgCg002
.
updateReceive
(
dbCg002
,
unqualifyQty
,
unqualifyWeight
);
}
}
}
}
}
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