//代码风格:暴力流 /*约束组合,流水节拍,开始时间,每次处理楼层,批次*/ public List <PlanObject> MakePlan(LimitedCondition L, DateTime starttime, BatchTask B)//makeplan函数 { //创建list List <PlanObject> list = new List <PlanObject>(); /*获取产能*/ CNSF(L);//产能算法获得产能 double[] PP = CNSF(L); DateTime wtime = starttime; DateTime ntime = starttime; DateTime gtime = starttime; DateTime lttime = starttime; DateTime wtemptime; DateTime ntemptime; DateTime gtemptime; DateTime lttemptime; /*核心算法函数本体*/ int pi = B.Projects.Count; for (int i = 0; i < pi; i++) { int bi = B.Projects[i].Buildings.Count; for (int j = 0; j < bi; j++) { int maxfloor = Maxfloor(B.Projects[i].Buildings[j]); int pid = i; int bid = j; for (int downf = 1; downf <= maxfloor; downf++) //简单易懂 { int[] GJ = GJHQ(downf, B, pid, bid); //分次获取构件 double[] gp = new double[13]; gp = CoreFunc(GJ, PP, L); //底层算法,获得生产排序 //重置时间,除第一次循环外,wtime为上一轮循环中的重置后的值,下同 wtemptime = wtime; ntemptime = ntime; gtemptime = gtime; lttemptime = lttime; //添加list成员 for (int k = 0; k < gp[2]; k++) { //生成planobject PlanObject plan = new PlanObject(); plan.BatchID = B.ID.ToString(); plan.BatchName = B.Name; plan.ProjectName = B.Projects[i].Name; plan.Building = B.Projects[i].Buildings[j].ID.ToString(); plan.Floor = downf.ToString(); plan.ComponentType = ("内墙"); plan.ComponentID = (k + 1).ToString(); plan.FlowLineNumber = ("内墙生产线"); plan.WorkPositionAmount = L.nWorkPositionAmount; DateTime d = ntemptime; ntemptime = ntemptime.AddHours(gp[10]); plan.ActualStartTime = d; plan.ActualEndTime = ntemptime; list.Add(plan); } for (int k = 0; k < gp[1]; k++) { //生成planobject PlanObject plan = new PlanObject(); plan.BatchID = B.ID.ToString(); plan.BatchName = B.Name; plan.ProjectName = B.Projects[i].Name; plan.Building = B.Projects[i].Buildings[j].ID.ToString(); plan.Floor = downf.ToString(); plan.ComponentType = ("内墙"); plan.ComponentID = (k + 1).ToString(); plan.FlowLineNumber = ("外墙生产线"); plan.WorkPositionAmount = L.wWorkPositionAmount; DateTime d = wtemptime; wtemptime = wtemptime.AddHours(gp[9]); plan.ActualStartTime = d; plan.ActualEndTime = wtemptime; list.Add(plan); } for (int k = 0; k < gp[4]; k++) { //生成planobject PlanObject plan = new PlanObject(); plan.BatchID = B.ID.ToString(); plan.BatchName = B.Name; plan.ProjectName = B.Projects[i].Name; plan.Building = B.Projects[i].Buildings[j].ID.ToString(); plan.Floor = downf.ToString(); plan.ComponentType = ("内墙"); plan.ComponentID = (k + 1).ToString(); plan.FlowLineNumber = ("固定模台生产线"); plan.WorkPositionAmount = L.gWorkPositionAmount; DateTime d = gtemptime; gtemptime = gtemptime.AddHours(gp[12]); plan.ActualStartTime = d; plan.ActualEndTime = gtemptime; list.Add(plan); } int ci = 0; for (; ci < GJ[4]; ci++) { list[ci].ComponentType = ("叠合板"); } for (; ci < GJ[4] + GJ[7]; ci++) { list[ci].ComponentType = ("单外墙"); } for (; ci < GJ[4] + GJ[7] + GJ[8]; ci++) { list[ci].ComponentType = ("内墙"); } for (; ci < GJ[4] + GJ[7] + GJ[8] + GJ[5]; ci++) { list[ci].ComponentType = ("叠合梁"); } for (; ci < GJ[4] + GJ[7] + GJ[8] + GJ[5] + GJ[6]; ci++) { list[ci].ComponentType = ("空调板"); } for (; ci < GJ[4] + GJ[7] + GJ[8] + GJ[5] + GJ[6] + GJ[9]; ci++) { list[ci].ComponentType = ("柱子"); } for (int k = 0; k < gp[0]; k++) { //生成planobject PlanObject plan = new PlanObject(); plan.BatchID = B.ID.ToString(); plan.BatchName = B.Name; plan.ProjectName = B.Projects[i].Name; plan.Building = B.Projects[i].Buildings[j].ID.ToString(); plan.Floor = downf.ToString(); plan.ComponentType = ("三明治外墙"); plan.ComponentID = (k + 1).ToString(); plan.FlowLineNumber = ("外墙生产线"); plan.WorkPositionAmount = L.wWorkPositionAmount; DateTime d = wtemptime; wtemptime = wtemptime.AddHours(gp[8]); plan.ActualStartTime = d; plan.ActualEndTime = wtemptime; list.Add(plan); } int tempg = (int)gp[5] - GJ[10]; for (int k = 0; k < GJ[10]; k++) { //生成planobject PlanObject plan = new PlanObject(); plan.BatchID = B.ID.ToString(); plan.BatchName = B.Name; plan.ProjectName = B.Projects[i].Name; plan.Building = B.Projects[i].Buildings[j].ID.ToString(); plan.Floor = downf.ToString(); plan.ComponentType = ("阳台板"); plan.ComponentID = (k + 1).ToString(); plan.FlowLineNumber = ("固定模台生产线"); plan.WorkPositionAmount = L.gWorkPositionAmount; DateTime d = gtemptime; gtemptime = gtemptime.AddHours(gp[13]); plan.ActualStartTime = d; plan.ActualEndTime = gtemptime; list.Add(plan); } for (int k = 0; k < tempg; k++) { //生成planobject PlanObject plan = new PlanObject(); plan.BatchID = B.ID.ToString(); plan.BatchName = B.Name; plan.ProjectName = B.Projects[i].Name; plan.Building = B.Projects[i].Buildings[j].ID.ToString(); plan.Floor = downf.ToString(); plan.ComponentType = ("飘窗"); plan.ComponentID = (k + 1).ToString(); plan.FlowLineNumber = ("固定模台生产线"); plan.WorkPositionAmount = L.gWorkPositionAmount; DateTime d = gtemptime; gtemptime = gtemptime.AddHours(gp[13]); plan.ActualStartTime = d; plan.ActualEndTime = gtemptime; list.Add(plan); } for (int k = 0; k < gp[3]; k++) { //生成planobject PlanObject plan = new PlanObject(); plan.BatchID = B.ID.ToString(); plan.BatchName = B.Name; plan.ProjectName = B.Projects[i].Name; plan.Building = B.Projects[i].Buildings[j].ID.ToString(); plan.Floor = downf.ToString(); plan.ComponentType = ("三明治外墙"); plan.ComponentID = (k + 1).ToString(); plan.FlowLineNumber = ("固定模台生产线"); plan.WorkPositionAmount = L.gWorkPositionAmount; DateTime d = gtemptime; gtemptime = gtemptime.AddHours(gp[11]); plan.ActualStartTime = d; plan.ActualEndTime = gtemptime; list.Add(plan); } for (int k = 0; k < gp[6]; k++) { //生成planobject PlanObject plan = new PlanObject(); plan.BatchID = B.ID.ToString(); plan.BatchName = B.Name; plan.ProjectName = B.Projects[i].Name; plan.Building = B.Projects[i].Buildings[j].ID.ToString(); plan.Floor = downf.ToString(); plan.ComponentType = ("楼梯"); plan.ComponentID = (k + 1).ToString(); plan.FlowLineNumber = ("楼梯生产线"); plan.WorkPositionAmount = L.ltWorkPositionAmount; DateTime d = lttemptime; lttemptime = lttemptime.AddHours(gp[14]); plan.ActualStartTime = d; plan.ActualEndTime = lttemptime; list.Add(plan); } ///循环每一轮后将时间置于各生产线生产的末位 wtime = wtemptime; ntime = ntemptime; gtime = gtemptime; lttime = lttemptime; } } } return(list); }