public T_CustomerOrder CreateNewOrder(int articleId, int amount, long creationTime, long dueTime) { var olist = new List <T_CustomerOrderPart>(); var orderPart = new T_CustomerOrderPart { ArticleId = articleId, IsPlanned = false, Quantity = amount, }; olist.Add(item: orderPart); var bp = BusinessPartners.First(predicate: x => x.Debitor); var order = new T_CustomerOrder() { BusinessPartnerId = bp.Id, DueTime = (int)dueTime, CreationTime = (int)creationTime, DueDateTime = dueTime.ToDateTime(), Name = Articles.Single(predicate: x => x.Id == articleId).Name, CustomerOrderParts = olist }; return(order); }
public void StartOrder() { var contractAgentRef = CreateTestProbe(); var order = new T_CustomerOrder() { DueTime = 0, Id = 1 }; var orderPart = new T_CustomerOrderPart() { Article = new M_Article { Name = "Bear" }, Quantity = 1, Id = 1, CustomerOrderId = 1, CustomerOrder = order }; var message = SimulationCore.Agents.ContractAgent.Contract.Instruction.StartOrder.Create(message: orderPart, target: contractAgentRef); var behave = Factory.Get(simType: DB.Nominal.SimulationType.None); var simContext = CreateTestProbe(); var actorPaths = AgentMoc.CreateActorPaths(testKit: this, simContext: simContext); AgentMoc.CreateAgent(actorPaths: actorPaths , principal: null , behaviour: behave , guardianType: GuardianType.Dispo); behave.Action(message: message); Assert.Equal(expected: "Bear", actual: ((IDefaultProperties)behave)._fArticle.Article.Name); var item = simContext.FishForMessage(isMessage: msg => msg is CreateChild , max: (TimeSpan.FromSeconds(value: 5))) as CreateChild; Assert.NotNull(@object: item); }
public static FArticle ToRequestItem(this T_CustomerOrderPart orderPart , IActorRef requester , long customerDue , long remainingDuration , long currentTime) { var article = new FArticle( key: Guid.Empty , keys: new FSharpSet <Guid>(new Guid[] { }) , dueTime: orderPart.CustomerOrder.DueTime , quantity: orderPart.Quantity , article: orderPart.Article , creationTime: currentTime , customerOrderId: orderPart.CustomerOrderId , isHeadDemand: true , stockExchangeId: Guid.Empty , storageAgent: ActorRefs.NoSender , isProvided: false , customerDue: customerDue , remainingDuration: remainingDuration , providedAt: 0 , originRequester: requester , dispoRequester: ActorRefs.Nobody , providerList: new List <FStockProvider>() , finishedAt: 0 ); return(article.CreateProductionKeys.SetPrimaryKey); }
public async Task <IActionResult> Edit(int id, [Bind("OrderId,ArticleId,Quantity,IsPlanned,Id")] T_CustomerOrderPart orderPart) { if (id != orderPart.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(entity: orderPart); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderPartExists(id: orderPart.Id)) { return(NotFound()); } else { throw; } } ViewData[index : "OrderId"] = orderPart.CustomerOrderId; return(View(viewName: "../Orders/Index", model: await _context.GetAllOrders.ToListAsync())); } ViewData[index : "ArticleId"] = new SelectList(items : _context.GetSellableArticles, dataValueField : "Id", dataTextField : "Name", selectedValue : orderPart.ArticleId); ViewData[index : "OrderId"] = new SelectList(items : _context.CustomerOrders, dataValueField : "Id", dataTextField : "Name", selectedValue : orderPart.CustomerOrderId); return(PartialView(viewName: "Details", model: orderPart)); }
/// <summary> /// Startup with Creating Dispo Agent for current Item. /// </summary> /// <param name="agent"></param> /// <param name="orderItem"></param> public void StartOrder(T_CustomerOrderPart orderItem) { // create Request Item _fArticle = orderItem.ToRequestItem(requester: Agent.Context.Self, currentTime: Agent.CurrentTime); // Tell Guardian to create Dispo Agent var agentSetup = AgentSetup.Create(agent: Agent, behaviour: DispoAgent.Behaviour.Factory.Get(simType: Agent.Behaviour.SimulationType)); var instruction = Guardian.Instruction.CreateChild.Create(setup: agentSetup, target: ((IAgent)Agent).Guardian, source: Agent.Context.Self); Agent.Send(instruction: instruction); // init end }
/// <summary> /// Startup with Creating Dispo Agent for current Item. /// </summary> /// <param name="agent"></param> /// <param name="orderItem"></param> public void StartOrder(T_CustomerOrderPart orderItem) { // create Request Item _fArticle = orderItem.ToRequestItem(requester: Agent.Context.Self , customerDue: orderItem.CustomerOrder.DueTime , remainingDuration: 0 , currentTime: Agent.CurrentTime); Agent.DebugMessage(msg: $"Start Order"); Agent.Send(DirectoryAgent.Directory.Instruction.Central.ForwardAddOrder.Create(_fArticle, Agent.ActorPaths.StorageDirectory.Ref)); }
private void CreateContractAgent(T_CustomerOrderPart orderPart) { _orderQueue.Enqueue(item: orderPart); DebugMessage(msg: $"Creating Contract Agent for order {orderPart.CustomerOrderId} with {orderPart.Article.Name} DueTime {orderPart.CustomerOrder.DueTime}"); var agentSetup = AgentSetup.Create(agent: this, behaviour: ContractAgent.Behaviour.Factory.Get(simType: _simulationType)); var instruction = CreateChild.Create(setup: agentSetup , target: ActorPaths.Guardians .Single(predicate: x => x.Key == GuardianType.Contract) .Value , source: this.Self); Send(instruction: instruction); }
public static CustomerOrderPart CreateCustomerOrderPartWithGivenArticle( int quantity, M_Article article, DueTime dueTime) { T_CustomerOrder tCustomerOrder = CreateCustomerOrder(dueTime); T_CustomerOrderPart tCustomerOrderPart = new T_CustomerOrderPart(); tCustomerOrderPart.CustomerOrder = tCustomerOrder; tCustomerOrderPart.CustomerOrderId = tCustomerOrder.Id; tCustomerOrderPart.Article = article; tCustomerOrderPart.ArticleId = tCustomerOrderPart.Article.Id; tCustomerOrderPart.Quantity = quantity; tCustomerOrderPart.State = State.Created; return(new CustomerOrderPart(tCustomerOrderPart)); }
public async Task <IActionResult> Create([Bind("OrderId,ArticleId,Quantity,IsPlanned,Id")] T_CustomerOrderPart orderPart) { if (ModelState.IsValid) { _context.Add(entity: orderPart); await _context.SaveChangesAsync(); var orders = await _context.GetAllOrders.ToListAsync(); ViewData[index : "OrderId"] = orderPart.CustomerOrderId; return(View(viewName: "../Orders/Index", model: orders)); } ViewData[index : "ArticleId"] = new SelectList(items : _context.GetSellableArticles, dataValueField : "Id", dataTextField : "Name", selectedValue : orderPart.ArticleId); ViewData[index : "OrderId"] = new SelectList(items : _context.CustomerOrders, dataValueField : "Id", dataTextField : "Name", selectedValue : orderPart.CustomerOrderId); return(PartialView(viewName: "Create", model: orderPart)); }
public static FArticle ToRequestItem(this T_CustomerOrderPart orderPart , IActorRef requester , long currentTime) { return(new FArticle( key: Guid.NewGuid() , dueTime: orderPart.CustomerOrder.DueTime , quantity: orderPart.Quantity , article: orderPart.Article , creationTime: currentTime , customerOrderId: orderPart.CustomerOrderId , isHeadDemand: true , stockExchangeId: Guid.Empty , storageAgent: ActorRefs.NoSender , isProvided: false , originRequester: requester , dispoRequester: ActorRefs.Nobody , providerList: new List <Guid>() , finishedAt: 0 )); }
public void CustomerOrderPartAdd(T_CustomerOrderPart customerOrderPart) { _customerOrderParts.Add(new CustomerOrderPart(customerOrderPart)); }
private CreateContractAgent(T_CustomerOrderPart message, IActorRef target) : base(message: message, target: target) { }
public static CreateContractAgent Create(T_CustomerOrderPart message, IActorRef target) { return(new CreateContractAgent(message: message, target: target)); }
public CustomerOrderPart(IDemand demand) : base(demand) { _customerOrderPart = (T_CustomerOrderPart)demand; }
public static ISimulationMessage Create(T_CustomerOrderPart message, IActorRef target, bool logThis = false) { return(new StartOrder(message: message, target: target, logThis: logThis)); }