Ejemplo n.º 1
0
        //导入五金
        private void button5_Click(object sender, EventArgs e)
        {
            var frm = new FormSelect();

            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK)
            {
                DataTable dt      = frm.gdt.DefaultView.Table;
                WaitForm  loading = WaitForm.getLoading();
                loading.SetExecuteMethod(runImpWujin, dt);
                loading.ShowDialog();
                if (ValidateProjectInfo())
                {
                    //CaculateFloorSum(false);
                    CaculateTotalPrice();
                    gCBDataSource.EndEdit();
                    gCBTableAdapter.Update(dataSet1.GCB);
                    new DataSet1TableAdapters.XMBTableAdapter().Update(dataSet1.XMB);
                    new DataSet1TableAdapters.PARTSTableAdapter().Update(dataSet1.PARTS);
                }
                this.SubProjectDetailGrid1.DataSource = null;
                this.SubProjectDetailGrid1.DataSource = this.PARTSSource;
                this.dataGridView4.DataSource         = null;
                this.dataGridView4.DataSource         = this.XMBBindingSource;
                //refreshData();
                //dataGridView4.Refresh();
                //SubProjectDetailGrid1.Refresh();
            }
        }
Ejemplo n.º 2
0
 public static WaitForm getLoading()
 {
     if (pLoading == null || pLoading.IsDisposed)
     {
         pLoading = new WaitForm();
     }
     return(pLoading);
 }
Ejemplo n.º 3
0
        private void runImpbancai(object obj)
        {
            //添加工程
            //dataSet1.GCB.AddGCBRow(ProjectKey,
            //dt.Rows[0]["项目名称"].ToString(), dt.Rows[0]["客户信息"].ToString(), string.Empty,
            //string.Empty, string.Empty,
            //DateTime.Now, " ",0, 0, 0,16.00);
            DataTable dt = NPOIExcelHelp.ReadExcel(openFileDialog.FileName, "Parts list", true);

            dt.Rows.RemoveAt(0);//移出第一行空行
            if (dt.Rows.Count > 0)
            {
                var project = dataSet1.GCB.Rows[0] as DataSet1.GCBRow;
                project.工程名称 = dt.Rows[0]["项目名称"].ToString();
                project.客户名称 = dt.Rows[0]["客户信息"].ToString();
                //textBox2.Text = dt.Rows[0]["项目名称"].ToString();
                //textBox4.Text = dt.Rows[0]["客户信息"].ToString();

                DataView  dataView   = dt.DefaultView;
                DataTable dtDistinct = dataView.ToTable(true, "组路径");//去列的重复项

                foreach (DataRow dr in dtDistinct.Rows)
                {
                    //添加项目
                    string subProjectKey = gCBTableAdapter.GetSubProjectKey(); //生成项目关键字
                    string xmName        = dr["组路径"].ToString();
                    if (string.IsNullOrEmpty(xmName))
                    {
                        continue;
                    }
                    dataSet1.XMB.AddXMBRow(subProjectKey, ProjectKey, "", (dataSet1.XMB.Rows.Count + 1).ToString("X"),
                                           xmName.Replace("/", ""), 0, "1", "1", "101");
                    foreach (DataRow drDetail in dt.Select("组路径='" + xmName + "'"))
                    {
                        //添加部件
                        dataSet1.PARTS.AddPARTSRow(gCBTableAdapter.GetNewSubProjectDetailId(),
                                                   subProjectKey, ProjectKey, (dataSet1.PARTS.Rows.Count + 1).ToString(), string.Empty, drDetail["名称"].ToString(),
                                                   float.Parse(drDetail["长度"].ToString()), float.Parse(drDetail["宽度"].ToString()),
                                                   float.Parse(drDetail["厚度"].ToString()), "M2", Convert.ToDouble(drDetail["数量"]),
                                                   float.Parse(drDetail["成型尺寸 l1"].ToString()), float.Parse(drDetail["成型尺寸 l2"].ToString()),
                                                   Convert.ToDouble(drDetail["面积,成型面积"]), drDetail["材料"].ToString(),
                                                   drDetail["图层名称"].ToString(), 0, 0, 0, 0, " ", string.Empty);
                    }
                }
            }
            WaitForm.getLoading().CloseLoadingForm();
        }
Ejemplo n.º 4
0
        private void runImpWujin(object obj)
        {
            DataTable dt = obj as DataTable;

            if (dt.Rows.Count > 0)
            {
                //添加项目
                string subProjectKey = gCBTableAdapter.GetSubProjectKey(); //生成项目关键字
                string xmName        = "五金配件";
                dataSet1.XMB.AddXMBRow(subProjectKey, ProjectKey, "", (dataSet1.XMB.Rows.Count + 1).ToString("X"),
                                       xmName, 0, "1", "1", "101");
                foreach (DataRow dr in dt.Rows)
                {
                    //添加部件
                    dataSet1.PARTS.AddPARTSRow(gCBTableAdapter.GetNewSubProjectDetailId(),
                                               subProjectKey, ProjectKey, (dataSet1.PARTS.Rows.Count + 1).ToString(), dr["颜色"].ToString(), dr["部品"].ToString(),
                                               0, 0, 0, dr["单位"].ToString(), Convert.ToDouble(dr["数量"]),
                                               0, 0, 0, dr["型号"].ToString(), string.Empty, 0, 0, Convert.ToDouble(dr["标准单价"]),
                                               Convert.ToDouble(dr["标准单价"]) * Convert.ToDouble(dr["数量"]), " ", dr["品牌"].ToString());
                }
            }
            WaitForm.getLoading().CloseLoadingForm();
        }
Ejemplo n.º 5
0
 //导入板材
 private void button6_Click(object sender, EventArgs e)
 {
     openFileDialog.FilterIndex = 1;
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         WaitForm loading = WaitForm.getLoading();
         loading.SetExecuteMethod(runImpbancai, null);
         loading.ShowDialog();
         if (ValidateProjectInfo())
         {
             //CaculateFloorSum(false);
             CaculateTotalPrice();
             gCBDataSource.EndEdit();
             gCBTableAdapter.Update(dataSet1.GCB);
             new DataSet1TableAdapters.XMBTableAdapter().Update(dataSet1.XMB);
             new DataSet1TableAdapters.PARTSTableAdapter().Update(dataSet1.PARTS);
         }
         this.SubProjectDetailGrid1.DataSource = null;
         this.SubProjectDetailGrid1.DataSource = this.PARTSSource;
         this.dataGridView4.DataSource         = null;
         this.dataGridView4.DataSource         = this.XMBBindingSource;
     }
 }