| | |
| | | using System.IO; |
| | | using System.Management; |
| | | using System.Net.NetworkInformation; |
| | | using System.Printing; |
| | | |
| | | namespace WarM |
| | | { |
| | |
| | | #region çææé® |
| | | private void bc_Click(object sender, EventArgs e) |
| | | { |
| | | //å®¡æ ¸æé |
| | | if (!DBUtility.ClsPub.Security_Log_second("Gy_BarCodeBill_automaticallyByPLC_ProduceByHand", 1, false, DBUtility.ClsPub.CurUserName)) |
| | | { |
| | | MessageBox.Show("çæå¤±è´¥ï¼æ æéï¼"); |
| | | return; |
| | | } |
| | | |
| | | //æ¸
餿å°ä»»å¡ |
| | | string msg = ""; |
| | | if (!clearPrinterTask(ref msg)) |
| | | { |
| | | MessageBox.Show(msg); |
| | | return; |
| | | } |
| | | |
| | | this.Sub_SaveBill(); |
| | | Display(); |
| | | |
| | | //设置æå°æ¨¡æ¿ï¼æå° |
| | | grdList.Rows[0].Cells[0].Value = "*"; |
| | | Report = new GridppReport(); |
| | | Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf"); //here . |
| | | Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord); |
| | | Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable); |
| | | Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd); |
| | | if (comboBox_PrinterParams.Text != "") |
| | | if (radioButton_IsPrint_Yes.Checked == true) |
| | | { |
| | | Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(é»è®¤)", ""); |
| | | //设置æå°æ¨¡æ¿ï¼æå° |
| | | grdList.Rows[0].Cells[0].Value = "*"; |
| | | Report = new GridppReport(); |
| | | Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf"); //here . |
| | | Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord); |
| | | Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable); |
| | | Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd); |
| | | if (comboBox_PrinterParams.Text != "") |
| | | { |
| | | Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(é»è®¤)", ""); |
| | | } |
| | | Report.Print(false); |
| | | } |
| | | Report.Print(false); |
| | | |
| | | |
| | | Display4(); |
| | | } |
| | | //ä¿ååæ® |
| | |
| | | return false; |
| | | } |
| | | |
| | | //æ¸
餿宿尿ºä»»å¡ |
| | | private bool clearPrinterTask(ref string msg) |
| | | { |
| | | try |
| | | { |
| | | PrintServer localPrintServer = new LocalPrintServer(); |
| | | PrintQueue pq = localPrintServer.GetPrintQueue(comboBox_PrinterParams.Text.Replace("(é»è®¤)", "").ToLower()); |
| | | pq.Refresh(); |
| | | PrintJobInfoCollection allPrintJobs = pq.GetPrintJobInfoCollection(); |
| | | foreach (PrintSystemJobInfo printJob in allPrintJobs) |
| | | { |
| | | printJob.Cancel(); |
| | | |
| | | } |
| | | return true; |
| | | } |
| | | catch(Exception ex) |
| | | { |
| | | msg = ex.Message; |
| | | return false; |
| | | } |
| | | } |
| | | |
| | | //æ ¹æ®é讯信æ¯çææ¡ç å¹¶æå° |
| | | private void timer2_Tick(object sender, EventArgs e) |
| | | { |
| | | if (produceQty > 0) |
| | | { |
| | | //æ¸
餿å°ä»»å¡ |
| | | string msg = ""; |
| | | if (!clearPrinterTask(ref msg)) |
| | | { |
| | | MessageBox.Show(msg); |
| | | produceQty = 0; |
| | | } |
| | | } |
| | | |
| | | for (int i = 0; i < produceQty; i++) |
| | | { |
| | | //çææ¡ç |
| | |
| | | //è·åéè¦æå°çæ°æ® |
| | | Display(); |
| | | |
| | | //设置æå°æ¨¡æ¿ï¼æå° |
| | | grdList.Rows[0].Cells[0].Value = "*"; |
| | | Report = new GridppReport(); |
| | | Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf"); //here . |
| | | Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord); |
| | | Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable); |
| | | Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd); |
| | | if (comboBox_PrinterParams.Text != "") |
| | | if (radioButton_IsPrint_Yes.Checked == true) |
| | | { |
| | | Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(é»è®¤)", ""); |
| | | //设置æå°æ¨¡æ¿ï¼æå° |
| | | grdList.Rows[0].Cells[0].Value = "*"; |
| | | Report = new GridppReport(); |
| | | Report.LoadFromFile(DBUtility.ClsPub.AppPath + @"\" + textBox_PrintModelParams.Text + ".grf"); //here . |
| | | Report.BeforePostRecord += new _IGridppReportEvents_BeforePostRecordEventHandler(ReportBeforePostRecord); |
| | | Report.FetchRecord += new _IGridppReportEvents_FetchRecordEventHandler(ReportFetchRecordByDataTable); |
| | | Report.PrintEnd += new _IGridppReportEvents_PrintEndEventHandler(ReportPrintEnd); |
| | | if (comboBox_PrinterParams.Text != "") |
| | | { |
| | | Report.Printer.PrinterName = comboBox_PrinterParams.Text.Replace("(é»è®¤)", ""); |
| | | } |
| | | Report.Print(false); |
| | | } |
| | | Report.Print(false); |
| | | |
| | | if (i == produceQty - 1) |
| | | { |