/// <summary>
        /// 初始化库存(每天晚上执行一次,纠正错误的库存)
        /// </summary>
        public void initStock()
        {
            string sql = @" TRUNCATE TABLE Stock1
                            INSERT INTO Stock1 (id,iden,Stock)
                            SELECT id,iden,SUM(Stock)Stock FROM View_Stock1 GROUP BY id,iden
                            DECLARE @@tt TABLE(id VARCHAR(20),stock DECIMAL )
                            insert into @@tt select a1.id,a1.Stock*b1.sum Stock  from  Stock1 a1 INNER JOIN 
                            (
	                            SELECT a.id,a.iden,c.sum FROM Stock1 a INNER JOIN dbo.Link b ON a.id=b.t_id AND a.iden=b.iden
	                            INNER JOIN Link_Mid c ON b.id=c.id AND b.iden=c.iden WHERE c.StockType<>1
                            ) b1 ON a1.id=b1.id AND a1.iden=b1.iden
                            UPDATE Stock1 SET Stock=b2.Stock FROM Stock1 a1 INNER JOIN @@tt b2 ON a1.id=b2.id where a1.Stock<>b2.Stock";
            DbBase db  = new DbBase();

            db.ChangeDBData_Centre();
            db.ExecuteNonQuery(sql, 60 * 10);
            db.ChangeDBShop();
            sql = string.Format("UPDATE dbo.Product SET Stock=b.Stock FROM Product a INNER JOIN {0}.dbo.Stock1 b ON a.spid=b.id WHERE a.Stock<>b.Stock", System.Configuration.ConfigurationManager.AppSettings["centredb"]);
            db.ExecuteNonQuery(sql);
        }