Exemple #1
0
        public async Task ImportWorkLoad(JobPlan job)
        {
            var wlId = "INSGT-" + job.PartName.ToUpper() + "-" + DateTime.Now.ToString("yyMMddHHmm");
            var file = AllocateFilename("work", "wkl");

            var st  = job.GetSimulatedStartingTimeUTC(1, 1).ToLocalTime();
            var end = job.RouteEndingTimeUTC.ToLocalTime();


            await WriteFile(file, string.Join("\n", new[] {
                wlId,
                st.ToString(DateFormat),
                end.ToString(DateFormat),
                job.Priority.ToString(),
                "R-" + job.PartName,
                job.UniqueStr,
                "FMS-INSIGHT",
                "/",
                job.PartName,
                "0",
                job.GetPlannedCyclesOnFirstProcess(1).ToString(),
                "/"
            }));

            await _plantHost.Send("imwrkl -w " + wlId + " -s -c -W " + file.CellPath);
        }
Exemple #2
0
        private static void WriteOrderQty(XmlTextWriter xml, JobPlan j)
        {
            xml.WriteStartElement("OrderQuantity");
            xml.WriteAttributeString("orderName", j.UniqueStr);

            int qty = j.GetPlannedCyclesOnFirstProcess(1);

            //qty /= j.PartsPerPallet(1, 1);

            xml.WriteElementString("ProcessNumber", "1");
            xml.WriteElementString("RemainQuantity", qty.ToString());

            xml.WriteEndElement(); // OrderQuantity
        }
Exemple #3
0
        private static void WriteOrder(XmlTextWriter xml, JobPlan j, bool onlyOrders)
        {
            string partName = onlyOrders ? j.PartName : j.UniqueStr;

            xml.WriteStartElement("Order");
            xml.WriteAttributeString("action", "ADD");
            xml.WriteAttributeString("name", j.UniqueStr);

            xml.WriteElementString("Comment", j.PartName);
            xml.WriteElementString("PartName", partName);
            xml.WriteElementString("Revision", "SAIL");
            xml.WriteElementString("Quantity", j.GetPlannedCyclesOnFirstProcess(1).ToString());
            xml.WriteElementString("Priority", j.Priority.ToString());
            xml.WriteElementString("Status", "0");

            xml.WriteEndElement(); // Order
        }
Exemple #4
0
        private static void SchedulePart(
            MazakWriteData transSet, int SchID, string mazakPartName, string mazakComment, int numProcess,
            JobPlan part, int proc1path, int earlierConflicts, bool UseStartingOffsetForDueDate)
        {
            var newSchRow = new MazakScheduleRow();

            newSchRow.Command            = MazakWriteCommand.Add;
            newSchRow.Id                 = SchID;
            newSchRow.PartName           = mazakPartName;
            newSchRow.PlanQuantity       = part.GetPlannedCyclesOnFirstProcess(proc1path);
            newSchRow.CompleteQuantity   = 0;
            newSchRow.FixForMachine      = 0;
            newSchRow.MissingFixture     = 0;
            newSchRow.MissingProgram     = 0;
            newSchRow.MissingTool        = 0;
            newSchRow.MixScheduleID      = 0;
            newSchRow.ProcessingPriority = 0;
            newSchRow.Comment            = mazakComment;

            if (UseStartingOffsetForDueDate)
            {
                if (part.GetSimulatedStartingTimeUTC(1, proc1path) != DateTime.MinValue)
                {
                    var start = part.GetSimulatedStartingTimeUTC(1, proc1path);
                    newSchRow.DueDate  = start.ToLocalTime().Date;
                    newSchRow.Priority = 91 + Math.Min(earlierConflicts, 9);
                }
                else
                {
                    newSchRow.DueDate  = DateTime.Today;
                    newSchRow.Priority = 91;
                }
            }
            else
            {
                newSchRow.Priority = 75;
                newSchRow.DueDate  = DateTime.Parse("1/1/2008 12:00:00 AM");
            }

            bool entireHold = false;

            if (part.HoldEntireJob != null)
            {
                entireHold = part.HoldEntireJob.IsJobOnHold;
            }
            bool machiningHold = false;

            if (part.HoldMachining(1, proc1path) != null)
            {
                machiningHold = part.HoldMachining(1, proc1path).IsJobOnHold;
            }
            newSchRow.HoldMode = (int)HoldPattern.CalculateHoldMode(entireHold, machiningHold);

            int matQty = newSchRow.PlanQuantity;

            if (!string.IsNullOrEmpty(part.GetInputQueue(process: 1, path: proc1path)))
            {
                matQty = 0;
            }

            //need to add all the ScheduleProcess rows
            for (int i = 1; i <= numProcess; i++)
            {
                var newSchProcRow = new MazakScheduleProcessRow();
                newSchProcRow.MazakScheduleRowId = SchID;
                newSchProcRow.ProcessNumber      = i;
                if (i == 1)
                {
                    newSchProcRow.ProcessMaterialQuantity = matQty;
                }
                else
                {
                    newSchProcRow.ProcessMaterialQuantity = 0;
                }
                newSchProcRow.ProcessBadQuantity     = 0;
                newSchProcRow.ProcessExecuteQuantity = 0;
                newSchProcRow.ProcessMachine         = 0;

                newSchRow.Processes.Add(newSchProcRow);
            }

            transSet.Schedules.Add(newSchRow);
        }