排产系统
源代码在线查看: inventory.java
软件大小: |
4136 K |
上传用户: |
zhou28 |
|
|
关键词: |
|
下载地址: |
免注册下载 普通下载
|
|
package com.power.pipeengine.Entity;
import java.util.*;
import com.power.pipeengine.InputData.*;
public class Inventory
{
private String _productID;
private int _facilityID;
private Vector _buckets = new Vector();
private Vector _qtys = new Vector();
public Inventory( String prod, int facility ) {
_productID = prod;
_facilityID = facility;
}
public void addEntry( int bucketID, double qty ) {
PIPECalendar cal = DataModel.getInstance().getCalendar();
_buckets.addElement( cal.getBucket( bucketID ) );
_qtys.addElement( new Double( qty ) );
}
public double getInventoryQty( Bucket b ) {
for( int i=0; i Bucket bucket = (Bucket) _buckets.elementAt(i);
if( bucket.getBucketID() != b.getBucketID() ) continue;
return ((Double) _qtys.elementAt(i)).doubleValue();
}
return 0;
}
public double getInventoryQty( int bucketID ) {
Bucket b = DataModel.getInstance().getCalendar().getBucket( bucketID );
return getInventoryQty( b );
}
public void print() {
System.out.println( _productID + "," + _facilityID );
for( int i=0; i Bucket b = (Bucket) _buckets.elementAt(i);
Double qty = (Double) _qtys.elementAt(i);
System.out.println( "\t(" + b.getBucketID() + ", " + qty + ")" );
}
}
}