コード例 #1
0
ファイル: SCommBB.cs プロジェクト: wanghouxian2015/GMWJGit
 /// <summary>
 /// ���캯��
 /// </summary>
 public SCommBB()
 {
     this.selfConn = true;
     this.connection = new SqlConnection(HS.Config.SqlDataObject.GetSqlConnectionString);
     this.connection.Open();
     this.commDB = new SCommDB(this.connection);
 }
コード例 #2
0
ファイル: SCommBB.cs プロジェクト: wanghouxian2015/GMWJGit
 /// <summary>
 /// ���캯��
 /// </summary>
 /// <param name="connection">��������</param>
 public SCommBB(SqlConnection connection)
 {
     this.connection = connection;
     this.commDB = new SCommDB(connection);
 }
コード例 #3
0
ファイル: SCommBB.cs プロジェクト: wanghouxian2015/GMWJGit
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
                return;

            if (this.selfConn)
            {
                this.connection.Close();
                this.connection.Dispose();
                this.connection = null;
            }
            if (this.commDB != null)
            {
                this.commDB.Dispose();
                this.commDB = null;
            }
        }
コード例 #4
0
ファイル: UStockDB.cs プロジェクト: wanghouxian2015/GMWJGit
        /// <summary>
        /// 更改物料箱锁定状态
        /// </summary>
        /// <param name="strWareLocatorNo">库位</param>
        /// <param name="strFinanceBillNo">采购合同号</param>
        /// <param name="strMaterialNo">物料号</param>
        /// <param name="num">数量</param>
        public void UpdateWareLocator(string strWareLocatorNo, string strFinanceBillNo, string strMaterialNo, float num)
        {
            SCommDB commBB = new SCommDB();

            try
            {
                DataTable dtStock = new DataTable();
                string strWhere = "", strSql = "";

                //查询条件
                strWhere = "isOutStocking=0 and wareLocatorNo='" + strWareLocatorNo + "' and materialNo='" + strMaterialNo + "' and num>0";

                if (strFinanceBillNo != "")
                {
                    strWhere += " and financeBillNo='" + strFinanceBillNo + "'";
                }

                //查询库存
                dtStock = this.GetVList(strWhere).Tables[0];

                foreach (DataRow row in dtStock.Rows)
                {
                    int stockId = 0;
                    float stockNum = 0;
                    string strBoxNo = "";

                    stockId = Convert.ToInt32(row["id"]);
                    stockNum = Convert.ToSingle(row["num"]);//库存数量
                    strBoxNo = row["boxNo"].ToString();

                    //更改库存锁定状态
                    strSql = "update dbo.UStock set isOutStocking=1 where id=" + stockId.ToString();
                    SqlHelper.ExecuteNonQuery(this.connection, this.transaction, CommandType.Text, strSql.ToString());

                    //更改原箱库存锁定状态
                    strSql = "update dbo.BArrangeBillBox set isOutStocking=1 where boxNo='" + strBoxNo + "'";
                    SqlHelper.ExecuteNonQuery(this.connection, this.transaction, CommandType.Text, strSql.ToString());

                    if (stockNum >= num)
                    {
                        break;
                    }
                    else
                    {
                        num = num - stockNum;
                    }
                }
            }
            finally
            {
                commBB.Dispose();
            }
        }