You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
101 lines
4.0 KiB
101 lines
4.0 KiB
using System;
|
|
using System.Windows;
|
|
using System.Windows.Input;
|
|
using System.Data;
|
|
using System.Drawing.Printing;
|
|
using SSWMS.Common;
|
|
|
|
namespace SSWMS.Client
|
|
{
|
|
public partial class STORAGE_PRINT : AvalonDock.DocumentContent
|
|
{
|
|
public STORAGE_PRINT()
|
|
{
|
|
InitializeComponent();
|
|
DocumentContent_Loaded(null, null);
|
|
}
|
|
|
|
private void DocumentContent_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
DataTable dt = new DataTable();
|
|
dt.Columns.Add("NAME", SystemCode.ConstCode.TypeString);
|
|
dt.Columns.Add("VALUE", SystemCode.ConstCode.TypeString);
|
|
int iDefaultIndex = 0;
|
|
foreach (string sPrinter in PrinterSettings.InstalledPrinters)
|
|
{
|
|
if (sPrinter.Contains("Microsoft Print to PDF")) // Test
|
|
// if (sPrinter.Contains("ZDesigner")) // 2210324 山东药玻
|
|
{
|
|
iDefaultIndex = dt.Rows.Count;
|
|
}
|
|
dt.Rows.Add(sPrinter, sPrinter);
|
|
}
|
|
this.cbPrinter.DisplayMemberPath = "NAME";
|
|
this.cbPrinter.SelectedValuePath = "VALUE";
|
|
this.cbPrinter.ItemsSource = dt.DefaultView;
|
|
this.cbPrinter.SelectedIndex = iDefaultIndex;
|
|
this.dgGoodsMain.dgData.U_WindowName = "COMMON";
|
|
this.dgGoodsMain.dgData.U_XmlTableName = "GOODS_MAIN";
|
|
this.dgGoodsMain.dgData.U_TableName = "V_GOODS_MAIN_GOODS";
|
|
this.dgGoodsMain.dgData.U_OrderField = "GOODS_CODE";
|
|
this.dgGoodsMain.dgData.U_AllowOperatData = false;
|
|
this.dgGoodsMain.dgData.gridApp.MouseDoubleClick += new MouseButtonEventHandler((a, b) =>
|
|
{
|
|
DataRowView drvSelected = this.dgGoodsMain.dgData.gridApp.SelectedItem as DataRowView;
|
|
if (drvSelected != null)
|
|
{
|
|
this.tbText1.Text = drvSelected["GOODS_CODE"].ToString();
|
|
this.tbText2.Text = drvSelected["GOODS_NAME"].ToString();
|
|
this.tbText3.Text = drvSelected["GOODS_QUANTITY"] is DBNull ? "1.00" : Convert.ToDecimal(drvSelected["GOODS_QUANTITY"]).ToString();
|
|
}
|
|
});
|
|
this.dgGoodsMain.U_InitControl();
|
|
bRefresh_Click(null, null);
|
|
}
|
|
|
|
private void bRefresh_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
this.tbText1.Text = string.Empty;
|
|
this.tbText2.Text = string.Empty;
|
|
this.tbText3.Text = string.Empty;
|
|
this.tbQuantity.Text = "1";
|
|
}
|
|
|
|
private void bPrint_Click(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (this.cbPrinter.SelectedValue == null)
|
|
{
|
|
MessageDialog.ShowException("请选择打印机");
|
|
return;
|
|
}
|
|
if (string.IsNullOrWhiteSpace(this.tbText1.Text))
|
|
{
|
|
MessageDialog.ShowException("请输入物料编码");
|
|
return;
|
|
}
|
|
if (string.IsNullOrWhiteSpace(this.tbText2.Text))
|
|
{
|
|
MessageDialog.ShowException("请输入物料名称");
|
|
return;
|
|
}
|
|
if (string.IsNullOrWhiteSpace(this.tbText3.Text))
|
|
{
|
|
MessageDialog.ShowException("请输入物料数量");
|
|
return;
|
|
}
|
|
Print.Program.Print(this.cbPrinter.SelectedValue.ToString(), new string[]
|
|
{
|
|
string.IsNullOrWhiteSpace(this.tbText1.Text) ? string.Empty : this.tbText1.Text.Trim(),
|
|
string.IsNullOrWhiteSpace(this.tbText2.Text) ? string.Empty : this.tbText2.Text.Trim(),
|
|
string.IsNullOrWhiteSpace(this.tbText3.Text) ? string.Empty : this.tbText3.Text.Trim()
|
|
});
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageDialog.ShowException(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|