Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
S
sap-service
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
曲欣亮
sap-service
Commits
2d3d5753
Commit
2d3d5753
authored
Jul 22, 2019
by
Quxl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
x
parent
93a4b99d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
454 additions
and
349 deletions
+454
-349
ConfirmQuotationServiceImpl.java
...rvices/confirm_quotation/ConfirmQuotationServiceImpl.java
+114
-94
DNDeletionServiceImpl.java
...egolm/sso/services/dn_deletion/DNDeletionServiceImpl.java
+39
-17
MaterialMasterServiceImpl.java
...o/services/material_master/MaterialMasterServiceImpl.java
+1
-1
PrformaInvoiceServiceImpl.java
...o/services/prforma_invoice/PrformaInvoiceServiceImpl.java
+131
-109
PriceListServiceImpl.java
...m/egolm/sso/services/price_list/PriceListServiceImpl.java
+64
-43
ShippingNotificationServiceImpl.java
...hipping_notfirmation/ShippingNotificationServiceImpl.java
+105
-85
No files found.
src/main/java/com/egolm/sso/services/confirm_quotation/ConfirmQuotationServiceImpl.java
View file @
2d3d5753
...
@@ -10,18 +10,22 @@ import java.util.Map.Entry;
...
@@ -10,18 +10,22 @@ import java.util.Map.Entry;
import
javax.jws.WebService
;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.HEADER
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.HEADER
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.ITEM_DATA
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.ITEM_DATA
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.ITEM_PRICING
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.ITEM_PRICING
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.RESPONSE
;
import
com.egolm.sso.services.confirm_quotation.Z_MT_SD_008_SO_CONFIRM_QUOTATION.RESPONSE
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@Component
@WebService
(
serviceName
=
"ConfirmQuotationService"
,
targetNamespace
=
"http://confirm_quotation.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.confirm_quotation.ConfirmQuotationService"
)
@WebService
(
serviceName
=
"ConfirmQuotationService"
,
targetNamespace
=
"http://confirm_quotation.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.confirm_quotation.ConfirmQuotationService"
)
...
@@ -33,106 +37,122 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
...
@@ -33,106 +37,122 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
@Autowired
@Autowired
CommonService
common
;
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Override
@Transactional
@Transactional
public
void
execute
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
Z_MT_SD_008_SO_CONFIRM_QUOTATION
)
{
public
void
execute
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
Z_MT_SD_008_SO_CONFIRM_QUOTATION
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
Long
time
=
now
.
getTime
();
System
.
out
.
println
(
JSON
.
toJSONString
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
));
System
.
out
.
println
(
JSON
.
toJSONString
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
));
try
{
Map
<
String
,
Object
>
header
=
new
HashMap
<>();
Map
<
String
,
Object
>
header
=
new
HashMap
<>();
RESPONSE
res
=
Z_MT_SD_008_SO_CONFIRM_QUOTATION
.
getRESPONSE
();
RESPONSE
res
=
Z_MT_SD_008_SO_CONFIRM_QUOTATION
.
getRESPONSE
();
HEADER
h
=
res
.
getHEADER
();
HEADER
h
=
res
.
getHEADER
();
header
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
header
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
header
.
put
(
"VBELN"
,
h
.
getVBELN
());
header
.
put
(
"VBELN"
,
h
.
getVBELN
());
header
.
put
(
"VKORG"
,
h
.
getVKORG
());
header
.
put
(
"VKORG"
,
h
.
getVKORG
());
header
.
put
(
"VTWEG"
,
h
.
getVTWEG
());
header
.
put
(
"VTWEG"
,
h
.
getVTWEG
());
header
.
put
(
"SPART"
,
h
.
getSPART
());
header
.
put
(
"SPART"
,
h
.
getSPART
());
header
.
put
(
"ERNAM"
,
h
.
getERNAM
());
header
.
put
(
"ERNAM"
,
h
.
getERNAM
());
header
.
put
(
"BSTDK"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getBSTDK
(),
DateUtil
.
FMT_DATE
));
header
.
put
(
"BSTDK"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getBSTDK
(),
DateUtil
.
FMT_DATE
));
header
.
put
(
"ERZET"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getERZET
(),
DateUtil
.
FMT_TIME
));
header
.
put
(
"ERZET"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getERZET
(),
DateUtil
.
FMT_TIME
));
header
.
put
(
"ERDAT"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getERDAT
(),
DateUtil
.
FMT_DATE
));
header
.
put
(
"ERDAT"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getERDAT
(),
DateUtil
.
FMT_DATE
));
header
.
put
(
"KUNNR"
,
h
.
getKUNNR
());
header
.
put
(
"KUNNR"
,
h
.
getKUNNR
());
header
.
put
(
"KGNNR"
,
h
.
getKGNNR
());
header
.
put
(
"KGNNR"
,
h
.
getKGNNR
());
header
.
put
(
"NAME1"
,
h
.
getNAME1
());
header
.
put
(
"NAME1"
,
h
.
getNAME1
());
header
.
put
(
"NAME2"
,
h
.
getNAME2
());
header
.
put
(
"NAME2"
,
h
.
getNAME2
());
header
.
put
(
"POSTL_COD1"
,
h
.
getPOSTL_COD1
());
header
.
put
(
"POSTL_COD1"
,
h
.
getPOSTL_COD1
());
header
.
put
(
"CITY1"
,
h
.
getCITY1
());
header
.
put
(
"CITY1"
,
h
.
getCITY1
());
header
.
put
(
"ZZPROM"
,
h
.
getZZPROM
());
header
.
put
(
"ZZPROM"
,
h
.
getZZPROM
());
header
.
put
(
"BSTKD"
,
h
.
getBSTKD
());
header
.
put
(
"BSTKD"
,
h
.
getBSTKD
());
header
.
put
(
"AUART"
,
h
.
getAUART
());
header
.
put
(
"AUART"
,
h
.
getAUART
());
header
.
put
(
"CMGST"
,
h
.
getCMGST
());
header
.
put
(
"CMGST"
,
h
.
getCMGST
());
header
.
put
(
"NETWRH"
,
StringUtil
.
toDouble
(
h
.
getNETWRH
()));
header
.
put
(
"NETWRH"
,
StringUtil
.
toDouble
(
h
.
getNETWRH
()));
header
.
put
(
"MWSTH"
,
StringUtil
.
toDouble
(
h
.
getMWSTH
()));
header
.
put
(
"MWSTH"
,
StringUtil
.
toDouble
(
h
.
getMWSTH
()));
header
.
put
(
"WAERK"
,
h
.
getWAERK
());
header
.
put
(
"WAERK"
,
h
.
getWAERK
());
header
.
put
(
"DPFLAG"
,
h
.
getDPFLAG
());
header
.
put
(
"DPFLAG"
,
h
.
getDPFLAG
());
header
.
put
(
"SEND_STATUS"
,
"N"
);
header
.
put
(
"SEND_STATUS"
,
"N"
);
header
.
put
(
"BATCH"
,
today
+
common
.
getNextval
(
"T_SO_CONFIRMACTION_HEADER_BATCH_"
)+
today
);
header
.
put
(
"BATCH"
,
dateString
+
common
.
getNextval
(
"T_SO_CONFIRMACTION_HEADER_BATCH_"
)+
dateString
);
header
.
put
(
"CREATED"
,
now
);
header
.
put
(
"CREATED"
,
now
);
header
.
put
(
"CREATEDBY"
,
"system"
);
header
.
put
(
"CREATEDBY"
,
"system"
);
String
idIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_HEADER_ID_"
+
today
),
"00000"
);
String
idIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_HEADER_ID_"
+
dateString
),
"00000"
);
Long
hID
=
Long
.
valueOf
(
time
+
idIndex
);
Long
hID
=
Long
.
valueOf
(
time
+
idIndex
);
header
.
put
(
"ID"
,
hID
);
header
.
put
(
"ID"
,
hID
);
header
.
put
(
"TRACE_NO"
,
"sapsoconfirmquotation"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
header
.
put
(
"TRACE_NO"
,
"sapsoconfirmquotation"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
insertTo
(
header
,
"t_so_confirmation_header"
);
insertTo
(
header
,
"t_so_confirmation_header"
);
List
<
ITEM_DATA
>
ids
=
res
.
getITEM_DATA
();
List
<
ITEM_DATA
>
ids
=
res
.
getITEM_DATA
();
Map
<
String
,
Map
<
String
,
Object
>>
itemDatas
=
new
HashMap
<>();
Map
<
String
,
Map
<
String
,
Object
>>
itemDatas
=
new
HashMap
<>();
for
(
ITEM_DATA
id
:
ids
)
{
for
(
ITEM_DATA
id
:
ids
)
{
Map
<
String
,
Object
>
itemData
=
new
HashMap
<>();
Map
<
String
,
Object
>
itemData
=
new
HashMap
<>();
itemData
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
itemData
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
itemData
.
put
(
"VBELN"
,
h
.
getVBELN
());
itemData
.
put
(
"VBELN"
,
h
.
getVBELN
());
itemData
.
put
(
"HEADER_ID"
,
hID
);
itemData
.
put
(
"HEADER_ID"
,
hID
);
itemData
.
put
(
"POSNR"
,
id
.
getPOSNR
());
itemData
.
put
(
"POSNR"
,
id
.
getPOSNR
());
itemData
.
put
(
"UEPOS"
,
id
.
getUEPOS
());
itemData
.
put
(
"UEPOS"
,
id
.
getUEPOS
());
itemData
.
put
(
"VTEXT"
,
id
.
getVTEXT
());
itemData
.
put
(
"VTEXT"
,
id
.
getVTEXT
());
itemData
.
put
(
"MATNR"
,
id
.
getMATNR
());
itemData
.
put
(
"MATNR"
,
id
.
getMATNR
());
itemData
.
put
(
"KWMENG"
,
StringUtil
.
toDouble
(
id
.
getKWMENG
()));
itemData
.
put
(
"KWMENG"
,
StringUtil
.
toDouble
(
id
.
getKWMENG
()));
itemData
.
put
(
"VRKME"
,
id
.
getVRKME
());
itemData
.
put
(
"VRKME"
,
id
.
getVRKME
());
itemData
.
put
(
"EDATU"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getEDATU
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"EDATU"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getEDATU
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"CDATE"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getCDATE
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"CDATE"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getCDATE
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"REFLAG"
,
id
.
getREFLAG
());
itemData
.
put
(
"REFLAG"
,
id
.
getREFLAG
());
itemData
.
put
(
"MWSTI"
,
StringUtil
.
toDouble
(
id
.
getMWSTI
()));
itemData
.
put
(
"MWSTI"
,
StringUtil
.
toDouble
(
id
.
getMWSTI
()));
itemData
.
put
(
"NETWRI"
,
StringUtil
.
toDouble
(
id
.
getNETWRI
()));
itemData
.
put
(
"NETWRI"
,
StringUtil
.
toDouble
(
id
.
getNETWRI
()));
itemData
.
put
(
"WAERK_I"
,
id
.
getWAERK_I
());
itemData
.
put
(
"WAERK_I"
,
id
.
getWAERK_I
());
itemData
.
put
(
"WERKS"
,
id
.
getWERKS
());
itemData
.
put
(
"WERKS"
,
id
.
getWERKS
());
itemData
.
put
(
"ZZCRDDATE"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getZZCRDDATE
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"ZZCRDDATE"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getZZCRDDATE
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"KGNNR_I"
,
id
.
getKGNNR_I
());
itemData
.
put
(
"KGNNR_I"
,
id
.
getKGNNR_I
());
itemData
.
put
(
"NAME1_I"
,
id
.
getNAME1_I
());
itemData
.
put
(
"NAME1_I"
,
id
.
getNAME1_I
());
itemData
.
put
(
"NAME2_I"
,
id
.
getNAME2_I
());
itemData
.
put
(
"NAME2_I"
,
id
.
getNAME2_I
());
itemData
.
put
(
"POSTL_CODE1_I"
,
id
.
getPOSTL_COD1_I
());
itemData
.
put
(
"POSTL_CODE1_I"
,
id
.
getPOSTL_COD1_I
());
itemData
.
put
(
"CITY1_I"
,
id
.
getCITY1_I
());
itemData
.
put
(
"CITY1_I"
,
id
.
getCITY1_I
());
itemData
.
put
(
"CREATED"
,
now
);
itemData
.
put
(
"CREATED"
,
now
);
itemData
.
put
(
"CREATEDBY"
,
"system"
);
itemData
.
put
(
"CREATEDBY"
,
"system"
);
String
iidIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_DATA_ID_"
+
today
),
"00000"
);
String
iidIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_DATA_ID_"
+
dateString
),
"00000"
);
Long
iID
=
Long
.
valueOf
(
time
+
iidIndex
);
Long
iID
=
Long
.
valueOf
(
time
+
iidIndex
);
itemData
.
put
(
"ID"
,
iID
);
itemData
.
put
(
"ID"
,
iID
);
itemDatas
.
put
(
id
.
getPOSNR
(),
itemData
);
itemDatas
.
put
(
id
.
getPOSNR
(),
itemData
);
insertTo
(
itemData
,
"t_so_confirmation_item_data"
);
insertTo
(
itemData
,
"t_so_confirmation_item_data"
);
}
}
List
<
ITEM_PRICING
>
ips
=
res
.
getITEM_PRICING
();
List
<
ITEM_PRICING
>
ips
=
res
.
getITEM_PRICING
();
for
(
ITEM_PRICING
ip
:
ips
)
{
for
(
ITEM_PRICING
ip
:
ips
)
{
Map
<
String
,
Object
>
itemPricing
=
new
HashMap
<>();
Map
<
String
,
Object
>
itemPricing
=
new
HashMap
<>();
itemPricing
.
put
(
"HEADER_ID"
,
hID
);
itemPricing
.
put
(
"HEADER_ID"
,
hID
);
String
POSNR
=
ip
.
getPOSNR
();
String
POSNR
=
ip
.
getPOSNR
();
itemPricing
.
put
(
"ITEM_DATA_ID"
,
itemDatas
.
get
(
POSNR
).
get
(
"ID"
));
itemPricing
.
put
(
"ITEM_DATA_ID"
,
itemDatas
.
get
(
POSNR
).
get
(
"ID"
));
itemPricing
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
itemPricing
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
itemPricing
.
put
(
"VBELN"
,
h
.
getVBELN
());
itemPricing
.
put
(
"VBELN"
,
h
.
getVBELN
());
itemPricing
.
put
(
"POSNR"
,
POSNR
);
itemPricing
.
put
(
"POSNR"
,
POSNR
);
itemPricing
.
put
(
"KSCHL"
,
ip
.
getKSCHL
());
itemPricing
.
put
(
"KSCHL"
,
ip
.
getKSCHL
());
itemPricing
.
put
(
"VTEXT"
,
ip
.
getVTEXT
());
itemPricing
.
put
(
"VTEXT"
,
ip
.
getVTEXT
());
itemPricing
.
put
(
"KBETR"
,
StringUtil
.
toDouble
(
ip
.
getKBETR
()));
itemPricing
.
put
(
"KBETR"
,
StringUtil
.
toDouble
(
ip
.
getKBETR
()));
itemPricing
.
put
(
"KWERT"
,
StringUtil
.
toDouble
(
ip
.
getKWERT
()));
itemPricing
.
put
(
"KWERT"
,
StringUtil
.
toDouble
(
ip
.
getKWERT
()));
itemPricing
.
put
(
"CREATED"
,
now
);
itemPricing
.
put
(
"CREATED"
,
now
);
itemPricing
.
put
(
"CREATEDBY"
,
"system"
);
itemPricing
.
put
(
"CREATEDBY"
,
"system"
);
String
itemPricingID
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_PRICING_ID_"
+
today
),
"00000"
);
String
itemPricingID
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_PRICING_ID_"
+
dateString
),
"00000"
);
itemPricing
.
put
(
"ID"
,
Long
.
valueOf
(
time
+
itemPricingID
));
itemPricing
.
put
(
"ID"
,
Long
.
valueOf
(
time
+
itemPricingID
));
insertTo
(
itemPricing
,
"t_so_confirmation_item_pricing"
);
insertTo
(
itemPricing
,
"t_so_confirmation_item_pricing"
);
}
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
Z_MT_SD_008_SO_CONFIRM_QUOTATION
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
}
}
...
...
src/main/java/com/egolm/sso/services/dn_deletion/DNDeletionServiceImpl.java
View file @
2d3d5753
...
@@ -7,14 +7,18 @@ import java.util.Map;
...
@@ -7,14 +7,18 @@ import java.util.Map;
import
javax.jws.WebService
;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.SqlUtil.Sql
;
import
com.egolm.sso.util.SqlUtil.Sql
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@Component
@WebService
(
serviceName
=
"DNDeletionService"
,
targetNamespace
=
"http://dn_deletion.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.dn_deletion.DNDeletionService"
)
@WebService
(
serviceName
=
"DNDeletionService"
,
targetNamespace
=
"http://dn_deletion.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.dn_deletion.DNDeletionService"
)
...
@@ -27,28 +31,46 @@ public class DNDeletionServiceImpl implements DNDeletionService {
...
@@ -27,28 +31,46 @@ public class DNDeletionServiceImpl implements DNDeletionService {
@Autowired
@Autowired
CommonService
common
;
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Override
@Transactional
@Transactional
public
void
execute
(
DELETED_DOCUMENTS
DELETED_DOCUMENTS
)
{
public
void
execute
(
DELETED_DOCUMENTS
DELETED_DOCUMENTS
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
Date
now
=
new
Date
();
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
try
{
map
.
put
(
"MSGID"
,
DELETED_DOCUMENTS
.
getMSGID
());
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"TARGET_SYSTEM"
,
DELETED_DOCUMENTS
.
getTARGET_SYSTEM
());
map
.
put
(
"MSGID"
,
DELETED_DOCUMENTS
.
getMSGID
());
map
.
put
(
"DOCTYPE"
,
DELETED_DOCUMENTS
.
getDOCTYPE
());
map
.
put
(
"TARGET_SYSTEM"
,
DELETED_DOCUMENTS
.
getTARGET_SYSTEM
());
map
.
put
(
"DOCNUMBER"
,
DELETED_DOCUMENTS
.
getDOCNUMBER
());
map
.
put
(
"DOCTYPE"
,
DELETED_DOCUMENTS
.
getDOCTYPE
());
map
.
put
(
"SALES_ORG"
,
DELETED_DOCUMENTS
.
getSALES_ORG
());
map
.
put
(
"DOCNUMBER"
,
DELETED_DOCUMENTS
.
getDOCNUMBER
());
map
.
put
(
"DELETED_BY"
,
DELETED_DOCUMENTS
.
getDELETED_BY
());
map
.
put
(
"SALES_ORG"
,
DELETED_DOCUMENTS
.
getSALES_ORG
());
map
.
put
(
"SOLD_TO"
,
DELETED_DOCUMENTS
.
getSOLD_TO
());
map
.
put
(
"DELETED_BY"
,
DELETED_DOCUMENTS
.
getDELETED_BY
());
map
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_SO_DN_DELETION_BATCH"
+
dateString
));
map
.
put
(
"SOLD_TO"
,
DELETED_DOCUMENTS
.
getSOLD_TO
());
map
.
put
(
"SEND_STATUS"
,
"N"
);
map
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_SO_DN_DELETION_BATCH"
+
dateString
));
map
.
put
(
"SEND_TIME"
,
now
);
map
.
put
(
"SEND_STATUS"
,
"N"
);
map
.
put
(
"CREATED"
,
now
);
map
.
put
(
"SEND_TIME"
,
now
);
map
.
put
(
"CREATEDBY"
,
"system"
);
map
.
put
(
"CREATED"
,
now
);
map
.
put
(
"UPDATED"
,
now
);
map
.
put
(
"CREATEDBY"
,
"system"
);
map
.
put
(
"UPDATEDBY"
,
"system"
);
map
.
put
(
"UPDATED"
,
now
);
Sql
headerSql
=
SqlUtil
.
insertSql
(
"t_so_dn_deletion"
,
map
);
map
.
put
(
"UPDATEDBY"
,
"system"
);
jdbcTemplate
.
update
(
headerSql
.
getSql
(),
headerSql
.
getArgs
());
Sql
headerSql
=
SqlUtil
.
insertSql
(
"t_so_dn_deletion"
,
map
);
jdbcTemplate
.
update
(
headerSql
.
getSql
(),
headerSql
.
getArgs
());
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
DELETED_DOCUMENTS
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
DELETED_DOCUMENTS
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
}
}
}
src/main/java/com/egolm/sso/services/material_master/MaterialMasterServiceImpl.java
View file @
2d3d5753
...
@@ -124,7 +124,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
...
@@ -124,7 +124,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
String
xmlName
=
Z_MT_SD_001_MATERIAL_MASTER
.
getClass
().
getSimpleName
();
String
xmlName
=
Z_MT_SD_001_MATERIAL_MASTER
.
getClass
().
getSimpleName
();
try
{
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_001_MATERIAL_MASTER
);
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_001_MATERIAL_MASTER
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
dateString
+
"MATERIAL_MASTER_FILE_NAME
"
+
dateString
)
+
".XML"
;
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_
"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
throw
new
XRException
(
"报文保存失败"
,
e
);
...
...
src/main/java/com/egolm/sso/services/prforma_invoice/PrformaInvoiceServiceImpl.java
View file @
2d3d5753
...
@@ -9,10 +9,12 @@ import java.util.Map;
...
@@ -9,10 +9,12 @@ import java.util.Map;
import
javax.jws.WebService
;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_BANK_DATA
;
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_BANK_DATA
;
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_DOCU_DATE
;
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.HEADER_DOCU_DATE
;
...
@@ -29,9 +31,11 @@ import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.ITEM_V
...
@@ -29,9 +31,11 @@ import com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.ITEM_V
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.SUMMARY_GENERAL
;
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.SUMMARY_GENERAL
;
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.Z_DT_SD_005_PERFORM_INVOICE
;
import
com.egolm.sso.services.prforma_invoice.Z_MT_SD_005_PERFORM_INVOICE.Z_DT_SD_005_PERFORM_INVOICE
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.SqlUtil.Sql
;
import
com.egolm.sso.util.SqlUtil.Sql
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@Component
@WebService
(
serviceName
=
"PrformaInvoiceService"
,
targetNamespace
=
"http://prforma_invoice.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.prforma_invoice.PrformaInvoiceService"
)
@WebService
(
serviceName
=
"PrformaInvoiceService"
,
targetNamespace
=
"http://prforma_invoice.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.prforma_invoice.PrformaInvoiceService"
)
...
@@ -43,128 +47,146 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
...
@@ -43,128 +47,146 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
@Autowired
@Autowired
CommonService
common
;
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Override
@Transactional
@Transactional
public
void
execute
(
Z_MT_SD_005_PERFORM_INVOICE
Z_MT_SD_005_PERFORM_INVOICE
)
{
public
void
execute
(
Z_MT_SD_005_PERFORM_INVOICE
Z_MT_SD_005_PERFORM_INVOICE
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
Date
now
=
new
Date
();
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Map
<
String
,
Object
>
headMap
=
new
HashMap
<
String
,
Object
>();
try
{
Z_DT_SD_005_PERFORM_INVOICE
Z_DT_SD_005_PERFORM_INVOICE
=
Z_MT_SD_005_PERFORM_INVOICE
.
getZ_DT_SD_005_PERFORM_INVOICE
();
Map
<
String
,
Object
>
headMap
=
new
HashMap
<
String
,
Object
>();
HEADER_GENERAL_DATA
HEADER_GENERAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_GENERAL_DATA
();
Z_DT_SD_005_PERFORM_INVOICE
Z_DT_SD_005_PERFORM_INVOICE
=
Z_MT_SD_005_PERFORM_INVOICE
.
getZ_DT_SD_005_PERFORM_INVOICE
();
List
<
HEADER_PARTNER_DATA
>
partnerList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_PARTNER_DATA
();
HEADER_GENERAL_DATA
HEADER_GENERAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_GENERAL_DATA
();
HEADER_DOCU_DATE
HEADER_DOCU_DATE
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_DOCU_DATE
();
List
<
HEADER_PARTNER_DATA
>
partnerList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_PARTNER_DATA
();
HEADER_REFERENCE_DATA
HEADER_REFERENCE_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_REFERENCE_DATA
();
HEADER_DOCU_DATE
HEADER_DOCU_DATE
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_DOCU_DATE
();
HEADER_BANK_DATA
HEADER_BANK_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_BANK_DATA
();
HEADER_REFERENCE_DATA
HEADER_REFERENCE_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_REFERENCE_DATA
();
HEADER_ORGANIZATIONAL_DATA
HEADER_ORGANIZATIONAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_ORGANIZATIONAL_DATA
();
HEADER_BANK_DATA
HEADER_BANK_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_BANK_DATA
();
List
<
SUMMARY_GENERAL
>
summaryList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getSUMMARY_GENERAL
();
HEADER_ORGANIZATIONAL_DATA
HEADER_ORGANIZATIONAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_ORGANIZATIONAL_DATA
();
List
<
ITEM_DATA
>
itemList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getITEM_DATA
();
List
<
SUMMARY_GENERAL
>
summaryList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getSUMMARY_GENERAL
();
Long
headerId
=
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_ID"
);
List
<
ITEM_DATA
>
itemList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getITEM_DATA
();
headMap
.
put
(
"ID"
,
headerId
);
Long
headerId
=
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_ID"
);
if
(
HEADER_GENERAL_DATA
!=
null
)
{
headMap
.
put
(
"ID"
,
headerId
);
headMap
.
put
(
"GENERAL_BELNR"
,
HEADER_GENERAL_DATA
.
getBELNR
());
if
(
HEADER_GENERAL_DATA
!=
null
)
{
headMap
.
put
(
"GENERAL_ZTERM"
,
HEADER_GENERAL_DATA
.
getZTERM
());
headMap
.
put
(
"GENERAL_BELNR"
,
HEADER_GENERAL_DATA
.
getBELNR
());
}
headMap
.
put
(
"GENERAL_ZTERM"
,
HEADER_GENERAL_DATA
.
getZTERM
());
if
(
partnerList
!=
null
)
{
}
for
(
HEADER_PARTNER_DATA
HEADER_PARTNER_DATA
:
partnerList
)
{
if
(
partnerList
!=
null
)
{
if
(
"AG"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
for
(
HEADER_PARTNER_DATA
HEADER_PARTNER_DATA
:
partnerList
)
{
headMap
.
put
(
"PARTNER_PARVW1"
,
HEADER_PARTNER_DATA
.
getPARVW
());
if
(
"AG"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
headMap
.
put
(
"PARTNER_PARTN1"
,
HEADER_PARTNER_DATA
.
getPARTN
());
headMap
.
put
(
"PARTNER_PARVW1"
,
HEADER_PARTNER_DATA
.
getPARVW
());
}
else
if
(
"WE"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
headMap
.
put
(
"PARTNER_PARTN1"
,
HEADER_PARTNER_DATA
.
getPARTN
());
headMap
.
put
(
"PARTNER_PARVW2"
,
HEADER_PARTNER_DATA
.
getPARVW
());
}
else
if
(
"WE"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
headMap
.
put
(
"PARTNER_PARTN2"
,
HEADER_PARTNER_DATA
.
getPARTN
());
headMap
.
put
(
"PARTNER_PARVW2"
,
HEADER_PARTNER_DATA
.
getPARVW
());
headMap
.
put
(
"PARTNER_PARTN2"
,
HEADER_PARTNER_DATA
.
getPARTN
());
}
}
}
}
}
}
if
(
HEADER_DOCU_DATE
!=
null
)
{
if
(
HEADER_DOCU_DATE
!=
null
)
{
headMap
.
put
(
"DOCU_IDDAT"
,
HEADER_DOCU_DATE
.
getIDDAT
());
headMap
.
put
(
"DOCU_IDDAT"
,
HEADER_DOCU_DATE
.
getIDDAT
());
headMap
.
put
(
"DOCU_DATUM"
,
HEADER_DOCU_DATE
.
getDATUM
());
headMap
.
put
(
"DOCU_DATUM"
,
HEADER_DOCU_DATE
.
getDATUM
());
}
if
(
HEADER_REFERENCE_DATA
!=
null
)
{
headMap
.
put
(
"EFERENCE_QUALF"
,
HEADER_REFERENCE_DATA
.
getQUALF
());
headMap
.
put
(
"EFERENCE_BELNR"
,
HEADER_REFERENCE_DATA
.
getBELNR
());
headMap
.
put
(
"EFERENCE_DATUM"
,
HEADER_REFERENCE_DATA
.
getDATUM
());
}
if
(
HEADER_BANK_DATA
!=
null
)
{
headMap
.
put
(
"BANK_ACNUM"
,
HEADER_BANK_DATA
.
getACNUM
());
}
if
(
HEADER_ORGANIZATIONAL_DATA
!=
null
)
{
headMap
.
put
(
"ORGANIZATIONAL_QUALF"
,
HEADER_ORGANIZATIONAL_DATA
.
getQUALF
());
headMap
.
put
(
"ORGANIZATIONAL_ORGID"
,
HEADER_ORGANIZATIONAL_DATA
.
getORGID
());
}
if
(
summaryList
!=
null
)
{
for
(
int
i
=
0
;
i
<
summaryList
.
size
();
i
++)
{
SUMMARY_GENERAL
SUMMARY_GENERAL
=
summaryList
.
get
(
i
);
headMap
.
put
(
"SUMMARY_SUMID"
+
(
i
+
1
),
SUMMARY_GENERAL
.
getSUMID
());
headMap
.
put
(
"SUMMARY_SUMME"
+
(
i
+
1
),
SUMMARY_GENERAL
.
getSUMME
());
headMap
.
put
(
"SUMMARY_WAERQ"
+
(
i
+
1
),
SUMMARY_GENERAL
.
getWAERQ
());
}
}
}
if
(
HEADER_REFERENCE_DATA
!=
null
)
{
headMap
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_BATCH_"
+
dateString
));
headMap
.
put
(
"EFERENCE_QUALF"
,
HEADER_REFERENCE_DATA
.
getQUALF
());
headMap
.
put
(
"SEND_STATUS"
,
'N'
);
headMap
.
put
(
"EFERENCE_BELNR"
,
HEADER_REFERENCE_DATA
.
getBELNR
());
headMap
.
put
(
"SEND_TIME"
,
now
);
headMap
.
put
(
"EFERENCE_DATUM"
,
HEADER_REFERENCE_DATA
.
getDATUM
());
headMap
.
put
(
"TRACE_NO"
,
"sapproformainvoice"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
}
headMap
.
put
(
"CREATED"
,
now
);
if
(
HEADER_BANK_DATA
!=
null
)
{
headMap
.
put
(
"CREATEDBY"
,
"system"
);
headMap
.
put
(
"BANK_ACNUM"
,
HEADER_BANK_DATA
.
getACNUM
());
headMap
.
put
(
"UPDATED"
,
null
);
}
headMap
.
put
(
"UPDATEDBY"
,
null
);
if
(
HEADER_ORGANIZATIONAL_DATA
!=
null
)
{
headMap
.
put
(
"ORGANIZATIONAL_QUALF"
,
HEADER_ORGANIZATIONAL_DATA
.
getQUALF
());
List
<
Map
<
String
,
Object
>>
itemDatas
=
new
ArrayList
<
Map
<
String
,
Object
>>();
headMap
.
put
(
"ORGANIZATIONAL_ORGID"
,
HEADER_ORGANIZATIONAL_DATA
.
getORGID
());
if
(
itemList
!=
null
)
{
}
for
(
ITEM_DATA
ITEM_DATA
:
itemList
)
{
if
(
summaryList
!=
null
)
{
Map
<
String
,
Object
>
itemDataMap
=
new
HashMap
<
String
,
Object
>();
for
(
int
i
=
0
;
i
<
summaryList
.
size
();
i
++)
{
Long
itemId
=
Long
.
valueOf
(
""
+
System
.
currentTimeMillis
()
+
StringUtil
.
format
(
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_ID_"
+
dateString
),
"00000"
));
SUMMARY_GENERAL
SUMMARY_GENERAL
=
summaryList
.
get
(
i
);
ITEM_REFERENCE_DATA
ITEM_REFERENCE_DATA
=
ITEM_DATA
.
getITEM_REFERENCE_DATA
();
headMap
.
put
(
"SUMMARY_SUMID"
+
(
i
+
1
),
SUMMARY_GENERAL
.
getSUMID
());
ITEM_MATERIAL_DATA
ITEM_MATERIAL_DATA
=
ITEM_DATA
.
getITEM_MATERIAL_DATA
();
headMap
.
put
(
"SUMMARY_SUMME"
+
(
i
+
1
),
SUMMARY_GENERAL
.
getSUMME
());
List
<
ITEM_AMOUNT_DATA
>
itemAmountList
=
ITEM_DATA
.
getITEM_AMOUNT_DATA
();
headMap
.
put
(
"SUMMARY_WAERQ"
+
(
i
+
1
),
SUMMARY_GENERAL
.
getWAERQ
());
ITEM_VAT_DATA
ITEM_VAT_DATA
=
ITEM_DATA
.
getITEM_VAT_DATA
();
List
<
ITEM_REFERENCE_PO_TYPE
>
poTypeList
=
ITEM_DATA
.
getITEM_REFERENCE_PO_TYPE
();
itemDataMap
.
put
(
"ID"
,
itemId
);
itemDataMap
.
put
(
"HEADER_ID"
,
headerId
);
if
(
ITEM_DATA
!=
null
)
{
itemDataMap
.
put
(
"POSEX"
,
ITEM_DATA
.
getPOSEX
());
itemDataMap
.
put
(
"MENGE"
,
ITEM_DATA
.
getMENGE
());
itemDataMap
.
put
(
"MENEE"
,
ITEM_DATA
.
getMENEE
());
itemDataMap
.
put
(
"WERKS"
,
ITEM_DATA
.
getWERKS
());
}
if
(
ITEM_REFERENCE_DATA
!=
null
)
{
itemDataMap
.
put
(
"REFERENCE_QUALF"
,
ITEM_REFERENCE_DATA
.
getQUALF
());
itemDataMap
.
put
(
"REFERENCE_BELNR"
,
ITEM_REFERENCE_DATA
.
getBELNR
());
itemDataMap
.
put
(
"REFERENCE_ZEILE"
,
ITEM_REFERENCE_DATA
.
getZEILE
());
}
if
(
ITEM_MATERIAL_DATA
!=
null
)
{
itemDataMap
.
put
(
"MATERIAL_QUALF"
,
ITEM_MATERIAL_DATA
.
getQUALF
());
itemDataMap
.
put
(
"MATERIAL_IDTNR"
,
ITEM_MATERIAL_DATA
.
getIDTNR
());
itemDataMap
.
put
(
"MATERIAL_DIDTNR"
,
null
);
}
}
if
(
itemAmountList
!=
null
)
{
}
for
(
int
i
=
0
;
i
<
itemAmountList
.
size
();
i
++)
{
headMap
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_BATCH_"
+
dateString
));
ITEM_AMOUNT_DATA
ITEM_AMOUNT_DATA
=
itemAmountList
.
get
(
i
);
headMap
.
put
(
"SEND_STATUS"
,
'N'
);
headMap
.
put
(
"AMOUNT_QUALF"
+
(
i
+
1
),
ITEM_AMOUNT_DATA
.
getQUALF
());
headMap
.
put
(
"SEND_TIME"
,
now
);
headMap
.
put
(
"AMOUNT_BETRG"
+
(
i
+
1
),
ITEM_AMOUNT_DATA
.
getBETRG
());
headMap
.
put
(
"TRACE_NO"
,
"sapproformainvoice"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
headMap
.
put
(
"CREATED"
,
now
);
headMap
.
put
(
"CREATEDBY"
,
"system"
);
headMap
.
put
(
"UPDATED"
,
null
);
headMap
.
put
(
"UPDATEDBY"
,
null
);
List
<
Map
<
String
,
Object
>>
itemDatas
=
new
ArrayList
<
Map
<
String
,
Object
>>();
if
(
itemList
!=
null
)
{
for
(
ITEM_DATA
ITEM_DATA
:
itemList
)
{
Map
<
String
,
Object
>
itemDataMap
=
new
HashMap
<
String
,
Object
>();
Long
itemId
=
Long
.
valueOf
(
""
+
System
.
currentTimeMillis
()
+
StringUtil
.
format
(
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_ID_"
+
dateString
),
"00000"
));
ITEM_REFERENCE_DATA
ITEM_REFERENCE_DATA
=
ITEM_DATA
.
getITEM_REFERENCE_DATA
();
ITEM_MATERIAL_DATA
ITEM_MATERIAL_DATA
=
ITEM_DATA
.
getITEM_MATERIAL_DATA
();
List
<
ITEM_AMOUNT_DATA
>
itemAmountList
=
ITEM_DATA
.
getITEM_AMOUNT_DATA
();
ITEM_VAT_DATA
ITEM_VAT_DATA
=
ITEM_DATA
.
getITEM_VAT_DATA
();
List
<
ITEM_REFERENCE_PO_TYPE
>
poTypeList
=
ITEM_DATA
.
getITEM_REFERENCE_PO_TYPE
();
itemDataMap
.
put
(
"ID"
,
itemId
);
itemDataMap
.
put
(
"HEADER_ID"
,
headerId
);
if
(
ITEM_DATA
!=
null
)
{
itemDataMap
.
put
(
"POSEX"
,
ITEM_DATA
.
getPOSEX
());
itemDataMap
.
put
(
"MENGE"
,
ITEM_DATA
.
getMENGE
());
itemDataMap
.
put
(
"MENEE"
,
ITEM_DATA
.
getMENEE
());
itemDataMap
.
put
(
"WERKS"
,
ITEM_DATA
.
getWERKS
());
}
}
}
if
(
ITEM_REFERENCE_DATA
!=
null
)
{
if
(
ITEM_VAT_DATA
!=
null
)
{
itemDataMap
.
put
(
"REFERENCE_QUALF"
,
ITEM_REFERENCE_DATA
.
getQUALF
());
itemDataMap
.
put
(
"VAT_MWSKZ"
,
ITEM_VAT_DATA
.
getMWSKZ
());
itemDataMap
.
put
(
"REFERENCE_BELNR"
,
ITEM_REFERENCE_DATA
.
getBELNR
());
itemDataMap
.
put
(
"VAT_MWSBT"
,
ITEM_VAT_DATA
.
getMWSBT
());
itemDataMap
.
put
(
"REFERENCE_ZEILE"
,
ITEM_REFERENCE_DATA
.
getZEILE
());
}
}
if
(
poTypeList
!=
null
)
{
if
(
ITEM_MATERIAL_DATA
!=
null
)
{
for
(
int
i
=
0
;
i
<
poTypeList
.
size
();
i
++)
{
itemDataMap
.
put
(
"MATERIAL_QUALF"
,
ITEM_MATERIAL_DATA
.
getQUALF
());
ITEM_REFERENCE_PO_TYPE
ITEM_REFERENCE_PO_TYPE
=
poTypeList
.
get
(
i
);
itemDataMap
.
put
(
"MATERIAL_IDTNR"
,
ITEM_MATERIAL_DATA
.
getIDTNR
());
headMap
.
put
(
"REFERENCE_PO_TYPE_TDID"
+
(
i
+
1
),
ITEM_REFERENCE_PO_TYPE
.
getTDID
());
itemDataMap
.
put
(
"MATERIAL_DIDTNR"
,
null
);
headMap
.
put
(
"REFERENCE_PO_DATA_TDLINE"
+
(
i
+
1
),
ITEM_REFERENCE_PO_TYPE
.
getITEM_REFERENCE_PO_DATA
().
getTDLINE
());
}
if
(
itemAmountList
!=
null
)
{
for
(
int
i
=
0
;
i
<
itemAmountList
.
size
();
i
++)
{
ITEM_AMOUNT_DATA
ITEM_AMOUNT_DATA
=
itemAmountList
.
get
(
i
);
headMap
.
put
(
"AMOUNT_QUALF"
+
(
i
+
1
),
ITEM_AMOUNT_DATA
.
getQUALF
());
headMap
.
put
(
"AMOUNT_BETRG"
+
(
i
+
1
),
ITEM_AMOUNT_DATA
.
getBETRG
());
}
}
}
if
(
ITEM_VAT_DATA
!=
null
)
{
itemDataMap
.
put
(
"VAT_MWSKZ"
,
ITEM_VAT_DATA
.
getMWSKZ
());
itemDataMap
.
put
(
"VAT_MWSBT"
,
ITEM_VAT_DATA
.
getMWSBT
());
}
if
(
poTypeList
!=
null
)
{
for
(
int
i
=
0
;
i
<
poTypeList
.
size
();
i
++)
{
ITEM_REFERENCE_PO_TYPE
ITEM_REFERENCE_PO_TYPE
=
poTypeList
.
get
(
i
);
headMap
.
put
(
"REFERENCE_PO_TYPE_TDID"
+
(
i
+
1
),
ITEM_REFERENCE_PO_TYPE
.
getTDID
());
headMap
.
put
(
"REFERENCE_PO_DATA_TDLINE"
+
(
i
+
1
),
ITEM_REFERENCE_PO_TYPE
.
getITEM_REFERENCE_PO_DATA
().
getTDLINE
());
}
}
itemDataMap
.
put
(
"CREATED"
,
now
);
itemDataMap
.
put
(
"CREATEDBY"
,
"system"
);
itemDataMap
.
put
(
"UPDATED"
,
headerId
);
itemDataMap
.
put
(
"UPDATEDBY"
,
headerId
);
itemDatas
.
add
(
itemDataMap
);
}
}
itemDataMap
.
put
(
"CREATED"
,
now
);
}
itemDataMap
.
put
(
"CREATEDBY"
,
"system"
);
Sql
headerSql
=
SqlUtil
.
insertSql
(
"t_perform_invoice_header"
,
headMap
);
itemDataMap
.
put
(
"UPDATED"
,
headerId
);
jdbcTemplate
.
update
(
headerSql
.
getSql
(),
headerSql
.
getArgs
());
itemDataMap
.
put
(
"UPDATEDBY"
,
headerId
);
Sql
itemDataSql
=
SqlUtil
.
insertSqlBatch
(
"t_perform_invoice_item"
,
itemDatas
);
itemDatas
.
add
(
itemDataMap
);
jdbcTemplate
.
batchUpdate
(
itemDataSql
.
getSql
(),
itemDataSql
.
getBachArgs
());
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
Z_MT_SD_005_PERFORM_INVOICE
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_005_PERFORM_INVOICE
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
}
Sql
headerSql
=
SqlUtil
.
insertSql
(
"t_perform_invoice_header"
,
headMap
);
jdbcTemplate
.
update
(
headerSql
.
getSql
(),
headerSql
.
getArgs
());
Sql
itemDataSql
=
SqlUtil
.
insertSqlBatch
(
"t_perform_invoice_item"
,
itemDatas
);
jdbcTemplate
.
batchUpdate
(
itemDataSql
.
getSql
(),
itemDataSql
.
getBachArgs
());
}
}
}
}
src/main/java/com/egolm/sso/services/price_list/PriceListServiceImpl.java
View file @
2d3d5753
...
@@ -10,16 +10,20 @@ import java.util.Map.Entry;
...
@@ -10,16 +10,20 @@ import java.util.Map.Entry;
import
javax.jws.WebService
;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.HEADER_SENDING
;
import
com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.HEADER_SENDING
;
import
com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.ITEM
;
import
com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.ITEM
;
import
com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.RECORD
;
import
com.egolm.sso.services.price_list.Z_MT_SD_002_PRICE_LIST.RECORD
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
@Component
@Component
...
@@ -32,56 +36,73 @@ public class PriceListServiceImpl implements PriceListService {
...
@@ -32,56 +36,73 @@ public class PriceListServiceImpl implements PriceListService {
@Autowired
@Autowired
CommonService
common
;
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Override
@Transactional
@Transactional
public
void
execute
(
Z_MT_SD_002_PRICE_LIST
Z_MT_SD_002_PRICE_LIST
)
{
public
void
execute
(
Z_MT_SD_002_PRICE_LIST
Z_MT_SD_002_PRICE_LIST
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
System
.
out
.
println
(
new
Gson
().
toJson
(
Z_MT_SD_002_PRICE_LIST
));
System
.
out
.
println
(
new
Gson
().
toJson
(
Z_MT_SD_002_PRICE_LIST
));
RECORD
r
=
Z_MT_SD_002_PRICE_LIST
.
getRECORD
();
try
{
HEADER_SENDING
h
=
r
.
getHEADER_SENDING
();
RECORD
r
=
Z_MT_SD_002_PRICE_LIST
.
getRECORD
();
List
<
ITEM
>
items
=
r
.
getITEM
();
HEADER_SENDING
h
=
r
.
getHEADER_SENDING
();
List
<
ITEM
>
items
=
r
.
getITEM
();
String
KUNNR
=
h
.
getKUNNR
();
String
DATUM
=
h
.
getDATUM
();
String
UZEIT
=
h
.
getUZEIT
();
for
(
ITEM
item
:
items
)
{
String
MATNR
=
item
.
getMATNR
();
Map
<
String
,
Object
>
priceObj
=
getPriceObj
(
KUNNR
,
MATNR
);
if
(
priceObj
==
null
)
{
priceObj
=
new
HashMap
<>();
}
priceObj
.
put
(
"KUNNR"
,
KUNNR
);
String
KUNNR
=
h
.
getKUNNR
();
priceObj
.
put
(
"DATUM"
,
DateUtil
.
parseDate
(
DATUM
,
DateUtil
.
FMT_DATE
));
String
DATUM
=
h
.
getDATUM
();
priceObj
.
put
(
"UZEIT"
,
DateUtil
.
parseDate
(
UZEIT
,
DateUtil
.
FMT_TIME
));
String
UZEIT
=
h
.
getUZEIT
();
priceObj
.
put
(
"MATNR"
,
MATNR
);
for
(
ITEM
item
:
items
)
{
String
MATNR
=
item
.
getMATNR
();
priceObj
.
put
(
"KBETR"
,
StringUtil
.
toDouble
(
item
.
getKBETR
()));
Map
<
String
,
Object
>
priceObj
=
getPriceObj
(
KUNNR
,
MATNR
);
priceObj
.
put
(
"KONWA"
,
item
.
getKONWA
());
if
(
priceObj
==
null
)
{
priceObj
.
put
(
"KPEIN"
,
item
.
getKPEIN
());
priceObj
=
new
HashMap
<>();
priceObj
.
put
(
"KMEIN"
,
item
.
getKMEIN
());
}
priceObj
.
put
(
"UMREZ"
,
item
.
getUMREZ
());
priceObj
.
put
(
"MAKTX"
,
item
.
getMAKTX
());
priceObj
.
put
(
"KUNNR"
,
KUNNR
);
priceObj
.
put
(
"PRSCH"
,
StringUtil
.
toDouble
(
item
.
getPRSCH
()));
priceObj
.
put
(
"DATUM"
,
DateUtil
.
parseDate
(
DATUM
,
DateUtil
.
FMT_DATE
));
priceObj
.
put
(
"DATAM"
,
DateUtil
.
parseDate
(
item
.
getDATAM
(),
DateUtil
.
FMT_DATE
));
priceObj
.
put
(
"UZEIT"
,
DateUtil
.
parseDate
(
UZEIT
,
DateUtil
.
FMT_TIME
));
priceObj
.
put
(
"DATBI"
,
DateUtil
.
parseDateNoEmpty
(
item
.
getDATBI
(),
DateUtil
.
FMT_DATE
));
priceObj
.
put
(
"MATNR"
,
MATNR
);
priceObj
.
put
(
"PLINE"
,
item
.
getPLINE
());
priceObj
.
put
(
"PRSCH_1"
,
StringUtil
.
toDouble
(
item
.
getPRSCH_1
()));
priceObj
.
put
(
"KBETR"
,
StringUtil
.
toDouble
(
item
.
getKBETR
()));
/*
priceObj
.
put
(
"KONWA"
,
item
.
getKONWA
());
priceObj.put("SEND_DATE", new Date(0));// 发送时间
priceObj
.
put
(
"KPEIN"
,
item
.
getKPEIN
());
*/
priceObj
.
put
(
"KMEIN"
,
item
.
getKMEIN
());
priceObj
.
put
(
"SEND_STATUS"
,
"N"
);
priceObj
.
put
(
"UMREZ"
,
item
.
getUMREZ
());
Long
BATCHID
=
common
.
getNextval
(
"T_PRICE_LIST_BATCH_"
+
today
);
priceObj
.
put
(
"MAKTX"
,
item
.
getMAKTX
());
String
BATCH
=
today
+
"-"
+
BATCHID
;
priceObj
.
put
(
"PRSCH"
,
StringUtil
.
toDouble
(
item
.
getPRSCH
()));
priceObj
.
put
(
"DATAM"
,
DateUtil
.
parseDate
(
item
.
getDATAM
(),
DateUtil
.
FMT_DATE
));
priceObj
.
put
(
"DATBI"
,
DateUtil
.
parseDateNoEmpty
(
item
.
getDATBI
(),
DateUtil
.
FMT_DATE
));
priceObj
.
put
(
"PLINE"
,
item
.
getPLINE
());
priceObj
.
put
(
"PRSCH_1"
,
StringUtil
.
toDouble
(
item
.
getPRSCH_1
()));
/*
priceObj.put("SEND_DATE", new Date(0));// 发送时间
*/
priceObj
.
put
(
"SEND_STATUS"
,
"N"
);
Long
BATCHID
=
common
.
getNextval
(
"T_PRICE_LIST_BATCH_"
+
dateString
);
String
BATCH
=
dateString
+
"-"
+
BATCHID
;
priceObj
.
put
(
"TRACE_NO"
,
"sappricelist"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
priceObj
.
put
(
"TRACE_NO"
,
"sappricelist"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
priceObj
.
put
(
"BATCH"
,
BATCH
);
priceObj
.
put
(
"BATCH"
,
BATCH
);
if
(
priceObj
.
get
(
"ID"
)
!=
null
)
{
if
(
priceObj
.
get
(
"ID"
)
!=
null
)
{
updatePriceObj
(
priceObj
);
updatePriceObj
(
priceObj
);
}
else
{
}
else
{
insertPriceObj
(
priceObj
);
insertPriceObj
(
priceObj
);
}
}
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
Z_MT_SD_002_PRICE_LIST
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_002_PRICE_LIST
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
}
}
}
}
...
...
src/main/java/com/egolm/sso/services/shipping_notfirmation/ShippingNotificationServiceImpl.java
View file @
2d3d5753
...
@@ -10,11 +10,13 @@ import java.util.Map.Entry;
...
@@ -10,11 +10,13 @@ import java.util.Map.Entry;
import
javax.jws.WebService
;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.HEADER_DATE
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.HEADER_DATE
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.HEADER_DELIVERY
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.HEADER_DELIVERY
;
...
@@ -25,7 +27,9 @@ import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRM
...
@@ -25,7 +27,9 @@ import com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRM
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.ITEM_REFERENCE_SO
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.ITEM_REFERENCE_SO
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
;
import
com.egolm.sso.services.shipping_notfirmation.Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@Component
@WebService
(
serviceName
=
"ShippingNotificationService"
,
targetNamespace
=
"http://shipping_notfirmation.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.shipping_notfirmation.ShippingNotificationService"
)
@WebService
(
serviceName
=
"ShippingNotificationService"
,
targetNamespace
=
"http://shipping_notfirmation.sso.egolm.com"
,
endpointInterface
=
"com.egolm.sso.services.shipping_notfirmation.ShippingNotificationService"
)
...
@@ -38,101 +42,117 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
...
@@ -38,101 +42,117 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
@Autowired
@Autowired
CommonService
common
;
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Override
@Transactional
@Transactional
public
void
execute
(
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
)
{
public
void
execute
(
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
)
{
boolean
isSuccess
=
true
;
System
.
out
.
println
(
JSON
.
toJSONString
(
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
));
System
.
out
.
println
(
JSON
.
toJSONString
(
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
));
Date
now
=
new
Date
();
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
Long
time
=
now
.
getTime
();
try
{
Map
<
String
,
Object
>
header
=
new
HashMap
<>();
Map
<
String
,
Object
>
header
=
new
HashMap
<>();
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
=
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
.
getZ_DT_SD_007_SHIPPING_NOTIFICATION_FILE
();
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
=
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
.
getZ_DT_SD_007_SHIPPING_NOTIFICATION_FILE
();
HEADER_DELIVERY
HEADER_DELIVERY
=
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
.
getHEADER_DELIVERY
();
HEADER_DELIVERY
HEADER_DELIVERY
=
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
.
getHEADER_DELIVERY
();
header
.
put
(
"DELIVERY_VBELN"
,
HEADER_DELIVERY
.
getVBELN
());
header
.
put
(
"DELIVERY_VBELN"
,
HEADER_DELIVERY
.
getVBELN
());
header
.
put
(
"DELIVERY_LFART"
,
HEADER_DELIVERY
.
getLFART
());
header
.
put
(
"DELIVERY_LFART"
,
HEADER_DELIVERY
.
getLFART
());
header
.
put
(
"DELIVERY_INCO1"
,
HEADER_DELIVERY
.
getINCO1
());
header
.
put
(
"DELIVERY_INCO1"
,
HEADER_DELIVERY
.
getINCO1
());
header
.
put
(
"DELIVERY_BTGEW"
,
StringUtil
.
toDouble
(
HEADER_DELIVERY
.
getBTGEW
()));
header
.
put
(
"DELIVERY_BTGEW"
,
StringUtil
.
toDouble
(
HEADER_DELIVERY
.
getBTGEW
()));
header
.
put
(
"DELIVERY_GEWEI"
,
HEADER_DELIVERY
.
getGEWEI
());
header
.
put
(
"DELIVERY_GEWEI"
,
HEADER_DELIVERY
.
getGEWEI
());
header
.
put
(
"DELIVERY_CMGST"
,
HEADER_DELIVERY
.
getCMGST
());
header
.
put
(
"DELIVERY_CMGST"
,
HEADER_DELIVERY
.
getCMGST
());
header
.
put
(
"DELIVERY_VKORG"
,
HEADER_DELIVERY
.
getVKORG
());
header
.
put
(
"DELIVERY_VKORG"
,
HEADER_DELIVERY
.
getVKORG
());
List
<
HEADER_PARTNER
>
HEADER_PARTNERs
=
HEADER_DELIVERY
.
getHEADER_PARTNER
();
List
<
HEADER_PARTNER
>
HEADER_PARTNERs
=
HEADER_DELIVERY
.
getHEADER_PARTNER
();
for
(
int
i
=
0
;
i
<
HEADER_PARTNERs
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
HEADER_PARTNERs
.
size
();
i
++)
{
HEADER_PARTNER
HEADER_PARTNER
=
HEADER_PARTNERs
.
get
(
i
);
HEADER_PARTNER
HEADER_PARTNER
=
HEADER_PARTNERs
.
get
(
i
);
String
PARTNER_Q
=
HEADER_PARTNER
.
getPARTNER_Q
();
String
PARTNER_Q
=
HEADER_PARTNER
.
getPARTNER_Q
();
String
PARTNER_ID
=
HEADER_PARTNER
.
getPARTNER_ID
();
String
PARTNER_ID
=
HEADER_PARTNER
.
getPARTNER_ID
();
String
NAME1
=
HEADER_PARTNER
.
getNAME1
();
String
NAME1
=
HEADER_PARTNER
.
getNAME1
();
String
NAME2
=
HEADER_PARTNER
.
getNAME2
();
String
NAME2
=
HEADER_PARTNER
.
getNAME2
();
String
POSTL_COD1
=
HEADER_PARTNER
.
getPOSTL_COD1
();
String
POSTL_COD1
=
HEADER_PARTNER
.
getPOSTL_COD1
();
String
CITY1
=
HEADER_PARTNER
.
getCITY1
();
String
CITY1
=
HEADER_PARTNER
.
getCITY1
();
if
(
PARTNER_Q
!=
null
)
{
if
(
PARTNER_Q
!=
null
)
{
header
.
put
(
"PARTNER_Q"
+(
i
+
1
),
PARTNER_Q
);
header
.
put
(
"PARTNER_Q"
+(
i
+
1
),
PARTNER_Q
);
}
}
if
(
PARTNER_ID
!=
null
)
{
if
(
PARTNER_ID
!=
null
)
{
header
.
put
(
"PARTNER_ID"
+(
i
+
1
),
PARTNER_ID
);
header
.
put
(
"PARTNER_ID"
+(
i
+
1
),
PARTNER_ID
);
}
}
if
(
NAME1
!=
null
)
{
if
(
NAME1
!=
null
)
{
header
.
put
(
"PARTNER_NAME1_"
+(
i
+
1
),
NAME1
);
header
.
put
(
"PARTNER_NAME1_"
+(
i
+
1
),
NAME1
);
}
}
if
(
NAME2
!=
null
)
{
if
(
NAME2
!=
null
)
{
header
.
put
(
"PARTNER_NAME2_"
+(
i
+
1
),
NAME2
);
header
.
put
(
"PARTNER_NAME2_"
+(
i
+
1
),
NAME2
);
}
}
if
(
POSTL_COD1
!=
null
)
{
if
(
POSTL_COD1
!=
null
)
{
header
.
put
(
"PARTNER_POSTLCOD1_"
+(
i
+
1
),
POSTL_COD1
);
header
.
put
(
"PARTNER_POSTLCOD1_"
+(
i
+
1
),
POSTL_COD1
);
}
}
if
(
CITY1
!=
null
)
{
if
(
CITY1
!=
null
)
{
header
.
put
(
"PARTNER_CITY1_"
+(
i
+
1
),
CITY1
);
header
.
put
(
"PARTNER_CITY1_"
+(
i
+
1
),
CITY1
);
}
}
}
}
List
<
HEADER_DATE
>
HEADER_DATEs
=
HEADER_DELIVERY
.
getHEADER_DATE
();
List
<
HEADER_DATE
>
HEADER_DATEs
=
HEADER_DELIVERY
.
getHEADER_DATE
();
if
(
HEADER_DATEs
!=
null
&&
HEADER_DATEs
.
size
()>
0
)
{
if
(
HEADER_DATEs
!=
null
&&
HEADER_DATEs
.
size
()>
0
)
{
HEADER_DATE
HEADER_DATE
=
HEADER_DATEs
.
get
(
0
);
HEADER_DATE
HEADER_DATE
=
HEADER_DATEs
.
get
(
0
);
header
.
put
(
"QUALF"
,
HEADER_DATE
.
getQUALF
());
header
.
put
(
"QUALF"
,
HEADER_DATE
.
getQUALF
());
header
.
put
(
"NTEND"
,
HEADER_DATE
.
getNTEND
());
header
.
put
(
"NTEND"
,
HEADER_DATE
.
getNTEND
());
}
header
.
put
(
"BATCH"
,
today
+
"-"
+
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_HEADER_BATCH_"
+
today
));
header
.
put
(
"SEND_STATUS"
,
"N"
);
header
.
put
(
"TRACE_NO"
,
"sapshippingnotification"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
header
.
put
(
"CREATED"
,
now
);
header
.
put
(
"CREATEDBY"
,
"system"
);
Long
hID
=
Long
.
valueOf
(
time
+
StringUtil
.
format
(
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_HEADER_ID_"
+
today
),
"00000"
));
header
.
put
(
"ID"
,
hID
);
insertTo
(
header
,
"t_shipping_notification_header"
);
List
<
ITEM
>
ITEMs
=
HEADER_DELIVERY
.
getITEM
();
for
(
ITEM
ITEM
:
ITEMs
)
{
Map
<
String
,
Object
>
item
=
new
HashMap
<>();
Long
iID
=
Long
.
valueOf
(
time
+
StringUtil
.
format
(
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_ITEM_ID_"
+
today
),
"00000"
));
item
.
put
(
"ID"
,
iID
);
item
.
put
(
"HEADER_ID"
,
hID
);
item
.
put
(
"POSNR"
,
ITEM
.
getPOSNR
());
item
.
put
(
"VTWEG"
,
ITEM
.
getVTWEG
());
item
.
put
(
"MATNR"
,
ITEM
.
getMATNR
());
item
.
put
(
"DMATNR"
,
ITEM
.
getDMATNR
());
item
.
put
(
"LFIMG"
,
ITEM
.
getLFIMG
());
item
.
put
(
"VRKME"
,
ITEM
.
getVRKME
());
List
<
ITEM_REFERENCE_SO
>
ITEM_REFERENCE_SOs
=
ITEM
.
getITEM_REFERENCE_SO
();
if
(
ITEM_REFERENCE_SOs
!=
null
&&
ITEM_REFERENCE_SOs
.
size
()>
0
)
{
ITEM_REFERENCE_SO
ITEM_REFERENCE_SO
=
ITEM_REFERENCE_SOs
.
get
(
0
);
item
.
put
(
"REFERENCE_SO_QUALF"
,
ITEM_REFERENCE_SO
.
getQUALF
());
item
.
put
(
"REFERENCE_SO_BELNR"
,
ITEM_REFERENCE_SO
.
getBELNR
());
item
.
put
(
"REFERENCE_SO_POSNR"
,
ITEM_REFERENCE_SO
.
getPOSNR
());
}
}
List
<
ITEM_REFERENCE_PO_TYPE
>
ITEM_REFERENCE_PO_TYPEs
=
ITEM
.
getITEM_REFERENCE_PO_TYPE
();
header
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_HEADER_BATCH_"
+
dateString
));
for
(
int
i
=
0
;
i
<
ITEM_REFERENCE_PO_TYPEs
.
size
();
i
++)
{
header
.
put
(
"SEND_STATUS"
,
"N"
);
ITEM_REFERENCE_PO_TYPE
ITEM_REFERENCE_PO_TYPE
=
ITEM_REFERENCE_PO_TYPEs
.
get
(
i
);
header
.
put
(
"TRACE_NO"
,
"sapshippingnotification"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
item
.
put
(
"REFERENCE_PO_TYPE_TDID"
+(
i
+
1
),
ITEM_REFERENCE_PO_TYPE
.
getTDID
());
header
.
put
(
"CREATED"
,
now
);
List
<
ITEM_REFERENCE_PO_DATA
>
ITEM_REFERENCE_PO_DATAs
=
ITEM_REFERENCE_PO_TYPE
.
getITEM_REFERENCE_PO_DATA
();
header
.
put
(
"CREATEDBY"
,
"system"
);
if
(
ITEM_REFERENCE_PO_DATAs
!=
null
&&
ITEM_REFERENCE_PO_DATAs
.
size
()>
0
)
{
Long
hID
=
Long
.
valueOf
(
time
+
StringUtil
.
format
(
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_HEADER_ID_"
+
dateString
),
"00000"
));
ITEM_REFERENCE_PO_DATA
ITEM_REFERENCE_PO_DATA
=
ITEM_REFERENCE_PO_DATAs
.
get
(
0
);
header
.
put
(
"ID"
,
hID
);
item
.
put
(
"REFERENCE_PO_TYPE_TDLINE"
+(
i
+
1
),
ITEM_REFERENCE_PO_DATA
.
getTDLINE
());
insertTo
(
header
,
"t_shipping_notification_header"
);
List
<
ITEM
>
ITEMs
=
HEADER_DELIVERY
.
getITEM
();
for
(
ITEM
ITEM
:
ITEMs
)
{
Map
<
String
,
Object
>
item
=
new
HashMap
<>();
Long
iID
=
Long
.
valueOf
(
time
+
StringUtil
.
format
(
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_ITEM_ID_"
+
dateString
),
"00000"
));
item
.
put
(
"ID"
,
iID
);
item
.
put
(
"HEADER_ID"
,
hID
);
item
.
put
(
"POSNR"
,
ITEM
.
getPOSNR
());
item
.
put
(
"VTWEG"
,
ITEM
.
getVTWEG
());
item
.
put
(
"MATNR"
,
ITEM
.
getMATNR
());
item
.
put
(
"DMATNR"
,
ITEM
.
getDMATNR
());
item
.
put
(
"LFIMG"
,
ITEM
.
getLFIMG
());
item
.
put
(
"VRKME"
,
ITEM
.
getVRKME
());
List
<
ITEM_REFERENCE_SO
>
ITEM_REFERENCE_SOs
=
ITEM
.
getITEM_REFERENCE_SO
();
if
(
ITEM_REFERENCE_SOs
!=
null
&&
ITEM_REFERENCE_SOs
.
size
()>
0
)
{
ITEM_REFERENCE_SO
ITEM_REFERENCE_SO
=
ITEM_REFERENCE_SOs
.
get
(
0
);
item
.
put
(
"REFERENCE_SO_QUALF"
,
ITEM_REFERENCE_SO
.
getQUALF
());
item
.
put
(
"REFERENCE_SO_BELNR"
,
ITEM_REFERENCE_SO
.
getBELNR
());
item
.
put
(
"REFERENCE_SO_POSNR"
,
ITEM_REFERENCE_SO
.
getPOSNR
());
}
}
List
<
ITEM_REFERENCE_PO_TYPE
>
ITEM_REFERENCE_PO_TYPEs
=
ITEM
.
getITEM_REFERENCE_PO_TYPE
();
for
(
int
i
=
0
;
i
<
ITEM_REFERENCE_PO_TYPEs
.
size
();
i
++)
{
ITEM_REFERENCE_PO_TYPE
ITEM_REFERENCE_PO_TYPE
=
ITEM_REFERENCE_PO_TYPEs
.
get
(
i
);
item
.
put
(
"REFERENCE_PO_TYPE_TDID"
+(
i
+
1
),
ITEM_REFERENCE_PO_TYPE
.
getTDID
());
List
<
ITEM_REFERENCE_PO_DATA
>
ITEM_REFERENCE_PO_DATAs
=
ITEM_REFERENCE_PO_TYPE
.
getITEM_REFERENCE_PO_DATA
();
if
(
ITEM_REFERENCE_PO_DATAs
!=
null
&&
ITEM_REFERENCE_PO_DATAs
.
size
()>
0
)
{
ITEM_REFERENCE_PO_DATA
ITEM_REFERENCE_PO_DATA
=
ITEM_REFERENCE_PO_DATAs
.
get
(
0
);
item
.
put
(
"REFERENCE_PO_TYPE_TDLINE"
+(
i
+
1
),
ITEM_REFERENCE_PO_DATA
.
getTDLINE
());
}
}
item
.
put
(
"CREATED"
,
now
);
item
.
put
(
"CREATEDBY"
,
"system"
);
insertTo
(
item
,
"t_shipping_notification_item"
);
}
}
catch
(
Exception
e
)
{
isSuccess
=
false
;
throw
new
XRException
(
"数据保存失败"
,
e
);
}
finally
{
String
xmlName
=
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
.
getClass
().
getSimpleName
();
try
{
String
xml
=
XMLUtil
.
toXml
(
Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE
);
String
xmlFullName
=
xmlRoot
+
"/sap/"
+
xmlName
+
"/"
+
DateUtil
.
formatDate
(
new
Date
(),
DateUtil
.
FMT_DATE
)
+
"/"
+
(
isSuccess
?
"success"
:
"error"
)
+
"/"
+
xmlName
+
"-"
+
common
.
getNextval
(
xmlName
+
"_"
+
dateString
)
+
".XML"
;
FileUtil
.
writeText
(
xmlFullName
,
xml
);
}
catch
(
Exception
e
)
{
throw
new
XRException
(
"报文保存失败"
,
e
);
}
}
item
.
put
(
"CREATED"
,
now
);
item
.
put
(
"CREATEDBY"
,
"system"
);
insertTo
(
item
,
"t_shipping_notification_item"
);
}
}
}
}
...
...
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