Files
lserp_cs_6.0/插件库/Lskj.WorkshopProgram/Control/BarcodePrinting .cs
T
cyf ab56a9bcf7 基线 SVN r240
SVN-Revision: r240
2025-02-06 06:46:06 +00:00

648 lines
30 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DevExpress.Utils;
using DevExpress.XtraEditors;
using DevExpress.XtraTab;
using Lskj.Control;
using Lskj.Core;
using Lskj.Util;
using RM.Interop.ReportMachine;
namespace Lskj.WorkshopProgram.Control//打印 吹膜代码
{
public partial class BarcodePrinting : UserControl
{
/// <summary>
/// 单号ID
/// </summary>
private string FSCBillNo = string.Empty;
/// <summary>
/// 客户编号
/// </summary>
private string customerCode = string.Empty;
/// <summary>
/// 报表控件
/// </summary>
private RMReportEngine.RMReport rmReport = new RMReportEngine.RMReport();
/// <summary>
/// 格式设计
/// </summary>
private string formatDesign = string.Empty;
/// <summary>
/// 是否改变
/// </summary>
private bool Change;
/// <summary>
/// 产品档案类型
/// </summary>
private string productFileType = string.Empty;
/// <summary>
/// 基材密度
/// </summary>
private double materialDensity;
public BarcodePrinting()
{
InitializeComponent();
this.Load();
}
//初始化
private void Load()
{
//string serverName = IniUtil.IniReadValue("金蝶数据库", "服务器名");
//string dbName = IniUtil.IniReadValue("金蝶数据库", "数据库名");
//string user = IniUtil.IniReadValue("金蝶数据库", "登录用户");
//string password = IniUtil.IniReadValue("金蝶数据库", "登录密码");
//string p1 = "~!@#$%^&*()abcdefghijklmnopqrstuvwxyz,./ABCDEFGHIJKLMNOP-QRSTUVWXYZ0123456789";
//string p2 = "A1B0C2DE3F6GH5I4JK7LMN8OPQ,./RST9UVWXYZ~!@#$%^&*()abcd-efghijklmnopqrstuvwxyz";
this.AddButton.Click += new EventHandler(OnAddBtn_Click);
this.saveButton.Click += new EventHandler(OnSaveButton_Click);
this.previewButton.Click += new EventHandler(OnPreviewButton_Click);
this.formatButton.Click += new EventHandler(OnFormatButton_Click);
this.reprintButton.Click += new EventHandler(OnReprintButton_Click);
this.invalidButton.Click += new EventHandler(OnInvalidButton_Click);
this.Parent.KeyUp += new KeyEventHandler(OnFinishedReport_KeyUp);
this.BarcodeDetails.Click += new EventHandler(OnBarcodeDetails_Click);
this.proBillCodeEdit.KeyPress += new KeyPressEventHandler(OnproBillCodeEdit_KeyPress);
this.proBillCodeEdit.GotFocus += new EventHandler(OnproBillCodeEdit_GotFocus);
this.proBillCodeEdit.LostFocus += new EventHandler(OnproBillCodeEdit_LostFocus);
}
#region 生产单号失去焦点
private void OnproBillCodeEdit_LostFocus(object sender, EventArgs e)
{
proBillCodeEdit.BackColor = Color.White;
string orderNo = this.proBillCodeEdit.Text.Trim();//扫描信息
double density = 0;
string strSql = "select PSin201 from P_ProductSpeciesTab where SpeciesName='纸芯'";
DataTable table = SqlHelper.ExecuteDataTable(strSql);
DataRow row = table != null && table.Rows.Count > 0 ? table.Rows[0] : null;
if (row != null) density = Convert.ToDouble(row["PSin201"].ToString());
strSql = "select ISNULL(JCMD,0) as JCMD from mps_planTaskListTab a left join p_ProductTab b on a.mps_lpt_productid=b.ProductId ";
strSql = strSql + " left join (select SpeciesNo,PSin201 as JCMD from p_productspeciestab where left(SpeciesNo,4)='0102') c on b.SpeciesNo=c.SpeciesNo";
strSql = strSql + " where mps_lpt_RwlNO='" + density + "' ";
table = SqlHelper.ExecuteDataTable(strSql);
row = table != null && table.Rows.Count > 0 ? table.Rows[0] : null;
if (row != null) materialDensity = Convert.ToDouble(row["JCMD"].ToString());
if (materialDensity != 0)
{
strSql = "select a.*,b.appellation,b.model,b.width,b.height,b.spec,b.Productunitname,c.crm_lco_billdocument_id, ";
strSql = strSql + " isnull(e.CoAlias,'') as CoName,d.crm_mco_operatedate,f.SpeciesName,b.mes_ws_id,isnull(e.Coid,'') as KHdm,isnull(a3.FName,'') as CPDALX ";
strSql = strSql + " from mps_planTaskListTab a join mps_planTaskMainTab a1 on a.mps_lpt_billdocument_id=a1.mps_mpt_billdocument_id left join p_ProductTab b on a.mps_lpt_productid=b.ProductId ";
strSql = strSql + " from mps_planTaskListTab a join mps_planTaskMainTab a1 on a.mps_lpt_billdocument_id=a1.mps_mpt_billdocument_id left join p_ProductTab b on a.mps_lpt_productid=b.ProductId ";
strSql = strSql + " left join Crm_BillcoListTab c on a.mps_lpt_selloid=c.crm_lco_id ";
strSql = strSql + " left join Crm_BillcoMaintab d on c.crm_lco_billdocument_id=d.crm_mco_billdocument_id ";
strSql = strSql + " left join P_CustomerTab e on d.crm_mco_shclientid=e.id ";
strSql = strSql + " left join p_ProductTab a2 on a.mps_lpt_cpproductid=a2.ProductId ";
strSql = strSql + " left join p_messageTab a3 on isnull(a2.PStr204,'')=a3.FNUmber ";
strSql = strSql + " left join P_EmployeeSpecTab f on d.crm_mco_zzjgdm=f.SpeciesNo where mps_lpt_RwlNO='"+ orderNo + "' ";
table = SqlHelper.ExecuteDataTable(strSql);
row = table != null && table.Rows.Count > 0 ? table.Rows[0] : null;
if (row != null)
{
customerCode = row["KHdm"].ToString();
productFileType = row["CPDALX"].ToString();
proBillCodeEdit.Text = orderNo;
customerEdit.Text = row["CoName"].ToString();
substrateName.Text = row["appellation"].ToString();
broadening.Text = row["width"].ToString();
thickness.Text = row["height"].ToString();
taskWeight.Text = row["mps_lpt_amount"].ToString();
specEdit.Text = row["spec"].ToString();
substrateApplication.Text = row["mps_lpt_cpapper"].ToString();
paperCoreWeight.Text = string.Format("0,0", Convert.ToDouble(Convert.ToDouble(this.broadening.Text) * density / 1000));
paperCoreWeight.SelectAll();
paperCoreWeight.Focus();
Change = false;
}
else
{
MessageUtil.Show("请与生产计划人员联系,是否此任务已经作废-01 !");
this.proBillCodeEdit.Text = "";
this.paperCoreWeight.Text = "";
this.substrateName.Text = "";
this.broadening.Text = "";
this.thickness.Text = "";
this.taskWeight.Text = "";
this.specEdit.Text = "";
this.paperCoreWeight.Text = "";
this.grossWeight.Text = "";
this.netWeight.Text = "";
this.proMachineEdit.Text = "";
this.proPersonEdit.Text = "";
this.length.Text = "";
this.joint.Text = "";
this.numberOfSlices.Text = "";
this.substrateApplication.Text = "";
this.proMachineEdit.Tag = "0";
this.proPersonEdit.Tag = "0";
this.personName.Text = "";
paperCoreWeight.SelectAll();
paperCoreWeight.Focus();
}
}
}
#endregion
#region 生产单号获得焦点
private void OnproBillCodeEdit_GotFocus(object sender, EventArgs e)
{
proBillCodeEdit.BackColor = Color.Yellow;
}
#endregion
#region 生产单号键盘点击
private void OnproBillCodeEdit_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar.Equals("13") && !string.IsNullOrWhiteSpace(this.proBillCodeEdit.Text))
{
string orderNo = this.proBillCodeEdit.Text.Trim();//扫描信息
double density = 0;
string strSql = "select a.*,b.appellation,b.model,b.width,b.height,b.spec,b.Productunitname,c.crm_lco_billdocument_id, ";
strSql = strSql + " isnull(e.CoAlias,'') as CoName,d.crm_mco_operatedate,f.SpeciesName,b.mes_ws_id,isnull(e.Coid,'') as KHdm,isnull(a3.FName,'') as CPDALX ";
strSql = strSql + " from mps_planTaskListTab a join mps_planTaskMainTab a1 on a.mps_lpt_billdocument_id=a1.mps_mpt_billdocument_id left join p_ProductTab b on a.mps_lpt_productid=b.ProductId ";
strSql = strSql + " left join Crm_BillcoListTab c on a.mps_lpt_selloid=c.crm_lco_id ";
strSql = strSql + " left join Crm_BillcoMaintab d on c.crm_lco_billdocument_id=d.crm_mco_billdocument_id ";
strSql = strSql + " left join P_CustomerTab e on d.crm_mco_shclientid=e.id ";
strSql = strSql + " left join p_ProductTab a2 on a.mps_lpt_cpproductid=a2.ProductId ";
strSql = strSql + " left join p_messageTab a3 on isnull(a2.PStr204,'')=a3.FNUmber ";
strSql = strSql + " left join P_EmployeeSpecTab f on d.crm_mco_zzjgdm=f.SpeciesNo where mps_lpt_RwlNO='" + orderNo + "' ";
DataTable table = SqlHelper.ExecuteDataTable(strSql);
DataRow row = table != null && table.Rows.Count > 0 ? table.Rows[0] : null;
if (row != null)
{
customerCode = row["KHdm"].ToString();
productFileType = row["CPDALX"].ToString();
proBillCodeEdit.Text = orderNo;
customerEdit.Text = row["CoName"].ToString();
substrateName.Text = row["appellation"].ToString();
broadening.Text = row["width"].ToString();
thickness.Text = row["height"].ToString();
taskWeight.Text = row["mps_lpt_amount"].ToString();
specEdit.Text = row["spec"].ToString();
substrateApplication.Text = row["mps_lpt_cpapper"].ToString();
paperCoreWeight.Text = string.Format("0,0", Convert.ToDouble(Convert.ToDouble(this.broadening.Text) * density / 1000));
paperCoreWeight.SelectAll();
paperCoreWeight.Focus();
Change = false;
}
else
{
MessageUtil.Show("请与生产计划人员联系,是否此任务已经作废-01 !");
this.proBillCodeEdit.Text = "";
this.paperCoreWeight.Text = "";
this.substrateName.Text = "";
this.broadening.Text = "";
this.thickness.Text = "";
this.taskWeight.Text = "";
this.specEdit.Text = "";
this.paperCoreWeight.Text = "";
this.grossWeight.Text = "";
this.netWeight.Text = "";
this.proMachineEdit.Text = "";
this.proPersonEdit.Text = "";
this.length.Text = "";
this.joint.Text = "";
this.numberOfSlices.Text = "";
this.substrateApplication.Text = "";
this.proMachineEdit.Tag = "0";
this.proPersonEdit.Tag = "0";
this.personName.Text = "";
paperCoreWeight.SelectAll();
paperCoreWeight.Focus();
}
}
}
#endregion
#region gridcontrolEx点击
private void OnBarcodeDetails_Click(object sender, EventArgs e)
{
this.formatButton.Enabled = true;
this.previewButton.Enabled = true;
this.reprintButton.Enabled = true;
this.invalidButton.Enabled = true;
}
#endregion
#region 快捷键F12F2
private void OnFinishedReport_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F2)
{
if (Convert.ToSingle(this.netWeight.Text) > 0)
{
DialogResult result = MessageUtil.Show("数据未保存,是否新增!", MessageBoxButtons.OKCancel);
if (result == DialogResult.OK)
{
AfterAdd();
this.netWeight.Enabled = true;
this.netWeight.Focus();
}
}
}
if (e.KeyCode == Keys.F12)
{
this.saveButton.PerformClick();
}
}
#endregion
#region 事件
#region 保存按钮点击事件
/// <summary>
/// <para>说明:保存方法</para>
/// <para>创建人:曹屹峰</para>
/// <para>创建日期:2021-12-6 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void OnSaveButton_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(this.proBillCodeEdit.Text))
{
MessageUtil.Show("[生产单号]信息有误!");
this.proBillCodeEdit.Focus();
return;
}
if (string.IsNullOrEmpty(this.netWeight.Text) && int.Parse(this.netWeight.Text) < 0)
{
MessageUtil.Show("[净重]不能<= 0");
this.grossWeight.Focus();
return;
}
if (Convert.ToSingle(this.netWeight.Text) > 5000)
{
MessageUtil.Show("[每箱数量]*[标准箱数]+[尾箱数量]>[剩余数量]+ 5000");
this.grossWeight.Focus();
return;
}
if (string.IsNullOrEmpty(this.proGroupEdit.Tag + ""))
{
MessageUtil.Show("无[生产班组]信息!");
this.proGroupEdit.Focus();
return;
}
if (string.IsNullOrEmpty(this.proMachineEdit.Tag + ""))
{
MessageUtil.Show("无[生产机台]信息!");
this.proMachineEdit.Focus();
return;
}
if (string.IsNullOrEmpty(this.proPersonEdit.Tag + ""))
{
MessageUtil.Show("无[生产人员]信息!");
this.proPersonEdit.Focus();
return;
}
if (string.IsNullOrEmpty(this.length.Text) && int.Parse(this.length.Text) == 0)
{
MessageUtil.Show("[长度]不能为0");
this.length.Focus();
return;
}
//保存
SqlParameter ErrMsg = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 250);
ErrMsg.Direction = ParameterDirection.Output;//输出参数
SqlParameter retval = new SqlParameter("retval", SqlDbType.Int, 4);
retval.Direction = ParameterDirection.ReturnValue;//返回值
SqlParameter[] param ={
new SqlParameter("@FDate",SqlDbType.Char,250),
new SqlParameter("@text21",SqlDbType.VarChar,250),
new SqlParameter("@text2",SqlDbType.VarChar,250),
new SqlParameter("@text3",SqlDbType.VarChar,12),
new SqlParameter("@text4",SqlDbType.VarChar,12),
new SqlParameter("@text5",SqlDbType.VarChar,12),
new SqlParameter("@Label13",SqlDbType.Float,250),
new SqlParameter("@Label14",SqlDbType.Float,250),
new SqlParameter("@Label20",SqlDbType.Float,250),
new SqlParameter("@textA12",SqlDbType.VarChar,12),
new SqlParameter("@textA8",SqlDbType.VarChar,12),
new SqlParameter("@textA9",SqlDbType.VarChar,12),
new SqlParameter("@textA10",SqlDbType.VarChar,12),
new SqlParameter("@text1",SqlDbType.VarChar,250),
new SqlParameter("@Combo1",SqlDbType.VarChar,250),
new SqlParameter("@Combo2",SqlDbType.VarChar,250),
retval,
ErrMsg,
};
param[0].Value = this.dateTimeEdit.Value;
param[1].Value = this.barCodeEdit.Text;
param[2].Value = this.proBillCodeEdit.Text;
param[3].Value = Convert.ToSingle(this.customerEdit.Text);
param[4].Value = Convert.ToSingle(this.substrateName.Text);
param[5].Value = Convert.ToSingle(this.broadening.Text);
param[6].Value = this.proGroupEdit.Tag + "";//生产班组隐藏值
param[7].Value = this.proMachineEdit.Tag + "";//生产机台隐藏值
param[8].Value = this.proPersonEdit.Tag + "";//生产人员隐藏值
param[9].Value = this.volumeNumber.Text.Trim();
param[10].Value = this.length.Text;
param[11].Value = this.joint.Text.Trim();
param[12].Value = this.numberOfSlices.Text.Trim();
param[13].Value = this.substrateApplication.Text.Trim();
param[14].Value = this.processingSurface.Text.Trim();
param[15].Value = this.changeShifts.Text.Trim();
SqlCommand cmd = SqlHelper.ExecuteCommand(CommandType.StoredProcedure, "Inter_Mes_JCProcRptTab", param);//执行新增存储过程返回sqlCommand获取返回值
if (!string.IsNullOrEmpty(cmd.Parameters["@ErrMsg"].Value + ""))
{
MessageUtil.Show(cmd.Parameters["@ErrMsg"].Value + "");
}
long JL = 0;
string strSql = string.Format("select count(FBarCode) as JL from Mes_JCProcRptTab where FBarCode='{0}'", this.barCodeEdit.Text);
DataRow row = SqlHelper.ExecuteDataTable(strSql).Select().FirstOrDefault();
if (row != null)
{
JL = row.Table.Columns.Contains("JL") ? Convert.ToInt64(row["JL"]) : 0;
}
if (JL > 0)
{
this.saveButton.Enabled = false;
FSCBillNo = this.barCodeEdit.Text.Trim();
if (!string.IsNullOrEmpty(FSCBillNo))
{
ReportPrint(1, FSCBillNo, "");
}
AfterAdd();
this.proBillCodeEdit.Focus();
}
else
{
MessageUtil.Show("保存失败,请重新保存!");
this.saveButton.Focus();
}
}
#endregion
#region 新增按钮点击事件
/// <summary>
/// <para>说明:新增按钮点击事件</para>
/// <para>创建人:唐德馨</para>
/// <para>创建日期:2021-12-1 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void OnAddBtn_Click(object sender, EventArgs e)
{
if (Convert.ToSingle(this.netWeight.Text) > 0)
{
DialogResult result = MessageUtil.Show("数据未保存,是否新增!", MessageBoxButtons.OKCancel);
if (result == DialogResult.OK)
{
AfterAdd();
this.substrateApplication.Enabled = true;
this.substrateApplication.Focus();
}
}
}
#endregion
#region 预览按钮点击事件
/// <summary>
/// <para>说明:预览点击事件</para>
/// <para>创建人:曹屹峰</para>
/// <para>创建日期:2021-12-1 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void OnPreviewButton_Click(object sender, EventArgs e)
{
if (BarcodeDetails.GridControl.DataSource == null && (BarcodeDetails.GridControl.DataSource as DataTable).Rows.Count == 0) return;
FSCBillNo = "";
DataTable gridTable = (this.BarcodeDetails.GridControl.DataSource as DataTable).TrimDeleteRows();
FSCBillNo = gridTable.Rows[BarcodeDetails.GridView.FocusedRowHandle][1].ToString();//第一列
if (!string.IsNullOrWhiteSpace(FSCBillNo)) ReportPrint(0, FSCBillNo, "");
}
#endregion
#region 设计格式点击事件
/// <summary>
/// <para>说明:设计格式点击事件</para>
/// <para>创建人:曹屹峰</para>
/// <para>创建日期:2021-12-1 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void OnFormatButton_Click(object sender, EventArgs e)
{
if (BarcodeDetails.GridControl.DataSource == null && (BarcodeDetails.GridControl.DataSource as DataTable).Rows.Count == 0) return;
FrmLogin frmLogin = new FrmLogin();
DialogResult dialogResult = frmLogin.ShowDialog();
if (dialogResult == DialogResult.OK)
{
string passwordEncrypt = "NkFDN0NBQkNEMjBFRTAxRTBGMkY4OTVEMTBBNjEwMDc=";
if (frmLogin.passwordStr.Equals(AESUtil.Decrypt(passwordEncrypt)))
{
FSCBillNo = "";
DataTable gridTable = (this.BarcodeDetails.GridControl.DataSource as DataTable).TrimDeleteRows();
FSCBillNo = gridTable.Rows[BarcodeDetails.GridView.FocusedRowHandle][1].ToString();//第一列
if (!string.IsNullOrWhiteSpace(FSCBillNo)) ReportPrint(2, FSCBillNo, "");
}
else
MessageUtil.Show("不允许进行[标签设计] ");
}
}
#endregion
#region 重打按钮点击事件
/// <summary>
/// <para>说明:重打点击事件</para>
/// <para>创建人:曹屹峰</para>
/// <para>创建日期:2021-12-1 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void OnReprintButton_Click(object sender, EventArgs e)
{
if (BarcodeDetails.GridControl.DataSource == null && (BarcodeDetails.GridControl.DataSource as DataTable).Rows.Count == 0) return;
FSCBillNo = "";
DataTable gridTable = (this.BarcodeDetails.GridControl.DataSource as DataTable).TrimDeleteRows();
FSCBillNo = gridTable.Rows[BarcodeDetails.GridView.FocusedRowHandle][1].ToString();//第一列
if (!string.IsNullOrWhiteSpace(FSCBillNo)) ReportPrint(1, FSCBillNo, "");
}
#endregion
#region 作废按钮点击事件
/// <summary>
/// <para>说明:作废按钮点击事件</para>
/// <para>创建人:曹屹峰</para>
/// <para>创建日期:2021-12-1 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void OnInvalidButton_Click(object sender, EventArgs e)
{
if (BarcodeDetails.GridControl.DataSource != null && (BarcodeDetails.GridControl.DataSource as DataTable).Rows.Count > 0)
{
FSCBillNo = "";
int selectNum = this.BarcodeDetails.GridView.FocusedRowHandle;
DataTable gridTable = (this.BarcodeDetails.GridControl.DataSource as DataTable).TrimDeleteRows();
FSCBillNo = gridTable.Rows[BarcodeDetails.GridView.FocusedRowHandle][1].ToString();//第一列
if (selectNum <= 0) return;
DialogResult result = MessageUtil.Show(string.Format("是否删除条码号[{0}]", FSCBillNo), MessageBoxButtons.OKCancel);
if (result == DialogResult.OK)
{
string strSql = string.Format("select * from Mes_JCProcRptTab where FBarCode='{0}' AND Ban=1", FSCBillNo);
DataTable table = SqlHelper.ExecuteDataTable(strSql);
if (table != null && table.Rows.Count > 0)
{
MessageUtil.Show("已经进行后续操作,不能作废");
return;
}
strSql = string.Format("UPDATE Mes_JCProcRptTab set Delid=1 WHERE FBarCode='{0}' AND isnull(Delid,0)='0'", FSCBillNo);
SqlHelper.ExecuteNonQuery(strSql);
}
}
Change = false;
this.invalidButton.Enabled = false;
}
#endregion
#endregion
#region 打印条码方法
/// <summary>
/// <para>说明:打印条码方法</para>
/// <para>创建人:唐德馨</para>
/// <para>创建日期:2021-12-1 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void ReportPrint(int index, string inSCBillNO, String newBarCode)
{
string printTemplateName = string.Empty;//打印模板名
string printerName = string.Empty;//打印机名
string strSql = string.Format("select * from P_CustomerTab where Coid='{0}'", customerCode);
DataRow dataRow = SqlHelper.ExecuteDataTable(strSql).Select().FirstOrDefault();
if (dataRow != null)
printTemplateName = dataRow["str4"] + "";
if (string.IsNullOrEmpty(printTemplateName) && !string.IsNullOrEmpty(customerCode))
{
MessageUtil.Show("[客户档案]的[吹膜标签]未设置!");
return;
}
printerName = IniHelper.Read("永盛参数设置.ini", "吹膜条码打印", "标签打印机名");//标签打印机名
string setSqlStr = string.Format("exec JJM_JCBarCodePrint '{0}'", inSCBillNO);
DataSet dataset = SqlHelper.ExecuteDataSet(setSqlStr);
System.Data.DataView dataView = new System.Data.DataView();
dataView.Table = dataset.Tables[0];
rmReport.ModifyPrepared = false;
rmReport.Init(this.Parent as System.Windows.Forms.Form, TxRMReportType.rmrtReport);//第一个参数设置问题
rmReport.PreviewOptions.BtnDesignVisible = true;
rmReport.AddDataSet(dataView, "数据源");
rmReport.LoadFromFile(string.Format("{0}.rmf", printTemplateName)); //SimpleList.rmf
switch (index)
{
case 0:
rmReport.ShowReport();
break;
case 1:
rmReport.PrinterName = printerName;
rmReport.ShowPrintDialog = false;
rmReport.PrintReport();
break;
case 2:
rmReport.DesignReport();
break;
}
}
#endregion
#region 复位新增方法
/// <summary>
/// <para>说明:复位新增</para>
/// <para>创建人:唐德馨</para>
/// <para>创建日期:2021-12-1 </para>
/// <para>修改人:</para>
/// <para>修改日期:</para>
/// <para>修改备注:</para>
/// <para>版本:1.0</para>
/// </summary>
private void AfterAdd()
{
SqlParameter NoStr = new SqlParameter("@NoStr", SqlDbType.VarChar, 250);
NoStr.Direction = ParameterDirection.Output;//输出参数
SqlParameter retval = new SqlParameter("retval", SqlDbType.Int, 4);
retval.Direction = ParameterDirection.ReturnValue;//返回值
SqlParameter[] param = {
new SqlParameter("@NoName", SqlDbType.VarChar, 250),
NoStr,
retval,
};
param[0].Value = "吹膜条码";
SqlCommand cmd = SqlHelper.ExecuteCommand(CommandType.StoredProcedure, "Pac_Mis_GetNo", param);//执行新增存储过程返回sqlCommand获取返回值
this.barCodeEdit.Text = "01-" + cmd.Parameters["NoStr"].Value + "";
this.dateTimeEdit.Value = DateTime.Now.Date;
this.dateTimeEdit.Format = DateTimePickerFormat.Short;
this.proBillCodeEdit.Text = "";
this.paperCoreWeight.Text = "";
this.substrateName.Text = "";
this.broadening.Text = "";
this.thickness.Text = "";
this.taskWeight.Text = "";
this.specEdit.Text = "";
this.paperCoreWeight.Text = "";
this.grossWeight.Text = "";
this.netWeight.Text = "";
this.proMachineEdit.Text = "";
this.proPersonEdit.Text = "";
this.length.Text = "";
this.joint.Text = "";
this.numberOfSlices.Text = "";
this.substrateApplication.Text = "";
this.proMachineEdit.Tag = "0";
this.proPersonEdit.Tag = "0";
this.personName.Text = "";
this.saveButton.Enabled = true;
}
#endregion
}
}