天津投入产出系统后端
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.
 
 
 
 
 
 

152 lines
5.1 KiB

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Model;
using QMAPP.WinForm.Forms.DisPatch;
using QMAPP.WinForm.Forms.TianJin;
namespace DCS.Place
{
public class TJPrintPasteCard
{
/// <summary>
/// 创建汇总列表
/// </summary>
/// <returns></returns>
private DataTable CreateTablePrepre()
{
#region
DataTable table = new DataTable();
table.Columns.Add("ROWINDEX"); //序号
table.Columns.Add("VWSEQ"); //
table.Columns.Add("VIN"); //到货单号条码
table.Columns.Add("PRODNO"); //零件号
table.Columns.Add("CARSETDESCCN"); //总成描述
table.Columns.Add("CP5A");//上线时间
table.Columns.Add("SCANDATE"); //打印时间
table.Columns.Add("PASTECARDNO"); //贴车单号
table.Columns.Add("PASTECARDNOSUB"); //贴车单号
table.Columns.Add("PASTECARDNOYS"); //贴车单号
table.Columns.Add("PRODUCTIONNAME"); //单线混线
table.Columns.Add("LINENO");
return table;
#endregion
}
/// <summary>
/// 外来件打印
/// </summary>
/// <param name="strindex"></param>
/// <param name="nfpastecard"></param>
/// <param name="producttype"></param>
public void Print(int strindex, TJEPasteCard nfpastecard, string producttype)
{
DataTable dt = CreateTablePrepre();
//BllFisOrder fisorder = new BllFisOrder();
//DataTable tbl = fisorder.GetPastecardDeatis();
//int strindex = int.Parse (tbl.Rows[0][0].ToString());
foreach (TJEPasteDetailsCard pastdetail in nfpastecard.DetailsCardlist)
{
DataRow ncsdr = dt.NewRow();
ncsdr["ROWINDEX"] = strindex;
ncsdr["VWSEQ"] = pastdetail.VWSEQ;
ncsdr["VIN"] = pastdetail.VIN;
ncsdr["PRODNO"] = pastdetail.PRODNO;
ncsdr["CARSETDESCCN"] = pastdetail.CARSETDESC_CN;
ncsdr["CP5A"] = pastdetail.CP5A;
ncsdr["PASTECARDNOYS"] = nfpastecard.PASTECARDNO;
ncsdr["PASTECARDNO"] = nfpastecard.PASTECARDNO;
ncsdr["PASTECARDNOSUB"] = nfpastecard.PASTECARDNO.Substring(nfpastecard.PASTECARDNO.Length - 4);
ncsdr["SCANDATE"] = DateTime.Now.ToString();
ncsdr["PRODUCTIONNAME"] = producttype;
ncsdr["LINENO"] = pastdetail.LINENO;
dt.Rows.Add(ncsdr);
strindex++;
//fisorder.UpdatePasteDetails(ncsdr["ROWINDEX"].ToString(), pastdetail.PASTEDETAILED_CARD_KEY);
}
TJPastCard cr = new TJPastCard();
try
{
cr.SetDataSource(dt); //为报表的数据表填充记录
//暂时注销
cr.PrintToPrinter(1, false, 0, 0);
}
catch (Exception ex)
{
QMAPP.WinForm.WriteLog.WriteError(ex.Message);
}
finally
{
if (cr != null)
{
cr.Close();
cr.Dispose();
}
}
}
/// <summary>
/// 本地打印
/// </summary>
/// <param name="printdt"></param>
public void Print(DataTable printdt)
{
TJPastCard cr=null;
try
{
cr = new TJPastCard();
// printdt.TableName = "text";
cr.PrintOptions.PrinterName = "";
cr.SetDataSource(printdt); //为报表的数据表填充记录
cr.PrintToPrinter(1, false, 0, 1);
}
catch (Exception ex)
{
QMAPP.WinForm.WriteLog.WriteError(ex.Message);
}
finally
{
if (cr != null)
{
cr.Close();
cr.Dispose();
}
}
}
/// <summary>
/// 本地打印--通过名称-选择打印机
/// </summary>
/// <param name="printdt"></param>
/// <param name="PrinterName"></param>
public void Print(DataTable printdt,string PrinterName)
{
TJPastCard cr = null;
try
{
cr = new TJPastCard();
// printdt.TableName = "text";
cr.PrintOptions.PrinterName = PrinterName;
cr.SetDataSource(printdt); //为报表的数据表填充记录
cr.PrintToPrinter(1, false, 0, 1);
}
catch (Exception ex)
{
QMAPP.WinForm.WriteLog.WriteError(ex.Message);
}
finally
{
if (cr != null)
{
cr.Close();
cr.Dispose();
}
}
}
}
}