Commit 4ae7ba41 authored by Quxl's avatar Quxl

x

parent 898cb98b
......@@ -15,6 +15,7 @@ import org.springframework.boot.system.ApplicationHome;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
......@@ -69,7 +70,7 @@ public class SI004INVENTORYSyncOutServiceTask {
}
public void sendData(SI004INVENTORYSyncOut SI004INVENTORYSyncOut) {
Page page = new Page(1L, 1000L, new String[] {"DIS_CODE", "INVENTORY_DATE"});
Page page = new Page(1L, 1000L, new String[] {"DIS_CODE", "TRACE_NO"});
String sql = "SELECT * FROM t_dis_inventory WHERE SEND_STATUS = 'N'";
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> tmp = null;
......@@ -79,7 +80,7 @@ public class SI004INVENTORYSyncOutServiceTask {
list.addAll(tmp);
page.toNextPage();
} while(tmp != null && tmp.size() > 0);
Map<String, List<Map<String, Object>>> datas = CollectionUtil.toGroupList(list, "DIS_CODE", "INVENTORY_DATE");
Map<String, List<Map<String, Object>>> datas = CollectionUtil.toGroupList(list, "DIS_CODE", "TRACE_NO");
for(List<Map<String, Object>> vList : datas.values()) {
try {
this.sendData(SI004INVENTORYSyncOut, vList);
......@@ -89,17 +90,23 @@ public class SI004INVENTORYSyncOutServiceTask {
}
}
@Transactional
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void sendData(SI004INVENTORYSyncOut SI004INVENTORYSyncOut, List<Map<String, Object>> vList) {
Date now = new Date();
boolean isSuccess = true;
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
ZDTSD004INVENTORYSENDING mt004INVENTORY = new ZDTSD004INVENTORYSENDING();
String message = null;
String errorMessage = null;
String traceNo = null;
String disCode = null;
try {
JSONObject headerObject = new JSONObject(vList.get(0));
ZDTSD004INVENTORYSENDING.RECORD RECORD = new ZDTSD004INVENTORYSENDING.RECORD();
ZDTSD004INVENTORYSENDING.RECORD.INVENTORYRECORD INVENTORYRECORD = new ZDTSD004INVENTORYSENDING.RECORD.INVENTORYRECORD();
ZDTSD004INVENTORYSENDING.RECORD.INVENTORYRECORD.HEADER INVENTORYRECORD_HEADER = new ZDTSD004INVENTORYSENDING.RECORD.INVENTORYRECORD.HEADER();
disCode = headerObject.getString("DIS_CODE");
traceNo = headerObject.getString("TRACE_NO");
INVENTORYRECORD_HEADER.setKUNNR(headerObject.getString("DIS_CODE"));
INVENTORYRECORD_HEADER.setNAME1(headerObject.getString("DIS_NAME"));
INVENTORYRECORD_HEADER.setZDATE(headerObject.getString("INVENTORY_DATE"));
......@@ -126,6 +133,8 @@ public class SI004INVENTORYSyncOutServiceTask {
jdbcTemplate.update(updateSql, idList.toArray());
} catch (Throwable e) {
isSuccess = false;
message = ThrowableUtil.getThrowableDesc(e);
errorMessage = ThrowableUtil.getCaused(e).getMessage();
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
try {
......@@ -133,6 +142,11 @@ public class SI004INVENTORYSyncOutServiceTask {
} catch (Exception e1) {
logger.error(timeString, e1);
}
try {
common.saveOrderTracking(traceNo, "004_INVENTORY", null, disCode, "D", (isSuccess ? "S" : "F"), message, errorMessage);
} catch (Throwable e1) {
logger.error("追踪数据保存失败", e1);
}
String xmlName = "Z_DT_SD_004_INVENTORY_SENDING";
try {
String xml = XMLUtil.toXml(mt004INVENTORY);
......
......@@ -15,6 +15,7 @@ import org.springframework.boot.system.ApplicationHome;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.alibaba.fastjson.JSONObject;
......@@ -69,7 +70,7 @@ public class SI011ACTUALSALESSyncOutServiceTask {
}
private void sendData(SI011ACTUALSALESSyncOut SI011ACTUALSALESSyncOut) {
Page page = new Page(1L, 1000L, new String[] {"DIS_CODE", "SALES_NO"});
Page page = new Page(1L, 1000L, new String[] {"DIS_CODE", "TRACE_NO"});
String sql = "SELECT * FROM t_dis_sales WHERE SEND_STATUS = 'N'";
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> tmp = null;
......@@ -79,7 +80,7 @@ public class SI011ACTUALSALESSyncOutServiceTask {
list.addAll(tmp);
page.toNextPage();
} while(tmp != null && tmp.size() > 0);
Map<String, List<Map<String, Object>>> datas = CollectionUtil.toGroupList(list, "DIS_CODE", "SALES_NO");
Map<String, List<Map<String, Object>>> datas = CollectionUtil.toGroupList(list, "DIS_CODE", "TRACE_NO");
for(List<Map<String, Object>> vList : datas.values()) {
try {
this.sendData(SI011ACTUALSALESSyncOut, vList);
......@@ -89,18 +90,24 @@ public class SI011ACTUALSALESSyncOutServiceTask {
}
}
@Transactional
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void sendData(SI011ACTUALSALESSyncOut SI011ACTUALSALESSyncOut, List<Map<String, Object>> vList) {
Date now = new Date();
boolean isSuccess = true;
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
ZDTSD011ACTUALSALESSENDING mt011ACTUALSALES = new ZDTSD011ACTUALSALESSENDING();
String message = null;
String errorMessage = null;
String traceNo = null;
String disCode = null;
try {
ZDTSD011ACTUALSALESSENDING.RECORD RECORD = new ZDTSD011ACTUALSALESSENDING.RECORD();
mt011ACTUALSALES.setRECORD(RECORD);
ZDTSD011ACTUALSALESSENDING.RECORD.HEADER header = new ZDTSD011ACTUALSALESSENDING.RECORD.HEADER();
List<ZDTSD011ACTUALSALESSENDING.RECORD.ITEM> itemList = RECORD.getITEM();
JSONObject headerObject = new JSONObject(vList.get(0));
traceNo = headerObject.getString("TRACE_NO");
disCode = headerObject.getString("DIS_CODE");
header.setAUBEL(headerObject.getString("SALES_NO"));
header.setFXSNA(headerObject.getString("DIS_NAME"));
header.setFXSNO(headerObject.getString("DIS_CODE"));
......@@ -133,6 +140,8 @@ public class SI011ACTUALSALESSyncOutServiceTask {
jdbcTemplate.update(updateSql, idList.toArray());
} catch (Throwable e) {
isSuccess = false;
message = ThrowableUtil.getThrowableDesc(e);
errorMessage = ThrowableUtil.getCaused(e).getMessage();
throw new XRException(ThrowableUtil.getCaused(e).getMessage() + " -- " + timeString, e);
} finally {
try {
......@@ -140,6 +149,11 @@ public class SI011ACTUALSALESSyncOutServiceTask {
} catch (Exception e1) {
logger.error(timeString, e1);
}
try {
common.saveOrderTracking(traceNo, "011_ACTUAL_SALES", null, disCode, "D", (isSuccess ? "S" : "F"), message, errorMessage);
} catch (Throwable e1) {
logger.error("追踪数据保存失败", e1);
}
String xmlName = "Z_DT_SD_011_ACTUAL_SALES_SENDING";
try {
String xml = XMLUtil.toXml(mt011ACTUALSALES);
......
......@@ -14,6 +14,7 @@ import org.springframework.boot.system.ApplicationHome;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.egolm.sso.clients.ServiceFactory;
......@@ -78,7 +79,7 @@ public class ZMISD009SOCREATIONServiceTask {
}
}
@Transactional
@Transactional(propagation=Propagation.REQUIRES_NEW)
public void sendData (ZMISD009SOCREATION ZMISD009SOCREATION, Map<String, Object> headerMap) {
Date now = new Date();
String timeString = DateUtil.formatDate(now, "yyyyMMddHHmmssSSS");
......
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