/// <summary> /// Provide Material /// </summary> private void WithdrawalMaterial(GptblProductionorderOperationActivity activity) { var materialId = string.Empty; foreach (var material in activity.ProductionorderOperationActivityMaterialrelation) { switch (material.MaterialrelationType) { case 2: //search for the materialId of the productionorder var materialActivity = _activityManager.GetActivity(material.GetChildKey); materialId = materialActivity.Productionorder.MaterialId; break; case 8: materialId = material.ChildId; break; default: throw new Exception("materialrelationtype does not exits"); } var stockPosting = new FCentralStockPosting(materialId: materialId, (double)material.Quantity); Agent.Send(DirectoryAgent.Directory.Instruction.Central.ForwardWithdrawMaterial.Create(stockPosting, Agent.ActorPaths.StorageDirectory.Ref)); } }
private void ProductionOrderFinishCheck(GptblProductionorderOperationActivity activity) { var productionOrder = activity.Productionorder; foreach (var activityOfProductionOrder in productionOrder.ProductionorderOperationActivities) { var prodactivity = _activityManager.Activities.SingleOrDefault(x => x.Activity.Equals(activityOfProductionOrder)); if (prodactivity == null || !prodactivity.ActivityIsFinishedDebug()) { return; } } Agent.DebugMessage($"Productionorder {productionOrder.ProductionorderId} with MaterialId {productionOrder.MaterialId} finished!"); // Insert Material var storagePosting = new FCentralStockPosting(productionOrder.MaterialId, (double)productionOrder.QuantityNet); Agent.Send(DirectoryAgent.Directory.Instruction.Central.ForwardInsertMaterial.Create(storagePosting, Agent.ActorPaths.StorageDirectory.Ref)); var product = _products.SingleOrDefault(x => x.MaterialId.Equals(productionOrder.MaterialId)); if (product != null) { //_stockPostingManager.AddInsertStockPosting(product.MaterialId,productionOrder.QuantityNet.Value,productionOrder.QuantityUnitId,GanttStockPostingType.Relatively,Agent.CurrentTime); var salesorderId = _SalesorderMaterialrelations.Single(x => x.ChildId.Equals(productionOrder.ProductionorderId)).SalesorderId; var salesorder = _salesOrder.Single(x => x.SalesorderId.Equals(salesorderId)); CreateLeadTime(product, long.Parse(salesorder.Info1)); salesorder.Status = 8; salesorder.QuantityDelivered = 1; var provideOrder = new FCentralProvideOrder(productionOrderId: productionOrder.ProductionorderId , materialId: product.MaterialId , materialName: product.Name , salesOrderId: salesorderId , materialFinishedAt: Agent.CurrentTime); Agent.Send(DirectoryAgent.Directory.Instruction.Central.ForwardProvideOrder.Create(provideOrder, Agent.ActorPaths.StorageDirectory.Ref)); } }
private void WithdrawMaterial(FCentralStockPosting stockPosting) { Agent.DebugMessage($"{stockPosting.Quantity} {stockPosting.MaterialId} arrived"); _stockManager.Remove(stockPosting.Quantity); LogValueChange(); }
private void InsertMaterial(FCentralStockPosting stockPosting) { Agent.DebugMessage($"{stockPosting.Quantity} {stockPosting.MaterialId} arrived"); _stockManager.Add(stockPosting.Quantity); LogValueChange(); }
public static ForwardWithdrawMaterial Create(FCentralStockPosting stockPosting, IActorRef target) { return(new ForwardWithdrawMaterial(message: stockPosting, target: target)); }
public static InsertMaterial Create(FCentralStockPosting message, IActorRef target) { return(new InsertMaterial(message: message, target: target)); }
public static ProvideStorageAgent Create(FCentralStockPosting stockPosting, IActorRef target) { return(new ProvideStorageAgent(message: stockPosting, target: target)); }
private void ForwardWithdrawMaterial(FCentralStockPosting stockPosting) { var actorRef = StorageManager.GetHubActorRefBy(stockPosting.MaterialId); Agent.Send(Storage.Instruction.Central.WithdrawMaterial.Create(stockPosting, actorRef)); }