R31356-17 Work Order Item - Copy From Recipe
Code | 31356-17 |
Entity | Production.ShopFloor.WorkOrderItems Entity |
Name | CopyFromRecipe |
Attribute | Ingredients, Operations |
Layer | Front-End |
Events | AttributeChanged(Recipe) |
Priority | Normal |
Modify | YES |
Applicable Legislations | ALL // no condition needed |
Action | WorkOrderItem.CopyIngredientsAndOperationsFromRecipe()
*CopyIngredientsAndOperationsFromRecipe() - the method clears all ingredient and operations related to the current Work order item and creates new, according to the selected Recipe. if (Recipe != null) { foreach (Ingredients) Delete(); foreach (Operations) Delete(); operationScrapRateMultiplier = 1; foreach (Recipe.Operations.OrderBy(LineOrd)) { WorkOrderItem.Operations.Add(RecipeOperation) with the following values: UseQuantity = Math.Round(UseQuantity* ProducedQuantityBase / Recipe.ProduceQuantity, 3,) in UseQuantityUnit OperationDescription = RecipeOperation.OperationDescription, WorkgroupResource = RecipeOperationo.WorkgroupResource, SetupTimeMinutes = RecipeOperation.SetupTimeMinutes, RunTimeMinutes =(RecipeOperation.RunTimeMinutes * ProducedQuantityBase/ RecipeOperation.Recipe.ProduceQuantity), WaitTimeMinutes = RecipeOperation.WaitTimeMinutes, MoveTimeMinutes = RecipeOperation.MoveTimeMinutes, MinimumConcurrentStartTimeMinutes = RecipeOperation.MinimumConcurrentStartTimeMinutes, Tooling = RecipeOperation.Tooling, Notes = RecipeOperation.Notes operationScrapRateMultiplier *= (1 + RecipeOperation.ScrapRate); } foreach (Recipe.Ingredients.OrderBy(LineOrd)) WorkOrder.ItemIngredients.Add(RecipeIngredient) with the following values: { Material = RecipeIngredient.Material, UsedQuantityUnit = RecipeIngredient.UsageUnit, FixedScrapQuantity = RecipeIngredient.FixedScrapQuantity, UsedQuantity = Math.Round(RecipeIngredient.FixedScrapQuantity + (((RecipeIngredient.UsageQuantity * (this.ProducedQuantityBase* (1 + RecipeIngredient.ScrapRate) / RecipeIngredient.Recipe.ProduceQuantity)) * operationScrapRateMultiplier, 3) in UsedQuantityUnit, Store = RecipeIngredient.Store, Notes = RecipeIngredient.Notes, Operation = RecipeIngredient.Operation, PrincipalRecipeIngredient = RecipeIngredient.PrincipalRecipeIngredient } |
Description | When Recipe is changed, the Ingredients and the Operations for the Work Order Item should be changed in order to correspond to the Recipe. |
Message | |
Version | Introduced: 21
Updated: - |
Revocable | YES |
* For more information about the Business Rules Documentation Template and a short explanation of each column, see topic System Business Rules.