private static bool Allocate(this DcnMaster mst, DcnBucket bck, DcnTarget target, int lotSize, DateTime now, out int diff) { diff = 0; int targetQty = target.RemainQty; if (lotSize <= 0) { lotSize = targetQty; } //lotSize 단위로 Alloc int remain = targetQty; int allocQty = lotSize; var plan = bck.Allocate(target.Product, allocQty, target, now); //전체 Alloc Plan 기록 if (plan != null) { plan.AllocSeq = mst.AllPlans.Count + 1; mst.AllPlans.Add(plan); mst.Current.Add(plan); } remain = remain - allocQty; if (remain < 0) { diff = Math.Abs(remain); } bool isNoAlloc = remain == targetQty; if (isNoAlloc) { return(false); } return(true); }
private static bool Allocate_FixPlan(this DcnMaster mst, DcnBucket bck, DcnTarget target, FixPlanDCN fixPlan, DateTime now) { int allocQty = fixPlan.PLAN_QTY; if (allocQty <= 0) { return(false); } FabProduct prod = target == null ? null : target.Product; if (prod == null) { prod = BopHelper.FindProduct(fixPlan.SHOP_ID, fixPlan.PRODUCT_ID); } if (prod == null) { return(false); } var plan = bck.Allocate(prod, allocQty, target, now); //전체 Alloc Plan 기록 if (plan != null) { plan.FixPlan = fixPlan; plan.AllocSeq = mst.AllPlans.Count + 1; mst.AllPlans.Add(plan); mst.Current.Add(plan); } bool isNoAlloc = plan == null; if (isNoAlloc) { return(false); } return(true); }