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.
252 lines
9.2 KiB
252 lines
9.2 KiB
using gregn6Lib;
|
|
using MESClassLibrary.BLL.Mistake247;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace PurchingMistakeNew
|
|
{
|
|
public class UtilityHelper
|
|
{
|
|
|
|
#region box箱码 打印
|
|
/// <summary>
|
|
/// 247轮眉
|
|
/// </summary>
|
|
/// <param name="type">类型 例如后左,后右</param>
|
|
/// <param name="fB">前后</param>
|
|
/// <param name="lR">左右</param>
|
|
/// <param name="botDisplay">下部显示</param>
|
|
public static void Get247LMBoxPrintDisplay(string type, ref string fB, ref string lR, ref string botDisplay)
|
|
{
|
|
string cfg = ConfigurationManager.AppSettings["PrintDisplayLMBox247"].ToString();
|
|
GetBoxPrintDisplay(cfg, type, ref fB, ref lR, ref botDisplay);
|
|
//if (!string.IsNullOrEmpty(cfg))
|
|
//{
|
|
// string[] grp = cfg.Split(';');
|
|
// foreach(string grpItem in grp)
|
|
// {
|
|
// //前左-前左,轮眉18,FLFLFLFLFLFLFLFLFL
|
|
// string[] grp1 = grpItem.Split('-');
|
|
// if(grp1.Length == 2 && grp1[0] == type)
|
|
// {
|
|
// string[] grp2 = grp1[1].Split(',');
|
|
// if(grp2.Length == 3)
|
|
// {
|
|
// fB = grp2[0];
|
|
// lR = grp2[1];
|
|
// botDisplay = grp2[2];
|
|
// }
|
|
// }
|
|
|
|
// }
|
|
//}
|
|
}
|
|
/// <summary>
|
|
/// 247扰流板
|
|
/// </summary>
|
|
/// <param name="type">类型 例如后左H,后左X 注意需要带H或者X </param>
|
|
/// <param name="fB">前后</param>
|
|
/// <param name="lR">左右</param>
|
|
/// <param name="botDisplay">下部显示</param>
|
|
public static void Get247RLBBoxPrintDisplay(string type, ref string fB, ref string lR, ref string botDisplay)
|
|
{
|
|
string cfg = ConfigurationManager.AppSettings["PrintDisplayRLBBox247"].ToString();
|
|
GetBoxPrintDisplay(cfg, type, ref fB, ref lR, ref botDisplay);
|
|
}
|
|
/// <summary>
|
|
/// 243轮眉
|
|
/// </summary>
|
|
/// <param name="type">类型 例如后左H,后左X 注意需要带H或者X </param>
|
|
/// <param name="fB">前后</param>
|
|
/// <param name="lR">左右</param>
|
|
/// <param name="botDisplay">下部显示</param>
|
|
public static void Get243LMBoxPrintDisplay(string type, ref string fB, ref string lR, ref string botDisplay)
|
|
{
|
|
string cfg = ConfigurationManager.AppSettings["PrintDisplayLMBox243"].ToString();
|
|
GetBoxPrintDisplay(cfg, type, ref fB, ref lR, ref botDisplay);
|
|
}
|
|
private static void GetBoxPrintDisplay(string cfg, string type, ref string fB, ref string lR, ref string botDisplay)
|
|
{
|
|
|
|
if (!string.IsNullOrEmpty(cfg))
|
|
{
|
|
string[] grp = cfg.Split(';');
|
|
foreach (string grpItem in grp)
|
|
{
|
|
//前左-前左,轮眉18,FLFLFLFLFLFLFLFLFL
|
|
string[] grp1 = grpItem.Split('-');
|
|
if (grp1.Length == 2 && grp1[0] == type)
|
|
{
|
|
string[] grp2 = grp1[1].Split(',');
|
|
if (grp2.Length == 3)
|
|
{
|
|
fB = grp2[0];
|
|
lR = grp2[1];
|
|
botDisplay = grp2[2];
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
public static void SetBoxPrintInfo(ref string fileName, string printType, GridppReport report, string printerName, bool is247 = true)
|
|
{
|
|
if (printType == "门板")
|
|
{
|
|
fileName = ReportHelper.GetBoxTemplateNameDoor();
|
|
}
|
|
else if (printType == "轮眉")
|
|
{
|
|
if (is247 == true)
|
|
{
|
|
fileName = ReportHelper.GetBoxTemplateNameWheelBrow247();
|
|
}
|
|
else
|
|
{
|
|
fileName = ReportHelper.GetBoxTemplateNameWheelBrow243();
|
|
}
|
|
}
|
|
else if (printType == "扰流板")
|
|
{
|
|
fileName = ReportHelper.GetBoxTemplateNameSpoiler();
|
|
}
|
|
|
|
report.LoadFromFile(fileName);
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings[printerName].ToString();
|
|
//GetHeadTable = getData;
|
|
|
|
}
|
|
public static void PrintBox(GridppReport report, string fileName, string part, string moudleType, string partType, string carType, Func<DataTable> GetHeadTable)
|
|
{
|
|
DataTable headTable = null;
|
|
if (string.IsNullOrEmpty(fileName))
|
|
{
|
|
report.Register("");
|
|
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
|
|
report.Print(false);
|
|
}
|
|
else
|
|
{
|
|
headTable = GetHeadTable();
|
|
headTable.Columns.Add("QLevel");
|
|
headTable.Columns.Add("FB");
|
|
headTable.Columns.Add("LR");
|
|
headTable.Columns.Add("Dis");
|
|
foreach (DataRow dr in headTable.Rows)
|
|
{
|
|
string qlevel = GetQLevel(part);
|
|
dr["QLevel"] = qlevel;
|
|
}
|
|
string fb = string.Empty;
|
|
string lr = string.Empty;
|
|
string dis = string.Empty;
|
|
if (partType == "轮眉")
|
|
{
|
|
if (carType.Contains("247"))
|
|
{
|
|
UtilityHelper.Get247LMBoxPrintDisplay(moudleType, ref fb, ref lr, ref dis);
|
|
}
|
|
else if (carType.Contains("243"))
|
|
{
|
|
UtilityHelper.Get243LMBoxPrintDisplay(moudleType, ref fb, ref lr, ref dis);
|
|
}
|
|
}
|
|
else if (partType == "扰流板")
|
|
{
|
|
if (carType.Contains("247"))
|
|
{
|
|
UtilityHelper.Get247RLBBoxPrintDisplay(moudleType, ref fb, ref lr, ref dis);
|
|
}
|
|
}
|
|
headTable.Rows[0]["FB"] = fb;
|
|
headTable.Rows[0]["LR"] = lr;
|
|
headTable.Rows[0]["Dis"] = dis;
|
|
|
|
ReportHelper report2 = new ReportHelper(fileName, headTable, null, (int)GRPaperOrientation.grpoPortrait, 1, report.Printer.PrinterName);
|
|
report2.Report.Printer.PrinterName = report.Printer.PrinterName;
|
|
report2.Report.Print(false);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 标签打印
|
|
public static void SetPrintInfo(ref string fileName, string printType, GridppReport report, string printerName)
|
|
{
|
|
if (printType == "门板")
|
|
{
|
|
fileName = ReportHelper.GetTemplateDoor();
|
|
}
|
|
else if (printType == "扰流板")
|
|
{
|
|
fileName = ReportHelper.GetTemplateSpoiler();
|
|
}
|
|
else if (printType == "轮眉247")
|
|
{
|
|
fileName = ReportHelper.GetTemplateWheelBrow247();
|
|
}
|
|
else if (printType == "轮眉243")
|
|
{
|
|
fileName = ReportHelper.GetTemplateWheelBrow243();
|
|
}
|
|
|
|
|
|
report.LoadFromFile(fileName);
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings[printerName].ToString();
|
|
|
|
}
|
|
|
|
public static void Print(GridppReport report, string fileName, string part, DataTable assembleTable)
|
|
{
|
|
string simplePart = part;
|
|
if (!string.IsNullOrEmpty(part))
|
|
{
|
|
int i = part.IndexOf('.');
|
|
if (i > 0)
|
|
{
|
|
simplePart = part.Substring(0, i);
|
|
}
|
|
}
|
|
DataTable headTable = null;
|
|
if (string.IsNullOrEmpty(fileName))
|
|
{
|
|
report.Register("");
|
|
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
|
|
report.Print(false);
|
|
}
|
|
else
|
|
{
|
|
if (assembleTable.Rows.Count == 0)
|
|
return;
|
|
headTable = assembleTable;
|
|
headTable.Columns.Add("QLevel");
|
|
foreach (DataRow dr in headTable.Rows)
|
|
{
|
|
string qlevel = GetQLevel(simplePart);
|
|
dr["QLevel"] = qlevel;
|
|
}
|
|
|
|
ReportHelper report2 = new ReportHelper(fileName, headTable, null, (int)GRPaperOrientation.grpoPortrait, 1, report.Printer.PrinterName);
|
|
report2.Report.Printer.PrinterName = report.Printer.PrinterName;
|
|
report2.Report.Print(false);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
public static string GetQLevel(string part)
|
|
{
|
|
RecordBLL bill = new RecordBLL();
|
|
string qlevel = bill.SearchQLevelFromWms("", part);
|
|
return qlevel;
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|