Exemplo n.º 1
0
        /// <summary>
        /// Build arraylist rule from recurcieve list   .
        /// </summary>
        /// <param name="grammarRuleContext"></param>
        private Production BuildProduction(ProductionContext context)
        {
            var rule = new List <IProductionElement>();

            do
            {
                if (context.grammarName() != null)
                {
                    string name = context.grammarName().GetText();
                    rule.Add(new NonTerminalProduction(name));
                }
                else if (context.lexerToken() != null)
                {
                    if (context.lexerToken().STRING() != null)
                    {
                        throw new GrammarBuilderException("Lexer defenition in grammar rules is not support now");
                        var text = context.lexerToken().STRING().GetText();
                        rule.Add(new TerminalProduction(text));
                    }
                    else
                    {
                        string name = context.lexerToken().lexerRuleName().GetText();
                        rule.Add(new TerminalProduction(name, true));
                    }
                }
                else
                {
                    //rule.Add(new EpsilonProduction());
                }
                context = context.production();
            } while (context != null);
            return(new Production(productionRuleID++, rule));
        }
        public static async Task SeedAsync(ProductionContext productionContext, ILogger <ProductionContext> logger)
        {
            if (!productionContext.Activities.Any())
            {
                productionContext.Activities.AddRange(GetPreconfiguredOrders());
                await productionContext.SaveChangesAsync();

                logger.LogInformation("Seed database associated with context {DbContextName}", typeof(ProductionContext).Name);
            }
        }
Exemplo n.º 3
0
        public Main()
        {
            InitializeComponent();
            dgProductGrid.AutoGenerateColumns   = false;
            dgSubAssemblies.AutoGenerateColumns = false;
            ctx           = new ProductionContext();
            _unitsService = new ProductService(ctx);
            _jobService   = new JobService(ctx);

            dgProductGrid.DataSource   = bsProducts;
            dgSubAssemblies.DataSource = bsSubassemlies;
            // ----------------Wire Events------------------
            this.Activated         += Main_Activated;
            bsProducts.AddingNew   += BsProducts_AddingNew;
            bsProducts.ListChanged += BsProducts_ListChanged;

            bsSubassemlies.AddingNew += BsSubassemlies_AddingNew;
            if (Knoodle.Properties.Settings.Default.LastSelectedJob != default)
            {
                _selectedJob = _jobService.GetDeepJob(Knoodle.Properties.Settings.Default.LastSelectedJob);
                LoadProducts(_selectedJob.JobID);
            }

            partsService = new PartsService();
            partsService.LoadParts();
            foreach (var p in partsService.Parts)
            {
                SourceMaterial mat = new SourceMaterial()
                {
                    ItemID = p.Key
                };
                mat.ItemID = p.Key;
                mat.MarkUp = p.Value.MarkUp.GetValueOrDefault();
                mat.MaterialDescription = p.Value.ItemDescription;
                mat.MaterialName        = p.Value.ItemName;
                mat.SupplierID          = p.Value.SupplierID.GetValueOrDefault();
                mat.UOM    = p.Value.UID.GetValueOrDefault();
                mat.Waste  = p.Value.Waste.GetValueOrDefault();
                mat.Weight = p.Value.Weight.GetValueOrDefault();


                PartDictionary.PartSource.Add(mat.ItemID, mat);
            }


            int k = PartDictionary.PartSource.Count();

            this.toolStripStatusLabel1.Text = String.Format("Parts Loaded : {0}", k.ToString());
        }
Exemplo n.º 4
0
 private static int Main()
 {
     try
     {
         ProductionContext       pc = new ProductionContext();
         ProgressConsumerBuilder pb = new ProgressConsumerBuilder(pc);
         pb.BuildOrder();
         Console.WriteLine("Test Success");
         return(100);
     }
     catch (Exception e)
     {
         Console.WriteLine("Test Failed:" + e.Message);
         return(101);
     }
 }
Exemplo n.º 5
0
 private static int Main()
 {
     try
     {
         ProductionContext pc = new ProductionContext();
         ProgressConsumerBuilder pb = new ProgressConsumerBuilder(pc);
         pb.BuildOrder();
         Console.WriteLine("Test Success");
         return 100;
     }
     catch (Exception e)
     {
         Console.WriteLine("Test Failed:" + e.Message);
         return 101;
     }
 }
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app
                              , IHostingEnvironment env
                              , ProductionContext productionContext
                              , INewOrderService newOrderService
                              //, IPaidOrderService paidOrderService
                              )
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }


            app.UseMvc();


            productionContext.Seed();

            var availableProductionAreas = productionContext.ProductionAreas?.ToList();

            //newOrderService.SubscribeToTopic("ProductionAreaChangedTopic", availableProductionAreas);
            newOrderService.SubscribeToTopic(/*"neworder"*/ "orderpaid", availableProductionAreas);
            //paidOrderService.SubscribeToTopic("orderpaid", availableProductionAreas);


            app.UseSwagger();
            app.UseSwaggerUI(c => {
                c.SwaggerEndpoint("/swagger/v1/swagger.json", "Production Area API v1");
            }
                             );


            /*
             * app.Run(async (context) =>
             * {
             *  await context.Response.WriteAsync("Hello World!");
             * });
             */
        }
 public OperationManufacturingPlanRepository(ProductionContext context)
 {
     _context = context;
 }
Exemplo n.º 8
0
 public ProductRepository(ProductionContext dbContext)
 {
     _context  = dbContext;
     _products = dbContext.Products;
 }
Exemplo n.º 9
0
 public ProductionRepository(ProductionContext dbContext)
 {
     _dbContext = dbContext ?? throw new ArgumentNullException(nameof(dbContext));
 }
Exemplo n.º 10
0
 public WIPOrder(ProductionContext context, WipOrderRow wipOrder)
 {
     _context  = context;
     _wipOrder = wipOrder;
 }
Exemplo n.º 11
0
 public ManuFacturingRepository(ProductionContext dbContext)
 {
     _context            = dbContext;
     _manuFacturingPlans = dbContext.ManufacturingPlans;
 }
Exemplo n.º 12
0
 public ProgressConsumerBuilder(ProductionContext productionContext)
 {
     _productionContext = productionContext;
 }
Exemplo n.º 13
0
 public WIPOrder(ProductionContext context, WipOrderRow wipOrder)
 {
     _context = context;
     _wipOrder = wipOrder;
 }
Exemplo n.º 14
0
 public GenericRepository(ProductionContext context)
 {
     _context = context;
 }
 public RepositoryCategory(ProductionContext context) : base(context)
 {
 }
Exemplo n.º 16
0
        public static void Seed(this ProductionContext context)
        {
            context.ProductionAreas.RemoveRange(context.ProductionAreas);

            context.SaveChanges();

            context.ProductionAreas.AddRange(
                new List <ProductionArea>()
            {
                new ProductionArea
                {
                    Id             = new Guid("9524c16b-7642-42f1-bd0b-9fcc9c7335c0")
                    , Name         = "Grill 1"
                    , Status       = true
                    , Restrictions = null
                }
                , new ProductionArea
                {
                    Id       = new Guid("1c8a9122-7d42-4884-90fd-cc90d830f723")
                    , Name   = "Grill 2 - No Gluten&Wheat"
                    , Status = true
                    , Restrictions
                        = new List <Restriction>
                        {
                            new Restriction {
                                Name = "gluten"
                            }, new Restriction {
                                Name = "wheat"
                            }
                        }
                }
                , new ProductionArea
                {
                    Id       = new Guid("7d0ab8cb-bda4-4008-a000-e6654ff3860e")
                    , Name   = "Grill 3 - No Soy"
                    , Status = true
                    , Restrictions
                        = new List <Restriction>
                        {
                            new Restriction {
                                Name = "soy"
                            }
                        }
                }
                , new ProductionArea
                {
                    Id       = new Guid("7c48711e-2eea-4707-bf2a-db1b39efe88a")
                    , Name   = "Grill 4 - No Milk"
                    , Status = true
                    , Restrictions
                        = new List <Restriction>
                        {
                            new Restriction {
                                Name = "milk"
                            }
                        }
                }
                , new ProductionArea
                {
                    Id       = new Guid("81b5b371-1fe5-4be6-9eb6-e2a81aa62174")
                    , Name   = "Grill 4 - No Soy, Milk & Gluten"
                    , Status = true
                    , Restrictions
                        = new List <Restriction>
                        {
                            new Restriction {
                                Name = "milk"
                            }, new Restriction {
                                Name = "soy"
                            }
                            , new Restriction {
                                Name = "gluten"
                            }, new Restriction {
                                Name = "wheat"
                            }
                        }
                }
                , new ProductionArea
                {
                    Id       = new Guid("58431438-145b-43f5-8136-095cb1622d1c")
                    , Name   = "Grill 5 - No Peanuts"
                    , Status = true
                    , Restrictions
                        = new List <Restriction>
                        {
                            new Restriction {
                                Name = "peanuts"
                            }
                        }
                }
                , new ProductionArea
                {
                    Id       = new Guid("bb38b77a-6706-46b0-973c-8084bbb42ece")
                    , Name   = "Grill 5 - No Sugar"
                    , Status = true
                    , Restrictions
                        = new List <Restriction>
                        {
                            new Restriction {
                                Name = "sugar"
                            }
                        }
                }
            }
                );

            context.SaveChanges();
        }
Exemplo n.º 17
0
 public ProductionRepository(ProductionContext context)
 {
     _context = context;
 }
Exemplo n.º 18
0
 public JobService()
 {
     ctx = new ProductionContext();
 }
Exemplo n.º 19
0
 public ProgressConsumerBuilder(ProductionContext productionContext)
 {
     _productionContext = productionContext;
 }
Exemplo n.º 20
0
 public BuildEngine(ProductionContext context)
 {
     ctx = context;
 }
Exemplo n.º 21
0
 public JobService(ProductionContext context)
 {
     ctx = context;
 }
Exemplo n.º 22
0
 public DeliveryService()
 {
     ctx            = new ProductionContext();
     deliveryMapper = new DeliveryMapper();
 }