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.
183 lines
6.4 KiB
C#
183 lines
6.4 KiB
C#
using Estsh.Client.ZPLPrinter;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
|
|
namespace Estsh.Client
|
|
{
|
|
public partial class FrmReprint : Form
|
|
{
|
|
/// <summary>
|
|
/// 业务逻辑处理对象
|
|
/// </summary>
|
|
private MesApp _app = null;
|
|
private List<dynamic> _snData = null;
|
|
|
|
private string stationType = string.Empty;
|
|
private int terminalID = 0;
|
|
|
|
public FrmReprint()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
public FrmReprint(MesApp app)
|
|
: this()
|
|
{
|
|
_app = app;
|
|
|
|
}
|
|
/// <summary>
|
|
/// 加载界面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void FrmReprint_Load(object sender, EventArgs e)
|
|
{
|
|
dgvData.AutoGenerateColumns = false;
|
|
terminalID = Convert.ToInt32(ConfigurationManager.AppSettings["TerminalID"]);
|
|
stationType = _app.stationType(terminalID.ToString());
|
|
if (stationType.ToUpper() == "B" || stationType.ToUpper() == "A")
|
|
{
|
|
rbQA.Visible = false;
|
|
}
|
|
else if (stationType.ToUpper() == "C")
|
|
{
|
|
rbSN.Visible = false;
|
|
rbQA.Checked = true;
|
|
}
|
|
else
|
|
{
|
|
rbQA.Visible = false;
|
|
rbSN.Visible = false;
|
|
cmdSearch.Visible = false;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void cmdSearch_Click(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(txtSN.Text.Trim()))
|
|
{
|
|
_snData = _app.GetTailSN((int)nudCount.Value, terminalID, !rbQA.Checked, txtSN.Text.Trim());
|
|
}
|
|
else
|
|
{
|
|
_snData = _app.GetTailSN((int)nudCount.Value, terminalID, !rbQA.Checked);
|
|
|
|
}
|
|
|
|
dgvData.DataSource = _snData;
|
|
}
|
|
/// <summary>
|
|
/// 打印
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void dgvData_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
string SerialNumber = null;
|
|
|
|
|
|
|
|
SerialNumber = _snData[e.RowIndex]["serial_number"].ToString();
|
|
|
|
|
|
if (MessageBox.Show("是否补打条码?", "Reprint", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
|
|
{
|
|
// 更新条码的补打次数
|
|
_app.UpdateSNReprintStatus(SerialNumber);
|
|
|
|
_app.insertSNReprint(SerialNumber, terminalID);
|
|
|
|
string RePrintList = _app.validataLimit("GYRePrintTerminalList");
|
|
string RePrints = _app.validataList("YYRePrintTerminalList");
|
|
if (RePrintList.Contains(terminalID.ToString()) && !terminalID.ToString().Equals("0"))
|
|
{
|
|
//贵阳
|
|
//查询打印条码需要的信息
|
|
List<dynamic> dtLabel = _app.GetPrintSNRE(SerialNumber);
|
|
string printIP = "";
|
|
PrintSNByZPL zplPrinter = new PrintSNByZPL();
|
|
printIP = _app.GetPrintIP(terminalID.ToString());
|
|
zplPrinter.PrintSerialNumber(dtLabel, "GYQA", printIP, 9100, 1);
|
|
}
|
|
else if (RePrints.Contains(terminalID.ToString()) && !terminalID.ToString().Equals("0"))
|
|
{
|
|
//余姚
|
|
//补打过程条码
|
|
if (rbSN.Checked || rbQA.Checked)
|
|
{
|
|
DataRow Row = _app.GetSN(SerialNumber);
|
|
string part_location = Row["part_location"].ToString();
|
|
string typeName = Row["type_name"].ToString();
|
|
string Bcode = string.Empty;
|
|
string BcodeText = string.Empty;
|
|
//if (part_location == "08" || part_location == "09" || part_location == "10" || part_location == "11" || part_location == "12" || part_location == "13" || part_location == "14")
|
|
//{
|
|
// Bcode = "YYLKQA.BTW";
|
|
// BcodeText = "YYLKQA.TXT";
|
|
//}
|
|
//else
|
|
//{
|
|
// if (typeName == "19D")
|
|
// {
|
|
// Bcode = "YYLKQA.BTW";
|
|
// BcodeText = "YYLKQA.TXT";
|
|
// }
|
|
// else
|
|
// {
|
|
// Bcode = "YYJLQA.BTW";
|
|
// BcodeText = "YYJLQA.TXT";
|
|
// }
|
|
//}
|
|
if (typeName == "SX12")
|
|
{
|
|
Bcode = "YYJLQA.BTW";
|
|
BcodeText = "YYJLQA.TXT";
|
|
}
|
|
else if (typeName == "MPC")
|
|
{
|
|
Bcode = "YYMPCQA.BTW";
|
|
BcodeText = "YYMPCQA.TXT";
|
|
}
|
|
else
|
|
{
|
|
Bcode = "YYLKQA.BTW";
|
|
BcodeText = "YYLKQA.TXT";
|
|
}
|
|
|
|
Printer.YYPrintSerialNumber(Row, Bcode, BcodeText);
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
// 补打过程条码
|
|
if (rbSN.Checked)
|
|
{
|
|
DataRow Row = _app.GetSN(SerialNumber);
|
|
Printer.PrintSerialNumber(Row, "BS.btw", "BS.txt");
|
|
}
|
|
// 补打合格证
|
|
if (rbQA.Checked)
|
|
{
|
|
Printer.PrintCSN(_app.GetSN(SerialNumber), "QA.btw", "QA.txt");
|
|
|
|
}
|
|
// 补打后排合格证
|
|
if (rbBQA.Checked)
|
|
{
|
|
Printer.PrintSerialNumber(_app.GetBackSN(SerialNumber, terminalID), "BQA.btw", "BQA.txt");
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|