You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.6 KiB
C#

1 year ago
using DevExpress.XtraEditors;
using DevExpress.XtraReports.UI;
using ICSharpCode.Core;
using Mesnac.Action.Base;
using Mesnac.Action.ChemicalWeighing.BinManage;
using Mesnac.Action.ChemicalWeighing.Entity;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Printing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mesnac.Action.ChemicalWeighing.Package
{
class BarcodeAction : ChemicalWeighingAction, IAction
{
#region 字段定义
private RuntimeParameter _runtime;
private DbMCControl _clientGridControl = null; //物料信息控件
private DataGridView clientGridView = null;
#endregion
public void Run(RuntimeParameter runtime)
{
base.RunIni(runtime); //必须调用
this._runtime = runtime;
DbMCControl materialDGV = this.GetDbMCControlByKey(Mesnac.Basic.DataSourceFactory.MCDbType.Local, "Hw_Package").FirstOrDefault();
if (materialDGV == null)
{
ICSharpCode.Core.LoggingService<BarcodeAction>.Error("预览物料条码信息失败:未找到控件");
return;
}
this._clientGridControl = materialDGV;
this.clientGridView = _clientGridControl.BaseControl as DataGridView;
this.DoWork();
}
/// <summary>
/// 预览条码
/// </summary>
protected void DoWork()
{
this._runtime.BaseControl.MCEnabled = false;
try
{
if (clientGridView.SelectedRows.Count >= 1)
{
string code = clientGridView.SelectedRows[0].Cells["BarCode"].Value as string;
FormBarcode frm=new FormBarcode(code);
frm.ShowDialog();
}
else
{
string msg2 = "请至少选择一条预览信息!";
MessageBox.Show(msg2, Mesnac.Basic.LanguageHelper.Caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
catch (Exception ex)
{
ICSharpCode.Core.LoggingService<BarcodeAction>.Error("预览信息预览异常:" + ex.Message, ex);
MessageBox.Show(ex.Message, Mesnac.Basic.LanguageHelper.WarnCaption, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
finally
{
this._runtime.BaseControl.MCEnabled = true;
}
}
}
}