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

📄 productdispatch.java

📁 简介: 今天为网友提供的是JAVA源码
💻 JAVA
字号:
package com.power.pipeengine.Report;

import java.util.*;
import java.io.*;
import java.text.*;

import com.power.pipeengine.Variable.*;
import com.power.pipeengine.Constraint.*;
import com.power.pipeengine.InputData.*;
import com.power.pipeengine.LPModel.*;
import com.power.pipeengine.Entity.*;
import com.power.pipeengine.*;
import com.power.pipe.*;

public class ProductDispatch extends Report
{
    private static final ProductDispatch INSTANCE =
                              new ProductDispatch();

   // Private constructor supresses
   // default public constructor
    private ProductDispatch( ) {
		_fileName = "ProductDispatch";
		//initFileWriter();
    }

    public static ProductDispatch getInstance( ) {
        return INSTANCE;
    }

    private StringBuffer content = new StringBuffer();

	public void createReport() throws IOException {
		Vector invFacilities = DataModel.getInstance().getFacilities().getInvFacilities();

		for( int i=0; i<invFacilities.size(); i++ ) {
			Facility f = (Facility) invFacilities.elementAt( i );
			//System.out.println( "Facility = " + f.getDescription() );
			Vector products = f.getProducts();
			for( int j=0; j<products.size(); j++ ) {
				Product p = (Product) products.elementAt( j );
				createReport( f, p );
			}
		}

		//_myFileWriter.close();
		super.flush( content.toString() );
        content = null;
        System.gc();
	}

	public void createReport( Facility f, Product p )
		throws IOException
	{
		Vector buckets = DataModel.getInstance().getCalendar().getBuckets();
		Vector producingRoutes = p.getProducingRoutes();
		Vector sourcingRoutes = p.getSourcingRoutes();
		ShipOutVariable shipOutVar = ShipOutVariable.getInstance();
		Solution sol = Solution.getInstance();
		String separator = GlobalConfig.getInstance().getSeparator();

		for( int i=0; i<buckets.size(); i++ ) {
			String constr = new String( );
			Bucket b = (Bucket) buckets.elementAt( i );
			Bucket prevBucket = null;

			//products shipped out to other inventory points
			Enumeration destFacilities = f.getDestinationFacilities().elements();
			while( destFacilities.hasMoreElements() ) {
				Vector shipments = (Vector) destFacilities.nextElement();
				for( int idx = 0; idx < shipments.size(); idx++ ) {
					Shipment s = (Shipment) shipments.elementAt( idx );
					/*if( EngineConfig.getInstance().getCollator().compare(
                        s.getFromProduct().getProductID(),
                        p.getProductID() ) == 0 ) {*/
                    if( s.getFromProduct().getProductNumber() == p.getProductNumber() ) {
						String var = shipOutVar.getVariable( f,
														  s.getToFacility(),
														  p,
														  b );
						int value = (int) (sol.getValue( var ) + EngineConfig.getInstance().PRECISION );
						if( value == 0 ) continue;

						String lineOut =    s.getFromFacilityID() + separator +
											p.getProductID() + separator +
											s.getToFacilityID() + separator +
											p.getProductID() + separator +
											b.getBucketID() + separator +
											value + "\n";
						content.append( lineOut );
					}
				}
			}


		}
	}

    public void reset() {
        content = new StringBuffer();
    }


}

⌨️ 快捷键说明

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