protected virtual OrderTracer GetInspectInv_OrderTracer(string loc, string item) { OrderTracer orderTracer = new OrderTracer(); orderTracer.TracerType = Enumerators.TracerType.InspectInv; orderTracer.Code = loc; orderTracer.ReqTime = DateTime.Now; orderTracer.Item = item; orderTracer.Qty = this.GetInvBalance(loc, item, Enumerators.InvType.Inspect); return(orderTracer); }
protected virtual OrderTracer GetDemand_OrderTracer(ItemFlow itemFlow) { OrderTracer orderTracer = new OrderTracer(); orderTracer.TracerType = Enumerators.TracerType.Demand; orderTracer.Code = itemFlow.Flow.Code; orderTracer.ReqTime = DateTime.Now; orderTracer.Item = itemFlow.Item; orderTracer.Qty = itemFlow.SafeInv; return(orderTracer); }
protected override decimal GetReqQty(ItemFlow itemFlow) { string item = itemFlow.Item; DateTime?winTime = itemFlow.Flow.WindowTime; decimal maxInv = itemFlow.MaxInv; decimal safeInv = itemFlow.SafeInv; #region Demand OrderTracer demand = this.GetDemand_OrderTracer(itemFlow); itemFlow.AddOrderTracer(demand); #endregion foreach (var loc in itemFlow.DemandSources) { #region OnhandInv OrderTracer onhandInv = this.GetOnhandInv_OrderTracer(loc, item); itemFlow.AddOrderTracer(onhandInv); #endregion #region InspectInv OrderTracer inspectInv = this.GetInspectInv_OrderTracer(loc, item); itemFlow.AddOrderTracer(inspectInv); #endregion #region OrderRct var orderRcts = this.GetOrderRct(loc, item, null, winTime); itemFlow.AddOrderTracer(orderRcts); #endregion } decimal reqQty = 0; bool isReq = this.CheckReq(itemFlow); if (isReq) { demand.Qty = maxInv;//Actual demand reqQty = this.GetReqQty(itemFlow.OrderTracers); } return(reqQty); }
public virtual void CreateOrderTracer(OrderTracer entity) { Create(entity); }
public void AddOrderTracer(OrderTracer orderTracer) { if (this.OrderTracers == null) { this.OrderTracers = new List<OrderTracer>(); } this.OrderTracers.Add(orderTracer); }
protected override decimal GetReqQty(ItemFlow itemFlow) { string item = itemFlow.Item; DateTime?orderTime = itemFlow.Flow.OrderTime; DateTime?winTime = itemFlow.Flow.WindowTime; DateTime?nextWinTime = itemFlow.Flow.NextWindowTime; #region Demand OrderTracer demand = this.GetDemand_OrderTracer(itemFlow); itemFlow.AddOrderTracer(demand); #endregion foreach (var loc in itemFlow.DemandSources) { #region Demand var demands = this.GetOrderIss(loc, item, winTime, nextWinTime, Enumerators.TracerType.Demand); itemFlow.AddOrderTracer(demands); #endregion //#region OnhandInv //OrderTracer onhandInv = this.GetOnhandInv_OrderTracer(loc, item); //itemFlow.AddOrderTracer(onhandInv); //#endregion //#region InspectInv //OrderTracer inspectInv = this.GetInspectInv_OrderTracer(loc, item); //itemFlow.AddOrderTracer(inspectInv); //#endregion #region OrderRct var orderRcts = this.GetOrderRct(loc, item, null, winTime); itemFlow.AddOrderTracer(orderRcts); #endregion #region OrderIss DateTime?startTime = null; if (true)//todo,config { startTime = orderTime; } var orderIsss = this.GetOrderIss(loc, item, startTime, winTime); itemFlow.AddOrderTracer(orderIsss); #endregion } decimal reqQty = this.GetReqQty(itemFlow.OrderTracers); return(reqQty); //double relativeLeadTime = demandChain.RelativeLeadTime; //decimal relativeQtyPer = demandChain.RelativeQtyPer; //string loc = demandChain.Loc; //string item = demandChain.Item; //string flowCode = demandChain.FlowCode; //DateTime? winTime = itemFlow.Flow.WindowTime.HasValue ? // itemFlow.Flow.WindowTime.Value : DateTime.Now.AddHours(itemFlow.Flow.FlowStrategy.LeadTime); //winTime = this.GetRelativeTime(itemFlow.Flow.WindowTime, demandChain); //DateTime? nextWinTime = this.GetRelativeTime(itemFlow.Flow.NextWindowTime, demandChain); //List<Plans> demandList = (from p in Plans // where Utilities.StringEq(loc, p.Loc) // && (flowCode == null || Utilities.StringEq(flowCode, p.FlowCode)) // && Utilities.StringEq(item, p.Item) // && (!winTime.HasValue || p.ReqTime >= winTime.Value)//greater equal // && (!nextWinTime.HasValue || p.ReqTime < nextWinTime.Value)//less than // && p.IRType == Enumerators.IRType.ISS // select p).ToList(); //decimal orderQty = demandList.Where(d => d.PlanType == Enumerators.PlanType.Orders).Sum(d => d.Qty); //decimal planQty = demandList.Where(d => d.PlanType == Enumerators.PlanType.Plans).Sum(d => d.Qty); //decimal demandQty = Math.Max(orderQty, planQty); //decimal safeInv = Math.Max(demandChain.SafeInv, itemFlow.SafeInv);//todo //decimal availableInv = this.GetAvailableInvQty(loc, item, winTime); //decimal reqQty = this.GetJITReqQty(availableInv, safeInv, demandQty); //if (reqQty > 0 && demandChain.IsTrace) //{ // itemFlow.DemandList.AddRange(demandList); //} //return reqQty; }
public virtual void DeleteOrderTracer(OrderTracer entity) { entityDao.DeleteOrderTracer(entity); }
public virtual void UpdateOrderTracer(OrderTracer entity) { entityDao.UpdateOrderTracer(entity); }
public virtual void UpdateOrderTracer(OrderTracer entity) { Update(entity); }
public virtual void UpdateOrderTracer(OrderTracer entity) { entityDao.UpdateOrderTracer(entity); }
public virtual void DeleteOrderTracer(OrderTracer entity) { entityDao.DeleteOrderTracer(entity); }
public virtual void CreateOrderTracer(OrderTracer entity) { entityDao.CreateOrderTracer(entity); }
public virtual void DeleteOrderTracer(OrderTracer entity) { Delete(entity); }
public virtual void UpdateOrderTracer(OrderTracer entity) { Update(entity); }
public virtual void CreateOrderTracer(OrderTracer entity) { entityDao.CreateOrderTracer(entity); }
public virtual void DeleteOrderTracer(OrderTracer entity) { Delete(entity); }
public virtual void CreateOrderTracer(OrderTracer entity) { Create(entity); }