//新建按钮 private void button1_Click(object sender, EventArgs e) { SetTextNull(); lblgh.txt.Text = LiuShuiHao(); pictureBox1.Image = UserProc.GetBarcode(this.pictureBox1.Height, this.pictureBox1.Width, TYPE.CODE128, this.lblgh.txt.Text); this.pictureBox1.Tag = (object)this.lblgh.txt.Text; show_ReadOnly = false; ref_txt(); btnExe.Text = "保存"; }
private void btnNewNow_Click(object sender, EventArgs e) { this.show_ReadOnly = false; this.ref_txt(); lblgh.txt.Text = LiuShuiHao(); pictureBox1.Image = UserProc.GetBarcode(this.pictureBox1.Height, this.pictureBox1.Width, TYPE.CODE128, this.lblgh.txt.Text); this.pictureBox1.Tag = (object)this.lblgh.txt.Text; dateTimePicker1.Value = DateTime.Now.AddSeconds((double)(-(double)DateTime.Now.Second)); //txtRiqijiaohuo.dtime.Value = DateTime.Today.AddDays(1.0); //txtKahao.txt.Focus(); btnExe.Text = "保存"; }
private bool showLD() { this.emptyLDmain(); this.emptyLDdata(); this.editBtnPrn.Enabled = false; if (this.showLDH == "") { return(false); } DataTable dataTable1 = new DataTable(); DataTable dataTable2 = new DataTable(); //using (SqlConnection sqlConnection = new SqlConnection(Settings.Default.DBconn)) { //sqlConnection.Open(); //SqlCommand command = sqlConnection.CreateCommand(); //command.CommandTimeout = 300; string CommandText = "select * from T_PFmain where danhao = '" + this.showLDH + "'"; dataTable1 = db.Ado.GetDataTable(CommandText); if (dataTable1.Rows.Count != 1) { //sqlDataReader1.Close(); //sqlDataReader1.Dispose(); //command.Dispose(); dataTable1.Dispose(); dataTable2.Dispose(); int num = (int)MessageBox.Show((IWin32Window)this, "无法找到此料单主数据!!!", "提示"); return(false); } string sql = ""; if (this.showLDH.StartsWith("LD") || this.showLDH.StartsWith("8") && this.showLDH.Length == 10) { this.editLblShowLB.Text = "配方单成本"; this.editColJL.Visible = false; this.editColJLYL.Visible = false; this.editColJLDW.Visible = false; sql = "select a.*,danjia=cast(b.item1 as money),jine=case when a.yongliangDW in('g','mL') then cast(cast(b.item1 as money)*a.yongliang/1000 as decimal(10,2)) else cast(cast(b.item1 as money)*a.yongliang as decimal(10,2)) end from T_PFdata a left join T_Base b on a.ranliao = b.item0 and (b.leibie = '染料名称' or b.leibie = '助剂名称') and a.yongliang > 0 where a.danhao = '" + dataTable1.Rows[0].Field <string>("danhao") + "' order by a.SN"; } else { this.editLblShowLB.Text = "加料单成本"; this.editColJL.Visible = true; this.editColJLYL.Visible = true; this.editColJLDW.Visible = true; sql = "select a.*,danjia=cast(b.item1 as money),jine=case when a.JLyongliangDW in('g','mL') then cast(cast(b.item1 as money)*a.JLyongliang/1000 as decimal(10,2)) else cast(cast(b.item1 as money)*a.JLyongliang as decimal(10,2)) end from T_PFdata a left join T_Base b on a.ranliao = b.item0 and (b.leibie = '染料名称' or b.leibie = '助剂名称') and a.JLyongliang > 0 where a.danhao = '" + dataTable1.Rows[0].Field <string>("danhao") + "' order by a.SN"; } //SqlDataReader sqlDataReader2 = command.ExecuteReader(); dataTable2 = db.Ado.GetDataTable(sql); //sqlDataReader2.Close(); ///sqlDataReader2.Dispose(); //command.Dispose(); } if (dataTable2.Rows.Count == 0) { dataTable1.Dispose(); dataTable2.Dispose(); int num = (int)MessageBox.Show((IWin32Window)this, "无法找到此料单行数据!!!", "提示"); return(false); } this.editImgLDH.Image = this.showLDH.Length != 11 || !this.showLDH.StartsWith("8") ? UserProc.GetBarcode(this.editImgLDH.Height, this.editImgLDH.Width, TYPE.CODE128, this.showLDH) : UserProc.GetBarcode(this.editImgLDH.Height, this.editImgLDH.Width * 62 / 100, TYPE.CODE128, this.showLDH); this.editImgLDH.Tag = (object)this.showLDH; this.editTxtKH.txt.Text = dataTable1.Rows[0].Field <string>("kehu"); this.editTxtSZ.txt.Text = dataTable1.Rows[0].Field <string>("shazhong"); this.editTxtSH.txt.Text = dataTable1.Rows[0].Field <string>("sehao"); this.editTxtYS.txt.Text = dataTable1.Rows[0].Field <string>("yanse"); this.editTxtDDH.txt.Text = dataTable1.Rows[0].Field <string>("dingdan"); this.editTxtDY.txt.Text = dataTable1.Rows[0].Field <string>("dayang"); this.editTxtZC.txt.Text = dataTable1.Rows[0].Field <string>("zhuche"); this.editTxtDJ.txt.Text = dataTable1.Rows[0].Field <Decimal>("danjia").ToString("0.###;-0.###;\"\""); TextBox txt1 = this.editTxtKZ.txt; //Decimal num1 = dataTable1.Rows[0].Field<Decimal>("kezhong"); //string str1 = num1.ToString("0.###;-0.###;\"\""); string str1 = dataTable1.Rows[0].Field <string>("kezhong"); txt1.Text = str1; TextBox txt2 = this.editTxtMS.txt; Decimal num1 = dataTable1.Rows[0].Field <Decimal>("mishu"); string str2 = num1.ToString("0.###;-0.###;\"\""); txt2.Text = str2; this.editTxtJH.txt.Text = dataTable1.Rows[0].Field <string>("jihao"); TextBox txt3 = this.editTxtSL.txt; num1 = dataTable1.Rows[0].Field <Decimal>("shuiliang"); string str3 = num1.ToString("0.####;-0.####;\"\""); txt3.Text = str3; TextBox txt4 = this.editTxtZL.txt; num1 = dataTable1.Rows[0].Field <Decimal>("zhongliang"); string str4 = num1.ToString("0.####;-0.####;\"\""); txt4.Text = str4; this.editTxtBZ.txt.Text = dataTable1.Rows[0].Field <string>("beizhu"); this.editTxtJLCS.txt.Text = dataTable1.Rows[0].Field <int>("JLciHJ").ToString("0"); for (int index = 0; index < dataTable2.Rows.Count; ++index) { this.editDgvMain.Rows.Add(); DataGridViewRow row = this.editDgvMain.Rows[this.editDgvMain.RowCount - 1]; row.Cells[this.editColSN.Name].Value = (object)dataTable2.Rows[index].Field <long>("SN"); row.Cells[this.editColGX.Name].Value = (object)dataTable2.Rows[index].Field <string>("gongxu"); row.Cells[this.editColRL.Name].Value = (object)dataTable2.Rows[index].Field <string>("ranliao"); row.Cells[this.editColBL.Name].Value = (object)dataTable2.Rows[index].Field <Decimal>("bili"); row.Cells[this.editColBLDW.Name].Value = (object)dataTable2.Rows[index].Field <string>("biliDW"); row.Cells[this.editColYL.Name].Value = (object)dataTable2.Rows[index].Field <Decimal>("yongliang"); row.Cells[this.editColYLDW.Name].Value = (object)dataTable2.Rows[index].Field <string>("yongliangDW"); row.Cells[this.editColGY.Name].Value = (object)dataTable2.Rows[index].Field <string>("yaoqiu"); row.Cells[this.editColJL.Name].Value = (object)dataTable2.Rows[index].Field <Decimal>("JLbili"); row.Cells[this.editColJLYL.Name].Value = (object)dataTable2.Rows[index].Field <Decimal>("JLyongliang"); row.Cells[this.editColJLDW.Name].Value = (object)dataTable2.Rows[index].Field <string>("JLyongliangDW"); row.Cells[this.editColSNld.Name].Value = (object)dataTable2.Rows[index].Field <long>("SNld"); row.Cells[this.editColDJ.Name].Value = (object)dataTable2.Rows[index].Field <Decimal?>("danjia"); row.Cells[this.editColJE.Name].Value = (object)dataTable2.Rows[index].Field <Decimal?>("jine"); } this.editDgvMain.HeJi(); this.editBtnPrn.Enabled = true; this.bsShowMain.DataSource = (object)dataTable1; this.bsShowData.DataSource = (object)dataTable2; dataTable1.Dispose(); dataTable2.Dispose(); return(true); }
public void SetData(Object o) { if (db == null) { return; } if ((long)o == -1L) { return; } getByWhere = db.Queryable <LCKA>().Where(it => it.SN == (long)o).ToList(); if (getByWhere.Count != 1) { MessageBoxEx.Show("参数错误,请检查"); return; } SN = (long)o; //客户, dateTimePicker1.Value = getByWhere[0].riqiZhidan; lblgh.txt.Text = getByWhere[0].liushuihao; txtKehu.cobodgv.Text = getByWhere[0].kehu; txtPinming.cobodgv.Text = getByWhere[0].peiming; txtSebie.cobodgv.Text = getByWhere[0].sebie; lblSH.cobodgv.Text = getByWhere[0].sehao; lblFUK.txt.Text = getByWhere[0].fukuan; lblKZ.txt.Text = getByWhere[0].kezhong; lblpishu.txt.Text = getByWhere[0].peishu; lblzhongliang.txt.Text = getByWhere[0].zhongliang; lblCW.cobodgv.Text = getByWhere[0].cangwei; lblZgs.txt.Text = getByWhere[0].zonggangshu; lblZps.txt.Text = getByWhere[0].zongpishu; lbDaih.txt.Text = getByWhere[0].daihao; lblDDH.txt.Text = getByWhere[0].dingdanhao; lblShouGan.txt.Text = getByWhere[0].shougan; lblSsl.txt.Text = getByWhere[0].suoshuilv; lblSld.txt.Text = getByWhere[0].selaodu; lblMC.txt.Text = getByWhere[0].michang; lblYWY.cobodgv.Text = getByWhere[0].yewuyuan; lblTS.txt.Text = getByWhere[0].taose; txtLiuchen.cobodgv.Text = getByWhere[0].shengchanlc; sclcgx.txt.Text = getByWhere[0].shengchangongxu; lblJGYQ.txt.Text = getByWhere[0].jiagongyaoqiu; lblBZ.txt.Text = getByWhere[0].beizhu; lblJH.cobodgv.Text = getByWhere[0].jihao; lblRSGY.txt.Text = getByWhere[0].ransegongyi; lblDXGY.txt.Text = getByWhere[0].dingxinggongyi; lblBZGY.txt.Text = getByWhere[0].baozhuanggongyi; lblMZ.txt.Text = getByWhere[0].mizhong; pictureBox1.Image = UserProc.GetBarcode(this.pictureBox1.Height, this.pictureBox1.Width, TYPE.CODE128, this.lblgh.txt.Text); this.pictureBox1.Tag = (object)this.lblgh.txt.Text; btnNewNow.Enabled = true; btnEdit.Enabled = true; btnDel.Enabled = true; btnPrn.Enabled = true; }
private void setPict(string code) { editImgLDH.Image = UserProc.GetBarcode(this.editImgLDH.Height, this.editImgLDH.Width, TYPE.CODE128, code); editImgLDH.Tag = (object)code; }