Exemplo n.º 1
0
 public Job(string id, Product product, int quantity, DateTime dueDate, int profitPerPiece, int penaltyPerDay)
 {
     Id             = id;
     Product        = product;
     Quantity       = quantity;
     DueDateMinutes = CommonTime.ToMinutes(dueDate);
     ProfitPerPiece = profitPerPiece;
     PenaltyPerDay  = penaltyPerDay;
 }
Exemplo n.º 2
0
 private void AddMachineExportLine(int lotStart, int lotReady, string machineId, string jobId)
 {
     MachineExportContent.AppendLine(string.Join(",", new[]
     {
         CommonTime.ToDateTime(lotStart, true).ToString(DateTimeFormatOnlyDate),
         machineId,
         CommonTime.ToDateTime(lotStart, true).ToString(DateTimeFormatOnlyTime),
         CommonTime.ToDateTime(lotReady, false).ToString(DateTimeFormatOnlyTime),
         jobId
     }));
 }
Exemplo n.º 3
0
 public void AddJobExportLine(Job job, int penalty, int jobBegin, int jobReady)
 {
     JobExportContent.AppendLine(string.Join(",", new[]
     {
         job.Id,
         (job.Quantity * job.ProfitPerPiece).ToString(),
         penalty.ToString(),
         CommonTime.ToDateTime(jobBegin, true).ToString(DateTimeFormatFull),
         CommonTime.ToDateTime(jobReady, false).ToString(DateTimeFormatFull),
         CommonTime.ToDateTime(job.DueDateMinutes, false).ToString(DateTimeFormatFull)
     }));
 }
Exemplo n.º 4
0
        public Result Export(FlowShopExporter exporter)
        {
            var totalPenalty = 0;

            foreach (var jobIdx in Order)
            {
                var job      = Jobs[jobIdx];
                var jobStart = -1;
                var jobReady = -1;

                for (int lotIdx = 1; lotIdx < (job.Quantity - 1) / MaxLotSize + 2; lotIdx++)
                {
                    var lotSize  = lotIdx * MaxLotSize > job.Quantity ? lotIdx * MaxLotSize - job.Quantity : MaxLotSize;
                    var lotReady = 0;
                    foreach (var stage in Stages)
                    {
                        var minutes      = stage.ProductMinutes[(int)job.Product] * lotSize;
                        var machineReady = stage.MachineReady[stage.NextMachineIdx];
                        lotReady = Math.Max(machineReady, lotReady) + minutes;
                        stage.MachineReady[stage.NextMachineIdx] = lotReady;

                        exporter.AddMachineExportLine(stage, job, lotReady, minutes);

                        stage.NextMachine();
                        if (lotReady > jobReady)
                        {
                            jobReady = lotReady;
                        }
                        if (jobStart == -1)
                        {
                            jobStart = lotReady - minutes;
                        }
                    }
                }

                var jobPenalty = CommonTime.GetNumberOfDelayDays(job.DueDateMinutes, jobReady) * job.PenaltyPerDay;
                totalPenalty = totalPenalty + jobPenalty;

                exporter.AddJobExportLine(job, jobPenalty, jobStart, jobReady);
            }

            var result = new Result()
            {
                TotalPenalty = totalPenalty,
                Makespan     = CommonTime.ToDateTime(Stages.Last().MachineReady.Max(), false)
            };

            return(result);
        }