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
dcc48924
Commit
dcc48924
authored
Jul 06, 2024
by
13420
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
采购收票bug处理
parent
2eabad05
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
303 additions
and
57 deletions
+303
-57
ServiceHGCW012.java
.../java/com/baosight/hggp/hg/cw/service/ServiceHGCW012.java
+244
-25
HGCWTools.java
src/main/java/com/baosight/hggp/hg/cw/tools/HGCWTools.java
+34
-11
HGCW012A.js
src/main/webapp/HG/CW/HGCW012A.js
+25
-21
No files found.
src/main/java/com/baosight/hggp/hg/cw/service/ServiceHGCW012.java
View file @
dcc48924
...
@@ -4,7 +4,6 @@ import com.baosight.eplat.utils.StringUtils;
...
@@ -4,7 +4,6 @@ import com.baosight.eplat.utils.StringUtils;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.aspect.annotation.OperationLogAnnotation
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.common.DdynamicEnum
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.core.dao.DaoUtils
;
import
com.baosight.hggp.hg.cw.domain.HGCW010
;
import
com.baosight.hggp.hg.cw.domain.HGCW012
;
import
com.baosight.hggp.hg.cw.domain.HGCW012
;
import
com.baosight.hggp.hg.cw.domain.HGCW013
;
import
com.baosight.hggp.hg.cw.domain.HGCW013
;
import
com.baosight.hggp.hg.cw.tools.HGCWTools
;
import
com.baosight.hggp.hg.cw.tools.HGCWTools
;
...
@@ -23,6 +22,7 @@ import org.apache.commons.collections.CollectionUtils;
...
@@ -23,6 +22,7 @@ import org.apache.commons.collections.CollectionUtils;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
import
java.text.DecimalFormat
;
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
;
...
@@ -151,14 +151,12 @@ public class ServiceHGCW012 extends ServiceBase {
...
@@ -151,14 +151,12 @@ public class ServiceHGCW012 extends ServiceBase {
@OperationLogAnnotation
(
operModul
=
"采购收票"
,
operType
=
"插入"
,
operDesc
=
"生成采购收票"
)
@OperationLogAnnotation
(
operModul
=
"采购收票"
,
operType
=
"插入"
,
operDesc
=
"生成采购收票"
)
public
EiInfo
select
(
EiInfo
inInfo
)
{
public
EiInfo
select
(
EiInfo
inInfo
)
{
try
{
try
{
Map
queryRows
=
EiInfoUtils
.
getFirstRow
(
inInfo
);
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
"resultA"
).
getRows
();
String
typeBlockId
=
queryRows
.
get
(
"type"
).
toString
();
List
<
Map
>
queryRows
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
).
getRows
();
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
typeBlockId
).
getRows
();
String
mainId
=
""
;
String
mainId
=
""
;
if
(
queryRows
.
get
(
"mainId"
)!=
null
)
{
if
(
CollectionUtils
.
isNotEmpty
(
queryRows
))
{
mainId
=
queryRows
.
get
(
"mainId"
).
toString
();
mainId
=
queryRows
.
get
(
0
).
get
(
"mainId"
).
toString
();
}
}
Integer
contractType
=
getContractTypeStr
(
queryRows
.
get
(
"type"
).
toString
());
//获取相应的数据
//获取相应的数据
List
<
HGCW013
>
hgcw013List
=
HGCWTools
.
HgCw013
.
mapToList
(
resultRows
,
NumberUtils
.
toLong
(
mainId
));
List
<
HGCW013
>
hgcw013List
=
HGCWTools
.
HgCw013
.
mapToList
(
resultRows
,
NumberUtils
.
toLong
(
mainId
));
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#.000"
);
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#.000"
);
...
@@ -166,53 +164,274 @@ public class ServiceHGCW012 extends ServiceBase {
...
@@ -166,53 +164,274 @@ public class ServiceHGCW012 extends ServiceBase {
if
(
StringUtils
.
isEmpty
(
mainId
))
{
if
(
StringUtils
.
isEmpty
(
mainId
))
{
//先生成主表
//先生成主表
HGCW012
hgcw012
=
new
HGCW012
();
HGCW012
hgcw012
=
new
HGCW012
();
hgcw012
.
fromMap
(
resultRows
.
get
(
0
));
UserVO
userVO
=
HGCWTools
.
HgCw002
.
getUserCompany
();
UserVO
userVO
=
HGCWTools
.
HgCw002
.
getUserCompany
();
hgcw012
.
setCompanyCode
(
userVO
.
getUsercode
());
hgcw012
.
setCompanyCode
(
userVO
.
getUsercode
());
hgcw012
.
setCompanyName
(
userVO
.
getUsername
());
hgcw012
.
setCompanyName
(
userVO
.
getUsername
());
hgcw012
.
setReviewStatus
(
0
);
hgcw012
.
setBillState
(
1
);
hgcw012
.
setBillState
(
1
);
hgcw012
.
setSigningDate
(
DateUtils
.
shortDate
());
hgcw012
.
setSigningDate
(
DateUtils
.
shortDate
());
hgcw012
.
setReceiveDate
(
DateUtils
.
shortDate
());
BigDecimal
totalContractPriceIncluding
=
BigDecimal
.
ZERO
;
BigDecimal
totalContractPriceIncluding
=
BigDecimal
.
ZERO
;
StringBuffer
contractNumber
=
new
StringBuffer
();
StringBuffer
settlementNumber
=
new
StringBuffer
();
Map
<
String
,
BigDecimal
>
rowMap
=
new
HashMap
<>();
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
totalContractPriceIncluding
=
totalContractPriceIncluding
.
add
(
hgcw013
.
getTotalContractPriceIncluding
());
settlementNumber
.
append
(
hgcw013
.
getSettlementNumber
()).
append
(
","
);
}
for
(
Map
m
:
resultRows
)
{
String
c
=
m
.
get
(
"settlementNumber"
).
toString
();
BigDecimal
remainingAmount
=
new
BigDecimal
(
m
.
get
(
"thisAmount"
).
toString
());
rowMap
.
put
(
c
,
remainingAmount
);
totalContractPriceIncluding
=
totalContractPriceIncluding
.
add
(
remainingAmount
);
}
}
hgcw012
.
setTotalContractPriceIncluding
(
new
BigDecimal
(
decimalFormat
.
format
(
totalContractPriceIncluding
)));
hgcw012
.
setTotalContractPriceIncluding
(
new
BigDecimal
(
decimalFormat
.
format
(
totalContractPriceIncluding
)));
hgcw012
.
setContractType
(
contractType
);
hgcw012
.
setPartyA
(
hgcw013List
.
get
(
0
).
getPartyA
());
hgcw012
.
setTaxPoints
(
hgcw013List
.
get
(
0
).
getTaxPoints
());
hgcw012
.
setThisSettlementTax
(
hgcw013List
.
get
(
0
).
getThisSettlementTax
());
hgcw012
.
setThisSettlementAmount
(
hgcw013List
.
get
(
0
).
getThisSettlementAmount
());
hgcw012
.
setBillNumber
(
hgcw013List
.
get
(
0
).
getBillNumber
());
hgcw012
.
setSettlementNumber
(
settlementNumber
.
toString
().
substring
(
0
,
settlementNumber
.
length
()
-
1
));
hgcw012
.
setRemainingAmount
(
new
BigDecimal
(
decimalFormat
.
format
(
totalContractPriceIncluding
)));
this
.
add
(
hgcw012
);
this
.
add
(
hgcw012
);
//生成明细表
//生成明细表
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
hgcw013
.
setMainId
(
hgcw012
.
getId
());
hgcw013
.
setMainId
(
hgcw012
.
getId
());
hgcw013
.
setId
(
null
);
// 反写金额
HGCWTools
.
HgCw008
.
deductionAmount
(
hgcw013
.
getSettlementNumber
(),
rowMap
.
get
(
hgcw013
.
getSettlementNumber
()));
DaoUtils
.
insert
(
HGCW013
.
INSERT
,
hgcw013
);
DaoUtils
.
insert
(
HGCW013
.
INSERT
,
hgcw013
);
}
}
}
else
{
}
else
{
// 更新主表
HGCW012
hgcw012
=
HGCWTools
.
HgCw012
.
getId
(
mainId
);
HGCW012
HGCW012
=
HGCWTools
.
HgCw012
.
getId
(
mainId
);
Map
<
String
,
BigDecimal
>
rowMap
=
new
HashMap
<>();
for
(
Map
m
:
resultRows
)
{
String
c
=
m
.
get
(
"settlementNumber"
).
toString
();
BigDecimal
remainingAmount
=
new
BigDecimal
(
m
.
get
(
"thisAmount"
).
toString
());
rowMap
.
put
(
c
,
remainingAmount
);
}
// 生成明细表
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
hgcw013
.
setMainId
(
hgcw012
.
getId
());
// 反写金额
HGCWTools
.
HgCw008
.
deductionAmount
(
hgcw013
.
getSettlementNumber
(),
rowMap
.
get
(
hgcw013
.
getSettlementNumber
()));
this
.
addHGCW013
(
hgcw013
);
}
List
<
HGCW013
>
hgcw013s
=
HGCWTools
.
HgCw013
.
getMainId
(
hgcw012
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
hgcw013s
))
{
// 更新主表
BigDecimal
totalContractPriceIncluding
=
BigDecimal
.
ZERO
;
StringBuffer
settlementNumber
=
new
StringBuffer
();
for
(
HGCW013
hgcw013
:
hgcw013s
)
{
totalContractPriceIncluding
=
totalContractPriceIncluding
.
add
(
hgcw013
.
getTotalContractPriceIncluding
());
settlementNumber
.
append
(
hgcw013
.
getSettlementNumber
()).
append
(
","
);
}
hgcw012
.
setTotalContractPriceIncluding
(
totalContractPriceIncluding
);
hgcw012
.
setPartyA
(
hgcw013s
.
get
(
0
).
getPartyA
());
hgcw012
.
setTaxPoints
(
hgcw013List
.
get
(
0
).
getTaxPoints
());
hgcw012
.
setThisSettlementTax
(
hgcw013List
.
get
(
0
).
getThisSettlementTax
());
hgcw012
.
setThisSettlementAmount
(
hgcw013List
.
get
(
0
).
getThisSettlementAmount
());
hgcw012
.
setBillNumber
(
hgcw013List
.
get
(
0
).
getBillNumber
());
hgcw012
.
setSettlementNumber
(
settlementNumber
.
toString
().
substring
(
0
,
settlementNumber
.
length
()
-
1
));
this
.
modify
(
hgcw012
);
}
}
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据生成成功!"
);
}
}
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"生成收款单失败"
);
}
return
inInfo
;
}
public
EiInfo
selecta
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
"result"
).
getRows
();
List
<
Map
>
queryRows
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
).
getRows
();
String
mainId
=
""
;
if
(
CollectionUtils
.
isNotEmpty
(
queryRows
))
{
mainId
=
queryRows
.
get
(
0
).
get
(
"mainId"
).
toString
();
}
//获取相应的数据
List
<
HGCW013
>
hgcw013List
=
HGCWTools
.
HgCw013
.
mapToList
(
resultRows
,
NumberUtils
.
toLong
(
mainId
));
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#.000"
);
if
(
CollectionUtils
.
isNotEmpty
(
hgcw013List
))
{
if
(
StringUtils
.
isEmpty
(
mainId
))
{
//先生成主表
HGCW012
hgcw012
=
new
HGCW012
();
UserVO
userVO
=
HGCWTools
.
HgCw002
.
getUserCompany
();
hgcw012
.
setCompanyCode
(
userVO
.
getUsercode
());
hgcw012
.
setCompanyName
(
userVO
.
getUsername
());
hgcw012
.
setReviewStatus
(
0
);
hgcw012
.
setBillState
(
1
);
hgcw012
.
setSigningDate
(
DateUtils
.
shortDate
());
BigDecimal
totalContractPriceIncluding
=
BigDecimal
.
ZERO
;
BigDecimal
totalContractPriceIncluding
=
BigDecimal
.
ZERO
;
StringBuffer
contractNumber
=
new
StringBuffer
();
StringBuffer
settlementNumber
=
new
StringBuffer
();
Map
<
String
,
BigDecimal
>
rowMap
=
new
HashMap
<>();
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
totalContractPriceIncluding
=
totalContractPriceIncluding
.
add
(
hgcw013
.
getTotalContractPriceIncluding
());
settlementNumber
.
append
(
hgcw013
.
getSettlementNumber
()).
append
(
","
);
}
for
(
Map
m
:
resultRows
)
{
String
c
=
m
.
get
(
"settlementNumber"
).
toString
();
BigDecimal
remainingAmount
=
new
BigDecimal
(
m
.
get
(
"thisAmount"
).
toString
());
rowMap
.
put
(
c
,
remainingAmount
);
totalContractPriceIncluding
=
totalContractPriceIncluding
.
add
(
remainingAmount
);
}
hgcw012
.
setTotalContractPriceIncluding
(
new
BigDecimal
(
decimalFormat
.
format
(
totalContractPriceIncluding
)));
hgcw012
.
setPartyA
(
hgcw013List
.
get
(
0
).
getPartyA
());
hgcw012
.
setTaxPoints
(
hgcw013List
.
get
(
0
).
getTaxPoints
());
hgcw012
.
setThisSettlementTax
(
hgcw013List
.
get
(
0
).
getThisSettlementTax
());
hgcw012
.
setThisSettlementAmount
(
hgcw013List
.
get
(
0
).
getThisSettlementAmount
());
hgcw012
.
setBillNumber
(
hgcw013List
.
get
(
0
).
getBillNumber
());
hgcw012
.
setSettlementNumber
(
settlementNumber
.
toString
().
substring
(
0
,
settlementNumber
.
length
()
-
1
));
hgcw012
.
setRemainingAmount
(
new
BigDecimal
(
decimalFormat
.
format
(
totalContractPriceIncluding
)));
this
.
add
(
hgcw012
);
//生成明细表
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
hgcw013
.
setMainId
(
hgcw012
.
getId
());
hgcw013
.
setId
(
null
);
// 反写金额
HGCWTools
.
HgCw008
.
deductionAmount
(
hgcw013
.
getSettlementNumber
(),
rowMap
.
get
(
hgcw013
.
getSettlementNumber
()));
DaoUtils
.
insert
(
HGCW013
.
INSERT
,
hgcw013
);
}
}
HGCW012
.
setTotalContractPriceIncluding
(
new
BigDecimal
(
decimalFormat
.
format
(
totalContractPriceIncluding
)));
}
else
{
HGCW012
hgcw012
=
HGCWTools
.
HgCw012
.
getId
(
mainId
);
Map
<
String
,
BigDecimal
>
rowMap
=
new
HashMap
<>();
this
.
modify
(
HGCW012
);
for
(
Map
m
:
resultRows
)
{
String
c
=
m
.
get
(
"settlementNumber"
).
toString
();
BigDecimal
remainingAmount
=
new
BigDecimal
(
m
.
get
(
"thisAmount"
).
toString
());
rowMap
.
put
(
c
,
remainingAmount
);
}
// 生成明细表
// 生成明细表
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
hgcw013
.
setMainId
(
HGCW012
.
getId
());
hgcw013
.
setMainId
(
hgcw012
.
getId
());
DaoUtils
.
insert
(
HGCW013
.
INSERT
,
hgcw013
);
}
}
}
List
<
HGCW013
>
hgcw013s
=
HGCWTools
.
HgCw013
.
getMainId
(
hgcw012
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
hgcw013s
))
{
// 更新主表
BigDecimal
totalContractPriceIncluding
=
BigDecimal
.
ZERO
;
StringBuffer
settlementNumber
=
new
StringBuffer
();
for
(
HGCW013
hgcw013
:
hgcw013s
)
{
totalContractPriceIncluding
=
totalContractPriceIncluding
.
add
(
hgcw013
.
getTotalContractPriceIncluding
());
settlementNumber
.
append
(
hgcw013
.
getSettlementNumber
()).
append
(
","
);
}
hgcw012
.
setTotalContractPriceIncluding
(
totalContractPriceIncluding
);
hgcw012
.
setPartyA
(
hgcw013s
.
get
(
0
).
getPartyA
());
hgcw012
.
setTaxPoints
(
hgcw013List
.
get
(
0
).
getTaxPoints
());
hgcw012
.
setThisSettlementTax
(
hgcw013List
.
get
(
0
).
getThisSettlementTax
());
hgcw012
.
setThisSettlementAmount
(
hgcw013List
.
get
(
0
).
getThisSettlementAmount
());
hgcw012
.
setBillNumber
(
hgcw013List
.
get
(
0
).
getBillNumber
());
hgcw012
.
setSettlementNumber
(
settlementNumber
.
toString
().
substring
(
0
,
settlementNumber
.
length
()
-
1
));
this
.
modify
(
hgcw012
);
}
}
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据生成成功!"
);
}
}
}
catch
(
Exception
e
)
{
}
LogUtils
.
setMsg
(
inInfo
,
e
,
"生成采购收票失败"
);
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"生成收款单失败"
);
}
}
return
inInfo
;
return
inInfo
;
}
}
public
EiInfo
selectb
(
EiInfo
inInfo
)
{
try
{
List
<
Map
>
resultRows
=
inInfo
.
getBlock
(
"resultB"
).
getRows
();
List
<
Map
>
queryRows
=
inInfo
.
getBlock
(
EiConstant
.
queryBlock
).
getRows
();
String
mainId
=
""
;
if
(
CollectionUtils
.
isNotEmpty
(
queryRows
))
{
mainId
=
queryRows
.
get
(
0
).
get
(
"mainId"
).
toString
();
}
//获取相应的数据
List
<
HGCW013
>
hgcw013List
=
HGCWTools
.
HgCw013
.
mapToList
(
resultRows
,
NumberUtils
.
toLong
(
mainId
));
DecimalFormat
decimalFormat
=
new
DecimalFormat
(
"#.000"
);
if
(
CollectionUtils
.
isNotEmpty
(
hgcw013List
))
{
if
(
StringUtils
.
isEmpty
(
mainId
))
{
//先生成主表
HGCW012
hgcw012
=
new
HGCW012
();
UserVO
userVO
=
HGCWTools
.
HgCw002
.
getUserCompany
();
hgcw012
.
setCompanyCode
(
userVO
.
getUsercode
());
hgcw012
.
setCompanyName
(
userVO
.
getUsername
());
hgcw012
.
setReviewStatus
(
0
);
hgcw012
.
setBillState
(
1
);
hgcw012
.
setSigningDate
(
DateUtils
.
shortDate
());
BigDecimal
totalContractPriceIncluding
=
BigDecimal
.
ZERO
;
StringBuffer
settlementNumber
=
new
StringBuffer
();
Map
<
String
,
BigDecimal
>
rowMap
=
new
HashMap
<>();
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
settlementNumber
.
append
(
hgcw013
.
getSettlementNumber
()).
append
(
","
);
}
for
(
Map
m
:
resultRows
)
{
String
c
=
m
.
get
(
"settlementNumber"
).
toString
();
BigDecimal
remainingAmount
=
new
BigDecimal
(
m
.
get
(
"thisAmount"
).
toString
());
rowMap
.
put
(
c
,
remainingAmount
);
totalContractPriceIncluding
=
totalContractPriceIncluding
.
add
(
remainingAmount
);
}
hgcw012
.
setTotalContractPriceIncluding
(
new
BigDecimal
(
decimalFormat
.
format
(
totalContractPriceIncluding
)));
hgcw012
.
setPartyA
(
hgcw013List
.
get
(
0
).
getPartyA
());
hgcw012
.
setTaxPoints
(
hgcw013List
.
get
(
0
).
getTaxPoints
());
hgcw012
.
setThisSettlementTax
(
hgcw013List
.
get
(
0
).
getThisSettlementTax
());
hgcw012
.
setThisSettlementAmount
(
hgcw013List
.
get
(
0
).
getThisSettlementAmount
());
hgcw012
.
setBillNumber
(
hgcw013List
.
get
(
0
).
getBillNumber
());
hgcw012
.
setSettlementNumber
(
settlementNumber
.
toString
().
substring
(
0
,
settlementNumber
.
length
()
-
1
));
hgcw012
.
setRemainingAmount
(
new
BigDecimal
(
decimalFormat
.
format
(
totalContractPriceIncluding
)));
this
.
add
(
hgcw012
);
//生成明细表
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
hgcw013
.
setMainId
(
hgcw012
.
getId
());
hgcw013
.
setId
(
null
);
}
}
else
{
HGCW012
hgcw012
=
HGCWTools
.
HgCw012
.
getId
(
mainId
);
Map
<
String
,
BigDecimal
>
rowMap
=
new
HashMap
<>();
for
(
Map
m
:
resultRows
)
{
String
c
=
m
.
get
(
"settlementNumber"
).
toString
();
BigDecimal
remainingAmount
=
new
BigDecimal
(
m
.
get
(
"thisAmount"
).
toString
());
rowMap
.
put
(
c
,
remainingAmount
);
}
// 生成明细表
for
(
HGCW013
hgcw013
:
hgcw013List
)
{
hgcw013
.
setMainId
(
hgcw012
.
getId
());
// 反写金额
HGCWTools
.
HgCw008
.
deductionAmount
(
hgcw013
.
getSettlementNumber
(),
rowMap
.
get
(
hgcw013
.
getSettlementNumber
()));
this
.
addHGCW013
(
hgcw013
);
}
List
<
HGCW013
>
hgcw013s
=
HGCWTools
.
HgCw013
.
getMainId
(
hgcw012
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
hgcw013s
))
{
// 更新主表
BigDecimal
totalContractPriceIncluding
=
BigDecimal
.
ZERO
;
StringBuffer
settlementNumber
=
new
StringBuffer
();
for
(
HGCW013
hgcw013
:
hgcw013s
)
{
totalContractPriceIncluding
=
totalContractPriceIncluding
.
add
(
hgcw013
.
getTotalContractPriceIncluding
());
settlementNumber
.
append
(
hgcw013
.
getSettlementNumber
()).
append
(
","
);
}
hgcw012
.
setTotalContractPriceIncluding
(
totalContractPriceIncluding
);
hgcw012
.
setPartyA
(
hgcw013s
.
get
(
0
).
getPartyA
());
hgcw012
.
setTaxPoints
(
hgcw013List
.
get
(
0
).
getTaxPoints
());
hgcw012
.
setThisSettlementTax
(
hgcw013List
.
get
(
0
).
getThisSettlementTax
());
hgcw012
.
setThisSettlementAmount
(
hgcw013List
.
get
(
0
).
getThisSettlementAmount
());
hgcw012
.
setBillNumber
(
hgcw013List
.
get
(
0
).
getBillNumber
());
hgcw012
.
setSettlementNumber
(
settlementNumber
.
toString
().
substring
(
0
,
settlementNumber
.
length
()
-
1
));
this
.
modify
(
hgcw012
);
}
}
inInfo
.
setMsg
(
"操作成功!本次对["
+
resultRows
.
size
()
+
"]条数据生成成功!"
);
}
}
catch
(
Exception
e
)
{
LogUtils
.
setMsg
(
inInfo
,
e
,
"生成收款单失败"
);
}
return
inInfo
;
}
public
void
addHGCW013
(
HGCW013
HGCW013
)
{
DaoUtils
.
insert
(
"HGCW013.insert"
,
HGCW013
);
}
/**
/**
* 提交操作
* 提交操作
* @param inInfo
* @param inInfo
...
...
src/main/java/com/baosight/hggp/hg/cw/tools/HGCWTools.java
View file @
dcc48924
...
@@ -441,6 +441,22 @@ public class HGCWTools {
...
@@ -441,6 +441,22 @@ public class HGCWTools {
return
results
.
get
(
0
);
return
results
.
get
(
0
);
}
}
public
static
void
updateAmount
(
Long
id
)
{
AssertUtils
.
isNull
(
id
,
"采购收票单ID不能为空!"
);
HGCW012
HGCW012
=
HGCWTools
.
HgCw012
.
getId
(
id
.
toString
());
List
<
HGCW013
>
HGCW013s
=
HGCWTools
.
HgCw013
.
getMainId
(
HGCW012
.
getId
());
if
(
CollectionUtils
.
isNotEmpty
(
HGCW013s
))
{
// 更新主表
BigDecimal
totalContractPriceIncluding
=
BigDecimal
.
ZERO
;
StringBuffer
contractNumber
=
new
StringBuffer
();
for
(
HGCW013
HGCW013
:
HGCW013s
)
{
totalContractPriceIncluding
=
totalContractPriceIncluding
.
add
(
HGCW013
.
getTotalContractPriceIncluding
());
}
HGCW012
.
setTotalContractPriceIncluding
(
totalContractPriceIncluding
);
HGCW012
.
setPartyA
(
HGCW013s
.
get
(
0
).
getPartyA
());
DaoUtils
.
update
(
"HGCW012.update"
,
HGCW012
);
}
}
public
static
void
cutAmount
(
String
settlementNumber
,
BigDecimal
cutAmount
)
{
public
static
void
cutAmount
(
String
settlementNumber
,
BigDecimal
cutAmount
)
{
AssertUtils
.
isNull
(
settlementNumber
,
"来源单号不能为空!"
);
AssertUtils
.
isNull
(
settlementNumber
,
"来源单号不能为空!"
);
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
// if (cutAmount.compareTo(new BigDecimal(BigInteger.ZERO)) <= 0) {
...
@@ -462,7 +478,6 @@ public class HGCWTools {
...
@@ -462,7 +478,6 @@ public class HGCWTools {
DaoUtils
.
update
(
"HGCW012.updateDeductionAmount"
,
HGCW012
);
DaoUtils
.
update
(
"HGCW012.updateDeductionAmount"
,
HGCW012
);
}
}
public
static
List
<
HGCW012
>
checkList
(
Map
paramMap
)
{
public
static
List
<
HGCW012
>
checkList
(
Map
paramMap
)
{
AssertUtils
.
isEmpty
(
paramMap
,
"数据检查参数不能为空"
);
AssertUtils
.
isEmpty
(
paramMap
,
"数据检查参数不能为空"
);
return
DaoBase
.
getInstance
().
query
(
"HGCW012.queryCheckList"
,
paramMap
);
return
DaoBase
.
getInstance
().
query
(
"HGCW012.queryCheckList"
,
paramMap
);
...
@@ -486,7 +501,6 @@ public class HGCWTools {
...
@@ -486,7 +501,6 @@ public class HGCWTools {
* 采购收票明细清单
* 采购收票明细清单
*/
*/
public
static
class
HgCw013
{
public
static
class
HgCw013
{
public
static
HGCW013
getId
(
Long
id
)
{
public
static
HGCW013
getId
(
Long
id
)
{
AssertUtils
.
isNull
(
id
,
"销售开票单ID不能为空!"
);
AssertUtils
.
isNull
(
id
,
"销售开票单ID不能为空!"
);
List
<
HGCW013
>
results
=
DaoBase
.
getInstance
().
query
(
HGCW013
.
QUERY
,
new
HashMap
<
String
,
Object
>(){
List
<
HGCW013
>
results
=
DaoBase
.
getInstance
().
query
(
HGCW013
.
QUERY
,
new
HashMap
<
String
,
Object
>(){
...
@@ -496,22 +510,29 @@ public class HGCWTools {
...
@@ -496,22 +510,29 @@ public class HGCWTools {
}
}
public
static
List
<
HGCW013
>
mapToList
(
List
<
Map
>
rows
,
Long
mainId
)
{
public
static
List
<
HGCW013
>
mapToList
(
List
<
Map
>
rows
,
Long
mainId
)
{
List
<
HGCW013
>
hgcw
013List
=
new
ArrayList
<>();
List
<
HGCW013
>
HGCW
013List
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
rows
))
{
if
(
CollectionUtils
.
isNotEmpty
(
rows
))
{
rows
.
forEach
(
row
->
{
rows
.
forEach
(
row
->
{
HGCW013
hgcw
013
=
new
HGCW013
();
HGCW013
HGCW
013
=
new
HGCW013
();
hgcw
013
.
fromMap
(
row
);
HGCW
013
.
fromMap
(
row
);
String
settlementNumber
=
row
.
get
(
"settlementNumber"
).
toString
();
String
settlementNumber
=
row
.
get
(
"settlementNumber"
).
toString
();
String
remainingAmount
=
row
.
get
(
"thisSettlementAmount"
).
toString
();
String
remainingAmount
=
row
.
get
(
"thisAmount"
).
toString
();
hgcw013
.
setTotalContractPriceIncluding
(
new
BigDecimal
(
remainingAmount
));
BigDecimal
taxPoints
=
new
BigDecimal
(
row
.
get
(
"taxPoints"
).
toString
());
// 假设这是以整数形式给出的税率,比如17表示17%
hgcw013
.
setSettlementNumber
(
settlementNumber
);
BigDecimal
thisAmount
=
new
BigDecimal
(
row
.
get
(
"thisAmount"
).
toString
());
BigDecimal
taxRateAsDecimal
=
taxPoints
.
divide
(
new
BigDecimal
(
"100"
)).
add
(
new
BigDecimal
(
"1"
));
// 将税率转换为小数形式
BigDecimal
thisSettlementAmount
=
thisAmount
.
divide
(
taxRateAsDecimal
,
2
,
RoundingMode
.
HALF_UP
);
BigDecimal
thisSettlementTax
=
thisAmount
.
subtract
(
thisSettlementAmount
);
// 计算税额
HGCW013
.
setTotalContractPriceIncluding
(
new
BigDecimal
(
remainingAmount
));
HGCW013
.
setSettlementNumber
(
settlementNumber
);
HGCW013
.
setThisSettlementTax
(
thisSettlementTax
.
toString
());
HGCW013
.
setThisSettlementAmount
(
thisSettlementAmount
.
toString
());
if
(
mainId
!=
null
)
{
if
(
mainId
!=
null
)
{
hgcw
013
.
setMainId
(
mainId
);
HGCW
013
.
setMainId
(
mainId
);
}
}
hgcw013List
.
add
(
hgcw
013
);
HGCW013List
.
add
(
HGCW
013
);
});
});
}
}
return
hgcw
013List
;
return
HGCW
013List
;
}
}
public
static
List
<
HGCW013
>
getMainId
(
Long
mainId
)
{
public
static
List
<
HGCW013
>
getMainId
(
Long
mainId
)
{
...
@@ -521,6 +542,8 @@ public class HGCWTools {
...
@@ -521,6 +542,8 @@ public class HGCWTools {
});
});
return
results
;
return
results
;
}
}
}
}
public
static
class
HgCw014
{
public
static
class
HgCw014
{
...
...
src/main/webapp/HG/CW/HGCW012A.js
View file @
dcc48924
...
@@ -46,39 +46,43 @@ function cancelFunc() {
...
@@ -46,39 +46,43 @@ function cancelFunc() {
}
}
function
btnSaveFunc
(
btnNode
,
gridNode
)
{
function
btnSaveFunc
(
btnNode
,
gridNode
)
{
let
nobe
=
''
;
let
buld
=
''
;
let
rows
;
let
rows
;
if
(
gridNode
==
"result"
)
{
if
(
gridNode
==
"result"
)
{
rows
=
resultGrid
.
getCheckedRows
();
rows
=
resultGrid
.
getCheckedRows
();
nobe
=
"HGCW012"
;
buld
=
"selecta"
;
}
else
if
(
gridNode
==
"resultA"
)
{
}
else
if
(
gridNode
==
"resultA"
)
{
rows
=
resultAGrid
.
getCheckedRows
();
rows
=
resultAGrid
.
getCheckedRows
();
nobe
=
"HGCW012"
;
buld
=
"select"
;
}
else
if
(
gridNode
==
"resultB"
)
{
}
else
if
(
gridNode
==
"resultB"
)
{
rows
=
resultBGrid
.
getCheckedRows
();
rows
=
resultBGrid
.
getCheckedRows
();
nobe
=
"HGCW012"
;
buld
=
"selectb"
;
}
}
if
(
rows
.
length
<
1
)
{
if
(
rows
.
length
<
1
)
{
message
(
"请选择数据"
)
message
(
"请选择数据"
)
return
;
return
;
}
}
let
flag
=
true
;
let
flag
=
true
;
if
(
gridNode
==
'resultA'
){
$
.
each
(
rows
,
function
(
index
,
item
)
{
$
.
each
(
rows
,
function
(
index
,
item
)
{
let
thisAmount
=
item
[
'this
Settlement
Amount'
];
let
thisAmount
=
item
[
'thisAmount'
];
let
remainingAmount
=
item
[
'remainingAmount'
];
let
remainingAmount
=
item
[
'remainingAmount'
];
let
billNumber
=
item
[
'billNumber'
];
if
(
!
isNumber
(
thisAmount
)
&&
!
isPositiveNumber
(
thisAmount
))
{
if
(
!
isNumber
(
thisAmount
)
&&
!
isPositiveNumber
(
thisAmount
))
{
message
(
"勾选的第"
+
(
index
+
1
)
+
"行本次
开
票金额必须是大于0的数字"
);
message
(
"勾选的第"
+
(
index
+
1
)
+
"行本次
收
票金额必须是大于0的数字"
);
flag
=
false
;
flag
=
false
;
return
false
;
return
false
;
}
}
if
(
parseFloat
(
thisAmount
)
>
parseFloat
(
remainingAmount
))
{
if
(
parseFloat
(
thisAmount
)
>
parseFloat
(
remainingAmount
))
{
message
(
"第"
+
(
index
+
1
)
+
"行本次开票金额不能大于剩余开票金额"
);
message
(
"第"
+
(
index
+
1
)
+
"行本次收票金额不能大于剩余收票金额"
);
flag
=
false
;
return
false
;
}
if
(
isBlank
(
billNumber
))
{
message
(
"第"
+
(
index
+
1
)
+
"行发票号不能为空,请填写发票号"
);
flag
=
false
;
flag
=
false
;
return
false
;
return
false
;
}
}
});
})
}
;
if
(
flag
){
if
(
flag
){
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据生成票据吗?"
,
{
JSUtils
.
confirm
(
"确定对勾选中的["
+
rows
.
length
+
"]条数据生成票据吗?"
,
{
ok
:
function
()
{
ok
:
function
()
{
...
@@ -86,7 +90,7 @@ function btnSaveFunc(btnNode, gridNode) {
...
@@ -86,7 +90,7 @@ function btnSaveFunc(btnNode, gridNode) {
info
.
addBlock
(
JSUtils
.
checkedRows2Block
(
gridNode
));
info
.
addBlock
(
JSUtils
.
checkedRows2Block
(
gridNode
));
info
.
set
(
"inqu_status-0-type"
,
gridNode
);
info
.
set
(
"inqu_status-0-type"
,
gridNode
);
info
.
set
(
"inqu_status-0-mainId"
,
$
(
"#inqu_status-0-mainId"
).
val
());
info
.
set
(
"inqu_status-0-mainId"
,
$
(
"#inqu_status-0-mainId"
).
val
());
EiCommunicator
.
send
(
"HGCW012"
,
"select"
,
info
,
{
EiCommunicator
.
send
(
nobe
,
buld
,
info
,
{
onSuccess
:
function
(
ei
)
{
onSuccess
:
function
(
ei
)
{
if
(
ei
.
getStatus
()
>=
0
)
{
if
(
ei
.
getStatus
()
>=
0
)
{
try
{
try
{
...
@@ -256,31 +260,31 @@ $(function () {
...
@@ -256,31 +260,31 @@ $(function () {
{
{
field
:
"thisPriceTax"
,
field
:
"thisPriceTax"
,
title
:
"收款价税合计金额"
,
title
:
"收款价税合计金额"
,
headerTemplate
:
"<span style='color: '>
结算
价税合计金额 </span>"
,
headerTemplate
:
"<span style='color: '>
收款
价税合计金额 </span>"
,
locked
:
false
locked
:
false
},
},
{
{
field
:
"thisSettlementTax"
,
field
:
"thisSettlementTax"
,
title
:
"收款税金"
,
title
:
"收款税金"
,
headerTemplate
:
"<span style='color: '>
结算
税金 </span>"
,
headerTemplate
:
"<span style='color: '>
收款
税金 </span>"
,
locked
:
false
locked
:
false
},
},
{
{
field
:
"thisSettlementAmount"
,
field
:
"thisSettlementAmount"
,
title
:
"收款金额"
,
title
:
"收款金额"
,
headerTemplate
:
"<span style='color: '>
结算税金
</span>"
,
headerTemplate
:
"<span style='color: '>
收款金额
</span>"
,
locked
:
false
locked
:
false
},
},
{
{
field
:
"thisAmount"
,
field
:
"thisAmount"
,
title
:
"本次收款金额"
,
title
:
"本次收款金额"
,
headerTemplate
:
"<span style='color: '>
结算税金
</span>"
,
headerTemplate
:
"<span style='color: '>
本次收款金额
</span>"
,
locked
:
false
locked
:
false
},
},
{
{
field
:
"remainingAmount"
,
field
:
"remainingAmount"
,
title
:
"剩余收款金额"
,
title
:
"剩余收款金额"
,
headerTemplate
:
"<span style='color: '>
结算税金
</span>"
,
headerTemplate
:
"<span style='color: '>
剩余收款金额
</span>"
,
locked
:
false
locked
:
false
}],
}],
loadComplete
:
function
(
grid
)
{
loadComplete
:
function
(
grid
)
{
...
@@ -342,26 +346,26 @@ $(function () {
...
@@ -342,26 +346,26 @@ $(function () {
locked
:
false
locked
:
false
},
},
{
{
field
:
"totalContractPrice
Ex
cluding"
,
field
:
"totalContractPrice
In
cluding"
,
title
:
"收款价税合计金额"
,
title
:
"收款价税合计金额"
,
headerTemplate
:
"<span style='color: '>
结算
价税合计金额 </span>"
,
headerTemplate
:
"<span style='color: '>
收款
价税合计金额 </span>"
,
locked
:
false
locked
:
false
},
},
{
{
field
:
"valueAddedTax"
,
field
:
"valueAddedTax"
,
title
:
"收款税金"
,
title
:
"收款税金"
,
headerTemplate
:
"<span style='color: '>
结算
税金 </span>"
,
headerTemplate
:
"<span style='color: '>
收款
税金 </span>"
,
locked
:
false
locked
:
false
},
},
{
{
field
:
"totalContractPriceExcluding"
,
field
:
"totalContractPriceExcluding"
,
title
:
"收款金额"
,
title
:
"收款金额"
,
headerTemplate
:
"<span style='color: '>
结算
金额 </span>"
,
headerTemplate
:
"<span style='color: '>
收款
金额 </span>"
,
locked
:
false
locked
:
false
},{
},{
field
:
"thisAmount"
,
field
:
"thisAmount"
,
title
:
"本次收款金额"
,
title
:
"本次收款金额"
,
headerTemplate
:
"<span style='color: '>
剩余付
款金额 </span>"
,
headerTemplate
:
"<span style='color: '>
本次收
款金额 </span>"
,
locked
:
false
locked
:
false
}],
}],
loadComplete
:
function
(
grid
)
{
loadComplete
:
function
(
grid
)
{
...
...
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