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

1

parent 97eaf3fe
......@@ -48,7 +48,6 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
xml = xml.replaceAll("</[a-zA-Z\\d]+:", "</");
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);
System.out.println(JSON.toJSONString(Z_MT_SD_001_MATERIAL_MASTER));
RECORD RECORD = Z_MT_SD_001_MATERIAL_MASTER.getRECORD();
HEADER_SENDING h = RECORD.getHEADER_SENDING();
......@@ -108,12 +107,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
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;
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);
......@@ -121,92 +119,10 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
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) {
goods.put("UPDATED", new Date());
goods.put("UPDATEDBY", "system");
String sql = "update t_ven_goods set ";
......@@ -229,13 +145,11 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
Long idIndex = common.getNextval(today + "_t_ven_goods");
String ID = time + "" + idIndex;
String idIndex = StringUtil.format(common.getNextval("T_VEN_GOODS_ID_"+today), "00000");
Long ID = Long.valueOf(time+idIndex);
goods.put("ID", ID);
goods.put("CREATED", DateUtil.formatDate(now, DateUtil.FMT_DATE_TIME)/* datetimef.format(new Date()) */);
goods.put("CREATEDBY", "system");
goods.put("UPDATEDBY", "");
String insertSql = "insert into t_ven_goods ";
String fieldSql = "(";
......
......@@ -64,8 +64,8 @@ public class PriceListServiceImpl implements PriceListService {
}
priceObj.put("KUNNR", KUNNR);
priceObj.put("DATUM", DATUM);
priceObj.put("UZEIT", UZEIT);
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()));
......@@ -75,7 +75,7 @@ public class PriceListServiceImpl implements PriceListService {
priceObj.put("UMREZ", item.getUMREZ());
priceObj.put("MAKTX", item.getMAKTX());
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("PLINE", item.getPLINE());
priceObj.put("PRSCH_1", StringUtil.toDouble(item.getPRSCH_1()));
......@@ -83,78 +83,22 @@ public class PriceListServiceImpl implements PriceListService {
priceObj.put("SEND_DATE", new Date(0));// 发送时间
*/
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;
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);
}
}
/*
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) {
priceObj.put("UPDATEDBY", "system");
priceObj.put("UPDATED", new Date());
String sql = "update t_price_list set ";
List<Object> args = new ArrayList<>();
......@@ -176,13 +120,11 @@ public class PriceListServiceImpl implements PriceListService {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
Long idIndex = common.getNextval(today + "_t_ven_goods");
Long ID = Long.valueOf(time + "" + idIndex);
String idIndex = StringUtil.format(common.getNextval("T_PRICE_LIST_ID_"+today), "00000");
Long ID = Long.valueOf(time + idIndex);
priceObj.put("ID", ID);
priceObj.put("CREATED", now);
priceObj.put("CREATEDBY", "system");
priceObj.put("UPDATEDBY", "");
String insertSql = "insert into t_price_list ";
String fieldSql = "(";
......
......@@ -39,13 +39,10 @@ public class SoConfirmQuotationServiceImpl implements SoConfirmQuotationService{
@Override
public void execute(String xml) {
try {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
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));
......@@ -54,6 +51,7 @@ public class SoConfirmQuotationServiceImpl implements SoConfirmQuotationService{
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());
......@@ -76,18 +74,14 @@ public class SoConfirmQuotationServiceImpl implements SoConfirmQuotationService{
header.put("WAERK", h.getWAERK());
header.put("DPFLAG", h.getDPFLAG());
header.put("SEND_STATUS", "N");
header.put("BATCH", today+"-1");
header.put("BATCH", today+common.getNextval("T_SO_CONFIRMACTION_HEADER_BATCH_")+today);
header.put("CREATED", now);
header.put("CREATEDBY", "system");
String idIndex = common.getNextval(today+"_t_so_confirmation_header")+"";
if(idIndex.length()<5) {
idIndex = StringUtil.prependZero(idIndex, 5);
}
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();
......@@ -116,12 +110,9 @@ public class SoConfirmQuotationServiceImpl implements SoConfirmQuotationService{
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", new Date());
itemData.put("CREATED", now);
itemData.put("CREATEDBY", "system");
String iidIndex = common.getNextval(today+"_t_so_confirmation_item_data")+"";
if(iidIndex.length()<5) {
iidIndex = StringUtil.prependZero(iidIndex, 5);
}
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);
......@@ -141,22 +132,15 @@ public class SoConfirmQuotationServiceImpl implements SoConfirmQuotationService{
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("CREATED", now);
itemPricing.put("CREATEDBY", "system");
String itemPricingID = common.getNextval(today+"_t_so_confirmation_item_pricing")+"";
if(itemPricingID.length()<5) {
itemPricingID = StringUtil.prependZero(itemPricingID, 5);
}
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");
}
}catch(Exception e) {
e.printStackTrace();
}
}
private void insertTo(Map<String, Object> obj, String table) {
String insertSql = "insert into "+table+" ";
String fieldSql = "(";
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