⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controlmanager.java

📁 SAP这个系统的一个转换器
💻 JAVA
字号:
package com.idoc.app;

/**
 * <p>Title: IDOC Interface</p>
 * <p>Description: IDOC 转换器</p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: SiChuan XinHua</p>
 * @author Richary
 * @version 1.0
 */

import java.io.File;
import com.idoc.file.ReadData;
import com.idoc.logic.MaterialParse;
import com.idoc.logic.PublishParse;
import com.idoc.logic.CatalogParse;
import com.idoc.logic.EANParse;
import com.idoc.logic.InventoryParse;
import com.idoc.logic.SetParse;
import com.idoc.logic.StorageParse;
import com.idoc.logic.DiscountParse;
import com.idoc.logic.SalesIDOC;
import com.idoc.logic.InventoryIDOC;
import com.idoc.file.WriteData;
import java.util.Vector;
import com.idoc.util.LogManager;
import com.idoc.util.db.DBQueryBean;
import java.lang.Runtime;

public class ControlManager {
  Runtime runtime = Runtime.getRuntime();
  public ControlManager() {
  }

  public void disposeData(String type) {
    if (type.equalsIgnoreCase("down")) {
      // 处理下传数据
      disposeDown(type);
    }
    else if (type.equalsIgnoreCase("up")) {
      // 处理上传数据
      //disposeUp(type);
    }
  }

  public void disposeDown(String type) {
    long ii = System.currentTimeMillis();
    boolean flag = false;
    String backDir = "";
    File[] file = new File[] {};
 //   System.out.println("controlstar... publish = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());

    // 处理出版社
 try {
      file = ReadData.getFileGroup("down", "publish");
      backDir = WriteData.createDownList("publish");
      for (int i = 0; i < file.length; i++) {
   // System.out.println("star... publish" + i + " = " + runtime.totalMemory() + " -- > " + runtime.freeMemory());
        PublishParse publish = new PublishParse();
//System.out.println(file[i]);
        flag = publish.disposeData(file[i]);
        if (flag) {
          WriteData.CopyFile(file[i], new File(backDir + file[i].getName())); // 备份
          if (file[i] != null) {
            //flag = file[i].delete();
          }
        }
      }
    //System.out.println("end... publish  = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
    }
    catch (Exception ex) {
      System.out.println("ControlManager'publish is Error!");
    }
    System.out.println("controlend... publish = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());
    System.out.println("controlstar... ean = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());

    // 处理EAN
   try {
      file = ReadData.getFileGroup("down", "ean");
      backDir = WriteData.createDownList("ean");
      for (int i = 0; i < file.length; i++) {
    //System.out.println("star... ean" + i + " = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
        EANParse ean = new EANParse();
 // System.out.println(file[i]);
        flag = ean.disposeData(file[i]);
        if (flag) {
          WriteData.CopyFile(file[i], new File(backDir + file[i].getName())); // 备份
          if (file[i] != null) {
            //flag = file[i].delete();
          }
        }
      }
    //System.out.println("end... ean  = " + runtime.totalMemory());
    }
    catch (Exception ex) {
      System.out.println("ControlManager'ean is Error!");
    }
System.gc();
    System.out.println("controlend... ean = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());
    System.out.println("controlstar... catalog = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());

    // 处理商品类目
     try {
      file = ReadData.getFileGroup("down", "catalog");
      backDir = WriteData.createDownList("catalog");
      for (int i = 0; i < file.length; i++) {
    //System.out.println("star... catalog" + i + " = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
        CatalogParse catalog = new CatalogParse();
  //System.out.println(file[i]);
        flag = catalog.disposeData(file[i]);
        if (flag) {
          WriteData.CopyFile(file[i], new File(backDir + file[i].getName())); // 备份
          if (file[i] != null) {
            //flag = file[i].delete();
          }
        }
      }
    //System.out.println("end... catalog  = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
    }
    catch (Exception ex) {
      System.out.println("ControlManager'catalog is Error!");
    }
    System.out.println("controlend... catalog = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());
    System.out.println("controlstar... set = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());

    // 处理套装商品
    try {
      file = ReadData.getFileGroup("down", "set");
      backDir = WriteData.createDownList("set");
      for (int i = 0; i < file.length; i++) {
    //System.out.println("star... set" + i + " = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
        SetParse set = new SetParse();
 // System.out.println(file[i]);
        flag = set.disposeData(file[i]);
        if (flag) {
          WriteData.CopyFile(file[i], new File(backDir + file[i].getName())); // 备份
          if (file[i] != null) {
            //flag = file[i].delete();
          }
        }
      }
    //System.out.println("end... set  = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
    }
    catch (Exception ex) {
      System.out.println("ControlManager'set is Error!");
    }
System.gc();
    System.out.println("controlend... set = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());
    System.out.println("controlstar... inventory = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());

    // 处理盘点数据
   try {
      file = ReadData.getFileGroup(type, "inventory");
///System.out.println(file.length);
      backDir = WriteData.createDownList("inventory");
      for (int i = 0; i < file.length; i++) {
    //System.out.println("star... inventory" + i + " = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
        InventoryParse inventory = new InventoryParse();
//System.out.println(file[i]);
        flag = inventory.disposeData(file[i]);
        if (flag) {
          WriteData.CopyFile(file[i], new File(backDir + file[i].getName())); // 备份
          if (file[i] != null) {
            //flag = file[i].delete();
          }
        }
      }
    //System.out.println("end... inventory  = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
    }
    catch (Exception ex) {
      System.out.println("ControlManager'inventory is Error!");
    }
System.gc();
    System.out.println("controlend... inventory = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());
    System.out.println("controlstar... promotion = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());

    // 处理商品组促销折扣
   try {
      file = ReadData.getFileGroup(type, "promotion");
      backDir = WriteData.createDownList("promotion");
      for (int i = 0; i < file.length; i++) {
    //System.out.println("star... promotion" + i + " = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
//System.out.println(file[i]);
        DiscountParse discount = new DiscountParse();
        flag = discount.disposeData(file[i]);
        if (flag) {
          WriteData.CopyFile(file[i], new File(backDir + file[i].getName())); // 备份
          if (file[i] != null) {
            //flag = file[i].delete();
          }
        }
      }
    //System.out.println("end... promotion  = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
    }
    catch (Exception ex) {
      System.out.println("ControlManager's discount is Error!");
    }
System.gc();
    System.out.println("controlend... promotion = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());
    System.out.println("controlstar... material = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());

  // 处理商品主数据
    try {
      file = ReadData.getFileGroup(type, "material");
      backDir = WriteData.createDownList("material");
      for (int i = 0; i < file.length; i++) {
    //System.out.println("star... material" + i + " = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
//System.out.println(file[i]);
        MaterialParse material = new MaterialParse();
        flag = material.disposeData(file[i]);
        if (flag) {
          WriteData.CopyFile(file[i], new File(backDir + file[i].getName())); //
          if (file[i] != null) {
            //flag = file[i].delete();
          }
        }
      }
    //System.out.println("end... material  = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
    }
    catch (Exception ex) {
      System.out.println("ControlManager's material is Error!");
    }
System.gc();
    System.out.println("controlend... material = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());
    System.out.println("controlstar... storage = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());

   // 处理库存信息
   try {
      file = ReadData.getFileGroup("down", "storage");
      backDir = WriteData.createDownList("storage");
      for (int i = 0; i < file.length; i++) {
    //System.out.println("star... storage" + i + " = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
        StorageParse storage = new StorageParse();
 // System.out.println(file[i]);
        flag = storage.disposeData(file[i]);
        if (flag) {
          WriteData.CopyFile(file[i], new File(backDir + file[i].getName())); // 备份
          if (file[i] != null) {
            //flag = file[i].delete();
          }
        }
      }
    //System.out.println("end... storage  = " + runtime.totalMemory() + " -- > " + runtime.availableProcessors());
    }
    catch (Exception ex) {
      System.out.println("ControlManager'storage is Error!");
    }
System.gc();
    System.out.println("controlend... storage = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());

  }

  /**
   * 上传调用
   * @param type
   */

  public void disposeUp(String type) {
    long ii = System.currentTimeMillis();
    SalesIDOC sales = new SalesIDOC();
     try {
       System.out.println("controlstar... SalesIDOC = " + runtime.freeMemory()+ " -- > " + runtime.availableProcessors());
       sales.disposeIDOC();
       System.gc();
       System.out.println("controlend... SalesIDOC = " + runtime.freeMemory() + " -- > " + runtime.availableProcessors());
    }
       catch (Exception ex) {
      System.out.println("ControlManager'Sales is Error!");
    }

   InventoryIDOC inventory = new InventoryIDOC();
    try {
      System.out.println("controlstar... InventoryIDOC = " + runtime.freeMemory() + " -- > " + runtime.availableProcessors());
      inventory.disposeIDOC();
      System.gc();
      System.out.println("controlend... InventoryIDOC = " + runtime.freeMemory() + " -- > " + runtime.availableProcessors());
    }
    catch (Exception ex) {
      System.out.println("ControlManager'Inventory is Error!");
    }
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -