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

171 lines
5.8 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Model;
using DCS.Place;
namespace QMAPP.WinForm.Forms.TianJin
{
public partial class TJFrmCarCardPrintShow : Form
{
public TJFrmCarCardPrintShow()
{
InitializeComponent();
}
private string pasterkey = "";
public TJFrmCarCardPrintShow(string pastecardkey)
{
pasterkey = pastecardkey;
InitializeComponent();
}
TJEPasteCard pastecard;
string ptroducttype = "";
string printtype = "";
public bool isprint = false;
public TJFrmCarCardPrintShow(TJEPasteCard ppaste, string pstrprodtype, string pprinttype)
{
printtype = pprinttype;
pastecard = ppaste;
ptroducttype = pstrprodtype;
InitializeComponent();
}
public void getdate()
{
dgvMat.DataMember = null;
dgvMat.DataSource = pastecard.DetailsCardlist;
}
/// <summary>
/// 打印
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnPrint_Click(object sender, EventArgs e)
{
try
{
if (printtype == "手动")
{
PrintPasteCard prin = new PrintPasteCard();
DataTable dt = new DataTable();
dt.Columns.Add("ROWINDEX");
dt.Columns.Add("VWSEQ");
dt.Columns.Add("VIN");
dt.Columns.Add("PRODNO");
dt.Columns.Add("CARSETDESCCN");
dt.Columns.Add("CP5A");
dt.Columns.Add("PASTECARDNO");
dt.Columns.Add("SCANDATE");
dt.Columns.Add("PRODUCTIONNAME");
dt.Columns.Add("LINENO");
int index = 1;
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
DataTable tbl = agent.InvokeServiceFunction<DataTable>(QMAPP.ServicesAgent.FrmPlaceManage.TJFrmPlaceBLL_GetPastecardDeatis.ToString());
for (var i = 0; i < dgvMat.Rows.Count; i++)
{
DataRow ncsdr = dt.NewRow();
ncsdr["ROWINDEX"] = index.ToString(); ;
ncsdr["VWSEQ"] = pastecard.DetailsCardlist[i].VWSEQ;
ncsdr["VIN"] = pastecard.DetailsCardlist[i].VIN;
ncsdr["PRODNO"] = pastecard.DetailsCardlist[i].PRODNO;
ncsdr["CARSETDESCCN"] = pastecard.DetailsCardlist[i].CARSETDESC_CN;
ncsdr["CP5A"] = pastecard.DetailsCardlist[i].CP5A;
//ncsdr["PASTECARDNO"] = pastecard.PLANTNAME+pastecard.PASTECARDNO;
ncsdr["SCANDATE"] = pastecard.DetailsCardlist[i].SCANDATE;
ncsdr["PRODUCTIONNAME"] = ptroducttype;
ncsdr["LINENO"] = pastecard.DetailsCardlist[i].LINENO;
dt.Rows.Add(ncsdr);
index++;
}
prin.Print(dt);
}
else
{
PrintPasteCard prin = new PrintPasteCard();
DataTable dt = (DataTable)dgvMat.DataSource;
prin.Print(dt);
}
isprint = true;
this.label1.Text = "消息提示:打印完成";
this.tsslblMessage.Text = "消息提示:打印完成";
btnPrint.Enabled = false;
this.Close();
TJFrmPlace fplace = (TJFrmPlace)this.Owner;
fplace.GetInitData();
fplace.GetInitData2();
//fplace.dgvNF.DataSource = new List<EPasteDetailsCard>();
//nfpastecard = null;
//nflist = null;
//nfindex = 0;
//dgvrowindex = 0;
}
catch (Exception ex)
{
isprint = false;
btnPrint.Enabled = true;
MessageBox.Show("打印失败!");
}
}
/// <summary>
/// 关闭
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnClose_Click(object sender, EventArgs e)
{
#region
try
{
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
#endregion
}
/// <summary>
/// 页面加载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void FrmCarCardPrintShow_Load(object sender, EventArgs e)
{
#region
try
{
btnPrint.Enabled = true;
if (printtype == "手动")
{
ITEMNO.Visible = false;
getdate();
}
else
{
QMAPP.ServicesAgent.ServiceAgent agent = ClientContext.GetServiceAgent();
DataTable tbl = agent.InvokeServiceFunction<DataTable>(QMAPP.ServicesAgent.FrmPlaceManage.TJFrmPlaceBLL_GetPascardDetailsByPid.ToString(), pasterkey);
dgvMat.DataSource = tbl;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
#endregion
}
}
}