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
fa49d08c
Commit
fa49d08c
authored
Sep 12, 2024
by
宋祥
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.修复质检单完成时,合同成收货完成的问题
parent
5e8d1c85
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
299 additions
and
200 deletions
+299
-200
HGCG002B.java
src/main/java/com/baosight/hggp/hg/cg/domain/HGCG002B.java
+18
-2
ServiceHGCG002A.java
...java/com/baosight/hggp/hg/cg/service/ServiceHGCG002A.java
+3
-0
ServiceHGCG003.java
.../java/com/baosight/hggp/hg/cg/service/ServiceHGCG003.java
+2
-12
ServiceHGCG003A.java
...java/com/baosight/hggp/hg/cg/service/ServiceHGCG003A.java
+4
-4
HGCG002A.xml
src/main/java/com/baosight/hggp/hg/cg/sql/HGCG002A.xml
+48
-42
HGCG003.xml
src/main/java/com/baosight/hggp/hg/cg/sql/HGCG003.xml
+3
-0
HGCGTools.java
src/main/java/com/baosight/hggp/hg/cg/tools/HGCGTools.java
+69
-110
HGCGUtils.java
src/main/java/com/baosight/hggp/hg/cg/utils/HGCGUtils.java
+14
-1
HGConstant.java
src/main/java/com/baosight/hggp/hg/constant/HGConstant.java
+2
-0
HGKCTools.java
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
+5
-9
ServiceHGZL001.java
.../java/com/baosight/hggp/hg/zl/service/ServiceHGZL001.java
+127
-17
HGCG003A.jsp
src/main/webapp/HG/CG/HGCG003A.jsp
+0
-1
HGCG003B.jsp
src/main/webapp/HG/CG/HGCG003B.jsp
+1
-0
HGZL001.jsp
src/main/webapp/HG/ZL/HGZL001.jsp
+3
-2
No files found.
src/main/java/com/baosight/hggp/hg/cg/domain/HGCG002B.java
View file @
fa49d08c
...
@@ -67,6 +67,7 @@ public class HGCG002B extends DaoEPBase {
...
@@ -67,6 +67,7 @@ public class HGCG002B extends DaoEPBase {
public
static
final
String
FIELD_BC_MAX_RECEIVE_WEIGHT
=
"bcMaxReceiveWeight"
;
/* 本次最大收货重量*/
public
static
final
String
FIELD_BC_MAX_RECEIVE_WEIGHT
=
"bcMaxReceiveWeight"
;
/* 本次最大收货重量*/
public
static
final
String
FIELD_CONTRACT_DATE
=
"contractDate"
;
/* 合同日期*/
public
static
final
String
FIELD_CONTRACT_DATE
=
"contractDate"
;
/* 合同日期*/
public
static
final
String
FIELD_CONTRACT_NO
=
"contractNo"
;
/* 合同号*/
public
static
final
String
FIELD_CONTRACT_NO
=
"contractNo"
;
/* 合同号*/
public
static
final
String
FIELD_CONTRACT_LINE_NO
=
"contractLineNo"
;
/* 合同行号*/
public
static
final
String
FIELD_PLAN_NO
=
"planNo"
;
/* 计划单号*/
public
static
final
String
FIELD_PLAN_NO
=
"planNo"
;
/* 计划单号*/
public
static
final
String
FIELD_SUP_CODE
=
"supCode"
;
/* 供应商编码*/
public
static
final
String
FIELD_SUP_CODE
=
"supCode"
;
/* 供应商编码*/
public
static
final
String
FIELD_SUP_NAME
=
"supName"
;
/* 供应商名称*/
public
static
final
String
FIELD_SUP_NAME
=
"supName"
;
/* 供应商名称*/
...
@@ -161,6 +162,7 @@ public class HGCG002B extends DaoEPBase {
...
@@ -161,6 +162,7 @@ public class HGCG002B extends DaoEPBase {
private
BigDecimal
bcMaxReceiveWeight
=
new
BigDecimal
(
0.000
);
/* 本次最大收货重量*/
private
BigDecimal
bcMaxReceiveWeight
=
new
BigDecimal
(
0.000
);
/* 本次最大收货重量*/
private
String
contractDate
=
" "
;
/* 合同日期*/
private
String
contractDate
=
" "
;
/* 合同日期*/
private
String
contractNo
=
" "
;
/* 合同号*/
private
String
contractNo
=
" "
;
/* 合同号*/
private
String
contractLineNo
=
" "
;
/* 合同行号*/
private
String
planNo
=
" "
;
/* 计划单号*/
private
String
planNo
=
" "
;
/* 计划单号*/
private
String
supCode
=
" "
;
/* 供应商编码*/
private
String
supCode
=
" "
;
/* 供应商编码*/
private
String
supName
=
" "
;
/* 供应商名称*/
private
String
supName
=
" "
;
/* 供应商名称*/
...
@@ -386,7 +388,11 @@ public class HGCG002B extends DaoEPBase {
...
@@ -386,7 +388,11 @@ public class HGCG002B extends DaoEPBase {
eiColumn
=
new
EiColumn
(
FIELD_CONTRACT_NO
);
eiColumn
=
new
EiColumn
(
FIELD_CONTRACT_NO
);
eiColumn
.
setDescName
(
"合同号"
);
eiColumn
.
setDescName
(
"合同号"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_CONTRACT_LINE_NO
);
eiColumn
.
setDescName
(
"合同行号"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiColumn
=
new
EiColumn
(
FIELD_PLAN_NO
);
eiColumn
=
new
EiColumn
(
FIELD_PLAN_NO
);
eiColumn
.
setDescName
(
"计划单号"
);
eiColumn
.
setDescName
(
"计划单号"
);
eiMetadata
.
addMeta
(
eiColumn
);
eiMetadata
.
addMeta
(
eiColumn
);
...
@@ -1087,7 +1093,15 @@ public class HGCG002B extends DaoEPBase {
...
@@ -1087,7 +1093,15 @@ public class HGCG002B extends DaoEPBase {
public
void
setCalculationMethod
(
Integer
calculationMethod
)
{
public
void
setCalculationMethod
(
Integer
calculationMethod
)
{
this
.
calculationMethod
=
calculationMethod
;
this
.
calculationMethod
=
calculationMethod
;
}
}
public
String
getContractLineNo
()
{
return
contractLineNo
;
}
public
void
setContractLineNo
(
String
contractLineNo
)
{
this
.
contractLineNo
=
contractLineNo
;
}
/**
/**
* get the value from Map.
* get the value from Map.
*
*
...
@@ -1140,6 +1154,7 @@ public class HGCG002B extends DaoEPBase {
...
@@ -1140,6 +1154,7 @@ public class HGCG002B extends DaoEPBase {
setBcMaxReceiveWeight
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
FIELD_BC_MAX_RECEIVE_WEIGHT
)),
bcMaxReceiveWeight
));
setBcMaxReceiveWeight
(
NumberUtils
.
toBigDecimal
(
StringUtils
.
toString
(
map
.
get
(
FIELD_BC_MAX_RECEIVE_WEIGHT
)),
bcMaxReceiveWeight
));
setContractDate
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_CONTRACT_DATE
)),
contractDate
));
setContractDate
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_CONTRACT_DATE
)),
contractDate
));
setContractNo
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_CONTRACT_NO
)),
contractNo
));
setContractNo
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_CONTRACT_NO
)),
contractNo
));
setContractLineNo
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_CONTRACT_LINE_NO
)),
contractLineNo
));
setPlanNo
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_PLAN_NO
)),
planNo
));
setPlanNo
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_PLAN_NO
)),
planNo
));
setSupCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_SUP_CODE
)),
supCode
));
setSupCode
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_SUP_CODE
)),
supCode
));
setSupName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_SUP_NAME
)),
supName
));
setSupName
(
StringUtils
.
defaultIfEmpty
(
StringUtils
.
toString
(
map
.
get
(
FIELD_SUP_NAME
)),
supName
));
...
@@ -1199,6 +1214,7 @@ public class HGCG002B extends DaoEPBase {
...
@@ -1199,6 +1214,7 @@ public class HGCG002B extends DaoEPBase {
map
.
put
(
FIELD_BC_MAX_RECEIVE_WEIGHT
,
StringUtils
.
toString
(
bcMaxReceiveWeight
,
eiMetadata
.
getMeta
(
FIELD_BC_MAX_RECEIVE_WEIGHT
)));
map
.
put
(
FIELD_BC_MAX_RECEIVE_WEIGHT
,
StringUtils
.
toString
(
bcMaxReceiveWeight
,
eiMetadata
.
getMeta
(
FIELD_BC_MAX_RECEIVE_WEIGHT
)));
map
.
put
(
FIELD_CONTRACT_DATE
,
StringUtils
.
toString
(
contractDate
,
eiMetadata
.
getMeta
(
FIELD_CONTRACT_DATE
)));
map
.
put
(
FIELD_CONTRACT_DATE
,
StringUtils
.
toString
(
contractDate
,
eiMetadata
.
getMeta
(
FIELD_CONTRACT_DATE
)));
map
.
put
(
FIELD_CONTRACT_NO
,
StringUtils
.
toString
(
contractNo
,
eiMetadata
.
getMeta
(
FIELD_CONTRACT_NO
)));
map
.
put
(
FIELD_CONTRACT_NO
,
StringUtils
.
toString
(
contractNo
,
eiMetadata
.
getMeta
(
FIELD_CONTRACT_NO
)));
map
.
put
(
FIELD_CONTRACT_LINE_NO
,
StringUtils
.
toString
(
contractLineNo
,
eiMetadata
.
getMeta
(
FIELD_CONTRACT_LINE_NO
)));
map
.
put
(
FIELD_PLAN_NO
,
StringUtils
.
toString
(
planNo
,
eiMetadata
.
getMeta
(
FIELD_PLAN_NO
)));
map
.
put
(
FIELD_PLAN_NO
,
StringUtils
.
toString
(
planNo
,
eiMetadata
.
getMeta
(
FIELD_PLAN_NO
)));
map
.
put
(
FIELD_SUP_CODE
,
StringUtils
.
toString
(
supCode
,
eiMetadata
.
getMeta
(
FIELD_SUP_CODE
)));
map
.
put
(
FIELD_SUP_CODE
,
StringUtils
.
toString
(
supCode
,
eiMetadata
.
getMeta
(
FIELD_SUP_CODE
)));
map
.
put
(
FIELD_SUP_NAME
,
StringUtils
.
toString
(
supName
,
eiMetadata
.
getMeta
(
FIELD_SUP_NAME
)));
map
.
put
(
FIELD_SUP_NAME
,
StringUtils
.
toString
(
supName
,
eiMetadata
.
getMeta
(
FIELD_SUP_NAME
)));
...
...
src/main/java/com/baosight/hggp/hg/cg/service/ServiceHGCG002A.java
View file @
fa49d08c
...
@@ -170,6 +170,9 @@ public class ServiceHGCG002A extends ServiceBase {
...
@@ -170,6 +170,9 @@ public class ServiceHGCG002A extends ServiceBase {
*/
*/
private
void
insertDetails
(
HGCG001A
fCg001A
,
HGCG002
newCg002
)
{
private
void
insertDetails
(
HGCG001A
fCg001A
,
HGCG002
newCg002
)
{
HGCG002B
cg002B
=
BeanUtils
.
copy
(
fCg001A
,
HGCG002B
.
class
);
HGCG002B
cg002B
=
BeanUtils
.
copy
(
fCg001A
,
HGCG002B
.
class
);
cg002B
.
setContractNo
(
newCg002
.
getContractNo
());
cg002B
.
setContractLineNo
(
SequenceGenerator
.
getNextSequence
(
HGConstant
.
SequenceId
.
CG_CONTRACT_LINE_NO
,
new
String
[]{
newCg002
.
getContractNo
()}));
cg002B
.
setDeleteFlag
(
DeleteFlagEnum
.
UN_REMOVE
.
getCode
());
cg002B
.
setDeleteFlag
(
DeleteFlagEnum
.
UN_REMOVE
.
getCode
());
cg002B
.
setPrimaryId
(
newCg002
.
getId
());
cg002B
.
setPrimaryId
(
newCg002
.
getId
());
cg002B
.
setPlanDetailId
(
fCg001A
.
getId
());
cg002B
.
setPlanDetailId
(
fCg001A
.
getId
());
...
...
src/main/java/com/baosight/hggp/hg/cg/service/ServiceHGCG003.java
View file @
fa49d08c
...
@@ -145,9 +145,7 @@ public class ServiceHGCG003 extends ServiceBase {
...
@@ -145,9 +145,7 @@ public class ServiceHGCG003 extends ServiceBase {
* @param dbCg003Map
* @param dbCg003Map
*/
*/
private
void
checkEditData
(
List
<
HGCG003
>
fCg003s
,
Map
<
String
,
HGCG003
>
dbCg003Map
)
{
private
void
checkEditData
(
List
<
HGCG003
>
fCg003s
,
Map
<
String
,
HGCG003
>
dbCg003Map
)
{
// 查询合同信息
List
<
String
>
contractNos
=
ObjectUtils
.
listEpKey
(
dbCg003Map
.
values
(),
HGCG003
.
FIELD_CONTRACT_NO
);
List
<
String
>
contractNos
=
ObjectUtils
.
listEpKey
(
dbCg003Map
.
values
(),
HGCG003
.
FIELD_CONTRACT_NO
);
Map
<
String
,
HGCG002A
>
dbCg002AMap
=
HGCGTools
.
HgCg002
.
map
(
contractNos
);
for
(
HGCG003
fCg003
:
fCg003s
)
{
for
(
HGCG003
fCg003
:
fCg003s
)
{
String
receiveNo
=
fCg003
.
getReceiveNo
();
String
receiveNo
=
fCg003
.
getReceiveNo
();
HGCG003
dbCg003
=
dbCg003Map
.
get
(
receiveNo
);
HGCG003
dbCg003
=
dbCg003Map
.
get
(
receiveNo
);
...
@@ -156,14 +154,6 @@ public class ServiceHGCG003 extends ServiceBase {
...
@@ -156,14 +154,6 @@ public class ServiceHGCG003 extends ServiceBase {
String
.
format
(
"收货单[%s]状态不是\"待确认\",不允许操作"
,
receiveNo
));
String
.
format
(
"收货单[%s]状态不是\"待确认\",不允许操作"
,
receiveNo
));
AssertUtils
.
isGt
(
BigDecimal
.
ZERO
,
fCg003
.
getReceiveQty
(),
AssertUtils
.
isGt
(
BigDecimal
.
ZERO
,
fCg003
.
getReceiveQty
(),
String
.
format
(
"收货单[%s]的\"收货数量(%s)\"必须大于0"
,
receiveNo
,
fCg003
.
getReceiveQty
()));
String
.
format
(
"收货单[%s]的\"收货数量(%s)\"必须大于0"
,
receiveNo
,
fCg003
.
getReceiveQty
()));
// 校验合同数量
BigDecimal
diffQty
=
fCg003
.
getReceiveQty
().
subtract
(
dbCg003
.
getReceiveQty
());
if
(
diffQty
.
compareTo
(
BigDecimal
.
ZERO
)
==
1
)
{
HGCG002A
dbCg002A
=
dbCg002AMap
.
get
(
dbCg003
.
getContractNo
());
AssertUtils
.
isGt
(
diffQty
,
dbCg002A
.
getBcMaxReceiveQty
(),
String
.
format
(
"收货单【%s】的累计\"收货数量(%s)\"不能大于合同的\"采购数量(%s)\""
,
receiveNo
,
fCg003
.
getReceiveQty
(),
dbCg002A
.
getPurQty
()));
}
}
}
}
}
...
@@ -202,12 +192,12 @@ public class ServiceHGCG003 extends ServiceBase {
...
@@ -202,12 +192,12 @@ public class ServiceHGCG003 extends ServiceBase {
// 采购收货DB数据
// 采购收货DB数据
Map
<
String
,
HGCG003
>
dbCg003Map
=
HGCGUtils
.
HgCg003
.
lockGetDataEp
(
fCg003s
);
Map
<
String
,
HGCG003
>
dbCg003Map
=
HGCGUtils
.
HgCg003
.
lockGetDataEp
(
fCg003s
);
// 采购合同DB数据
// 采购合同DB数据
Map
<
String
,
HGCG002A
>
dbCg002
A
Map
=
HGCGUtils
.
HgCg002
.
lockGetData
(
Map
<
String
,
HGCG002A
>
dbCg002Map
=
HGCGUtils
.
HgCg002
.
lockGetData
(
ObjectUtils
.
listEpKey
(
fCg003s
,
HGCG003
.
FIELD_CONTRACT_NO
));
ObjectUtils
.
listEpKey
(
fCg003s
,
HGCG003
.
FIELD_CONTRACT_NO
));
// 数据校验
// 数据校验
this
.
checkRemoveData
(
fCg003s
,
dbCg003Map
);
this
.
checkRemoveData
(
fCg003s
,
dbCg003Map
);
// 保存数据
// 保存数据
this
.
removeData
(
fCg003s
,
dbCg003Map
,
dbCg002
A
Map
);
this
.
removeData
(
fCg003s
,
dbCg003Map
,
dbCg002Map
);
inInfo
=
this
.
query
(
inInfo
);
inInfo
=
this
.
query
(
inInfo
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setStatus
(
EiConstant
.
STATUS_DEFAULT
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
fCg003s
.
size
()
+
"]条数据删除成功!"
);
inInfo
.
setMsg
(
"操作成功!本次对["
+
fCg003s
.
size
()
+
"]条数据删除成功!"
);
...
...
src/main/java/com/baosight/hggp/hg/cg/service/ServiceHGCG003A.java
View file @
fa49d08c
...
@@ -185,18 +185,18 @@ public class ServiceHGCG003A extends ServiceBase {
...
@@ -185,18 +185,18 @@ public class ServiceHGCG003A extends ServiceBase {
*
*
* @param fCg002Bs
* @param fCg002Bs
* @param dbCg002BMap
* @param dbCg002BMap
* @param
c
g002
* @param
dbC
g002
*/
*/
private
void
confirmData
(
List
<
HGCG002B
>
fCg002Bs
,
Map
<
Long
,
HGCG002B
>
dbCg002BMap
,
HGCG002
c
g002
)
{
private
void
confirmData
(
List
<
HGCG002B
>
fCg002Bs
,
Map
<
Long
,
HGCG002B
>
dbCg002BMap
,
HGCG002
dbC
g002
)
{
// 写入主信息
// 写入主信息
HGCG003
newCg003
=
insertMain
(
fCg002Bs
,
c
g002
);
HGCG003
newCg003
=
insertMain
(
fCg002Bs
,
dbC
g002
);
// 写入明细数据
// 写入明细数据
for
(
HGCG002B
fCg002B
:
fCg002Bs
)
{
for
(
HGCG002B
fCg002B
:
fCg002Bs
)
{
insertDetails
(
fCg002B
,
dbCg002BMap
,
newCg003
);
insertDetails
(
fCg002B
,
dbCg002BMap
,
newCg003
);
}
}
// 修改合同信息
// 修改合同信息
List
<
HGCG002
>
cg002s
=
new
LinkedList
<>();
List
<
HGCG002
>
cg002s
=
new
LinkedList
<>();
cg002s
.
add
(
c
g002
);
cg002s
.
add
(
dbC
g002
);
HGCGTools
.
HgCg002
.
updateContractPrimary
(
cg002s
);
HGCGTools
.
HgCg002
.
updateContractPrimary
(
cg002s
);
}
}
...
...
src/main/java/com/baosight/hggp/hg/cg/sql/HGCG002A.xml
View file @
fa49d08c
...
@@ -40,7 +40,9 @@
...
@@ -40,7 +40,9 @@
PROJ_NAME as "projName",
<!-- 项目名称 -->
PROJ_NAME as "projName",
<!-- 项目名称 -->
CALCULATION_METHOD as "calculationMethod",
<!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
CALCULATION_METHOD as "calculationMethod",
<!-- 计算方式 0-数量乘单价 1-重量乘单价 -->
PLAN_DETAIL_ID as "planDetailId",
<!-- 计划明细id -->
PLAN_DETAIL_ID as "planDetailId",
<!-- 计划明细id -->
STATUS as "status"
STATUS as "status",
CONTRACT_NO as "contractNo",
CONTRACT_LINE_NO as "contractLineNo"
</sql>
</sql>
<sql
id=
"condition"
>
<sql
id=
"condition"
>
...
@@ -199,47 +201,51 @@
...
@@ -199,47 +201,51 @@
<include
refid=
"condition"
/>
<include
refid=
"condition"
/>
</select>
</select>
<insert
id=
"insert"
>
<insert
id=
"insert"
>
INSERT INTO ${hggpSchema}.HGCG002A (ID,
INSERT INTO ${hggpSchema}.HGCG002A (
ACCOUNT_CODE,
<!-- 企业编码 -->
ACCOUNT_CODE,
<!-- 企业编码 -->
DEP_CODE,
<!-- 部门编码 -->
DEP_CODE,
<!-- 部门编码 -->
CREATED_BY,
<!-- 记录创建者 -->
CREATED_BY,
<!-- 记录创建者 -->
CREATED_NAME,
<!-- 记录创建名称 -->
CREATED_NAME,
<!-- 记录创建名称 -->
CREATED_TIME,
<!-- 记录创建时间 -->
CREATED_TIME,
<!-- 记录创建时间 -->
UPDATED_BY,
<!-- 记录修改者 -->
DELETE_FLAG,
<!-- 0-未删除,1-已删除 -->
UPDATED_NAME,
<!-- 记录修改名称 -->
COMPANY_CODE,
<!-- 公司编码 -->
UPDATED_TIME,
<!-- 记录修改时间 -->
COMPANY_NAME,
<!-- 公司名称 -->
DELETE_FLAG,
<!-- 0-未删除,1-已删除 -->
INVENT_TYPE,
<!-- 存货类型 -->
COMPANY_CODE,
<!-- 公司编码 -->
INVENT_CODE,
<!-- 存货编码 -->
COMPANY_NAME,
<!-- 公司名称 -->
INVENT_NAME,
<!-- 存货名称 -->
INVENT_TYPE,
<!-- 存货类型 -->
SPEC,
<!-- 规格 -->
INVENT_CODE,
<!-- 存货编码 -->
MATERIAL,
<!-- 材质 -->
INVENT_NAME,
<!-- 存货名称 -->
UNIT,
<!-- 单位 -->
SPEC,
<!-- 规格 -->
LENGTH,
<!-- 长度 -->
MATERIAL,
<!-- 材质 -->
WIDTH,
<!-- 宽度 -->
UNIT,
<!-- 单位 -->
THICK,
<!-- 厚度 -->
LENGTH,
<!-- 长度 -->
PUR_QTY,
<!-- 采购数量 -->
WIDTH,
<!-- 宽度 -->
PUR_UNIT_WEIGHT,
<!-- 采购单重 -->
THICK,
<!-- 厚度 -->
PUR_WEIGHT,
<!-- 采购重量 -->
PUR_QTY,
<!-- 采购数量 -->
RECEIVE_QTY,
<!-- 收货数量 -->
PUR_UNIT_WEIGHT,
<!-- 采购单重 -->
RECEIVE_WEIGHT,
<!-- 收货重量 -->
PUR_WEIGHT,
<!-- 采购重量 -->
PRICE,
<!-- 单价 -->
RECEIVE_QTY,
<!-- 收货数量 -->
AMOUNT,
<!-- 金额(不含税金额) -->
RECEIVE_WEIGHT,
<!-- 收货重量 -->
TAX_INCLUDE_AMOUNT,
<!-- 含税金额 -->
PRICE,
<!-- 单价 -->
TAX_AMOUNT,
<!-- 税额 -->
AMOUNT,
<!-- 金额(不含税金额) -->
TAX_RATE,
<!-- 税率 -->
TAX_INCLUDE_AMOUNT,
<!-- 含税金额 -->
INVENT_TYPE_DETAIL,
<!-- 存货类型大类 -->
TAX_AMOUNT,
<!-- 税额 -->
PRIMARY_ID,
<!-- 主表id -->
TAX_RATE,
<!-- 税率 -->
PROJ_CODE,
<!-- 项目编码 -->
INVENT_TYPE_DETAIL,
<!-- 存货类型大类 -->
PROJ_NAME,
<!-- 项目名称 -->
PRIMARY_ID,
<!-- 主表id -->
CALCULATION_METHOD,
PROJ_CODE,
<!-- 项目编码 -->
PLAN_DETAIL_ID,
PROJ_NAME,
<!-- 项目名称 -->
CONTRACT_NO,
CALCULATION_METHOD,
CONTRACT_LINE_NO
PLAN_DETAIL_ID
) VALUES (
)
#accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#,
VALUES (#id#, #accountCode#, #depCode#, #createdBy#, #createdName#, #createdTime#, #updatedBy#, #updatedName#, #updatedTime#, #deleteFlag#, #companyCode#, #companyName#, #inventType#, #inventCode#, #inventName#, #spec#, #material#, #unit#, #length#, #width#, #thick#, #purQty#, #purUnitWeight#, #purWeight#, #receiveQty#, #receiveWeight#, #price#, #amount#, #taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#, #primaryId#,#projCode#,#projName#,#calculationMethod#, #planDetailId#)
#deleteFlag#, #companyCode#, #companyName#, #inventType#, #inventCode#, #inventName#, #spec#,
</insert>
#material#, #unit#, #length#, #width#, #thick#, #purQty#, #purUnitWeight#, #purWeight#, #receiveQty#,
#receiveWeight#, #price#, #amount#, #taxIncludeAmount#, #taxAmount#, #taxRate#, #inventTypeDetail#,
#primaryId#,#projCode#,#projName#,#calculationMethod#, #planDetailId#, #contractNo#, #contractLineNo#
)
</insert>
<delete
id=
"delete"
>
<delete
id=
"delete"
>
DELETE FROM ${hggpSchema}.HGCG002A WHERE
DELETE FROM ${hggpSchema}.HGCG002A WHERE
...
...
src/main/java/com/baosight/hggp/hg/cg/sql/HGCG003.xml
View file @
fa49d08c
...
@@ -140,6 +140,9 @@
...
@@ -140,6 +140,9 @@
<isNotEmpty
prepend=
" AND "
property=
"id"
>
<isNotEmpty
prepend=
" AND "
property=
"id"
>
ID = #id#
ID = #id#
</isNotEmpty>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"ids"
>
ID IN
<iterate
open=
"("
close=
")"
conjunction=
","
property=
"ids"
>
#ids[]#
</iterate>
</isNotEmpty>
<isNotEmpty
prepend=
" AND "
property=
"receiveNo"
>
<isNotEmpty
prepend=
" AND "
property=
"receiveNo"
>
RECEIVE_NO = #receiveNo#
RECEIVE_NO = #receiveNo#
</isNotEmpty>
</isNotEmpty>
...
...
src/main/java/com/baosight/hggp/hg/cg/tools/HGCGTools.java
View file @
fa49d08c
...
@@ -312,33 +312,44 @@ public class HGCGTools {
...
@@ -312,33 +312,44 @@ public class HGCGTools {
paramMap
.
put
(
HGCG002
.
FIELD_RECEIVE_WEIGHT
,
newReceiveWeight
);
paramMap
.
put
(
HGCG002
.
FIELD_RECEIVE_WEIGHT
,
newReceiveWeight
);
DaoUtils
.
update
(
HGSqlConstant
.
HgCg002
.
UPDATE_RECEIVE
,
paramMap
);
DaoUtils
.
update
(
HGSqlConstant
.
HgCg002
.
UPDATE_RECEIVE
,
paramMap
);
}
}
/**
/**
* 查询
* 查询
*
*
* @param
contractNo
s
* @param
id
s
* @return
* @return
*/
*/
public
static
List
<
HGCG002
A
>
list
(
List
<
String
>
contractNo
s
)
{
public
static
List
<
HGCG002
>
listByIds
(
List
<
Long
>
id
s
)
{
AssertUtils
.
isEmpty
(
contractNo
s
,
"合同号不能为空"
);
AssertUtils
.
isEmpty
(
id
s
,
"合同号不能为空"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"
contractNos"
,
contractNo
s
);
paramMap
.
put
(
"
ids"
,
id
s
);
return
DaoBase
.
getInstance
().
query
(
HGCG002
.
QUERY
,
paramMap
);
return
DaoBase
.
getInstance
().
query
(
HGCG002
.
QUERY
,
paramMap
);
}
}
/**
/**
* 查询
* 查询
*
*
* @param ids
* @param ids
* @return
* @return
*/
*/
public
static
List
<
HGCG002
>
listByIds
(
List
<
Long
>
ids
)
{
public
static
Map
<
Long
,
HGCG002
>
mapByIds
(
List
<
Long
>
ids
)
{
AssertUtils
.
isEmpty
(
ids
,
"合同号不能为空"
);
List
<
HGCG002
>
results
=
listByIds
(
ids
);
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGCG002:
:
getId
,
item
->
item
));
}
/**
* 查询
*
* @param contractNos
* @return
*/
public
static
List
<
HGCG002A
>
list
(
List
<
String
>
contractNos
)
{
AssertUtils
.
isEmpty
(
contractNos
,
"合同号不能为空"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"
ids"
,
id
s
);
paramMap
.
put
(
"
contractNos"
,
contractNo
s
);
return
DaoBase
.
getInstance
().
query
(
HGCG002
.
QUERY
,
paramMap
);
return
DaoBase
.
getInstance
().
query
(
HGCG002
.
QUERY
,
paramMap
);
}
}
/**
/**
* 查询
* 查询
*
*
...
@@ -347,7 +358,7 @@ public class HGCGTools {
...
@@ -347,7 +358,7 @@ public class HGCGTools {
*/
*/
public
static
Map
<
String
,
HGCG002A
>
map
(
List
<
String
>
contractNos
)
{
public
static
Map
<
String
,
HGCG002A
>
map
(
List
<
String
>
contractNos
)
{
List
<
HGCG002A
>
results
=
list
(
contractNos
);
List
<
HGCG002A
>
results
=
list
(
contractNos
);
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGCG002
A
:
:
getContractNo
,
item
->
item
));
return
results
.
stream
().
collect
(
Collectors
.
toMap
(
HGCG002:
:
getContractNo
,
item
->
item
));
}
}
/**
/**
...
@@ -430,39 +441,7 @@ public class HGCGTools {
...
@@ -430,39 +441,7 @@ public class HGCGTools {
DaoUtils
.
update
(
HGSqlConstant
.
HgCg002
.
UPDATE_PUR
,
cg002
);
DaoUtils
.
update
(
HGSqlConstant
.
HgCg002
.
UPDATE_PUR
,
cg002
);
}
}
public
static
void
updateChecks
(
List
<
HGZL001
>
fZl001s
)
{
//获取收货明细数据
List
<
Long
>
receiveDetailIds
=
fZl001s
.
stream
().
map
(
HGZL001:
:
getReceiveDetailId
).
collect
(
Collectors
.
toList
());
List
<
HGCG003B
>
hgcg003BList
=
HGCGTools
.
HgCg003B
.
list
(
receiveDetailIds
);
//获取合同明细
List
<
Long
>
contractDetailIds
=
hgcg003BList
.
stream
().
map
(
HGCG003B:
:
getContractDetailId
).
collect
(
Collectors
.
toList
());
List
<
HGCG002B
>
hgcg002BList
=
HGCGTools
.
HgCg002B
.
list
(
contractDetailIds
);
//合同主表信息
List
<
Long
>
contractIds
=
hgcg002BList
.
stream
().
map
(
o
->
o
.
getPrimaryId
()).
collect
(
Collectors
.
toList
());
List
<
HGCG002
>
queryHgcg002List
=
HGCGTools
.
HgCg002
.
listByIds
(
contractIds
);
fZl001s
.
forEach
(
hgzl001
->{
//关联获取到收货明细
HGCG003B
hgcg003B
=
hgcg003BList
.
stream
().
filter
(
o
->
o
.
getId
().
compareTo
(
hgzl001
.
getReceiveDetailId
())
==
0
).
findAny
().
orElse
(
null
);
if
(
Objects
.
nonNull
(
hgcg003B
)){
//关联获取到合同明细
HGCG002B
hgcg002B
=
hgcg002BList
.
stream
().
filter
(
o
->
o
.
getId
().
compareTo
(
hgcg003B
.
getContractDetailId
())
==
0
).
findAny
().
orElse
(
null
);
if
(
Objects
.
nonNull
(
hgcg002B
)){
BigDecimal
unqualifyQty
=
hgzl001
.
getUnqualifyQty
();
Integer
status
=
unqualifyQty
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
?
HGConstant
.
CgContractStatus
.
S_5
:
HGConstant
.
CgContractStatus
.
S_4
;
hgcg002B
.
setStatus
(
status
);
HGCGTools
.
HgCg002B
.
updateCheck
(
hgcg002B
,
unqualifyQty
.
negate
());
//修改主表信息
HGCG002
hgcg002
=
queryHgcg002List
.
stream
().
filter
(
o
->
o
.
getId
().
compareTo
(
hgcg002B
.
getPrimaryId
())
==
0
).
findAny
().
orElse
(
null
);
hgcg002
.
setStatus
(
status
);
HGCGTools
.
HgCg002
.
updateCheck
(
hgcg002
,
unqualifyQty
.
negate
());
}
}
});
}
/**
/**
* 修改状态
* 修改状态
*
*
...
@@ -611,24 +590,6 @@ public class HGCGTools {
...
@@ -611,24 +590,6 @@ public class HGCGTools {
/**
/**
* 修改状态
* 修改状态
*
*
* @param dbCg002B
* @param receiveQty
*/
public
static
void
updateCheck
(
HGCG002B
dbCg002B
,
BigDecimal
receiveQty
)
{
AssertUtils
.
isNull
(
dbCg002B
,
"合同明细不能为空!"
);
AssertUtils
.
isNull
(
receiveQty
,
"收货数量不能为空!"
);
BigDecimal
newReceiveQty
=
receiveQty
.
add
(
dbCg002B
.
getReceiveQty
());
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
HGCG002
.
FIELD_ID
,
dbCg002B
.
getId
());
paramMap
.
put
(
HGCG002
.
FIELD_RECEIVE_QTY
,
newReceiveQty
);
paramMap
.
put
(
HGCG002
.
FIELD_RECEIVE_WEIGHT
,
newReceiveQty
.
multiply
(
dbCg002B
.
getPurUnitWeight
()));
paramMap
.
put
(
HGCG002
.
FIELD_STATUS
,
dbCg002B
.
getStatus
());
DaoUtils
.
update
(
HGSqlConstant
.
HgCg002B
.
UPDATE_CHECK
,
paramMap
);
}
/**
* 修改状态
*
* @param primaryId
* @param primaryId
* @param status
* @param status
*/
*/
...
@@ -664,6 +625,7 @@ public class HGCGTools {
...
@@ -664,6 +625,7 @@ public class HGCGTools {
AssertUtils
.
isEmpty
(
results
,
String
.
format
(
"采购收货单[%s]不存在"
,
id
));
AssertUtils
.
isEmpty
(
results
,
String
.
format
(
"采购收货单[%s]不存在"
,
id
));
return
results
.
get
(
0
);
return
results
.
get
(
0
);
}
}
/**
/**
* 锁
* 锁
*
*
...
@@ -678,7 +640,20 @@ public class HGCGTools {
...
@@ -678,7 +640,20 @@ public class HGCGTools {
paramMap
.
put
(
"receiveNos"
,
receiveNos
);
paramMap
.
put
(
"receiveNos"
,
receiveNos
);
DaoBase
.
getInstance
().
update
(
HGSqlConstant
.
HgCg003
.
LOCK
,
paramMap
);
DaoBase
.
getInstance
().
update
(
HGSqlConstant
.
HgCg003
.
LOCK
,
paramMap
);
}
}
/**
* 查询
*
* @param ids
* @return
*/
public
static
List
<
HGCG003
>
listById
(
List
<
Long
>
ids
)
{
AssertUtils
.
isEmpty
(
ids
,
"合同号不能为空"
);
Map
<
String
,
Object
>
paramMap
=
new
HashMap
();
paramMap
.
put
(
"ids"
,
ids
);
return
DaoBase
.
getInstance
().
query
(
HGCG003
.
QUERY
,
paramMap
);
}
/**
/**
* 查询
* 查询
*
*
...
@@ -760,50 +735,6 @@ public class HGCGTools {
...
@@ -760,50 +735,6 @@ public class HGCGTools {
*
*
* @param zl001s
* @param zl001s
*/
*/
public
static
void
updateChecks
(
List
<
HGZL001
>
zl001s
)
{
zl001s
.
forEach
(
zl001
->{
Map
<
String
,
Object
>
paramDetailMap
=
new
HashMap
<>();
paramDetailMap
.
put
(
HGCG003B
.
FIELD_ID
,
zl001
.
getReceiveDetailId
());
paramDetailMap
.
put
(
HGCG003B
.
FIELD_STATUS
,
HGConstant
.
CgReceiveStatus
.
S_4
);
paramDetailMap
.
put
(
HGCG003B
.
FIELD_DELIVER_QTY
,
zl001
.
getUnqualifyQty
());
paramDetailMap
.
put
(
HGCG003B
.
FIELD_DEPOSIT_QTY
,
zl001
.
getQualifyQty
());
DaoUtils
.
update
(
HGSqlConstant
.
HgCg003B
.
UPDATE_CONFIRM
,
paramDetailMap
);
//采购入库
HGKCTools
.
HgKc001
.
putInStorageData
(
zl001
.
getReceiveDetailId
());
});
//获取质检通过的收货单信息
List
<
String
>
receiveNos
=
zl001s
.
stream
().
map
(
o
->
o
.
getReceiveNo
()).
collect
(
Collectors
.
toList
());
if
(!
CollectionUtils
.
isEmpty
(
receiveNos
)){
//主表信息
List
<
HGCG003
>
hgcg003List
=
HGCGTools
.
HgCg003
.
list
(
receiveNos
);
//子表信息
List
<
HGCG003B
>
hgcg003BList
=
HGCGTools
.
HgCg003B
.
listByPrimaryIds
(
hgcg003List
.
stream
().
map
(
o
->
o
.
getId
()).
collect
(
Collectors
.
toList
()));
hgcg003List
.
forEach
(
cg003
->{
List
<
HGCG003B
>
hgcg003BFilterList
=
hgcg003BList
.
stream
().
filter
(
o
->
o
.
getPrimaryId
().
compareTo
(
cg003
.
getId
())
==
0
&&
o
.
getStatus
().
intValue
()
==
HGConstant
.
CgReceiveStatus
.
S_3
).
collect
(
Collectors
.
toList
());
//如果不存在质检中的收货明细了,则主表为质检完成
if
(
CollectionUtils
.
isEmpty
(
hgcg003BFilterList
)){
Map
<
String
,
Object
>
paramDetailMap
=
new
HashMap
<>();
paramDetailMap
.
put
(
HGCG003
.
FIELD_RECEIVE_NO
,
cg003
.
getReceiveNo
());
paramDetailMap
.
put
(
HGCG003
.
FIELD_STATUS
,
HGConstant
.
CgReceiveStatus
.
S_4
);
BigDecimal
depositQtySum
=
hgcg003BList
.
stream
().
map
(
HGCG003B:
:
getDepositQty
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
paramDetailMap
.
put
(
HGCG003
.
FIELD_DEPOSIT_QTY
,
depositQtySum
);
BigDecimal
deliverQtySum
=
hgcg003BList
.
stream
().
map
(
HGCG003B:
:
getDeliverQty
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
paramDetailMap
.
put
(
HGCG003
.
FIELD_DELIVER_QTY
,
deliverQtySum
);
DaoUtils
.
update
(
HGSqlConstant
.
HgCg003
.
UPDATE_CONFIRM
,
paramDetailMap
);
}
});
}
}
/**
* 修改状态
*
* @param zl001s
*/
public
static
void
deleteChecks
(
List
<
HGZL001
>
zl001s
)
{
public
static
void
deleteChecks
(
List
<
HGZL001
>
zl001s
)
{
zl001s
.
forEach
(
zl001
->{
zl001s
.
forEach
(
zl001
->{
Map
<
String
,
Object
>
paramDetailMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
paramDetailMap
=
new
HashMap
<>();
...
@@ -877,7 +808,7 @@ public class HGCGTools {
...
@@ -877,7 +808,7 @@ public class HGCGTools {
paramMap
.
put
(
"primaryId"
,
primaryId
);
paramMap
.
put
(
"primaryId"
,
primaryId
);
return
DaoBase
.
getInstance
().
query
(
HGCG003B
.
QUERY
,
paramMap
);
return
DaoBase
.
getInstance
().
query
(
HGCG003B
.
QUERY
,
paramMap
);
}
}
/**
/**
* 查询
* 查询
*
*
...
@@ -890,7 +821,36 @@ public class HGCGTools {
...
@@ -890,7 +821,36 @@ public class HGCGTools {
paramMap
.
put
(
"primaryIds"
,
primaryIds
);
paramMap
.
put
(
"primaryIds"
,
primaryIds
);
return
DaoBase
.
getInstance
().
query
(
HGCG003B
.
QUERY
,
paramMap
);
return
DaoBase
.
getInstance
().
query
(
HGCG003B
.
QUERY
,
paramMap
);
}
}
/**
* 查询
*
* @param primaryIds
* @return
*/
public
static
Map
<
Long
,
List
<
HGCG003B
>>
mapByPrimaryIds
(
List
<
Long
>
primaryIds
)
{
List
<
HGCG003B
>
results
=
listByPrimaryIds
(
primaryIds
);
if
(
CollectionUtils
.
isEmpty
(
results
))
{
return
null
;
}
return
results
.
stream
().
collect
(
Collectors
.
groupingBy
(
HGCG003B:
:
getPrimaryId
));
}
/**
* 锁
*
* @param id
* @return
*/
public
static
void
lock
(
Long
id
)
{
if
(
id
==
null
)
{
return
;
}
Map
paramMap
=
new
HashMap
();
paramMap
.
put
(
"id"
,
id
);
DaoBase
.
getInstance
().
update
(
HGSqlConstant
.
HgCg003B
.
LOCK
,
paramMap
);
}
/**
/**
* 锁
* 锁
*
*
...
@@ -945,7 +905,6 @@ public class HGCGTools {
...
@@ -945,7 +905,6 @@ public class HGCGTools {
DaoUtils
.
update
(
HGSqlConstant
.
HgCg003B
.
UPDATE_STATUS
,
paramMap
);
DaoUtils
.
update
(
HGSqlConstant
.
HgCg003B
.
UPDATE_STATUS
,
paramMap
);
}
}
}
}
}
}
src/main/java/com/baosight/hggp/hg/cg/utils/HGCGUtils.java
View file @
fa49d08c
...
@@ -178,7 +178,20 @@ public class HGCGUtils {
...
@@ -178,7 +178,20 @@ public class HGCGUtils {
* @date:2024/5/9,16:58
* @date:2024/5/9,16:58
*/
*/
public
static
class
HgCg003B
{
public
static
class
HgCg003B
{
/**
* 锁并且获取数据
*
* @param id
* @return
*/
public
static
HGCG003B
lockGetData
(
Long
id
)
{
// 锁
HGCGTools
.
HgCg003B
.
lock
(
id
);
// db数据
return
HGCGTools
.
HgCg003B
.
get
(
id
);
}
/**
/**
* 锁并且获取数据
* 锁并且获取数据
*
*
...
...
src/main/java/com/baosight/hggp/hg/constant/HGConstant.java
View file @
fa49d08c
...
@@ -101,6 +101,8 @@ public class HGConstant {
...
@@ -101,6 +101,8 @@ public class HGConstant {
public
static
final
String
CG_PLAN_NO
=
"CG_PLAN_NO"
;
public
static
final
String
CG_PLAN_NO
=
"CG_PLAN_NO"
;
// 采购合同号
// 采购合同号
public
static
final
String
CG_CONTRACT_NO
=
"CG_CONTRACT_NO"
;
public
static
final
String
CG_CONTRACT_NO
=
"CG_CONTRACT_NO"
;
// 采购合同行号
public
static
final
String
CG_CONTRACT_LINE_NO
=
"CG_CONTRACT_LINE_NO"
;
// 采购收货号
// 采购收货号
public
static
final
String
CG_RECEIVE_NO
=
"CG_RECEIVE_NO"
;
public
static
final
String
CG_RECEIVE_NO
=
"CG_RECEIVE_NO"
;
// 采购入库号
// 采购入库号
...
...
src/main/java/com/baosight/hggp/hg/kc/tools/HGKCTools.java
View file @
fa49d08c
...
@@ -8,6 +8,7 @@ import com.baosight.hggp.core.dao.DaoBase;
...
@@ -8,6 +8,7 @@ import com.baosight.hggp.core.dao.DaoBase;
import
com.baosight.hggp.core.dao.DaoUtils
;
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.hg.cg.domain.HGCG003B
;
import
com.baosight.hggp.hg.cg.domain.HGCG003B
;
import
com.baosight.hggp.hg.cg.tools.HGCGTools
;
import
com.baosight.hggp.hg.cg.utils.HGCGUtils
;
import
com.baosight.hggp.hg.cg.utils.HGCGUtils
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.constant.HGConstant
;
import
com.baosight.hggp.hg.constant.HGSqlConstant
;
import
com.baosight.hggp.hg.constant.HGSqlConstant
;
...
@@ -107,16 +108,11 @@ public class HGKCTools {
...
@@ -107,16 +108,11 @@ public class HGKCTools {
/**
/**
* 生产入库(入库质检单)
* 生产入库(入库质检单)
* @param receiveId
*
* @param dbCg003B
*/
*/
public
static
void
putInStorageData
(
Long
receiveId
)
{
public
static
void
putInStorageData
(
HGCG003B
dbCg003B
)
{
List
<
Long
>
receiveIDsList
=
new
LinkedList
<>();
HGKC001
newKc001
=
BeanUtils
.
copy
(
dbCg003B
,
HGKC001
.
class
);
receiveIDsList
.
add
(
receiveId
);
// db数据
Map
<
Long
,
HGCG003B
>
dbCg003BMap
=
HGCGUtils
.
HgCg003B
.
lockGetData
(
receiveIDsList
);
HGCG003B
dbCg003B
=
dbCg003BMap
.
get
(
receiveId
);
HGKC001
newKc001
=
new
HGKC001
();
BeanUtils
.
copyProperties
(
dbCg003B
,
newKc001
,
"id"
,
"createdBy"
,
"createdName"
,
"createdTime"
,
"updatedBy"
,
"updatedName"
,
"updatedTime"
);
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
.
getDepositQty
());
newKc001
.
setDepositQty
(
dbCg003B
.
getDepositQty
());
...
...
src/main/java/com/baosight/hggp/hg/zl/service/ServiceHGZL001.java
View file @
fa49d08c
...
@@ -6,7 +6,13 @@ import com.baosight.hggp.core.constant.CommonConstant;
...
@@ -6,7 +6,13 @@ import com.baosight.hggp.core.constant.CommonConstant;
import
com.baosight.hggp.core.dao.DaoUtils
;
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.HGCG002B
;
import
com.baosight.hggp.hg.cg.domain.HGCG003
;
import
com.baosight.hggp.hg.cg.domain.HGCG003B
;
import
com.baosight.hggp.hg.cg.tools.HGCGTools
;
import
com.baosight.hggp.hg.cg.tools.HGCGTools
;
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.constant.HGSqlConstant
;
import
com.baosight.hggp.hg.kc.tools.HGKCTools
;
import
com.baosight.hggp.hg.kc.tools.HGKCTools
;
import
com.baosight.hggp.hg.xs.domain.Company
;
import
com.baosight.hggp.hg.xs.domain.Company
;
...
@@ -21,10 +27,15 @@ import com.baosight.iplat4j.core.ei.EiConstant;
...
@@ -21,10 +27,15 @@ 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
;
import
org.apache.commons.collections.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.stream.Collectors
;
/**
/**
* @author ZJH
* @author ZJH
...
@@ -194,10 +205,14 @@ public class ServiceHGZL001 extends ServiceBase {
...
@@ -194,10 +205,14 @@ public class ServiceHGZL001 extends ServiceBase {
try
{
try
{
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
)
.
collect
(
Collectors
.
toList
());
Map
<
Long
,
HGCG003B
>
dbCg003BMap
=
HGCGUtils
.
HgCg003B
.
lockGetData
(
receiveDetailIds
);
// 数据校验
// 数据校验
this
.
checkProcessData
(
fZl001s
,
dbZl001Map
);
this
.
checkProcessData
(
fZl001s
,
dbZl001Map
,
dbCg003BMap
);
// 保存数据
// 保存数据
this
.
saveProcessData
(
fZl001s
,
dbZl001Map
);
this
.
saveProcessData
(
fZl001s
,
dbZl001Map
,
dbCg003BMap
);
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
()
+
"]条数据处理成功!"
);
...
@@ -206,50 +221,145 @@ public class ServiceHGZL001 extends ServiceBase {
...
@@ -206,50 +221,145 @@ public class ServiceHGZL001 extends ServiceBase {
}
}
return
inInfo
;
return
inInfo
;
}
}
/**
/**
* 校验数据
* 校验数据
*
*
* @param fZl001s
* @param fZl001s
* @param dbZl001Map
* @param dbZl001Map
* @param dbCg003BMap
*/
*/
private
void
checkProcessData
(
List
<
HGZL001
>
fZl001s
,
Map
<
String
,
HGZL001
>
dbZl001Map
)
{
private
void
checkProcessData
(
List
<
HGZL001
>
fZl001s
,
Map
<
String
,
HGZL001
>
dbZl001Map
,
Map
<
Long
,
HGCG003B
>
dbCg003BMap
)
{
for
(
HGZL001
fZl001
:
fZl001s
)
{
for
(
HGZL001
fZl001
:
fZl001s
)
{
String
checkNo
=
fZl001
.
getCheckNo
();
String
checkNo
=
fZl001
.
getCheckNo
();
HGZL001
dbZl003
=
dbZl001Map
.
get
(
checkNo
);
HGZL001
dbZl003
=
dbZl001Map
.
get
(
checkNo
);
AssertUtils
.
isNotEquals
(
CommonConstant
.
YesNo
.
NO_0
,
dbZl003
.
getStatus
(),
AssertUtils
.
isNotEquals
(
CommonConstant
.
YesNo
.
NO_0
,
dbZl003
.
getStatus
(),
String
.
format
(
"质检单[%s]状态不是\"未处理\",不允许操作"
,
checkNo
));
String
.
format
(
"质检单[%s]状态不是\"未处理\",不允许操作"
,
checkNo
));
AssertUtils
.
isTrue
(
fZl001
.
getQualifyQty
().
compareTo
(
BigDecimal
.
ZERO
)
<
0
,
String
.
format
(
"质检单[%s]的合格数量不能为负数"
,
checkNo
));
AssertUtils
.
isTrue
(
fZl001
.
getQualifyQty
().
compareTo
(
BigDecimal
.
ZERO
)
<
0
,
AssertUtils
.
isTrue
(
fZl001
.
getUnqualifyQty
().
compareTo
(
BigDecimal
.
ZERO
)
<
0
,
String
.
format
(
"质检单[%s]的不合格数量不能为负数"
,
checkNo
));
String
.
format
(
"质检单[%s]的合格数量不能为负数"
,
checkNo
));
AssertUtils
.
isTrue
(
fZl001
.
getUnqualifyQty
().
compareTo
(
BigDecimal
.
ZERO
)
<
0
,
String
.
format
(
"质检单[%s]的不合格数量不能为负数"
,
checkNo
));
AssertUtils
.
isNotEquals
(
fZl001
.
getQualifyQty
().
add
(
fZl001
.
getUnqualifyQty
()),
dbZl003
.
getReceiveQty
(),
AssertUtils
.
isNotEquals
(
fZl001
.
getQualifyQty
().
add
(
fZl001
.
getUnqualifyQty
()),
dbZl003
.
getReceiveQty
(),
String
.
format
(
"质检单[%s]的合格数量加不合格数量必须等于收货数量"
,
checkNo
));
String
.
format
(
"质检单[%s]的合格数量加不合格数量必须等于收货数量"
,
checkNo
));
AssertUtils
.
isNull
(
dbCg003BMap
.
get
(
fZl001
.
getReceiveDetailId
()),
String
.
format
(
"质检单[%s]的关联的收货信息不存在"
,
checkNo
));
}
}
}
}
/**
/**
* 保存数据
* 保存数据
*
*
* @param fZl001s
* @param fZl001s
* @param dbZl001Map
* @param dbZl001Map
* @param dbCg003BMap
*/
*/
private
void
saveProcessData
(
List
<
HGZL001
>
fZl001s
,
Map
<
String
,
HGZL001
>
dbZl001Map
)
{
private
void
saveProcessData
(
List
<
HGZL001
>
fZl001s
,
Map
<
String
,
HGZL001
>
dbZl001Map
,
Map
<
Long
,
HGCG003B
>
dbCg003BMap
)
{
for
(
HGZL001
fZl001
:
fZl001s
)
{
for
(
HGZL001
fZl001
:
fZl001s
)
{
// 更新质检单状态
String
checkNo
=
fZl001
.
getCheckNo
();
String
checkNo
=
fZl001
.
getCheckNo
();
HGZL001
dbZl001
=
dbZl001Map
.
get
(
checkNo
);
HGZL001
dbZl001
=
dbZl001Map
.
get
(
checkNo
);
dbZl001
.
setQualifyQty
(
fZl001
.
getQualifyQty
());
dbZl001
.
setQualifyQty
(
fZl001
.
getQualifyQty
());
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
);
// // 更新收货单状态
// 更新收货单明细
// HGCGTools.HgCg003.updateCheck(dbZl001);
this
.
updateReceiveDetail
(
fZl001
,
dbCg003BMap
);
//生成采购入库单
//HGKCTools.HgKc001.putInStorageData(dbZl001.getReceiveDetailId());
}
}
// 更新收货单
状态
// 更新收货单
主表信息
HGCGTools
.
HgCg003
.
updateChecks
(
fZl001s
);
this
.
updateReceiveMain
(
fZl001s
);
// 质检修改合同状态
// 质检修改合同状态
HGCGTools
.
HgCg002
.
updateChecks
(
fZl001s
);
this
.
updateContract
(
fZl001s
,
dbCg003BMap
);
}
}
/**
* 更新收货单明细
*
* @param fZl001
* @param dbCg003BMap
*/
private
void
updateReceiveDetail
(
HGZL001
fZl001
,
Map
<
Long
,
HGCG003B
>
dbCg003BMap
)
{
Long
receiveDetailId
=
fZl001
.
getReceiveDetailId
();
// 更新采购收货明细的入库数量
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
());
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
);
}
}
}
}
src/main/webapp/HG/CG/HGCG003A.jsp
View file @
fa49d08c
...
@@ -88,7 +88,6 @@
...
@@ -88,7 +88,6 @@
sumType=
"page"
/>
sumType=
"page"
/>
<EF:EFColumn
ename=
"taxIncludeAmount"
cname=
"含税金额"
enable=
"false"
width=
"120"
align=
"right"
<EF:EFColumn
ename=
"taxIncludeAmount"
cname=
"含税金额"
enable=
"false"
width=
"120"
align=
"right"
format=
"{0:C3}"
sumType=
"page"
/>
format=
"{0:C3}"
sumType=
"page"
/>
<EF:EFColumn
ename=
"planNo"
cname=
"计划单号"
enable=
"false"
width=
"120"
align=
"center"
/>
<EF:EFColumn
ename=
"planNo"
cname=
"计划单号"
enable=
"false"
width=
"120"
align=
"center"
/>
<EF:EFColumn
ename=
"createdName"
cname=
"创建人"
enable=
"false"
width=
"100"
align=
"center"
/>
<EF:EFColumn
ename=
"createdName"
cname=
"创建人"
enable=
"false"
width=
"100"
align=
"center"
/>
<EF:EFColumn
ename=
"createdTime"
cname=
"创建时间"
enable=
"false"
width=
"140"
align=
"center"
<EF:EFColumn
ename=
"createdTime"
cname=
"创建时间"
enable=
"false"
width=
"140"
align=
"center"
...
...
src/main/webapp/HG/CG/HGCG003B.jsp
View file @
fa49d08c
...
@@ -68,6 +68,7 @@
...
@@ -68,6 +68,7 @@
<EF:EFComboColumn
ename=
"status"
cname=
"状态"
enable=
"false"
width=
"80"
align=
"center"
>
<EF:EFComboColumn
ename=
"status"
cname=
"状态"
enable=
"false"
width=
"80"
align=
"center"
>
<EF:EFCodeOption
codeName=
"hggp.hgcg.receiveStatus"
/>
<EF:EFCodeOption
codeName=
"hggp.hgcg.receiveStatus"
/>
</EF:EFComboColumn>
</EF:EFComboColumn>
<EF:EFColumn
ename=
"contractNo"
cname=
"合同号"
enable=
"false"
width=
"120"
align=
"center"
/>
<EF:EFColumn
ename=
"createdName"
cname=
"创建人"
enable=
"false"
width=
"100"
align=
"center"
/>
<EF:EFColumn
ename=
"createdName"
cname=
"创建人"
enable=
"false"
width=
"100"
align=
"center"
/>
<EF:EFColumn
ename=
"createdTime"
cname=
"创建时间"
enable=
"false"
width=
"140"
align=
"center"
<EF:EFColumn
ename=
"createdTime"
cname=
"创建时间"
enable=
"false"
width=
"140"
align=
"center"
editType=
"datetime"
parseFormats=
"['yyyyMMddHHmmss']"
/>
editType=
"datetime"
parseFormats=
"['yyyyMMddHHmmss']"
/>
...
...
src/main/webapp/HG/ZL/HGZL001.jsp
View file @
fa49d08c
...
@@ -29,11 +29,12 @@
...
@@ -29,11 +29,12 @@
<EF:EFOption
label=
"已处理"
value=
"1"
></EF:EFOption>
<EF:EFOption
label=
"已处理"
value=
"1"
></EF:EFOption>
<EF:EFOption
label=
"未处理"
value=
"0"
></EF:EFOption>
<EF:EFOption
label=
"未处理"
value=
"0"
></EF:EFOption>
</EF:EFSelect>
</EF:EFSelect>
<EF:EFInput
cname=
"收货单号"
ename=
"receiveNo"
blockId=
"inqu_status"
row=
"0"
colWidth=
"3"
/>
</div>
</div>
</EF:EFRegion>
</EF:EFRegion>
<EF:EFRegion
id=
"result"
title=
"明细信息"
>
<EF:EFRegion
id=
"result"
title=
"明细信息"
fitHeight=
"true"
>
<EF:EFGrid
blockId=
"result"
autoDraw=
"override"
isFloat=
"true"
checkMode=
"row"
>
<EF:EFGrid
blockId=
"result"
autoDraw=
"override"
isFloat=
"true"
checkMode=
"row"
height=
"68vh"
>
<EF:EFColumn
ename=
"id"
cname=
"内码"
hidden=
"true"
/>
<EF:EFColumn
ename=
"id"
cname=
"内码"
hidden=
"true"
/>
<EF:EFColumn
ename=
"problemPhoto"
cname=
"问题照片"
locked=
"true"
enable=
"false"
width=
"100"
align=
"center"
<EF:EFColumn
ename=
"problemPhoto"
cname=
"问题照片"
locked=
"true"
enable=
"false"
width=
"100"
align=
"center"
required=
"true"
/>
required=
"true"
/>
...
...
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