Commit a6b17e54 authored by Tong Li's avatar Tong Li

准备时间,前处理时间,后处理时间都从工序取

parent 13d1cc93
...@@ -144,6 +144,7 @@ public class Entry { ...@@ -144,6 +144,7 @@ public class Entry {
private double changeLineTime;//换模时间 private double changeLineTime;//换模时间
private BigDecimal setupTime;//准备时间 private BigDecimal setupTime;//准备时间
private int teardownTime; // 收尾时间(后处理时间) private int teardownTime; // 收尾时间(后处理时间)
private int preTime; // 收尾时间(后处理时间)
//常数时间 //常数时间
private int constTime; private int constTime;
private String equipCode;//设备编码 private String equipCode;//设备编码
......
...@@ -15,9 +15,9 @@ public class MachineOption { ...@@ -15,9 +15,9 @@ public class MachineOption {
private String equipCode; private String equipCode;
private String resourceCode; private String resourceCode;
private double processingTime; // 加工时间 (秒) private double processingTime; // 加工时间 (秒)
private int setupTime; // 换型时间(如果与前一个产品不同) // private int setupTime; // 换型时间(如果与前一个产品不同)
private int teardownTime; // 收尾时间(后处理时间) // private int teardownTime; // 收尾时间(后处理时间)
private int contantTime; // 常数时间 // private int contantTime; // 常数时间
private int preTime; // 前处理时间 // private int preTime; // 前处理时间
private String equipName; private String equipName;
} }
\ No newline at end of file
package com.aps.entity.basic; package com.aps.entity.basic;
import com.aps.entity.MaterialPurchase;
import com.aps.entity.Stock; import com.aps.entity.Stock;
import lombok.Data; import lombok.Data;
...@@ -32,6 +33,9 @@ public class Material { ...@@ -32,6 +33,9 @@ public class Material {
*/ */
private double CurrentStock; private double CurrentStock;
/**
* 库存详情
*/
List<Stock> materialStocks=new ArrayList<>(); List<Stock> materialStocks=new ArrayList<>();
/** /**
...@@ -39,6 +43,11 @@ public class Material { ...@@ -39,6 +43,11 @@ public class Material {
*/ */
private List<MaterialSupply> InTransit = new ArrayList<>(); private List<MaterialSupply> InTransit = new ArrayList<>();
/**
* 原材料供应商 定义原材料采购周期,检验周期 价格
*/
private List<MaterialPurchase> materialPurchases = new ArrayList<>();
/** /**
* 采购周期 * 采购周期
*/ */
......
...@@ -398,7 +398,7 @@ if(finishedOrder==null||finishedOrder.size()==0) ...@@ -398,7 +398,7 @@ if(finishedOrder==null||finishedOrder.size()==0)
int teardownTime = operation.getTeardownTime(); int teardownTime = operation.getTeardownTime();
//前处理时间 //前处理时间
int preTime = machineOption.getPreTime(); int preTime = operation.getPreTime();
//设置时间平滑 是 不考虑设置时间 //设置时间平滑 是 不考虑设置时间
//前处理,是否可以在相同任务前序未完工就开始设置时间, //前处理,是否可以在相同任务前序未完工就开始设置时间,
// 就是 最早开工时间是否+前处理时间,总的加工工时不考虑前处理 // 就是 最早开工时间是否+前处理时间,总的加工工时不考虑前处理
...@@ -497,8 +497,6 @@ if(finishedOrder==null||finishedOrder.size()==0) ...@@ -497,8 +497,6 @@ if(finishedOrder==null||finishedOrder.size()==0)
result.setProductName(operation.getProductName()); result.setProductName(operation.getProductName());
result.setProductCode(operation.getProductCode()); result.setProductCode(operation.getProductCode());
result.setMachineId(machine.getId()); result.setMachineId(machine.getId());
result.setStartTime(startTime); result.setStartTime(startTime);
result.setEndTime(endTime); result.setEndTime(endTime);
result.setOneTime(processingTime); result.setOneTime(processingTime);
...@@ -963,22 +961,6 @@ if(finishedOrder==null||finishedOrder.size()==0) ...@@ -963,22 +961,6 @@ if(finishedOrder==null||finishedOrder.size()==0)
return reslte; return reslte;
} }
private int calculateSetupTimeForConflict(List<GAScheduleResult> existingGenes, Entry operation, Machine machine,
MachineOption machineOption, GAScheduleResult conflictingGene) {
int setupTime = (conflictingGene.getProductId() != operation.getProductId())
? machineOption.getSetupTime()
: 0;
if (existingGenes.stream().filter(g -> g.getMachineId() == machine.getId()).count() <= 1) {
setupTime = 0;
}
if (setupTime > 0) {
// System.out.println("设备 " + machine.getId() + " 需要换型,因为产品从 " + conflictingGene.getProductId() + " 变更为 " + operation.getProductId());
}
return setupTime;
}
private void calculateScheduleResult(Chromosome chromosome) { private void calculateScheduleResult(Chromosome chromosome) {
// 1. 最早完工时间(最小化) // 1. 最早完工时间(最小化)
......
...@@ -286,9 +286,6 @@ if(routingIds.size()==0) ...@@ -286,9 +286,6 @@ if(routingIds.size()==0)
} }
else { else {
routingIds=headers1.getId().longValue(); routingIds=headers1.getId().longValue();
} }
if(headers1==null) if(headers1==null)
{ {
......
...@@ -195,9 +195,6 @@ public class RoutingDataService { ...@@ -195,9 +195,6 @@ public class RoutingDataService {
} else { } else {
od.setDependencyType(DependencyType.FinishToStart); od.setDependencyType(DependencyType.FinishToStart);
} }
OperationDependency.add(od); OperationDependency.add(od);
} }
entry.setNextEntryIds(OperationDependency); entry.setNextEntryIds(OperationDependency);
...@@ -217,6 +214,8 @@ public class RoutingDataService { ...@@ -217,6 +214,8 @@ public class RoutingDataService {
entry.setSetupTime(op.getSetupTime()); entry.setSetupTime(op.getSetupTime());
//后处理 //后处理
entry.setTeardownTime(op.getPostprocessingTime()); entry.setTeardownTime(op.getPostprocessingTime());
//前处理
entry.setPreTime(op.getPreprocessingTime());
entry.setConstTime(op.getConstTime()); entry.setConstTime(op.getConstTime());
entry.setOrderId(op.getOrderId()); entry.setOrderId(op.getOrderId());
entry.setOrderCode(op.getOrderCode()); entry.setOrderCode(op.getOrderCode());
...@@ -265,10 +264,10 @@ public class RoutingDataService { ...@@ -265,10 +264,10 @@ public class RoutingDataService {
mo.setEquipName(e.getEquipName()); mo.setEquipName(e.getEquipName());
mo.setResourceCode(e.getResourceCode()); mo.setResourceCode(e.getResourceCode());
mo.setProcessingTime(e.getSpeed()); mo.setProcessingTime(e.getSpeed());
mo.setContantTime(op.getConstTime()); // mo.setContantTime(op.getConstTime());
mo.setSetupTime(op.getChangeLineTime()); // mo.setSetupTime(op.getChangeLineTime());
mo.setTeardownTime(op.getPostprocessingTime()); // mo.setTeardownTime(op.getPostprocessingTime());
mo.setPreTime(e.getSetupTime()); // mo.setPreTime(e.getSetupTime());
mos.add(mo); mos.add(mo);
......
...@@ -1428,16 +1428,16 @@ public class ChromosomeDataService { ...@@ -1428,16 +1428,16 @@ public class ChromosomeDataService {
} }
// 处理preTime字段 // 处理preTime字段
if (data.containsKey("preTime")) { // if (data.containsKey("preTime")) {
Object preTimeObj = data.get("preTime"); // Object preTimeObj = data.get("preTime");
if (preTimeObj instanceof Integer) { // if (preTimeObj instanceof Integer) {
machineOption.setPreTime((Integer) preTimeObj); // machineOption.setPreTime((Integer) preTimeObj);
} else if (preTimeObj instanceof Long) { // } else if (preTimeObj instanceof Long) {
machineOption.setPreTime(((Long) preTimeObj).intValue()); // machineOption.setPreTime(((Long) preTimeObj).intValue());
} else if (preTimeObj instanceof String) { // } else if (preTimeObj instanceof String) {
machineOption.setPreTime(Integer.parseInt((String) preTimeObj)); // machineOption.setPreTime(Integer.parseInt((String) preTimeObj));
} // }
} // }
// 处理processingTime字段 - 修改为:时间(runtime) ÷ 数量(singleOut) // 处理processingTime字段 - 修改为:时间(runtime) ÷ 数量(singleOut)
if (data.containsKey("processingTime") || data.containsKey("singleOut") || data.containsKey("runtime")) { if (data.containsKey("processingTime") || data.containsKey("singleOut") || data.containsKey("runtime")) {
......
...@@ -104,6 +104,8 @@ public class PlanResultService { ...@@ -104,6 +104,8 @@ public class PlanResultService {
@Autowired @Autowired
private StockMapper stockMapper; private StockMapper stockMapper;
@Autowired @Autowired
private SjzPfWhStockMapper sjzPfWhStockMapper; private SjzPfWhStockMapper sjzPfWhStockMapper;
...@@ -1332,8 +1334,6 @@ private GlobalParam InitGlobalParam() ...@@ -1332,8 +1334,6 @@ private GlobalParam InitGlobalParam()
for (MaterialInfo m : materiallist) for (MaterialInfo m : materiallist)
{ {
// materiallist.forEach(m -> { // materiallist.forEach(m -> {
Material material = new Material(); Material material = new Material();
material.setId(m.getId()); material.setId(m.getId());
...@@ -1342,11 +1342,11 @@ private GlobalParam InitGlobalParam() ...@@ -1342,11 +1342,11 @@ private GlobalParam InitGlobalParam()
material.setCkeckLeadTime(m.getInspectDuration()); material.setCkeckLeadTime(m.getInspectDuration());
material.setPurchaseLeadTime(m.getPurchaseDuration()); material.setPurchaseLeadTime(m.getPurchaseDuration());
List<Stock> materialStocks= Stocklist.stream() if(Stocklist!=null&&Stocklist.size()>0) {
List<Stock> materialStocks = Stocklist.stream()
.filter(t -> t.getMaterialId().equals(m.getId())) .filter(t -> t.getMaterialId().equals(m.getId()))
.collect(Collectors.toList()); .collect(Collectors.toList());
if(materialStocks!=null&&materialStocks.size()>0) if (materialStocks != null && materialStocks.size() > 0) {
{
double stock = materialStocks.stream() double stock = materialStocks.stream()
.filter(t -> t.getMaterialId().equals(m.getId())) .filter(t -> t.getMaterialId().equals(m.getId()))
.mapToDouble(Stock::getTotal) .mapToDouble(Stock::getTotal)
...@@ -1355,12 +1355,23 @@ private GlobalParam InitGlobalParam() ...@@ -1355,12 +1355,23 @@ private GlobalParam InitGlobalParam()
material.setMaterialStocks(materialStocks); material.setMaterialStocks(materialStocks);
} }
}
if(MaterialPurchaselist!=null&&MaterialPurchaselist.size()>0)
{
List<MaterialPurchase> materialPurchases = MaterialPurchaselist.stream()
.filter(t -> t.getMaterialId().equals(m.getId()))
.collect(Collectors.toList());
material.setMaterialPurchases(materialPurchases);
}
List<MaterialSupply> materialSupplys = new ArrayList<>();
if(m.getMaterialTypeName()==null) if(m.getMaterialTypeName()==null)
{ {
continue; continue;
} }
List<MaterialSupply> materialSupplys = new ArrayList<>();
if (m.getMaterialTypeName().equals("MP")) { if (m.getMaterialTypeName().equals("MP")) {
List<PurchaseReceipt> PurchaseReceipts = PurchaseReceiptlist.stream() List<PurchaseReceipt> PurchaseReceipts = PurchaseReceiptlist.stream()
.filter(t -> t.getMaterialid() == m.getId()) .filter(t -> t.getMaterialid() == m.getId())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment