private void toolStripButton9_Click(object sender, EventArgs e)
        {
            if (null == this.ly_inma0010DataGridView.CurrentRow)
            {
                return;
            }

            string nowplannum;
            string noename;
            string savepath;

            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
            dialog.Description = "请选择存放文件夹";
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (string.IsNullOrEmpty(dialog.SelectedPath))
                {
                    MessageBox.Show("文件夹路径不能为空", "提示");
                    return;
                }

                savepath = dialog.SelectedPath;
            }
            else
            {
                return;
            }


            NewFrm.Show(this);
            foreach (DataGridViewRow dgr in ly_inma0010DataGridView.Rows)
            {
                nowplannum = dgr.Cells["物资编号"].Value.ToString();

                noename = dgr.Cells["名称"].Value.ToString();

                string nowtype = dgr.Cells["中方型号"].Value.ToString();

                //this.toolStripLabel3.Text = plannum;
                //this.toolStripLabel3.Invalidate();

                NewFrm.Notify(this, "正在计算导出:  (" + nowplannum + " " + nowtype + ")" + noename + "   成本");

                this.ly_item_allcost_NoVat2TableAdapter.Fill(this.lYMaterialMange.ly_item_allcost_NoVat2, nowplannum);


                //ExportDataGridviewTOExcellA.ExportExcel(nowplannum + " " + nowtype, this.ly_item_allcost_NoVatDataGridView, savepath + "\\" + nowplannum + ".xls");
            }

            NewFrm.Hide(this);
        }
Esempio n. 2
0
        private void toolStripButton3_Click(object sender, EventArgs e)
        {
            if (null == this.ly_inma0010DataGridView.CurrentRow)
            {
                return;
            }

            string nowplannum;
            string noename;

            NewFrm.Show(this);
            foreach (DataGridViewRow dgr in ly_inma0010DataGridView.Rows)
            {
                nowplannum = dgr.Cells["物资编号"].Value.ToString();

                noename = dgr.Cells["名称"].Value.ToString();

                //this.toolStripLabel3.Text = plannum;
                //this.toolStripLabel3.Invalidate();

                NewFrm.Notify(this, "正在计算:  (" + nowplannum + ")" + noename + "   借用");



                Countmoney(nowplannum);
            }

            NewFrm.Hide(this);

            NewFrm.Show(this);

            this.ly_inma0010TableAdapter.Fill(this.lYStoreMange.ly_inma0010, SQLDatabase.NowUserID);

            CountMoney(ly_inma0010BindingSource, ly_inma0010DataGridView);

            NewFrm.Hide(this);
        }
        private void 计算当前物料成本ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (null == this.ly_inma0010DataGridView.CurrentRow)
            {
                return;
            }

            if (SQLDatabase.NowUserID != "000")
            {
                return;
            }
            string nowplannum;
            string noename;

            NewFrm.Show(this);

            nowplannum = this.ly_inma0010DataGridView.CurrentRow.Cells["物资编号"].Value.ToString();

            noename = this.ly_inma0010DataGridView.CurrentRow.Cells["名称"].Value.ToString();

            //this.toolStripLabel3.Text = plannum;
            //this.toolStripLabel3.Invalidate();

            NewFrm.Notify(this, "正在计算:  (" + nowplannum + ")" + noename + "   成本");



            Countmoney(nowplannum);



            NewFrm.Hide(this);

            this.ly_inma0010cpTableAdapter.Fill(this.lYMaterialMange.ly_inma0010cp);

            this.ly_inma0010cpBindingSource.Position = this.ly_inma0010cpBindingSource.Find("物资编号", nowplannum);
        }
Esempio n. 4
0
        private void 统一制定采购员ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (!SQLDatabase.CheckHaveRight(SQLDatabase.NowUserID, "物料采购员设置"))
            {
                return;
            }

            DataGridView dgv = ly_inma0010_sortDataGridView;



            string nowitemno;

            //string sel = "SELECT distinct yhbm as 代码,yhmc as 名称 FROM T_users order by yhbm";

            string    sel       = @"select yhbm as 工号, yhmc as 姓名 from T_users_Purchase_View ";
            QueryForm queryForm = new QueryForm();


            queryForm.Sel    = sel;
            queryForm.Constr = SQLDatabase.Connectstring;

            //Set the Column Collection to the filter Table
            //queryForm.SetSourceColumns(this.billMainDataSet.BalanceBill.Columns);

            queryForm.ShowDialog();

            //for (int i = 0; i < this.dataGridView1.Columns.Count; i++)

            //    this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;

            dgv.Columns["采购员"].SortMode = DataGridViewColumnSortMode.NotSortable;

            NewFrm.Show(this);
            foreach (DataGridViewRow dgr in dgv.Rows)
            {
                if (true == dgr.Selected)
                {
                    nowitemno = dgr.Cells["物资编号"].Value.ToString();

                    this.itemlist.Add(nowitemno);

                    //dgr.Cells["buyer_code"].Value = queryForm.Result;
                    //dgr.Cells["采购员"].Value = queryForm.Result1;

                    NewFrm.Notify(this, "正在更新:  (" + nowitemno + ")" + "   采购员");


                    UpdateSupplier(nowitemno, queryForm.Result, queryForm.Result1);

                    //this.ly_inma0010_sortBindingSource.EndEdit();

                    //this.ly_inma0010_sortTableAdapter.Update(this.lYMaterielRequirements.ly_inma0010_sort);


                    //UpdateRequirement(itemno, nowid, "buyercode", queryForm.Result);

                    //this.ly_inma0010_sortBindingSource.EndEdit();

                    //this.ly_inma0010_sortTableAdapter.Update(this.lYMaterielRequirements.ly_inma0010_sort);
                }
            }

            dgv.Columns["采购员"].SortMode = DataGridViewColumnSortMode.Automatic;
            // this.lY_MaterielRequirementsTableAdapter.Fill(this.lYPlanMange.LY_MaterielRequirements, parentId, "外协", "OWE");
            this.ly_inma0010_sortTableAdapter.Fill(this.lYMaterielRequirements.ly_inma0010_sort, this.sortcode, this.sortcode);
            NewFrm.Hide(this);

            int nowindex = 0;

            foreach (string nowitem in itemlist)
            {
                nowindex = this.ly_inma0010_sortBindingSource.Find("物资编号", nowitem);
                dgv.Rows[nowindex].Selected = true;
            }



            // dgv.Columns["采购员"].SortMode = DataGridViewColumnSortMode.Automatic;
        }
        private void toolStripButton6_Click(object sender, EventArgs e)
        {
            if (null == this.ly_inma0010DataGridView.CurrentRow)
            {
                return;
            }

            if (SQLDatabase.NowUserID != "000")
            {
                return;
            }

            string nowplannum;
            string noename;

            NewFrm.Show(this);
            foreach (DataGridViewRow dgr in ly_inma0010DataGridView.Rows)
            {
                nowplannum = dgr.Cells["物资编号"].Value.ToString();

                noename = dgr.Cells["名称"].Value.ToString();

                //this.toolStripLabel3.Text = plannum;
                //this.toolStripLabel3.Invalidate();

                NewFrm.Notify(this, "正在计算:  (" + nowplannum + ")" + noename + "   成本");



                Countmoney(nowplannum);
            }

            NewFrm.Hide(this);

            this.ly_inma0010cpTableAdapter.Fill(this.lYMaterialMange.ly_inma0010cp);
            ///////////////////////

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