Beispiel #1
0
        public WIPCalc()
        {
            uow = new UnitOfWork();

            wipTable = new WIPTable(uow);
            wipTable.Save();

            dictPoLine = new Dictionary<string, XPCollection<WIPPurchOrderLine>>();
            dictProdRoute = new Dictionary<string, XPCollection<WIPProdRoute>>();
            dictWHTotal = new Dictionary<string, XPCollection<WIPWHTotal>>();
            dictProdBom = new Dictionary<string, XPCollection<WIPProdBom>>();
        }
Beispiel #2
0
        public static WIPReport GetWipReport(WIPTable wipTable)
        {
            WIPReport wipReport;

            switch (wipTable.WIPReportType)
            {
                case mpWIPAll.ReportType.CM:
                    wipReport = new WIPReport_CM();
                    break;
                case mpWIPAll.ReportType.NPD:
                    wipReport = new WIPReport_NPD();
                    break;
                default:
                    wipReport = new WIPReport();
                    break;
            }

            wipReport.WIPTable = wipTable;
            return wipReport;
        }
Beispiel #3
0
        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;
            }
        }
Beispiel #4
0
        public void RunReport()
        {
            Logger.For(this).Info("开始");
            wipTable = new WIPTable(Session);
            wipTable.WIPReportType = this.WIPReportType;
            wipTable.Save();

            dictPoLine = new Dictionary<string, XPCollection<WIPPurchOrderLine>>();
            dictProdRoute = new Dictionary<string, XPCollection<WIPProdRoute>>();
            dictWHTotal = new Dictionary<string, XPCollection<WIPWHTotal>>();
            dictProdBom = new Dictionary<string, XPCollection<WIPProdBom>>();
            dictWIPRouteLine = new Dictionary<string, WIPRouteLine>();

            uow = (UnitOfWork)Session;
            try
            {
                cacheData();
                initWIPItemNeed();
                uow.CommitChanges();
                calcWIP();
                uow.CommitChanges();
                calcReadyQty();
                uow.CommitChanges();
            }
            catch (Exception ex)
            {
                Logger.For(this).Error(string.Format("不能计算WIP.  出现以下错误.\n{0}", ex.Message));
                uow.RollbackTransaction();
            }
            Logger.For(this).Info("结束");
        }