예제 #1
0
        private void copyStru(string oriitemno, string disitemno)
        {
            if (SQLDatabase.CheckBOMConfliect(disitemno, oriitemno))
            {
                MessageBox.Show("源物料的BOM中包含当前目的物料,结构冲突...", "注意");
                return;
            }

            SqlConnection sqlConnection1 = new SqlConnection(SQLDatabase.Connectstring);
            SqlCommand    cmd            = new SqlCommand();

            string contractinnerCode = "";

            //cmd.Parameters.Add("@Client_mode", SqlDbType.VarChar);
            //cmd.Parameters["@Client_mode"].Value = "YY";

            //cmd.Parameters.Add("@loanId", SqlDbType.Int);
            //cmd.Parameters["@loanId"].Value = loanId;

            cmd.Parameters.Add("@oriitemno", SqlDbType.VarChar);
            cmd.Parameters["@oriitemno"].Value = oriitemno;

            cmd.Parameters.Add("@disitemno", SqlDbType.VarChar);
            cmd.Parameters["@disitemno"].Value = disitemno;


            cmd.CommandText = "LY_Copy_Bomstru";
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection  = sqlConnection1;

            sqlConnection1.Open();
            cmd.ExecuteNonQuery();
            sqlConnection1.Close();



            //return contractinnerCode;
        }
예제 #2
0
        private void bom_material_selDataGridView_DoubleClick(object sender, EventArgs e)
        {
            if (null == bom_material_selDataGridView.CurrentRow)
            {
                return;
            }
            string componentNum = this.bom_material_selDataGridView.CurrentRow.Cells["物资编号1"].Value.ToString();

            if (!checkLock())
            {
                MessageBox.Show("已经锁定无法修改...", "注意");
                return;
            }
            string salespeople = this.ly_inma0010DataGridView.CurrentRow.Cells["负责人"].Value.ToString();

            if (!string.IsNullOrEmpty(salespeople))
            {
                if (salespeople != SQLDatabase.nowUserName())
                {
                    MessageBox.Show("请负责人:" + salespeople + "操作", "注意");
                    return;
                }
            }
            else
            {
                MessageBox.Show("请联系技术部领导进行负责人指定...", "注意");
                return;
            }



            if (parentNum != "noSet")
            {
                if (SQLDatabase.CheckBOMConfliect(parentNum, componentNum))
                {
                    MessageBox.Show("所选子件的BOM中包含当前父件,结构冲突...", "注意");
                    return;
                }

                string insStr = " INSERT INTO ly_bm0031  " +
                                "( parent,component) " +
                                " values ('" + parentNum + "','" + componentNum + "' )";


                using (TransactionScope scope = new TransactionScope())
                {
                    SqlConnection sqlConnection1 = new SqlConnection(SQLDatabase.Connectstring);
                    SqlCommand    cmd            = new SqlCommand();

                    cmd.CommandText = insStr;
                    cmd.CommandType = CommandType.Text;
                    cmd.Connection  = sqlConnection1;



                    sqlConnection1.Open();
                    cmd.ExecuteNonQuery();

                    sqlConnection1.Close();

                    scope.Complete();
                }
            }


            this.ly_bm0031TableAdapter.Fill(this.lYMaterialMange.ly_bm0031, parentNum);
            this.bom_material_selTableAdapter.Fill(this.lYMaterialMange.bom_material_sel, parentNum);

            this.ly_bm0031BindingSource.Position = this.ly_bm0031BindingSource.Find("component", componentNum);
        }