Просмотр исходного кода

排产算法优化,原有operation和part直接用task、workpiece替换

yejian016332 3 лет назад
Родитель
Сommit
959ac90bd9
18 измененных файлов с 1261 добавлено и 1070 удалено
  1. 5 6
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/algorithm/ga/GAScheduleManager.java
  2. 5 5
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/algorithm/ga/GAScheduler.java
  3. 0 1
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/CandidateProcess.java
  4. 44 83
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/Instance.java
  5. 7 8
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/Machine.java
  6. 428 428
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/Operation.java
  7. 232 232
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/Part.java
  8. 2 2
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/objective/ObjectiveCmax.java
  9. 24 48
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/manager/AssignManager.java
  10. 7 7
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/manager/ScheduleManager.java
  11. 2 2
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/manager/iface/AssignManagerIface.java
  12. 3 3
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/rule/OperationPriority.java
  13. 5 3
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/rule/basic/OperationRule.java
  14. 2 2
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/util/InstanceUtil.java
  15. 139 131
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderServiceImpl.java
  16. 23 42
      imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java
  17. 229 50
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/TTask.java
  18. 104 17
      imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/TWorkpiece.java

+ 5 - 6
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/algorithm/ga/GAScheduleManager.java

@@ -1,9 +1,9 @@
 package com.github.zuihou.business.aps.algorithm.ga;
 
 import com.github.zuihou.business.aps.instance.domain.basicdata.Instance;
-import com.github.zuihou.business.aps.instance.domain.basicdata.Operation;
 import com.github.zuihou.business.aps.instance.manager.ScheduleManager;
 import com.github.zuihou.business.aps.rule.OperationPriority;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -35,7 +35,7 @@ public class GAScheduleManager extends ScheduleManager {
 		try {
 			this.beforeSchedule(instance, 0);
 
-			for (Operation operation : instance.getOperationMap().values()) {
+			for (TTask operation : instance.getOperationMap().values()) {
 				operation.setOpPriority(priorityArray[i]);
 				i++;
 			}
@@ -59,7 +59,7 @@ public class GAScheduleManager extends ScheduleManager {
 		// 只要就绪任务集合不为空,则继续安排
 		while (!instance.getReadyTaskS().isEmpty()) {
 			// 获得最优先的任务
-			Operation operation = instance.getReadyTaskS().first();
+			TTask operation = instance.getReadyTaskS().first();
 			// 分派任务
 			assignManager.assignTask(instance, operation);
 		}
@@ -67,13 +67,12 @@ public class GAScheduleManager extends ScheduleManager {
 
 	@Override
 	public void initReadyTasks(Instance instance) throws Exception {
-		// TODO Auto-generated method stub
-		Comparator<Operation> operationTaskComparator = instance.getOperationComparator();
+		Comparator<TTask> operationTaskComparator = instance.getOperationComparator();
 		if (operationTaskComparator == null) {
             operationTaskComparator = new OperationPriority();
         }
 		// 设置工序优先级比较器
-		TreeSet<Operation> readyTaskS = new TreeSet<Operation>(operationTaskComparator);
+		TreeSet<TTask> readyTaskS = new TreeSet<TTask>(operationTaskComparator);
 		// 重新排序
 		readyTaskS.addAll(instance.getReadyTaskS());
 		instance.setReadyTaskS(readyTaskS);

+ 5 - 5
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/algorithm/ga/GAScheduler.java

@@ -4,7 +4,7 @@ import cn.hutool.core.date.DateUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.github.zuihou.business.aps.algorithm.ga.problem.GAPriorityScheduleProblem;
 import com.github.zuihou.business.aps.instance.domain.basicdata.Instance;
-import com.github.zuihou.business.aps.instance.domain.basicdata.Operation;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import io.jenetics.*;
 import io.jenetics.engine.Engine;
 import io.jenetics.engine.EvolutionResult;
@@ -58,7 +58,7 @@ public class GAScheduler {
 
 				Phenotype<IntegerGene, Double> best = engine.stream()
 						.limit(100)
-						.peek(r -> System.out.println( DateUtil.format(new Date(r.getGeneration()),"yyyy-MM-dd HH:mm:ss") + " : " + r.getBestPhenotype()))
+						.peek(r -> System.out.println( DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss") + " : " + r.getBestPhenotype()))
 						.collect(EvolutionResult.toBestPhenotype());
 				results.add(best.getFitness());
 				System.out.println("Found min objective: " + DateUtil.format(new Date(best.getFitness().longValue()),"yyyy-MM-dd HH:mm:ss"));
@@ -75,10 +75,10 @@ public class GAScheduler {
 				+ results.stream().mapToDouble(Double::doubleValue).min().orElse(0D));
 		long end = System.currentTimeMillis();
 		instance.getObjective().setObjectiveValue(results.stream().mapToDouble(Double::doubleValue).min().orElse(0D));
-		Iterator<Map.Entry<String, Operation>> it = instance.getOperationMap().entrySet().iterator();
+		Iterator<Map.Entry<String, TTask>> it = instance.getOperationMap().entrySet().iterator();
 		while(it.hasNext()){
-			Operation operation = it.next().getValue();
-			System.out.println("[" + operation.getPartId() + "]" + operation.getName() + "[" + operation.getMachineId() + "]" + ":"+ DateUtil.format(new Date(operation.getStart()),"yyyy-MM-dd HH:mm:ss") + "-" + DateUtil.format(new Date(operation.getFinish()),"yyyy-MM-dd HH:mm:ss"));
+			TTask operation = it.next().getValue();
+			System.out.println("[" + operation.getCompleteBatchNo() + "]" + operation.getProcedureNo() + "[" + operation.getMachineId() + "]" + ":"+ DateUtil.format(new Date(operation.getStart()),"yyyy-MM-dd HH:mm:ss") + "-" + DateUtil.format(new Date(operation.getFinish()),"yyyy-MM-dd HH:mm:ss"));
 		}
 		System.out.println(JSONObject.toJSONString(instance.getPartMap()));
 		System.out.println("调度用时:" + (end - start) / 1000.0 / 60.0 + "分钟");

+ 0 - 1
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/CandidateProcess.java

@@ -15,7 +15,6 @@ import lombok.ToString;
  */
 @Data
 @NoArgsConstructor
-@ToString(callSuper = true)
 @AllArgsConstructor
 public class CandidateProcess {
 	/**

+ 44 - 83
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/Instance.java

@@ -1,10 +1,16 @@
 package com.github.zuihou.business.aps.instance.domain.basicdata;
 
 
+import com.baomidou.mybatisplus.annotation.TableName;
 import com.github.zuihou.business.aps.instance.domain.objective.Objective;
 import com.github.zuihou.business.aps.instance.domain.objective.ObjectiveCmax;
 import com.github.zuihou.business.aps.rule.OperationPriority;
 import com.github.zuihou.business.aps.rule.basic.OperationRule;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
+import io.swagger.annotations.ApiModel;
+import lombok.*;
+import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.util.*;
@@ -14,6 +20,10 @@ import java.util.*;
  * @description: 调度案例类,包含了所有和调度相关的信息:工件、工序、可选工艺、工时等
  * @date: 2021年11月29日
  */
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
 public class Instance implements Serializable {
 
 	/**
@@ -36,7 +46,7 @@ public class Instance implements Serializable {
 	/**
 	 * 工序集合(工序名+工序)
 	 */
-	protected Map<String, Operation> operationMap = new HashMap<>();
+	protected Map<String, TTask> operationMap = new HashMap<>();
 	/**
 	 * 设备集合(设备名+设备)
 	 */
@@ -44,7 +54,7 @@ public class Instance implements Serializable {
 	/**
 	 * 零件集合(零件名称+零件)
 	 */
-	protected Map<String, Part> partMap = new HashMap<>();
+	protected Map<String, TWorkpiece> partMap = new HashMap<>();
 
 	/**
 	 * 上一步的调度目标值
@@ -54,7 +64,7 @@ public class Instance implements Serializable {
 	/**
 	 * 就绪任务集合
 	 */
-	protected TreeSet<Operation> readyTaskS = new TreeSet<Operation>(new OperationPriority());
+	protected TreeSet<TTask> readyTaskS = new TreeSet<TTask>(new OperationPriority());
 	/**
 	 * 工序任务比较器
 	 */
@@ -97,7 +107,7 @@ public class Instance implements Serializable {
 	/**
 	 * @return the operationMap
 	 */
-	public Map<String, Operation> getOperationMap() {
+	public Map<String, TTask> getOperationMap() {
 		return operationMap;
 	}
 
@@ -105,7 +115,7 @@ public class Instance implements Serializable {
 	 * @param operationMap
 	 *            the operationMap to set
 	 */
-	public void setOperationMap(Map<String, Operation> operationMap) {
+	public void setOperationMap(Map<String, TTask> operationMap) {
 		this.operationMap = operationMap;
 	}
 
@@ -127,7 +137,7 @@ public class Instance implements Serializable {
 	/**
 	 * @return the partMap
 	 */
-	public Map<String, Part> getPartMap() {
+	public Map<String, TWorkpiece> getPartMap() {
 		return partMap;
 	}
 
@@ -135,7 +145,7 @@ public class Instance implements Serializable {
 	 * @param partMap
 	 *            the partMap to set
 	 */
-	public void setPartMap(Map<String, Part> partMap) {
+	public void setPartMap(Map<String, TWorkpiece> partMap) {
 		this.partMap = partMap;
 	}
 
@@ -145,15 +155,15 @@ public class Instance implements Serializable {
 	 */
 	public void reset() {
 		this.lastObjectiveValue = 0;
-		this.getObjective().setObjectiveValue(0);
+		this.objective.setObjectiveValue(0);
 		this.totalAssignedTaskWork = 0;
 		// 括号内可设置比较器
-		readyTaskS = new TreeSet<Operation>(new OperationPriority());
-		for (Part part : partMap.values()) {
+		readyTaskS = new TreeSet<TTask>(new OperationPriority());
+		for (TWorkpiece part : partMap.values()) {
 			part.setCurrOp(part.getOpList().get(0));
 			readyTaskS.add(part.getCurrOp());
 		}
-		for (Operation operation : operationMap.values()) {
+		for (TTask operation : operationMap.values()) {
 			// 清除计划时间
 			operation.setStart(0);
 			operation.setFinish(0);
@@ -161,7 +171,7 @@ public class Instance implements Serializable {
 			operation.setMachineId(-1);
 			operation.setMachineName("");
 			// 初始为未调度状态
-			operation.setState(Operation.Unassigned_state);
+			operation.setState(TTask.Unassigned_state);
 			if(operation.getFixedMachineID() == -1 ){
 				operation.setFixedMachineID(-1);
 			}
@@ -177,17 +187,19 @@ public class Instance implements Serializable {
 			machine.setUtilRation(0);
 
 			for(String noUseTime : machine.getNoUseTime()){
-				Operation operation = new Operation();
+				TTask operation = new TTask();
 				String[] noUseTimeScope = noUseTime.split("-");
 				long noUseTimeStart = Long.parseLong(noUseTimeScope[0]);
 				long noUseTimeEnd = Long.parseLong(noUseTimeScope[1]);
 				operation.setStart(noUseTimeStart);
 				operation.setFinish(noUseTimeEnd);
+
+
 				machine.getQueueList().add(operation);
 			}
 
 		}
-		for (Part part : partMap.values()) {
+		for (TWorkpiece part : partMap.values()) {
             part.setStart(0);
             part.setFinish(0);
         }
@@ -200,11 +212,11 @@ public class Instance implements Serializable {
 		// 默认目标为制造期
 		this.objective = new ObjectiveCmax();
 		operationMap.clear();
-		for (Part part : partMap.values()) {
+		for (TWorkpiece part : partMap.values()) {
 			double remainWork = 0d;
 			int iSize = part.getOpList().size();
 			for (int j = iSize - 1; j >= 0; j--) {
-				Operation operation = part.getOpList().get(j);
+				TTask operation = part.getOpList().get(j);
 				remainWork += operation.getWorkTime();
 				operation.setRemainWorkTime(remainWork);
 				// 刷新剩余工序数
@@ -222,13 +234,13 @@ public class Instance implements Serializable {
 						operation.setSuccOp(part.getOpList().get(j + 1));
 					}
 				}
-				operationMap.put(operation.getPartId() + "_" + operation.getName(), operation);
+				operationMap.put(operation.getCompleteBatchNo() + "_" + operation.getProcedureNo(), operation);
 			}
 			part.setTotalWorkTime(remainWork);
 		}
-		class AssginedOpComp implements Comparator<Operation>, Serializable {
+		class AssginedOpComp implements Comparator<TTask>, Serializable {
 			@Override
-			public int compare(Operation o1, Operation o2) {
+			public int compare(TTask o1, TTask o2) {
 				// TODO Auto-generated method stub
 				if (o1.getStart() > o2.getStart()) {
 					return 1;
@@ -241,73 +253,22 @@ public class Instance implements Serializable {
 		}
 		// 设置机床上已安排任务的比较器
 		for (Machine machine : machineMap.values()) {
-			TreeSet<Operation> queueList = new TreeSet<Operation>(new AssginedOpComp());
+			TreeSet<TTask> queueList = new TreeSet<TTask>(new AssginedOpComp());
 			machine.setQueueList(queueList);
 		}
 	}
 
-	public TreeSet<Operation> getReadyTaskS() {
-		return readyTaskS;
-	}
-
-	public void setReadyTaskS(TreeSet<Operation> readyTaskS) {
-		this.readyTaskS = readyTaskS;
-	}
-
-	public OperationRule getOperationComparator() {
-		return operationComparator;
-	}
-
-	public void setOperationComparator(OperationRule operationComparator) {
-		this.operationComparator = operationComparator;
-	}
-
-	public double getTotalWorkTime() {
-		return totalWorkTime;
-	}
-
-	public void setTotalWorkTime(double totalWorkTime) {
-		this.totalWorkTime = totalWorkTime;
-	}
-
-	public double getTotalOpNum() {
-		return totalOpNum;
-	}
-
-	public void setTotalOpNum(double totalOpNum) {
-		this.totalOpNum = totalOpNum;
-	}
-
-
-	public double getTotalAssignedTaskWork() {
-		return totalAssignedTaskWork;
-	}
-
-	public void setTotalAssignedTaskWork(double totalAssignedTaskWork) {
-		this.totalAssignedTaskWork = totalAssignedTaskWork;
-	}
-
-	public void setObjective(Objective objective) {
-		this.objective = objective;
-	}
-
-	public double getLastObjectiveValue() {
-		return lastObjectiveValue;
-	}
-
-	public void setLastObjectiveValue(double lastObjectiveValue) {
-		this.lastObjectiveValue = lastObjectiveValue;
-	}
-
-	public Objective getObjective() {
-		return objective;
-	}
-
-	public long getCalcBeginDate() {
-		return calcBeginDate;
-	}
-
-	public void setCalcBeginDate(long calcBeginDate) {
-		this.calcBeginDate = calcBeginDate;
+	@Override
+	public String toString() {
+		return "Instance{" +
+				"totalWorkTime=" + totalWorkTime +
+				", totalOpNum=" + totalOpNum +
+				", partNum=" + partNum +
+				", lastObjectiveValue=" + lastObjectiveValue +
+				", operationComparator=" + operationComparator +
+				", totalAssignedTaskWork=" + totalAssignedTaskWork +
+				", objective=" + objective +
+				", calcBeginDate=" + calcBeginDate +
+				'}';
 	}
 }

+ 7 - 8
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/Machine.java

@@ -1,5 +1,6 @@
 package com.github.zuihou.business.aps.instance.domain.basicdata;
 
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 import com.github.zuihou.business.productionReadyCenter.entity.CuttingTool;
 
 import java.io.Serializable;
@@ -19,16 +20,14 @@ public class Machine implements Serializable {
 	// 查询系统当前机床最新的刀具信息 刀名-刀具寿命信息
 	Map<String, CuttingTool> cuttingTools = new HashMap<String, CuttingTool>();
 
-
-
 	/**
 	 * 机床缓存,需要根据学习到的策略确定比较器
 	 */
-	transient private TreeSet<Operation> buffer = new TreeSet<Operation>();
+	transient private TreeSet<TTask> buffer = new TreeSet<TTask>();
 
-	class AssginedOpComp implements Comparator<Operation>, Serializable {
+	class AssginedOpComp implements Comparator<TTask>, Serializable {
 		@Override
-		public int compare(Operation o1, Operation o2) {
+		public int compare(TTask o1, TTask o2) {
 			// TODO Auto-generated method stub
 			if (o1.getStart() > o2.getStart()) {
 				return 1;
@@ -41,7 +40,7 @@ public class Machine implements Serializable {
 	}
 
 	// 队列结果
-	private TreeSet<Operation> queueList = new TreeSet<Operation>(new AssginedOpComp());
+	private TreeSet<TTask> queueList = new TreeSet<TTask>(new AssginedOpComp());
 	public Machine() {
 	}
 
@@ -95,11 +94,11 @@ public class Machine implements Serializable {
 		this.loadRation = loadRation;
 	}
 
-	public TreeSet<Operation> getQueueList() {
+	public TreeSet<TTask> getQueueList() {
 		return queueList;
 	}
 
-	public void setQueueList(TreeSet<Operation> queueList) {
+	public void setQueueList(TreeSet<TTask> queueList) {
 		this.queueList = queueList;
 	}
 

+ 428 - 428
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/Operation.java

@@ -1,428 +1,428 @@
-package com.github.zuihou.business.aps.instance.domain.basicdata;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- *
- * @author: igen
- * @description: 工序类
- * @date: 2021年11月29日
- *
- */
-public class Operation implements Serializable {
-	/**
-	 * 已分派状态
-	 */
-	public static final int Assigned_State = 1;
-	/**
-	 * 未分派状态
-	 */
-	public static final int Unassigned_state = 0;
-	/**
-	 * 工序号
-	 */
-	private String id;
-	/**
-	 * 零件号
-	 */
-	private String partId;
-	/**
-	 * 零件
-	 */
-	private Part part;
-	/**
-	 * 工序名称
-	 */
-	private String name;
-	/**
-	 * 工序顺序(排序用)
-	 */
-	private int seq;
-	/**
-	 * 准备时间
-	 */
-	private double preTime;
-	/**
-	 * 单件时间
-	 */
-	private double runTime; // 选择工时
-	/**
-	 * 设备编号
-	 */
-	private long machineId; // 选择设备
-	/**
-	 * 固定的机床编号,用于解码时确定已安排的机床(-1表示未被安排机床)
-	 */
-	private int fixedMachineID = -1;
-	/**
-	 * 设备名称
-	 */
-	private String machineName; // 选择设备
-	/**
-	 * 可选设备数量
-	 */
-	private int candidateProNum; // 可选设备数量
-	/**
-	 * 权重
-	 */
-	private double weight;// 权重
-	/**
-	 * 交货期
-	 */
-	private long dueDate;
-	/**
-	 * 最早开始
-	 */
-	private long earlyStart;
-	/**
-	 * 开始
-	 */
-	private long start;
-	/**
-	 * 结束
-	 */
-	private long finish;
-	/**
-	 * 工序预计开始
-	 */
-	private Date earlyStartTime;
-	/**
-	 * 工序预计结束
-	 */
-	private Date earlyEndTime;
-	/**
-	 * 开始
-	 */
-	private String expectStartTime;
-	/**
-	 * 结束
-	 */
-	private String expectEndTime;
-	/**
-	 * 计划数,默认为1
-	 */
-	private int planQty = 1;
-	/**
-	 * 前置工序
-	 */
-	private Operation prepOp;
-	/**
-	 * 后置工序
-	 */
-	private Operation SuccOp;
-	/**
-	 * 状态0未调度 1已调度
-	 */
-	private int state;
-	/**
-	 * 剩余工序数
-	 */
-	private int remainOpNum;
-	/**
-	 * 剩余工时
-	 */
-	private double remainWorkTime;
-
-	/**
-	 * 工序优先级
-	 */
-	private double opPriority;
-
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	/**
-	 * @return the partId
-	 */
-	public String getPartId() {
-		return partId;
-	}
-
-	/**
-	 * @param partId
-	 *            the partId to set
-	 */
-	public void setPartId(String partId) {
-		this.partId = partId;
-	}
-
-	/**
-	 * @return the name
-	 */
-	public String getName() {
-		return name;
-	}
-
-	/**
-	 * @param name
-	 *            the name to set
-	 */
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	/**
-	 * @return the seq
-	 */
-	public int getSeq() {
-		return seq;
-	}
-
-	/**
-	 * @param seq
-	 *            the seq to set
-	 */
-	public void setSeq(int seq) {
-		this.seq = seq;
-	}
-
-	/**
-	 * @return the preTime
-	 */
-	public double getPreTime() {
-		return preTime;
-	}
-
-	/**
-	 * @param preTime
-	 *            the preTime to set
-	 */
-	public void setPreTime(double preTime) {
-		this.preTime = preTime;
-	}
-
-	/**
-	 * @return the runTime
-	 */
-	public double getRunTime() {
-		return runTime;
-	}
-
-	/**
-	 * @param runTime
-	 *            the runTime to set
-	 */
-	public void setRunTime(double runTime) {
-		this.runTime = runTime;
-	}
-
-	public long getMachineId() {
-		return machineId;
-	}
-
-	public void setMachineId(long machineId) {
-		this.machineId = machineId;
-	}
-
-	/**
-	 * @return the machineName
-	 */
-	public String getMachineName() {
-		return machineName;
-	}
-
-	/**
-	 * @param machineName
-	 *            the machineName to set
-	 */
-	public void setMachineName(String machineName) {
-		this.machineName = machineName;
-	}
-
-	/**
-	 * @return the candidateProNum
-	 */
-	public int getCandidateProNum() {
-		return candidateProNum;
-	}
-
-	/**
-	 * @param candidateProNum
-	 *            the candidateProNum to set
-	 */
-	public void setCandidateProNum(int candidateProNum) {
-		this.candidateProNum = candidateProNum;
-	}
-
-	/**
-	 * @return the dueDate
-	 */
-	public long getDueDate() {
-		return dueDate;
-	}
-
-	/**
-	 * @param dueDate
-	 *            the dueDate to set
-	 */
-	public void setDueDate(long dueDate) {
-		this.dueDate = dueDate;
-	}
-
-	public long getStart() {
-		return start;
-	}
-
-	public void setStart(long start) {
-		this.start = start;
-	}
-
-	public long getFinish() {
-		return finish;
-	}
-
-	public void setFinish(long finish) {
-		this.finish = finish;
-	}
-
-	public double getWeight() {
-		return weight;
-	}
-
-	public void setWeight(double weight) {
-		this.weight = weight;
-	}
-
-	public int getPlanQty() {
-		return planQty;
-	}
-
-	/**
-	 * 临时使用,因为可能对于不同的设备工时不同
-	 *
-	 * @return 下午3:42:57
-	 */
-	public double getWorkTime() {
-		return this.planQty * this.runTime + this.preTime;
-	}
-
-	public void setPlanQty(int planQty) {
-		this.planQty = planQty;
-	}
-
-	public Operation getPrepOp() {
-		return prepOp;
-	}
-
-	public void setPrepOp(Operation prepOp) {
-		this.prepOp = prepOp;
-	}
-
-	public Operation getSuccOp() {
-		return SuccOp;
-	}
-
-	public void setSuccOp(Operation succOp) {
-		SuccOp = succOp;
-	}
-
-	public long getEarlyStart() {
-		return earlyStart;
-	}
-
-	public void setEarlyStart(long earlyStart) {
-		this.earlyStart = earlyStart;
-	}
-
-	public int getState() {
-		return state;
-	}
-
-	public void setState(int state) {
-		this.state = state;
-	}
-
-	public int getRemainOpNum() {
-		return remainOpNum;
-	}
-
-	public void setRemainOpNum(int remainOpNum) {
-		this.remainOpNum = remainOpNum;
-	}
-
-	public double getRemainWorkTime() {
-		return remainWorkTime;
-	}
-
-	public void setRemainWorkTime(double remainWorkTime) {
-		this.remainWorkTime = remainWorkTime;
-	}
-
-	public double getOpPriority() {
-		return opPriority;
-	}
-
-	public void setOpPriority(double opPriority) {
-		this.opPriority = opPriority;
-	}
-
-	public Part getPart() {
-		return part;
-	}
-
-	public void setPart(Part part) {
-		this.part = part;
-	}
-
-	public int getFixedMachineID() {
-		return fixedMachineID;
-	}
-
-	public void setFixedMachineID(int fixedMachineID) {
-		this.fixedMachineID = fixedMachineID;
-	}
-
-	public Date getEarlyStartTime() {
-		return earlyStartTime;
-	}
-
-	public void setEarlyStartTime(Date earlyStartTime) {
-		this.earlyStartTime = earlyStartTime;
-	}
-
-	public Date getEarlyEndTime() {
-		return earlyEndTime;
-	}
-
-	public void setEarlyEndTime(Date earlyEndTime) {
-		this.earlyEndTime = earlyEndTime;
-	}
-
-	public String getExpectStartTime() {
-		return expectStartTime;
-	}
-
-	public void setExpectStartTime(String expectStartTime) {
-		this.expectStartTime = expectStartTime;
-	}
-
-	public String getExpectEndTime() {
-		return expectEndTime;
-	}
-
-	public void setExpectEndTime(String expectEndTime) {
-		this.expectEndTime = expectEndTime;
-	}
-
-	@Override
-	public String toString() {
-		return "Operation{" +
-				"partId=" + partId +
-				", earlyStart=" + earlyStart +
-				", start=" + start +
-				", finish=" + finish +
-				", expectStartTime=" + expectStartTime +
-				", expectEndTime=" + expectEndTime +
-				", remainOpNum=" + remainOpNum +
-				", remainWorkTime=" + remainWorkTime +
-				", opPriority=" + opPriority +
-				", machineId=" + machineId +
-				'}';
-	}
-}
+//package com.github.zuihou.business.aps.instance.domain.basicdata;
+//
+//import java.io.Serializable;
+//import java.util.Date;
+//
+///**
+// *
+// * @author: igen
+// * @description: 工序类
+// * @date: 2021年11月29日
+// *
+// */
+//public class Operation implements Serializable {
+//	/**
+//	 * 已分派状态
+//	 */
+//	public static final int Assigned_State = 1;
+//	/**
+//	 * 未分派状态
+//	 */
+//	public static final int Unassigned_state = 0;
+//	/**
+//	 * 工序号
+//	 */
+//	private String id;
+//	/**
+//	 * 零件号
+//	 */
+//	private String partId;
+//	/**
+//	 * 零件
+//	 */
+//	private Part part;
+//	/**
+//	 * 工序名称
+//	 */
+//	private String name;
+//	/**
+//	 * 工序顺序(排序用)
+//	 */
+//	private int seq;
+//	/**
+//	 * 准备时间
+//	 */
+//	private double preTime;
+//	/**
+//	 * 单件时间
+//	 */
+//	private double runTime; // 选择工时
+//	/**
+//	 * 设备编号
+//	 */
+//	private long machineId; // 选择设备
+//	/**
+//	 * 固定的机床编号,用于解码时确定已安排的机床(-1表示未被安排机床)
+//	 */
+//	private int fixedMachineID = -1;
+//	/**
+//	 * 设备名称
+//	 */
+//	private String machineName; // 选择设备
+//	/**
+//	 * 可选设备数量
+//	 */
+//	private int candidateProNum; // 可选设备数量
+//	/**
+//	 * 权重
+//	 */
+//	private double weight;// 权重
+//	/**
+//	 * 交货期
+//	 */
+//	private long dueDate;
+//	/**
+//	 * 最早开始
+//	 */
+//	private long earlyStart;
+//	/**
+//	 * 开始
+//	 */
+//	private long start;
+//	/**
+//	 * 结束
+//	 */
+//	private long finish;
+//	/**
+//	 * 工序预计开始
+//	 */
+//	private Date earlyStartTime;
+//	/**
+//	 * 工序预计结束
+//	 */
+//	private Date earlyEndTime;
+//	/**
+//	 * 开始
+//	 */
+//	private String expectStartTime;
+//	/**
+//	 * 结束
+//	 */
+//	private String expectEndTime;
+//	/**
+//	 * 计划数,默认为1
+//	 */
+//	private int planQty = 1;
+//	/**
+//	 * 前置工序
+//	 */
+//	private Operation prepOp;
+//	/**
+//	 * 后置工序
+//	 */
+//	private Operation SuccOp;
+//	/**
+//	 * 状态0未调度 1已调度
+//	 */
+//	private int state;
+//	/**
+//	 * 剩余工序数
+//	 */
+//	private int remainOpNum;
+//	/**
+//	 * 剩余工时
+//	 */
+//	private double remainWorkTime;
+//
+//	/**
+//	 * 工序优先级
+//	 */
+//	private double opPriority;
+//
+//	public String getId() {
+//		return id;
+//	}
+//
+//	public void setId(String id) {
+//		this.id = id;
+//	}
+//
+//	/**
+//	 * @return the partId
+//	 */
+//	public String getPartId() {
+//		return partId;
+//	}
+//
+//	/**
+//	 * @param partId
+//	 *            the partId to set
+//	 */
+//	public void setPartId(String partId) {
+//		this.partId = partId;
+//	}
+//
+//	/**
+//	 * @return the name
+//	 */
+//	public String getName() {
+//		return name;
+//	}
+//
+//	/**
+//	 * @param name
+//	 *            the name to set
+//	 */
+//	public void setName(String name) {
+//		this.name = name;
+//	}
+//
+//	/**
+//	 * @return the seq
+//	 */
+//	public int getSeq() {
+//		return seq;
+//	}
+//
+//	/**
+//	 * @param seq
+//	 *            the seq to set
+//	 */
+//	public void setSeq(int seq) {
+//		this.seq = seq;
+//	}
+//
+//	/**
+//	 * @return the preTime
+//	 */
+//	public double getPreTime() {
+//		return preTime;
+//	}
+//
+//	/**
+//	 * @param preTime
+//	 *            the preTime to set
+//	 */
+//	public void setPreTime(double preTime) {
+//		this.preTime = preTime;
+//	}
+//
+//	/**
+//	 * @return the runTime
+//	 */
+//	public double getRunTime() {
+//		return runTime;
+//	}
+//
+//	/**
+//	 * @param runTime
+//	 *            the runTime to set
+//	 */
+//	public void setRunTime(double runTime) {
+//		this.runTime = runTime;
+//	}
+//
+//	public long getMachineId() {
+//		return machineId;
+//	}
+//
+//	public void setMachineId(long machineId) {
+//		this.machineId = machineId;
+//	}
+//
+//	/**
+//	 * @return the machineName
+//	 */
+//	public String getMachineName() {
+//		return machineName;
+//	}
+//
+//	/**
+//	 * @param machineName
+//	 *            the machineName to set
+//	 */
+//	public void setMachineName(String machineName) {
+//		this.machineName = machineName;
+//	}
+//
+//	/**
+//	 * @return the candidateProNum
+//	 */
+//	public int getCandidateProNum() {
+//		return candidateProNum;
+//	}
+//
+//	/**
+//	 * @param candidateProNum
+//	 *            the candidateProNum to set
+//	 */
+//	public void setCandidateProNum(int candidateProNum) {
+//		this.candidateProNum = candidateProNum;
+//	}
+//
+//	/**
+//	 * @return the dueDate
+//	 */
+//	public long getDueDate() {
+//		return dueDate;
+//	}
+//
+//	/**
+//	 * @param dueDate
+//	 *            the dueDate to set
+//	 */
+//	public void setDueDate(long dueDate) {
+//		this.dueDate = dueDate;
+//	}
+//
+//	public long getStart() {
+//		return start;
+//	}
+//
+//	public void setStart(long start) {
+//		this.start = start;
+//	}
+//
+//	public long getFinish() {
+//		return finish;
+//	}
+//
+//	public void setFinish(long finish) {
+//		this.finish = finish;
+//	}
+//
+//	public double getWeight() {
+//		return weight;
+//	}
+//
+//	public void setWeight(double weight) {
+//		this.weight = weight;
+//	}
+//
+//	public int getPlanQty() {
+//		return planQty;
+//	}
+//
+//	/**
+//	 * 临时使用,因为可能对于不同的设备工时不同
+//	 *
+//	 * @return 下午3:42:57
+//	 */
+//	public double getWorkTime() {
+//		return this.planQty * this.runTime + this.preTime;
+//	}
+//
+//	public void setPlanQty(int planQty) {
+//		this.planQty = planQty;
+//	}
+//
+//	public Operation getPrepOp() {
+//		return prepOp;
+//	}
+//
+//	public void setPrepOp(Operation prepOp) {
+//		this.prepOp = prepOp;
+//	}
+//
+//	public Operation getSuccOp() {
+//		return SuccOp;
+//	}
+//
+//	public void setSuccOp(Operation succOp) {
+//		SuccOp = succOp;
+//	}
+//
+//	public long getEarlyStart() {
+//		return earlyStart;
+//	}
+//
+//	public void setEarlyStart(long earlyStart) {
+//		this.earlyStart = earlyStart;
+//	}
+//
+//	public int getState() {
+//		return state;
+//	}
+//
+//	public void setState(int state) {
+//		this.state = state;
+//	}
+//
+//	public int getRemainOpNum() {
+//		return remainOpNum;
+//	}
+//
+//	public void setRemainOpNum(int remainOpNum) {
+//		this.remainOpNum = remainOpNum;
+//	}
+//
+//	public double getRemainWorkTime() {
+//		return remainWorkTime;
+//	}
+//
+//	public void setRemainWorkTime(double remainWorkTime) {
+//		this.remainWorkTime = remainWorkTime;
+//	}
+//
+//	public double getOpPriority() {
+//		return opPriority;
+//	}
+//
+//	public void setOpPriority(double opPriority) {
+//		this.opPriority = opPriority;
+//	}
+//
+//	public Part getPart() {
+//		return part;
+//	}
+//
+//	public void setPart(Part part) {
+//		this.part = part;
+//	}
+//
+//	public int getFixedMachineID() {
+//		return fixedMachineID;
+//	}
+//
+//	public void setFixedMachineID(int fixedMachineID) {
+//		this.fixedMachineID = fixedMachineID;
+//	}
+//
+//	public Date getEarlyStartTime() {
+//		return earlyStartTime;
+//	}
+//
+//	public void setEarlyStartTime(Date earlyStartTime) {
+//		this.earlyStartTime = earlyStartTime;
+//	}
+//
+//	public Date getEarlyEndTime() {
+//		return earlyEndTime;
+//	}
+//
+//	public void setEarlyEndTime(Date earlyEndTime) {
+//		this.earlyEndTime = earlyEndTime;
+//	}
+//
+//	public String getExpectStartTime() {
+//		return expectStartTime;
+//	}
+//
+//	public void setExpectStartTime(String expectStartTime) {
+//		this.expectStartTime = expectStartTime;
+//	}
+//
+//	public String getExpectEndTime() {
+//		return expectEndTime;
+//	}
+//
+//	public void setExpectEndTime(String expectEndTime) {
+//		this.expectEndTime = expectEndTime;
+//	}
+//
+//	@Override
+//	public String toString() {
+//		return "Operation{" +
+//				"partId=" + partId +
+//				", earlyStart=" + earlyStart +
+//				", start=" + start +
+//				", finish=" + finish +
+//				", expectStartTime=" + expectStartTime +
+//				", expectEndTime=" + expectEndTime +
+//				", remainOpNum=" + remainOpNum +
+//				", remainWorkTime=" + remainWorkTime +
+//				", opPriority=" + opPriority +
+//				", machineId=" + machineId +
+//				'}';
+//	}
+//}

+ 232 - 232
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/basicdata/Part.java

@@ -1,232 +1,232 @@
-package com.github.zuihou.business.aps.instance.domain.basicdata;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @author: igen
- * @description: 工件类
- * @date: 2021年11月29日
- */
-public class Part implements Serializable {
-	/**
-	 * 零件号
-	 */
-	private String id;
-	/**
-	 * 零件名称
-	 */
-	private String name;
-	/**
-	 * 工序总数
-	 */
-	private int operationNum; // 工序数量
-
-	/**
-	 * 工序列表
-	 */
-	private List<Operation> opList; // 工艺路线
-	/**
-	 * 计划开始
-	 */
-	private double start;
-	/**
-	 * 计划结束
-	 */
-	private double finish;
-	/**
-	 * 权重
-	 */
-	private double weight;// 权重
-	/**
-	 * 交货期
-	 */
-	private double dueDate;// 交货期
-	/**
-	 * 计划数,默认为1
-	 */
-	private int planQty = 1;
-	/**
-	 * 当前工序
-	 */
-	private Operation currOp;
-	/**
-	 * 总工时
-	 */
-	private double totalWorkTime;
-
-	/**
-	 * 订单工件优先级
-	 */
-	private int partPrority;
-
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id = id;
-	}
-
-	/**
-	 * @return the name
-	 */
-	public String getName() {
-		return name;
-	}
-
-	/**
-	 * @param name
-	 *            the name to set
-	 */
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	/**
-	 * @return the operationNum
-	 */
-	public int getOperationNum() {
-		return operationNum;
-	}
-
-	/**
-	 * @param operationNum
-	 *            the operationNum to set
-	 */
-	public void setOperationNum(int operationNum) {
-		this.operationNum = operationNum;
-	}
-
-	/**
-	 * @return the opList
-	 */
-	public List<Operation> getOpList() {
-		return opList;
-	}
-
-	/**
-	 * @param opList
-	 *            the opList to set
-	 */
-	public void setOpList(List<Operation> opList) {
-		this.opList = opList;
-	}
-
-	/**
-	 * @return the start
-	 */
-	public double getStart() {
-		return start;
-	}
-
-	/**
-	 * @param start
-	 *            the start to set
-	 */
-	public void setStart(double start) {
-		this.start = start;
-	}
-
-	/**
-	 * @return the finish
-	 */
-	public double getFinish() {
-		return finish;
-	}
-
-	/**
-	 * @param finish
-	 *            the finish to set
-	 */
-	public void setFinish(double finish) {
-		this.finish = finish;
-	}
-
-	/**
-	 * @return the weight
-	 */
-	public double getWeight() {
-		return weight;
-	}
-
-	/**
-	 * @param weight
-	 *            the weight to set
-	 */
-	public void setWeight(double weight) {
-		this.weight = weight;
-	}
-
-	/**
-	 * @return the dueDate
-	 */
-	public double getDueDate() {
-		return dueDate;
-	}
-
-	/**
-	 * @param dueDate
-	 *            the dueDate to set
-	 */
-	public void setDueDate(double dueDate) {
-		this.dueDate = dueDate;
-	}
-
-	/**
-	 * @return the planQty
-	 */
-	public int getPlanQty() {
-		return planQty;
-	}
-
-	/**
-	 * @param planQty
-	 *            the planQty to set
-	 */
-	public void setPlanQty(int planQty) {
-		this.planQty = planQty;
-	}
-
-	public Operation getCurrOp() {
-		return currOp;
-	}
-
-	public void setCurrOp(Operation currOp) {
-		this.currOp = currOp;
-	}
-
-	public double getTotalWorkTime() {
-		return totalWorkTime;
-	}
-
-	public void setTotalWorkTime(double totalWorkTime) {
-		this.totalWorkTime = totalWorkTime;
-	}
-
-	public int getPartPrority() {
-		return partPrority;
-	}
-
-	public void setPartPrority(int partPrority) {
-		this.partPrority = partPrority;
-	}
-
-	@Override
-	public String toString() {
-		return "Part{" +
-				"id=" + id +
-				", name='" + name + '\'' +
-				", operationNum=" + operationNum +
-				", partPrority=" + partPrority +
-				", opList=" + opList +
-				", start=" + start +
-				", finish=" + finish +
-				", weight=" + weight +
-				", dueDate=" + dueDate +
-				", planQty=" + planQty +
-				", currOp=" + currOp +
-				", totalWorkTime=" + totalWorkTime +
-				'}';
-	}
-}
+//package com.github.zuihou.business.aps.instance.domain.basicdata;
+//
+//import java.io.Serializable;
+//import java.util.List;
+//
+///**
+// * @author: igen
+// * @description: 工件类
+// * @date: 2021年11月29日
+// */
+//public class Part implements Serializable {
+//	/**
+//	 * 零件号
+//	 */
+//	private String id;
+//	/**
+//	 * 零件名称
+//	 */
+//	private String name;
+//	/**
+//	 * 工序总数
+//	 */
+//	private int operationNum; // 工序数量
+//
+//	/**
+//	 * 工序列表
+//	 */
+//	private List<Operation> opList; // 工艺路线
+//	/**
+//	 * 计划开始
+//	 */
+//	private double start;
+//	/**
+//	 * 计划结束
+//	 */
+//	private double finish;
+//	/**
+//	 * 权重
+//	 */
+//	private double weight;// 权重
+//	/**
+//	 * 交货期
+//	 */
+//	private double dueDate;// 交货期
+//	/**
+//	 * 计划数,默认为1
+//	 */
+//	private int planQty = 1;
+//	/**
+//	 * 当前工序
+//	 */
+//	private Operation currOp;
+//	/**
+//	 * 总工时
+//	 */
+//	private double totalWorkTime;
+//
+//	/**
+//	 * 订单工件优先级
+//	 */
+//	private int partPrority;
+//
+//	public String getId() {
+//		return id;
+//	}
+//
+//	public void setId(String id) {
+//		this.id = id;
+//	}
+//
+//	/**
+//	 * @return the name
+//	 */
+//	public String getName() {
+//		return name;
+//	}
+//
+//	/**
+//	 * @param name
+//	 *            the name to set
+//	 */
+//	public void setName(String name) {
+//		this.name = name;
+//	}
+//
+//	/**
+//	 * @return the operationNum
+//	 */
+//	public int getOperationNum() {
+//		return operationNum;
+//	}
+//
+//	/**
+//	 * @param operationNum
+//	 *            the operationNum to set
+//	 */
+//	public void setOperationNum(int operationNum) {
+//		this.operationNum = operationNum;
+//	}
+//
+//	/**
+//	 * @return the opList
+//	 */
+//	public List<Operation> getOpList() {
+//		return opList;
+//	}
+//
+//	/**
+//	 * @param opList
+//	 *            the opList to set
+//	 */
+//	public void setOpList(List<Operation> opList) {
+//		this.opList = opList;
+//	}
+//
+//	/**
+//	 * @return the start
+//	 */
+//	public double getStart() {
+//		return start;
+//	}
+//
+//	/**
+//	 * @param start
+//	 *            the start to set
+//	 */
+//	public void setStart(double start) {
+//		this.start = start;
+//	}
+//
+//	/**
+//	 * @return the finish
+//	 */
+//	public double getFinish() {
+//		return finish;
+//	}
+//
+//	/**
+//	 * @param finish
+//	 *            the finish to set
+//	 */
+//	public void setFinish(double finish) {
+//		this.finish = finish;
+//	}
+//
+//	/**
+//	 * @return the weight
+//	 */
+//	public double getWeight() {
+//		return weight;
+//	}
+//
+//	/**
+//	 * @param weight
+//	 *            the weight to set
+//	 */
+//	public void setWeight(double weight) {
+//		this.weight = weight;
+//	}
+//
+//	/**
+//	 * @return the dueDate
+//	 */
+//	public double getDueDate() {
+//		return dueDate;
+//	}
+//
+//	/**
+//	 * @param dueDate
+//	 *            the dueDate to set
+//	 */
+//	public void setDueDate(double dueDate) {
+//		this.dueDate = dueDate;
+//	}
+//
+//	/**
+//	 * @return the planQty
+//	 */
+//	public int getPlanQty() {
+//		return planQty;
+//	}
+//
+//	/**
+//	 * @param planQty
+//	 *            the planQty to set
+//	 */
+//	public void setPlanQty(int planQty) {
+//		this.planQty = planQty;
+//	}
+//
+//	public Operation getCurrOp() {
+//		return currOp;
+//	}
+//
+//	public void setCurrOp(Operation currOp) {
+//		this.currOp = currOp;
+//	}
+//
+//	public double getTotalWorkTime() {
+//		return totalWorkTime;
+//	}
+//
+//	public void setTotalWorkTime(double totalWorkTime) {
+//		this.totalWorkTime = totalWorkTime;
+//	}
+//
+//	public int getPartPrority() {
+//		return partPrority;
+//	}
+//
+//	public void setPartPrority(int partPrority) {
+//		this.partPrority = partPrority;
+//	}
+//
+//	@Override
+//	public String toString() {
+//		return "Part{" +
+//				"id=" + id +
+//				", name='" + name + '\'' +
+//				", operationNum=" + operationNum +
+//				", partPrority=" + partPrority +
+//				", opList=" + opList +
+//				", start=" + start +
+//				", finish=" + finish +
+//				", weight=" + weight +
+//				", dueDate=" + dueDate +
+//				", planQty=" + planQty +
+//				", currOp=" + currOp +
+//				", totalWorkTime=" + totalWorkTime +
+//				'}';
+//	}
+//}

+ 2 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/domain/objective/ObjectiveCmax.java

@@ -1,7 +1,7 @@
 package com.github.zuihou.business.aps.instance.domain.objective;
 
 import com.github.zuihou.business.aps.instance.domain.basicdata.Instance;
-import com.github.zuihou.business.aps.instance.domain.basicdata.Operation;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 
 /**
  * @author: igen
@@ -14,7 +14,7 @@ public class ObjectiveCmax extends Objective {
 	@Override
 	public double calcValue(Instance instance) {
 		double value = 0;
-		for (Operation operation : instance.getOperationMap().values()) {
+		for (TTask operation : instance.getOperationMap().values()) {
 			if (operation.getFinish() > value) {
 				value = operation.getFinish();
 			}

+ 24 - 48
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/manager/AssignManager.java

@@ -2,12 +2,15 @@ package com.github.zuihou.business.aps.instance.manager;
 
 import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
-import com.github.zuihou.business.aps.instance.domain.basicdata.*;
+import com.github.zuihou.business.aps.instance.domain.basicdata.CandidateProcess;
+import com.github.zuihou.business.aps.instance.domain.basicdata.Instance;
+import com.github.zuihou.business.aps.instance.domain.basicdata.Machine;
 import com.github.zuihou.business.aps.instance.manager.iface.AssignManagerIface;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.Date;
 import java.util.List;
 import java.util.TreeSet;
 
@@ -32,9 +35,9 @@ public class AssignManager implements AssignManagerIface {
 	 * @date: 2021年11月29日
 	 *
 	 */
-	protected void assignOrderOperation(Instance instance, Operation operation, boolean insert) throws Exception {
+	protected void assignOrderOperation(Instance instance, TTask operation, boolean insert) throws Exception {
 		// 寻找可选机床
-		List<CandidateProcess> candidateProcesses = instance.getCandidateProMap().get(operation.getPartId() + "_" + operation.getName());
+		List<CandidateProcess> candidateProcesses = instance.getCandidateProMap().get(operation.getCompleteBatchNo() + "_" + operation.getProcedureNo());
 		Machine machine = null;
 		CandidateProcess candidateProcess = null;
 		// 只有一台可用机床或者优先指定了一台使用的情况,则直接分派
@@ -70,8 +73,6 @@ public class AssignManager implements AssignManagerIface {
 			// 计划开始为最早开始
 			operation.setStart(operation.getEarlyStart());
 			operation.setFinish(DateUtil.offsetMinute(new DateTime(operation.getStart()),new Long(candidateProcess.getDuration()).intValue()).getTime());
-			operation.setExpectStartTime(DateUtil.format(new Date(operation.getStart()),"yyyy-MM-dd HH:mm:ss"));
-			operation.setExpectEndTime(DateUtil.format(new Date(operation.getFinish()),"yyyy-MM-dd HH:mm:ss"));
 
 		} else {
 			findMachineSpace(operation, candidateProcess, machine,instance.getCalcBeginDate(), insert);
@@ -83,7 +84,7 @@ public class AssignManager implements AssignManagerIface {
 		afterAssign(instance, operation);
 		if (machine == null) {
 			log.error("无可选机床!");
-			throw new Exception(operation.getName() + "无可选机床");
+			throw new Exception(operation.getProcedureName() + "无可选机床");
 		}
 	}
 
@@ -98,13 +99,13 @@ public class AssignManager implements AssignManagerIface {
 	 *
 	 */
 	@Override
-	public void afterAssign(Instance instance, Operation operation) throws Exception {
-		TreeSet<Operation> readyTasks = instance.getReadyTaskS();
-		operation.setState(Operation.Assigned_State);
+	public void afterAssign(Instance instance, TTask operation) throws Exception {
+		TreeSet<TTask> readyTasks = instance.getReadyTaskS();
+		operation.setState(TTask.Assigned_State);
 		// if (readyTasks.contains(operation)) {
 		readyTasks.remove(operation);
-		Operation nextOp = operation.getSuccOp();
-		Part part = instance.getPartMap().get(operation.getPartId());
+		TTask nextOp = operation.getSuccOp();
+		TWorkpiece part = instance.getPartMap().get(operation.getCompleteBatchNo());
 		part.setCurrOp(nextOp);
 		if (nextOp != null) {
 			readyTasks.add(nextOp);
@@ -131,8 +132,7 @@ public class AssignManager implements AssignManagerIface {
 	 * @date: 2021年11月29日
 	 *
 	 */
-	private boolean insertMachineOepration(Operation operation, Operation formerOp, Operation latterOp, Machine machine) {
-		// TODO Auto-generated method stub
+	private boolean insertMachineOepration(TTask operation, TTask formerOp, TTask latterOp, Machine machine) {
 		long start = 0;
 		long finish = 0;
 		long workTime = operation.getFinish() - operation.getStart();
@@ -142,9 +142,6 @@ public class AssignManager implements AssignManagerIface {
 			operation.setStart(start);
 			operation.setFinish(finish);
 
-			operation.setExpectStartTime(DateUtil.format(new Date(operation.getStart()),"yyyy-MM-dd HH:mm:ss"));
-			operation.setExpectEndTime(DateUtil.format(new Date(operation.getFinish()),"yyyy-MM-dd HH:mm:ss"));
-
 			return true;
 		}
 		if (latterOp.getStart() < operation.getFinish()) {
@@ -154,10 +151,6 @@ public class AssignManager implements AssignManagerIface {
 		if (latterOp.getStart() - start >= workTime) {
 			operation.setStart(start);
 			operation.setFinish(start + workTime);
-
-			operation.setExpectStartTime(DateUtil.format(new Date(operation.getStart()),"yyyy-MM-dd HH:mm:ss"));
-			operation.setExpectEndTime(DateUtil.format(new Date(operation.getFinish()),"yyyy-MM-dd HH:mm:ss"));
-
 			return true;
 		} else {
 			return false;
@@ -173,35 +166,27 @@ public class AssignManager implements AssignManagerIface {
 	 * @param insert
 	 * @date: 2021年11月29日
 	 */
-	private void findMachineSpace(Operation operation, CandidateProcess candidateProcess, Machine machine, long calcBeginDate, boolean insert) {
+	private void findMachineSpace(TTask operation, CandidateProcess candidateProcess, Machine machine, long calcBeginDate, boolean insert) {
 		// 如果有任务了则需要判断插空
 		long earlyStart = operation.getEarlyStart();
 		long earlyFinish = DateUtil.offsetMinute(new DateTime(DateUtil.current(false)),new Double(candidateProcess.getDuration()).intValue()).getTime();
 		boolean findSpace = false;
-		Operation tempOp = new Operation();
-		Operation formerOp = null;
-		Operation latterOp = null;
+		TTask tempOp = new TTask();
+		TTask formerOp = null;
+		TTask latterOp = null;
 		tempOp.setStart(earlyStart);
 		tempOp.setFinish(earlyFinish);
 
-		tempOp.setExpectStartTime(DateUtil.format(new Date(tempOp.getStart()),"yyyy-MM-dd HH:mm:ss"));
-		tempOp.setExpectEndTime(DateUtil.format(new Date(tempOp.getFinish()),"yyyy-MM-dd HH:mm:ss"));
-
-
 		int findIndex = 0;
 		// 只有需要插空时才寻找空隙
 		if (insert) {
 			while (!findSpace) {
 				if (findIndex == 0) {
 					// 第一次查找时使用一个虚拟工序
-					Operation virOp = new Operation();
+					TTask virOp = new TTask();
 					virOp.setStart(calcBeginDate);
 					virOp.setFinish(calcBeginDate);
 
-					virOp.setExpectStartTime(DateUtil.format(new Date(virOp.getStart()),"yyyy-MM-dd HH:mm:ss"));
-					virOp.setExpectEndTime(DateUtil.format(new Date(virOp.getFinish()),"yyyy-MM-dd HH:mm:ss"));
-
-
 					formerOp = virOp;
 					latterOp = machine.getQueueList().first();
 				}
@@ -210,18 +195,11 @@ public class AssignManager implements AssignManagerIface {
 					tempOp.setStart(latterOp.getFinish() > earlyStart ? latterOp.getFinish() : earlyStart);
 					tempOp.setFinish(DateUtil.offsetMinute(new DateTime(tempOp.getStart()),new Double(candidateProcess.getDuration()).intValue()).getTime());
 
-					tempOp.setExpectStartTime(DateUtil.format(new Date(tempOp.getStart()),"yyyy-MM-dd HH:mm:ss"));
-					tempOp.setExpectEndTime(DateUtil.format(new Date(tempOp.getFinish()),"yyyy-MM-dd HH:mm:ss"));
-
-
 					formerOp = latterOp;
 					latterOp = machine.getQueueList().higher(latterOp);
 				} else {
 					operation.setStart(tempOp.getStart());
 					operation.setFinish(DateUtil.offsetMinute(new DateTime(operation.getStart()),new Double(candidateProcess.getDuration()).intValue()).getTime());
-					operation.setExpectStartTime(DateUtil.format(new Date(operation.getStart()),"yyyy-MM-dd HH:mm:ss"));
-					operation.setExpectEndTime(DateUtil.format(new Date(operation.getFinish()),"yyyy-MM-dd HH:mm:ss"));
-
 				}
 				findIndex++;
 			}
@@ -232,8 +210,6 @@ public class AssignManager implements AssignManagerIface {
 					: operation.getEarlyStart();
 			operation.setStart(startTime);
 			operation.setFinish(DateUtil.offsetMinute(new DateTime(startTime),new Double(candidateProcess.getDuration()).intValue()).getTime());
-			operation.setExpectStartTime(DateUtil.format(new Date(operation.getStart()),"yyyy-MM-dd HH:mm:ss"));
-			operation.setExpectEndTime(DateUtil.format(new Date(operation.getFinish()),"yyyy-MM-dd HH:mm:ss"));
 
 		}
 	}
@@ -245,15 +221,15 @@ public class AssignManager implements AssignManagerIface {
 	 * @param operation
 	 * @date: 2021年11月29日
 	 */
-	private void calOperationEarlyStart(Instance instance, Operation operation) {
+	private void calOperationEarlyStart(Instance instance, TTask operation) {
 		// 计算最早开始,目的是从该时间起在设备上寻找插空,如果是工件的首道工序,则为0
 		if (null == operation.getPrepOp()) {
 			operation.setEarlyStart(instance.getCalcBeginDate());
 		} else {
-			Operation predOp = operation.getPrepOp();
+			TTask predOp = operation.getPrepOp();
 			operation.setEarlyStart(predOp.getFinish());
 			if (predOp.getMachineId() == -1) {
-				log.error("前置工序" + predOp.getName() + "未分派成功!");
+				log.error("前置工序" + predOp.getProcedureName() + "未分派成功!");
 			}
 		}
 	}
@@ -266,7 +242,7 @@ public class AssignManager implements AssignManagerIface {
 	 * @param insert
 	 * @date: 2021年11月29日
 	 */
-	public void assignTask(Instance instance, Operation operation, boolean insert) {
+	public void assignTask(Instance instance, TTask operation, boolean insert) {
 		// 计算最早开始
 		calOperationEarlyStart(instance, operation);
 		// 分派任务
@@ -285,7 +261,7 @@ public class AssignManager implements AssignManagerIface {
 	 * @date: 2021年11月29日
 	 *
 	 */
-	public void assignTask(Instance instance, Operation operation) {
+	public void assignTask(Instance instance, TTask operation) {
 		assignTask(instance, operation, true);
 	}
 }

+ 7 - 7
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/manager/ScheduleManager.java

@@ -2,11 +2,11 @@ package com.github.zuihou.business.aps.instance.manager;
 
 import com.github.zuihou.business.aps.instance.domain.basicdata.Instance;
 import com.github.zuihou.business.aps.instance.domain.basicdata.Machine;
-import com.github.zuihou.business.aps.instance.domain.basicdata.Operation;
-import com.github.zuihou.business.aps.instance.domain.basicdata.Part;
 import com.github.zuihou.business.aps.instance.manager.iface.ScheduleManagerIface;
 import com.github.zuihou.business.aps.rule.OperationPriority;
 import com.github.zuihou.business.aps.util.InstanceUtil;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -31,7 +31,7 @@ public class ScheduleManager implements ScheduleManagerIface {
 		// 只要就绪任务集合不为空,则继续安排
 		while (!instance.getReadyTaskS().isEmpty()) {
 			// 获得最优先的任务
-			Operation operation = instance.getReadyTaskS().first();
+			TTask operation = instance.getReadyTaskS().first();
 			// 分派任务
 			assignManager.assignTask(instance, operation);
 		}
@@ -47,7 +47,7 @@ public class ScheduleManager implements ScheduleManagerIface {
 	@Override
 	public void afterSchedule(Instance instance, int mode) throws Exception {
 		// 设置工件的开始和结束
-		for (Part part : instance.getPartMap().values()) {
+		for (TWorkpiece part : instance.getPartMap().values()) {
 			if (part.getOpList().size() > 0) {
 				int opNum = part.getOpList().size();
 				part.setStart(part.getOpList().get(0).getStart());
@@ -61,7 +61,7 @@ public class ScheduleManager implements ScheduleManagerIface {
 		for (Machine machine : instance.getMachineMap().values()) {
 			double util = 0;
 			double load = 0;
-			for (Operation operation : machine.getQueueList()) {
+			for (TTask operation : machine.getQueueList()) {
 				load += operation.getWorkTime();
 				util += operation.getRunTime() * operation.getPlanQty();
 			}
@@ -75,12 +75,12 @@ public class ScheduleManager implements ScheduleManagerIface {
 
 	@Override
 	public void initReadyTasks(Instance instance) throws Exception {
-		Comparator<Operation> operationTaskComparator = instance.getOperationComparator();
+		Comparator<TTask> operationTaskComparator = instance.getOperationComparator();
 		if (operationTaskComparator == null) {
 			operationTaskComparator = new OperationPriority();
 		}
 		// 设置工序优先级比较器
-		TreeSet<Operation> readyTaskS = new TreeSet<Operation>(operationTaskComparator);
+		TreeSet<TTask> readyTaskS = new TreeSet<TTask>(operationTaskComparator);
 		// 重新排序
 		readyTaskS.addAll(instance.getReadyTaskS());
 		instance.setReadyTaskS(readyTaskS);

+ 2 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/instance/manager/iface/AssignManagerIface.java

@@ -1,7 +1,7 @@
 package com.github.zuihou.business.aps.instance.manager.iface;
 
 import com.github.zuihou.business.aps.instance.domain.basicdata.Instance;
-import com.github.zuihou.business.aps.instance.domain.basicdata.Operation;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 
 /**
  * @author: igen
@@ -17,6 +17,6 @@ public interface AssignManagerIface {
 	 * @throws Exception
 	 * @date: 2021年11月29日
 	 */
-	public void afterAssign(Instance instance, Operation operation) throws Exception;
+	public void afterAssign(Instance instance, TTask operation) throws Exception;
 
 }

+ 3 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/rule/OperationPriority.java

@@ -1,7 +1,7 @@
 package com.github.zuihou.business.aps.rule;
 
-import com.github.zuihou.business.aps.instance.domain.basicdata.Operation;
 import com.github.zuihou.business.aps.rule.basic.OperationRule;
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
 
 import java.io.Serializable;
 import java.util.Comparator;
@@ -12,13 +12,13 @@ import java.util.Comparator;
  * @author igen
  *
  */
-public class OperationPriority extends OperationRule implements Comparator<Operation>, Serializable {
+public class OperationPriority extends OperationRule implements Comparator<TTask>, Serializable {
 	public OperationPriority() {
 		super(0, "PRIORITY");
 	}
 
 	@Override
-	public int compare(Operation operTask1, Operation operTask2) {
+	public int compare(TTask operTask1, TTask operTask2) {
 		if (operTask1.equals(operTask2)) {
 			return 0;
 		}

+ 5 - 3
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/rule/basic/OperationRule.java

@@ -1,5 +1,7 @@
 package com.github.zuihou.business.aps.rule.basic;
-import com.github.zuihou.business.aps.instance.domain.basicdata.Operation;
+
+import com.github.zuihou.business.operationManagementCenter.entity.TTask;
+
 import java.util.Comparator;
 
 /**
@@ -8,7 +10,7 @@ import java.util.Comparator;
  * @date: 2019年12月18日
  *
  */
-public class OperationRule implements Comparator<Operation> {
+public class OperationRule implements Comparator<TTask> {
 	/**
 	 * 规则序号
 	 */
@@ -45,7 +47,7 @@ public class OperationRule implements Comparator<Operation> {
 	}
 
 	@Override
-	public int compare(Operation o1, Operation o2) {
+	public int compare(TTask o1, TTask o2) {
 		return 0;
 	}
 

+ 2 - 2
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/aps/util/InstanceUtil.java

@@ -3,7 +3,7 @@ package com.github.zuihou.business.aps.util;
 import com.alibaba.fastjson.JSON;
 import com.github.zuihou.business.aps.algorithm.ga.GAScheduler;
 import com.github.zuihou.business.aps.instance.domain.basicdata.Instance;
-import com.github.zuihou.business.aps.instance.domain.basicdata.Part;
+import com.github.zuihou.business.operationManagementCenter.entity.TWorkpiece;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -27,7 +27,7 @@ public class InstanceUtil {
 	 */
 	public static double calcCmax(Instance instance) {
 		double cmax = 0;
-		for (Part part : instance.getPartMap().values()) {
+		for (TWorkpiece part : instance.getPartMap().values()) {
 			if (part.getFinish() > cmax) {
 				cmax = part.getFinish();
 			}

+ 139 - 131
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/OrderServiceImpl.java

@@ -20,6 +20,7 @@ import com.github.zuihou.business.operationManagementCenter.dto.OrderProductUpda
 import com.github.zuihou.business.operationManagementCenter.dto.OrderUpdateDTO;
 import com.github.zuihou.business.operationManagementCenter.entity.*;
 import com.github.zuihou.business.operationManagementCenter.service.*;
+import com.github.zuihou.business.productionReadyCenter.dao.BBomMapper;
 import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureProductionresourceMapper;
 import com.github.zuihou.business.productionReadyCenter.dao.BomProcedureProgramMapper;
 import com.github.zuihou.business.productionReadyCenter.dao.MMeterialReceiveLogMapper;
@@ -125,6 +126,9 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
     @Autowired
     private MMeterialReceiveLogService meterialReceiveLogService;
 
+    @Autowired
+    private BBomMapper bBomMapper;
+
     @Override
     public IPage<Order> pageList(IPage page,String sustDesc, LbqWrapper<Order> wrapper) {
         return baseMapper.pageList(page,sustDesc, wrapper, new DataScope());
@@ -332,12 +336,14 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
                     List<Long> bomIdList = plan.getPlanProductList().stream().map(p -> p.getBomId()).collect(Collectors.toList());
                     //查出本次需要得工艺信息
                     Map<Long, List<BomProcedure>> bomProcedureMap = bomProcedureService.getBomProcedureMap(bomIdList);
+                    List<BBom> bboms = bBomMapper.selectList(Wraps.<BBom>lbQ().in(BBom::getId,bomIdList));
+                    Map<Long,BBom> bbomsMap = bboms.stream().collect(Collectors.toMap(BBom::getId, t->t));
 
                     for (PlanProduct planProduct : plan.getPlanProductList()) {
                         for (int partNum = 0; partNum < planProduct.getPlanBomNum(); partNum++) {
                             TWorkpiece workpiece = new TWorkpiece();
                             workpiece.setBomId(planProduct.getBomId()).setCompleteBatchNo(UUID.randomUUID().toString().replace("-", "")).setOrderId(planProduct.getOrderId()).setOrderNo(planProduct.getOrderNo())
-                                    .setPlanId(planProduct.getPlanId()).setPlanNo(planProduct.getPlanNo());
+                                    .setPlanId(planProduct.getPlanId()).setPlanNo(planProduct.getPlanNo()).setBomName(bbomsMap.get(planProduct.getBomId()).getName());
                             workpieceMapper.insert(workpiece);
 
                             // 生成task表,因为工序定了以后不变,排产时只需更新预计开始时间和结束时间
@@ -711,9 +717,6 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
 
     @Override
     public Order orderEnable(Order model){
-        // 默认只有一键生产过后的订单可以暂停和启用,未一键生产过的订单无需暂停和启用,启用是找出所有的所有未加工的工件重新排序
-        model.setProduceStatus("2");
-        planMapper.updatePlanProduceStatus(model);
 
         // 找出当前所有的订单计划还未开始加工的工件进行重排
         QueryWrapper<Plan> planWrapper = new QueryWrapper<Plan>();
@@ -741,135 +744,140 @@ public class OrderServiceImpl extends SuperServiceImpl<OrderMapper, Order> imple
         //查出本次需要得工艺信息
         Map<Long, List<BomProcedure>> bomProcedureMap = bomProcedureService.getBomProcedureMap(bomIdList);
 
-        // 可选设备集合(工序名称+可选设备列表)
-        Map<String, List<CandidateProcess>> candidateProMap = new HashMap<>(); // 可选处理集合(可选设备以及对应的加工时间)
-        // 工序集合(工序名+工序)
-        Map<String, Operation> operationMap = new HashMap<>();
-        // 设备集合(设备名+设备)
-        Map<String, Machine> machineMap = new HashMap<>();
-        // 零件集合(零件名称+零件)
-        Map<String, Part> partMap = new HashMap<>();
-        Map<Long,OrderProduct> orderProductMap = orderProductList.stream().collect(Collectors.toMap(OrderProduct::getId, t->t));
-
-        List<TTask> taskList = new ArrayList<TTask>();
-        //设置completeBatchNo
-        Map<String,String> completeBatchNoMap = new HashMap<String,String>();
-        double totalOpNum = 0.0;
-
-        for(TWorkpiece tWorkpiece : tWorkpieces){
-            Long bomId = planProductMap.get(tWorkpiece.getPlanId());
-            List<BomProcedure> bomProcedureList = bomProcedureMap.get(bomId);
-            Map<Long,BomProcedure> bomProcedureListMap = bomProcedureList.stream().collect(Collectors.toMap(BomProcedure::getId, t->t));
-            Part part = new Part();
-            List<CandidateProcess> candidateProcesses = new ArrayList<CandidateProcess>();
-            // 根据工件id查找未加工的任务
-            QueryWrapper<TTask> tTaskWrapper = new QueryWrapper<TTask>();
-            planWrapper.in("completeBatchNo", tWorkpiece.getCompleteBatchNo());
-            planWrapper.eq("status", "1");
-            List<TTask> tTasks = taskMapper.selectList(tTaskWrapper);
-            List<Operation> opList = new ArrayList<Operation>();
-
-            for(TTask tTask : tTasks){
-                BomProcedure bomProcedure = bomProcedureListMap.get(tTask.getProcedureId());
-                if (bomProcedure.getProductionresourceList().size() > 0){
-                    Machine machine = new Machine();
-                    CandidateProcess candidateProcess = new CandidateProcess();
-                    for(BomProcedureProductionresource bomProcedureProductionresource : bomProcedure.getProductionresourceList()){
-                        if(!machineMap.containsKey(bomProcedureProductionresource.getResourceId())){
-                            machine.setId(bomProcedureProductionresource.getResourceId().longValue());
-                            // 添加设备维保时间片
-                            LbqWrapper<Repair> repairWrapper = new LbqWrapper<Repair>().eq(Repair::getProductionresourceId, bomProcedureProductionresource.getResourceId()).gt(Repair::getRepairStartTime, cn.hutool.core.date.DateUtil.toLocalDateTime(cn.hutool.core.date.DateUtil.date()));
-                            List<Repair> repairs = repairService.list(repairWrapper);
-                            for(Repair repair : repairs){
-                                machine.getNoUseTime().add(Timestamp.valueOf(repair.getRepairStartTime()).getTime() + "-" + Timestamp.valueOf(repair.getRepairEndTime()).getTime());
-                            }
-                            machineMap.put("M" + bomProcedureProductionresource.getResourceId(), machine);
-                        }
-
-                        if(!candidateProMap.containsKey(tWorkpiece.getCompleteBatchNo() + "_" + bomProcedure.getNo())){
-                            candidateProcess.setMachineId(bomProcedureProductionresource.getResourceId());
-                            LbqWrapper<BomProcedureProgram> bomProcedureProgramWrapper = new LbqWrapper<BomProcedureProgram>().eq(BomProcedureProgram::getResourceId, bomProcedureProductionresource.getResourceId()).eq(BomProcedureProgram::getProcedureId,bomProcedureProductionresource.getProcedureId());
-                            BomProcedureProgram bomProcedureProgram = bomProcedureProgramMapper.selectOne(bomProcedureProgramWrapper);
-                            // 人工上下料没有程序的情况直接用工序时间
-                            if(null != bomProcedureProgram && null != bomProcedureProgram.getWorkTime()){
-                                candidateProcess.setProcedureId(bomProcedureProgram.getProcedureId());
-                                candidateProcess.setDuration(bomProcedureProgram.getWorkTime().intValue());
-                                candidateProcess.setRunTime(bomProcedureProgram.getWorkTime());
-                            }else{
-                                candidateProcess.setProcedureId(bomProcedure.getId());
-                                //candidateProcess.setDuration(bomProcedure.getPrepareWorkhours().intValue() + bomProcedure.getRatedWorkhours().intValue());
-                                candidateProcess.setDuration(bomProcedure.getRatedWorkhours().intValue());
-                                candidateProcess.setRunTime( bomProcedure.getRatedWorkhours());
-                            }
-                            if(!candidateProcesses.contains(candidateProcess)){
-                                candidateProcesses.add(candidateProcess);
-                            }
-                            candidateProMap.put(tWorkpiece.getCompleteBatchNo() + "_" + bomProcedure.getNo(),candidateProcesses);
-                        }
-                    }
-                }
-                // 组装排产所以的工序信息
-                Operation operation = new Operation();
-                operation.setId(String.valueOf(tTask.getId()));
-                operation.setPartId(tTask.getCompleteBatchNo());
-                operation.setName(tTask.getProcedureNo());
-                operation.setSeq(tTask.getProcedureSort()+1);
-                operation.setDueDate(orderProductListMap.get(tWorkpiece.getBomId()).getDeliveryTime().getTime());
-                operation.setPlanQty(1);
-                String operationKey = tTask.getCompleteBatchNo() + "_" + tTask.getProcedureNo();
-                operationMap.put(operationKey,operation);
-                opList.add(operation);
-                totalOpNum ++;
-            }
-
-            part.setId(tWorkpiece.getCompleteBatchNo());
-            part.setOperationNum(bomProcedureList.size());
-            part.setOpList(opList);
-            // 根据最终版本调整交互日期及优先级
-            part.setDueDate(orderProductListMap.get(tWorkpiece.getBomId()).getDeliveryTime().getTime());
-            part.setPartPrority(plansMap.get(tWorkpiece.getPlanId()).getPrority());
-            partMap.put(tWorkpiece.getCompleteBatchNo(),part);
-
-        }
+//        // 可选设备集合(工序名称+可选设备列表)
+//        Map<String, List<CandidateProcess>> candidateProMap = new HashMap<>(); // 可选处理集合(可选设备以及对应的加工时间)
+//        // 工序集合(工序名+工序)
+//        Map<String, Operation> operationMap = new HashMap<>();
+//        // 设备集合(设备名+设备)
+//        Map<String, Machine> machineMap = new HashMap<>();
+//        // 零件集合(零件名称+零件)
+//        Map<String, Part> partMap = new HashMap<>();
+//        Map<Long,OrderProduct> orderProductMap = orderProductList.stream().collect(Collectors.toMap(OrderProduct::getId, t->t));
+//
+//        List<TTask> taskList = new ArrayList<TTask>();
+//        //设置completeBatchNo
+//        Map<String,String> completeBatchNoMap = new HashMap<String,String>();
+//        double totalOpNum = 0.0;
+//
+//        for(TWorkpiece tWorkpiece : tWorkpieces){
+//            Long bomId = planProductMap.get(tWorkpiece.getPlanId());
+//            List<BomProcedure> bomProcedureList = bomProcedureMap.get(bomId);
+//            Map<Long,BomProcedure> bomProcedureListMap = bomProcedureList.stream().collect(Collectors.toMap(BomProcedure::getId, t->t));
+//            Part part = new Part();
+//            List<CandidateProcess> candidateProcesses = new ArrayList<CandidateProcess>();
+//            // 根据工件id查找未加工的任务
+//            QueryWrapper<TTask> tTaskWrapper = new QueryWrapper<TTask>();
+//            planWrapper.in("completeBatchNo", tWorkpiece.getCompleteBatchNo());
+//            planWrapper.eq("status", "1");
+//            List<TTask> tTasks = taskMapper.selectList(tTaskWrapper);
+//            List<Operation> opList = new ArrayList<Operation>();
+//
+//            for(TTask tTask : tTasks){
+//                BomProcedure bomProcedure = bomProcedureListMap.get(tTask.getProcedureId());
+//                if (bomProcedure.getProductionresourceList().size() > 0){
+//                    Machine machine = new Machine();
+//                    CandidateProcess candidateProcess = new CandidateProcess();
+//                    for(BomProcedureProductionresource bomProcedureProductionresource : bomProcedure.getProductionresourceList()){
+//                        if(!machineMap.containsKey(bomProcedureProductionresource.getResourceId())){
+//                            machine.setId(bomProcedureProductionresource.getResourceId().longValue());
+//                            // 添加设备维保时间片
+//                            LbqWrapper<Repair> repairWrapper = new LbqWrapper<Repair>().eq(Repair::getProductionresourceId, bomProcedureProductionresource.getResourceId()).gt(Repair::getRepairStartTime, cn.hutool.core.date.DateUtil.toLocalDateTime(cn.hutool.core.date.DateUtil.date()));
+//                            List<Repair> repairs = repairService.list(repairWrapper);
+//                            for(Repair repair : repairs){
+//                                machine.getNoUseTime().add(Timestamp.valueOf(repair.getRepairStartTime()).getTime() + "-" + Timestamp.valueOf(repair.getRepairEndTime()).getTime());
+//                            }
+//                            machineMap.put("M" + bomProcedureProductionresource.getResourceId(), machine);
+//                        }
+//
+//                        if(!candidateProMap.containsKey(tWorkpiece.getCompleteBatchNo() + "_" + bomProcedure.getNo())){
+//                            candidateProcess.setMachineId(bomProcedureProductionresource.getResourceId());
+//                            LbqWrapper<BomProcedureProgram> bomProcedureProgramWrapper = new LbqWrapper<BomProcedureProgram>().eq(BomProcedureProgram::getResourceId, bomProcedureProductionresource.getResourceId()).eq(BomProcedureProgram::getProcedureId,bomProcedureProductionresource.getProcedureId());
+//                            BomProcedureProgram bomProcedureProgram = bomProcedureProgramMapper.selectOne(bomProcedureProgramWrapper);
+//                            // 人工上下料没有程序的情况直接用工序时间
+//                            if(null != bomProcedureProgram && null != bomProcedureProgram.getWorkTime()){
+//                                candidateProcess.setProcedureId(bomProcedureProgram.getProcedureId());
+//                                candidateProcess.setDuration(bomProcedureProgram.getWorkTime().intValue());
+//                                candidateProcess.setRunTime(bomProcedureProgram.getWorkTime());
+//                            }else{
+//                                candidateProcess.setProcedureId(bomProcedure.getId());
+//                                //candidateProcess.setDuration(bomProcedure.getPrepareWorkhours().intValue() + bomProcedure.getRatedWorkhours().intValue());
+//                                candidateProcess.setDuration(bomProcedure.getRatedWorkhours().intValue());
+//                                candidateProcess.setRunTime( bomProcedure.getRatedWorkhours());
+//                            }
+//                            if(!candidateProcesses.contains(candidateProcess)){
+//                                candidateProcesses.add(candidateProcess);
+//                            }
+//                            candidateProMap.put(tWorkpiece.getCompleteBatchNo() + "_" + bomProcedure.getNo(),candidateProcesses);
+//                        }
+//                    }
+//                }
+//                // 组装排产所以的工序信息
+//                Operation operation = new Operation();
+//                operation.setId(String.valueOf(tTask.getId()));
+//                operation.setPartId(tTask.getCompleteBatchNo());
+//                operation.setName(tTask.getProcedureNo());
+//                operation.setSeq(tTask.getProcedureSort()+1);
+//                operation.setDueDate(orderProductListMap.get(tWorkpiece.getBomId()).getDeliveryTime().getTime());
+//                operation.setPlanQty(1);
+//                String operationKey = tTask.getCompleteBatchNo() + "_" + tTask.getProcedureNo();
+//                operationMap.put(operationKey,operation);
+//                opList.add(operation);
+//                totalOpNum ++;
+//            }
+//
+//            part.setId(tWorkpiece.getCompleteBatchNo());
+//            part.setOperationNum(bomProcedureList.size());
+//            part.setOpList(opList);
+//            // 根据最终版本调整交互日期及优先级
+//            part.setDueDate(orderProductListMap.get(tWorkpiece.getBomId()).getDeliveryTime().getTime());
+//            part.setPartPrority(plansMap.get(tWorkpiece.getPlanId()).getPrority());
+//            partMap.put(tWorkpiece.getCompleteBatchNo(),part);
+//
+//        }
+//
+//        // 调用java简易排产
+//        Instance instance = new Instance();
+//        instance.setTotalOpNum(totalOpNum);
+//        // 赋值设备map
+//        instance.setMachineMap(machineMap);
+//        // 创造零件map
+//        instance.setPartMap(partMap);
+//        // 创造工序map
+//        instance.setOperationMap(operationMap);
+//        // 创造工序可选设备集合map
+//        instance.setCandidateProMap(candidateProMap);
+//
+//        GAScheduler gaScheduler = new GAScheduler(instance, GAScheduler.PRIORITY_CODE);
+//        try{
+//            gaScheduler.schedule();
+//        }catch(Exception e){
+//            e.printStackTrace();
+//        }
+//        // 更新task表人工序任务的预计开始时间及结束时间
+//        Iterator<Map.Entry<String, Operation>> it = instance.getOperationMap().entrySet().iterator();
+//        while(it.hasNext()){
+//            Operation operation = it.next().getValue();
+//            for(TTask task : taskList){
+//                if(task.getTmpId().equals(operation.getId())){
+//                    List<BomProcedureProductionresource> procedureProductionresourceList = procedureProductionresourceMapper.selectList(Wraps.<BomProcedureProductionresource>lbQ().eq(BomProcedureProductionresource::getProcedureId,task.getProcedureId()).
+//                            eq(BomProcedureProductionresource::getResourceId,operation.getMachineId()).orderByDesc(BomProcedureProductionresource::getCreateTime));
+//                    task.setExpectStartTime(new Date(operation.getStart()));
+//                    task.setExpectEndTime(new Date(operation.getFinish()));
+//                    task.setResourceId(operation.getMachineId());
+//                    if(CollectionUtil.isNotEmpty(procedureProductionresourceList)){
+//                        task.setResourceBusinessId(procedureProductionresourceList.get(0).getResourceBusinessId());
+//                    }
+//                    taskMapper.updateAllById(task);
+//                    break;
+//                }
+//            }
+//
+//        }
 
-        // 调用java简易排产
-        Instance instance = new Instance();
-        instance.setTotalOpNum(totalOpNum);
-        // 赋值设备map
-        instance.setMachineMap(machineMap);
-        // 创造零件map
-        instance.setPartMap(partMap);
-        // 创造工序map
-        instance.setOperationMap(operationMap);
-        // 创造工序可选设备集合map
-        instance.setCandidateProMap(candidateProMap);
-
-        GAScheduler gaScheduler = new GAScheduler(instance, GAScheduler.PRIORITY_CODE);
-        try{
-            gaScheduler.schedule();
-        }catch(Exception e){
-            e.printStackTrace();
-        }
-        // 更新task表人工序任务的预计开始时间及结束时间
-        Iterator<Map.Entry<String, Operation>> it = instance.getOperationMap().entrySet().iterator();
-        while(it.hasNext()){
-            Operation operation = it.next().getValue();
-            for(TTask task : taskList){
-                if(task.getTmpId().equals(operation.getId())){
-                    List<BomProcedureProductionresource> procedureProductionresourceList = procedureProductionresourceMapper.selectList(Wraps.<BomProcedureProductionresource>lbQ().eq(BomProcedureProductionresource::getProcedureId,task.getProcedureId()).
-                            eq(BomProcedureProductionresource::getResourceId,operation.getMachineId()).orderByDesc(BomProcedureProductionresource::getCreateTime));
-                    task.setExpectStartTime(new Date(operation.getStart()));
-                    task.setExpectEndTime(new Date(operation.getFinish()));
-                    task.setResourceId(operation.getMachineId());
-                    if(CollectionUtil.isNotEmpty(procedureProductionresourceList)){
-                        task.setResourceBusinessId(procedureProductionresourceList.get(0).getResourceBusinessId());
-                    }
-                    taskMapper.updateAllById(task);
-                    break;
-                }
-            }
+        // 默认只有一键生产过后的订单可以暂停和启用,未一键生产过的订单无需暂停和启用,启用是找出所有的所有未加工的工件重新排序
+        model.setProduceStatus("2");
+        planMapper.updatePlanProduceStatus(model);
 
-        }
         return model;
     }
 

+ 23 - 42
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/operationManagementCenter/service/impl/TaskServiceImpl.java

@@ -214,18 +214,16 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
         // 可选设备集合(工序名称+可选设备列表)
         Map<String, List<CandidateProcess>> candidateProMap = new HashMap<>(); // 可选处理集合(可选设备以及对应的加工时间)
         // 工序集合(工序名+工序)
-        Map<String, Operation> operationMap = new HashMap<>();
+        Map<String, TTask> operationMap = new HashMap<>();
         // 设备集合(设备名+设备)
         Map<String, Machine> machineMap = new HashMap<>();
         // 零件集合(零件名称+零件)
-        Map<String, Part> partMap = new HashMap<>();
+        Map<String, TWorkpiece> partMap = new HashMap<>();
 
         Map<Long,OrderProduct> orderProductMap = orderProductList.stream().collect(Collectors.toMap(OrderProduct::getId, t->t));
 
-        List<TTask> taskList = new ArrayList<TTask>();
-
         // 排产需要的数组组装进行优化,提高组装数据的时效
-        //
+
         double totalOpNum = 0.0;
         for(int partIndex = 1;partIndex <= planProductList.size(); partIndex++){
             PlanProduct planProduct = planProductList.get(partIndex - 1);
@@ -264,27 +262,17 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
 
             for(int partNum = 0; partNum < planWorkpieces.size(); partNum++){
                 TWorkpiece workpiece = planWorkpieces.get(partNum);
-                Part part = new Part();
-                List<Operation> opList = new ArrayList<Operation>();
+                List<TTask> opList = new ArrayList<TTask>();
 
                 // 根据工件id查询工件工序
                 LbqWrapper<TTask> tTaskWrapper = new LbqWrapper<TTask>().in(TTask::getCompleteBatchNo, workpiece.getCompleteBatchNo()).eq(TTask::getStatus,"1").orderByAsc(TTask::getProcedureSort);
                 List<TTask> tTasks = tTaskMapper.selectList(tTaskWrapper);
 
-                taskList.addAll(tTasks);
-
                 for(int i = 0; i < tTasks.size(); i++){
                     TTask tTask = tTasks.get(i);
-                    Operation operation = new Operation();
-                    operation.setId(String.valueOf(tTask.getId()));
-                    operation.setPartId(workpiece.getCompleteBatchNo());
-                    operation.setName(tTask.getProcedureNo());
-                    operation.setSeq(i + 1);
-                    operation.setDueDate(orderProduct.getDeliveryTime().getTime());
-                    operation.setPlanQty(1);
                     String operationkey = tTask.getCompleteBatchNo() + "_" + tTask.getProcedureNo();
-                    operationMap.put(operationkey,operation);
-                    opList.add(operation);
+                    operationMap.put(operationkey,tTask);
+                    opList.add(tTask);
                     totalOpNum ++;
 
                     // 组装排产工序对应设备
@@ -323,20 +311,16 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
                     }
                 }
 
-                part.setId(workpiece.getCompleteBatchNo());
-                part.setName(orderProduct.getBomName());
-                part.setOperationNum(bomProcedureList.size());
-                part.setOpList(opList);
+                workpiece.setOperationNum(tTasks.size());
+                workpiece.setOpList(opList);
                 // 根据最终版本调整交互日期及优先级
-                part.setDueDate(orderProduct.getDeliveryTime().getTime());
-                part.setPartPrority(orderProduct.getPrority());
-                partMap.put(workpiece.getCompleteBatchNo(),part);
+                workpiece.setDueDate(orderProduct.getDeliveryTime().getTime());
+                workpiece.setPartPrority(orderProduct.getPrority());
+                partMap.put(workpiece.getCompleteBatchNo(),workpiece);
             }
         }
 
-
         // 调用java简易排产
-
         Instance instance = new Instance();
         instance.setTotalOpNum(totalOpNum);
         // 赋值设备map
@@ -355,23 +339,20 @@ public class TaskServiceImpl extends SuperServiceImpl<TTaskMapper, TTask> implem
             e.printStackTrace();
         }
         // 更新task表人工序任务的预计开始时间及结束时间
-        Iterator<Map.Entry<String, Operation>> it = instance.getOperationMap().entrySet().iterator();
+        Iterator<Map.Entry<String, TTask>> it = instance.getOperationMap().entrySet().iterator();
+        ArrayList<TTask> taskList = new ArrayList<>();
         while(it.hasNext()){
-            Operation operation = it.next().getValue();
-            for(TTask task : taskList){
-                if(task.getId().equals(Long.valueOf(operation.getId()))){
-                    List<BomProcedureProductionresource> procedureProductionresourceList = procedureProductionresourceMapper.selectList(Wraps.<BomProcedureProductionresource>lbQ().eq(BomProcedureProductionresource::getProcedureId,task.getProcedureId())
-                            .eq(BomProcedureProductionresource::getResourceId,operation.getMachineId()).orderByDesc(BomProcedureProductionresource::getCreateTime));
-                    task.setExpectStartTime(new Date(operation.getStart()));
-                    task.setExpectEndTime(new Date(operation.getFinish()));
-                    task.setResourceId(operation.getMachineId());
-                    task.setExecutorId(operation.getMachineId());
-                    if(CollectionUtil.isNotEmpty(procedureProductionresourceList)){
-                        task.setResourceBusinessId(procedureProductionresourceList.get(0).getResourceBusinessId());
-                    }
-                    break;
-                }
+            TTask task = it.next().getValue();
+            List<BomProcedureProductionresource> procedureProductionresourceList = procedureProductionresourceMapper.selectList(Wraps.<BomProcedureProductionresource>lbQ().eq(BomProcedureProductionresource::getProcedureId,task.getProcedureId())
+                    .eq(BomProcedureProductionresource::getResourceId,task.getMachineId()).orderByDesc(BomProcedureProductionresource::getCreateTime));
+            task.setExpectStartTime(new Date(task.getStart()));
+            task.setExpectEndTime(new Date(task.getFinish()));
+            task.setResourceId(task.getMachineId());
+            task.setExecutorId(task.getMachineId());
+            if(CollectionUtil.isNotEmpty(procedureProductionresourceList)){
+                task.setResourceBusinessId(procedureProductionresourceList.get(0).getResourceBusinessId());
             }
+            taskList.add(task);
         }
         updateBatchById(taskList);
         return taskList;

+ 229 - 50
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/TTask.java

@@ -5,6 +5,8 @@ import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
 import com.alibaba.fastjson.annotation.JSONField;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.baomidou.mybatisplus.annotation.IdType;
+
+import java.io.Serializable;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.fasterxml.jackson.annotation.JsonFormat;
@@ -45,13 +47,13 @@ import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
  */
 @Data
 @NoArgsConstructor
-@ToString(callSuper = true)
 @EqualsAndHashCode(callSuper = true)
 @Accessors(chain = true)
 @TableName("imcs_t_task")
 @ApiModel(value = "TTask", description = "任务表")
 @AllArgsConstructor
-public class TTask extends Entity<Long> {
+@Builder
+public class TTask extends Entity<Long> implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -80,14 +82,6 @@ public class TTask extends Entity<Long> {
     private Long resourceId;
 
 
-    /**
-     * 分配设备ID字符串型
-     */
-    @ApiModelProperty(value = "分配设备ID")
-    @TableField(exist = false)
-    @Excel(name = "分配设备ID")
-    private String resourceIdStr;
-
     /**
      * 工序ID
      */
@@ -428,51 +422,236 @@ public class TTask extends Entity<Long> {
     @TableField(exist = false)
     private List<BomProcedureTray> bomProcedureTrayList;
 
+
+    // 排产所用字段
+
     /**
-     * 临时用的。用于matlab的对接
+     * 已分派状态
      */
     @TableField(exist = false)
-    private String tmpId;
+    public static final int Assigned_State = 1;
 
-    public String getResourceIdStr() {
-        if(StringUtil.isEmpty(resourceIdStr)){
-            return String.valueOf(getResourceId());
-        }
-        return resourceIdStr;
-    }
+    /**
+     * 未分派状态
+     */
+    @TableField(exist = false)
+    public static final int Unassigned_state = 0;
 
-    public void setResourceIdStr(String resourceIdStr) {
-        this.resourceIdStr = resourceIdStr;
-    }
+    /**
+     * 零件
+     */
+    @TableField(exist = false)
+    private TWorkpiece part;
 
-    @Builder
-    public TTask(Long id, LocalDateTime createTime, LocalDateTime updateTime, String updateUser,
-                    Long orderId, Long planId, Long resourceId, Long procedureId, String taskNo,
-                    String status, Date expectStartTime, Date expectEndTime, Date startTime, Date endTime,
-                    Integer prority, String draftFlag, Long executorId, String executorType, String executorName, Long procedureMeterialId,
-                    Long procedureTrayGroupId, Long procedureProgramId, String taskBatchNo) {
-        this.id = id;
-        this.createTime = createTime;
-        this.updateTime = updateTime;
-        this.orderId = orderId;
-        this.planId = planId;
-        this.resourceId = resourceId;
-        this.procedureId = procedureId;
-        this.taskNo = taskNo;
-        this.status = status;
-        this.expectStartTime = expectStartTime;
-        this.expectEndTime = expectEndTime;
-        this.startTime = startTime;
-        this.endTime = endTime;
-        this.prority = prority;
-        this.draftFlag = draftFlag;
-        this.executorId = executorId;
-        this.executorType = executorType;
-        this.executorName = executorName;
-        this.procedureMeterialId = procedureMeterialId;
-        this.procedureTrayGroupId = procedureTrayGroupId;
-        this.procedureProgramId = procedureProgramId;
-        this.taskBatchNo = taskBatchNo;
-    }
+    /**
+     * 准备时间
+     */
+    @TableField(exist = false)
+    private double preTime;
+
+    /**
+     * 单件时间
+     */
+    @TableField(exist = false)
+    private double runTime; // 选择工时
+
+    /**
+     * 设备编号
+     */
+    @TableField(exist = false)
+    private long machineId; // 选择设备
+
+    /**
+     * 固定的机床编号,用于解码时确定已安排的机床(-1表示未被安排机床)
+     */
+    @TableField(exist = false)
+    private int fixedMachineID = -1;
+
+    /**
+     * 设备名称
+     */
+    @TableField(exist = false)
+    private String machineName; // 选择设备
+
+    /**
+     * 可选设备数量
+     */
+    @TableField(exist = false)
+    private int candidateProNum; // 可选设备数量
+
+    /**
+     * 权重
+     */
+    @TableField(exist = false)
+    private double weight;// 权重
+
+    /**
+     * 交货期
+     */
+    @TableField(exist = false)
+    private long dueDate;
+
+    /**
+     * 最早开始
+     */
+    @TableField(exist = false)
+    private long earlyStart;
+
+    /**
+     * 开始
+     */
+    @TableField(exist = false)
+    private long start;
+
+    /**
+     * 结束
+     */
+    @TableField(exist = false)
+    private long finish;
+
+    /**
+     * 工序预计开始
+     */
+    @TableField(exist = false)
+    private Date earlyStartTime;
+
+    /**
+     * 工序预计结束
+     */
+    @TableField(exist = false)
+    private Date earlyEndTime;
+
+    /**
+     * 计划数,默认为1
+     */
+    @TableField(exist = false)
+    private int planQty = 1;
+
+    /**
+     * 前置工序
+     */
+    @TableField(exist = false)
+    private TTask prepOp;
+
+    /**
+     * 后置工序
+     */
+    @TableField(exist = false)
+    private TTask SuccOp;
+
+    /**
+     * 状态0未调度 1已调度
+     */
+    @TableField(exist = false)
+    private int state;
+
+    /**
+     * 剩余工序数
+     */
+    @TableField(exist = false)
+    private int remainOpNum;
+
+    /**
+     * 剩余工时
+     */
+    @TableField(exist = false)
+    private double remainWorkTime;
 
+    /**
+     * 工序优先级
+     */
+    @TableField(exist = false)
+    private double opPriority;
+
+    public double getWorkTime() {
+		return this.planQty * this.runTime + this.preTime;
+	}
+
+    // 排产所用字段
+
+    /**
+     * 临时用的。用于matlab的对接
+     */
+    @TableField(exist = false)
+    private String tmpId;
+
+    @Override
+    public String toString() {
+        return "TTask{" +
+                "orderId=" + orderId +
+                ", planId=" + planId +
+                ", resourceId=" + resourceId +
+                ", procedureId=" + procedureId +
+                ", procedureName='" + procedureName + '\'' +
+                ", taskNo='" + taskNo + '\'' +
+                ", status='" + status + '\'' +
+                ", expectStartTime=" + expectStartTime +
+                ", expectEndTime=" + expectEndTime +
+                ", startTime=" + startTime +
+                ", endTime=" + endTime +
+                ", prority=" + prority +
+                ", process=" + process +
+                ", draftFlag='" + draftFlag + '\'' +
+                ", executorId=" + executorId +
+                ", executorType='" + executorType + '\'' +
+                ", executorName='" + executorName + '\'' +
+                ", procedureMeterialId=" + procedureMeterialId +
+                ", meterialId=" + meterialId +
+                ", procedureTrayGroupId=" + procedureTrayGroupId +
+                ", procedureProgramId=" + procedureProgramId +
+                ", bomId=" + bomId +
+                ", mulPlanStatus='" + mulPlanStatus + '\'' +
+                ", orderName='" + orderName + '\'' +
+                ", taskBatchNo='" + taskBatchNo + '\'' +
+                ", completeBatchNo='" + completeBatchNo + '\'' +
+                ", bomBatchNo='" + bomBatchNo + '\'' +
+                ", meterialConf='" + meterialConf + '\'' +
+                ", trayConf='" + trayConf + '\'' +
+                ", overtimeStatus='" + overtimeStatus + '\'' +
+                ", bomDesc='" + bomDesc + '\'' +
+                ", procedureNo='" + procedureNo + '\'' +
+                ", resourceDesc='" + resourceDesc + '\'' +
+                ", planTime='" + planTime + '\'' +
+                ", ratedWorkHours=" + ratedWorkHours +
+                ", resourceBusinessId=" + resourceBusinessId +
+                ", planNo='" + planNo + '\'' +
+                ", orderNo='" + orderNo + '\'' +
+                ", actualTime='" + actualTime + '\'' +
+                ", content='" + content + '\'' +
+                ", prepareWorkHours=" + prepareWorkHours +
+                ", bomNo='" + bomNo + '\'' +
+                ", procedureDesc='" + procedureDesc + '\'' +
+                ", exeFlag='" + exeFlag + '\'' +
+                ", ip='" + ip + '\'' +
+                ", port='" + port + '\'' +
+                ", firstProcedureFlag='" + firstProcedureFlag + '\'' +
+                ", lastProcedureFlag='" + lastProcedureFlag + '\'' +
+                ", procedureSort=" + procedureSort +
+                ", productionresourceList=" + productionresourceList +
+                ", meterialList=" + meterialList +
+                ", bomProcedureTrayGroupList=" + bomProcedureTrayGroupList +
+                ", programList=" + programList +
+                ", bomProcedureTrayList=" + bomProcedureTrayList +
+                ", part=" + part +
+                ", preTime=" + preTime +
+                ", runTime=" + runTime +
+                ", machineId=" + machineId +
+                ", fixedMachineID=" + fixedMachineID +
+                ", machineName='" + machineName + '\'' +
+                ", candidateProNum=" + candidateProNum +
+                ", weight=" + weight +
+                ", dueDate=" + dueDate +
+                ", earlyStart=" + earlyStart +
+                ", start=" + start +
+                ", finish=" + finish +
+                ", earlyStartTime=" + earlyStartTime +
+                ", earlyEndTime=" + earlyEndTime +
+                ", planQty=" + planQty +
+                ", state=" + state +
+                ", remainOpNum=" + remainOpNum +
+                ", remainWorkTime=" + remainWorkTime +
+                ", opPriority=" + opPriority +
+                ", tmpId='" + tmpId + '\'' +
+                '}';
+    }
 }

+ 104 - 17
imcs-admin-boot/imcs-business-entity/src/main/java/com/github/zuihou/business/operationManagementCenter/entity/TWorkpiece.java

@@ -11,7 +11,11 @@ import javax.validation.constraints.NotEmpty;
 import javax.validation.constraints.NotNull;
 import org.hibernate.validator.constraints.Length;
 import org.hibernate.validator.constraints.Range;
+
+import java.io.Serializable;
 import java.time.LocalDateTime;
+import java.util.List;
+
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
@@ -27,7 +31,7 @@ import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
 /**
  * <p>
  * 实体类
- * 
+ *
  * </p>
  *
  * @author imcs_
@@ -35,13 +39,13 @@ import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
  */
 @Data
 @NoArgsConstructor
-@ToString(callSuper = true)
 @EqualsAndHashCode(callSuper = true)
 @Accessors(chain = true)
 @TableName("imcs_t_workpiece")
 @ApiModel(value = "TWorkpiece", description = "")
 @AllArgsConstructor
-public class TWorkpiece extends Entity {
+@Builder
+public class TWorkpiece extends Entity implements Serializable {
 
     private static final long serialVersionUID = 1L;
 
@@ -176,20 +180,103 @@ public class TWorkpiece extends Entity {
     private Long isEnd;
 
 
+    /**
+     * 零件名称
+     */
+    @TableField(exist = false)
+    private String name;
 
-    @Builder
-    public TWorkpiece(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser, 
-                    String orderNo, Long orderId, String uniqueCode, String produceStatus, String completeBatchNo) {
-        this.id = id;
-        this.createTime = createTime;
-        this.createUser = createUser;
-        this.updateTime = updateTime;
-        this.updateUser = updateUser;
-        this.orderNo = orderNo;
-        this.orderId = orderId;
-        this.uniqueCode = uniqueCode;
-        this.produceStatus = produceStatus;
-        this.completeBatchNo = completeBatchNo;
-    }
+    /**
+     * 工序总数
+     */
+    @TableField(exist = false)
+    private int operationNum; // 工序数量
+
+    /**
+     * 工序列表
+     */
+    @TableField(exist = false)
+    private List<TTask> opList; // 工艺路线
+
+    /**
+     * 计划开始
+     */
+    @TableField(exist = false)
+    private double start;
+    /**
+     * 计划结束
+     */
+    @TableField(exist = false)
+    private double finish;
+
+    /**
+     * 权重
+     */
+    @TableField(exist = false)
+    private double weight;// 权重
+
+    /**
+     * 交货期
+     */
+    @TableField(exist = false)
+    private double dueDate;// 交货期
 
+    /**
+     * 计划数,默认为1
+     */
+    @TableField(exist = false)
+    private int planQty = 1;
+
+    /**
+     * 当前工序
+     */
+    @TableField(exist = false)
+    private TTask currOp;
+
+    /**
+     * 总工时
+     */
+    @TableField(exist = false)
+    private double totalWorkTime;
+
+    /**
+     * 订单工件优先级
+     */
+    @TableField(exist = false)
+    private int partPrority;
+
+    @Override
+    public String toString() {
+        return "TWorkpiece{" +
+                "orderNo='" + orderNo + '\'' +
+                ", orderId=" + orderId +
+                ", uniqueCode='" + uniqueCode + '\'' +
+                ", produceStatus='" + produceStatus + '\'' +
+                ", testResult='" + testResult + '\'' +
+                ", completeBatchNo='" + completeBatchNo + '\'' +
+                ", bomId=" + bomId +
+                ", bomName='" + bomName + '\'' +
+                ", bomNo='" + bomNo + '\'' +
+                ", planId=" + planId +
+                ", planNo='" + planNo + '\'' +
+                ", storgeId=" + storgeId +
+                ", pointId='" + pointId + '\'' +
+                ", pstorgeId=" + pstorgeId +
+                ", ppointId='" + ppointId + '\'' +
+                ", orderName='" + orderName + '\'' +
+                ", procedureId=" + procedureId +
+                ", procedureName='" + procedureName + '\'' +
+                ", taskNodeId=" + taskNodeId +
+                ", isEnd=" + isEnd +
+                ", name='" + name + '\'' +
+                ", operationNum=" + operationNum +
+                ", start=" + start +
+                ", finish=" + finish +
+                ", weight=" + weight +
+                ", dueDate=" + dueDate +
+                ", planQty=" + planQty +
+                ", totalWorkTime=" + totalWorkTime +
+                ", partPrority=" + partPrority +
+                '}';
+    }
 }