Commit 7b1a76ad authored by Quxl's avatar Quxl

x

parent 4180fba0
......@@ -99,7 +99,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
header.put("BATCH", dateString + "-" + common.getNextval("T_SO_CONFIRMACTION_HEADER_BATCH_" + KUNNR));
header.put("CREATED", now);
header.put("CREATEBY", systemId);
String idIndex = StringUtil.format(common.getNextval("T_SO_CONFIRMATION_HEADER_ID_"+dateString), "00000");
String idIndex = StringUtil.getIndex("T_SO_CONFIRMATION_HEADER_ID");
Long hID = Long.valueOf(time+idIndex);
header.put("ID", hID);
header.put("TRACE_NO", "sapsoconfirmquotation"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
......@@ -134,7 +134,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
itemData.put("CITY1_I", id.getCITY1_I());
itemData.put("CREATED", now);
itemData.put("CREATEBY", systemId);
String iidIndex = StringUtil.format(common.getNextval("T_SO_CONFIRMATION_ITEM_DATA_ID_"+dateString), "00000");
String iidIndex = StringUtil.getIndex("T_SO_CONFIRMATION_ITEM_DATA_ID");
Long iID = Long.valueOf(time+iidIndex);
itemData.put("ID", iID);
itemDatas.put(id.getPOSNR(), itemData);
......@@ -157,7 +157,7 @@ public class ConfirmQuotationServiceImpl implements ConfirmQuotationService {
itemPricing.put("KWERT", StringUtil.toDouble(ip.getKWERT()));
itemPricing.put("CREATED", now);
itemPricing.put("CREATEBY", systemId);
String itemPricingID = StringUtil.format(common.getNextval("T_SO_CONFIRMATION_ITEM_PRICING_ID_"+dateString), "00000");
String itemPricingID = StringUtil.getIndex("T_SO_CONFIRMATION_ITEM_PRICING_ID");
itemPricing.put("ID", Long.valueOf(time+itemPricingID));
insertTo(itemPricing, "t_so_confirmation_item_pricing");
}
......
......@@ -50,7 +50,7 @@ public class DNDeletionServiceImpl implements DNDeletionService {
String dateString = DateUtil.formatDate(now, DateUtil.FMT_DATE);
try {
Map<String, Object> map = new HashMap<String, Object>();
Long ID = Long.valueOf("" + System.currentTimeMillis() + StringUtil.format(common.getNextval("T_SO_DN_DELETION_ID" + dateString), "00000"));
Long ID = Long.valueOf("" + System.currentTimeMillis() + StringUtil.getIndex("T_SO_DN_DELETION_ID"));
String SOLD_TO = DELETED_DOCUMENTS.getSOLD_TO();
map.put("ID", ID);
map.put("MESSAGE_ID", DELETED_DOCUMENTS.getMSGID());
......
......@@ -160,9 +160,8 @@ public class MaterialMasterServiceImpl implements MaterialMasterService {
private void insertGoods(Map<String, Object> goods) {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
String idIndex = StringUtil.format(common.getNextval("T_VEN_GOODS_ID_"+today), "00000");
String idIndex = StringUtil.getIndex("T_VEN_GOODS_ID");
Long ID = Long.valueOf(time+idIndex);
goods.put("ID", ID);
goods.put("CREATED", DateUtil.formatDate(now, DateUtil.FMT_DATE_TIME)/* datetimef.format(new Date()) */);
......
......@@ -74,7 +74,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
List<HEADER_ORGANIZATIONAL_DATA> HEADER_ORGANIZATIONAL_DATA_LIST = 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 = Long.valueOf(now.getTime() + "" + StringUtil.format(common.getNextval("T_PERFORM_INVOICE_HEADER_ID"), "00000"));
Long headerId = Long.valueOf(now.getTime() + "" + StringUtil.getIndex("T_PERFORM_INVOICE_HEADER_ID"));
headMap.put("ID", headerId);
if(HEADER_GENERAL_DATA != null) {
headMap.put("GENERAL_BELNR", HEADER_GENERAL_DATA.getBELNR());
......@@ -164,7 +164,7 @@ public class PrformaInvoiceServiceImpl implements PrformaInvoiceService {
if(itemList != null) {
for(ITEM_DATA ITEM_DATA : itemList) {
Map<String, Object> itemDataMap = new HashMap<String, Object>();
Long itemId = Long.valueOf("" + now.getTime() + StringUtil.format(common.getNextval("T_PERFORM_INVOICE_ITEM_DATE_ID_" + dateString), "00000"));
Long itemId = Long.valueOf("" + now.getTime() + StringUtil.getIndex("T_PERFORM_INVOICE_ITEM_DATE_ID"));
List<ITEM_REFERENCE_DATA> ITEM_REFERENCE_DATA_LIST = 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();
......
......@@ -143,9 +143,8 @@ public class PriceListServiceImpl implements PriceListService {
private void insertPriceObj(Map<String, Object> priceObj) {
Date now = new Date();
String today = DateUtil.formatDate(now, DateUtil.FMT_DATE);
Long time = now.getTime();
String idIndex = StringUtil.format(common.getNextval("T_PRICE_LIST_ID_"+today), "00000");
String idIndex = StringUtil.getIndex("T_PRICE_LIST_ID");
Long ID = Long.valueOf(time + idIndex);
priceObj.put("ID", ID);
priceObj.put("CREATED", now);
......
......@@ -117,7 +117,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
header.put("TRACE_NO", "sapshippingnotification"+DateUtil.formatDate(now, DateUtil.FMT_DATETIME));
header.put("CREATED", now);
header.put("CREATEBY", systemId);
Long hID = Long.valueOf(time+StringUtil.format(common.getNextval("T_SHIPPING_NOTIFICATION_HEADER_ID_"+dateString), "00000"));
Long hID = Long.valueOf(time + StringUtil.getIndex("T_SHIPPING_NOTIFICATION_HEADER_ID"));
header.put("ID", hID);
insertTo(header, "t_shipping_notification_header");
......@@ -125,7 +125,7 @@ public class ShippingNotificationServiceImpl implements ShippingNotificationServ
if(ITEMs != null) {
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"));
Long iID = Long.valueOf(time + StringUtil.getIndex("T_SHIPPING_NOTIFICATION_ITEM_ID"));
item.put("ID", iID);
item.put("HEADER_ID", hID);
item.put("POSNR", ITEM.getPOSNR());
......
......@@ -6,6 +6,8 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.dom4j.Document;
import org.dom4j.DocumentException;
......@@ -105,7 +107,16 @@ public class StringUtil {
}
}
public static void main(String[] args) {
System.out.println(Long.valueOf(""));
private static Map<String, Long> idx = new ConcurrentHashMap<String, Long>();
public synchronized static String getIndex(String name) {
Long id = idx.get(name);
if(id == null || id > 99999L) {
id = 0L;
}
Long tmpId = id;
idx.put(name, ++id);
return StringUtil.format(tmpId, "00000");
}
}
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