Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
T
topsun-bpm
Project
Project
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
鲁鑫
topsun-bpm
Commits
023ce088
Commit
023ce088
authored
Feb 21, 2025
by
1650842865
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
外发单打印格式调整
parent
d4659581
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
406 additions
and
162 deletions
+406
-162
processOuter2.ftl
...t/src/main/webapp/template/print/topsun/processOuter2.ftl
+242
-0
SapPurchaseOrderApplicationImpl.java
...der/application/impl/SapPurchaseOrderApplicationImpl.java
+164
-162
No files found.
topsun-xt/src/main/webapp/template/print/topsun/processOuter2.ftl
0 → 100644
View file @
023ce088
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<head>
<title>
外发加工单
</title>
<
#
include
"/
print
/
commonStyleTemplate
.
ftl
"
/>
<style
type=
"text/css"
>
td
{
font-size
:
12px
;
}
</style>
</head>
<body>
<!-- 页眉部分 -->
<div
style=
"font-size: 20px;text-align: center; margin-top: 0px"
>
广州市宝绅科技应用有限公司
</div>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tablePrint"
>
<colgroup>
<col
width=
"40%"
/>
<col
width=
"10%"
/>
<col
width=
"40%"
/>
</colgroup>
<tr>
<td
class=
"right"
>
电 话:020-36201957/020-36343128
</td>
<td>
</td>
<td
class=
"left"
>
地 址:广州市白云区江高小塘南路68号
</td>
</tr>
</table>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tablePrint"
>
<colgroup>
<col
width=
'100%'
/>
<
#
--
<
col
width=
"40%"
/>
-->
</colgroup>
<tr>
<td
style=
"font-size: 20px;text-align: center;margin-top: 0.5cm"
>
外发单
</td>
<
#
--
<
td
class=
"right"
>
-->
<
#
--
<
img
class=
"barcode"
src=
"${barCode}"
style=
"right: auto"
></img>
-->
<
#
--
</
td
>
-->
</tr>
</table>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
<colgroup>
<col
width=
'8%'
/>
<col
width=
'42%'
/>
<col
width=
"9%"
/>
<col
width=
"41%"
/>
</colgroup>
<tr>
<td
class=
"left"
>
加工商
</td>
<td
class=
"left"
>
${namel?default("")?html}
</td>
<td
class=
"left"
>
加工商
<br/>
地址
</td>
<td
class=
"left"
>
${address?default("")?html}
</td>
</tr>
</table>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
<colgroup>
<col
width=
'8%'
/>
<col
width=
'34%'
/>
<col
width=
"8%"
/>
<col
width=
"9%"
/>
<col
width=
"8%"
/>
<col
width=
"9%"
/>
<col
width=
"9%"
/>
<col
width=
"15%"
/>
</colgroup>
<tr>
<td
class=
"left"
>
外发单号
</td>
<td
class=
"left"
>
${ebeln?default("")?html}
</td>
<td
class=
"left"
>
外发日期
</td>
<td
class=
"left"
><
@
formatDate
date=
fillinDate/
></td>
<td
class=
"left"
>
交货日期
</td>
<td
class=
"left"
><
@
formatDate
date=
eindt/
></td>
<td
class=
"left"
>
联系人电话
</td>
<td
class=
"left"
>
${telf1?default("")?html}
</td>
</tr>
</table>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
<colgroup>
<col
width=
'8%'
/>
<col
width=
'68%'
/>
<col
width=
"9%"
/>
<col
width=
"15%"
/>
</colgroup>
<tr>
<td
class=
"left"
>
交货地点
</td>
<td
class=
"left"
>
${strSuppl?default("")?html}
</td>
<td
class=
"left"
>
仓库
</td>
<td
class=
"left"
>
${lgobe?default("")?html}
</td>
</tr>
</table>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
<colgroup>
<col
width=
'8%'
/>
<col
width=
"92%"
/>
</colgroup>
<tr>
<td
class=
"center"
>
备注1
</td>
<td
class=
"left"
style=
"height: 80px"
>
${headText1?default("")?html}
</td>
</tr>
</table>
<
#
if
materialList
??
&&
materialList
?
size
gt
0
>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
<colgroup>
<col
width=
'5%'
/>
<col
width=
'10%'
/>
<col
width=
'25%'
/>
<col
width=
'5%'
/>
<col
width=
'7%'
/>
<col
width=
'7%'
/>
<col
width=
'7%'
/>
<col
width=
'5%'
/>
<col
width=
'5%'
/>
<col
width=
'9%'
/>
<col
width=
'5%'
/>
<col
width=
'10%'
/>
</colgroup>
<tr>
<td
class=
"center"
>
项次
</td>
<td
class=
"center"
>
产品编码
</td>
<td
class=
"center"
>
产品名称
</td>
<td
class=
"center"
>
单位
</td>
<td
class=
"center"
>
数量
</td>
<td
class=
"center"
>
LOSS数
</td>
<td
class=
"center"
>
单价
</td>
<td
class=
"center"
>
运输费用
</td>
<td
class=
"center"
>
包装费用
</td>
<td
class=
"center"
>
总金额
</td>
<td
class=
"center"
>
外发工序
</td>
<td
class=
"center"
>
备注
</td>
</tr>
<
#
list
materialList
as
detail
>
<tr>
<td
class=
"center"
>
${detail.no?default("")?html}
</td>
<td
class=
"center"
>
${detail.matnr2?default("")?html}
</td>
<td
class=
"center"
>
${detail.maktx?default("")?html}
</td>
<td
class=
"center"
>
${detail.msehl?default("")?html}
</td>
<td
class=
"center"
>
${detail.number?default("")?html}
</td>
<td
class=
"center"
>
${detail.loss?default("")?html}
</td>
<td
class=
"center"
>
${detail.netpr?default("")?html}
</td>
<td
class=
"center"
>
${detail.kbetr2?default("")?html}
</td>
<td
class=
"center"
>
${detail.kbetr3?default("")?html}
</td>
<td
class=
"center"
>
${detail.amount?default("")?html}
</td>
<td
class=
"center"
>
${detail.outProcess01?default("")?html}
</td>
<td
class=
"center"
>
${detail.remark?default("")?html}
</td>
</tr>
</
#
list>
</table>
<
#
else
>
</
#
if>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
<colgroup>
<col
width=
'8%'
/>
<col
width=
'92%'
/>
</colgroup>
<tr>
<td
class=
"center"
>
生产制程
</td>
<td
class=
"left"
>
${productionProcess?default("")?html}
</td>
</tr>
</table>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
<colgroup>
<col
width=
'8%'
/>
<col
width=
"92%"
/>
</colgroup>
<tr>
<td
class=
"center"
>
备注2
</td>
<td
class=
"left"
style=
"height: 80px"
>
${headText?default("")?html}
</td>
</tr>
</table>
<
#
if
productInfoVoList
??
&&
productInfoVoList
?
size
gt
0
>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
<colgroup>
<col
width=
'50%'
/>
<col
width=
'50%'
/>
</colgroup>
<tr>
<td
class=
"left"
>
产品正面图片:
</td>
<td
class=
"left"
>
产品背面图片:
</td>
</tr>
<
#
list
productInfoVoList
as
detail
>
<tr>
<td
class=
"center"
>
<img
src=
'${detail.frontImg?default("")?html}'
width=
"230px"
/>
</td>
<td
class=
"center"
>
<img
src=
'${detail.backImg?default("")?html}'
width=
"230px"
/>
</td>
</tr>
</
#
list>
</table>
<
#
else
>
</
#
if>
<
#
--
<
table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
-->
<
#
--
<
colgroup
>
-->
<
#
--
<
col
width=
'50%'
/>
-->
<
#
--
<
col
width=
"50%"
/>
-->
<
#
--
</
colgroup
>
-->
<
#
--
<
tr
>
-->
<
#
--
<
td
class=
"left"
>
产品正面图片:-->
<
#
--
<
br
/>
-->
<
#
--
<
img
src=
'${frontImg?default("")?html}'
width=
"230px"
/>
-->
<
#
--
</
td
>
-->
<
#
--
<
td
class=
"left"
>
产品背面图片:-->
<
#
--
<
br
/>
-->
<
#
--
<
img
src=
'${backImg?default("")?html}'
width=
"230px"
/>
-->
<
#
--
</
td
>
-->
<
#
--
</
tr
>
-->
<
#
--
</
table
>
-->
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tableBorder"
>
<colgroup>
<col
width=
'100%'
/>
</colgroup>
<tr>
<td
class=
"left"
>
付款方式:${zwels?default("")?html}
<br/>
月结方式:${zterm?default("")?html}
<br/>
注意事项:整张订单结束后方可请款,送货和付款时请附上此单。收到订单请2小时内签回。周六,日不收货。周一至周五17:00下班。
</td>
</tr>
</table>
<table
cellspacing=
"0px"
cellpadding=
"0px"
class=
"tablePrint"
>
<colgroup>
<col
width=
'33%'
/>
<col
width=
"33%"
/>
<col
width=
"33%"
/>
</colgroup>
<tr>
<td
class=
"left"
>
加工商回签:
</td>
<td
class=
"left"
>
核准:
</td>
<td
class=
"left"
>
采购员:${personMemberName?default("")?html}
</td>
</tr>
</table>
</body>
</html>
topsun/src/main/java/com/huigou/topsun/sap/purchaseOrder/application/impl/SapPurchaseOrderApplicationImpl.java
View file @
023ce088
...
...
@@ -450,54 +450,26 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
//获取加工商信息
String
lifnr
=
sapPurchaseOrder
.
getLifnr
();
map
=
this
.
getSupplierInfo
(
map
,
lifnr
);
//获取销售订单信息
map
=
this
.
getSaleOrderInfo
(
map
,
sapPurchaseOrder
.
getId
());
//获取产品信息
map
=
this
.
getProductInfo
(
map
);
//成品外购
map
.
put
(
"page"
,
"/print/topsun/productProcessOuter.ftl"
);
//map = this.getProductInfo(map);
//map.put("page","/print/topsun/productProcessOuter.ftl");
List
<
SapPurchaseOrderItem
>
purchaseOrderItems
=
this
.
sapPurchaseOrderItemApplication
.
getPurchaseOrderItems
(
sapPurchaseOrder
.
getId
());
map
.
put
(
"eindt"
,
purchaseOrderItems
.
get
(
0
).
getEindt
());
//交货时间
map
.
put
(
"telf1"
,
purchaseOrderItems
.
get
(
0
).
getTelf1
());
//联系电话
map
.
put
(
"lgobe"
,
purchaseOrderItems
.
get
(
0
).
getLgobe
());
//仓库
map
.
put
(
"strSuppl"
,
purchaseOrderItems
.
get
(
0
).
getStrSuppl
());
//交货地点
//订单类型是ZNB3时对应工序外发(临时工序外协)
if
(
"ZNB3"
.
equals
(
sapPurchaseOrder
.
getBsart
())){
map
=
this
.
getProcessOutInfo
(
map
);
//工序外协
map
.
put
(
"page"
,
"/print/topsun/processOuter.ftl"
);
}
return
map
;
}
@Override
public
void
updateProcessOutStatus
(
List
<
String
>
ids
)
{
List
<
SapPurchaseOrder
>
orderList
=
sapPurchaseOrderRepository
.
findAll
(
ids
);
for
(
SapPurchaseOrder
sapPurchaseOrder
:
orderList
)
{
sapPurchaseOrder
.
setSendOut
(
"1"
);
}
sapPurchaseOrderRepository
.
save
(
orderList
);
}
@Override
public
void
abortPurchaseOrder
(
String
id
,
String
jobPageId
)
{
//先标记终止状态
SapPurchaseOrder
purchaseOrder
=
sapPurchaseOrderRepository
.
findOne
(
id
);
List
<
SapMutualEpLog
>
logList
=
sapMutualEpLogApplication
.
findByBusinessId
(
purchaseOrder
.
getId
());
if
(!
CollectionUtils
.
isEmpty
(
logList
)){
List
<
String
>
types
=
logList
.
stream
()
.
map
(
SapMutualEpLog:
:
getType
)
.
collect
(
Collectors
.
toList
());
if
(
types
.
contains
(
"E"
)){
purchaseOrder
.
setStatusId
(
BizBillStatus
.
ABORTED
.
getId
());
//删除待办
actApplication
.
deleteRuntimeTaskExtension
(
jobPageId
);
sapPurchaseOrderRepository
.
save
(
purchaseOrder
);
}
else
{
throw
new
RuntimeException
(
"正常流程不能强制终止"
);
}
map
=
this
.
getProcessOutInfo
(
map
);
}
else
{
throw
new
RuntimeException
(
"正常流程不能强制终止"
);
//成品外购
//获取订单信息
map
=
this
.
getSaleOrderInfo
(
map
,
purchaseOrderItems
);
}
map
.
put
(
"page"
,
"/print/topsun/processOuter2.ftl"
);
return
map
;
}
public
Map
<
String
,
Object
>
getSupplierInfo
(
Map
<
String
,
Object
>
map
,
String
lifnr
){
...
...
@@ -533,141 +505,171 @@ public class SapPurchaseOrderApplicationImpl extends FlowBroker implements SapPu
return
map
;
}
public
Map
<
String
,
Object
>
getSaleOrderInfo
(
Map
<
String
,
Object
>
map
,
String
orderId
){
List
<
SapPurchaseOrderItem
>
purchaseOrderItems
=
this
.
sapPurchaseOrderItemApplication
.
getPurchaseOrderItems
(
orderId
);
SapPurchaseOrderItem
purchaseOrderItem
=
purchaseOrderItems
.
get
(
0
);
purchaseOrderItem
.
setMatnr2
(
purchaseOrderItem
.
getMatnr2
().
replaceFirst
(
"^0*"
,
""
));
BeanUtil
.
beanToMap
(
purchaseOrderItem
,
map
,
false
,
false
);
// map.put("eindt",purchaseOrderItem.getEindt());//交货日期
// map.put("lgobe",purchaseOrderItem.getLgobe());//仓库
// map.put("telf1",purchaseOrderItem.getTelf1());//联系人电话
// map.put("matnr2",purchaseOrderItem.getMatnr2());//产品编码
// map.put("maktx",purchaseOrderItem.getMaktx());//产品名称
// map.put("strSuppl",purchaseOrderItem.getStrSuppl());//交货地点
// map.put("msehl",purchaseOrderItem.getMsehl());//单位
//销售单号多个的情况放明细列表中
Set
<
SapSaleOrderVo
>
saleOrderVos
=
purchaseOrderItems
public
Map
<
String
,
Object
>
getSaleOrderInfo
(
Map
<
String
,
Object
>
map
,
List
<
SapPurchaseOrderItem
>
purchaseOrderItems
){
//根据产品合并明细项
List
<
String
>
matnrList
=
new
ArrayList
<>(
purchaseOrderItems
.
stream
()
.
map
(
sapPurchaseOrderItem
->
{
SapSaleOrderVo
sapSaleOrderVo
=
new
SapSaleOrderVo
();
BeanUtil
.
copyProperties
(
sapPurchaseOrderItem
,
sapSaleOrderVo
);
return
sapSaleOrderVo
;
}).
collect
(
Collectors
.
toSet
());
BigDecimal
zero
=
BigDecimal
.
ZERO
;
//计算成品数量
for
(
SapSaleOrderVo
saleOrderVo
:
saleOrderVos
)
{
zero
=
zero
.
add
(
saleOrderVo
.
getKwmeng
());
.
map
(
SapPurchaseOrderItem:
:
getMatnr2
).
collect
(
Collectors
.
toSet
()));
////获取产品信息
List
<
EpProductInfoVo
>
productInfoVoList
=
this
.
getProductInfo
(
matnrList
);
map
.
put
(
"productInfoVoList"
,
productInfoVoList
);
//生产制程
map
.
put
(
"productionProcess"
,
productInfoVoList
.
get
(
0
).
getProductionProcess
());
//获取订单明细信息
List
<
Map
<
String
,
Object
>>
detailList
=
new
ArrayList
<>();
for
(
int
i
=
1
;
i
<=
matnrList
.
size
();
i
++)
{
String
matnr
=
matnrList
.
get
(
i
-
1
);
Map
<
String
,
Object
>
detailMap
=
new
HashMap
<>();
detailMap
.
put
(
"no"
,
i
);
BigDecimal
number
=
BigDecimal
.
ZERO
;
BigDecimal
amount
=
BigDecimal
.
ZERO
;
for
(
int
j
=
0
;
j
<
purchaseOrderItems
.
size
();
j
++)
{
SapPurchaseOrderItem
purchaseOrderItem
=
purchaseOrderItems
.
get
(
j
);
if
(
matnr
.
equals
(
purchaseOrderItem
.
getMatnr2
())){
detailMap
.
put
(
"matnr2"
,
matnr
.
replaceFirst
(
"^0*"
,
""
));
detailMap
.
put
(
"maktx"
,
purchaseOrderItem
.
getTxz01
());
detailMap
.
put
(
"msehl"
,
purchaseOrderItem
.
getMsehl
());
number
=
number
.
add
(
purchaseOrderItem
.
getKwmeng
());
//计算总额 = (含税单价+运输费)* 成品数量
BigDecimal
netpr
=
purchaseOrderItem
.
getNetpr
();
//含税单价
BigDecimal
kbetr2
=
purchaseOrderItem
.
getKbetr2
()
==
null
?
BigDecimal
.
ZERO
:
purchaseOrderItem
.
getKbetr2
();
//运输费
BigDecimal
kbetr3
=
purchaseOrderItem
.
getKbetr3
()
==
null
?
BigDecimal
.
ZERO
:
purchaseOrderItem
.
getKbetr3
();
//包装费
amount
=
amount
.
add
(
netpr
.
add
(
kbetr2
).
add
(
kbetr3
).
multiply
(
purchaseOrderItem
.
getKwmeng
()));
detailMap
.
put
(
"netpr"
,
netpr
);
detailMap
.
put
(
"kbetr2"
,
kbetr2
);
detailMap
.
put
(
"kbetr3"
,
kbetr3
);
detailMap
.
put
(
"priceAmount"
,
netpr
.
add
(
kbetr2
).
add
(
kbetr3
));
//合计单价
detailMap
.
put
(
"loss"
,
"1%"
);
//LOSS数,默认1%
}
}
detailMap
.
put
(
"number"
,
number
);
detailMap
.
put
(
"amount"
,
amount
);
detailList
.
add
(
detailMap
);
}
map
.
put
(
"number"
,
zero
);
map
.
put
(
"backNumber"
,
zero
);
map
.
put
(
"saleOrderVos"
,
saleOrderVos
);
//计算总额 = (含税单价+运输费)* 成品数量
BigDecimal
netpr
=
purchaseOrderItem
.
getNetpr
();
//含税单价
BigDecimal
kbetr2
=
purchaseOrderItem
.
getKbetr2
()
==
null
?
BigDecimal
.
ZERO
:
purchaseOrderItem
.
getKbetr2
();
//运输费
BigDecimal
kbetr3
=
purchaseOrderItem
.
getKbetr3
()
==
null
?
BigDecimal
.
ZERO
:
purchaseOrderItem
.
getKbetr3
();
//包装费
BigDecimal
amount
=
netpr
.
add
(
kbetr2
).
add
(
kbetr3
).
multiply
(
zero
);
map
.
put
(
"netpr"
,
netpr
);
map
.
put
(
"kbetr2"
,
kbetr2
);
map
.
put
(
"kbetr3"
,
kbetr3
);
map
.
put
(
"priceAmount"
,
netpr
.
add
(
kbetr2
).
add
(
kbetr3
));
//合计单价
map
.
put
(
"amount"
,
amount
);
map
.
put
(
"loss"
,
"1%"
);
//LOSS数,默认1%
//实际送货数量 = 成品数量 + LOSS数 (向上取整)
BigDecimal
multiply
=
zero
.
multiply
(
new
BigDecimal
(
"0.01"
));
long
loss
=
multiply
.
setScale
(
0
,
RoundingMode
.
UP
).
longValue
();
// 向上取整
BigDecimal
realNumber
=
zero
.
add
(
BigDecimal
.
valueOf
(
loss
));
map
.
put
(
"realNumber"
,
realNumber
);
map
.
put
(
"materialList"
,
detailList
);
return
map
;
}
private
Map
<
String
,
Object
>
getProductInfo
(
Map
<
String
,
Object
>
map
)
{
String
matnr2
=
(
String
)
map
.
get
(
"matnr2"
);
//从EP系统查询产品信息
EpProductInfoVo
epProductInfoVo
=
epApplication
.
queryEpProductInfo
(
matnr2
);
epProductInfoVo
.
setPrintColor
(
epProductInfoVo
.
getFrontColor
()+
";"
+
epProductInfoVo
.
getOppositeColor
());
BeanUtil
.
beanToMap
(
epProductInfoVo
,
map
,
false
,
false
);
try
{
File
file
=
new
File
(
"product-"
+
map
.
get
(
"ebeln"
)+
".png"
);
if
(!
file
.
exists
())
{
String
IMG_TYPE_PNG
=
"image/png"
;
map
.
put
(
"barCode"
,
CommonUtils
.
genBarCode128
((
String
)
map
.
get
(
"ebeln"
),
IMG_TYPE_PNG
,
file
,
128
,
10
,
HumanReadablePlacement
.
HRP_BOTTOM
));
}
else
{
map
.
put
(
"barCode"
,
file
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
RuntimeException
(
"PDF生成失败!"
);
private
List
<
EpProductInfoVo
>
getProductInfo
(
List
<
String
>
matnrList
)
{
List
<
EpProductInfoVo
>
epProductInfoVos
=
new
ArrayList
<>();
for
(
String
matnr2
:
matnrList
)
{
//从EP系统查询产品信息
EpProductInfoVo
epProductInfoVo
=
epApplication
.
queryEpProductInfo
(
matnr2
);
epProductInfoVos
.
add
(
epProductInfoVo
);
//pProductInfoVo.setPrintColor(epProductInfoVo.getFrontColor()+";"+epProductInfoVo.getOppositeColor());
//BeanUtil.beanToMap(epProductInfoVo,map,false,false);
}
return
map
;
// try {
// File file = new File("product-"+map.get("ebeln")+".png");
// if(!file.exists()) {
// String IMG_TYPE_PNG = "image/png";
// map.put("barCode", CommonUtils.genBarCode128((String) map.get("ebeln"), IMG_TYPE_PNG, file,128,10, HumanReadablePlacement.HRP_BOTTOM));
// } else {
// map.put("barCode",file);
// }
// }catch (Exception e) {
// e.printStackTrace();
// throw new RuntimeException("PDF生成失败!");
// }
return
epProductInfoVos
;
}
private
Map
<
String
,
Object
>
getProcessOutInfo
(
Map
<
String
,
Object
>
map
)
{
String
ebeln
=
(
String
)
map
.
get
(
"ebeln"
);
//采购订单号
//根据订单号查询外协单明细
ProcessOutsourceOrderItem
outsourceOrderItem
=
processOutsourceOrderItemRepository
.
findByEbeln
(
ebeln
);
if
(
StringUtil
.
isBlank
((
String
)
map
.
get
(
"matnr2"
))
){
map
.
put
(
"matnr2"
,
outsourceOrderItem
.
getProductCode
().
replaceFirst
(
"^0*"
,
""
));
map
.
put
(
"maktx"
,
outsourceOrderItem
.
getProductName
());
//没有产品编码时,从外协单查询
map
=
this
.
getProductInfo
(
map
);
}
map
.
put
(
"outProcess01"
,
outsourceOrderItem
.
getTxz01
());
map
.
put
(
"outProcess02"
,
outsourceOrderItem
.
getTxz02
());
//临时工序外发,计算印张数;实际送货数量,LOSS数
BigDecimal
number
=
outsourceOrderItem
.
getMenge
();
//成品数量
map
.
put
(
"number"
,
number
);
BigDecimal
model
=
(
BigDecimal
)
map
.
get
(
"model"
)
!=
null
?
(
BigDecimal
)
map
.
get
(
"model"
)
:
BigDecimal
.
ZERO
;
//排版数量
BigDecimal
loss
=
outsourceOrderItem
.
getPrintLoss
()
!=
null
?
outsourceOrderItem
.
getPrintLoss
()
:
BigDecimal
.
ZERO
;
//印张LOSS数改为LOSS数
//map.put("printLoss",printLoss);
BigDecimal
printLoss
=
BigDecimal
.
ZERO
;
if
(
model
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
&&
loss
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
){
printLoss
=
loss
.
divide
(
model
,
2
,
RoundingMode
.
UP
);
long
printLossL
=
printLoss
.
setScale
(
0
,
RoundingMode
.
UP
).
longValue
();
printLoss
=
new
BigDecimal
(
printLossL
);
}
map
.
put
(
"printLoss"
,
printLoss
);
//印张量 = 成品数量/排版数量
BigDecimal
printNumber
=
BigDecimal
.
ZERO
;
if
(
number
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
&&
model
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
){
printNumber
=
number
.
divide
(
model
,
2
,
RoundingMode
.
UP
);
long
l
=
printNumber
.
setScale
(
0
,
RoundingMode
.
UP
).
longValue
();
printNumber
=
new
BigDecimal
(
l
);
}
map
.
put
(
"printNumber"
,
printNumber
);
if
(
printNumber
.
compareTo
(
BigDecimal
.
ZERO
)
>
0
){
//有成品数量+排版数量的时候,应回厂数量=印张量
map
.
put
(
"backNumber"
,
printNumber
);
}
//LOSS数 = 印张LOSS * 排版数量
//BigDecimal loss = printLoss.multiply(model);
map
.
put
(
"loss"
,
loss
);
List
<
ProcessOutsourceOrderItem
>
outsourceOrderItemList
=
processOutsourceOrderItemRepository
.
findByEbeln
(
ebeln
);
//根据产品合并明细项,获取产品图片信息
List
<
String
>
matnrList
=
new
ArrayList
<>(
outsourceOrderItemList
.
stream
()
.
map
(
ProcessOutsourceOrderItem:
:
getProductCode
).
collect
(
Collectors
.
toSet
()));
//获取产品信息
List
<
EpProductInfoVo
>
productInfoVoList
=
this
.
getProductInfo
(
matnrList
);
map
.
put
(
"productInfoVoList"
,
productInfoVoList
);
//生产制程
map
.
put
(
"productionProcess"
,
productInfoVoList
.
get
(
0
).
getProductionProcess
());
//产品和工序合并明细项,获取数量合计,loss合计,总金额合计
List
<
ProductKey
>
uniqueProductList
=
new
ArrayList
<>(
outsourceOrderItemList
.
stream
()
.
map
(
p
->
new
ProductKey
(
p
.
getProductCode
(),
p
.
getWempf
()))
.
collect
(
Collectors
.
toSet
()));
map
.
put
(
"eindt"
,
outsourceOrderItemList
.
get
(
0
).
getEeind
());
List
<
Map
<
String
,
Object
>>
detailList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
uniqueProductList
.
size
();
i
++)
{
Map
<
String
,
Object
>
detailMap
=
new
HashMap
<>();
detailMap
.
put
(
"no"
,
i
+
1
);
ProductKey
productKey
=
uniqueProductList
.
get
(
i
);
BigDecimal
number
=
BigDecimal
.
ZERO
;
BigDecimal
loss
=
BigDecimal
.
ZERO
;
BigDecimal
amount
=
BigDecimal
.
ZERO
;
for
(
int
j
=
0
;
j
<
outsourceOrderItemList
.
size
();
j
++)
{
ProcessOutsourceOrderItem
outsourceOrderItem
=
outsourceOrderItemList
.
get
(
j
);
if
(
productKey
.
getProductCode
().
equals
(
outsourceOrderItem
.
getProductCode
())){
detailMap
.
put
(
"matnr2"
,
outsourceOrderItem
.
getProductCode
().
replaceFirst
(
"^0*"
,
""
));
detailMap
.
put
(
"maktx"
,
outsourceOrderItem
.
getProductName
());
detailMap
.
put
(
"msehl"
,
outsourceOrderItem
.
getMeinsName
());
detailMap
.
put
(
"outProcess01"
,
outsourceOrderItem
.
getWempf
());
//临时工序外发,计算印张数;实际送货数量,LOSS数
number
=
number
.
add
(
outsourceOrderItem
.
getMenge
());
//成品数量
loss
=
loss
.
add
(
outsourceOrderItem
.
getPrintLoss
()
!=
null
?
outsourceOrderItem
.
getPrintLoss
()
:
BigDecimal
.
ZERO
);
//印张LOSS数改为LOSS数
//查询工序报价
ProcessQuotedPriceItemNumber
quotedPriceItemNumber
=
processQuotedPriceItemApplication
.
findQuotedPriceByProductAndProcess
(
outsourceOrderItem
.
getProductCode
(),
outsourceOrderItem
.
getWempf
(),
outsourceOrderItem
.
getMenge
(),
outsourceOrderItem
.
getLifnr
());
detailMap
.
put
(
"netpr"
,
quotedPriceItemNumber
.
getUnitPrice
());
//含税单价
detailMap
.
put
(
"kbetr2"
,
quotedPriceItemNumber
.
getFreight
());
//运输费
detailMap
.
put
(
"kbetr3"
,
quotedPriceItemNumber
.
getPackMoney
());
//包装费
BigDecimal
priceAmount
=
quotedPriceItemNumber
.
getUnitPrice
();
if
(
quotedPriceItemNumber
.
getFreight
()
!=
null
){
priceAmount
=
priceAmount
.
add
(
quotedPriceItemNumber
.
getFreight
());
}
if
(
quotedPriceItemNumber
.
getPackMoney
()
!=
null
){
priceAmount
=
priceAmount
.
add
(
quotedPriceItemNumber
.
getPackMoney
());
}
detailMap
.
put
(
"priceAmount"
,
priceAmount
);
//合计单价
amount
=
amount
.
add
(
priceAmount
.
multiply
(
outsourceOrderItem
.
getMenge
()));
//合计金额
}
}
detailMap
.
put
(
"number"
,
number
);
detailMap
.
put
(
"loss"
,
loss
);
detailMap
.
put
(
"amount"
,
amount
);
//总价
detailList
.
add
(
detailMap
);
//实际送货数量 = 成品数量 + LOSS数
BigDecimal
realNumber
=
number
.
add
(
loss
);
map
.
put
(
"realNumber"
,
realNumber
);
//查询工序外协单组件
List
<
ProcessOutsourceMaterial
>
materialList
=
processOutsourceMaterialRepository
.
findByProcessOutsourceId
(
outsourceOrderItem
.
getProcessOutsourceId
());
for
(
ProcessOutsourceMaterial
material
:
materialList
)
{
material
.
setDeliveryMethodOut
(
DictUtil
.
getDictionaryDetailText
(
"deliveryMethodOut"
,
material
.
getDeliveryMethodOut
()));
}
map
.
put
(
"materialList"
,
materialList
);
//查询工序报价
ProcessQuotedPriceItemNumber
quotedPriceItemNumber
=
processQuotedPriceItemApplication
.
findQuotedPriceByProductAndProcess
(
outsourceOrderItem
.
getProductCode
(),
outsourceOrderItem
.
getWempf
(),
outsourceOrderItem
.
getMenge
(),
outsourceOrderItem
.
getLifnr
());
map
.
put
(
"netpr"
,
quotedPriceItemNumber
.
getUnitPrice
());
//含税单价
map
.
put
(
"kbetr2"
,
quotedPriceItemNumber
.
getFreight
());
//运输费
map
.
put
(
"kbetr3"
,
quotedPriceItemNumber
.
getPackMoney
());
//包装费
BigDecimal
priceAmount
=
quotedPriceItemNumber
.
getUnitPrice
(
);
if
(
quotedPriceItemNumber
.
getFreight
()
!=
null
)
{
priceAmount
=
priceAmount
.
add
(
quotedPriceItemNumber
.
getFreight
()
);
map
.
put
(
"materialList"
,
detailList
);
return
map
;
}
@Override
public
void
updateProcessOutStatus
(
List
<
String
>
ids
)
{
List
<
SapPurchaseOrder
>
orderList
=
sapPurchaseOrderRepository
.
findAll
(
ids
);
for
(
SapPurchaseOrder
sapPurchaseOrder
:
orderList
)
{
sapPurchaseOrder
.
setSendOut
(
"1"
);
}
if
(
quotedPriceItemNumber
.
getPackMoney
()
!=
null
){
priceAmount
=
priceAmount
.
add
(
quotedPriceItemNumber
.
getPackMoney
());
sapPurchaseOrderRepository
.
save
(
orderList
);
}
@Override
public
void
abortPurchaseOrder
(
String
id
,
String
jobPageId
)
{
//先标记终止状态
SapPurchaseOrder
purchaseOrder
=
sapPurchaseOrderRepository
.
findOne
(
id
);
List
<
SapMutualEpLog
>
logList
=
sapMutualEpLogApplication
.
findByBusinessId
(
purchaseOrder
.
getId
());
if
(!
CollectionUtils
.
isEmpty
(
logList
)){
List
<
String
>
types
=
logList
.
stream
()
.
map
(
SapMutualEpLog:
:
getType
)
.
collect
(
Collectors
.
toList
());
if
(
types
.
contains
(
"E"
)){
purchaseOrder
.
setStatusId
(
BizBillStatus
.
ABORTED
.
getId
());
//删除待办
actApplication
.
deleteRuntimeTaskExtension
(
jobPageId
);
sapPurchaseOrderRepository
.
save
(
purchaseOrder
);
}
else
{
throw
new
RuntimeException
(
"正常流程不能强制终止"
);
}
}
else
{
throw
new
RuntimeException
(
"正常流程不能强制终止"
);
}
map
.
put
(
"priceAmount"
,
priceAmount
);
//合计单价
map
.
put
(
"amount"
,
priceAmount
.
multiply
(
number
));
//总价
return
map
;
}
}
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