private void button5_Click(object sender, EventArgs e) { View_arrivebill select_arrivebill = bsarrivebill.Current as View_arrivebill; ////MessageBox.Show(select_arrivebill.varrordercode); //MessageBox.Show(gridView1.RowCount.ToString()); //gridView1.GetRow(0); }
/// <summary> /// 勾兑火车物料到货单 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button1_Click(object sender, EventArgs e) { var view3 = gridView3; View_arrivebill bill = view3.GetFocusedRow() as View_arrivebill; if (bill == null) { MessageBox.Show("没有NC到货单!"); return; } if (MessageBox.Show("请确认勾选的是" + bill.custname + "的" + bill.invname, "提示", MessageBoxButtons.YesNo) == DialogResult.No) { return; } initTaskbill(); if (!checkMat()) { MessageBox.Show("请检查物料、到货单,必须是同一物料、同一到货单", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //QC_Sample_Veh train = view.GetRow(0) as QC_Sample_Veh; //var hc= train.CardID; //if (hcph != "" && hc != hcph) //{ // MessageBox.Show("请先取样:"+hcph); // return; //} foreach (var item in sample_unselect) { if (item.zp) { //状态 0 改变成1 item.SampleState = Xg.Lab.Sample.SampleState.开始组批; item.WpCode = "HYQY"; item.MatCode = bill.invcode; item.MatPK = bill.cbaseid; item.NcDhdHeadNo = bill.varrordercode; item.SupplierCode = bill.custcode; //取样人 item.FetchPerson = LocalInfo.Current.user.ID; //取样时间 item.FetchTime = DateTime.Now; } } sample_unselect.Save(); initview(); //gridControl1.DataSource = trainData; }
/// <summary> /// 如果有未打印的任务单,控制必须是同一种物料,同一个到货单 /// </summary> /// <param name="hcph"></param> /// <returns></returns> public bool checkMat() { var view = gridView1; if (view.RowCount < 1) { return(false); } QC_Sample_Veh train = view.GetRow(0) as QC_Sample_Veh; string hc = train.CardID; string mat = train.rwdh; string fz = train.zpdh; bool gouxuan = false; //gridcontrol列表内选择的是同一种物料 for (int i = 0; i < view.RowCount; i++) { if (view.IsGroupRow(i)) { continue; } var entity = view.GetRow(i) as QC_Sample_Veh; if (entity.rwdh != mat && entity.zp) { return(false); } if (entity.zp) { gouxuan = true; } } if (!gouxuan) { return(false); } //选择的发站不一致 if (fazhan != "" && fazhan != fz) { return(false); } ////选择的物料不一致 if (matname != "" && matname != mat) { return(false); } //判断是否是同一张到货单 if (ncdhd != "") { var viewdhd = gridView3; if (viewdhd.RowCount < 1) { return(false); } View_arrivebill dhd = viewdhd.GetFocusedRow() as View_arrivebill; if (ncdhd != dhd.varrordercode) { return(false); } } return(true); }
/// <summary> /// 重新勾兑 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void button6_Click_1(object sender, EventArgs e) { if (MessageBox.Show("确认要进行重新勾兑吗", "确认", MessageBoxButtons.YesNo) == DialogResult.No) { return; } if (hcph != "") { MessageBox.Show("请先打印已勾选的火车"); return; } if (cmbHCPH.Text.Trim() == "") { MessageBox.Show("请输入火车勾号"); return; } //else //{ // sample_unselect.LoadDataByWhere("wllx='火运' and cardid=@cardid order by begintime", cmbHCPH.Text.Trim()); //} //foreach (var item in sample_unselect) //{ // item.SampleState = Xg.Lab.Sample.SampleState.初始状态; // item.WpCode = ""; // item.MatCode = ""; // item.MatPK = ""; // item.NcDhdHeadNo = ""; // item.SupplierCode = ""; // //取样人 // item.FetchPerson = LocalInfo.Current.user.ID; // //取样时间 // item.FetchTime = DateTime.Now; // item.zp = false; //} //sample_unselect.Save(); //bstrain.DataSource = sample_unselect; if (!checkMat()) { MessageBox.Show("请检查物料、到货单,必须是同一物料、同一到货单"); return; } var view3 = gridView3; View_arrivebill bill = view3.GetFocusedRow() as View_arrivebill; if (bill == null) { MessageBox.Show("没有NC到货单!"); return; } foreach (var item in sample_unselect) { if (item.zp) { //item.SampleState = Xg.Lab.Sample.SampleState.开始组批; //item.WpCode = "HYQY"; item.MatCode = bill.invcode; item.MatPK = bill.cbaseid; item.NcDhdHeadNo = bill.varrordercode; item.SupplierCode = bill.custcode; //取样人 item.FetchPerson = item.FetchPerson + "~~" + LocalInfo.Current.user.ID; //取样时间 item.FetchTime = DateTime.Now; } } sample_unselect.Save(); DbEntityTable <QC_Sample_Mix> dbmix = new DbEntityTable <QC_Sample_Mix>(); dbmix.LoadDataByWhere("main.sample_mix_id in ( select distinct(sample_mix_id) from qc_sample_veh where cardid='" + cmbHCPH.Text.Trim() + "')"); foreach (var item in dbmix) { //item.SampleState = SampleState.处理完成; item.MatCode = bill.invcode; item.MatPK = bill.cbaseid; item.SupplierCode = bill.custcode; } dbmix.Save(); initview(); MessageBox.Show("操作成功!"); }