private void GetProdRouteQty(WIPItemNeed wipItemNeed) { string key = String.Format("{0}_{1}", wipItemNeed.Item.ItemNo, wipItemNeed.RouteLine.WorkOper.Name); if (dictProdRoute.ContainsKey(key)) { XPCollection<WIPProdRoute> wipProdRoutes = dictProdRoute[key]; for (int i = 0; i < wipProdRoutes.Count; i++) { WIPProdRoute wipProdRoute = wipProdRoutes[i]; if (wipProdRoute.BalQty > 0 && wipItemNeed.LackQty > 0) { float tmpQty; if (wipProdRoute.BalQty > wipItemNeed.LackQty) tmpQty = wipItemNeed.LackQty; else tmpQty = wipProdRoute.BalQty; WIPItemNeedDetail needDetail = new WIPItemNeedDetail(uow, wipItemNeed); needDetail.WIPProdRoute = wipProdRoute; needDetail.UsedQty = tmpQty; needDetail.NeedDetailType = WIPItemNeedDetail.DetailType.Production; wipItemNeed.WIPQty = wipItemNeed.WIPQty + tmpQty; wipItemNeed.calcSubItemNeedQty(); wipItemNeed.Save(); wipProdRoute.UsedQty = wipProdRoute.UsedQty + tmpQty; wipProdRoute.Save(); } } } }
private void initWIPItemNeed() { foreach (WIPSalesOrderLine soLine in soLines) { WIPItemNeed wipItemNeed = new WIPItemNeed(uow, soLine, wipTable); wipItemNeed.Save(); } }
private void GetPoQty(WIPItemNeed wipItemNeed) { string key = wipItemNeed.Item.ItemNo; if (dictPoLine.ContainsKey(key)) { XPCollection<WIPPurchOrderLine> wipPoLines = dictPoLine[key]; #region // Get WHQAQty - PurchLine QA Qty foreach (WIPPurchOrderLine wipPoLine in wipPoLines) { if (wipPoLine.QABalQty > 0 && wipItemNeed.LackQty > 0) { float tmpQty; if (wipPoLine.QABalQty > wipItemNeed.LackQty) tmpQty = wipItemNeed.LackQty; else tmpQty = wipPoLine.QABalQty; WIPItemNeedDetail needDetail = new WIPItemNeedDetail(uow, wipItemNeed); needDetail.WIPPurchOrderLine = wipPoLine; needDetail.UsedQty = tmpQty; needDetail.NeedDetailType = WIPItemNeedDetail.DetailType.QA; wipItemNeed.WHQAQty = wipItemNeed.WHQAQty + tmpQty; wipItemNeed.calcSubItemNeedQty(); wipItemNeed.Save(); wipPoLine.QAUsedQty = wipPoLine.QAUsedQty + tmpQty; wipPoLine.Save(); } } #endregion #region // Get WIPQty - PurchLine ordered qty foreach (WIPPurchOrderLine wipPoLine in wipPoLines) { if (wipPoLine.BalQty > 0 && wipItemNeed.LackQty > 0) { float tmpQty; if (wipPoLine.BalQty > wipItemNeed.LackQty) tmpQty = wipItemNeed.LackQty; else tmpQty = wipPoLine.BalQty; WIPItemNeedDetail needDetail = new WIPItemNeedDetail(uow, wipItemNeed); needDetail.WIPPurchOrderLine = wipPoLine; needDetail.Projection = wipPoLine.GetProjection(tmpQty); needDetail.UsedQty = tmpQty; needDetail.NeedDetailType = WIPItemNeedDetail.DetailType.Purch; wipItemNeed.WIPQty = wipItemNeed.WIPQty + tmpQty; wipItemNeed.calcSubItemNeedQty(); wipItemNeed.Save(); wipPoLine.UsedQty = wipPoLine.UsedQty + tmpQty; wipPoLine.Save(); } } #endregion } }
private void GetProdBomQty(WIPItemNeed wipItemNeed) { string key = ""; if (wipItemNeed.ParentItemNeed != null) key = String.Format("{0}_{1}", wipItemNeed.ParentItemNeed.Item.ItemNo, wipItemNeed.Item.ItemNo); else key = wipItemNeed.Item.ItemNo; if (dictProdBom.ContainsKey(key)) { XPCollection<WIPProdBom> wipProdBoms = dictProdBom[key]; for (int i = 0; i < wipProdBoms.Count; i++) { WIPProdBom wipProdBom = wipProdBoms[i]; if (wipProdBom.BalQty > 0 && wipItemNeed.LackQty > 0) { float tmpQty; if (wipProdBom.BalQty > wipItemNeed.LackQty) tmpQty = wipItemNeed.LackQty; else tmpQty = wipProdBom.BalQty; WIPItemNeedDetail needDetail = new WIPItemNeedDetail(uow, wipItemNeed); needDetail.WIPProdBom = wipProdBom; needDetail.UsedQty = tmpQty; needDetail.NeedDetailType = WIPItemNeedDetail.DetailType.Production; wipItemNeed.WIPProdBomQty = wipItemNeed.WIPProdBomQty + tmpQty; wipItemNeed.calcSubItemNeedQty(); wipItemNeed.Save(); wipProdBom.UsedQty = wipProdBom.UsedQty + tmpQty; wipProdBom.Save(); } } } }
private void InitBomItemNeed(WIPItemNeed parentItemNeed) { // foreach (BomLine bLine in Item.BomLines) foreach (BomLine bLine in parentItemNeed.Item.BomLines) { if (bLine.LineType != Item.ItemSource.None) { WIPItemNeed wipItemNeed = new WIPItemNeed(Session, parentItemNeed, bLine); wipItemNeed.Save(); } } }
public WIPItemNeed(Session session, WIPItemNeed wipItemNeed, BomLine bLine) : base(session) { ParentItemNeed = wipItemNeed; WIPTable = wipItemNeed.WIPTable; SalesOrderLine = wipItemNeed.SalesOrderLine; Item = bLine.BomItem; ItemSource = bLine.LineType; Level = wipItemNeed.Level + 1; if (SalesOrderLine.SaleOrderLine.OrderType.WareHouse != null) WareHouse = SalesOrderLine.SaleOrderLine.OrderType.WareHouse; else WareHouse = bLine.Warehouse; VariableScrap = bLine.VariableScrap; ConstantScrap = bLine.ConstantScrap; Qty = bLine.Qty; PerSeries = bLine.PerSeries; NeedQty = wipItemNeed.LackQty; NeedDate = wipItemNeed.NeedDate.AddDays(-1); CheckOrderTypeScrap(); calcSubItemNeedQty(); SetSortKey(); WIPItemNeed childItemNeed = this; if (ItemSource == Item.ItemSource.Make) { RouteLine rLine = Item.GetLastRouteLine(); if (rLine != null) { RouteLine = CWIPRouteLine(rLine); RouteLine PreviousRLine = rLine.GetPreviousRoute(); if (PreviousRLine != null) { WIPItemNeed childWipItemNeed = new WIPItemNeed(Session, this, PreviousRLine, ref childItemNeed); childWipItemNeed.Save(); } else { IsCheckWH = true; } } InitBomItemNeed(childItemNeed); } else { IsCheckWH = true; } }
public WIPItemNeed(Session session, WIPSalesOrderLine soLine, WIPTable wipTable) : base(session) { WIPTable = wipTable; SalesOrderLine = soLine; Item = soLine.SaleOrderLine.Item; ItemSource = Item.Source; IsEnableCalcQty = true; NeedDate = soLine.SaleOrderLine.NeedDate; NeedQty = soLine.BalQty - soLine.ReadyShipQty; WareHouse = soLine.SaleOrderLine.WareHouse; calcSubItemNeedQty(); Level = 1; SubLevel = 1; SetSortKey(); // childItemNeed 的用途是取得最先那个真正要用的RouteLine的WIPItemNeed. // 例 : P <= M 时, P为最后的RouteLine, 但它是取M的, 所以是M的WIPItemNeed才需要找Bom作为DictChildItemNeed // 而 P的ChildItemNeed只是M. WIPItemNeed childItemNeed = this; if (ItemSource == Item.ItemSource.Make) { RouteLine rLine = Item.GetLastRouteLine(); if (rLine != null) { RouteLine = CWIPRouteLine(rLine); RouteLine PreviousRLine = rLine.GetPreviousRoute(); if (PreviousRLine != null) { WIPItemNeed childWipItemNeed = new WIPItemNeed(Session, this, PreviousRLine, ref childItemNeed); childWipItemNeed.Save(); } else { IsCheckWH = true; } } InitBomItemNeed(childItemNeed); } else { IsCheckWH = true; } }
public WIPItemNeed(Session session, WIPItemNeed wipItemNeed, RouteLine rLine, ref WIPItemNeed childItemNeed) : base(session) { ParentItemNeed = wipItemNeed; WIPTable = wipItemNeed.WIPTable; SalesOrderLine = wipItemNeed.SalesOrderLine; //Item = rLine.wipItem; Item = wipItemNeed.Item; ItemSource = wipItemNeed.ItemSource; Level = wipItemNeed.Level; SubLevel = wipItemNeed.SubLevel + 1; IsEnableCalcQty = true; if (SalesOrderLine.SaleOrderLine.OrderType.WareHouse != null) WareHouse = SalesOrderLine.SaleOrderLine.OrderType.WareHouse; else WareHouse = wipItemNeed.WareHouse; // TODO: calc the needDate & needQty NeedDate = wipItemNeed.NeedDate.AddDays(-1); NeedQty = wipItemNeed.LackQty; calcSubItemNeedQty(); RouteLine = CWIPRouteLine(rLine); SetSortKey(); CheckOrderTypeScrap(); RouteLine PreviousRLine = rLine.GetPreviousRoute(); if (PreviousRLine != null) { WIPItemNeed childWipItemNeed = new WIPItemNeed(Session, this, PreviousRLine, ref childItemNeed); childWipItemNeed.Save(); } else { IsCheckWH = true; childItemNeed = this; } }
public void calcWipItemNeed(WIPItemNeed wipItemNeed) { if (BalQty > 0 && wipItemNeed.LackQty > 0) { float tmpQty = BalQty; wipItemNeed.WIPWHTotal = this; if (tmpQty > wipItemNeed.LackQty) { tmpQty = wipItemNeed.LackQty; } wipItemNeed.WHQty = wipItemNeed.WHQty + tmpQty; wipItemNeed.calcSubItemNeedQty(); wipItemNeed.Save(); UsedQty = UsedQty + tmpQty; } if (QABalQty > 0 && wipItemNeed.LackQty > 0) { float tmpQty = QABalQty; wipItemNeed.WIPWHTotal = this; if (tmpQty > wipItemNeed.LackQty) { tmpQty = wipItemNeed.LackQty; } wipItemNeed.WHQAQty = wipItemNeed.WHQAQty + tmpQty; wipItemNeed.calcSubItemNeedQty(); wipItemNeed.Save(); QAUsedQty = QAUsedQty + tmpQty; } }