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

172 lines
6.4 KiB

using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using Model;
using QMAPP.WinForm.Forms.DisPatch;
namespace DCS.Place
{
public class PrintPasteCard
{
/// <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, EPasteCard nfpastecard, string producttype)
{
DataTable dt = CreateTablePrepre();
//BllFisOrder fisorder = new BllFisOrder();
//DataTable tbl = fisorder.GetPastecardDeatis();
//int strindex = int.Parse (tbl.Rows[0][0].ToString());
foreach (EPasteDetailsCard 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);
}
PastCard cr = new PastCard();
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)
{
// DataTable dt = CreateTablePrepre();
//string pastecardno="";
//string paste_card_key = "";
// foreach (DataRow currrow in printdt .Rows )
// {
// DataRow ncsdr = dt.NewRow();
//ncsdr["ROWINDEX"] = currrow["ROWINDEX"];
// ncsdr["VIN"] = currrow["VIN"];
//ncsdr["PRODNO"] = currrow["PRODNO"];
//ncsdr["CARSETDESC_CN"] = currrow["CARSETDESC_CN"];
//ncsdr["CP5A"] = currrow["CP5A"];
//ncsdr["PASTECARDNOYS"] = currrow["PASTECARDNO"];
//pastecardno=currrow["PASTECARDNO"].ToString ();
//ncsdr["PASTECARDNO"] = "*" + currrow["PASTECARDNO"] + "*";
//ncsdr["PASTECARDNOSUB"] = currrow["PASTECARDNO"].ToString().Substring(currrow["PASTECARDNO"].ToString ().Length - 4);
//ncsdr["SCANDATE"] = DateTime.Now.ToString();
//ncsdr["LINENO"] = currrow["LINENO"];
//ncsdr["INDEXNUMBER"] = currrow["VWSEQ"];
//paste_card_key = currrow["PASTE_CARD_KEY"].ToString ();
//if (currrow["PRODUCTIONNAME"].ToString() == "01")
//{
// ncsdr["PRODUCTIONNAME"] = "混";
//}
//if (currrow["PRODUCTIONNAME"].ToString() == "02")
//{
// ncsdr["PRODUCTIONNAME"] = "单";
//}
// dt.Rows.Add(ncsdr);
// }
//if (!string.IsNullOrEmpty(pastecardno))
//{
// EFailLog log = new EFailLog();
// log.TID = Guid.NewGuid().ToString();
// log.FCT_DATE = DateTime.Now;
// log.FCT_NO = paste_card_key;
// log.FCT_OPER = QM.Account.UserBuffer.UserCode;
// log.FCT_OPERTYPE = 1;
// log.FCT_REASON = "贴车单补打印操作";
// //BllFisOrder bllFisOrder = new BllFisOrder();
// //bllFisOrder.UpdataBarcodeDate(pastecardno);
// // bllFisOrder.InsertLog(log);
// QMAPP.ServicesAgent.ServiceAgent agent = QMAPP.WinForm.ClientContext.GetServiceAgent();
// agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_UpdataBarcodeDate.ToString(), pastecardno);
// agent.InvokeServiceFunction(QMAPP.ServicesAgent.FrmPlaceManage.FrmPlaceBLL_InsertLog.ToString(), log);
//}
PastCard cr=null;
try
{
cr = new PastCard();
// printdt.TableName = "text";
cr.SetDataSource(printdt); //为报表的数据表填充记录
cr.PrintToPrinter(1, false, 0, 0);
}
catch (Exception ex)
{
QMAPP.WinForm.WriteLog.WriteError(ex.Message);
}
finally
{
if (cr != null)
{
cr.Close();
cr.Dispose();
}
}
}
}
}