private void InitValue(LCKA lcka, int index, BaseIList baseIList) { if (index == 1) { lblDanh.txt.Text = baseIList.dingdanhao; // lblYWY.cobodgv.Text = baseIList.item0; // lblCW.cobodgv.Text = baseIList.item1; lblPIH.txt.Text = baseIList.item2; lblBZ1.txt.Text = baseIList.item3; lblTxt1.cobodgv.Text = baseIList.pingmin; lblTxt2.cobodgv.Text = baseIList.seming; lblZPS.cobodgv.Text = baseIList.sehao; lblPS.txt.Text = baseIList.pishu; lblZZ.txt.Text = baseIList.zongliang; lblKH.cobodgv.Text = baseIList.kehu; riqi.Value = baseIList.riqi; } else { riqi.Value = DateTime.Now; //lblDanh.txt.Text = lcka.dingdanhao; //lblYWY.cobodgv.Text = lcka.item0; //lblCW.cobodgv.Text = lcka.item1; //lblPIH.txt.Text = lcka.item2; //lblBZ1.txt.Text = lcka.item3; lblTxt1.cobodgv.Text = lcka.peiming; lblTxt2.cobodgv.Text = lcka.sebie; lblZPS.cobodgv.Text = lcka.sehao; lblPS.txt.Text = lcka.peishu; lblZZ.txt.Text = lcka.zhongliang; lblKH.cobodgv.Text = lcka.kehu; //lblPS.txt.Text = lcka.; } }
private string LiuShuiHao() { string lsh; string yy = DateTime.Now.ToString("yy"); string nian = yy.Substring(1) + DateTime.Now.ToString("MM") + DateTime.Now.ToString("dd"); LCKA result = db.Queryable <LCKA>() .OrderBy(it => it.SN, OrderByType.Desc) .First(); if (result == null) { lsh = nian + "001"; return(lsh); } string liushuihao = result.liushuihao; if (liushuihao.IndexOf(nian) == -1) { liushuihao = "001"; } else { string liushuihao1 = liushuihao.Substring(5); int a = int.Parse(liushuihao1) + 1; liushuihao = a.ToString("000"); } lsh = nian + liushuihao; return(lsh); }
private bool del_data() { bool flag = false; try { LCKA result = db.Queryable <LCKA>() .Where(it => it.SN == SN) .First(); if (result == null) { MessageBox.Show(this, "该行已不存在!请核对!", "提示"); flag = false; } else { int a = db.Deleteable <LCKA>().Where(it => it.SN == result.SN).ExecuteCommand(); db.Deleteable <LCMX>().Where(it => it.SNka == result.SN).ExecuteCommand(); flag = true; } } catch (Exception ex) { flag = false; MessageBox.Show(this, ex.Message + "\r\n\r\n 删除失败,请再试一次!", "提示"); } return(flag); }
private void Initgrid(Tuple <List <LCKA>, List <CP_TABLE> > getAll) { dataGridViewX1.Rows.Clear(); if (getAll == null) { return; } for (int i = 0; i < getAll.Item1.Count; i++) { int index = dataGridViewX1.Rows.Add(); LCKA dataRowCollection = getAll.Item1[i]; CP_TABLE cp_table = getAll.Item2[i]; dataGridViewX1.Rows[index].Tag = dataRowCollection.SN; dataGridViewX1.Rows[index].Cells[0].Value = dataRowCollection.liushuihao; dataGridViewX1.Rows[index].Cells[1].Value = dataRowCollection.kehu; dataGridViewX1.Rows[index].Cells[2].Value = dataRowCollection.peiming; dataGridViewX1.Rows[index].Cells[3].Value = dataRowCollection.peishu; dataGridViewX1.Rows[index].Cells[4].Value = dataRowCollection.daihao; dataGridViewX1.Rows[index].Cells[5].Value = dataRowCollection.sebie; dataGridViewX1.Rows[index].Cells[6].Value = dataRowCollection.sehao; dataGridViewX1.Rows[index].Cells[7].Value = dataRowCollection.fukuan; dataGridViewX1.Rows[index].Cells[8].Value = dataRowCollection.kezhong; dataGridViewX1.Rows[index].Cells[9].Value = dataRowCollection.cangwei; dataGridViewX1.Rows[index].Cells[10].Value = dataRowCollection.zonggangshu; dataGridViewX1.Rows[index].Cells[11].Value = dataRowCollection.riqiZhidan; dataGridViewX1.Rows[index].Cells[12].Value = dataRowCollection.zhongliang.Trim(); dataGridViewX1.Rows[index].Cells[13].Value = cp_table.status; } dataGridViewX1.HeJi(); }
private void InitValue(LCKA asdf, int index, BaseIList baseIList) { if (index == 1) { lblDanh.txt.Text = asdf.liushuihao; lblPIH.txt.Text = baseIList.item0; lblBZ1.txt.Text = baseIList.item3; } riqi.Value = DateTime.Now; lblTxt1.cobodgv.Text = asdf.peiming; lblTxt2.cobodgv.Text = asdf.sebie; lblZPS.cobodgv.Text = asdf.sehao; lblPS.txt.Text = asdf.peishu; lblZZ.txt.Text = asdf.zhongliang; }
private void btnNext_Click(object sender, EventArgs e) { LCKA dn = this.Get_dn(); if (dn == null) { MessageBox.Show(this, "已是最后一张流程卡!", "提示"); } else { SN = dn.SN; SetData(SN); btnNewNow.Enabled = true; btnEdit.Enabled = true; btnDel.Enabled = true; btnPrn.Enabled = true; } }
private void btnPrev_Click(object sender, EventArgs e) { LCKA up = this.Get_up(); if (up == null) { MessageBox.Show(this, "已是第一张流程卡!", "提示"); } else { SN = up.SN; SetData(SN); btnNewNow.Enabled = true; btnEdit.Enabled = true; btnDel.Enabled = true; btnPrn.Enabled = true; } }
private void button5_Click(object sender, EventArgs e) { LCKA lcka = getByWhere[0]; UserProc.WaitStart(this); string asd = lcka.riqiZhidan.ToString("yy-MM-dd HH:mm"); //asd = asd.Replace("月", "-").Replace("日", ""); Console.WriteLine("-------------" + asd); List <LCKA> list = new List <LCKA>(); if (lcka == null) { MessageBox.Show(this, "该流程卡已不存在!请核对!", "提示"); UserProc.WaitEnd(this); } else { var asdfg = db.Queryable <BaseIList>() .Where(it => it.leibie == "产量登记" && it.item1 == "开卡" && it.dingdanhao == lcka.liushuihao) .First(); if (asdfg == null) { var sd = new BaseIList() { leibie = "产量登记", dingdanhao = lcka.liushuihao, pingmin = lcka.peiming, seming = lcka.sebie, sehao = lcka.sehao, item0 = ClsLogUser.XinMing, //操作人员 pishu = lcka.peishu, item1 = "开卡", //工序 zongliang = lcka.zhongliang, item2 = "0%", //百分比 riqi = DateTime.Now, item3 = "开卡", kehu = lcka.kehu, }; db.Insertable <BaseIList>(sd).ExecuteCommand(); } list.Add(lcka); /* * if (lcka.zonggangshu == "" || !UserProc.IsInt(lcka.zonggangshu)) * { * list.Add(lcka); * } * else * { * int num = Convert.ToInt32(lcka.zonggangshu); * for (int i = 0; i < num; i++) * { * LCKA asd1 = new LCKA(); * asd1 = TransExpV2<LCKA, LCKA>.Trans(lcka); * asd1.liushuihao = string.Format("{0}", (int.Parse(lcka.liushuihao) + i)); * list.Add(asd1); * } * } */ FrmPrn frmPrn = new FrmPrn(); frmPrn.rptView.LocalReport.ReportEmbeddedResource = "DotNetBarProject.view.Report2.rdlc"; string filename = Application.StartupPath + "\\imgLCK.Bmp"; pictureBox1.Image.Save(filename, ImageFormat.Bmp); string str = "file:///" + filename.Replace("\\", "/"); frmPrn.rptView.LocalReport.EnableExternalImages = true; ReportParameter reportParameter1 = new ReportParameter("LDH", str); ReportParameter parameters = new ReportParameter("p1", sclcgx.txt.Text); ReportParameter parameters1 = new ReportParameter("riqi", asd); string[] array = new string[30]; var asde = db.Queryable <LCMX>().Where(it => it.SNka == lcka.SN).ToList(); //string[] asdf = sclcgx.txt.Text.Split("->".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < asde.Count; i++) { array[i] = asde[i].gongxu; } for (int i = asde.Count; i < 30; i++) { array[i] = ""; } ReportParameter parameters2 = new ReportParameter("p2", array); //BindingSource asdfds = new BindingSource(); //asdfds.DataSource = asde; //ReportDataSource reportDataSource1 = new ReportDataSource(); //reportDataSource1.Name = "lblcmx"; //reportDataSource1.Value = asdfds; frmPrn.rptView.LocalReport.SetParameters(parameters); frmPrn.rptView.LocalReport.SetParameters(parameters1); frmPrn.rptView.LocalReport.SetParameters(reportParameter1); frmPrn.rptView.LocalReport.SetParameters(parameters2); frmPrn.rptView.LocalReport.DataSources.Clear(); ReportDataSource reportDataSource = new ReportDataSource(); reportDataSource.Name = "DataSet1"; reportDataSource.Value = list; frmPrn.rptView.LocalReport.DataSources.Clear(); frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource); //frmPrn.rptView.LocalReport.DataSources.Add(reportDataSource1); var a = frmPrn.rptView.LocalReport.DataSources; frmPrn.rptView.RefreshReport(); frmPrn.ShowDialog(); frmPrn.Close(); UserProc.WaitEnd(this); } }
private bool edit_data() { bool result1; LCKA result = null; result = db.Queryable <LCKA>() .Where(it => it.SN == SN) .OrderBy(it => it.SN, OrderByType.Desc) .First(); if (result == null) { MessageBox.Show(this, "该行已不存在!请核对!", "提示"); result1 = false; } else { result.liushuihao = lblgh.txt.Text; result.kehu = txtKehu.cobodgv.Text; result.peiming = txtPinming.cobodgv.Text; result.sebie = txtSebie.cobodgv.Text; result.sehao = lblSH.cobodgv.Text; result.fukuan = lblFUK.txt.Text; result.kezhong = lblKZ.txt.Text; result.peishu = lblpishu.txt.Text; result.zhongliang = lblzhongliang.txt.Text; result.cangwei = lblCW.cobodgv.Text; result.zonggangshu = lblZgs.txt.Text; result.zongpishu = lblZps.txt.Text; result.daihao = lbDaih.txt.Text; result.dingdanhao = lblDDH.txt.Text; result.shougan = lblShouGan.txt.Text; result.suoshuilv = lblSsl.txt.Text; result.selaodu = lblSld.txt.Text; result.michang = lblMC.txt.Text; result.yewuyuan = lblYWY.cobodgv.Text; result.taose = lblTS.txt.Text; result.shengchanlc = txtLiuchen.cobodgv.Text; result.shengchangongxu = sclcgx.txt.Text; result.jiagongyaoqiu = lblJGYQ.txt.Text; result.beizhu = lblBZ.txt.Text; result.jihao = lblJH.cobodgv.Text; result.ransegongyi = lblRSGY.txt.Text; result.dingxinggongyi = lblDXGY.txt.Text; result.baozhuanggongyi = lblBZGY.txt.Text; result.mizhong = lblMZ.txt.Text; //}; try { var t2 = db.Updateable <LCKA>(result).ExecuteCommand(); db.Deleteable <LCMX>().Where(it => it.SNka == result.SN).ExecuteCommand(); string[] array = sclcgx.txt.Text.Split("->".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { var insertObj1 = new LCMX { SNka = result.SN, gongxu = array[i], riqi = dateTimePicker1.Value, }; db.Insertable <LCMX>(insertObj1).ExecuteCommand(); } result1 = true; } catch (Exception ex) { MessageBoxEx.Show(ex.Message); result1 = false; } } return(result1); }
private int save_data() { var insertObj = new LCKA() { riqiZhidan = dateTimePicker1.Value, liushuihao = lblgh.txt.Text, kehu = txtKehu.cobodgv.Text, peiming = txtPinming.cobodgv.Text, sebie = txtSebie.cobodgv.Text, sehao = lblSH.cobodgv.Text, fukuan = lblFUK.txt.Text, kezhong = lblKZ.txt.Text, peishu = lblpishu.txt.Text, zhongliang = lblzhongliang.txt.Text, cangwei = lblCW.cobodgv.Text, zonggangshu = lblZgs.txt.Text, zongpishu = lblZps.txt.Text, daihao = lbDaih.txt.Text, dingdanhao = lblDDH.txt.Text, shougan = lblShouGan.txt.Text, suoshuilv = lblSsl.txt.Text, selaodu = lblSld.txt.Text, michang = lblMC.txt.Text, yewuyuan = lblYWY.cobodgv.Text, taose = lblTS.txt.Text, shengchanlc = txtLiuchen.cobodgv.Text, shengchangongxu = sclcgx.txt.Text, jiagongyaoqiu = lblJGYQ.txt.Text, beizhu = lblBZ.txt.Text, jihao = lblJH.cobodgv.Text, ransegongyi = lblRSGY.txt.Text, dingxinggongyi = lblDXGY.txt.Text, baozhuanggongyi = lblBZGY.txt.Text, mizhong = lblMZ.txt.Text, }; try { var t2 = db.Insertable <LCKA>(insertObj).ExecuteReturnIdentity(); string[] array = sclcgx.txt.Text.Split(new string[] { "->" }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { var insertObj1 = new LCMX { SNka = t2, gongxu = array[i], riqi = dateTimePicker1.Value, }; db.Insertable <LCMX>(insertObj1).ExecuteCommand(); } return(t2); } catch (Exception ex) { MessageBoxEx.Show(ex.Message); return(-1); } }