Exemple #1
0
        private static void AddRoutingToJob(MazakSchedulesPartsPallets mazakData, MazakPartRow partRow, JobPlan job, IMachineGroupName machineGroupName, MazakPart.IProcToPath procToPath, MazakDbType mazakTy)
        {
            //Add routing and pallets
            foreach (var partProcRow in partRow.Processes)
            {
                var path = procToPath.PathForProc(partProcRow.ProcessNumber);
                job.SetPartsPerPallet(partProcRow.ProcessNumber, path, partProcRow.FixQuantity);
                job.SetPathGroup(partProcRow.ProcessNumber, path, path);
                job.SetHoldMachining(partProcRow.ProcessNumber, path, job.HoldMachining(partProcRow.ProcessNumber, path));
                job.SetHoldLoadUnload(partProcRow.ProcessNumber, path, job.HoldLoadUnload(partProcRow.ProcessNumber, path));

                //Routing
                string fixStr    = partProcRow.FixLDS;
                string cutStr    = partProcRow.CutMc;
                string removeStr = partProcRow.RemoveLDS;

                if (mazakTy != MazakDbType.MazakVersionE)
                {
                    fixStr    = ConvertStatIntV2ToV1(Convert.ToInt32(fixStr));
                    cutStr    = ConvertStatIntV2ToV1(Convert.ToInt32(cutStr));
                    removeStr = ConvertStatIntV2ToV1(Convert.ToInt32(removeStr));
                }

                foreach (char c in fixStr)
                {
                    if (c != '0')
                    {
                        job.AddLoadStation(partProcRow.ProcessNumber, path, int.Parse(c.ToString()));
                    }
                }
                foreach (char c in removeStr)
                {
                    if (c != '0')
                    {
                        job.AddUnloadStation(partProcRow.ProcessNumber, path, int.Parse(c.ToString()));
                    }
                }

                JobMachiningStop routeStop = null;
                foreach (char c in cutStr)
                {
                    if (c != '0')
                    {
                        if (routeStop == null)
                        {
                            routeStop = new JobMachiningStop(machineGroupName.MachineGroupName);
                            job.AddMachiningStop(partProcRow.ProcessNumber, path, routeStop);
                        }
                        routeStop.Stations.Add(int.Parse(c.ToString()));
                    }
                }

                if (routeStop != null)
                {
                    routeStop.ProgramName = partProcRow.MainProgram;
                }

                //Planned Pallets
                foreach (var palRow in mazakData.Pallets)
                {
                    if (palRow.PalletNumber > 0 &&
                        palRow.Fixture == partProcRow.Fixture &&
                        !job.HasPallet(partProcRow.ProcessNumber, path, palRow.PalletNumber.ToString()))
                    {
                        job.AddProcessOnPallet(partProcRow.ProcessNumber, path, palRow.PalletNumber.ToString());
                    }
                }
            }
        }