Commit 7fddc5b6 authored by 曲欣红's avatar 曲欣红

1

parent 97eaf3fe
...@@ -48,7 +48,6 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -48,7 +48,6 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
xml = xml.replaceAll("</[a-zA-Z\\d]+:", "</"); xml = xml.replaceAll("</[a-zA-Z\\d]+:", "</");
xml = xml.replaceAll(regex, ""); xml = xml.replaceAll(regex, "");
Z_MT_SD_001_MATERIAL_MASTER Z_MT_SD_001_MATERIAL_MASTER = XMLUtil.toBeanByJxab(xml, Z_MT_SD_001_MATERIAL_MASTER.class); Z_MT_SD_001_MATERIAL_MASTER Z_MT_SD_001_MATERIAL_MASTER = XMLUtil.toBeanByJxab(xml, Z_MT_SD_001_MATERIAL_MASTER.class);
System.out.println(JSON.toJSONString(Z_MT_SD_001_MATERIAL_MASTER));
RECORD RECORD = Z_MT_SD_001_MATERIAL_MASTER.getRECORD(); RECORD RECORD = Z_MT_SD_001_MATERIAL_MASTER.getRECORD();
HEADER_SENDING h = RECORD.getHEADER_SENDING(); HEADER_SENDING h = RECORD.getHEADER_SENDING();
...@@ -108,12 +107,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -108,12 +107,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
goods.put("DIS_UPDATE_STATUS", "N");// 分销商更新结果(Y成功,N失败) goods.put("DIS_UPDATE_STATUS", "N");// 分销商更新结果(Y成功,N失败)
*/ */
Long BATCHID = common.getNextval(today + "_t_ven_goods_BATCH_" + DIS_CODE + "_" + GOODS_CODE); Long BATCHID = common.getNextval(today + "T_VEN_GOODS_BATCH_" + today);
String BATCH = today+"-"+BATCHID; String BATCH = today+"-"+BATCHID;
goods.put("TRACE_NO", "sapmaterialmaster" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME)); goods.put("TRACE_NO", "sapmaterialmaster" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
goods.put("BATCH", BATCH); goods.put("BATCH", BATCH);
goods.put("SEND_STATUS", "N"); goods.put("SEND_STATUS", "N");
goods.put("UPDATED", DateUtil.formatDate(now, DateUtil.FMT_DATE_TIME));
if (goods.get("ID") != null) { if (goods.get("ID") != null) {
updateGoods(goods); updateGoods(goods);
...@@ -121,92 +119,10 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -121,92 +119,10 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
insertGoods(goods); insertGoods(goods);
} }
} }
/*
Element record = StringUtil.getDataElement(xml, "RECORD");
Element headerSending = record.element("HEADER_SENDING");
String DIS_CODE = headerSending.elementText("KUNNR");
String DATUM = headerSending.elementText("DATUM");
String UZEIT = headerSending.elementText("UZEIT");
List<Element> itemList = record.elements("ITEM");
try {
for (Element element : itemList) {
String GOODS_CODE = element.elementText("MATNR");
Map<String, Object> goods = getGoods(DIS_CODE, GOODS_CODE);
if (goods == null) {
goods = new HashMap<>();
}
goods.put("DIS_CODE", DIS_CODE);
goods.put("DATUM", DateUtil.parseDate(DATUM, DateUtil.FMT_DATE));
goods.put("UZEIT", DateUtil.parseDate(UZEIT, DateUtil.FMT_TIME));
goods.put("GOODS_CODE", GOODS_CODE);
goods.put("ROUGH_WEIGHT", Double.valueOf(element.elementText("BRGEW")));
goods.put("NET_WEIGHT", Double.valueOf(element.elementText("NTGEW")));
goods.put("WETGHT_UNIT", element.elementText("GEWEI"));
goods.put("CATEGORY_CODE", element.elementText("PLINE"));
goods.put("CREATION_DATE", DateUtil.parseDate(element.elementText("ERSDA"), DateUtil.FMT_DATE));
goods.put("LAST_CHANGE_DATE", DateUtil.parseDate(element.elementText("LAEDA"), DateUtil.FMT_DATE));
goods.put("GOODS_NAME", element.elementText("NORMT"));
goods.put("VMSTA", element.elementText("VMSTA"));
goods.put("STKTYP", element.elementText("STKTYP"));
goods.put("SPEC", element.elementText("UMREZ"));
goods.put("GOODS_NAME_EN", element.elementText("NORMT_EN"));
goods.put("AUMNG", element.elementText("AUMNG"));
goods.put("VRKME", element.elementText("VRKME"));
goods.put("BASE_UNIT", element.elementText("MEINS"));
goods.put("STATISTICS_UNIT", element.elementText("SCHME"));// (统计单位--》发货单位)
goods.put("LAENG", element.elementText("LAENG"));
goods.put("BREIT", element.elementText("BREIT"));
goods.put("HOEHE", element.elementText("HOEHE"));
goods.put("MEABM", element.elementText("MEABM"));
goods.put("LAENG_B", element.elementText("LAENG_B"));
goods.put("BREIT_B", element.elementText("BREIT_B"));
goods.put("HOEHE_B", element.elementText("HOEHE_B"));
goods.put("MEABM_B", element.elementText("MEABM_B"));
goods.put("PUBLIC", element.elementText("PUBLIC"));
goods.put("INTERNET", element.elementText("INTERNET"));
goods.put("CATEGORY_NAME", "");// 品类名称
goods.put("PRODUCTION_LINE_CODE", "");// 产线(产地)编码
goods.put("PRODUCTION_LINE_NAME", "");// 产线(产地)名称
goods.put("MSTAV", "");// 停产标志2
goods.put("BARCODE", "");// 物料条码
goods.put("TAX_RATE", 0);// 税率
goods.put("GOODS_KEY", "");// 物料唯一码
goods.put("SEND_TIME", now);// 发送时间
goods.put("DIS_UPDATE_STATUS", "N");// 分销商更新结果(Y成功,N失败)
Long BATCHID = common.getNextval(today + "_t_ven_goods_BATCH_" + DIS_CODE + "" + GOODS_CODE);
String BATCH = today+"-"+BATCHID;
goods.put("TRACE_NO", "sapmaterialmaster" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
goods.put("BATCH", BATCH);
goods.put("SEND_STATUS", "N");
goods.put("UPDATED",
DateUtil.formatDate(now, DateUtil.FMT_DATE_TIME));
if (goods.get("ID") != null) {
updateGoods(goods);
} else {
insertGoods(goods);
}
}
} catch (Exception e) {
e.printStackTrace();
}
*/
} }
private void updateGoods(Map<String, Object> goods) { private void updateGoods(Map<String, Object> goods) {
goods.put("UPDATED", new Date());
goods.put("UPDATEDBY", "system"); goods.put("UPDATEDBY", "system");
String sql = "update t_ven_goods set "; String sql = "update t_ven_goods set ";
...@@ -229,13 +145,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService { ...@@ -229,13 +145,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
Date now = new Date(); Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE); String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime(); Long time = now.getTime();
Long idIndex = common.getNextval(today + "_t_ven_goods"); String idIndex = StringUtil.format(common.getNextval("T_VEN_GOODS_ID_"+today), "00000");
Long ID = Long.valueOf(time+idIndex);
String ID = time + "" + idIndex;
goods.put("ID", ID); goods.put("ID", ID);
goods.put("CREATED", DateUtil.formatDate(now, DateUtil.FMT_DATE_TIME)/* datetimef.format(new Date()) */); goods.put("CREATED", DateUtil.formatDate(now, DateUtil.FMT_DATE_TIME)/* datetimef.format(new Date()) */);
goods.put("CREATEDBY", "system"); goods.put("CREATEDBY", "system");
goods.put("UPDATEDBY", "");
String insertSql = "insert into t_ven_goods "; String insertSql = "insert into t_ven_goods ";
String fieldSql = "("; String fieldSql = "(";
......
...@@ -64,8 +64,8 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -64,8 +64,8 @@ public class PriceListServiceImpl implements PriceListService {
} }
priceObj.put("KUNNR", KUNNR); priceObj.put("KUNNR", KUNNR);
priceObj.put("DATUM", DATUM); priceObj.put("DATUM", DateUtil.parseDate(DATUM, DateUtil.FMT_DATE));
priceObj.put("UZEIT", UZEIT); priceObj.put("UZEIT", DateUtil.parseDate(UZEIT, DateUtil.FMT_TIME));
priceObj.put("MATNR", MATNR); priceObj.put("MATNR", MATNR);
priceObj.put("KBETR", StringUtil.toDouble(item.getKBETR())); priceObj.put("KBETR", StringUtil.toDouble(item.getKBETR()));
...@@ -75,7 +75,7 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -75,7 +75,7 @@ public class PriceListServiceImpl implements PriceListService {
priceObj.put("UMREZ", item.getUMREZ()); priceObj.put("UMREZ", item.getUMREZ());
priceObj.put("MAKTX", item.getMAKTX()); priceObj.put("MAKTX", item.getMAKTX());
priceObj.put("PRSCH", StringUtil.toDouble(item.getPRSCH())); priceObj.put("PRSCH", StringUtil.toDouble(item.getPRSCH()));
priceObj.put("DATAM", item.getDATAM()); priceObj.put("DATAM", DateUtil.parseDate(item.getDATAM(), DateUtil.FMT_DATE));
priceObj.put("DATBI", DateUtil.parseDateNoEmpty(item.getDATBI(), DateUtil.FMT_DATE)); priceObj.put("DATBI", DateUtil.parseDateNoEmpty(item.getDATBI(), DateUtil.FMT_DATE));
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()));
...@@ -83,78 +83,22 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -83,78 +83,22 @@ public class PriceListServiceImpl implements PriceListService {
priceObj.put("SEND_DATE", new Date(0));// 发送时间 priceObj.put("SEND_DATE", new Date(0));// 发送时间
*/ */
priceObj.put("SEND_STATUS", "N"); priceObj.put("SEND_STATUS", "N");
Long BATCHID = common.getNextval(today + "_t_price_list_BATCH_" + KUNNR + "_" + MATNR); Long BATCHID = common.getNextval("T_PRICE_LIST_BATCH_" + today);
String BATCH = today + "-" + BATCHID; String BATCH = today + "-" + 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);
priceObj.put("UPDATED", now);
if (priceObj.get("ID") != null) { if (priceObj.get("ID") != null) {
updatePriceObj(priceObj); updatePriceObj(priceObj);
} else { } else {
insertPriceObj(priceObj); insertPriceObj(priceObj);
} }
} }
/*
Element record = StringUtil.getDataElement(xml, "RECORD");
Element headerSending = record.element("HEADER_SENDING");
String KUNNR = headerSending.elementText("KUNNR");
String DATUM = headerSending.elementText("DATUM");
String UZEIT = headerSending.elementText("UZEIT");
List<Element> itemList = record.elements("ITEM");
try {
for (Element element : itemList) {
String MATNR = element.elementText("MATNR");
Map<String, Object> priceObj = getPriceObj(KUNNR, MATNR);
if (priceObj == null) {
priceObj = new HashMap<>();
}
priceObj.put("KUNNR", KUNNR);
priceObj.put("DATUM", DATUM);
priceObj.put("UZEIT", UZEIT);
priceObj.put("MATNR", MATNR);
priceObj.put("KBETR", StringUtil.toDouble(element.elementText("KBETR")));
priceObj.put("KONWA", element.elementText("KONWA"));
priceObj.put("KPEIN", element.elementText("KPEIN"));
priceObj.put("KMEIN", element.elementText("KMEIN"));
priceObj.put("UMREZ", element.elementText("UMREZ"));
priceObj.put("MAKTX", element.elementText("MAKTX"));
priceObj.put("PRSCH", StringUtil.toDouble(element.elementText("PRSCH")));
priceObj.put("DATAM", element.elementText("DATAM"));
priceObj.put("DATBI", DateUtil.parseDateNoEmpty(element.elementText("DATBI"), DateUtil.FMT_DATE));
priceObj.put("PLINE", element.elementText("PLINE"));
priceObj.put("PRSCH_1", StringUtil.toDouble(element.elementText("PRSCH_1")));
priceObj.put("SEND_DATE", new Date(0));// 发送时间
priceObj.put("SEND_STATUS", "N");
Long BATCHID = common.getNextval(today + "_t_price_list_BATCH_" + KUNNR + "" + MATNR);
String BATCH = today + "-" + BATCHID;
priceObj.put("TRACE_NO", "sappricelist" + DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
priceObj.put("BATCH", BATCH);
priceObj.put("UPDATED", now);
if (priceObj.get("ID") != null) {
updatePriceObj(priceObj);
} else {
insertPriceObj(priceObj);
}
}
} catch (Exception e) {
e.printStackTrace();
}
*/
} }
private void updatePriceObj(Map<String, Object> priceObj) { private void updatePriceObj(Map<String, Object> priceObj) {
priceObj.put("UPDATEDBY", "system"); priceObj.put("UPDATEDBY", "system");
priceObj.put("UPDATED", new Date());
String sql = "update t_price_list set "; String sql = "update t_price_list set ";
List<Object> args = new ArrayList<>(); List<Object> args = new ArrayList<>();
...@@ -176,13 +120,11 @@ public class PriceListServiceImpl implements PriceListService { ...@@ -176,13 +120,11 @@ public class PriceListServiceImpl implements PriceListService {
Date now = new Date(); Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE); String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime(); Long time = now.getTime();
Long idIndex = common.getNextval(today + "_t_ven_goods"); String idIndex = StringUtil.format(common.getNextval("T_PRICE_LIST_ID_"+today), "00000");
Long ID = Long.valueOf(time + idIndex);
Long ID = Long.valueOf(time + "" + idIndex);
priceObj.put("ID", ID); priceObj.put("ID", ID);
priceObj.put("CREATED", now); priceObj.put("CREATED", now);
priceObj.put("CREATEDBY", "system"); priceObj.put("CREATEDBY", "system");
priceObj.put("UPDATEDBY", "");
String insertSql = "insert into t_price_list "; String insertSql = "insert into t_price_list ";
String fieldSql = "("; String fieldSql = "(";
......
...@@ -39,124 +39,108 @@ public class SoConfirmQuotationServiceImpl implements SoConfirmQuotationService{ ...@@ -39,124 +39,108 @@ public class SoConfirmQuotationServiceImpl implements SoConfirmQuotationService{
@Override @Override
public void execute(String xml) { public void execute(String xml) {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
try { Z_MT_SD_008_SO_CONFIRM_QUOTATION Z_MT_SD_008_SO_CONFIRM_QUOTATION = XMLUtil.toBeanByJxab(xml, Z_MT_SD_008_SO_CONFIRM_QUOTATION.class);
Date now = new Date(); System.out.println(JSON.toJSONString(Z_MT_SD_008_SO_CONFIRM_QUOTATION));
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime(); Map<String, Object> header = new HashMap<>();
RESPONSE res = Z_MT_SD_008_SO_CONFIRM_QUOTATION.getRESPONSE();
HEADER h = res.getHEADER();
Z_MT_SD_008_SO_CONFIRM_QUOTATION Z_MT_SD_008_SO_CONFIRM_QUOTATION = XMLUtil.toBeanByJxab(xml, Z_MT_SD_008_SO_CONFIRM_QUOTATION.class);
System.out.println(JSON.toJSONString(Z_MT_SD_008_SO_CONFIRM_QUOTATION)); header.put("BSTKD_E", h.getBSTKD_E());
header.put("VBELN", h.getVBELN());
Map<String, Object> header = new HashMap<>(); header.put("VKORG", h.getVKORG());
RESPONSE res = Z_MT_SD_008_SO_CONFIRM_QUOTATION.getRESPONSE(); header.put("VTWEG", h.getVTWEG());
HEADER h = res.getHEADER(); header.put("SPART", h.getSPART());
header.put("ERNAM", h.getERNAM());
header.put("BSTKD_E", h.getBSTKD_E()); header.put("BSTDK", DateUtil.parseDateNoEmpty(h.getBSTDK(), DateUtil.FMT_DATE));
header.put("VKORG", h.getVKORG()); header.put("ERZET", DateUtil.parseDateNoEmpty(h.getERZET(), DateUtil.FMT_TIME));
header.put("VTWEG", h.getVTWEG()); header.put("ERDAT", DateUtil.parseDateNoEmpty(h.getERDAT(), DateUtil.FMT_DATE));
header.put("SPART", h.getSPART()); header.put("KUNNR", h.getKUNNR());
header.put("ERNAM", h.getERNAM()); header.put("KGNNR", h.getKGNNR());
header.put("BSTDK", DateUtil.parseDateNoEmpty(h.getBSTDK(), DateUtil.FMT_DATE)); header.put("NAME1", h.getNAME1());
header.put("ERZET", DateUtil.parseDateNoEmpty(h.getERZET(), DateUtil.FMT_TIME)); header.put("NAME2", h.getNAME2());
header.put("ERDAT", DateUtil.parseDateNoEmpty(h.getERDAT(), DateUtil.FMT_DATE)); header.put("POSTL_COD1", h.getPOSTL_COD1());
header.put("KUNNR", h.getKUNNR()); header.put("CITY1", h.getCITY1());
header.put("KGNNR", h.getKGNNR()); header.put("ZZPROM", h.getZZPROM());
header.put("NAME1", h.getNAME1()); header.put("BSTKD", h.getBSTKD());
header.put("NAME2", h.getNAME2()); header.put("AUART", h.getAUART());
header.put("POSTL_COD1", h.getPOSTL_COD1()); header.put("CMGST", h.getCMGST());
header.put("CITY1", h.getCITY1()); header.put("NETWRH", StringUtil.toDouble(h.getNETWRH()));
header.put("ZZPROM", h.getZZPROM()); header.put("MWSTH", StringUtil.toDouble(h.getMWSTH()));
header.put("BSTKD", h.getBSTKD()); header.put("WAERK", h.getWAERK());
header.put("AUART", h.getAUART()); header.put("DPFLAG", h.getDPFLAG());
header.put("CMGST", h.getCMGST()); header.put("SEND_STATUS", "N");
header.put("NETWRH", StringUtil.toDouble(h.getNETWRH())); header.put("BATCH", today+common.getNextval("T_SO_CONFIRMACTION_HEADER_BATCH_")+today);
header.put("MWSTH", StringUtil.toDouble(h.getMWSTH())); header.put("CREATED", now);
header.put("WAERK", h.getWAERK()); header.put("CREATEDBY", "system");
header.put("DPFLAG", h.getDPFLAG()); String idIndex = StringUtil.format(common.getNextval("T_SO_CONFIRMATION_HEADER_ID_"+today), "00000");
header.put("SEND_STATUS", "N"); Long hID = Long.valueOf(time+idIndex);
header.put("BATCH", today+"-1"); header.put("ID", hID);
header.put("CREATED", now); header.put("TRACE_NO", "sapsoconfirmquotation"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
header.put("CREATEDBY", "system");
String idIndex = common.getNextval(today+"_t_so_confirmation_header")+""; insertTo(header, "t_so_confirmation_header");
if(idIndex.length()<5) {
idIndex = StringUtil.prependZero(idIndex, 5); List<ITEM_DATA> ids = res.getITEM_DATA();
} Map<String, Map<String, Object>> itemDatas = new HashMap<>();
Long hID = Long.valueOf(time+idIndex); for(ITEM_DATA id : ids) {
header.put("ID", hID); Map<String, Object> itemData = new HashMap<>();
header.put("TRACE_NO", "sapsoconfirmquotation"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME)); itemData.put("BSTKD_E", h.getBSTKD_E());
itemData.put("VBELN", h.getVBELN());
itemData.put("HEADER_ID", hID);
insertTo(header, "t_so_confirmation_header"); itemData.put("POSNR", id.getPOSNR());
itemData.put("UEPOS", id.getUEPOS());
List<ITEM_DATA> ids = res.getITEM_DATA(); itemData.put("VTEXT", id.getVTEXT());
Map<String, Map<String, Object>> itemDatas = new HashMap<>(); itemData.put("MATNR", id.getMATNR());
for(ITEM_DATA id : ids) { itemData.put("KWMENG", StringUtil.toDouble(id.getKWMENG()));
Map<String, Object> itemData = new HashMap<>(); itemData.put("VRKME", id.getVRKME());
itemData.put("BSTKD_E", h.getBSTKD_E()); itemData.put("EDATU", DateUtil.parseDateNoEmpty(id.getEDATU(), DateUtil.FMT_DATE));
itemData.put("VBELN", h.getVBELN()); itemData.put("CDATE", DateUtil.parseDateNoEmpty(id.getCDATE(), DateUtil.FMT_DATE));
itemData.put("HEADER_ID", hID); itemData.put("REFLAG", id.getREFLAG());
itemData.put("POSNR", id.getPOSNR()); itemData.put("MWSTI", StringUtil.toDouble(id.getMWSTI()));
itemData.put("UEPOS", id.getUEPOS()); itemData.put("NETWRI", StringUtil.toDouble(id.getNETWRI()));
itemData.put("VTEXT", id.getVTEXT()); itemData.put("WAERK_I", id.getWAERK_I());
itemData.put("MATNR", id.getMATNR()); itemData.put("WERKS", id.getWERKS());
itemData.put("KWMENG", StringUtil.toDouble(id.getKWMENG())); itemData.put("ZZCRDDATE", DateUtil.parseDateNoEmpty(id.getZZCRDDATE(), DateUtil.FMT_DATE));
itemData.put("VRKME", id.getVRKME()); itemData.put("KGNNR_I", id.getKGNNR_I());
itemData.put("EDATU", DateUtil.parseDateNoEmpty(id.getEDATU(), DateUtil.FMT_DATE)); itemData.put("NAME1_I", id.getNAME1_I());
itemData.put("CDATE", DateUtil.parseDateNoEmpty(id.getCDATE(), DateUtil.FMT_DATE)); itemData.put("NAME2_I", id.getNAME2_I());
itemData.put("REFLAG", id.getREFLAG()); itemData.put("POSTL_CODE1_I", id.getPOSTL_COD1_I());
itemData.put("MWSTI", StringUtil.toDouble(id.getMWSTI())); itemData.put("CITY1_I", id.getCITY1_I());
itemData.put("NETWRI", StringUtil.toDouble(id.getNETWRI())); itemData.put("CREATED", now);
itemData.put("WAERK_I", id.getWAERK_I()); itemData.put("CREATEDBY", "system");
itemData.put("WERKS", id.getWERKS()); String iidIndex = StringUtil.format(common.getNextval("T_SO_CONFIRMATION_ITEM_DATA_ID_"+today), "00000");
itemData.put("ZZCRDDATE", DateUtil.parseDateNoEmpty(id.getZZCRDDATE(), DateUtil.FMT_DATE)); Long iID = Long.valueOf(time+iidIndex);
itemData.put("KGNNR_I", id.getKGNNR_I()); itemData.put("ID", iID);
itemData.put("NAME1_I", id.getNAME1_I()); itemDatas.put(id.getPOSNR(), itemData);
itemData.put("NAME2_I", id.getNAME2_I()); insertTo(itemData, "t_so_confirmation_item_data");
itemData.put("POSTL_CODE1_I", id.getPOSTL_COD1_I()); }
itemData.put("CITY1_I", id.getCITY1_I());
itemData.put("CREATED", new Date()); List<ITEM_PRICING> ips = res.getITEM_PRICING();
itemData.put("CREATEDBY", "system"); for(ITEM_PRICING ip : ips) {
String iidIndex = common.getNextval(today+"_t_so_confirmation_item_data")+""; Map<String, Object> itemPricing = new HashMap<>();
if(iidIndex.length()<5) { itemPricing.put("HEADER_ID", hID);
iidIndex = StringUtil.prependZero(iidIndex, 5); String POSNR = ip.getPOSNR();
} itemPricing.put("ITEM_DATA_ID", itemDatas.get(POSNR).get("ID"));
Long iID = Long.valueOf(time+iidIndex); itemPricing.put("BSTKD_E", h.getBSTKD_E());
itemData.put("ID", iID); itemPricing.put("VBELN", h.getVBELN());
itemDatas.put(id.getPOSNR(), itemData); itemPricing.put("POSNR", POSNR);
insertTo(itemData, "t_so_confirmation_item_data"); itemPricing.put("KSCHL", ip.getKSCHL());
} itemPricing.put("VTEXT", ip.getVTEXT());
itemPricing.put("KBETR", StringUtil.toDouble(ip.getKBETR()));
List<ITEM_PRICING> ips = res.getITEM_PRICING(); itemPricing.put("KWERT", StringUtil.toDouble(ip.getKWERT()));
for(ITEM_PRICING ip : ips) { itemPricing.put("CREATED", now);
Map<String, Object> itemPricing = new HashMap<>(); itemPricing.put("CREATEDBY", "system");
itemPricing.put("HEADER_ID", hID); String itemPricingID = StringUtil.format(common.getNextval("T_SO_CONFIRMATION_ITEM_PRICING_ID_"+today), "00000");
String POSNR = ip.getPOSNR(); itemPricing.put("ID", Long.valueOf(time+itemPricingID));
itemPricing.put("ITEM_DATA_ID", itemDatas.get(POSNR).get("ID")); insertTo(itemPricing, "t_so_confirmation_item_pricing");
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", new Date());
itemPricing.put("CREATEDBY", "system");
String itemPricingID = common.getNextval(today+"_t_so_confirmation_item_pricing")+"";
if(itemPricingID.length()<5) {
itemPricingID = StringUtil.prependZero(itemPricingID, 5);
}
itemPricing.put("ID", Long.valueOf(time+itemPricingID));
insertTo(itemPricing, "t_so_confirmation_item_pricing");
}
}catch(Exception e) {
e.printStackTrace();
} }
} }
private void insertTo(Map<String, Object> obj, String table) { private void insertTo(Map<String, Object> obj, String table) {
String insertSql = "insert into "+table+" "; String insertSql = "insert into "+table+" ";
String fieldSql = "("; String fieldSql = "(";
String valuesSql = "("; String valuesSql = "(";
......
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