public async Task <ActionResult> LoginAsync(Login login)
        {
            GDFService _svc = new GDFService();
            var        user = login.user;

            Session["user"] = user;
            var password = login.password;

            Session["pass"] = password;
            var ret = await _svc.LoginAsync(user, password);

            var projectsL = await _svc.GetProjectsAsync();

            List <project> projects = new List <project>();

            foreach (var i in projectsL)
            {
                project project = new project();
                project.name = i.Name;
                project.id   = i.Id;
                projects.Add(project);

                //return RedirectToAction("GetProjects", "Home");
            }

            return(View(projects));
        }
        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
        public async Task <Project> Mydelagate()
        {
            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"]));



            // 2. Execute Simulation
            var task1 = _svc.ExecRenderingAsync(
                (s, e) => Console.WriteLine("time={0}, status={1}", e.Time, e.Result.RunningStatus),
                proj
                );

            RenderingResult rets = await task1;
            {
                var result = task1.Result;
                if (result != null)
                {
                    List <PartLog> partLogs = new List <PartLog>(result.PartLogs);
                    foreach (var i in partLogs)
                    {
                        var a = i.Parts;
                        var b = i.Time;
                    }
                    List <StatusLog> statusLogs = new List <StatusLog>(result.StatusLogs);
                    foreach (var y in statusLogs)
                    {
                        var c = y.Time;
                        var k = y.OperationRateOfStations;
                    }
                    // rets.FlowLogs = result.FlowLogs;
                    //   rets.PartLogs = result.PartLogs;
                    //   rets.StatusLogs = result.StatusLogs;
                    // rets.Summary = result.Summary;
                    //  rets.RenderingTime = result.RenderingTime;

                    var FlowLogs      = result.FlowLogs;
                    var PartLogs      = result.PartLogs;
                    var StatusLogs    = result.StatusLogs;
                    var Summary       = result.Summary;
                    var RenderingTime = result.RenderingTime;
                    partLogs.Add(result.PartLogs);
                }
                return(null);
            }
        }
Exemple #4
0
        public async Task <ActionResult> Product()
        {
            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 <Product_View> product_Views = new List <Product_View>();

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

                    List <Product> products = new List <Product>(p.Products);
                    foreach (var k in products)
                    {
                        Product_View product = new Product_View();
                        product.Name = k.Name;
                        product.Desc = k.Desc;


                        product_Views.Add(product);
                    }
                }//end of foreach

                return(View(product_Views));
            } //end of else
            return(null);
        }     //end of project info
        public async Task <ActionResult> ProjectInfo()
        {
            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
            {
                List <StationActivity> stationActivities = new List <StationActivity>(proj.StationActivities);


                List <StationActivity_View> stationActivity_Views = new List <StationActivity_View>();



                foreach (var p in stationActivities)
                {
                    StationActivity_View activity_View = new StationActivity_View();
                    activity_View.Worktime              = p.Worktime;
                    activity_View.Dispersion            = p.Dispersion;
                    activity_View.Position              = p.Position;
                    activity_View.Activation            = p.Activation;
                    activity_View.Behavior              = p.Behavior;
                    activity_View.ShowToolingActivities = p.ShowToolingActivities;


                    stationActivity_Views.Add(activity_View);
                }    //end of foreach

                return(View(stationActivity_Views));
            } //end of else
            return(null);
        }     //end of project info
        public async Task <ActionResult> Product(string name)
        {
            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 <Product> products = new List <Product>();

                List <Product_View> product_Views = new List <Product_View>();

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

                foreach (var p in stationActivities)
                {
                    Product_View product = new Product_View();

                    product.Name = p.Product.Name;
                    product.Desc = p.Product.Desc;
                    product_Views.Add(product);
                }//end of foreach

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

            return(null);
        }//end of project info
Exemple #7
0
        public async Task <ActionResult> Tooling()
        {
            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"]));



            var result = await _svc.ExecRenderingAsync(
                (s, e) => Console.WriteLine("time={0}, status={1}", e.Time, e.Result.RunningStatus),
                proj
                );

            RenderingResult rendering = new RenderingResult();

            List <ToolingInfo_View> toolingInfo_Views = new List <ToolingInfo_View>();

            if (result != null)
            {
                rendering.Summary = result.Summary;
                SummaryResult summary = new SummaryResult();
                summary = result.Summary;
                List <ToolingInfo> toolingInfos = new List <ToolingInfo>(summary.Toolings);
                //Define object summary_view
                ToolingInfo_View toolingInfo_View = new ToolingInfo_View();
                ToolingInfo      toolingInfo      = new ToolingInfo();
                foreach (var i in toolingInfos)
                {
                    toolingInfo_View.UnusedCount   = i.UnusedCount;
                    toolingInfo_View.UsedCount     = i.UsedCount;
                    toolingInfo_View.ZeroLifeCount = i.ZeroLifeCount;
                    toolingInfo_Views.Add(toolingInfo_View);
                }
            }


            return(View(toolingInfo_Views));
        }
Exemple #8
0
        public async Task <ActionResult> AssetsTools()
        {
            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 <Tooling>      toolings      = new List <Tooling>(proj.Assets.Toolings);
                List <Tooling_View> tooling_Views = new List <Tooling_View>();

                foreach (var i in toolings)
                {
                    Tooling_View tooling_View = new Tooling_View();
                    tooling_View.Name        = i.Name;
                    tooling_View.Life        = i.Life;
                    tooling_View.Policy      = i.Policy;
                    tooling_View.ReleaseTime = i.ReleaseTime;
                    tooling_View.SetTime     = i.SetTime;
                    tooling_View.Stock       = i.Stock;
                    tooling_View.Unit        = i.Unit;
                    tooling_Views.Add(tooling_View);
                }


                return(View(tooling_Views));
            }
            return(null);
        } //end of foreach
Exemple #9
0
        public async Task <ActionResult> Part()
        {
            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 <Part> parts = new List <Part>(proj.PartsList);


                List <Part_View> Part_Views = new List <Part_View>();



                foreach (var p in parts)
                {
                    Part_View part_View = new Part_View();
                    part_View.Id   = p.Id;
                    part_View.Name = p.Name;

                    Part_Views.Add(part_View);
                }//end of foreach

                return(View(Part_Views));
            } //end of else
            return(null);
        }     //end of project info
        public async Task <ActionResult> RenderingCondition()
        {
            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
            {
                RenderingCondition rendering = new RenderingCondition();
                rendering = proj.RenderingCondition;
                RenderingParameters parameters = new RenderingParameters();
                parameters = rendering.RenderingParameters;

                //Define the object the rendering parameters_View object
                RenderingParameters_View renderingParameters_View = new RenderingParameters_View();

                renderingParameters_View.StartTime    = parameters.StartTime;
                renderingParameters_View.Sampling     = parameters.Sampling;
                renderingParameters_View.Period       = parameters.Period;
                renderingParameters_View.DataInterval = parameters.DataInterval;



                return(View(renderingParameters_View));
            }//end of else
            return(null);
        }
Exemple #11
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
        public async Task <ActionResult> ToolingActivity()
        {
            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 <ToolingActivity_View> tooling_Views = new List <ToolingActivity_View>();

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

                foreach (var p in stationActivities)
                {
                    ToolingActivity tooling = new ToolingActivity();

                    List <ToolingActivity> toolings = new List <ToolingActivity>(p.ToolingActivities);

                    foreach (var t in toolings)
                    {
                        //Define tooling object
                        ToolingActivity_View tool_View = new ToolingActivity_View();

                        tool_View.Activation     = t.Activation;
                        tool_View.Condition      = t.Condition;
                        tool_View.Behavior       = t.Behavior;
                        tool_View.Headcount      = t.Headcount;
                        tool_View.Quantity       = t.Quantity;
                        tool_View.Worktime       = t.Worktime;
                        tool_View.WorkerBehavior = t.WorkerBehavior;
                        tool_View.Operation      = t.Operation;



                        tooling_Views.Add(tool_View);
                    } //end of foreach tooling activity
                }     //end of foreach

                return(View(tooling_Views));
            } //end of else
            return(null);
        }     //end of project info
Exemple #13
0
        public async Task <ActionResult> Station()
        {
            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 <Station> stations = new List <Station>();

                List <Station_View> stations_Views = new List <Station_View>();

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

                foreach (var p in stationActivities)
                {
                    Station station = new Station();

                    station = p.Station;
                    stations.Add(station);


                    //Define station object
                    Station_View station_View = new Station_View();

                    station_View.H = station.H;
                    station_View.InputBufferSize  = station.InputBufferSize;
                    station_View.OutputBufferSize = station.OutputBufferSize;
                    station_View.TotalBufferSize  = station.TotalBufferSize;
                    station_View.X    = station.X;
                    station_View.Y    = station.Y;
                    station_View.Name = station.Name;


                    stations_Views.Add(station_View);

                    stations.Add(station);

                    //stationActivities.Add(stationActivity);

                    // stationActivities_Views.Add(stationActivity_View);
                }//end of foreach
                return(View(stations_Views));
                // return View(stationActivities_Views);
            } //end of else
            return(null);
        }     //end of project info
        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
 public FindiClient()
 {
     _svc     = new GDFService();
     _project = null;
 }