Commit 076ea7fe authored by Quxl's avatar Quxl

x

parent bacdd330
...@@ -54,7 +54,10 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -54,7 +54,10 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
Date now = new Date(); Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS"); String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE); String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapsoconfirmquotation"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
Long time = now.getTime(); Long time = now.getTime();
String KUNNR = null;
String VBELN = null;
try { 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();
...@@ -65,10 +68,10 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -65,10 +68,10 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
header.put("MSGTXT", MESSAGE.getMSGTXT()); header.put("MSGTXT", MESSAGE.getMSGTXT());
} }
if(h != null) { if(h != null) {
String KUNNR = h.getKUNNR(); KUNNR = h.getKUNNR();
VBELN = h.getVBELN();
header.put("BSTKD_E", h.getBSTKD_E()); header.put("BSTKD_E", h.getBSTKD_E());
header.put("VBELN", h.getVBELN()); header.put("VBELN", VBELN);
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());
...@@ -102,7 +105,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -102,7 +105,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
String idIndex = StringUtil.getIndex("T_SO_CONFIRMATION_HEADER_ID"); String idIndex = StringUtil.getIndex("T_SO_CONFIRMATION_HEADER_ID");
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", TRACE_NO);
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<>();
...@@ -163,8 +166,20 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -163,8 +166,20 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
} }
} }
} }
try {
common.saveApiAccessLog("execute", "/confirm_quotation", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try {
common.saveApiAccessLog("execute", "/confirm_quotation", "ERROR");
common.saveOrderTracking(TRACE_NO, "SoConfirmQuotation", VBELN, KUNNR, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e); throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally { } finally {
String xmlName = Z_MT_SD_008_SO_CONFIRM_QUOTATION.getClass().getSimpleName(); String xmlName = Z_MT_SD_008_SO_CONFIRM_QUOTATION.getClass().getSimpleName();
...@@ -174,7 +189,6 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService { ...@@ -174,7 +189,6 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_008_SO_CONFIRM_QUOTATION); String json = new Gson().toJson(Z_MT_SD_008_SO_CONFIRM_QUOTATION);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/confirm_quotation", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -48,10 +48,12 @@ public class DNDeletionServiceImpl implements DNDeletionService { ...@@ -48,10 +48,12 @@ public class DNDeletionServiceImpl implements DNDeletionService {
Date now = new Date(); Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS"); String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE); String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapsodndeletion" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String SOLD_TO = null;
try { try {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
Long ID = Long.valueOf("" + System.currentTimeMillis() + StringUtil.getIndex("T_SO_DN_DELETION_ID")); Long ID = Long.valueOf("" + System.currentTimeMillis() + StringUtil.getIndex("T_SO_DN_DELETION_ID"));
String SOLD_TO = DELETED_DOCUMENTS.getSOLD_TO(); SOLD_TO = DELETED_DOCUMENTS.getSOLD_TO();
map.put("ID", ID); map.put("ID", ID);
map.put("MESSAGE_ID", DELETED_DOCUMENTS.getMSGID()); map.put("MESSAGE_ID", DELETED_DOCUMENTS.getMSGID());
map.put("TARGET_SYSTEM", DELETED_DOCUMENTS.getTARGET_SYSTEM()); map.put("TARGET_SYSTEM", DELETED_DOCUMENTS.getTARGET_SYSTEM());
...@@ -65,7 +67,7 @@ public class DNDeletionServiceImpl implements DNDeletionService { ...@@ -65,7 +67,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
throw new XRException("Unable to generate batch number, [SOLD_TO] cannot be empty"); throw new XRException("Unable to generate batch number, [SOLD_TO] cannot be empty");
} }
map.put("BATCH", dateString + "-" + common.getNextval("T_SO_DN_DELETION_BATCH_" + SOLD_TO)); map.put("BATCH", dateString + "-" + common.getNextval("T_SO_DN_DELETION_BATCH_" + SOLD_TO));
map.put("TRACE_NO", "sapsodndeletion" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME)); map.put("TRACE_NO", TRACE_NO);
map.put("SEND_STATUS", "N"); map.put("SEND_STATUS", "N");
map.put("CREATED", now); map.put("CREATED", now);
map.put("CREATEBY", systemId); map.put("CREATEBY", systemId);
...@@ -73,8 +75,20 @@ public class DNDeletionServiceImpl implements DNDeletionService { ...@@ -73,8 +75,20 @@ public class DNDeletionServiceImpl implements DNDeletionService {
map.put("UPDATEBY", systemId); map.put("UPDATEBY", systemId);
Sql headerSql = SqlUtil.insertSql("t_so_dn_deletion", map); Sql headerSql = SqlUtil.insertSql("t_so_dn_deletion", map);
jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs()); jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs());
try {
common.saveApiAccessLog("execute", "/dn_deletion", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try {
common.saveApiAccessLog("execute", "/dn_deletion", "ERROR");
common.saveOrderTracking(TRACE_NO, "SODNDeletion", null, SOLD_TO, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e); throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally { } finally {
String xmlName = DELETED_DOCUMENTS.getClass().getSimpleName(); String xmlName = DELETED_DOCUMENTS.getClass().getSimpleName();
...@@ -84,7 +98,6 @@ public class DNDeletionServiceImpl implements DNDeletionService { ...@@ -84,7 +98,6 @@ public class DNDeletionServiceImpl implements DNDeletionService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(DELETED_DOCUMENTS); String json = new Gson().toJson(DELETED_DOCUMENTS);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/dn_deletion", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -51,10 +51,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -51,10 +51,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
boolean isSuccess = true; boolean isSuccess = true;
System.out.println(new Gson().toJson(Z_MT_SD_001_MATERIAL_MASTER)); System.out.println(new Gson().toJson(Z_MT_SD_001_MATERIAL_MASTER));
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE); String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapmaterialmaster" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String DIS_CODE = null;
try { try {
RECORD RECORD = Z_MT_SD_001_MATERIAL_MASTER.getRECORD(); RECORD RECORD = Z_MT_SD_001_MATERIAL_MASTER.getRECORD();
HEADER_SENDING HEADER_SENDING = RECORD.getHEADER_SENDING(); HEADER_SENDING HEADER_SENDING = RECORD.getHEADER_SENDING();
String DIS_CODE = null;
String DATUM = null; String DATUM = null;
String UZEIT = null; String UZEIT = null;
if(HEADER_SENDING != null) { if(HEADER_SENDING != null) {
...@@ -110,7 +111,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -110,7 +111,7 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
goods.put("MEABM_B", item.getMEABM_B()); goods.put("MEABM_B", item.getMEABM_B());
goods.put("PUBLIC", item.getPUBLIC()); goods.put("PUBLIC", item.getPUBLIC());
goods.put("INTERNET", item.getINTERNET()); goods.put("INTERNET", item.getINTERNET());
goods.put("TRACE_NO", "sapmaterialmaster" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME)); goods.put("TRACE_NO", TRACE_NO);
goods.put("BATCH", BATCH); goods.put("BATCH", BATCH);
goods.put("SEND_STATUS", "N"); goods.put("SEND_STATUS", "N");
if (goods.get("ID") != null) { if (goods.get("ID") != null) {
...@@ -121,8 +122,20 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -121,8 +122,20 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
} }
} }
} }
try {
common.saveApiAccessLog("execute", "/material_master", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try {
common.saveApiAccessLog("execute", "/material_master", "ERROR");
common.saveOrderTracking(TRACE_NO, "MaterialMaster", null, DIS_CODE, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e); throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally { } finally {
String xmlName = Z_MT_SD_001_MATERIAL_MASTER.getClass().getSimpleName(); String xmlName = Z_MT_SD_001_MATERIAL_MASTER.getClass().getSimpleName();
...@@ -132,7 +145,6 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -132,7 +145,6 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_001_MATERIAL_MASTER); String json = new Gson().toJson(Z_MT_SD_001_MATERIAL_MASTER);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/material_master", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -63,6 +63,8 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -63,6 +63,8 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
Date now = new Date(); Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS"); String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE); String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sapproformainvoice" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String BATCH_CODE = null;
try { try {
Map<String, Object> headMap = new HashMap<String, Object>(); 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(); Z_DT_SD_005_PERFORM_INVOICE Z_DT_SD_005_PERFORM_INVOICE = Z_MT_SD_005_PERFORM_INVOICE.getZ_DT_SD_005_PERFORM_INVOICE();
...@@ -80,7 +82,6 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -80,7 +82,6 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
headMap.put("GENERAL_BELNR", HEADER_GENERAL_DATA.getBELNR()); headMap.put("GENERAL_BELNR", HEADER_GENERAL_DATA.getBELNR());
headMap.put("GENERAL_ZTERM", HEADER_GENERAL_DATA.getZTERM()); headMap.put("GENERAL_ZTERM", HEADER_GENERAL_DATA.getZTERM());
} }
String BATCH_CODE = null;
if(partnerList != null) { if(partnerList != null) {
for(HEADER_PARTNER_DATA HEADER_PARTNER_DATA : partnerList) { for(HEADER_PARTNER_DATA HEADER_PARTNER_DATA : partnerList) {
if(HEADER_PARTNER_DATA != null) { if(HEADER_PARTNER_DATA != null) {
...@@ -156,7 +157,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -156,7 +157,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
throw new XRException("Unable to generate batch number, [PARTN] cannot be empty"); throw new XRException("Unable to generate batch number, [PARTN] cannot be empty");
} }
headMap.put("BATCH", dateString + "-" + common.getNextval("T_PERFORM_INVOICE_HEADER_BATCH_" + BATCH_CODE)); headMap.put("BATCH", dateString + "-" + common.getNextval("T_PERFORM_INVOICE_HEADER_BATCH_" + BATCH_CODE));
headMap.put("TRACE_NO", "sapproformainvoice" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME)); headMap.put("TRACE_NO", TRACE_NO);
headMap.put("CREATED", now); headMap.put("CREATED", now);
headMap.put("CREATEBY", systemId); headMap.put("CREATEBY", systemId);
...@@ -248,8 +249,20 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -248,8 +249,20 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs()); jdbcTemplate.update(headerSql.getSql(), headerSql.getArgs());
Sql itemDataSql = SqlUtil.insertSqlBatch("t_perform_invoice_item_data", itemDatas); Sql itemDataSql = SqlUtil.insertSqlBatch("t_perform_invoice_item_data", itemDatas);
jdbcTemplate.batchUpdate(itemDataSql.getSql(), itemDataSql.getBachArgs()); jdbcTemplate.batchUpdate(itemDataSql.getSql(), itemDataSql.getBachArgs());
try {
common.saveApiAccessLog("execute", "/prforma_invoice", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try {
common.saveApiAccessLog("execute", "/prforma_invoice", "ERROR");
common.saveOrderTracking(TRACE_NO, "ProFormaInvoice", null, BATCH_CODE, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e); throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally { } finally {
String xmlName = Z_MT_SD_005_PERFORM_INVOICE.getClass().getSimpleName(); String xmlName = Z_MT_SD_005_PERFORM_INVOICE.getClass().getSimpleName();
...@@ -259,7 +272,6 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService { ...@@ -259,7 +272,6 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_005_PERFORM_INVOICE); String json = new Gson().toJson(Z_MT_SD_005_PERFORM_INVOICE);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/prforma_invoice", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -51,13 +51,14 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -51,13 +51,14 @@ public class PriceListServiceImpl implements PriceListService {
Date now = new Date(); Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS"); String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE); String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
String TRACE_NO = "sappricelist" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String KUNNR = null;
try { try {
RECORD r = Z_MT_SD_002_PRICE_LIST.getRECORD(); RECORD r = Z_MT_SD_002_PRICE_LIST.getRECORD();
if(r != null) { if(r != null) {
HEADER_SENDING h = r.getHEADER_SENDING(); HEADER_SENDING h = r.getHEADER_SENDING();
List<ITEM> items = r.getITEM(); List<ITEM> items = r.getITEM();
String KUNNR = null;
String DATUM = null; String DATUM = null;
String UZEIT = null; String UZEIT = null;
if(h != null) { if(h != null) {
...@@ -93,7 +94,7 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -93,7 +94,7 @@ public class PriceListServiceImpl implements PriceListService {
priceObj.put("PLINE", item.getPLINE()); priceObj.put("PLINE", item.getPLINE());
priceObj.put("PRSCH_1", StringUtil.toDouble(item.getPRSCH_1())); priceObj.put("PRSCH_1", StringUtil.toDouble(item.getPRSCH_1()));
priceObj.put("SEND_STATUS", "N"); priceObj.put("SEND_STATUS", "N");
priceObj.put("TRACE_NO", "sappricelist" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME)); priceObj.put("TRACE_NO", TRACE_NO);
priceObj.put("BATCH", BATCH); priceObj.put("BATCH", BATCH);
if (priceObj.get("ID") != null) { if (priceObj.get("ID") != null) {
updatePriceObj(priceObj); updatePriceObj(priceObj);
...@@ -104,8 +105,20 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -104,8 +105,20 @@ public class PriceListServiceImpl implements PriceListService {
} }
} }
} }
try {
common.saveApiAccessLog("execute", "/price_list", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try {
common.saveApiAccessLog("execute", "/price_list", "ERROR");
common.saveOrderTracking(TRACE_NO, "PriceList", null, KUNNR, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e); throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally { } finally {
String xmlName = Z_MT_SD_002_PRICE_LIST.getClass().getSimpleName(); String xmlName = Z_MT_SD_002_PRICE_LIST.getClass().getSimpleName();
...@@ -115,7 +128,6 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -115,7 +128,6 @@ public class PriceListServiceImpl implements PriceListService {
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_002_PRICE_LIST); String json = new Gson().toJson(Z_MT_SD_002_PRICE_LIST);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/price_list", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -58,13 +58,15 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ ...@@ -58,13 +58,15 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS"); String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE); String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime(); Long time = now.getTime();
String TRACE_NO = "sapshippingnotification"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME);
String BATCH_CODE = null;
try { 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();
if(Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE != null) { if(Z_DT_SD_007_SHIPPING_NOTIFICATION_FILE != null) {
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();
if(HEADER_DELIVERY != null) { if(HEADER_DELIVERY != null) {
String BATCH_CODE = null;
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());
...@@ -114,7 +116,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ ...@@ -114,7 +116,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
} }
header.put("BATCH", dateString + "-" + common.getNextval("T_SHIPPING_NOTIFICATION_HEADER_BATCH_" + BATCH_CODE)); header.put("BATCH", dateString + "-" + common.getNextval("T_SHIPPING_NOTIFICATION_HEADER_BATCH_" + BATCH_CODE));
header.put("SEND_STATUS", "N"); header.put("SEND_STATUS", "N");
header.put("TRACE_NO", "sapshippingnotification"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME)); header.put("TRACE_NO", TRACE_NO);
header.put("CREATED", now); header.put("CREATED", now);
header.put("CREATEBY", systemId); header.put("CREATEBY", systemId);
Long hID = Long.valueOf(time + StringUtil.getIndex("T_SHIPPING_NOTIFICATION_HEADER_ID")); Long hID = Long.valueOf(time + StringUtil.getIndex("T_SHIPPING_NOTIFICATION_HEADER_ID"));
...@@ -172,8 +174,20 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ ...@@ -172,8 +174,20 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
} }
} }
} }
try {
common.saveApiAccessLog("execute", "/shipping_notfirmation", "SUCCESS");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (Exception e) { } catch (Exception e) {
isSuccess = false; isSuccess = false;
try {
common.saveApiAccessLog("execute", "/shipping_notfirmation", "ERROR");
common.saveOrderTracking(TRACE_NO, "ShippingNotification", null, BATCH_CODE, "U", "ERROR", ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString);
} catch (Throwable e1) {
e1.printStackTrace();
}
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e); throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally { } finally {
String xmlName = Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.getClass().getSimpleName(); String xmlName = Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE.getClass().getSimpleName();
...@@ -183,7 +197,6 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ ...@@ -183,7 +197,6 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
FileUtil.writeText(xmlFullName, xml); FileUtil.writeText(xmlFullName, xml);
String json = new Gson().toJson(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE); String json = new Gson().toJson(Z_MT_SD_007_SHIPPING_NOTFIRMATION_FILE);
FileUtil.writeText(xmlFullName + ".JSON", json); FileUtil.writeText(xmlFullName + ".JSON", json);
common.saveApiAccessLog("execute", "/shipping_notfirmation", isSuccess ? "SUCCESS" : "ERROR");
} catch (Exception e) { } catch (Exception e) {
throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e); throw new XRException(ThrowableUtil.getCaused(e).getMessage(), e);
} }
......
...@@ -9,11 +9,13 @@ import java.util.Map; ...@@ -9,11 +9,13 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.system.ApplicationHome; import org.springframework.boot.system.ApplicationHome;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
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.services.CommonService;
import com.egolm.sso.util.ServiceFactory; import com.egolm.sso.util.ServiceFactory;
import com.schneider_distributor.ZDTSD009SOCREATION.Header; import com.schneider_distributor.ZDTSD009SOCREATION.Header;
import com.schneider_distributor.ZDTSD009SOCREATION.ITEM; import com.schneider_distributor.ZDTSD009SOCREATION.ITEM;
...@@ -24,6 +26,9 @@ public class ZMISD009SOCREATIONTask { ...@@ -24,6 +26,9 @@ public class ZMISD009SOCREATIONTask {
@Autowired @Autowired
private JdbcTemplate jdbcTemplate; private JdbcTemplate jdbcTemplate;
@Autowired
private CommonService common;
@Value("${schneider.username}") @Value("${schneider.username}")
private String username; private String username;
...@@ -54,49 +59,65 @@ public class ZMISD009SOCREATIONTask { ...@@ -54,49 +59,65 @@ public class ZMISD009SOCREATIONTask {
List<Map<String, Object>> headerList = jdbcTemplate.queryForList("SELECT * FROM t_so_creation_header WHERE SEND_STATUS = ? LIMIT ?", "N", 1); List<Map<String, Object>> headerList = jdbcTemplate.queryForList("SELECT * FROM t_so_creation_header WHERE SEND_STATUS = ? LIMIT ?", "N", 1);
if(headerList.size() > 0) { if(headerList.size() > 0) {
for(Map<String, Object> headerMap : headerList) { for(Map<String, Object> headerMap : headerList) {
ZDTSD009SOCREATION ZDTSD009SOCREATIONBean = new ZDTSD009SOCREATION(); String TRACE_NO = (String)headerMap.get("TRACE_NO");
Header header = new Header();
Long ID = (Long)headerMap.get("ID");
String BSTKD_E = (String)headerMap.get("BSTKD_E");
String VBELN = (String)headerMap.get("VBELN");
Date BSTDK = (Date)headerMap.get("BSTDK");
String KUNNR = (String)headerMap.get("KUNNR"); String KUNNR = (String)headerMap.get("KUNNR");
String KGNNR = (String)headerMap.get("KGNNR"); try {
String QTFLAG = (String)headerMap.get("QTFLAG"); ZDTSD009SOCREATION ZDTSD009SOCREATIONBean = new ZDTSD009SOCREATION();
header.setBSTKDE(BSTKD_E); Header header = new Header();
header.setVBELN(VBELN); Long ID = (Long)headerMap.get("ID");
header.setKUNNR(KUNNR); String BSTKD_E = (String)headerMap.get("BSTKD_E");
header.setKGNNR(KGNNR); String VBELN = (String)headerMap.get("VBELN");
header.setQTFLAG(QTFLAG); Date BSTDK = (Date)headerMap.get("BSTDK");
if(BSTDK != null) { String KGNNR = (String)headerMap.get("KGNNR");
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); String QTFLAG = (String)headerMap.get("QTFLAG");
header.setBSTDK(format.format(BSTDK));
} header.setBSTKDE(BSTKD_E);
ZDTSD009SOCREATIONBean.setHeader(header); header.setVBELN(VBELN);
header.setKUNNR(KUNNR);
List<Map<String, Object>> itemList = jdbcTemplate.queryForList("SELECT * FROM t_so_creation_item WHERE HEADER_ID = ?", ID); header.setKGNNR(KGNNR);
for(Map<String, Object> itemMap : itemList) { header.setQTFLAG(QTFLAG);
String POSNR = (String)itemMap.get("POSNR"); if(BSTDK != null) {
String VTEXT = (String)itemMap.get("VTEXT");
String MATNR = (String)itemMap.get("MATNR");
Integer KWMENG = (Integer)itemMap.get("KWMENG");
Date EDATU = (Date)itemMap.get("EDATU");
ITEM item = new ITEM();
item.setPOSNR(POSNR);
item.setVTEXT(VTEXT);
item.setMATNR(MATNR);
if(KWMENG != null) {
item.setKWMENG(KWMENG.toString());
}
if(EDATU != null) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
item.setEDATU(format.format(EDATU)); header.setBSTDK(format.format(BSTDK));
}
ZDTSD009SOCREATIONBean.setHeader(header);
List<Map<String, Object>> itemList = jdbcTemplate.queryForList("SELECT * FROM t_so_creation_item WHERE HEADER_ID = ?", ID);
for(Map<String, Object> itemMap : itemList) {
String POSNR = (String)itemMap.get("POSNR");
String VTEXT = (String)itemMap.get("VTEXT");
String MATNR = (String)itemMap.get("MATNR");
Integer KWMENG = (Integer)itemMap.get("KWMENG");
Date EDATU = (Date)itemMap.get("EDATU");
ITEM item = new ITEM();
item.setPOSNR(POSNR);
item.setVTEXT(VTEXT);
item.setMATNR(MATNR);
if(KWMENG != null) {
item.setKWMENG(KWMENG.toString());
}
if(EDATU != null) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
item.setEDATU(format.format(EDATU));
}
ZDTSD009SOCREATIONBean.getITEM().add(item);
}
ZMISD009SOCREATION.zMISD009SOCREATION(ZDTSD009SOCREATIONBean);
jdbcTemplate.update("UPDATE t_so_creation_header SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID = ?", ID);
try {
common.saveOrderTracking(TRACE_NO, "SoCreation", null, KUNNR, "D", "SUCCESS", null);
} catch (Throwable e) {
e.printStackTrace();
}
} catch (DataAccessException e) {
e.printStackTrace();
try {
common.saveOrderTracking(TRACE_NO, "SoCreation", null, KUNNR, "D", "ERROR", null);
} catch (Throwable e1) {
e1.printStackTrace();
} }
ZDTSD009SOCREATIONBean.getITEM().add(item);
} }
ZMISD009SOCREATION.zMISD009SOCREATION(ZDTSD009SOCREATIONBean);
jdbcTemplate.update("UPDATE t_so_creation_header SET SEND_STATUS = 'Y', SEND_TIME = NOW() WHERE ID = ?", ID);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment