Example #1
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            //////////////////////////////////////



            LY_MaterialAdd queryForm = new LY_MaterialAdd();

            queryForm.material_code = "";
            queryForm.runmode       = "增加";
            queryForm.statemode     = "原料";

            queryForm.StartPosition = FormStartPosition.CenterParent;
            queryForm.ShowDialog();

            if (queryForm.DialogResult != DialogResult.Cancel)
            {
                this.ly_inma0010ylTableAdapter.Fill(this.lYMaterialMange.ly_inma0010yl);
                this.ly_inma0010ylBindingSource.Position = this.ly_inma0010ylBindingSource.Find("物资编号", queryForm.material_code);


                SQLDatabase.dataChangeREC(ly_inma0010DataGridView.CurrentRow.Cells["id"].Value.ToString(), "ly_inma0010", "INS", this.Text);
            }

            ///////////////////////////////////////////
        }
Example #2
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (null == ly_inma0010DataGridView.CurrentRow)
            {
                return;
            }
            string s = this.ly_inma0010DataGridView.CurrentRow.Cells["物资编号"].Value.ToString();
            //int loanid = int.Parse(this.xD_Client_LoanDataGridView.CurrentRow.Cells["Id_loan"].Value.ToString());

            LY_MaterialAdd queryForm = new LY_MaterialAdd();

            queryForm.statemode     = "成品";
            queryForm.runmode       = "修改";
            queryForm.material_code = s;

            queryForm.StartPosition = FormStartPosition.CenterParent;
            queryForm.ShowDialog();

            //if (queryForm.DialogResult != DialogResult.Cancel)
            //{
            //    this.ly_inma0010cpTableAdapter.Fill(this.lYMaterialMange.ly_inma0010cp);

            //    this.ly_inma0010cpBindingSource.Position = this.ly_inma0010cpBindingSource.Find("物资编号", s);
            //}
        }
Example #3
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (null == ly_inma0010DataGridView.CurrentRow)
            {
                return;
            }

            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;
            }

            string s = this.ly_inma0010DataGridView.CurrentRow.Cells["物资编号"].Value.ToString();
            //int loanid = int.Parse(this.xD_Client_LoanDataGridView.CurrentRow.Cells["Id_loan"].Value.ToString());

            LY_MaterialAdd queryForm = new LY_MaterialAdd();

            queryForm.statemode     = "原料";
            queryForm.runmode       = "修改";
            queryForm.material_code = s;

            queryForm.StartPosition = FormStartPosition.CenterParent;
            queryForm.ShowDialog();

            if (queryForm.DialogResult != DialogResult.Cancel)
            {
                this.ly_inma0010machineTableAdapter.Fill(this.lYMaterialMange.ly_inma0010machine);

                this.ly_inma0010machineBindingSource.Position = this.ly_inma0010machineBindingSource.Find("物资编号", s);
            }
        }
Example #4
0
        private void ly_inma0010DataGridView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            return;

            if (null == ly_inma0010DataGridView.CurrentRow)
            {
                return;
            }
            string s = this.ly_inma0010DataGridView.CurrentRow.Cells["物资编号"].Value.ToString();
            //int loanid = int.Parse(this.xD_Client_LoanDataGridView.CurrentRow.Cells["Id_loan"].Value.ToString());

            LY_MaterialAdd queryForm = new LY_MaterialAdd();

            queryForm.statemode     = "成品";
            queryForm.runmode       = "修改";
            queryForm.material_code = s;

            queryForm.StartPosition = FormStartPosition.CenterParent;
            queryForm.ShowDialog();

            //if (queryForm.DialogResult != DialogResult.Cancel)
            //{
            //    this.ly_inma0010cpTableAdapter.Fill(this.lYMaterialMange.ly_inma0010cp);

            //    this.ly_inma0010cpBindingSource.Position = this.ly_inma0010cpBindingSource.Find("物资编号", s);
            //}

            //if (null == ly_inma0010DataGridView.CurrentRow) return;
            //string s = this.ly_inma0010DataGridView.CurrentRow.Cells["物资编号"].Value.ToString();

            //string selAllString = "SELECT     parentno, itemno,  itemno +':' +itemname as itemname  from f_BomExtend('" + s +"',1) ORDER BY  id_num ";
            //string cString = SQLDatabase.Connectstring; ;
            //SqlDataAdapter bomAdapter = new SqlDataAdapter(selAllString, cString);

            //bomAdapter.SelectCommand.CommandTimeout = 0;

            //DataSet bomData = new DataSet();
            //bomAdapter.Fill(bomData);

            //this.treeView1.Nodes.Clear();
            //MakeTreeView(bomData.Tables[0], null, null);
            ////this.treeView1.ExpandAll();
            //this.treeView1.SelectedNode = this.treeView1.Nodes[0];
            //this.treeView1.SelectedNode.Expand();

            //this.groupBox1.Text = s + "BOM结构图";
        }
Example #5
0
        private void bindingNavigatorAddNewItem_Click(object sender, EventArgs e)
        {
            LY_MaterialAdd queryForm = new LY_MaterialAdd();

            queryForm.material_code = "";
            queryForm.runmode       = "增加";
            queryForm.statemode     = "成品";

            queryForm.StartPosition = FormStartPosition.CenterParent;
            queryForm.ShowDialog();

            //if (queryForm.DialogResult != DialogResult.Cancel)
            //{
            //    this.ly_inma0010cpTableAdapter.Fill(this.lYMaterialMange.ly_inma0010cp);
            //    this.ly_inma0010cpBindingSource.Position = this.ly_inma0010cpBindingSource.Find("物资编号", queryForm.material_code);
            //}
        }
Example #6
0
        private void 修改物料基本信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == ly_inma0010_inoutDataGridView.CurrentRow)
            {
                return;
            }


            string s     = this.ly_inma0010_inoutDataGridView.CurrentRow.Cells["物资编号"].Value.ToString();
            string nowxh = this.ly_inma0010_inoutDataGridView.CurrentRow.Cells["id"].Value.ToString();
            //int loanid = int.Parse(this.xD_Client_LoanDataGridView.CurrentRow.Cells["Id_loan"].Value.ToString());



            LY_MaterialAdd queryForm = new LY_MaterialAdd();

            queryForm.statemode     = "原料";
            queryForm.runmode       = "修改";
            queryForm.material_code = s;

            queryForm.StartPosition = FormStartPosition.CenterParent;
            queryForm.ShowDialog();

            if (queryForm.DialogResult != DialogResult.Cancel)
            {
                // this.ly_inma0010ylTableAdapter.Fill(this.lYMaterialMange.ly_inma0010yl);

                this.ly_inma0010_inoutTableAdapter.Fill(this.lYMaterialMange.ly_inma0010_inout, SQLDatabase.NowUserID);

                int nowpos = this.ly_inma0010_inoutBindingSource.Find("id", nowxh);

                //if (nowpos < 1)
                //{
                //    nowpos = this.ly_inma0010ylBindingSource.Find("物资编号", nowxh);
                //}

                this.ly_inma0010_inoutBindingSource.Position = nowpos; // this.ly_inma0010ylBindingSource.Find("物资编号", s);
            }
        }
Example #7
0
        private void ly_inma0010DataGridView_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            if (null == ly_inma0010DataGridView.CurrentRow)
            {
                return;
            }

            //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;
            //}

            DataGridView dgv = sender as DataGridView;

            if ("商务型号" == dgv.CurrentCell.OwningColumn.Name)
            {
                string wzbh = dgv.CurrentRow.Cells["物资编号"].Value.ToString();
                string swxh = dgv.CurrentCell.Value == null ? "" : dgv.CurrentCell.Value.ToString().Trim();
                if (swxh == "")
                {
                    swxh = dgv.CurrentRow.Cells["中方型号"].Value.ToString();
                }
                ChangeValue queryForm1 = new ChangeValue();

                queryForm1.OldValue   = swxh;
                queryForm1.NewValue   = swxh;
                queryForm1.ChangeMode = "string";
                queryForm1.ShowDialog();
                if (queryForm1.NewValue != "")
                {
                    string updstr = " update ly_inma0010  " +
                                    "  set commercial_description='" + queryForm1.NewValue + "'"
                                    + " where  wzbh='" + wzbh + "'";
                    SqlConnection sqlConnection1 = new SqlConnection(SQLDatabase.Connectstring);
                    SqlCommand    cmd            = new SqlCommand();

                    cmd.CommandText    = updstr;
                    cmd.CommandType    = CommandType.Text;
                    cmd.Connection     = sqlConnection1;
                    cmd.CommandTimeout = 0;

                    using (TransactionScope scope = new TransactionScope())
                    {
                        sqlConnection1.Open();
                        try
                        {
                            cmd.ExecuteNonQuery();
                            scope.Complete();
                            dgv.CurrentCell.Value = queryForm1.NewValue;
                        }
                        catch (SqlException sqle)
                        {
                            MessageBox.Show(sqle.Message.Split('*')[0]);
                        }
                        finally
                        {
                            sqlConnection1.Close();
                        }
                    }
                }

                return;
            }



            string         s         = this.ly_inma0010DataGridView.CurrentRow.Cells["物资编号"].Value.ToString();
            LY_MaterialAdd queryForm = new LY_MaterialAdd();

            queryForm.statemode     = "成品";
            queryForm.runmode       = "修改";
            queryForm.material_code = s;

            queryForm.StartPosition = FormStartPosition.CenterParent;
            queryForm.ShowDialog();

            if (queryForm.DialogResult != DialogResult.Cancel)
            {
                this.ly_inma0010cpTableAdapter.Fill(this.lYMaterialMange.ly_inma0010cp);

                this.ly_inma0010cpBindingSource.Position = this.ly_inma0010cpBindingSource.Find("物资编号", s);
            }
        }
Example #8
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (null == ly_inma0010DataGridView.CurrentRow)
            {
                return;
            }


            DataGridView dgv = sender as DataGridView;

            if ("商务型号" == dgv.CurrentCell.OwningColumn.Name)
            {
                string wzbh = dgv.CurrentRow.Cells["物资编号"].Value.ToString();
                string swxh = dgv.CurrentCell.Value == null ? "" : dgv.CurrentCell.Value.ToString().Trim();
                if (swxh == "")
                {
                    swxh = dgv.CurrentRow.Cells["中方型号"].Value.ToString();
                }
                ChangeValue queryForm1 = new ChangeValue();

                queryForm1.OldValue   = swxh;
                queryForm1.NewValue   = swxh;
                queryForm1.ChangeMode = "string";
                queryForm1.ShowDialog();
                if (queryForm1.NewValue != "")
                {
                    string updstr = " update ly_inma0010  " +
                                    "  set commercial_description='" + queryForm1.NewValue + "'"
                                    + " where  wzbh='" + wzbh + "'";
                    SqlConnection sqlConnection1 = new SqlConnection(SQLDatabase.Connectstring);
                    SqlCommand    cmd            = new SqlCommand();

                    cmd.CommandText    = updstr;
                    cmd.CommandType    = CommandType.Text;
                    cmd.Connection     = sqlConnection1;
                    cmd.CommandTimeout = 0;

                    using (TransactionScope scope = new TransactionScope())
                    {
                        sqlConnection1.Open();
                        try
                        {
                            cmd.ExecuteNonQuery();
                            scope.Complete();
                            dgv.CurrentCell.Value = queryForm1.NewValue;
                        }
                        catch (SqlException sqle)
                        {
                            MessageBox.Show(sqle.Message.Split('*')[0]);
                        }
                        finally
                        {
                            sqlConnection1.Close();
                        }
                    }
                }

                return;
            }



            string s     = this.ly_inma0010DataGridView.CurrentRow.Cells["物资编号"].Value.ToString();
            string nowxh = this.ly_inma0010DataGridView.CurrentRow.Cells["id"].Value.ToString();
            //int loanid = int.Parse(this.xD_Client_LoanDataGridView.CurrentRow.Cells["Id_loan"].Value.ToString());

            LY_MaterialAdd queryForm = new LY_MaterialAdd();

            queryForm.statemode     = "原料";
            queryForm.runmode       = "修改";
            queryForm.material_code = s;

            queryForm.StartPosition = FormStartPosition.CenterParent;
            queryForm.ShowDialog();

            if (queryForm.DialogResult != DialogResult.Cancel)
            {
                this.ly_inma0010ylTableAdapter.Fill(this.lYMaterialMange.ly_inma0010yl);

                int nowpos = this.ly_inma0010ylBindingSource.Find("id", nowxh);

                //if (nowpos < 1)
                //{
                //    nowpos = this.ly_inma0010ylBindingSource.Find("物资编号", nowxh);
                //}

                this.ly_inma0010ylBindingSource.Position = nowpos; // this.ly_inma0010ylBindingSource.Find("物资编号", s);

                SQLDatabase.dataChangeREC(ly_inma0010DataGridView.CurrentRow.Cells["id"].Value.ToString(), "ly_inma0010", "UPD", this.Text);
            }
        }