?? simpledispatchrule.java
字號:
ProcessRequirement.getInstance().getAvgRqmtByOperator( new Integer( tmpStyle.getProcessID()) );
double stdUsedThisTime = stdRemained -
(sumCapIdx - tmpStyle.getRequirement() );
stdRemained = stdRemained - stdUsedThisTime;
double percentRemained = stdRemained /
(pc.getCapability(tmpStyle.getProcessID()) *
ProcessRequirement.getInstance().getAvgRqmtByOperator( new Integer( tmpStyle.getProcessID()) ) );
pc.setAssignedPercentage(1 - percentRemained);
tmpStyle.addOperator(pc,
new Double(stdUsedThisTime /
(pc.
getCapability(tmpStyle.getProcessID()) *
ProcessRequirement.getInstance().getAvgRqmtByOperator( new Integer( tmpStyle.getProcessID()) )
) ) );
numAssigned++;
break;
}
else {
tmpStyle.addOperator(pc, new Double(pc.getAvailPercentage()));
pc.setAssignedPercentage(1.0);
numAssigned++;
}
}
//no matter how many operators available
if( sumCapIdx == 0 &&
! SewingOps.getInstance().isSewingOp( tmpStyle.getProcessID() ) ) {
ProcessCapability pc = ProcessRequirement.getInstance().getLastAssigned(
new Integer( tmpStyle.getProcessID() ) );
if( null != pc ) {
tmpStyle.addOperator(pc, new Double(1.0));
} else {
//for (int i = 0; i < tmpStyle.getNumOfOperators() - sumCapIdx; i++) {
pc = new ProcessCapability(getAnExtraOperator());
pcs.add(pc);
pc.setAssignedPercentage(1.0);
tmpStyle.addOperator(pc, new Double(1.0));
//}
}
}
if( SewingOps.getInstance().isSewingOp( tmpStyle.getProcessID() ) ) {
if (base == 0 && remainder != 0) {
double rank = OrderDetailsManHourMap.getInstance().getRank(tmpStyle);
if (rank <= remainder) {
for (int k = 0; k < capableOperators.size(); k++) {
ProcessCapability pc = (ProcessCapability) capableOperators.
elementAt(
k);
if (pc.isAssigned())
continue;
if (pc.getAssignedPID() != 0 &&
pc.getAssignedPID() != tmpStyle.getProcessID()) {
continue;
}
pc.setAssignedPID( tmpStyle.getProcessID() );
pc.setAssignedPercentage(1.0);
tmpStyle.addOperator(pc, new Double(1.0));
ProcessRequirement.getInstance().updateLastAssigned( new Integer( tmpStyle.getProcessID() ),
pc );
numAssigned++;
break;
}
}
else {
ProcessCapability pc = ProcessRequirement.getInstance().getLastAssigned(
new Integer( tmpStyle.getProcessID() ) );
if( null != pc ) {
tmpStyle.addOperator(pc, new Double(1.0));
} else {
//for (int i = 0; i < tmpStyle.getNumOfOperators() - sumCapIdx; i++) {
pc = new ProcessCapability(getAnExtraOperator());
pcs.add(pc);
pc.setAssignedPercentage(1.0);
tmpStyle.addOperator(pc, new Double(1.0));
//}
}
/*ProcessCapability pc = new ProcessCapability(getAnExtraOperator());
pc.setAssignedPercentage(1.0);
tmpStyle.addOperator(pc, new Double(1.0));*/
numAssigned++;
}
}
else if (base != 0 && remainder != 0) {
/*double rank = OrderDetailsManHourMap.getInstance().getRank(tmpStyle);
if (rank <= remainder) {
for (int k = 0; k < capableOperators.size(); k++) {
ProcessCapability pc = (ProcessCapability) capableOperators.
elementAt(
k);
if (pc.isAssigned())
continue;
if (pc.getAssignedPID() != 0 &&
pc.getAssignedPID() != tmpStyle.getProcessID()) {
continue;
}
pc.setAssignedPercentage(1.0);
tmpStyle.addOperator(pc, new Double(1.0));
numAssigned++;
break;
}
}*/
}
}
if( SewingOps.getInstance().isSewingOp( tmpStyle.getProcessID() ) &&
numAssigned == 0 ) {
ProcessCapability pc = ProcessRequirement.getInstance().getLastAssigned(
new Integer( tmpStyle.getProcessID() ) );
if( null != pc ) {
tmpStyle.addOperator(pc, new Double(1.0));
} else {
//for (int i = 0; i < tmpStyle.getNumOfOperators() - sumCapIdx; i++) {
pc = new ProcessCapability(getAnExtraOperator());
pcs.add(pc);
pc.setAssignedPercentage(1.0);
tmpStyle.addOperator(pc, new Double(1.0));
//}
}
/*ProcessCapability pc = new ProcessCapability(getAnExtraOperator());
pc.setAssignedPercentage(1.0);
tmpStyle.addOperator(pc, new Double(1.0));
numAssigned++;*/
}
for (int k = 0; k < pcs.size(); k++) {
ProcessCapability pc = (ProcessCapability) pcs.elementAt(k);
distinctOperators.put(pc, "");
}
System.out.println("debug here 1");
tmpStyle.generateSchedule();
System.out.println("here 2");
schedules.append(tmpStyle.getSchedules());
totalOperators += tmpStyle.getNumOfAssignedOperators();
}
System.out.println("debug 14");
}
private double getExtendRatio( Style tmpStyle ) {
Vector capableOperators = ProcessCapabilityTable.getInstance().
getCapableOperators(tmpStyle.getProcessID());
double sumCapIdx = 0;
for (int k = 0; k < capableOperators.size(); k++) {
ProcessCapability pc = (ProcessCapability) capableOperators.elementAt(
k);
if (pc.isAssignedTest())
continue;
if (pc.getAssignedPIDTest() != 0 &&
pc.getAssignedPIDTest() != tmpStyle.getProcessID()) {
continue;
}
sumCapIdx += pc.getCapability(tmpStyle.getProcessID()) *
pc.getAvailPercentageTest();
pc.setAssignedPIDTest(tmpStyle.getProcessID());
if (sumCapIdx >= tmpStyle.getNumOfOperators()) {
if( SewingOps.getInstance().isSewingOp( tmpStyle.getProcessID() ) ) {
pc.setAssignedPercentageTest(1.0);
break;
}
double stdRemained = pc.getCapability(tmpStyle.getProcessID()) *
pc.getAvailPercentageTest();
double stdUsedThisTime = stdRemained -
(sumCapIdx - tmpStyle.getNumOfOperators());
stdRemained = stdRemained - stdUsedThisTime;
double percentRemained = stdRemained /
pc.getCapability(tmpStyle.getProcessID());
pc.setAssignedPercentageTest(1 - percentRemained);
break;
}
else {
pc.setAssignedPercentageTest(1.0);
}
}
if( SewingOps.getInstance().isSewingOp( tmpStyle.getProcessID() ) )
return (tmpStyle.getNumOfOperators() - sumCapIdx) / tmpStyle.getNumOfOperators();
return 0;
}
private double getMaxExtendRatio( Vector styles ) {
//init all capable pcs
for (int j = 0; j < styles.size(); j++) {
Style tmpStyle = (Style) styles.elementAt(j);
Vector capableOperators = ProcessCapabilityTable.getInstance().
getCapableOperators(tmpStyle.getProcessID());
for (int k = 0; k < capableOperators.size(); k++) {
ProcessCapability pc = (ProcessCapability) capableOperators.elementAt(
k);
if (pc.isAssignedTest())
continue;
/*if (pc.getAssignedPIDTest() != 0 &&
pc.getAssignedPIDTest() != tmpStyle.getProcessID()) {
continue;
}*/
pc.initTestParameters();
}
}
//for all sewing processes
double maxRatio = 0;
for (int j = 0; j < styles.size(); j++) {
Style tmpStyle = (Style) styles.elementAt(j);
double tmpRatio = this.getExtendRatio( tmpStyle );
if( tmpRatio > maxRatio ) {
maxRatio = tmpRatio;
}
}
return maxRatio;
}
private void assignLeftOverOperators() {
//get all big orders
Hashtable stylesByOrder = OrderDetailsManHourMap.getInstance().
getStylesByOrder();
Enumeration orderIDs = stylesByOrder.keys();
Date dueDate = null;
//loop through all orders to get sum of max processing times
while (orderIDs.hasMoreElements()) {
String anOrderID = (String) orderIDs.nextElement();
Vector allStylesByOrder = OrderDetailsManHourMap.getInstance().
getDistinctStyleByOrder(anOrderID);
for (int i = 0; i < allStylesByOrder.size(); i++) {
Style aStyle = (Style) allStylesByOrder.elementAt(i);
dueDate = aStyle.getDueDate();
//get styles by orderID and styleID
Vector styles = OrderDetailsManHourMap.getInstance().getStyles(
anOrderID,
aStyle.getStyleID());
for (int j = 0; j < styles.size(); j++) {
Style tmpStyle = (Style) styles.elementAt(j);
if (!SewingOps.getInstance().isSewingOp(tmpStyle.getProcessID()))
continue;
Vector capableOperators = ProcessCapabilityTable.getInstance().
getCapableOperators(tmpStyle.getProcessID());
int remainder = 0;
for (int k = 0; k < capableOperators.size(); k++) {
ProcessCapability pc = (ProcessCapability) capableOperators.
elementAt(
k);
if (pc.isAssigned())
continue;
remainder++;
}
double rank = OrderDetailsManHourMap.getInstance().getRank(tmpStyle);
if (rank <= remainder) {
for (int k = 0; k < capableOperators.size(); k++) {
ProcessCapability pc = (ProcessCapability) capableOperators.
elementAt(
k);
if (pc.isAssigned())
continue;
if (pc.getAssignedPID() != 0 &&
pc.getAssignedPID() != tmpStyle.getProcessID()) {
continue;
}
pc.setAssignedPercentage(1.0);
tmpStyle.addOperator(pc, new Double(1.0));
OrderDetailsManHourMap.getInstance().readjustRank( tmpStyle );
break;
}
}
}
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -