예제 #1
0
        public string GetGraphizString(ProductionOrderBom productionOrderBom)
        {
            // Demand(CustomerOrder);20;Truck

            string graphizString;
            ProductionOrderOperation productionOrderOperation =
                productionOrderBom.GetProductionOrderOperation();

            if (productionOrderOperation != null)
            {
                T_ProductionOrderOperation tProductionOrderOperation =
                    productionOrderOperation.GetValue();
                graphizString = $"D: ProductionOrderBom;{ToGraphizString(productionOrderBom)}"
                                // + $"bs({tProductionOrderOperation.StartBackward});" +
                                // $"be({tProductionOrderOperation.EndBackward});" +
                                // $"\\nOperationName: {tProductionOrderOperation}"
                ;
            }
            else
            {
                throw new MrpRunException("Every productionOrderBom must have exact one operation.");
            }

            return(graphizString);
        }
        public Demands CreateProductionOrderBomsForArticleBom(
            M_ArticleBom articleBom, Quantity quantity,
            ProductionOrder parentProductionOrder)
        {
            Demands newProductionOrderBoms = new Demands();
            ProductionOrderOperation productionOrderOperation = null;

            if (articleBom.OperationId == null)
            {
                throw new MrpRunException(
                          "Every PrOBom must have an operation. Add an operation to the articleBom.");
            }

            // load articleBom.Operation
            if (articleBom.Operation == null)
            {
                articleBom.Operation =
                    _dbMasterDataCache.M_OperationGetById(
                        new Id(articleBom.OperationId.GetValueOrDefault()));
            }

            // don't create an productionOrderOperation twice, take existing
            if (_alreadyCreatedProductionOrderOperations.ContainsKey(articleBom.Operation))
            {
                productionOrderOperation =
                    _alreadyCreatedProductionOrderOperations[articleBom.Operation];
            }

            ProductionOrderBom newProductionOrderBom =
                ProductionOrderBom.CreateTProductionOrderBom(articleBom, parentProductionOrder,
                                                             productionOrderOperation, quantity);

            if (newProductionOrderBom.HasOperation() == false)
            {
                throw new MrpRunException(
                          "Every PrOBom must have an operation. Add an operation to the articleBom.");
            }

            if (_alreadyCreatedProductionOrderOperations.ContainsKey(articleBom.Operation) == false)
            {
                _alreadyCreatedProductionOrderOperations.Add(articleBom.Operation,
                                                             newProductionOrderBom.GetProductionOrderOperation());
            }

            newProductionOrderBoms.Add(newProductionOrderBom);


            return(newProductionOrderBoms);
        }