/// <summary> /// 抓图并保存 /// </summary> private void GraspAndSaveImage() { m_MainThreadCapPicture = new CapPicture(MainThreadCapPicture); Invoke(m_MainThreadCapPicture); //用委托抓图 }
private void button17_Click(object sender, EventArgs e) { if (strPoint == "") { MessageBox.Show("请先选择计量点!"); return; } if (cbJLLX.Enabled == true && cbJLLX.Text.Trim() == "复磅") { MessageBox.Show("“复磅”不能选择,请重新选择计量类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txtJLD.Text == "") { MessageBox.Show("请选择磅房信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtJLD.Focus(); return; } if (cbCH.Text == "") { MessageBox.Show("车号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cbCH.Focus(); return; } if (cbCH1.Text == "") { MessageBox.Show("车号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cbCH1.Focus(); return; } //sDDH = txtHTH.Text.Trim(); //if (txtLH.Text != "" && sDDH == "") //{ // MessageBox.Show("该炉号没有对应的合同号!"); // //return; //} if (txtZS.Text == "" && txtLH.Text.Trim().Length == 9) { MessageBox.Show("请录入支数!"); return; } //if (txtLH.Text == "" && txtLH2.Text != "" || txtLH3.Text != "") //{ // MessageBox.Show("请把炉号录入第一个输入框!"); // txtLH.Focus(); // return; //} if (cbJLLX.Enabled == true && cbJLLX.Text.Trim() == "复磅") { MessageBox.Show("“复磅”不能选择,请重新选择计量类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (ControlProve() == false) { return; } if (txtLH.Text.Trim().Length > 0 && strYCJL == "1" && txtZS.Text.Trim().Length == 0) { MessageBox.Show("请输入支数或块数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtZS.Focus(); return; } if (txtLH2.Text.Trim().Length > 0 && strYCJL == "1" && txtZS2.Text.Trim().Length == 0) { MessageBox.Show("请输入支数或块数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtZS2.Focus(); return; } if (txtLH3.Text.Trim().Length > 0 && strYCJL == "1" && txtZS3.Text.Trim().Length == 0) { MessageBox.Show("请输入支数或块数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtZS3.Focus(); return; } this.Cursor = Cursors.WaitCursor; strBCSJ = "1"; printInfoClear(); strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; //print.printCZH = txtCZH.Text.Trim(); print.printCH = cbCH.Text.Trim() + cbCH1.Text.Trim(); print.printHTH = txtHTH.Text.Trim(); print.printWLMC = cbWLMC.Text.Trim(); print.printFHDW = cbFHDW.Text.Trim(); print.printSHDW = cbSHDW.Text.Trim(); print.printCYDW = cbCYDW.Text.Trim(); print.printJLLX = cbJLLX.Text.Trim(); print.printJLD = txtJLD.Text.Trim(); print.printJLY = txtJLY.Text.Trim(); //add by luobin print.printYKL = txtYKL.Text.Trim(); print.printYKBL = s_YKBL; //print.pringJLCS = strYCJL; print.printLH = txtLH.Text.Trim(); print.printZS = txtZS.Text.Trim(); print.printGZ = GZ; print.printGG = GG; print.printLH1 = txtLH.Text.Trim(); print.printZS1 = txtZS.Text.Trim(); print.printLH2 = txtLH2.Text.Trim(); print.printZS2 = txtZS2.Text.Trim(); print.printLH3 = txtLH3.Text.Trim(); print.printZS3 = txtZS3.Text.Trim(); print.printAdviseSpec = this.strAdviseSpec; print.printZZJY = this.strZZJY; //if (strYCJL == "") //{ // if (chbQXPZ.Checked == false) // { // QueryQXPZData(); // } //} if (strYCJL != "" || strQXPZ != "") { if (txtLH.Text.Trim().Length != 0 ) { //if (SaveGPData() == false) if (SaveFPHistory() == false) { this.Cursor = Cursors.Default; strBCSJ = "0"; return; } } } else { if (AddYCJLData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } if (cbCH.SelectedIndex < 0) { this.DownLoadCarNo(); } if (strYCJL == "") { DisPlayShowForFirst(); } if (strYCJL == "1") { DisPlayShowForSecond(); } m_MainThreadCapPicture = new CapPicture(MainThreadCapPicture); Invoke(m_MainThreadCapPicture); //用委托抓图 //打印磅单 //Print(); //查询一次计量表 m_BindUltraGridDelegate = new BindUltraGridDelegate(QueryYCBData); BeginInvoke(m_BindUltraGridDelegate); dtQX.Rows.Clear(); dtQX.Columns.Clear(); ultraChart1.DataSource = dataTable6; ksht = 1; ClearControlData(); ClearControl(); ClearQXPZData(); if (strYB == "1") { ClearYBData(); } //曲线图表刷新 if (m_nPointCount > 0) { for (int i = 0; i < m_nPointCount; i++) { if (m_PoundRoomArray[i].POINTNAME.Trim() == ultraGrid2.ActiveRow.Cells["FS_POINTNAME"].Value.ToString().Trim()) { dtQX.Rows.Clear(); dtQX.Columns.Clear(); ultraChart1.DataSource = dataTable6; BackZeroSign[i] = 1; //BackZeroSign = 1,意思就是车子在上称过程中如出现重量多次稳定,可以继续绘图;如是下称,则不准再画。 } } } ifStart = "0";//保存后重新恢复启动 cbJLLX.Enabled = true; //strZYBH = ""; //清除Guid //if (chb_Autocontrol.Checked == true) //{ // if (m_PoundRoomArray[m_iSelectedPound].POINTID == "K01" || m_PoundRoomArray[m_iSelectedPound].POINTID == "K02") // m_PoundRoomArray[m_iSelectedPound].SendRtuCommand((byte)1, (byte)5, (byte)0x50, (byte)(0xE0 - 1), (byte)0x00, (byte)0); //} m_PoundRoomArray[m_iSelectedPound].ClearCardNoAndGuid(); m_PoundRoomArray[m_iSelectedPound].CardNo = ""; m_PoundRoomArray[m_iSelectedPound].ReaderGUID = ""; txtZL.Text = ""; if (strYCJL == "1") { ClearYCBData(); } //pictureBox18.Image = BitmapToImage(new byte[1]); //pictureBox18.Refresh(); //panel20.Visible = false; //panel22.BringToFront(); btnGPBC.Enabled = false; strBCSJ = "0"; #region 自动播放语音 m_AlarmVoicePath = Constant.RunPath + "\\sound\\称重完成.wav"; WriteLog("准备语音播放..."); #endregion this.Cursor = Cursors.Default; }
private void btnBC_Click(object sender, EventArgs e) { //�ֶμ�� if (!CheckInPut()) { return; } if (DialogResult.No == MessageBox.Show("�Ƿ����ݣ�������ǡ����������������ݣ�������������������ݣ�", "��ʾ", MessageBoxButtons.YesNo, MessageBoxIcon.Information)) { return; } if (!ifExistFirstWeight)//���һ�α���û������� { if (bSglr && txtWeight.Text != "" && txtTareWeight.Text == "") { bSave=saveDataForSglr("first"); bFirst = true; } else if (!bSglr&&txtWeight.Text != "" && txtTareWeight.Text == "") { bSave = saveData("first");//����һ������ bFirst = true; } else if (bSglr && txtWeight.Text != "" && txtTareWeight.Text != "") { bSave=saveDataForSglr(); bFirst = false; } } else//���һ�α��������Ӧ�ŵ����ݣ����ڶ��α��в�������������¼��ɾ��һ�α��м�¼ { { bSave = saveData();//����������� bFirst = false; } } queryHistoryDataByDate(); queryFirstDataByAll(); if (bSave) { //�洢ͼƬ��Ϣ m_MainThreadCapPicture = new CapPicture(MainThreadCapPicture); Invoke(m_MainThreadCapPicture); //��ί��ץͼ bSave = false; txtWeight.ReadOnly = true; txtWeight.BackColor = Color.Bisque; } //m_AlarmVoicePath = Constant.RunPath + "\\sound\\ProductComplete.wav"; //AutoAlarmVoice(); initCommpent(); }
private void button16_Click(object sender, EventArgs e) { try { if (strPoint == "") { MessageBox.Show("请选择计量点!"); return; } if (cbJLLX.Enabled == true && cbJLLX.Text.Trim() == "复磅") { MessageBox.Show("“复磅”不能选择,请重新选择计量类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (cbJLLX.Text.Trim() != "外协") { if (ControlProve() == false) { return; } } else { if (txtJLD.Text == "") { MessageBox.Show("请选择磅房信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtJLD.Focus(); return; } if (cbCH.Text == "") { MessageBox.Show("车号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cbCH.Focus(); return; } if (cbCH1.Text == "") { MessageBox.Show("车号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cbCH1.Focus(); return; } } //判断是否取样、卸货与验收 if (strYCJL == "1" && cbJLLX.Text == "") { //卸货 //if (stSHKCD == "1") // { if (strXCQR != "1") { if (DialogResult.No == MessageBox.Show("卡号:" + txtCZH.Text.Trim() + "车号:" + cbCH.Text.Trim() + cbCH1.Text.Trim() + "未卸货!,是否继续保存", "保存提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) //MessageBox.Show("该车还未卸货,是否允许过磅!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } //} } if (ifStart == "1") { if (txtLH.Text.Trim() != "" && sDDH == "") { MessageBox.Show("请先查询炉号对应的合同号!"); return; } if (txtLH.Text.Trim() != "" && sDDH != "" && txtZS.Text.Trim() == "") { MessageBox.Show("请录入炉号对应的支数!"); txtZS.Focus(); return; } if (txtLH.Text.Trim() == "" && txtLH2.Text.Trim() != "" || txtLH3.Text.Trim() != "") { MessageBox.Show("请把炉号录入相应的位置!"); txtLH.Focus(); return; } } if (strPoint == "") { MessageBox.Show("请双击选择计量点接管信息,接管计量点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.Cursor = Cursors.WaitCursor; strBCSJ = "1"; //在保存时不需要计算净重,防止保存时系统自动退出 printInfoClear(); strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; //print.printCZH = txtCZH.Text.Trim(); print.printCH = cbCH.Text.Trim() + cbCH1.Text.Trim(); print.printHTH = txtHTH.Text.Trim(); print.printWLMC = cbWLMC.Text.Trim(); print.printFHDW = cbFHDW.Text.Trim(); print.printSHDW = cbSHDW.Text.Trim(); print.printCYDW = cbCYDW.Text.Trim(); print.printJLLX = cbJLLX.Text.Trim(); print.printJLD = txtJLD.Text.Trim(); print.printJLY = txtJLY.Text.Trim(); //add by luobin print.printYKL = txtYKL.Text.Trim(); print.printYKBL = s_YKBL; print.printAdviseSpec = this.strAdviseSpec; print.printZZJY = this.strZZJY; //print.pringJLCS = strYCJL; WriteLog("1"); if (e_REWEIGHTFLAG == "1")//二次计量复磅标志(期限皮重时用) { if (UpdateECJLBData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } WriteLog("2"); if (e_REWEIGHTFLAG != "1") { //if (strYCJL == "") //{ // if (chbQXPZ.Checked == false) // { // QueryQXPZData(); // } //} if (ifStart == "0") { if (strYCJL == "" && strYB == "1" || strYCJL == "" && strYB == "" && cbJLLX.Text == "") { if (strQXPZ == "") { WriteLog("3"); if (AddYCJLData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } WriteLog("3.1"); } else { WriteLog("4"); if (AddECJLBData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } WriteLog("4.1"); } } else { if (strYCJL == "1" && cbJLLX.Text == "") { if (txtLH.Text == "" && txtLH2.Text == "" && txtLH3.Text == "") { WriteLog("5"); if (AddECJLData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } WriteLog("5.1"); } } WriteLog("6"); if (cbJLLX.Text == "外协") { if (AddWXData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } WriteLog("6.1"); if (cbJLLX.Text.Trim() == "复磅") { if (strYCJL == "1") { if (UpdateYCJLData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } if (strECJL == "1") { if (UpdateECJLBData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } } } //是否保存期限皮重 if (chbQXPZ.Checked == true) { //AddTPData(); if (SaveQXPZData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } } } if (e_REWEIGHTFLAG == "1") { DisPlayShowForFirst(); } if (e_REWEIGHTFLAG != "1") { //if (strYCJL == "" && strYB == "1" || chbQXPZ.Checked == true) if (strYCJL == "") { WriteLog("8"); DisPlayShowForFirst(); WriteLog("8.1"); } if (strYCJL == "1" && cbJLLX.Text == "") { WriteLog("9"); DisPlayShowForSecond(); WriteLog("9.1"); } } //抓图线程 m_MainThreadCapPicture = new CapPicture(MainThreadCapPicture); Invoke(m_MainThreadCapPicture); //用委托抓图 //打印磅单 //Print(); //查询一次计量表 WriteLog("10"); m_BindUltraGridDelegate = new BindUltraGridDelegate(QueryYCBData); //Invoke(m_BindUltraGridDelegate); BeginInvoke(m_BindUltraGridDelegate); WriteLog("10.1"); //panelYCSP.Visible = false; //曲线图表刷新 dtQX.Rows.Clear(); dtQX.Columns.Clear(); ultraChart1.DataSource = dataTable6; ksht = 1;//开始画图标志, ClearControlData(); ClearControl(); ClearQXPZData(); if (strYB == "1") { ClearYBData(); } WriteLog("11"); //曲线图表刷新 if (m_nPointCount > 0) { for (int i = 0; i < m_nPointCount; i++) { if (m_PoundRoomArray[i].POINTNAME.Trim() == ultraGrid2.ActiveRow.Cells["FS_POINTNAME"].Value.ToString().Trim()) { dtQX.Rows.Clear(); dtQX.Columns.Clear(); ultraChart1.DataSource = dataTable6; BackZeroSign[i] = 1; //BackZeroSign = 1,意思就是车子在上称过程中如出现重量多次稳定,可以继续绘图;如是下称,则不准再画。 } } } WriteLog("12"); ifStart = "0";//保存后重新恢复启动 cbJLLX.Enabled = true; //strZYBH = ""; //清除Guid //if (chb_Autocontrol.Checked == true) //{ // //if (m_PoundRoomArray[m_iSelectedPound].POINTID == "K01" || m_PoundRoomArray[m_iSelectedPound].POINTID == "K02") // m_PoundRoomArray[m_iSelectedPound].SendRtuCommand((byte)1, (byte)5, (byte)0x50, (byte)(0xE0 - 1), (byte)0x00, (byte)0); //} m_PoundRoomArray[m_iSelectedPound].ClearCardNoAndGuid(); m_PoundRoomArray[m_iSelectedPound].CardNo = ""; m_PoundRoomArray[m_iSelectedPound].ReaderGUID = ""; txtZL.Text = ""; WriteLog("13"); if (strYCJL == "1") { ClearYCBData(); } if (e_REWEIGHTFLAG == "1") { ClearECJLBData(); } WriteLog("14"); //pictureBox18.Image = BitmapToImage(new byte[1]); //车牌号一次计量图片 //pictureBox18.Refresh(); //panel20.Visible = false; //车牌号一次计量图片panel //panel22.BringToFront(); //磅单视频 strBCSJ = "0"; WriteLog("15"); #region 自动播放语音 m_AlarmVoicePath = Constant.RunPath + "\\sound\\称重完成.wav"; WriteLog("准备语音播放..."); #endregion this.Cursor = Cursors.Default; } catch (Exception ex) { WriteLog("保存失败: " + ex.ToString()); } }
/// <summary> /// 钢坯保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnGPBC_Click(object sender, EventArgs e) { //是否检测红外 //if (chb_AutoInfrared.Checked == true) //{ // //前后端红外都被挡,给予保存提示 // if (StatusBack.Connected == false && StatusFront.Connected == false) // { // if (DialogResult.No == MessageBox.Show("前、后端红外都被挡,请确认停车到位,是否继续保存", "保存提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) // return; // } //} if (strPoint == "") { MessageBox.Show("请先选择计量点!"); return; } if (cbJLLX.Enabled == true && cbJLLX.Text.Trim() == "复磅") { MessageBox.Show("“复磅”不能选择,请重新选择计量类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (txtZS.Text.Trim() == "" && txtLH.Text.Trim().Length>0)//20110301彭海波修改 { MessageBox.Show("请录入支数!"); return; } if (ControlProve() == false) { return; } if (txtLH.Text.Trim().Length > 0 && strYCJL == "1" && txtZS.Text.Trim().Length == 0) { MessageBox.Show("请输入支数或块数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtZS.Focus(); return; } if (txtLH2.Text.Trim().Length > 0 && strYCJL == "1" && txtZS2.Text.Trim().Length == 0) { MessageBox.Show("请输入支数或块数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtZS2.Focus(); return; } if (txtLH3.Text.Trim().Length > 0 && strYCJL == "1" && txtZS3.Text.Trim().Length == 0) { MessageBox.Show("请输入支数或块数", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtZS3.Focus(); return; } this.Cursor = Cursors.WaitCursor; strBCSJ = "1"; //2012.3.28.16:50 打印机 参数 printInfoClear(); strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; //print.printCZH = txtCZH.Text.Trim(); print.printCH = cbCH.Text.Trim() + cbCH1.Text.Trim(); print.printHTH = txtHTH.Text.Trim(); print.printWLMC = cbWLMC.Text.Trim(); print.printFHDW = cbFHDW.Text.Trim(); print.printSHDW = cbSHDW.Text.Trim(); print.printCYDW = cbCYDW.Text.Trim(); print.printJLLX = cbJLLX.Text.Trim(); print.printJLD = txtJLD.Text.Trim(); print.printJLY = txtJLY.Text.Trim(); //add by luobin print.printYKL = txtYKL.Text.Trim(); print.printYKBL = s_YKBL; //print.pringJLCS = strYCJL; print.printLH = txtLH.Text.Trim(); print.printZS = txtZS.Text.Trim(); print.printGZ = GZ; print.printGG = GG; print.printLH1 = txtLH.Text.Trim(); print.printZS1 = txtZS.Text.Trim(); print.printLH2 = txtLH2.Text.Trim(); print.printZS2 = txtZS2.Text.Trim(); print.printLH3 = txtLH3.Text.Trim(); print.printZS3 = txtZS3.Text.Trim(); print.printAdviseSpec = this.strAdviseSpec; print.printZZJY = this.strZZJY; if (strYCJL != "" || strQXPZ != "" ) { if (txtLH.Text.Trim().Length != 0 && txtLH2.Text.Trim().Length != 0) { //if (SaveGPData() == false) if (SaveBPHistory() == false) { this.Cursor = Cursors.Default; strBCSJ = "0"; return; } } else { //if (SaveGPTwoData() == false) if (SaveFPHistory() == false) { this.Cursor = Cursors.Default; strBCSJ = "0"; return; } } } else { if (cbLS.Text.Trim() == "还不是最后一炉") { if (SaveGPTwoData() == false) { this.Cursor = Cursors.Default; return; } } if (cbLS.Text.Trim() == "") { if (AddYCJLData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } } if (cbCH.SelectedIndex < 0) { this.DownLoadCarNo(); } if (strYCJL == "") { DisPlayShowForFirst(); } if (strYCJL == "1") { DisPlayShowForSecond(); } //有错误 m_MainThreadCapPicture = new CapPicture(MainThreadCapPicture); Invoke(m_MainThreadCapPicture); //用委托抓图 //打印磅单 //Print(); //查询一次计量表 m_BindUltraGridDelegate = new BindUltraGridDelegate(QueryYCBData); BeginInvoke(m_BindUltraGridDelegate); dtQX.Rows.Clear(); dtQX.Columns.Clear(); ultraChart1.DataSource = dataTable6; ksht = 1; ClearControlData(); ClearControl(); ClearQXPZData(); if (strYB == "1") { ClearYBData(); } //曲线图表刷新 if (m_nPointCount > 0) { for (int i = 0; i < m_nPointCount; i++) { if (m_PoundRoomArray[i].POINTNAME.Trim() == ultraGrid2.ActiveRow.Cells["FS_POINTNAME"].Value.ToString().Trim()) { dtQX.Rows.Clear(); dtQX.Columns.Clear(); ultraChart1.DataSource = dataTable6; BackZeroSign[i] = 1; //BackZeroSign = 1,意思就是车子在上称过程中如出现重量多次稳定,可以继续绘图;如是下称,则不准再画。 } } } ifStart = "0";//保存后重新恢复启动 cbJLLX.Enabled = true; //strZYBH = ""; //清除Guid //if (chb_Autocontrol.Checked == true) //{ // if (m_PoundRoomArray[m_iSelectedPound].POINTID == "K01" || m_PoundRoomArray[m_iSelectedPound].POINTID == "K02") // m_PoundRoomArray[m_iSelectedPound].SendRtuCommand((byte)1, (byte)5, (byte)0x50, (byte)(0xE0 - 1), (byte)0x00, (byte)0); //} m_PoundRoomArray[m_iSelectedPound].ClearCardNoAndGuid(); m_PoundRoomArray[m_iSelectedPound].CardNo = ""; m_PoundRoomArray[m_iSelectedPound].ReaderGUID = ""; txtZL.Text = ""; if (strYCJL == "1") { ClearYCBData(); } // btnGPBC.Enabled = false; 2012年3月21号 strBCSJ = "0"; this.Cursor = Cursors.Default; #region 自动播放语音 m_AlarmVoicePath = Constant.RunPath + "\\sound\\称重完成.wav"; WriteLog("准备语音播放..."); #endregion }
/// <summary> /// 保存按钮单击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnBC_Click(object sender, EventArgs e) { try { //是否检测红外 //if (chb_AutoInfrared.Checked == true) //{ // //前后端红外都被挡,给予保存提示 // if (StatusBack.Connected == false && StatusFront.Connected == false) // { // if (DialogResult.No == MessageBox.Show("前、后端红外都被挡,请确认停车到位,是否继续保存", "保存提示", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)) // return; // } //} if (strPoint == "") { MessageBox.Show("请选择计量点!"); return; } if (cbJLLX.Enabled == true && cbJLLX.Text.Trim() == "复磅") { //MessageBox.Show("“复磅”不能选择,请重新选择计量类型!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //return; //UpdateYCJLData();//复磅修改一次计量数据 string cardno = this.txtCZH.Text.Trim(); string strSQL = "select * from dt_firstcarweight where fs_cardnumber ='" + cardno + "'"; CoreClientParam ccp = new CoreClientParam(); ccp.ServerName = "ygjzjl.car.CarCard"; ccp.MethodName = "queryByClientSql"; ccp.ServerParams = new object[] { strSQL }; System.Data.DataTable dt = new System.Data.DataTable(); ccp.SourceDataTable = dt; this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal); if (dt.Rows.Count > 0) { if (UpdateYCJLData() == false) { return; } } else { string strSQl1 = "select * from dt_carweight_weight where fd_ecjlsj =(select max(fd_ecjlsj) from dt_carweight_weight where fs_cardnumber='" + cardno + "') and fs_cardnumber='" + cardno + "' "; CoreClientParam ccp1 = new CoreClientParam(); ccp1.ServerName = "ygjzjl.car.CarCard"; ccp1.MethodName = "queryByClientSql"; ccp1.ServerParams = new object[] { strSQl1 }; System.Data.DataTable dt1 = new System.Data.DataTable(); ccp1.SourceDataTable = dt1; this.ExecuteQueryToDataTable(ccp1, CoreInvokeType.Internal); if (dt1.Rows.Count > 0) { if (UpdateECJLBData() == false) { return; } } else { return; } } } if (cbJLLX.Text.Trim() != "外协") { if (ControlProve() == false) { return; } } else { if (txtJLD.Text == "") { MessageBox.Show("请选择磅房信息!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); txtJLD.Focus(); return; } if (cbCH.Text == "") { MessageBox.Show("车号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cbCH.Focus(); return; } if (cbCH1.Text == "") { MessageBox.Show("车号不能为空!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); cbCH1.Focus(); return; } } //判断是否取样、卸货与验收 if (strYCJL == "1" && cbJLLX.Text == "") { //卸货 if (stSHKCD == "1")//是否需要卸货 { if (strXCQR != "1")//是否已经卸货 { if (DialogResult.No == MessageBox.Show("卡号:" + txtCZH.Text.Trim() + "车号:" + cbCH.Text.Trim() + cbCH1.Text.Trim() + "未卸货!,是否继续保存", "保存提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)) //MessageBox.Show("该车还未卸货,是否允许过磅!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (Convert.ToDateTime(strYCJLSJ).ToString("yyyy-MM-dd").Equals(System.DateTime.Now.ToString("yyyy-MM-dd")) == false) { if (DialogResult.No == MessageBox.Show("卡号:" + txtCZH.Text.Trim() + "车号:" + cbCH.Text.Trim() + cbCH1.Text.Trim() + "计量日期不为同一天!,是否继续保存", "保存提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)) return; } if (Convert.ToSingle(this.txtJZ.Text.Trim()) < 1) { if (DialogResult.No == MessageBox.Show("卡号:" + txtCZH.Text.Trim() + "车号:" + cbCH.Text.Trim() + cbCH1.Text.Trim() + "净重小于1吨!,是否继续保存", "保存提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)) return; } } } if (ifStart == "1") { if (txtLH.Text.Trim() != "" && sDDH == "") { MessageBox.Show("请先查询炉号对应的合同号!"); return; } if (txtLH.Text.Trim() != "" && sDDH != "" && txtZS.Text.Trim() == "") { MessageBox.Show("请录入炉号对应的支数!"); txtZS.Focus(); return; } if (txtLH.Text.Trim() == "" && txtLH2.Text.Trim() != "" || txtLH3.Text.Trim() != "") { MessageBox.Show("请把炉号录入相应的位置!"); txtLH.Focus(); return; } } if (strPoint == "") { MessageBox.Show("请双击选择计量点接管信息,接管计量点!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } this.Cursor = Cursors.WaitCursor; strBCSJ = "1"; //在保存时不需要计算净重,防止保存时系统自动退出 printInfoClear();//打印参数初始化 strCode = DateTime.Now.ToString("yyyyMMddHHmmss") + strJLDID; //print.printCZH = txtCZH.Text.Trim(); print.printCH = cbCH.Text.Trim() + cbCH1.Text.Trim(); print.printHTH = txtHTH.Text.Trim(); print.printWLMC = cbWLMC.Text.Trim(); print.printFHDW = cbFHDW.Text.Trim(); print.printSHDW = cbSHDW.Text.Trim(); print.printCYDW = cbCYDW.Text.Trim(); print.printJLLX = cbJLLX.Text.Trim(); print.printJLD = txtJLD.Text.Trim(); print.printJLY = txtJLY.Text.Trim(); //add by luobin print.printYKL = txtYKL.Text.Trim(); print.printYKBL = s_YKBL; print.printAdviseSpec = this.strAdviseSpec; print.printZZJY = this.strZZJY; //print.pringJLCS = strYCJL; WriteLog("1"); if (e_REWEIGHTFLAG == "1")//二次计量复磅标志(期限皮重时用) { if (UpdateECJLBData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } WriteLog("2"); if (e_REWEIGHTFLAG != "1") { //if (strYCJL == "") //{ // if (chbQXPZ.Checked == false) // { // QueryQXPZData(); // } //} if (ifStart == "0") { if (strYCJL == "" && cbJLLX.Text == "") { if (strQXPZ == "") { WriteLog("3"); if (AddYCJLData() == false)//保存一次计量数据 { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } WriteLog("3.1"); } else { WriteLog("4"); if (AddECJLBData() == false)//二次计量数据 { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } WriteLog("4.1"); } } else { if (strYCJL == "1" && cbJLLX.Text == "") { //if (txtLH.Text == "" && txtLH2.Text == "" && txtLH3.Text == "") // { WriteLog("5"); if (AddECJLData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } WriteLog("5.1"); // } } WriteLog("6"); if (cbJLLX.Text == "外协") { if (AddWXData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } WriteLog("6.1"); if (cbJLLX.Text.Trim() == "复磅") { if (strYCJL == "1")//判断一次计量是否是空 { if (UpdateYCJLData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } if (strECJL == "1") { if (UpdateECJLBData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } } } //是否保存期限皮重 if (chbQXPZ.Checked == true) { //AddTPData(); if (SaveQXPZData() == false) { strBCSJ = "0"; this.Cursor = Cursors.Default; return; } } } } if (e_REWEIGHTFLAG == "1") { DisPlayShowForFirst(); } if (e_REWEIGHTFLAG != "1") { //if (strYCJL == "" && strYB == "1" || chbQXPZ.Checked == true) if (strYCJL == "") { WriteLog("8"); DisPlayShowForFirst();//一次计量完成后,液晶显示计量信息 WriteLog("8.1"); } if (strYCJL == "1" && cbJLLX.Text == "") { WriteLog("9"); DisPlayShowForSecond();//二次计量完成后液晶显示计量信息 WriteLog("9.1"); } } //抓图线程 m_MainThreadCapPicture = new CapPicture(MainThreadCapPicture); Invoke(m_MainThreadCapPicture); //用委托抓图 //打印磅单 //Print(); //查询一次计量表 WriteLog("10"); m_BindUltraGridDelegate = new BindUltraGridDelegate(QueryYCBData); //Invoke(m_BindUltraGridDelegate); BeginInvoke(m_BindUltraGridDelegate); WriteLog("10.1"); //panelYCSP.Visible = false; //曲线图表刷新 dtQX.Rows.Clear(); dtQX.Columns.Clear(); ultraChart1.DataSource = dataTable6; ksht = 1;//开始画图标志, ClearControlData();//清空控件数据 ClearControl();//清空控件内容 ClearQXPZData(); if (strYB == "1") { ClearYBData(); } WriteLog("11"); //曲线图表刷新 if (m_nPointCount > 0) { for (int i = 0; i < m_nPointCount; i++) { if (m_PoundRoomArray[i].POINTNAME.Trim() == ultraGrid2.ActiveRow.Cells["FS_POINTNAME"].Value.ToString().Trim()) { dtQX.Rows.Clear(); dtQX.Columns.Clear(); ultraChart1.DataSource = dataTable6; BackZeroSign[i] = 1; //BackZeroSign = 1,意思就是车子在上称过程中如出现重量多次稳定,可以继续绘图;如是下称,则不准再画。 } } } WriteLog("12"); ifStart = "0";//保存后重新恢复启动 cbJLLX.Enabled = true; //strZYBH = ""; //清除Guid //if (chb_Autocontrol.Checked == true) //{ //if (m_PoundRoomArray[m_iSelectedPound].POINTID == "K01" || m_PoundRoomArray[m_iSelectedPound].POINTID == "K02") m_PoundRoomArray[m_iSelectedPound].SendRtuCommand((byte)1, (byte)5, (byte)0x50, (byte)(0xE0 - 1), (byte)0x00, (byte)0); //} m_PoundRoomArray[m_iSelectedPound].ClearCardNoAndGuid(); m_PoundRoomArray[m_iSelectedPound].CardNo = ""; m_PoundRoomArray[m_iSelectedPound].ReaderGUID = ""; txtZL.Text = ""; WriteLog("13"); if (strYCJL == "1") { ClearYCBData();//清空一次计量数据 } if (e_REWEIGHTFLAG == "1") { ClearECJLBData();//清空两次计量数据 } WriteLog("14"); //pictureBox18.Image = BitmapToImage(new byte[1]); //车牌号一次计量图片 //pictureBox18.Refresh(); //panel20.Visible = false; //车牌号一次计量图片panel //panel22.BringToFront(); //磅单视频 strBCSJ = "0"; WriteLog("15"); #region 自动播放语音 m_AlarmVoicePath = Constant.RunPath + "\\sound\\称重完成.wav"; WriteLog("准备语音播放..."); if (System.IO.File.Exists(m_AlarmVoicePath)) { if (m_PoundRoomArray[m_iSelectedPound].Talk == true && m_PoundRoomArray[m_iSelectedPound].TalkID > 0) { m_PoundRoomArray[m_iSelectedPound].VideoRecord.SDK_RealPlay(1,0,(int)picFDTP.Handle); m_PoundRoomArray[m_iSelectedPound].VideoRecord.SDK_StopTalk(); m_PoundRoomArray[m_iSelectedPound].TalkID = 0; m_PoundRoomArray[m_iSelectedPound].Talk = false; ultraToolbarsManager1.Toolbars[0].Tools["YYDJ"].SharedProps.Caption = "打开对讲"; } FileInfo fi = new FileInfo(m_AlarmVoicePath); int waveTimeLen = Convert.ToInt32((fi.Length - 54) / 16 + 500); if (m_PoundRoomArray[m_iSelectedPound].AUDIONUM > 0) { m_PoundRoomArray[m_iSelectedPound].AUDIONUM = 0; WriteLog("开始语音播放,预计时间 " + waveTimeLen.ToString()); int reVal = m_PoundRoomArray[m_iSelectedPound].VideoRecord.SDK_SendData(m_AlarmVoicePath); Thread.Sleep(waveTimeLen); WriteLog("语音播放完成,播放字节 " + reVal.ToString()); if (reVal <= 0 && m_PoundRoomArray[m_iSelectedPound].ISFIRSTSEND == false) reBootVideo(); m_PoundRoomArray[m_iSelectedPound].ISFIRSTSEND = false; m_PoundRoomArray[m_iSelectedPound].AUDIONUM = 1; } } #endregion this.Cursor = Cursors.Default; } catch (Exception ex) { WriteLog("保存失败: " + ex.ToString()); } //this.sendWC();调用计量完成的声音 //this.pictureJP();调用截图 //this.stopYP(); }
/// <summary> /// 窗体初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WeighMeasureInfo_Load(object sender, EventArgs e) { card = new IcCard(); card.PortName = "COM1"; getImage.ob = this.ob; getImage.SynServerTime();//同步服务器时间 //InphaseServerTime cc = new InphaseServerTime(); //cc.Check_Before_Login(); //m_SerialPort1 = new SerialPort(); //m_SerialPort2 = new SerialPort(); //m_SerialPort7 = new SerialPort(); //m_SerialPort = new SerialPort[10] { m_SerialPort1, m_SerialPort2, m_SerialPort3, m_SerialPort4, m_SerialPort5, m_SerialPort6, m_SerialPort7, m_SerialPort8, m_SerialPort9, m_SerialPort10 }; m_MainThreadCapPicture= new CapPicture (MainThreadCapPicture); //构建计量点曲线图列表与动态列 dtQXT = new DataTable[10] { dtQXT0, dtQXT1, dtQXT2, dtQXT3, dtQXT4, dtQXT5, dtQXT6, dtQXT7, dtQXT8, dtQXT9 }; curveColumns = new int[10] { curveColumns0, curveColumns1, curveColumns2, curveColumns3, curveColumns4, curveColumns5, curveColumns6, curveColumns7, curveColumns8, curveColumns9 }; strBackZero = new int[10] { strBackZero0, strBackZero1, strBackZero2, strBackZero3, strBackZero4, strBackZero5, strBackZero6, strBackZero7, strBackZero8, strBackZero9 }; BackZeroSign = new int[10] { BackZeroSign0, BackZeroSign1, BackZeroSign2, BackZeroSign3, BackZeroSign4, BackZeroSign5, BackZeroSign6, BackZeroSign7, BackZeroSign8, BackZeroSign9 }; BackZero = new int[10] { BackZero0, BackZero1, BackZero2, BackZero3, BackZero4, BackZero5, BackZero6, BackZero7, BackZero8, BackZero9 }; s_toZore = new decimal[10] { s_toZore0, s_toZore1, s_toZore2, s_toZore3, s_toZore4, s_toZore5, s_toZore6, s_toZore7, s_toZore8, s_toZore9 }; b_daozha = new bool[10] { b_daozha0, b_daozha1, b_daozha2, b_daozha3, b_daozha4, b_daozha5, b_daozha6, b_daozha7, b_daozha8, b_daozha9 }; ifControlDaozha = new int[10] { ifControlDaozha0, ifControlDaozha1, ifControlDaozha2, ifControlDaozha3, ifControlDaozha4, ifControlDaozha5, ifControlDaozha6, ifControlDaozha7, ifControlDaozha8, ifControlDaozha9 }; stRunPath = System.Environment.CurrentDirectory;//当前界面自己定义路径 Constant.RunPath = System.Environment.CurrentDirectory;//Core.KgMcms.PublicComponent带的定义路径 //Constant.SetViewStyle(this); ControlerInit(); //GetLXData(); DataGridInit(); QueryJLDData(); // QueryYYBBData(); 该方法为语音播报方法 Load调用该方法时ultraToolbarsManager冲突 ultraToolbarsManager 不显示 panelYCJL.Width = 652; panelYCJL.Visible = false;//一次计量图片 //panelYCSP.Height = 209; picFDTP.Visible = false;//双击放大图片 panel22.Visible = true;//查询出一次计量车号图片 txtJLY.Text = CoreFS.SA06.CoreUserInfo.UserInfo.GetUserName(); txtBC.Text = Table_CA02_UserOrder.Static_T_CA02_UserOrder.GetUserOrderName(CoreFS.SA06.CoreUserInfo.UserInfo.GetUserOrder()); //chbQXPZ.Enabled = false; sdk = new SDK_Com.HKDVR();//硬盘录像机实例化 sdk.SDK_Init();//必须要初始化 //ConnectYPLXJ(); DataRow dro = dataTable6.NewRow(); dro[0] = 0; dataTable6.Rows.Add(dro); ultraChart1.DataSource = dataTable6; lbYS.ForeColor = Color.Red; //GetLXData(); //for (int i = 1; i <= 6; i++) //{ // Button btnItemName = (Button)panelYYBF.Controls.Find("btn" + Convert.ToString(i), true)[0]; // btnItemName.Enabled = false; //} //for (int i = 1; i <= 15; i++) //{ // if (i != 9) // { // Button btnItemName = (Button)panelSPKZ.Controls.Find("button" + Convert.ToString(i), true)[0]; // btnItemName.Enabled = false; // } //} s_SerialPort = new SerialPort("COM2", 115200, Parity.None, 8, StopBits.One); //屏幕显示数据实例化 m_SerialPort1 = new SerialPort(); m_SerialPort2 = new SerialPort(); m_SerialPort3 = new SerialPort(); m_SerialPort4 = new SerialPort(); m_SerialPort5 = new SerialPort(); m_SerialPort6 = new SerialPort(); m_SerialPort7 = new SerialPort(); m_SerialPort8 = new SerialPort(); m_SerialPort9 = new SerialPort(); m_SerialPort10 = new SerialPort(); m_SerialPort11 = new SerialPort(); m_SerialPort12 = new SerialPort(); m_SerialPort13 = new SerialPort(); m_SerialPort14 = new SerialPort(); QueryYCBData(); ClearYBData(); ClearYCBData(); InitConfig(); this.BuildMyTable();//构建内存表格式 this.DownLoadMaterial(); //下载磅房对应物料信息到内存表 this.DownLoadReceiver(); //下载磅房对应收货单位信息到内存表 this.DownLoadSender(); //下载磅房对应发货单位信息到内存表 this.DownLoadTrans(); //下载磅房对应承运单位信息到内存表 this.DownLoadCarNo(); //下载磅房对应车号信息到内存表 //this.DownLoadFlow(); //下载流向信息 this.DownLoadProvider(); //下载磅房对应供应单位信息内存表 printInfoClear(); }
private void btnBC_Click(object sender, EventArgs e) { if (txtTRAINNO.Text == "") { MessageBox.Show("�������복����Ϣ!"); return; } if (!check()) { return; } //�ֶμ�� if (!ifExistFirstWeight)//���һ�α���û������� { if (bSglr && txtWeight.Text != "" && txtTareWeight.Text == "") { bSave=saveDataForSglr("first"); bFirst = true; } else if (!bSglr&&txtWeight.Text != "" && txtTareWeight.Text == "") { bSave = saveData("first");//����һ������ bFirst = true; } else if (bSglr && txtWeight.Text != "" && txtTareWeight.Text != "") { bSave=saveDataForSglr(); bFirst = false; } } else//���һ�α��������Ӧ���ŵ����ݣ����ڶ��α��в�������������¼��ɾ��һ�α��м�¼ { { bSave = saveData();//����������� bFirst = false; } } queryHistoryDataByDate(); queryFirstDataByAll(); if (bSave) { //�洢ͼƬ��Ϣ m_MainThreadCapPicture = new CapPicture(MainThreadCapPicture); Invoke(m_MainThreadCapPicture); //��ί��ץͼ bSave = false; txtWeight.ReadOnly = true; txtWeight.BackColor = Color.Bisque; } //m_AlarmVoicePath = Constant.RunPath + "\\sound\\ProductComplete.wav"; //AutoAlarmVoice(); initCommpent(); }