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.
644 lines
28 KiB
644 lines
28 KiB
3 months ago
|
using System;
|
||
|
using System.Collections.Generic;
|
||
|
using System.ComponentModel;
|
||
|
using System.Configuration;
|
||
|
using System.Data;
|
||
|
using System.Diagnostics.Eventing.Reader;
|
||
|
using System.Drawing;
|
||
|
using System.Linq;
|
||
|
using System.Reflection;
|
||
|
using System.Text;
|
||
|
using System.Threading.Tasks;
|
||
|
using System.Windows.Forms;
|
||
|
using System.Windows.Forms.VisualStyles;
|
||
|
using gregn6Lib;
|
||
|
using MESClassLibrary.BLL.BasicInfo;
|
||
|
using MESClassLibrary.BLL.Log;
|
||
|
using MESClassLibrary.BLL.Mistake247;
|
||
|
using MESClassLibrary.Model;
|
||
|
|
||
|
namespace PunchingMistake
|
||
|
{
|
||
|
public partial class FrmScan : Form
|
||
|
{
|
||
|
public FrmScan()
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
}
|
||
|
|
||
|
public static string temppartNo = "";
|
||
|
public static string tempdeviceno = "";
|
||
|
private void FrmScan_Load(object sender, EventArgs e)
|
||
|
{
|
||
|
Control.CheckForIllegalCrossThreadCalls = false;
|
||
|
textBox1.TabIndex = 0;
|
||
|
textBox1.Focus();
|
||
|
textBox1.Enabled = true;
|
||
|
textBox2.Enabled = false;
|
||
|
checkBox1.Visible = true;
|
||
|
panel1.Visible = false;
|
||
|
textBox1.TabIndex = 0;
|
||
|
textBox1.Focus();
|
||
|
|
||
|
//string oldBoxNo = "A2477900588-9149" + "." + "190919" + "." + "000001";
|
||
|
//string BoxNo = oldBoxNo.Substring(0, oldBoxNo.Length - 6) +
|
||
|
// (Convert.ToInt32(oldBoxNo.Substring(oldBoxNo.Length - 6, 6)) + 1).ToString().PadLeft(6, '0');
|
||
|
}
|
||
|
|
||
|
private void textBox1_KeyDown(object sender, KeyEventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if (e.KeyCode == Keys.Enter)
|
||
|
{
|
||
|
if (textBox1.Text.Trim() != "")
|
||
|
{
|
||
|
textBox2.Enabled = true;
|
||
|
textBox2.Focus();
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
MessageBox.Show("请扫描设备条码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void textBox2_KeyDown(object sender, KeyEventArgs e)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if (e.KeyCode == Keys.Enter)
|
||
|
{
|
||
|
MistakeBLL bll = new MistakeBLL();
|
||
|
GridppReport report = new GridppReport();
|
||
|
ColorBLL cbll = new ColorBLL();
|
||
|
AssemblyBLL abll = new AssemblyBLL();
|
||
|
BoxBLL boxbll = new BoxBLL();
|
||
|
BoxModel boxmd = new BoxModel();
|
||
|
AssemblyModel md = new AssemblyModel();
|
||
|
report.Printer.PrinterName = "";
|
||
|
int BoxCount = 0;
|
||
|
string partNo = "";
|
||
|
|
||
|
if (textBox2.Text.Trim() == "")
|
||
|
{
|
||
|
MessageBox.Show("请扫描半成品条码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (textBox2.Text.Length == 20)
|
||
|
{
|
||
|
partNo = textBox2.Text.Substring(0, 10);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
partNo = textBox2.Text.Substring(0, textBox2.Text.IndexOf("."));
|
||
|
}
|
||
|
|
||
|
string deviceNo = textBox1.Text.Trim();
|
||
|
|
||
|
|
||
|
DataTable dt = bll.IsMath(textBox1.Text.Trim(), partNo);
|
||
|
if (dt != null && dt.Rows.Count > 0)
|
||
|
{
|
||
|
//textBox1.Text = "";
|
||
|
//textBox2.Text = "";
|
||
|
|
||
|
#region 根据半成品种类区分打印什么样的条码
|
||
|
|
||
|
if (partNo == "1230002580") //中间扰流板
|
||
|
{
|
||
|
#region 打印箱单不显示
|
||
|
|
||
|
checkBox1.Visible = false;
|
||
|
panel1.Visible = false;
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 打印总成条码和包装箱码
|
||
|
|
||
|
Form1 fr = new Form1();
|
||
|
fr.Show();
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
|
||
|
else
|
||
|
{
|
||
|
#region 根据半成品查找总成零件号
|
||
|
DataTable dt2 = bll.SearchByNo(partNo, deviceNo);
|
||
|
if (dt2 != null && dt2.Rows.Count > 0)
|
||
|
{
|
||
|
md.PartNo = dt2.Rows[0]["PartNo2"].ToString();
|
||
|
|
||
|
#region 根据总成零件号获取总成描述
|
||
|
if (md.PartNo == "A2477204706" || md.PartNo == "A2477305403" || md.PartNo == "A2477204606" ||
|
||
|
md.PartNo == "A2477305303")
|
||
|
{
|
||
|
md.Des = "装饰条-高光电镀";
|
||
|
}
|
||
|
|
||
|
if (md.PartNo == "A2477204906" || md.PartNo == "A2477305603" || md.PartNo == "A2477204806" ||
|
||
|
md.PartNo == "A2477305503")
|
||
|
{
|
||
|
md.Des = "装饰条-喷涂";
|
||
|
}
|
||
|
|
||
|
if (md.PartNo == "A2477205106" || md.PartNo == "A2477305803" || md.PartNo == "A2477205006" ||
|
||
|
md.PartNo == "A2477305703")
|
||
|
{
|
||
|
md.Des = "装饰条-珍珠镍电镀";
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
md.PartName = dt2.Rows[0]["PartName2"].ToString();
|
||
|
BoxCount = Convert.ToInt32(dt2.Rows[0]["PackCount"].ToString());
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 保存总成条码
|
||
|
|
||
|
|
||
|
md.ID = Guid.NewGuid().ToString();
|
||
|
|
||
|
md.BatchNo = DateTime.Now.ToString("yyyy-MM-dd").Substring(2, 2) +
|
||
|
DateTime.Now.ToString("yyyy-MM-dd").Substring(5, 2) +
|
||
|
DateTime.Now.ToString("yyyy-MM-dd").Substring(8, 2);
|
||
|
|
||
|
#region 根据半成品零件号判断总成类型、总成条码模板、打印机
|
||
|
if (partNo == "1230002601" || partNo == "1230003122")
|
||
|
{
|
||
|
md.PartType = "X247 左侧前门板";
|
||
|
report.LoadFromFile(@"D:\X247 左侧前门板.grf");
|
||
|
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002604" || partNo == "1230003130")
|
||
|
{
|
||
|
md.PartType = "X247 左侧后门板";
|
||
|
report.LoadFromFile(@"D:\X247 左侧后门板.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002602" || partNo == "1230003126")
|
||
|
{
|
||
|
md.PartType = "X247 右侧前门板";
|
||
|
|
||
|
report.LoadFromFile(@"D:\X247 右侧前门板.grf");
|
||
|
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002605" || partNo == "1230003134")
|
||
|
{
|
||
|
md.PartType = "X247 右侧后门板";
|
||
|
report.LoadFromFile(@"D:\X247 右侧后门板.grf");
|
||
|
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002609")
|
||
|
{
|
||
|
md.PartType = "X247 前部左侧轮眉";
|
||
|
report.LoadFromFile(@"D:\X247 前部左侧轮眉.grf");
|
||
|
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002615")
|
||
|
{
|
||
|
md.PartType = "X247 后部左侧后轮眉";
|
||
|
report.LoadFromFile(@"D:\X247 后部左侧后轮眉.grf");
|
||
|
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002612")
|
||
|
{
|
||
|
md.PartType = "X247 前部右侧轮眉";
|
||
|
|
||
|
report.LoadFromFile(@"D:\X247 前部右侧轮眉.grf");
|
||
|
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002617")
|
||
|
{
|
||
|
md.PartType = "X247 右侧后部后轮眉";
|
||
|
|
||
|
report.LoadFromFile(@"D:\X247 右侧后部后轮眉.grf");
|
||
|
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002619")
|
||
|
{
|
||
|
md.PartType = "X247 后部左侧前轮眉";
|
||
|
// report.LoadFromFile(@"D:\X247 后部左侧轮眉.grf");
|
||
|
|
||
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002621")
|
||
|
{
|
||
|
md.PartType = "X247 后部右侧前轮眉";
|
||
|
|
||
|
//report.LoadFromFile(@"D:\X247 后部右侧前轮眉.grf");
|
||
|
|
||
|
//report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002627")
|
||
|
{
|
||
|
md.PartType = "X247 后部左侧扰流板";
|
||
|
|
||
|
report.LoadFromFile(@"D:\X247 后部左侧扰流板眉.grf");
|
||
|
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002600")
|
||
|
{
|
||
|
md.PartType = "X247 后部右侧扰流板";
|
||
|
|
||
|
report.LoadFromFile(@"D:\X247 后部右侧扰流板.grf");
|
||
|
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
md.Color = "通用";
|
||
|
md.ColorNo = "";
|
||
|
md.TapeBatchNo = md.BatchNo;
|
||
|
md.Validity = "3个月";
|
||
|
md.ValidityDate = "从" + DateTime.Now.ToString("yyyy-MM-dd") + "到" +
|
||
|
DateTime.Now.AddMonths(3).ToString("yyyy-MM-dd");
|
||
|
abll.AddInfo(md);
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 打印总成条码
|
||
|
|
||
|
report.Register("");
|
||
|
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
|
||
|
report.Print(false);
|
||
|
|
||
|
abll.UpdateInfo(md);
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
#region 判断是否打印箱单
|
||
|
|
||
|
DataTable pdt = abll.SearchCount(md.PartNo);
|
||
|
if (pdt != null && pdt.Rows.Count >= 0)
|
||
|
{
|
||
|
if (Convert.ToInt32(pdt.Rows[0]["sum"].ToString()) == BoxCount)
|
||
|
{
|
||
|
#region 保存并打印箱单
|
||
|
|
||
|
string BoxNo = "", oldBoxNo = "";
|
||
|
|
||
|
DataTable dt3 = boxbll.SearchByNo(md.PartNo,md.BatchNo);
|
||
|
if (dt3 != null && dt3.Rows.Count > 0)
|
||
|
{
|
||
|
oldBoxNo = dt3.Rows[0]["BoxNo"].ToString();
|
||
|
BoxNo = oldBoxNo.Substring(0, oldBoxNo.Length - 6) +
|
||
|
(Convert.ToInt32(oldBoxNo.Substring(oldBoxNo.Length - 6, 6)) + 1).ToString()
|
||
|
.PadLeft(6, '0');
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
BoxNo = md.PartNo + "." + md.BatchNo + "." + "000001";
|
||
|
}
|
||
|
|
||
|
boxmd.ID = Guid.NewGuid().ToString();
|
||
|
boxmd.BoxNo = BoxNo;
|
||
|
boxmd.PartNo = md.PartNo;
|
||
|
boxmd.PartName = md.PartName;
|
||
|
boxmd.BatchNo = md.BatchNo;
|
||
|
boxmd.BoxCount = BoxCount;
|
||
|
boxmd.Des = md.Des;
|
||
|
boxbll.AddInfo(boxmd);
|
||
|
|
||
|
|
||
|
#region MyRegion
|
||
|
|
||
|
if (partNo == "1230002601")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 左侧前门板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
|
||
|
if (partNo == "1230002604")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 左侧后门板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002602")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 右侧前门板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002605")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 右侧后门板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002609")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 前部左侧轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002615")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部左侧轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002612")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 前部右侧轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002617")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部右侧后轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002619")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部左侧前轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002621")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部右侧前轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002627")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部左侧扰流板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "1230002600")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部右侧扰流板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
report.Register("");
|
||
|
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
|
||
|
report.Print(false);
|
||
|
boxbll.UpdateInfo(boxmd);
|
||
|
abll.UpdatePrintFlag(md);
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
|
||
|
}
|
||
|
|
||
|
#endregion
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
MessageBox.Show("匹配失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
temppartNo = partNo;
|
||
|
tempdeviceno = textBox1.Text;
|
||
|
textBox1.Text = "";
|
||
|
textBox2.Text = "";
|
||
|
textBox2.Enabled = false;
|
||
|
textBox1.Focus();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private void checkBox1_CheckedChanged(object sender, EventArgs e)
|
||
|
{
|
||
|
if (checkBox1.Checked == false)
|
||
|
{
|
||
|
panel1.Visible = true;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/// <summary>
|
||
|
/// 手打箱单
|
||
|
/// </summary>
|
||
|
/// <param name="sender"></param>
|
||
|
/// <param name="e"></param>
|
||
|
private void button2_Click(object sender, EventArgs e)
|
||
|
{
|
||
|
#region 判断数据合法性
|
||
|
if (textBox3.Text.Trim() == "")
|
||
|
{
|
||
|
MessageBox.Show("请输入数量!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
|
return;
|
||
|
}
|
||
|
if (!IsNumeric(textBox3.Text.Trim()))
|
||
|
{
|
||
|
MessageBox.Show("数量格式不正确!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||
|
return;
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
try
|
||
|
{
|
||
|
GridppReport report = new GridppReport();
|
||
|
AssemblyBLL bll = new AssemblyBLL();
|
||
|
MistakeBLL mbll = new MistakeBLL();
|
||
|
BoxBLL boxbll = new BoxBLL();
|
||
|
BoxModel boxmd = new BoxModel();
|
||
|
AssemblyModel md = new AssemblyModel();
|
||
|
int BoxCount = 0;
|
||
|
|
||
|
string partNo = textBox4.Text.Substring(0,11);
|
||
|
|
||
|
DataTable dt = mbll.SearchPartName(partNo);
|
||
|
if (dt != null && dt.Rows.Count > 0)
|
||
|
{
|
||
|
boxmd.PartName = dt.Rows[0]["PartName2"].ToString();
|
||
|
}
|
||
|
|
||
|
#region 根据总成零件号获取描述
|
||
|
if (partNo == "A2477204706" || partNo == "A2477305403" || partNo == "A2477204606" ||
|
||
|
partNo == "A2477305303")
|
||
|
{
|
||
|
boxmd.Des = "装饰条-高光电镀";
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2477204906" || partNo == "A2477305603" || partNo == "A2477204806" ||
|
||
|
partNo == "A2477305503")
|
||
|
{
|
||
|
boxmd.Des = "装饰条-喷涂";
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2477205106" || partNo == "A2477305803" || partNo == "A2477205006" ||
|
||
|
partNo == "A2477305703")
|
||
|
{
|
||
|
boxmd.Des = "装饰条-珍珠镍电镀";
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 根据总成零件号判断箱单类型和打印机
|
||
|
|
||
|
if (partNo == "A2477204606" || partNo == "A2477204806" || partNo == "A2477205006")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 左侧前门板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
|
||
|
if (partNo == "A2477305303" || partNo == "A2477305503" || partNo == "A2477305703")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 左侧后门板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2477204706" || partNo == "A2477204906" || partNo == "A2477205106")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 右侧前门板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2477305603" || partNo == "A2477305403" || partNo == "A2477305803")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 右侧后门板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2478850022")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 前部左侧轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2478850222")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部左侧轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2478850122")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 前部右侧轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2478850322")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部右侧后轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2477309400")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部左侧前轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2477309600")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部右侧前轮眉装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2477901300")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部左侧扰流板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
|
||
|
if (partNo == "A2477901400")
|
||
|
{
|
||
|
report.LoadFromFile(@"D:\X247 后部右侧扰流板装箱单.grf");
|
||
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
||
|
}
|
||
|
#endregion
|
||
|
|
||
|
#region 根据总成零件号打印装箱单
|
||
|
|
||
|
string BoxNo = "", oldBoxNo = "";
|
||
|
string batchNo = DateTime.Now.ToString("yyyy-MM-dd").Substring(2, 2) +
|
||
|
DateTime.Now.ToString("yyyy-MM-dd").Substring(5, 2) +
|
||
|
DateTime.Now.ToString("yyyy-MM-dd").Substring(8, 2);
|
||
|
DataTable dt3 = boxbll.SearchByNo(partNo, batchNo);
|
||
|
if (dt3 != null && dt3.Rows.Count > 0)
|
||
|
{
|
||
|
oldBoxNo = dt3.Rows[0]["BoxNo"].ToString();
|
||
|
BoxNo = oldBoxNo.Substring(0, oldBoxNo.Length - 6) +
|
||
|
(Convert.ToInt32(oldBoxNo.Substring(oldBoxNo.Length - 6, 6)) + 1).ToString().PadLeft(6, '0');
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//md.BatchNo = DateTime.Now.ToString("yyyy-MM-dd").Substring(2, 2) + DateTime.Now.ToString("yyyy-MM-dd").Substring(5, 2) + DateTime.Now.ToString("yyyy-MM-dd").Substring(8, 2);
|
||
|
BoxNo = partNo + "." + batchNo + "." + "000001";
|
||
|
}
|
||
|
boxmd.ID = Guid.NewGuid().ToString();
|
||
|
boxmd.BoxNo = BoxNo;
|
||
|
boxmd.PartNo = partNo;
|
||
|
//boxmd.PartName = md.PartName;
|
||
|
boxmd.BatchNo = batchNo;
|
||
|
boxmd.BoxCount = Convert.ToInt32(textBox3.Text.Trim());
|
||
|
|
||
|
boxbll.AddInfo(boxmd);
|
||
|
|
||
|
report.Register("");
|
||
|
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
|
||
|
report.Print(false);
|
||
|
boxbll.UpdateInfo(boxmd);
|
||
|
|
||
|
bll.UpdatePrintFlag1(partNo);
|
||
|
#endregion
|
||
|
}
|
||
|
catch (Exception ex)
|
||
|
{
|
||
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
||
|
}
|
||
|
}
|
||
|
|
||
|
private static bool IsNumeric(string str)
|
||
|
{
|
||
|
System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[0-9]\d*$");
|
||
|
return reg1.IsMatch(str);
|
||
|
}
|
||
|
|
||
|
private void textBox4_KeyDown(object sender, KeyEventArgs e)
|
||
|
{
|
||
|
if (e.KeyCode == Keys.Enter)
|
||
|
{
|
||
|
textBox3.Focus();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|