Beispiel #1
0
        /// <summary>
        /// copies am Article and his Childs to ProductionOrder
        /// Creates Demand Provider for Production oder and DemandRequests for childs
        /// </summary>
        /// <returns></returns>
        public ProductionOrder CopyArticleToProductionOrder(int articleId, decimal quantity, int demandRequesterId)
        {
            var article = Articles.Include(a => a.ArticleBoms).ThenInclude(c => c.ArticleChild).Single(a => a.Id == articleId);

            var mainProductionOrder = new ProductionOrder
            {
                ArticleId = article.Id,
                Name      = "Prod. Auftrag: " + article.Name,
                Quantity  = quantity,
            };

            ProductionOrders.Add(mainProductionOrder);

            CreateProductionOrderWorkSchedules(mainProductionOrder);


            var demandProvider = new DemandProviderProductionOrder()
            {
                ProductionOrderId = mainProductionOrder.Id,
                Quantity          = quantity,
                ArticleId         = article.Id,
                DemandRequesterId = demandRequesterId,
            };

            Demands.Add(demandProvider);

            SaveChanges();

            return(mainProductionOrder);
        }
Beispiel #2
0
        public ProductionOrder CreateProductionOrder(IDemandToProvider demand, int duetime, int simulationId)
        {
            var productionOrder = new ProductionOrder()
            {
                ArticleId = demand.Article.Id,
                Quantity  = SimulationConfigurations.Single(a => a.Id == simulationId).Lotsize,
                Duetime   = duetime
            };

            ProductionOrders.Add(productionOrder);
            SaveChanges();
            return(productionOrder);
        }
 public void ProvidersAdd(Provider provider)
 {
     if (provider.GetType() == typeof(ProductionOrder))
     {
         _productionOrders.Add((ProductionOrder)provider);
     }
     else if (provider.GetType() == typeof(PurchaseOrderPart))
     {
         _purchaseOrderParts.Add((PurchaseOrderPart)provider);
     }
     else if (provider.GetType() == typeof(StockExchangeProvider))
     {
         _stockExchangeProviders.Add((StockExchangeProvider)provider);
     }
     else
     {
         throw new MrpRunException("This type is not known.");
     }
 }
        private int CrearOrden(ElaboracionPartidaVO itemVO, String codigoAlmacen)
        {
            int docEntry = -1;
            ProductionOrders order = (ProductionOrders)company.GetBusinessObject(BoObjectTypes.oProductionOrders);

            order.Warehouse = codigoAlmacen;
            order.ItemNo = itemVO.itemCode;
            order.DueDate = DateTime.Today;
            order.PlannedQuantity = itemVO.cantidad;
            String referencia = "Generado desde el Portal";
            order.Remarks = referencia;
            order.JournalRemarks = referencia;

            if (order.Add() == 0)
            {
                string strDocEntry = company.GetNewObjectKey();
                docEntry = int.Parse(strDocEntry);

                order.GetByKey(docEntry);
                order.ProductionOrderStatus = BoProductionOrderStatusEnum.boposReleased;
                this.resultadoVO.DocNum = order.DocumentNumber;

                this._docEntryOf = strDocEntry;
                this._docNumOf = order.DocumentNumber.ToString();

                for (int i = 0; i < order.Lines.Count; i++)
                {
                    order.Lines.SetCurrentLine(i);
                    order.Lines.Warehouse = codigoAlmacen;
                }

                if (order.Update() != 0)
                {
                    raiseError();
                }
            }
            else
            {
                raiseError();
            }

            return docEntry;
        } // CrearOrden