注塑喷涂
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.
 
 
 
 
 

973 lines
40 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using gregn6Lib;
using MESClassLibrary.BLL.Log;
using MESClassLibrary.BLL.Mistake247;
using MESClassLibrary.Model;
namespace PurchingMistakeNew
{
public partial class Form5 : Form
{
public Form5()
{
InitializeComponent();
}
private void textBox2_KeyDown(object sender, KeyEventArgs e)
{
MistakeBLL mbll = new MistakeBLL();
RecordBLL rbll = new RecordBLL();
BoxBLL boxBll = new BoxBLL();
BoxModel md = new BoxModel();
BoxBLL bll = new BoxBLL();
AssemblyBLL abll = new AssemblyBLL();
ToVisualBLL vbll=new ToVisualBLL();
DataTable dt1 = null;
GridppReport report = new GridppReport();
string part = "", box = "", batch = "", newBox = "", newBatch = "", partName = "";
int maxCount = 0, currentCount = 0;
try
{
if (e.KeyCode == Keys.Enter)
{
if (textBox2.Text.Trim() == "")
{
MessageBox.Show("请扫描总成码!", "提示", MessageBoxButtons.OK);
textBox2.Focus();
return;
}
DataTable recorddt = rbll.SearchByPartNo2(textBox2.Text.Trim());
if (recorddt != null && recorddt.Rows.Count > 0)
{
if (recorddt.Rows[0]["BoxNo"].ToString() != "")
{
MessageBox.Show("此总成已入箱!", "提示", MessageBoxButtons.OK);
textBox2.Focus();
return;
}
if (Convert.ToInt32(recorddt.Rows[0]["Flag"].ToString()) == 2)
{
MessageBox.Show("此总成已报废!", "提示", MessageBoxButtons.OK);
textBox2.Focus();
return;
}
}
else
{
MessageBox.Show("此总成不存在!", "提示", MessageBoxButtons.OK);
textBox2.Focus();
return;
}
#region 2022-01-04wff增加,扫描总成标签时校验是否进行视觉检测,ToVisual=1未检测,=0已检测
//DataTable dt3 = vbll.SearchInfoByPartNo(textBox2.Text.Trim(), "tb_ToVisual_WheelBrow_247");
//if (dt3 != null && dt3.Rows.Count > 0)
//{
// if (dt3.Rows[0]["ToVisual"].ToString() == "1")
// {
// MessageBox.Show("此总成未进行视觉检测,不允许装箱!", "提示", MessageBoxButtons.OK);
// textBox2.Focus();
// return;
// }
//}
#endregion
#region 颜色
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2478850022")
{
userControl11.BackColor = System.Drawing.Color.Cyan;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2478850222")
{
userControl12.BackColor = System.Drawing.Color.Cyan;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2478850122")
{
userControl13.BackColor = System.Drawing.Color.Cyan;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2478850322")
{
userControl14.BackColor = System.Drawing.Color.Cyan;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2477309400")
{
userControl15.BackColor = System.Drawing.Color.Cyan;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2477309600")
{
userControl16.BackColor = System.Drawing.Color.Cyan;
}
#endregion
#region 判断是否需要打印箱单
part = textBox2.Text.Substring(0, textBox2.Text.IndexOf("."));
dt1 = mbll.SearchPartName(part);
if (dt1 != null && dt1.Rows.Count > 0)
{
maxCount = Convert.ToInt32(dt1.Rows[0]["PackCount"].ToString());
partName = dt1.Rows[0]["PartName2"].ToString();
}
else
{
maxCount = 0;
}
DataTable boxdt = rbll.SearchBoxByPart(part);
if (boxdt != null && boxdt.Rows.Count > 0)
{
box = boxdt.Rows[0]["BoxNo"].ToString();
}
else
{
box = "";
}
batch = 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);
if (box != "")
{
#region 判断装箱单是否已满
DataTable indt = rbll.SearchCountByBox(box);
if (indt != null && indt.Rows.Count > 0)
{
currentCount = Convert.ToInt32(indt.Rows[0]["sum"].ToString());
}
else
{
currentCount = 0;
}
if (currentCount == 0 || currentCount >= maxCount)
{
#region 生成装箱单
if (box.Substring(12, 6) == batch)
{
newBox = box.Substring(0, box.Length - 6) + (Convert.ToInt32(box.Substring(box.Length - 6, 6)) + 1).ToString().PadLeft(6, '0');
newBatch = batch;
}
else
{
newBox = textBox2.Text.Substring(0, 11) + "." + batch + "." + "000001";
newBatch = box.Substring(12, 6);
}
#endregion
#region 保存装箱单并打印
md.ID = Guid.NewGuid().ToString();
md.BoxNo = newBox;
md.PartNo = part;
md.PartName = partName;
md.BatchNo = newBatch;
md.Validity = "3个月";
md.ValidityDate = "从" + DateTime.Now.ToString("yyyy-MM-dd") + "到" +
DateTime.Now.AddMonths(3).ToString("yyyy-MM-dd");
bll.AddInfo(md);
#region 打印装箱单
#region 注释掉
//if (part == "A2477209103" || part == "A2477209203" || part == "A2477209305" || part == "A2477204606" || part == "A2477204806" || part == "A2477205006")
//{
// report.LoadFromFile(@"D:\X247 左侧前门板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
//}
//if (part == "A2477309401" || part == "A2477309501" || part == "A2477300203" || part == "A2477305303" || part == "A2477305503" || part == "A2477305703")
//{
// report.LoadFromFile(@"D:\X247 左侧后门板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
//if (part == "A2477209303" || part == "A2477209403" || part == "A2477207505" || part == "A2477204706" || part == "A2477204906" || part == "A2477205106")
//{
// report.LoadFromFile(@"D:\X247 右侧前门板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
//}
//if (part == "A2477309601" || part == "A2477309701" || part == "A2477300303" || part == "A2477305403" || part == "A2477305603" || part == "A2477305803")
//{
// report.LoadFromFile(@"D:\X247 右侧后门板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
#endregion
if (part == "A2478850022")
{
report.LoadFromFile(@"D:\X247 前部左侧轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2478850222")
{
report.LoadFromFile(@"D:\X247 后部左侧轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2478850122")
{
report.LoadFromFile(@"D:\X247 前部右侧轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
if (part == "A2478850322")
{
report.LoadFromFile(@"D:\X247 后部右侧后轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
if (part == "A2477309400")
{
report.LoadFromFile(@"D:\X247 后部左侧前轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2477309600")
{
report.LoadFromFile(@"D:\X247 后部右侧前轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
#region 注释掉
//if (part == "A2477900788" || part == "A2477901300")
//{
// report.LoadFromFile(@"D:\X247 后部左侧扰流板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
//if (part == "A2477900888" || part == "A2477901400")
//{
// report.LoadFromFile(@"D:\X247 后部右侧扰流板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
#endregion
#endregion
report.Register("");
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
report.Print(false);
bll.UpdateInfo(md);
#endregion
}
#endregion
}
else
{
DataTable dt = boxBll.searchBox(part);
if (dt != null && dt.Rows.Count > 0)
{
}
else
{
newBox = textBox2.Text.Substring(0, 11) + "." + batch + "." + "000001";
newBatch = batch;
#region 保存装箱单并打印
md.ID = Guid.NewGuid().ToString();
md.BoxNo = newBox;
md.PartNo = part;
md.PartName = partName;
md.BatchNo = newBatch;
md.Flag = 0;
bll.AddInfo(md);
#region 打印装箱单
#region 注释掉
//if (part == "A2477209103" || part == "A2477209203" || part == "A2477209305" || part == "A2477204606" || part == "A2477204806" || part == "A2477205006")
//{
// report.LoadFromFile(@"D:\X247 左侧前门板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
//}
//if (part == "A2477309401" || part == "A2477309501" || part == "A2477300203" || part == "A2477305303" || part == "A2477305503" || part == "A2477305703")
//{
// report.LoadFromFile(@"D:\X247 左侧后门板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
//if (part == "A2477209303" || part == "A2477209403" || part == "A2477207505" || part == "A2477204706" || part == "A2477204906" || part == "A2477205106")
//{
// report.LoadFromFile(@"D:\X247 右侧前门板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
//}
//if (part == "A2477309601" || part == "A2477309701" || part == "A2477300303" || part == "A2477305403" || part == "A2477305603" || part == "A2477305803")
//{
// report.LoadFromFile(@"D:\X247 右侧后门板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
#endregion
if (part == "A2478850022")
{
report.LoadFromFile(@"D:\X247 前部左侧轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2478850222")
{
report.LoadFromFile(@"D:\X247 后部左侧轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2478850122")
{
report.LoadFromFile(@"D:\X247 前部右侧轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
if (part == "A2478850322")
{
report.LoadFromFile(@"D:\X247 后部右侧后轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
if (part == "A2477309400")
{
report.LoadFromFile(@"D:\X247 后部左侧前轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2477309600")
{
report.LoadFromFile(@"D:\X247 后部右侧前轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
#region 注释掉
//if (part == "A2477900788" || part == "A2477901300")
//{
// report.LoadFromFile(@"D:\X247 后部左侧扰流板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
//if (part == "A2477900888" || part == "A2477901400")
//{
// report.LoadFromFile(@"D:\X247 后部右侧扰流板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
#endregion
#endregion
report.Register("");
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
report.Print(false);
bll.UpdateInfo(md);
#endregion
}
}
#endregion
textBox1.Enabled = true;
textBox1.Focus();
}
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
MistakeBLL mbll = new MistakeBLL();
RecordBLL rbll = new RecordBLL();
RecordModel md = new RecordModel();
BoxBLL boxBll = new BoxBLL();
ToVisualBLL vbll=new ToVisualBLL();
int maxCount = 0, currentCount = 0;
bool flag;
try
{
if (e.KeyCode == Keys.Enter)
{
if (textBox1.Text.Trim() == "")
{
MessageBox.Show("请扫描箱单!", "提示", MessageBoxButtons.OK);
textBox1.Focus();
return;
}
#region 判断箱单是否存在
DataTable IsBoxdt = boxBll.SearchBoxIsExsit(textBox1.Text.Trim());
if (IsBoxdt != null && IsBoxdt.Rows.Count > 0)
{
}
else
{
MessageBox.Show("此箱单不存在!", "提示", MessageBoxButtons.OK);
textBox1.Focus();
return;
}
#endregion
#region 判断装箱单是否已满
DataTable dt1 = mbll.SearchPartName(textBox1.Text.Substring(0, textBox1.Text.IndexOf(".")));
if (dt1 != null && dt1.Rows.Count > 0)
{
maxCount = Convert.ToInt32(dt1.Rows[0]["PackCount"].ToString());
}
else
{
maxCount = 0;
}
DataTable dt2 = rbll.SearchCountByBox(textBox1.Text.Trim());
if (dt2 != null && dt2.Rows.Count > 0)
{
currentCount = Convert.ToInt32(dt2.Rows[0]["sum"].ToString());
}
else
{
currentCount = 0;
}
if (currentCount >= maxCount)
{
MessageBox.Show("此装箱单已满!", "提示", MessageBoxButtons.OK);
textBox1.Focus();
return;
}
#endregion
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) !=
textBox1.Text.Substring(0, textBox1.Text.IndexOf(".")))
{
MessageBox.Show("总成和箱子不匹配!", "提示", MessageBoxButtons.OK);
textBox1.Focus();
return;
}
else
{
#region 入箱
md.PartNo2 = textBox2.Text.Trim();
md.BoxNo = textBox1.Text.Trim();
md.Flag = 1;
flag = rbll.updateBoxInfo(md);
#endregion
if (flag == true)
{
#region 颜色
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2478850022")
{
userControl11.BackColor = System.Drawing.Color.Chartreuse;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2478850222")
{
userControl12.BackColor = System.Drawing.Color.Chartreuse;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2478850122")
{
userControl13.BackColor = System.Drawing.Color.Chartreuse;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2478850322")
{
userControl14.BackColor = System.Drawing.Color.Chartreuse;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2477309400")
{
userControl15.BackColor = System.Drawing.Color.Chartreuse;
}
if (textBox2.Text.Substring(0, textBox2.Text.IndexOf(".")) == "A2477309600")
{
userControl16.BackColor = System.Drawing.Color.Chartreuse;
}
#endregion
textBox1.Enabled = false;
textBox2.Focus();
textBox2.Text = "";
textBox1.Text = "";
InitUC();
#region 判断是否都已视觉检测完成,完成后返回扫描界面
//if (vbll.IsVisual("tb_ToVisual_WheelBrow_247"))
//{
// this.Hide();
// FrmScan_247 frm = new FrmScan_247();
// frm.Show();
//}
#endregion
}
}
}
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
}
private void InitUC()
{
MistakeBLL mbll = new MistakeBLL();
RecordBLL rbll = new RecordBLL();
int[] maxCount = new int[6];
int[] currentCount = new int[6];
string[] part ={"A2478850022", "A2478850222", "A2478850122", "A2478850322", "A2477309400", "A2477309600"};
string[] box = new string[6];
#region 查找产品的最大包装量、装箱单号
DataTable dt1 = null;
for (int i = 0; i < 6; i++)
{
dt1 = mbll.SearchPartName(part[i]);
if (dt1 != null && dt1.Rows.Count > 0)
{
maxCount[i] = Convert.ToInt32(dt1.Rows[0]["PackCount"].ToString());
}
else
{
maxCount[i] = 0;
}
DataTable boxdt = rbll.SearchBoxByPart(part[i]);
if (boxdt != null && boxdt.Rows.Count > 0)
{
box[i] = boxdt.Rows[0]["BoxNo"].ToString();
}
else
{
box[i] = "";
}
if (box[i] != "")
{
#region 判断装箱单是否已满
DataTable indt = rbll.SearchCountByBox(box[i]);
if (indt != null && indt.Rows.Count > 0)
{
currentCount[i] = Convert.ToInt32(indt.Rows[0]["sum"].ToString());
}
else
{
currentCount[i] = 0;
}
#endregion
}
}
#endregion
#region 前左、后左后
userControl11.Part = "A2478850022 前部左侧轮眉总成";
userControl12.Part = "A2478850222 后部左侧后轮眉总成";
userControl11.Box = box[0];
userControl12.Box = box[1];
if (currentCount[0] == maxCount[0])
{
userControl11.strIn = "0" + "/" + maxCount[0].ToString();
}
else
{
userControl11.strIn = currentCount[0].ToString() + "/" + maxCount[0].ToString();
}
if (currentCount[1] == maxCount[1])
{
userControl12.strIn = "0" + "/" + maxCount[1].ToString();
}
else
{
userControl12.strIn = currentCount[1].ToString() + "/" + maxCount[1].ToString();
}
#endregion
#region 前右、后右后
userControl13.Part = "A2478850122 前部右侧轮眉总成";
userControl13.Box = box[2];
userControl14.Part = "A2478850322 后部右侧后轮眉总成";
userControl14.Box = box[3];
if (currentCount[2] == maxCount[2])
{
userControl13.strIn = "0" + "/" + maxCount[2].ToString();
}
else
{
userControl13.strIn = currentCount[2].ToString() + "/" + maxCount[2].ToString();
}
if (currentCount[3] == maxCount[3])
{
userControl14.strIn = "0" + "/" + maxCount[3].ToString();
}
else
{
userControl14.strIn = currentCount[3].ToString() + "/" + maxCount[3].ToString();
}
#endregion
#region 后左前、后右前
userControl15.Part = "A2477309400 后部左侧前轮眉总成";
userControl16.Part = "A2477309600 后部右侧前轮眉总成";
userControl15.Box = box[4];
userControl16.Box = box[5];
if (currentCount[4] == maxCount[4])
{
userControl15.strIn = "0" + "/" + maxCount[4].ToString();
}
else
{
userControl15.strIn = currentCount[4].ToString() + "/" + maxCount[4].ToString();
}
if (currentCount[5] == maxCount[5])
{
userControl16.strIn = "0" + "/" + maxCount[5].ToString();
}
else
{
userControl16.strIn = currentCount[5].ToString() + "/" + maxCount[5].ToString();
}
#endregion
}
private void button2_Click(object sender, EventArgs e)
{
BoxBLL bll = new BoxBLL();
BoxModel md = new BoxModel();
string part = "";
GridppReport report = new GridppReport();
try
{
if (textBox3.Text.Trim() == "")
{
MessageBox.Show("请输入箱单!", "提示", MessageBoxButtons.OK);
textBox3.Focus();
return;
}
DataTable dt = bll.SearchBoxIsExsit(textBox3.Text.Trim());
if (dt != null && dt.Rows.Count > 0)
{
#region 补打
md.ID = Guid.NewGuid().ToString();
md.BoxNo = dt.Rows[0]["BoxNo"].ToString();
md.PartNo = dt.Rows[0]["PartNo"].ToString();
part = md.PartNo;
md.PartName = dt.Rows[0]["PartName"].ToString();
md.BatchNo = dt.Rows[0]["BatchNo"].ToString();
md.Flag = 1;
md.Validity = dt.Rows[0]["Validity"].ToString();
md.ValidityDate = dt.Rows[0]["ValidityDate"].ToString();
bll.AddInfo(md);
#endregion
#region 打印装箱单
#region 注释掉
if (part == "A2477209103" || part == "A2477209203" || part == "A2477209305" || part == "A2477204606" || part == "A2477204806" || part == "A2477205006")
{
report.LoadFromFile(@"D:\X247 左侧前门板装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2477309401" || part == "A2477309501" || part == "A2477300203" || part == "A2477305303" || part == "A2477305503" || part == "A2477305703")
{
report.LoadFromFile(@"D:\X247 左侧后门板装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
if (part == "A2477209303" || part == "A2477209403" || part == "A2477207505" || part == "A2477204706" || part == "A2477204906" || part == "A2477205106")
{
report.LoadFromFile(@"D:\X247 右侧前门板装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2477309601" || part == "A2477309701" || part == "A2477300303" || part == "A2477305403" || part == "A2477305603" || part == "A2477305803")
{
report.LoadFromFile(@"D:\X247 右侧后门板装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
#endregion
if (part == "A2478850022")
{
report.LoadFromFile(@"D:\X247 前部左侧轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2478850222")
{
report.LoadFromFile(@"D:\X247 后部左侧轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2478850122")
{
report.LoadFromFile(@"D:\X247 前部右侧轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
if (part == "A2478850322")
{
report.LoadFromFile(@"D:\X247 后部右侧后轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
if (part == "A2477309400")
{
report.LoadFromFile(@"D:\X247 后部左侧前轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
}
if (part == "A2477309600")
{
report.LoadFromFile(@"D:\X247 后部右侧前轮眉装箱单.grf");
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
}
#region 注释掉
//if (part == "A2477900788" || part == "A2477901300")
//{
// report.LoadFromFile(@"D:\X247 后部左侧扰流板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
//if (part == "A2477900888" || part == "A2477901400")
//{
// report.LoadFromFile(@"D:\X247 后部右侧扰流板装箱单.grf");
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
//}
#endregion
#endregion
report.Register("");
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
report.Print(false);
bll.UpdateInfo(md);
}
else
{
MessageBox.Show("箱单不存在!", "提示", MessageBoxButtons.OK);
textBox3.Focus();
return;
}
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
}
private void button4_Click(object sender, EventArgs e)
{
panel1.Visible = true;
}
private void Form5_Load(object sender, EventArgs e)
{
textBox1.Enabled = false;
textBox2.Enabled = true;
textBox2.Focus();
textBox1.Text = "";
textBox2.Text = "";
panel1.Visible = false;
panel2.Visible = false;
panel3.Visible = false;
InitUC();
}
private void button3_Click(object sender, EventArgs e)
{
panel1.Visible = false;
}
private void button6_Click(object sender, EventArgs e)
{
panel2.Visible = false;
}
private void button5_Click(object sender, EventArgs e)
{
try
{
panel2.Visible = true;
this.listView1.Columns.Clear();
listView1.Clear();
this.listView1.Columns.Add("总成零件号", 300, HorizontalAlignment.Center);
this.listView1.Columns.Add("总成打印时间", 300, HorizontalAlignment.Center);
RecordBLL bll=new RecordBLL();
DataTable dt = null;
dt = bll.SearchState(3, 4, 5);
if (dt != null && dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
ListViewItem lvi = new ListViewItem(dt.Rows[i]["PartNo2"].ToString());
lvi.SubItems.Add(dt.Rows[i]["CreateTime1"].ToString()); //后面添加的Item都为SubItems ,即为子项
//this.listView1.Items.Remove(lvi);
listView1.Items.Add(lvi);
}
}
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
}
private void button9_Click(object sender, EventArgs e)
{
try
{
panel3.Visible = true;
this.listView2.Columns.Clear();
this.listView2.Clear();
this.listView2.Columns.Add("总成零件号", 300, HorizontalAlignment.Center);
this.listView2.Columns.Add("总成打印时间", 300, HorizontalAlignment.Center);
string boxNo = textBox4.Text.Trim();
RecordBLL bll = new RecordBLL();
DataTable dt = bll.GetRecord(boxNo);
if (dt != null && dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
ListViewItem lvi = new ListViewItem(dt.Rows[i]["PartNo2"].ToString());
lvi.SubItems.Add(dt.Rows[i]["CreateTime1"].ToString()); //后面添加的Item都为SubItems ,即为子项
listView2.Items.Add(lvi);
}
}
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
}
private void button8_Click(object sender, EventArgs e)
{
panel3.Visible = false;
textBox2.Focus();
}
private void button7_Click(object sender, EventArgs e)
{
panel3.Visible = true;
textBox4.Focus();
}
private void button1_Click(object sender, EventArgs e)
{
RecordBLL bll = new RecordBLL();
RecordModel md = new RecordModel();
bool flag;
try
{
DialogResult result = MessageBox.Show("确认报废?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (result == DialogResult.OK)
{
md.Flag = 2;
md.PartNo2 = textBox2.Text.Trim();
flag = bll.DelInfo(md);
if (flag == false)
{
MessageBox.Show("报废失败!", "提示", MessageBoxButtons.OK);
textBox2.Focus();
return;
}
else
{
MessageBox.Show("报废成功!", "提示", MessageBoxButtons.OK);
}
}
else
{
return;
}
}
catch (Exception ex)
{
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
}
}
private void Form5_FormClosed(object sender, FormClosedEventArgs e)
{
Environment.Exit(0);
}
}
}