排产系统
源代码在线查看: productdispatch.java
软件大小: |
4136 K |
上传用户: |
zhou28 |
|
|
关键词: |
|
下载地址: |
免注册下载 普通下载
|
|
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 Facility f = (Facility) invFacilities.elementAt( i );
//System.out.println( "Facility = " + f.getDescription() );
Vector products = f.getProducts();
for( int j=0; 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 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();
}
}