示例#1
0
        private void CreateExcel(string path)
        {
            DataTable dt = new DataTable();

            clsBuiness.CaiDan_RGLJ cd = new clsBuiness.CaiDan_RGLJ();
            cd.STYLE        = txt_Style.Text;
            cd.LABEL        = txt_Label.Text;
            cd.DESC         = this.txt_desc.Text;
            cd.FABRIC       = this.txt_fabric.Text;
            cd.Jacket       = this.txt_jacket.Text;
            cd.Pant         = this.txt_pant.Text;
            cd.shuoming     = this.txt_shuoming.Text;
            cd.JiaGongchang = this.cb_jgc.Text;
            cd.MianLiao     = this.txt_mianlioa.Text;
            cd.CaiDanHao    = this.txt_CaidanNo.Text;
            cd.ZhiDanRiqi   = this.txt_zhidan.Text;
            cd.JiaoHuoRiqi  = this.txt_jiaohuo.Text;
            cd.RN_NO        = this.txt_RN.Text;
            //dt.Columns.Add("id", typeof(int));
            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                //if (!dataGridView1.Columns[i].HeaderCell.Value.ToString().Equals("id"))
                //{
                dt.Columns.Add(dataGridView1.Columns[i].HeaderCell.Value.ToString(), typeof(String));
                //}
            }
            for (int i = 0; i < dataGridView1.Rows.Count; i++)
            {
                if (dataGridView1.Rows[i].Cells[1].Value != null)
                {
                    dt.Rows.Add(dataGridView1.Rows[i].Cells[0].Value, dataGridView1.Rows[i].Cells[1].Value, dataGridView1.Rows[i].Cells[2].Value, dataGridView1.Rows[i].Cells[3].Value, dataGridView1.Rows[i].Cells[4].Value, dataGridView1.Rows[i].Cells[5].Value, dataGridView1.Rows[i].Cells[6].Value, dataGridView1.Rows[i].Cells[7].Value, dataGridView1.Rows[i].Cells[8].Value, dataGridView1.Rows[i].Cells[9].Value, dataGridView1.Rows[i].Cells[10].Value, dataGridView1.Rows[i].Cells[11].Value, dataGridView1.Rows[i].Cells[12].Value, dataGridView1.Rows[i].Cells[13].Value, dataGridView1.Rows[i].Cells[14].Value, dataGridView1.Rows[i].Cells[15].Value, dataGridView1.Rows[i].Cells[16].Value, dataGridView1.Rows[i].Cells[17].Value, dataGridView1.Rows[i].Cells[18].Value, dataGridView1.Rows[i].Cells[19].Value, dataGridView1.Rows[i].Cells[20].Value, dataGridView1.Rows[i].Cells[21].Value, dataGridView1.Rows[i].Cells[22].Value, dataGridView1.Rows[i].Cells[23].Value, dataGridView1.Rows[i].Cells[24].Value, dataGridView1.Rows[i].Cells[25].Value, dataGridView1.Rows[i].Cells[26].Value, dataGridView1.Rows[i].Cells[27].Value, dataGridView1.Rows[i].Cells[28].Value, dataGridView1.Rows[i].Cells[29].Value, dataGridView1.Rows[i].Cells[30].Value, dataGridView1.Rows[i].Cells[31].Value, dataGridView1.Rows[i].Cells[32].Value, dataGridView1.Rows[i].Cells[33].Value, dataGridView1.Rows[i].Cells[34].Value, dataGridView1.Rows[i].Cells[35].Value, dataGridView1.Rows[i].Cells[36].Value, dataGridView1.Rows[i].Cells[37].Value, dataGridView1.Rows[i].Cells[38].Value, dataGridView1.Rows[i].Cells[39].Value, dataGridView1.Rows[i].Cells[40].Value, dataGridView1.Rows[i].Cells[41].Value, dataGridView1.Rows[i].Cells[42].Value, dataGridView1.Rows[i].Cells[43].Value);
                }
            }
            gn2.CDEXCELRGLJ(dt, cd, path);
            foldPath = path + "\\裁单表-" + cd.CaiDanHao + ".xls";
        }
示例#2
0
        private void CaiDanRGLJ_Load(object sender, EventArgs e)
        {
            this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.None;//设置dava宽度
            #region RGLJ
            DataTable dt4 = new DataTable();
            dt4.Columns.Add("Id", typeof(int));

            dt4.Columns.Add("面料", typeof(string));
            dt4.Columns.Add("款式", typeof(string));
            dt4.Columns["款式"].ReadOnly = true;
            dt4.Columns.Add("货号", typeof(string));
            dt4.Columns.Add("颜色", typeof(string));
            dt4.Columns.Add("颜色编号", typeof(string));
            dt4.Columns.Add("上衣", typeof(string));
            dt4.Columns.Add("34R", typeof(string));
            dt4.Columns.Add("36R", typeof(string));
            dt4.Columns.Add("38R", typeof(string));
            dt4.Columns.Add("40R", typeof(string));
            dt4.Columns.Add("42R", typeof(string));
            dt4.Columns.Add("44R", typeof(string));
            dt4.Columns.Add("46R", typeof(string));
            dt4.Columns.Add("48R", typeof(string));
            dt4.Columns.Add("50R", typeof(string));
            dt4.Columns.Add("52R", typeof(string));
            dt4.Columns.Add("54R", typeof(string));
            dt4.Columns.Add("56R", typeof(string));
            dt4.Columns.Add("58R", typeof(string));
            dt4.Columns.Add("60R", typeof(string));
            dt4.Columns.Add("62R", typeof(string));
            dt4.Columns.Add("36L", typeof(string));
            dt4.Columns.Add("38L", typeof(string));
            dt4.Columns.Add("40L", typeof(string));
            dt4.Columns.Add("42L", typeof(string));
            dt4.Columns.Add("44L", typeof(string));
            dt4.Columns.Add("46L", typeof(string));
            dt4.Columns.Add("48L", typeof(string));
            dt4.Columns.Add("50L", typeof(string));
            dt4.Columns.Add("52L", typeof(string));
            dt4.Columns.Add("54L", typeof(string));
            dt4.Columns.Add("56L", typeof(string));
            dt4.Columns.Add("58L", typeof(string));
            dt4.Columns.Add("60L", typeof(string));
            dt4.Columns.Add("62L", typeof(string));
            dt4.Columns.Add("34S", typeof(string));
            dt4.Columns.Add("36S", typeof(string));
            dt4.Columns.Add("38S", typeof(string));
            dt4.Columns.Add("40S", typeof(string));
            dt4.Columns.Add("42S", typeof(string));
            dt4.Columns.Add("44S", typeof(string));
            dt4.Columns.Add("46S", typeof(string));
            dt4.Columns.Add("Sub Total: ", typeof(string));
            dataGridView1.DataSource            = dt4;
            dataGridView1.Columns["Id"].Visible = false;
            //rowMergeView = new DataGridViewHelper(RGLJ);
            DataGridViewHelper rowMergeView = new DataGridViewHelper(dataGridView1);
            rowMergeView.Headers.Add(new DataGridViewHelper.TopHeader(1, 1, "LOT#"));
            //rowMergeView.Headers.Add(new DataGridViewHelper.TopHeader(0, 1, "LOT1#"));
            rowMergeView.Headers.Add(new DataGridViewHelper.TopHeader(2, 1, "STYLE"));
            rowMergeView.Headers.Add(new DataGridViewHelper.TopHeader(3, 1, "ART"));
            rowMergeView.Headers.Add(new DataGridViewHelper.TopHeader(4, 1, "COLOR"));
            rowMergeView.Headers.Add(new DataGridViewHelper.TopHeader(5, 1, "COLOR#"));
            rowMergeView.Headers.Add(new DataGridViewHelper.TopHeader(44, 1, "订单合计"));

            #endregion

            dataGridView1.CellValueChanged -= dataGridView1_CellValueChanged;
            txt_Style.Text = StyleId;
            txt_Label.Text = chima;
            txt_CaidanNo.SelectedIndexChanged -= txt_CaidanNo_SelectedIndexChanged;
            this.txt_desc.Text                 = cd[0].DESC.ToString();
            this.txt_fabric.Text               = cd[0].FABRIC.ToString();
            this.txt_jacket.Text               = cd[0].Jacket.ToString();
            this.txt_pant.Text                 = cd[0].Pant.ToString();
            this.txt_shuoming.Text             = cd[0].shuoming.ToString();
            dataGridView1.ColumnHeadersHeight  = 35;
            txt_CaidanNo.SelectedIndexChanged += txt_CaidanNo_SelectedIndexChanged;
            cb_jgc.DataSource    = jgc;
            cb_jgc.DisplayMember = "Name";
            cb_jgc.ValueMember   = "id";
            txt_zhidan.Text      = DateTime.Now.ToString();
            List <clsBuiness.CaiDan_RGLJ> caidan = new List <CaiDan_RGLJ>();
            if (!txt_CaidanNo.Equals(string.Empty))
            {
                caidan = gn2.selectCaiDanRGLJ("").GroupBy(g => g.CaiDanHao).Select(s => s.First()).ToList <clsBuiness.CaiDan_RGLJ>();
            }
            clsBuiness.CaiDan_RGLJ c = new clsBuiness.CaiDan_RGLJ()
            {
                CaiDanHao = ""
            };
            caidan.Add(c);
            txt_CaidanNo.DataSource    = caidan;
            txt_CaidanNo.DisplayMember = "CaiDanHao";
            txt_CaidanNo.ValueMember   = "id";
            if (txt_CaidanNo.FindString(" ") >= 0)
            {
                txt_CaidanNo.SelectedIndex = txt_CaidanNo.FindString(" ");
            }
            dataGridView1.CellValueChanged += dataGridView1_CellValueChanged;
            resizedava_cloumn(dataGridView1);//设置Dave 宽度
        }