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; }
/// <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 }
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 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(); }