| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.ComponentModel; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Drawing; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Windows.Forms; | 
					
						
							|  |  |  |  | using DevExpress.XtraBars; | 
					
						
							|  |  |  |  | //using DeiNiu.wms.Logical; | 
					
						
							|  |  |  |  | using Microsoft.Reporting.WinForms; | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | using DeiNiu.Utils; | 
					
						
							|  |  |  |  | using DeiNiu.wms.win.utils.print; | 
					
						
							|  |  |  |  | using System.Drawing.Printing; | 
					
						
							|  |  |  |  | using DeiNiu.wms.Data.Model; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace DeiNiu.wms.win | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     public partial class ConfigPrint : BasicRibbonForm | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         public ConfigPrint() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             InitializeComponent(); | 
					
						
							|  |  |  |  |             //testReportInA4(); | 
					
						
							|  |  |  |  |             loadPrinters(); | 
					
						
							|  |  |  |  |             loadDefaultPrinters(); | 
					
						
							|  |  |  |  |             //testLocation(); | 
					
						
							|  |  |  |  |             //testOutA4(); | 
					
						
							|  |  |  |  |             /* | 
					
						
							|  |  |  |  |           this.reportViewer1.LocalReport.ReportPath = "wms_in_code.rdlc";// "DeiNiu.wms.Logical.reports.code_print.rdlc"; | 
					
						
							|  |  |  |  |           reportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local; | 
					
						
							|  |  |  |  |           DataTable dt = new DeiNiu.wms.Data.Model.WmsStock().getStockRecord("PDDHJO00000051"); | 
					
						
							|  |  |  |  |           int rowCnt = dt.Rows.Count; | 
					
						
							|  |  |  |  |           reportViewer1.LocalReport.DataSources.Add(new ReportDataSource("DataSet1", dt)); | 
					
						
							|  |  |  |  |           this.reportViewer1.RefreshReport(); | 
					
						
							|  |  |  |  |           */ | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  |         private void reportViewer1_Load(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         void loadPrinters() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             PrintDocument print = new PrintDocument(); | 
					
						
							|  |  |  |  |             string sDefault = print.PrinterSettings.PrinterName;//默认打印机名 | 
					
						
							|  |  |  |  |             foreach (string sPrint in PrinterSettings.InstalledPrinters)//获取所有打印机名称 | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 comPrinters.Properties.Items.Add(sPrint); | 
					
						
							|  |  |  |  |                 if (sPrint == sDefault) | 
					
						
							|  |  |  |  |                     comPrinters.SelectedIndex = comPrinters.Properties.Items.IndexOf(sPrint); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         private void btnTest_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             PrintDocument print = new PrintDocument(); | 
					
						
							|  |  |  |  |               | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnA4_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             WriteConfig("A4Printer", comPrinters.Text);  | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             loadDefaultPrinters();  | 
					
						
							|  |  |  |  |           //  MessageBox.Show("设置成功"); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |           | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void loadDefaultPrinters() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |               readPrinters(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-04 22:41:19 +08:00
										 |  |  |  |             lbA4.Text = pickConstants.PRINTER_NAME_A4; | 
					
						
							|  |  |  |  |             lbCode.Text = pickConstants.PRINTER_NAME_CODE; | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |             | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnCode_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             WriteConfig("CodePrinter", comPrinters.Text); | 
					
						
							|  |  |  |  |             loadDefaultPrinters(); | 
					
						
							|  |  |  |  |           // MessageBox.Show("设置成功"); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private void btnPin_Click(object sender, EventArgs e) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             WriteConfig("PinPrinter", comPrinters.Text); | 
					
						
							|  |  |  |  |             loadDefaultPrinters(); | 
					
						
							|  |  |  |  |            // MessageBox.Show("设置成功"); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |     } | 
					
						
							|  |  |  |  | } |