public static int CreatePeriodBalance(ISession session, INVPeriod openPeriod)
        {
            DbSession dbsession = session.DbSession as DbSession;
            IDbCommand command = dbsession.CreateSqlStringCommand(@"
Insert Into inv_stock_balance(blnc_id, pd_id, sku_id, loc_code, area_code, sec_code, lot_num, stock_qty)
Select seq_inv_stock_balance.nextval,:pid,sku_id,loc_code,area_code,sec_code,lot_num,stock_qty
From inv_stock_detail
Where stock_qty<>0");
            dbsession.AddParameter(command, ":pid", DbTypeInfo.Int32(), openPeriod.PeriodID);
            dbsession.ExecuteNonQuery(command);

            INVPeriod prev = INVPeriod.GetPeriod(session, openPeriod.StartingDate.AddDays(-1));
            command = dbsession.CreateStoredProcCommand("f_rpt_inv_balance", new object[] { openPeriod.PeriodID, (prev == null ? 0 : prev.PeriodID) });
            dbsession.ExecuteNonQuery(command);
            return 1;
        }
Exemplo n.º 2
0
        public void Open(ISession session)
        {
            if (this.Status != INVPeriodStatus.New)
            {
                throw new Exception("无法对库存期间" + this.PeriodCode + "开帐");
            }
            INVPeriod openPeriod = GetOpenPeriod(session);

            //TODO: 多仓库时库存期间不一样的处理
            if (openPeriod != null)
            {
                throw new Exception("另一个库存期间" + openPeriod.PeriodCode + "已经开帐,系统只能有一个开帐的库存期间");
            }
            this.Status = INVPeriodStatus.Open;
            this.Update(session, "Status");
        }
        public static int CreatePeriodBalance(ISession session, INVPeriod openPeriod)
        {
            DbSession  dbsession = session.DbSession as DbSession;
            IDbCommand command   = dbsession.CreateSqlStringCommand(@"
Insert Into inv_stock_balance(blnc_id, pd_id, sku_id, loc_code, area_code, sec_code, lot_num, stock_qty)
Select seq_inv_stock_balance.nextval,:pid,sku_id,loc_code,area_code,sec_code,lot_num,stock_qty
From inv_stock_detail
Where stock_qty<>0");

            dbsession.AddParameter(command, ":pid", DbTypeInfo.Int32(), openPeriod.PeriodID);
            dbsession.ExecuteNonQuery(command);

            INVPeriod prev = INVPeriod.GetPeriod(session, openPeriod.StartingDate.AddDays(-1));

            command = dbsession.CreateStoredProcCommand("f_rpt_inv_balance", new object[] { openPeriod.PeriodID, (prev == null ? 0 : prev.PeriodID) });
            dbsession.ExecuteNonQuery(command);
            return(1);
        }
Exemplo n.º 4
0
        public static INVPeriod CreatePeriod(ISession session, DateTime date)
        {
            DateTime nowDay = new DateTime(date.Year, date.Month, date.Day);
            //�Ժ���Ըijɰ������õĹ���������
            DateTime firstDay = new DateTime(date.Year, date.Month, 1);
            DateTime lastDay = firstDay.AddMonths(1).AddDays(-1);

            INVPeriod period = new INVPeriod();
            period.Type = INVPeriodType.Month;
            period.Status = INVPeriodStatus.New;
            period.Year = nowDay.Year;
            period.Index = nowDay.Month;
            period.PeriodCode = period.Year.ToString() + period.Index.ToString().PadLeft(2, '0');
            period.StartingDate = firstDay;
            period.EndDate = lastDay;
            period.BalanceFinished = false;
            period.Create(session);

            return period;
        }
Exemplo n.º 5
0
        public static INVPeriod CreatePeriod(ISession session, DateTime date)
        {
            DateTime nowDay = new DateTime(date.Year, date.Month, date.Day);
            //以后可以改成按照配置的规则来计算
            DateTime firstDay = new DateTime(date.Year, date.Month, 1);
            DateTime lastDay  = firstDay.AddMonths(1).AddDays(-1);

            INVPeriod period = new INVPeriod();

            period.Type            = INVPeriodType.Month;
            period.Status          = INVPeriodStatus.New;
            period.Year            = nowDay.Year;
            period.Index           = nowDay.Month;
            period.PeriodCode      = period.Year.ToString() + period.Index.ToString().PadLeft(2, '0');
            period.StartingDate    = firstDay;
            period.EndDate         = lastDay;
            period.BalanceFinished = false;
            period.Create(session);

            return(period);
        }