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;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSON
;
import
com.egolm.sso.config.XRException
;
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.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.RESPONSE
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@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 {
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
Z_MT_SD_008_SO_CONFIRM_QUOTATION
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
System
.
out
.
println
(
JSON
.
toJSONString
(
Z_MT_SD_008_SO_CONFIRM_QUOTATION
));
Map
<
String
,
Object
>
header
=
new
HashMap
<>();
RESPONSE
res
=
Z_MT_SD_008_SO_CONFIRM_QUOTATION
.
getRESPONSE
();
HEADER
h
=
res
.
getHEADER
();
header
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
header
.
put
(
"VBELN"
,
h
.
getVBELN
());
header
.
put
(
"VKORG"
,
h
.
getVKORG
());
header
.
put
(
"VTWEG"
,
h
.
getVTWEG
());
header
.
put
(
"SPART"
,
h
.
getSPART
());
header
.
put
(
"ERNAM"
,
h
.
getERNAM
());
header
.
put
(
"BSTDK"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getBSTDK
(),
DateUtil
.
FMT_DATE
));
header
.
put
(
"ERZET"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getERZET
(),
DateUtil
.
FMT_TIME
));
header
.
put
(
"ERDAT"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getERDAT
(),
DateUtil
.
FMT_DATE
));
header
.
put
(
"KUNNR"
,
h
.
getKUNNR
());
header
.
put
(
"KGNNR"
,
h
.
getKGNNR
());
header
.
put
(
"NAME1"
,
h
.
getNAME1
());
header
.
put
(
"NAME2"
,
h
.
getNAME2
());
header
.
put
(
"POSTL_COD1"
,
h
.
getPOSTL_COD1
());
header
.
put
(
"CITY1"
,
h
.
getCITY1
());
header
.
put
(
"ZZPROM"
,
h
.
getZZPROM
());
header
.
put
(
"BSTKD"
,
h
.
getBSTKD
());
header
.
put
(
"AUART"
,
h
.
getAUART
());
header
.
put
(
"CMGST"
,
h
.
getCMGST
());
header
.
put
(
"NETWRH"
,
StringUtil
.
toDouble
(
h
.
getNETWRH
()));
header
.
put
(
"MWSTH"
,
StringUtil
.
toDouble
(
h
.
getMWSTH
()));
header
.
put
(
"WAERK"
,
h
.
getWAERK
());
header
.
put
(
"DPFLAG"
,
h
.
getDPFLAG
());
header
.
put
(
"SEND_STATUS"
,
"N"
);
header
.
put
(
"BATCH"
,
today
+
common
.
getNextval
(
"T_SO_CONFIRMACTION_HEADER_BATCH_"
)+
today
);
header
.
put
(
"CREATED"
,
now
);
header
.
put
(
"CREATEDBY"
,
"system"
);
String
idIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_HEADER_ID_"
+
today
),
"00000"
);
Long
hID
=
Long
.
valueOf
(
time
+
idIndex
);
header
.
put
(
"ID"
,
hID
);
header
.
put
(
"TRACE_NO"
,
"sapsoconfirmquotation"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
insertTo
(
header
,
"t_so_confirmation_header"
);
List
<
ITEM_DATA
>
ids
=
res
.
getITEM_DATA
();
Map
<
String
,
Map
<
String
,
Object
>>
itemDatas
=
new
HashMap
<>();
for
(
ITEM_DATA
id
:
ids
)
{
Map
<
String
,
Object
>
itemData
=
new
HashMap
<>();
itemData
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
itemData
.
put
(
"VBELN"
,
h
.
getVBELN
());
itemData
.
put
(
"HEADER_ID"
,
hID
);
itemData
.
put
(
"POSNR"
,
id
.
getPOSNR
());
itemData
.
put
(
"UEPOS"
,
id
.
getUEPOS
());
itemData
.
put
(
"VTEXT"
,
id
.
getVTEXT
());
itemData
.
put
(
"MATNR"
,
id
.
getMATNR
());
itemData
.
put
(
"KWMENG"
,
StringUtil
.
toDouble
(
id
.
getKWMENG
()));
itemData
.
put
(
"VRKME"
,
id
.
getVRKME
());
itemData
.
put
(
"EDATU"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getEDATU
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"CDATE"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getCDATE
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"REFLAG"
,
id
.
getREFLAG
());
itemData
.
put
(
"MWSTI"
,
StringUtil
.
toDouble
(
id
.
getMWSTI
()));
itemData
.
put
(
"NETWRI"
,
StringUtil
.
toDouble
(
id
.
getNETWRI
()));
itemData
.
put
(
"WAERK_I"
,
id
.
getWAERK_I
());
itemData
.
put
(
"WERKS"
,
id
.
getWERKS
());
itemData
.
put
(
"ZZCRDDATE"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getZZCRDDATE
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"KGNNR_I"
,
id
.
getKGNNR_I
());
itemData
.
put
(
"NAME1_I"
,
id
.
getNAME1_I
());
itemData
.
put
(
"NAME2_I"
,
id
.
getNAME2_I
());
itemData
.
put
(
"POSTL_CODE1_I"
,
id
.
getPOSTL_COD1_I
());
itemData
.
put
(
"CITY1_I"
,
id
.
getCITY1_I
());
itemData
.
put
(
"CREATED"
,
now
);
itemData
.
put
(
"CREATEDBY"
,
"system"
);
String
iidIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_DATA_ID_"
+
today
),
"00000"
);
Long
iID
=
Long
.
valueOf
(
time
+
iidIndex
);
itemData
.
put
(
"ID"
,
iID
);
itemDatas
.
put
(
id
.
getPOSNR
(),
itemData
);
insertTo
(
itemData
,
"t_so_confirmation_item_data"
);
}
List
<
ITEM_PRICING
>
ips
=
res
.
getITEM_PRICING
();
for
(
ITEM_PRICING
ip
:
ips
)
{
Map
<
String
,
Object
>
itemPricing
=
new
HashMap
<>();
itemPricing
.
put
(
"HEADER_ID"
,
hID
);
String
POSNR
=
ip
.
getPOSNR
();
itemPricing
.
put
(
"ITEM_DATA_ID"
,
itemDatas
.
get
(
POSNR
).
get
(
"ID"
));
itemPricing
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
itemPricing
.
put
(
"VBELN"
,
h
.
getVBELN
());
itemPricing
.
put
(
"POSNR"
,
POSNR
);
itemPricing
.
put
(
"KSCHL"
,
ip
.
getKSCHL
());
itemPricing
.
put
(
"VTEXT"
,
ip
.
getVTEXT
());
itemPricing
.
put
(
"KBETR"
,
StringUtil
.
toDouble
(
ip
.
getKBETR
()));
itemPricing
.
put
(
"KWERT"
,
StringUtil
.
toDouble
(
ip
.
getKWERT
()));
itemPricing
.
put
(
"CREATED"
,
now
);
itemPricing
.
put
(
"CREATEDBY"
,
"system"
);
String
itemPricingID
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_PRICING_ID_"
+
today
),
"00000"
);
itemPricing
.
put
(
"ID"
,
Long
.
valueOf
(
time
+
itemPricingID
));
insertTo
(
itemPricing
,
"t_so_confirmation_item_pricing"
);
try
{
Map
<
String
,
Object
>
header
=
new
HashMap
<>();
RESPONSE
res
=
Z_MT_SD_008_SO_CONFIRM_QUOTATION
.
getRESPONSE
();
HEADER
h
=
res
.
getHEADER
();
header
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
header
.
put
(
"VBELN"
,
h
.
getVBELN
());
header
.
put
(
"VKORG"
,
h
.
getVKORG
());
header
.
put
(
"VTWEG"
,
h
.
getVTWEG
());
header
.
put
(
"SPART"
,
h
.
getSPART
());
header
.
put
(
"ERNAM"
,
h
.
getERNAM
());
header
.
put
(
"BSTDK"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getBSTDK
(),
DateUtil
.
FMT_DATE
));
header
.
put
(
"ERZET"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getERZET
(),
DateUtil
.
FMT_TIME
));
header
.
put
(
"ERDAT"
,
DateUtil
.
parseDateNoEmpty
(
h
.
getERDAT
(),
DateUtil
.
FMT_DATE
));
header
.
put
(
"KUNNR"
,
h
.
getKUNNR
());
header
.
put
(
"KGNNR"
,
h
.
getKGNNR
());
header
.
put
(
"NAME1"
,
h
.
getNAME1
());
header
.
put
(
"NAME2"
,
h
.
getNAME2
());
header
.
put
(
"POSTL_COD1"
,
h
.
getPOSTL_COD1
());
header
.
put
(
"CITY1"
,
h
.
getCITY1
());
header
.
put
(
"ZZPROM"
,
h
.
getZZPROM
());
header
.
put
(
"BSTKD"
,
h
.
getBSTKD
());
header
.
put
(
"AUART"
,
h
.
getAUART
());
header
.
put
(
"CMGST"
,
h
.
getCMGST
());
header
.
put
(
"NETWRH"
,
StringUtil
.
toDouble
(
h
.
getNETWRH
()));
header
.
put
(
"MWSTH"
,
StringUtil
.
toDouble
(
h
.
getMWSTH
()));
header
.
put
(
"WAERK"
,
h
.
getWAERK
());
header
.
put
(
"DPFLAG"
,
h
.
getDPFLAG
());
header
.
put
(
"SEND_STATUS"
,
"N"
);
header
.
put
(
"BATCH"
,
dateString
+
common
.
getNextval
(
"T_SO_CONFIRMACTION_HEADER_BATCH_"
)+
dateString
);
header
.
put
(
"CREATED"
,
now
);
header
.
put
(
"CREATEDBY"
,
"system"
);
String
idIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_HEADER_ID_"
+
dateString
),
"00000"
);
Long
hID
=
Long
.
valueOf
(
time
+
idIndex
);
header
.
put
(
"ID"
,
hID
);
header
.
put
(
"TRACE_NO"
,
"sapsoconfirmquotation"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
insertTo
(
header
,
"t_so_confirmation_header"
);
List
<
ITEM_DATA
>
ids
=
res
.
getITEM_DATA
();
Map
<
String
,
Map
<
String
,
Object
>>
itemDatas
=
new
HashMap
<>();
for
(
ITEM_DATA
id
:
ids
)
{
Map
<
String
,
Object
>
itemData
=
new
HashMap
<>();
itemData
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
itemData
.
put
(
"VBELN"
,
h
.
getVBELN
());
itemData
.
put
(
"HEADER_ID"
,
hID
);
itemData
.
put
(
"POSNR"
,
id
.
getPOSNR
());
itemData
.
put
(
"UEPOS"
,
id
.
getUEPOS
());
itemData
.
put
(
"VTEXT"
,
id
.
getVTEXT
());
itemData
.
put
(
"MATNR"
,
id
.
getMATNR
());
itemData
.
put
(
"KWMENG"
,
StringUtil
.
toDouble
(
id
.
getKWMENG
()));
itemData
.
put
(
"VRKME"
,
id
.
getVRKME
());
itemData
.
put
(
"EDATU"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getEDATU
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"CDATE"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getCDATE
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"REFLAG"
,
id
.
getREFLAG
());
itemData
.
put
(
"MWSTI"
,
StringUtil
.
toDouble
(
id
.
getMWSTI
()));
itemData
.
put
(
"NETWRI"
,
StringUtil
.
toDouble
(
id
.
getNETWRI
()));
itemData
.
put
(
"WAERK_I"
,
id
.
getWAERK_I
());
itemData
.
put
(
"WERKS"
,
id
.
getWERKS
());
itemData
.
put
(
"ZZCRDDATE"
,
DateUtil
.
parseDateNoEmpty
(
id
.
getZZCRDDATE
(),
DateUtil
.
FMT_DATE
));
itemData
.
put
(
"KGNNR_I"
,
id
.
getKGNNR_I
());
itemData
.
put
(
"NAME1_I"
,
id
.
getNAME1_I
());
itemData
.
put
(
"NAME2_I"
,
id
.
getNAME2_I
());
itemData
.
put
(
"POSTL_CODE1_I"
,
id
.
getPOSTL_COD1_I
());
itemData
.
put
(
"CITY1_I"
,
id
.
getCITY1_I
());
itemData
.
put
(
"CREATED"
,
now
);
itemData
.
put
(
"CREATEDBY"
,
"system"
);
String
iidIndex
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_DATA_ID_"
+
dateString
),
"00000"
);
Long
iID
=
Long
.
valueOf
(
time
+
iidIndex
);
itemData
.
put
(
"ID"
,
iID
);
itemDatas
.
put
(
id
.
getPOSNR
(),
itemData
);
insertTo
(
itemData
,
"t_so_confirmation_item_data"
);
}
List
<
ITEM_PRICING
>
ips
=
res
.
getITEM_PRICING
();
for
(
ITEM_PRICING
ip
:
ips
)
{
Map
<
String
,
Object
>
itemPricing
=
new
HashMap
<>();
itemPricing
.
put
(
"HEADER_ID"
,
hID
);
String
POSNR
=
ip
.
getPOSNR
();
itemPricing
.
put
(
"ITEM_DATA_ID"
,
itemDatas
.
get
(
POSNR
).
get
(
"ID"
));
itemPricing
.
put
(
"BSTKD_E"
,
h
.
getBSTKD_E
());
itemPricing
.
put
(
"VBELN"
,
h
.
getVBELN
());
itemPricing
.
put
(
"POSNR"
,
POSNR
);
itemPricing
.
put
(
"KSCHL"
,
ip
.
getKSCHL
());
itemPricing
.
put
(
"VTEXT"
,
ip
.
getVTEXT
());
itemPricing
.
put
(
"KBETR"
,
StringUtil
.
toDouble
(
ip
.
getKBETR
()));
itemPricing
.
put
(
"KWERT"
,
StringUtil
.
toDouble
(
ip
.
getKWERT
()));
itemPricing
.
put
(
"CREATED"
,
now
);
itemPricing
.
put
(
"CREATEDBY"
,
"system"
);
String
itemPricingID
=
StringUtil
.
format
(
common
.
getNextval
(
"T_SO_CONFIRMATION_ITEM_PRICING_ID_"
+
dateString
),
"00000"
);
itemPricing
.
put
(
"ID"
,
Long
.
valueOf
(
time
+
itemPricingID
));
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;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.sso.config.XRException
;
import
com.egolm.sso.services.CommonService
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.SqlUtil.Sql
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@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 {
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
DELETED_DOCUMENTS
DELETED_DOCUMENTS
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"MSGID"
,
DELETED_DOCUMENTS
.
getMSGID
());
map
.
put
(
"TARGET_SYSTEM"
,
DELETED_DOCUMENTS
.
getTARGET_SYSTEM
());
map
.
put
(
"DOCTYPE"
,
DELETED_DOCUMENTS
.
getDOCTYPE
());
map
.
put
(
"DOCNUMBER"
,
DELETED_DOCUMENTS
.
getDOCNUMBER
());
map
.
put
(
"SALES_ORG"
,
DELETED_DOCUMENTS
.
getSALES_ORG
());
map
.
put
(
"DELETED_BY"
,
DELETED_DOCUMENTS
.
getDELETED_BY
());
map
.
put
(
"SOLD_TO"
,
DELETED_DOCUMENTS
.
getSOLD_TO
());
map
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_SO_DN_DELETION_BATCH"
+
dateString
));
map
.
put
(
"SEND_STATUS"
,
"N"
);
map
.
put
(
"SEND_TIME"
,
now
);
map
.
put
(
"CREATED"
,
now
);
map
.
put
(
"CREATEDBY"
,
"system"
);
map
.
put
(
"UPDATED"
,
now
);
map
.
put
(
"UPDATEDBY"
,
"system"
);
Sql
headerSql
=
SqlUtil
.
insertSql
(
"t_so_dn_deletion"
,
map
);
jdbcTemplate
.
update
(
headerSql
.
getSql
(),
headerSql
.
getArgs
());
try
{
Map
<
String
,
Object
>
map
=
new
HashMap
<
String
,
Object
>();
map
.
put
(
"MSGID"
,
DELETED_DOCUMENTS
.
getMSGID
());
map
.
put
(
"TARGET_SYSTEM"
,
DELETED_DOCUMENTS
.
getTARGET_SYSTEM
());
map
.
put
(
"DOCTYPE"
,
DELETED_DOCUMENTS
.
getDOCTYPE
());
map
.
put
(
"DOCNUMBER"
,
DELETED_DOCUMENTS
.
getDOCNUMBER
());
map
.
put
(
"SALES_ORG"
,
DELETED_DOCUMENTS
.
getSALES_ORG
());
map
.
put
(
"DELETED_BY"
,
DELETED_DOCUMENTS
.
getDELETED_BY
());
map
.
put
(
"SOLD_TO"
,
DELETED_DOCUMENTS
.
getSOLD_TO
());
map
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_SO_DN_DELETION_BATCH"
+
dateString
));
map
.
put
(
"SEND_STATUS"
,
"N"
);
map
.
put
(
"SEND_TIME"
,
now
);
map
.
put
(
"CREATED"
,
now
);
map
.
put
(
"CREATEDBY"
,
"system"
);
map
.
put
(
"UPDATED"
,
now
);
map
.
put
(
"UPDATEDBY"
,
"system"
);
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 {
String
xmlName
=
Z_MT_SD_001_MATERIAL_MASTER
.
getClass
().
getSimpleName
();
try
{
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
);
}
catch
(
Exception
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;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.sso.config.XRException
;
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_DOCU_DATE
;
...
...
@@ -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.Z_DT_SD_005_PERFORM_INVOICE
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.SqlUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.SqlUtil.Sql
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@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 {
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
Z_MT_SD_005_PERFORM_INVOICE
Z_MT_SD_005_PERFORM_INVOICE
)
{
boolean
isSuccess
=
true
;
Date
now
=
new
Date
();
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Map
<
String
,
Object
>
headMap
=
new
HashMap
<
String
,
Object
>();
Z_DT_SD_005_PERFORM_INVOICE
Z_DT_SD_005_PERFORM_INVOICE
=
Z_MT_SD_005_PERFORM_INVOICE
.
getZ_DT_SD_005_PERFORM_INVOICE
();
HEADER_GENERAL_DATA
HEADER_GENERAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_GENERAL_DATA
();
List
<
HEADER_PARTNER_DATA
>
partnerList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_PARTNER_DATA
();
HEADER_DOCU_DATE
HEADER_DOCU_DATE
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_DOCU_DATE
();
HEADER_REFERENCE_DATA
HEADER_REFERENCE_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_REFERENCE_DATA
();
HEADER_BANK_DATA
HEADER_BANK_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_BANK_DATA
();
HEADER_ORGANIZATIONAL_DATA
HEADER_ORGANIZATIONAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_ORGANIZATIONAL_DATA
();
List
<
SUMMARY_GENERAL
>
summaryList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getSUMMARY_GENERAL
();
List
<
ITEM_DATA
>
itemList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getITEM_DATA
();
Long
headerId
=
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_ID"
);
headMap
.
put
(
"ID"
,
headerId
);
if
(
HEADER_GENERAL_DATA
!=
null
)
{
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
(
"AG"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
headMap
.
put
(
"PARTNER_PARVW1"
,
HEADER_PARTNER_DATA
.
getPARVW
());
headMap
.
put
(
"PARTNER_PARTN1"
,
HEADER_PARTNER_DATA
.
getPARTN
());
}
else
if
(
"WE"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
headMap
.
put
(
"PARTNER_PARVW2"
,
HEADER_PARTNER_DATA
.
getPARVW
());
headMap
.
put
(
"PARTNER_PARTN2"
,
HEADER_PARTNER_DATA
.
getPARTN
());
try
{
Map
<
String
,
Object
>
headMap
=
new
HashMap
<
String
,
Object
>();
Z_DT_SD_005_PERFORM_INVOICE
Z_DT_SD_005_PERFORM_INVOICE
=
Z_MT_SD_005_PERFORM_INVOICE
.
getZ_DT_SD_005_PERFORM_INVOICE
();
HEADER_GENERAL_DATA
HEADER_GENERAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_GENERAL_DATA
();
List
<
HEADER_PARTNER_DATA
>
partnerList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_PARTNER_DATA
();
HEADER_DOCU_DATE
HEADER_DOCU_DATE
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_DOCU_DATE
();
HEADER_REFERENCE_DATA
HEADER_REFERENCE_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_REFERENCE_DATA
();
HEADER_BANK_DATA
HEADER_BANK_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_BANK_DATA
();
HEADER_ORGANIZATIONAL_DATA
HEADER_ORGANIZATIONAL_DATA
=
Z_DT_SD_005_PERFORM_INVOICE
.
getHEADER_ORGANIZATIONAL_DATA
();
List
<
SUMMARY_GENERAL
>
summaryList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getSUMMARY_GENERAL
();
List
<
ITEM_DATA
>
itemList
=
Z_DT_SD_005_PERFORM_INVOICE
.
getITEM_DATA
();
Long
headerId
=
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_ID"
);
headMap
.
put
(
"ID"
,
headerId
);
if
(
HEADER_GENERAL_DATA
!=
null
)
{
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
(
"AG"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
headMap
.
put
(
"PARTNER_PARVW1"
,
HEADER_PARTNER_DATA
.
getPARVW
());
headMap
.
put
(
"PARTNER_PARTN1"
,
HEADER_PARTNER_DATA
.
getPARTN
());
}
else
if
(
"WE"
.
equals
(
HEADER_PARTNER_DATA
.
getPARVW
()))
{
headMap
.
put
(
"PARTNER_PARVW2"
,
HEADER_PARTNER_DATA
.
getPARVW
());
headMap
.
put
(
"PARTNER_PARTN2"
,
HEADER_PARTNER_DATA
.
getPARTN
());
}
}
}
}
if
(
HEADER_DOCU_DATE
!=
null
)
{
headMap
.
put
(
"DOCU_IDDAT"
,
HEADER_DOCU_DATE
.
getIDDAT
());
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_DOCU_DATE
!=
null
)
{
headMap
.
put
(
"DOCU_IDDAT"
,
HEADER_DOCU_DATE
.
getIDDAT
());
headMap
.
put
(
"DOCU_DATUM"
,
HEADER_DOCU_DATE
.
getDATUM
());
}
}
headMap
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_BATCH_"
+
dateString
));
headMap
.
put
(
"SEND_STATUS"
,
'N'
);
headMap
.
put
(
"SEND_TIME"
,
now
);
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
)
{
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
(
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
(
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
());
}
headMap
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_PERFORM_INVOICE_HEADER_BATCH_"
+
dateString
));
headMap
.
put
(
"SEND_STATUS"
,
'N'
);
headMap
.
put
(
"SEND_TIME"
,
now
);
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_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
());
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
++)
{
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"
);
itemDataMap
.
put
(
"UPDATED"
,
headerId
);
itemDataMap
.
put
(
"UPDATEDBY"
,
headerId
);
itemDatas
.
add
(
itemDataMap
);
}
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
());
}
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;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.egolm.sso.config.XRException
;
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.ITEM
;
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.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
import
com.google.gson.Gson
;
@Component
...
...
@@ -32,56 +36,73 @@ public class PriceListServiceImpl implements PriceListService {
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
public
void
execute
(
Z_MT_SD_002_PRICE_LIST
Z_MT_SD_002_PRICE_LIST
)
{
boolean
isSuccess
=
true
;
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
));
RECORD
r
=
Z_MT_SD_002_PRICE_LIST
.
getRECORD
();
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
<>();
}
try
{
RECORD
r
=
Z_MT_SD_002_PRICE_LIST
.
getRECORD
();
HEADER_SENDING
h
=
r
.
getHEADER_SENDING
();
List
<
ITEM
>
items
=
r
.
getITEM
();
priceObj
.
put
(
"KUNNR"
,
KUNNR
);
priceObj
.
put
(
"DATUM"
,
DateUtil
.
parseDate
(
DATUM
,
DateUtil
.
FMT_DATE
));
priceObj
.
put
(
"UZEIT"
,
DateUtil
.
parseDate
(
UZEIT
,
DateUtil
.
FMT_TIME
));
priceObj
.
put
(
"MATNR"
,
MATNR
);
priceObj
.
put
(
"KBETR"
,
StringUtil
.
toDouble
(
item
.
getKBETR
()));
priceObj
.
put
(
"KONWA"
,
item
.
getKONWA
());
priceObj
.
put
(
"KPEIN"
,
item
.
getKPEIN
());
priceObj
.
put
(
"KMEIN"
,
item
.
getKMEIN
());
priceObj
.
put
(
"UMREZ"
,
item
.
getUMREZ
());
priceObj
.
put
(
"MAKTX"
,
item
.
getMAKTX
());
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_"
+
today
);
String
BATCH
=
today
+
"-"
+
BATCHID
;
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
);
priceObj
.
put
(
"DATUM"
,
DateUtil
.
parseDate
(
DATUM
,
DateUtil
.
FMT_DATE
));
priceObj
.
put
(
"UZEIT"
,
DateUtil
.
parseDate
(
UZEIT
,
DateUtil
.
FMT_TIME
));
priceObj
.
put
(
"MATNR"
,
MATNR
);
priceObj
.
put
(
"KBETR"
,
StringUtil
.
toDouble
(
item
.
getKBETR
()));
priceObj
.
put
(
"KONWA"
,
item
.
getKONWA
());
priceObj
.
put
(
"KPEIN"
,
item
.
getKPEIN
());
priceObj
.
put
(
"KMEIN"
,
item
.
getKMEIN
());
priceObj
.
put
(
"UMREZ"
,
item
.
getUMREZ
());
priceObj
.
put
(
"MAKTX"
,
item
.
getMAKTX
());
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
(
"BATCH"
,
BATCH
);
if
(
priceObj
.
get
(
"ID"
)
!=
null
)
{
updatePriceObj
(
priceObj
);
}
else
{
insertPriceObj
(
priceObj
);
priceObj
.
put
(
"TRACE_NO"
,
"sappricelist"
+
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATETIME
));
priceObj
.
put
(
"BATCH"
,
BATCH
);
if
(
priceObj
.
get
(
"ID"
)
!=
null
)
{
updatePriceObj
(
priceObj
);
}
else
{
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;
import
javax.jws.WebService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Component
;
import
org.springframework.transaction.annotation.Transactional
;
import
com.alibaba.fastjson.JSON
;
import
com.egolm.sso.config.XRException
;
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_DELIVERY
;
...
...
@@ -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.Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
;
import
com.egolm.sso.util.DateUtil
;
import
com.egolm.sso.util.FileUtil
;
import
com.egolm.sso.util.StringUtil
;
import
com.egolm.sso.util.XMLUtil
;
@Component
@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
@Autowired
CommonService
common
;
@Value
(
"${xmlRoot}"
)
private
String
xmlRoot
;
@Override
@Transactional
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
));
Date
now
=
new
Date
();
String
today
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
String
dateString
=
DateUtil
.
formatDate
(
now
,
DateUtil
.
FMT_DATE
);
Long
time
=
now
.
getTime
();
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
();
HEADER_DELIVERY
HEADER_DELIVERY
=
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
.
getHEADER_DELIVERY
();
header
.
put
(
"DELIVERY_VBELN"
,
HEADER_DELIVERY
.
getVBELN
());
header
.
put
(
"DELIVERY_LFART"
,
HEADER_DELIVERY
.
getLFART
());
header
.
put
(
"DELIVERY_INCO1"
,
HEADER_DELIVERY
.
getINCO1
());
header
.
put
(
"DELIVERY_BTGEW"
,
StringUtil
.
toDouble
(
HEADER_DELIVERY
.
getBTGEW
()));
header
.
put
(
"DELIVERY_GEWEI"
,
HEADER_DELIVERY
.
getGEWEI
());
header
.
put
(
"DELIVERY_CMGST"
,
HEADER_DELIVERY
.
getCMGST
());
header
.
put
(
"DELIVERY_VKORG"
,
HEADER_DELIVERY
.
getVKORG
());
List
<
HEADER_PARTNER
>
HEADER_PARTNERs
=
HEADER_DELIVERY
.
getHEADER_PARTNER
();
for
(
int
i
=
0
;
i
<
HEADER_PARTNERs
.
size
();
i
++)
{
HEADER_PARTNER
HEADER_PARTNER
=
HEADER_PARTNERs
.
get
(
i
);
String
PARTNER_Q
=
HEADER_PARTNER
.
getPARTNER_Q
();
String
PARTNER_ID
=
HEADER_PARTNER
.
getPARTNER_ID
();
String
NAME1
=
HEADER_PARTNER
.
getNAME1
();
String
NAME2
=
HEADER_PARTNER
.
getNAME2
();
String
POSTL_COD1
=
HEADER_PARTNER
.
getPOSTL_COD1
();
String
CITY1
=
HEADER_PARTNER
.
getCITY1
();
if
(
PARTNER_Q
!=
null
)
{
header
.
put
(
"PARTNER_Q"
+(
i
+
1
),
PARTNER_Q
);
}
if
(
PARTNER_ID
!=
null
)
{
header
.
put
(
"PARTNER_ID"
+(
i
+
1
),
PARTNER_ID
);
}
if
(
NAME1
!=
null
)
{
header
.
put
(
"PARTNER_NAME1_"
+(
i
+
1
),
NAME1
);
}
if
(
NAME2
!=
null
)
{
header
.
put
(
"PARTNER_NAME2_"
+(
i
+
1
),
NAME2
);
}
if
(
POSTL_COD1
!=
null
)
{
header
.
put
(
"PARTNER_POSTLCOD1_"
+(
i
+
1
),
POSTL_COD1
);
}
if
(
CITY1
!=
null
)
{
header
.
put
(
"PARTNER_CITY1_"
+(
i
+
1
),
CITY1
);
try
{
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
();
HEADER_DELIVERY
HEADER_DELIVERY
=
Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE
.
getHEADER_DELIVERY
();
header
.
put
(
"DELIVERY_VBELN"
,
HEADER_DELIVERY
.
getVBELN
());
header
.
put
(
"DELIVERY_LFART"
,
HEADER_DELIVERY
.
getLFART
());
header
.
put
(
"DELIVERY_INCO1"
,
HEADER_DELIVERY
.
getINCO1
());
header
.
put
(
"DELIVERY_BTGEW"
,
StringUtil
.
toDouble
(
HEADER_DELIVERY
.
getBTGEW
()));
header
.
put
(
"DELIVERY_GEWEI"
,
HEADER_DELIVERY
.
getGEWEI
());
header
.
put
(
"DELIVERY_CMGST"
,
HEADER_DELIVERY
.
getCMGST
());
header
.
put
(
"DELIVERY_VKORG"
,
HEADER_DELIVERY
.
getVKORG
());
List
<
HEADER_PARTNER
>
HEADER_PARTNERs
=
HEADER_DELIVERY
.
getHEADER_PARTNER
();
for
(
int
i
=
0
;
i
<
HEADER_PARTNERs
.
size
();
i
++)
{
HEADER_PARTNER
HEADER_PARTNER
=
HEADER_PARTNERs
.
get
(
i
);
String
PARTNER_Q
=
HEADER_PARTNER
.
getPARTNER_Q
();
String
PARTNER_ID
=
HEADER_PARTNER
.
getPARTNER_ID
();
String
NAME1
=
HEADER_PARTNER
.
getNAME1
();
String
NAME2
=
HEADER_PARTNER
.
getNAME2
();
String
POSTL_COD1
=
HEADER_PARTNER
.
getPOSTL_COD1
();
String
CITY1
=
HEADER_PARTNER
.
getCITY1
();
if
(
PARTNER_Q
!=
null
)
{
header
.
put
(
"PARTNER_Q"
+(
i
+
1
),
PARTNER_Q
);
}
if
(
PARTNER_ID
!=
null
)
{
header
.
put
(
"PARTNER_ID"
+(
i
+
1
),
PARTNER_ID
);
}
if
(
NAME1
!=
null
)
{
header
.
put
(
"PARTNER_NAME1_"
+(
i
+
1
),
NAME1
);
}
if
(
NAME2
!=
null
)
{
header
.
put
(
"PARTNER_NAME2_"
+(
i
+
1
),
NAME2
);
}
if
(
POSTL_COD1
!=
null
)
{
header
.
put
(
"PARTNER_POSTLCOD1_"
+(
i
+
1
),
POSTL_COD1
);
}
if
(
CITY1
!=
null
)
{
header
.
put
(
"PARTNER_CITY1_"
+(
i
+
1
),
CITY1
);
}
}
}
List
<
HEADER_DATE
>
HEADER_DATEs
=
HEADER_DELIVERY
.
getHEADER_DATE
();
if
(
HEADER_DATEs
!=
null
&&
HEADER_DATEs
.
size
()>
0
)
{
HEADER_DATE
HEADER_DATE
=
HEADER_DATEs
.
get
(
0
);
header
.
put
(
"QUALF"
,
HEADER_DATE
.
getQUALF
());
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
<
HEADER_DATE
>
HEADER_DATEs
=
HEADER_DELIVERY
.
getHEADER_DATE
();
if
(
HEADER_DATEs
!=
null
&&
HEADER_DATEs
.
size
()>
0
)
{
HEADER_DATE
HEADER_DATE
=
HEADER_DATEs
.
get
(
0
);
header
.
put
(
"QUALF"
,
HEADER_DATE
.
getQUALF
());
header
.
put
(
"NTEND"
,
HEADER_DATE
.
getNTEND
());
}
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
());
header
.
put
(
"BATCH"
,
dateString
+
"-"
+
common
.
getNextval
(
"T_SHIPPING_NOTIFICATION_HEADER_BATCH_"
+
dateString
));
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_"
+
dateString
),
"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_"
+
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