public async Task <ActionResult> Process()
        {
            GDFService _svc = new GDFService();
            var        ret  = await _svc.LoginAsync(Session["user"].ToString(), Session["pass"].ToString());

            if (!ret)
            {
                return(null);
            }
            //var id = Convert.ToInt32(Session["id"]);
            var proj = await _svc.GetProjectAsync(Convert.ToInt32(Session["id"]));

            //Project proj = new Project(Session["name"].ToString());

            if (proj == null)
            {
                ViewBag("There is no data in the system!");
            }
            else
            {
                //assign list of Part to proj variable
                List <ProductionProcess> productionProcesses = new List <ProductionProcess>(proj.ProductionProcesses);


                List <ProductionProcess_View> productionProc_Views = new List <ProductionProcess_View>();

                List <Process_View> process_Views = new List <Process_View>();

                foreach (var p in productionProcesses)
                {
                    //Define Process Object

                    List <Process> processes = new List <Process>(p.Processes);
                    foreach (var k in processes)
                    {
                        Process_View process_View = new Process_View();
                        process_View.Name          = k.Name;
                        process_View.Desc          = k.Desc;
                        process_View.Disabled      = k.Disabled;
                        process_View.Frequency     = k.Frequency;
                        process_View.InputProcess  = k.InputProcess;
                        process_View.OutputProcess = k.OutputProcess;
                        process_View.Worktime      = k.Worktime;
                        process_View.X             = k.X;
                        process_View.Y             = k.Y;
                        process_View.Setup         = k.Setup;
                        process_View.IsFinal       = k.IsFinal;

                        process_Views.Add(process_View);
                    }
                }//end of foreach

                return(View(process_Views));
            } //end of else
            return(null);
        }     //end of project info
Exemplo n.º 2
0
        public async Task <ActionResult> Input()
        {
            GDFService _svc = new GDFService();
            var        ret  = await _svc.LoginAsync(Session["user"].ToString(), Session["pass"].ToString());

            if (!ret)
            {
                return(null);
            }

            var proj = await _svc.GetProjectAsync(Convert.ToInt32(Session["id"]));



            if (proj == null)
            {
                ViewBag("There is no data in the system!");
            }
            else
            {
                List <StationActivity> stationActivities = new List <StationActivity>(proj.StationActivities);

                StationActivity stationActivity = new StationActivity();

                List <Process> processes = new List <Process>();

                List <Process_View> process_Views = new List <Process_View>();

                List <StationActivity_View> stationActivities_Views = new List <StationActivity_View>();
                StationActivity_View        stationActivity_View    = new StationActivity_View();

                List <InOut_View> inOut_Views = new List <InOut_View>();

                foreach (var p in stationActivities)
                {
                    Process process = new Process();

                    process = p.Process;
                    processes.Add(process);



                    //Define station object
                    Process_View process_View = new Process_View();

                    foreach (var ele in processes)
                    {
                        //Define a list of InOut Objects
                        List <InOut> inputs = new List <InOut>(ele.Inputs);

                        //Define a list of InOut_View Objects
                        List <InOut_View> input_Views = new List <InOut_View>();
                        foreach (var inp in inputs)
                        {
                            List <Material> materials = new List <Material>(inp.Materials);

                            List <Material_View> material_Views = new List <Material_View>();

                            foreach (var m in materials)
                            {
                                Material_View material_View = new Material_View();
                                material_View.Production = m.Production;
                                material_View.Quantity   = m.Quantity;

                                material_Views.Add(material_View);
                            }

                            return(View(material_Views));
                        }


                        //  List<InOut> outputs = new List<InOut>(ele.Outputs);
                    }

                    process_Views.Add(process_View);
                }//end of foreach

                return(View(process_Views));
            }//end of else

            return(null);
        }//end of project info
Exemplo n.º 3
0
        void ProccessList_ButtonClick(object sender, EventArgs e)
        {
            var engine  =  IronPython.Hosting.Python.CreateEngine();
            var scope   =  engine.CreateScope();
            var paths = engine.GetSearchPaths();

            paths.Add(@".\Lib");
            engine.SetSearchPaths(paths);

            var source = engine.CreateScriptSourceFromString(code, Microsoft.Scripting.SourceCodeKind.Statements);

            source.Execute(scope);
            if (Windows_radioButton.Checked)
            {
                var  ProcessList_python = scope.GetVariable <Func <object, object, object, object> >("ProcessList");
                List ProcessList        = new List();

                LoadingForm f = new LoadingForm();
                f.Function = (() => {
                    ProcessList = (List)ProcessList_python(".\\Lib\\application.py", "", "");
                });
                f.StartPosition = FormStartPosition.CenterParent;
                f.ShowDialog();

                List <string> ProcessList_C = new List <string>();
                ProcessList_C.Clear();

                foreach (string data in ProcessList)
                {
                    ProcessList_C.Add(data);
                }

                Process_View.Items.Clear();

                if (ProcessList_C[0] == "Failed")
                {
                    MessageBox.Show("Frdia-Server Start Plz....");
                }
                else
                {
                    int i = 2;
                    while (true)
                    {
                        int          testnum = 0;
                        ListViewItem lvt     = new ListViewItem();

                        if (int.TryParse(ProcessList_C[i], out testnum))
                        {
                            lvt.Text = ProcessList_C[i];
                            i++;
                        }
                        if (i + 1 < ProcessList_C.Count)
                        {
                            if (!int.TryParse(ProcessList_C[i + 1], out testnum))
                            {
                                if (!int.TryParse(ProcessList_C[i + 2], out testnum))
                                {
                                    lvt.SubItems.Add("" + ProcessList_C[i] + " " + ProcessList_C[i + 1] + " " + ProcessList_C[i + 1]);
                                    i = i + 2;
                                }
                                else
                                {
                                    lvt.SubItems.Add("" + ProcessList_C[i] + " " + ProcessList_C[i + 1]);
                                    i++;
                                }
                            }
                            else if (ProcessList_C[i] == "Flex")
                            {
                                lvt.SubItems.Add("" + ProcessList_C[i] + " " + ProcessList_C[i + 1]);
                                i++;
                            }
                            else
                            {
                                lvt.SubItems.Add(ProcessList_C[i]);
                            }
                            i++;
                        }
                        else
                        {
                            lvt.SubItems.Add(ProcessList_C[i]);
                            break;
                        }
                        Process_View.Items.Add(lvt);
                        Process_View.FullRowSelect = true;
                    }
                    Process_View.EndUpdate();
                }
            }
            else if (SelectMenu.SelectedItem.ToString() == "USB")
            {
                var  ProcessList_python = scope.GetVariable <Func <object, object, object, object> >("ProcessList");
                List ProcessList        = new List();

                LoadingForm f = new LoadingForm();
                f.Function = (() => {
                    ProcessList = (List)ProcessList_python(".\\Lib\\application.py", "U", "");
                });
                f.StartPosition = FormStartPosition.CenterParent;
                f.ShowDialog();

                List <string> ProcessList_C = new List <string>();
                ProcessList_C.Clear();

                foreach (string data in ProcessList)
                {
                    ProcessList_C.Add(data);
                }

                Process_View.Items.Clear();

                if (ProcessList_C[0] == "Failed")
                {
                    MessageBox.Show("Frdia-Server Start Plz....");
                }
                else
                {
                    int i = 2;
                    while (true)
                    {
                        int          testnum = 0;
                        ListViewItem lvt     = new ListViewItem();

                        if (int.TryParse(ProcessList_C[i], out testnum))
                        {
                            lvt.Text = ProcessList_C[i];
                            i++;
                        }
                        if (i + 1 < ProcessList_C.Count)
                        {
                            if (!int.TryParse(ProcessList_C[i + 1], out testnum))
                            {
                                if (!int.TryParse(ProcessList_C[i + 2], out testnum))
                                {
                                    lvt.SubItems.Add("" + ProcessList_C[i] + " " + ProcessList_C[i + 1] + " " + ProcessList_C[i + 1]);
                                    i = i + 2;
                                }
                                else
                                {
                                    lvt.SubItems.Add("" + ProcessList_C[i] + " " + ProcessList_C[i + 1]);
                                    i++;
                                }
                            }
                            else if (ProcessList_C[i] == "Flex")
                            {
                                lvt.SubItems.Add("" + ProcessList_C[i] + " " + ProcessList_C[i + 1]);
                                i++;
                            }
                            else
                            {
                                lvt.SubItems.Add(ProcessList_C[i]);
                            }
                            i++;
                        }
                        else
                        {
                            lvt.SubItems.Add(ProcessList_C[i]);
                            break;
                        }
                        Process_View.Items.Add(lvt);
                        Process_View.FullRowSelect = true;
                    }
                    Process_View.EndUpdate();
                }
            }
            else if (SelectMenu.SelectedItem.ToString() == "DEVICE")
            {
                var    ProcessList_python = scope.GetVariable <Func <object, object, object, object> >("ProcessList");
                string address            = AddressInsert.Text.ToString();
                List   ProcessList        = new List();

                LoadingForm f = new LoadingForm();
                f.Function = (() => {
                    ProcessList = (List)ProcessList_python(".\\Lib\\application.py", "D", address);
                });
                f.StartPosition = FormStartPosition.CenterParent;
                f.ShowDialog();

                List <string> ProcessList_C = new List <string>();
                ProcessList_C.Clear();

                foreach (string data in ProcessList)
                {
                    ProcessList_C.Add(data);
                }

                Process_View.Items.Clear();

                if (ProcessList_C[0] == "Failed")
                {
                    MessageBox.Show("Frdia-Server Start Plz....");
                }
                else
                {
                    int i = 2;
                    while (true)
                    {
                        int          testnum = 0;
                        ListViewItem lvt     = new ListViewItem();

                        if (int.TryParse(ProcessList_C[i], out testnum))
                        {
                            lvt.Text = ProcessList_C[i];
                            i++;
                        }
                        if (i + 1 < ProcessList_C.Count)
                        {
                            if (!int.TryParse(ProcessList_C[i + 1], out testnum))
                            {
                                if (!int.TryParse(ProcessList_C[i + 2], out testnum))
                                {
                                    lvt.SubItems.Add("" + ProcessList_C[i] + " " + ProcessList_C[i + 1] + " " + ProcessList_C[i + 1]);
                                    i = i + 2;
                                }
                                else
                                {
                                    lvt.SubItems.Add("" + ProcessList_C[i] + " " + ProcessList_C[i + 1]);
                                    i++;
                                }
                            }
                            else if (ProcessList_C[i] == "Flex")
                            {
                                lvt.SubItems.Add("" + ProcessList_C[i] + " " + ProcessList_C[i + 1]);
                                i++;
                            }
                            else
                            {
                                lvt.SubItems.Add(ProcessList_C[i]);
                            }
                            i++;
                        }
                        else
                        {
                            lvt.SubItems.Add(ProcessList_C[i]);
                            break;
                        }
                        Process_View.Items.Add(lvt);
                        Process_View.FullRowSelect = true;
                    }
                    Process_View.EndUpdate();
                }
            }
            else
            {
                MessageBox.Show("error");
            }
        }
        public async Task <ActionResult> Process()
        {
            GDFService _svc = new GDFService();
            var        ret  = await _svc.LoginAsync(Session["user"].ToString(), Session["pass"].ToString());

            if (!ret)
            {
                return(null);
            }

            var proj = await _svc.GetProjectAsync(Convert.ToInt32(Session["id"]));



            if (proj == null)
            {
                ViewBag("There is no data in the system!");
            }
            else
            {
                List <StationActivity> stationActivities = new List <StationActivity>(proj.StationActivities);

                StationActivity stationActivity = new StationActivity();

                List <Process> processes = new List <Process>();

                List <Process_View> process_Views = new List <Process_View>();

                List <StationActivity_View> stationActivities_Views = new List <StationActivity_View>();
                StationActivity_View        stationActivity_View    = new StationActivity_View();

                foreach (var p in stationActivities)
                {
                    Process process = new Process();

                    process = p.Process;
                    processes.Add(process);


                    //Define station object
                    Process_View process_View = new Process_View();

                    process_View.Desc          = process.Desc;
                    process_View.Disabled      = process.Disabled;
                    process_View.Frequency     = process.Frequency;
                    process_View.InputProcess  = process.InputProcess;
                    process_View.IsFinal       = process.IsFinal;
                    process_View.Name          = process.Name;
                    process_View.OutputProcess = process.OutputProcess;
                    process_View.Setup         = process.Setup;
                    process_View.Worktime      = process.Worktime;
                    process_View.X             = process.X;
                    process_View.Y             = process.Y;

                    /*foreach(var ele in processes)
                     * {
                     *  Product_View product = new Product_View();
                     *  product.Name = ele.Product.Name;
                     * }*/

                    process_Views.Add(process_View);
                }//end of foreach

                return(View(process_Views));
            }//end of else

            return(null);
        }//end of project info