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.
951 lines
43 KiB
951 lines
43 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 System.Windows.Forms.VisualStyles;
|
|
using gregn6Lib;
|
|
using MESClassLibrary.BLL.Log;
|
|
using MESClassLibrary.BLL.Mistake247;
|
|
using MESClassLibrary.Model;
|
|
using System.Threading;
|
|
using MESClassLibrary.BLL.Mistake247;
|
|
|
|
namespace PurchingMistakeNew
|
|
{
|
|
public partial class Form1 : Form
|
|
{
|
|
private static string orderNo="";
|
|
public Form1()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void textBox1_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
MistakeBLL bll=new MistakeBLL();
|
|
BoxBLL bbll=new BoxBLL();
|
|
RecordBLL rbll=new RecordBLL();
|
|
|
|
BoxModel bmd=new BoxModel();
|
|
|
|
string partno = "", PartName = "", BoxNo = "", newBoxNo = "", banBatchNo = "", newBatchNo="";
|
|
int packCount = 0;
|
|
|
|
|
|
GridppReport report = new GridppReport();
|
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
if (textBox1.Text.Trim() != "")
|
|
{
|
|
#region 查找配置码对应的总成、标准包装量
|
|
|
|
//DataTable dt = bll.SearchPartNoByDecice(textBox1.Text.Trim());
|
|
//if (dt != null && dt.Rows.Count > 0)
|
|
//{
|
|
// partno = dt.Rows[0]["PartNo2"].ToString();
|
|
// packCount =Convert.ToInt32(dt.Rows[0]["PackCount"].ToString());
|
|
// PartName = dt.Rows[0]["PartName2"].ToString();
|
|
//}
|
|
|
|
//#endregion
|
|
|
|
//#region 当前箱单是哪个
|
|
|
|
//DataTable boxdt = bbll.searchBox(partno);
|
|
//if (boxdt != null && boxdt.Rows.Count > 0)
|
|
//{
|
|
// BoxNo = boxdt.Rows[0]["BoxNo"].ToString();
|
|
// banBatchNo = boxdt.Rows[0]["BatchNo"].ToString();
|
|
// newBatchNo = 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 判断箱单是否已满
|
|
|
|
// DataTable rdt = rbll.SearchCountByBox(BoxNo);
|
|
// if (rdt != null && rdt.Rows.Count > 0)
|
|
// {
|
|
// if (Convert.ToInt32(rdt.Rows[0]["sum"].ToString()) == packCount)
|
|
// {
|
|
// #region 生成包装单
|
|
|
|
// if (banBatchNo == newBatchNo)
|
|
// {
|
|
// newBoxNo = partno + "." + banBatchNo + "." +
|
|
// (Convert.ToInt32(BoxNo.Substring(BoxNo.Length - 4, 4)) + 1)
|
|
// .ToString()
|
|
// .PadLeft(4, '0');
|
|
// }
|
|
// else
|
|
// {
|
|
// newBoxNo = partno + "." + newBatchNo + "." +"0001";
|
|
// }
|
|
|
|
// #endregion
|
|
|
|
// bmd.ID = Guid.NewGuid().ToString();
|
|
// bmd.BoxNo = newBoxNo;
|
|
// bmd.PartNo = partno;
|
|
// bmd.PartName = PartName;
|
|
// bmd.BatchNo = newBatchNo;
|
|
|
|
// bbll.AddInfo(bmd);
|
|
|
|
|
|
// #region 打印装箱单
|
|
|
|
// if (partno == "A2477209103" || partno == "A2477209203" || partno == "A2477209305" || partno == "A2477203007" || partno == "A2477203207" || partno == "A2477205006")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 左侧前门板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
// }
|
|
|
|
|
|
// if (partno == "A2477309401" || partno == "A2477309501" || partno == "A2477300203" || partno == "A2477305303" || partno == "A2477305503" || partno == "A2477305703")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 左侧后门板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
// }
|
|
|
|
// if (partno == "A2477209303" || partno == "A2477209403" || partno == "A2477207505" || partno == "A2477203107" || partno == "A2477203307" || partno == "A2477205106")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 右侧前门板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
// }
|
|
|
|
// if (partno == "A2477309601" || partno == "A2477309701" || partno == "A2477300303" || partno == "A2477305403" || partno == "A2477305603" || 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 == "A2477900788" || partno == "A2477901300")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 后部左侧扰流板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
// }
|
|
|
|
// if (partno == "A2477900888" || partno == "A2477901400")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 后部右侧扰流板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
// }
|
|
|
|
// #endregion
|
|
|
|
// report.Register("");
|
|
// report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
|
|
// report.Print(false);
|
|
// bbll.UpdateInfo(bmd);
|
|
|
|
// }
|
|
// }
|
|
|
|
// #endregion
|
|
//}
|
|
//else
|
|
//{
|
|
// #region 生成包装单
|
|
|
|
// newBatchNo = 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 + "." + newBatchNo + "." + "0001";
|
|
|
|
// #endregion
|
|
|
|
// bmd.ID = Guid.NewGuid().ToString();
|
|
// bmd.BoxNo = BoxNo;
|
|
// bmd.PartNo = partno;
|
|
// bmd.PartName = PartName;
|
|
// bmd.BatchNo = newBatchNo;
|
|
// bbll.AddInfo(bmd);
|
|
|
|
// #region 打印装箱单
|
|
|
|
// if (partno == "A2477209103" || partno == "A2477209203" || partno == "A2477209305" || partno == "A2477203007" || partno == "A2477203207" || partno == "A2477205006")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 左侧前门板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
// }
|
|
|
|
|
|
// if (partno == "A2477309401" || partno == "A2477309501" || partno == "A2477300203" || partno == "A2477305303" || partno == "A2477305503" || partno == "A2477305703")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 左侧后门板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
// }
|
|
|
|
// if (partno == "A2477209303" || partno == "A2477209403" || partno == "A2477207505" || partno == "A2477203107" || partno == "A2477203307" || partno == "A2477205106")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 右侧前门板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
// }
|
|
|
|
// if (partno == "A2477309601" || partno == "A2477309701" || partno == "A2477300303" || partno == "A2477305403" || partno == "A2477305603" || 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 == "A2477900788" || partno == "A2477901300")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 后部左侧扰流板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
// }
|
|
|
|
// if (partno == "A2477900888" || partno == "A2477901400")
|
|
// {
|
|
// report.LoadFromFile(@"D:\X247 后部右侧扰流板装箱单.grf");
|
|
// report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
// }
|
|
|
|
// #endregion
|
|
|
|
// report.Register("");
|
|
// report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
|
|
// report.Print(false);
|
|
// bbll.UpdateInfo(bmd);
|
|
//}
|
|
|
|
|
|
#endregion
|
|
|
|
textBox2.Enabled = true;
|
|
textBox2.Focus();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("请扫描设备条码!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
textBox1.Focus();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
}
|
|
}
|
|
|
|
private void Form1_Load(object sender, EventArgs e)
|
|
{
|
|
Control.CheckForIllegalCrossThreadCalls = false;
|
|
textBox1.Enabled = true;
|
|
textBox2.Enabled = false;
|
|
panel1.Visible = false;
|
|
string aa = ConfigurationManager.AppSettings["interval"].ToString();
|
|
initData();
|
|
//bindData();
|
|
this.listView1.Columns.Clear();
|
|
this.listView1.Columns.Add("计划单", 100, HorizontalAlignment.Center);
|
|
this.listView1.Columns.Add("零件号", 100, HorizontalAlignment.Center);
|
|
this.listView1.Columns.Add("零件名称", 200, HorizontalAlignment.Center);
|
|
this.listView1.Columns.Add("数量", 60, HorizontalAlignment.Center);
|
|
this.listView1.Columns.Add("完成数", 70, HorizontalAlignment.Center);
|
|
}
|
|
|
|
public void initData()
|
|
{
|
|
//string[] part =
|
|
//{
|
|
// "A2477203007", "A2477203207", "A2477205006", "A2477305303", "A2477305503", "A2477305703", "A2477203107",
|
|
// "A2477203307", "A2477205106", "A2477305403", "A2477305603", "A2477305803"
|
|
//};
|
|
//变更零件号后
|
|
string[] part =
|
|
{
|
|
"A2477203007", "A2477204207", "A2477205006", "A2477305303", "A2477305503", "A2477305703", "A2477203107",
|
|
"A2477203307", "A2477205106", "A2477305403", "A2477305603", "A2477305803"
|
|
};
|
|
|
|
string[] sum = new string[12];
|
|
DataTable dt = null;
|
|
RecordBLL bll=new RecordBLL();
|
|
string 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);
|
|
//string batch = "191111";
|
|
|
|
try
|
|
{
|
|
for (int i = 0; i < 12; i++)
|
|
{
|
|
dt = bll.GetCount(part[i], batch);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
sum[i] = dt.Rows[0]["sum"].ToString();
|
|
}
|
|
else
|
|
{
|
|
sum[i] = "";
|
|
}
|
|
}
|
|
|
|
#region 左前
|
|
|
|
uc1.PartInfo = "A2477203007 左侧前门板装饰件总成VAR7—高光电镀";
|
|
uc2.PartInfo = "A2477203207 左侧前门板装饰件总成VAR7 VAR9—喷涂";
|
|
uc3.PartInfo = "A2477205006 左侧前门板装饰件总成VAR5—珍珠镍电镀";
|
|
|
|
uc1.Sum = sum[0];
|
|
uc2.Sum = sum[1];
|
|
uc3.Sum = sum[2];
|
|
|
|
#endregion
|
|
|
|
#region 左后
|
|
|
|
uc4.PartInfo = "A2477305303 左侧后门板装饰件总成VAR7—高光电镀";
|
|
uc5.PartInfo = "A2477305503 左侧后门板装饰件总成VAR7 VAR9—喷涂";
|
|
uc6.PartInfo = "A2477305703 左侧后门板装饰件总成VAR5—珍珠镍电镀";
|
|
|
|
uc4.Sum = sum[3];
|
|
uc5.Sum = sum[4];
|
|
uc6.Sum = sum[5];
|
|
|
|
#endregion
|
|
|
|
#region 右前
|
|
|
|
uc7.PartInfo = "A2477203107 右侧前门板装饰件总成VAR7—高光电镀";
|
|
uc8.PartInfo = "A2477203307 右侧前门板装饰件总成VAR7 VAR9—喷涂";
|
|
uc9.PartInfo = "A2477205106 右侧前门板装饰件总成VAR5—珍珠镍电镀";
|
|
|
|
uc7.Sum = sum[6];
|
|
uc8.Sum = sum[7];
|
|
uc9.Sum = sum[8];
|
|
|
|
#endregion
|
|
|
|
#region 右后
|
|
|
|
uc10.PartInfo = "A2477305403 右侧后门板装饰件总成VAR7—高光电镀";
|
|
uc11.PartInfo = "A2477305603 右侧后门板装饰件总成VAR7 VAR9—喷涂";
|
|
uc12.PartInfo = "A2477305803 右后门板装饰件总成 VAR5—珍珠镍电镀";
|
|
|
|
uc10.Sum = sum[9];
|
|
uc11.Sum = sum[10];
|
|
uc12.Sum = sum[11];
|
|
|
|
#endregion
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
}
|
|
}
|
|
|
|
private void textBox2_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string partNo = "", deviceNo = "",partsub="",order="";
|
|
int BoxCount = 0, type = 0, orderCount = 0, ActualCount=0;
|
|
RecordBLL rbll=new RecordBLL();
|
|
MistakeBLL bll = new MistakeBLL();
|
|
AssemblyBLL abll = new AssemblyBLL();
|
|
Plan247BLL pbll=new Plan247BLL();
|
|
|
|
AssemblyModel md = new AssemblyModel();
|
|
RecordModel rmd=new RecordModel();
|
|
|
|
GridppReport report = new GridppReport();
|
|
|
|
string batchNo = "", newbatchNo = "";
|
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
#region 是否扫描单号
|
|
|
|
if (textBox4.Text.Trim()=="")
|
|
{
|
|
MessageBox.Show("请扫描计划单!", "提示", MessageBoxButtons.OK);
|
|
textBox4.Focus();
|
|
return;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 判断计划单里是否有此产品的生产计划并且是未完成
|
|
if (VerifyHelper.ScanSjBarCodeFormat(textBox2.Text.Trim()) == false)
|
|
{
|
|
MessageBox.Show($"扫描条码[{textBox2.Text.Trim()}]格式错误!", "提示", MessageBoxButtons.OK);
|
|
textBox2.Text = "";
|
|
textBox2.Focus();
|
|
return;
|
|
}
|
|
|
|
DataTable hdt = pbll.IsHavePlan(textBox2.Text.Trim().Substring(0,10), textBox4.Text.Trim());
|
|
if (hdt != null && hdt.Rows.Count > 0)
|
|
{
|
|
order = hdt.Rows[0]["OrderNo"].ToString();
|
|
orderCount = Convert.ToInt32(hdt.Rows[0]["OrderCount"].ToString());
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("该零件已生产完成!", "提示", MessageBoxButtons.OK);
|
|
textBox2.Focus();
|
|
return;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 判断半成品条码的合法性
|
|
|
|
if (textBox2.Text.Trim().Length < 10)
|
|
{
|
|
MessageBox.Show("半成品条码有误,请重新扫描!", "提示", MessageBoxButtons.OK);
|
|
textBox2.Focus();
|
|
return;
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 半成品是否已装配
|
|
|
|
DataTable recorddt = rbll.SearchByPartNo1(textBox2.Text.Trim());
|
|
if (recorddt != null && recorddt.Rows.Count > 0)
|
|
{
|
|
MessageBox.Show("此半成品已装配过!", "提示", MessageBoxButtons.OK);
|
|
textBox2.Focus();
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
deviceNo = textBox1.Text.Trim();
|
|
partNo = textBox2.Text.Substring(0, 10);
|
|
|
|
DataTable dt = bll.IsMath(deviceNo, partNo);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
#region 根据半成品查找总成零件号
|
|
|
|
DataTable dt2 = bll.SearchByNo(partNo, deviceNo);
|
|
if (dt2 != null && dt2.Rows.Count > 0)
|
|
{
|
|
partsub = dt2.Rows[0]["PartNo2"].ToString();
|
|
|
|
#region 判断总成零件当前批次是否存在查询5次
|
|
|
|
newbatchNo = 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);
|
|
|
|
try
|
|
{
|
|
DataTable partdt = abll.searchPartNo(dt2.Rows[0]["PartNo2"] + "." + newbatchNo);
|
|
if (partdt != null && partdt.Rows.Count > 0)
|
|
{
|
|
md.PartNo = partdt.Rows[0]["PartNo"].ToString().Substring(0, partdt.Rows[0]["PartNo"].ToString().Length - 6) +
|
|
(Convert.ToInt32(partdt.Rows[0]["PartNo"].ToString().Substring(partdt.Rows[0]["PartNo"].ToString().Length - 6, 6)) + 1)
|
|
.ToString()
|
|
.PadLeft(6, '0');
|
|
}
|
|
else
|
|
{
|
|
md.PartNo = dt2.Rows[0]["PartNo2"] + "." + newbatchNo + "." + "000001";
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
MessageBox.Show("连接数据库失败!");
|
|
return;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 根据总成零件号获取总成描述
|
|
if (partsub == "A2477203107" || partsub == "A2477305403" || partsub == "A2477203007" ||
|
|
partsub == "A2477305303")
|
|
{
|
|
md.Des = "装饰条-高光电镀";
|
|
}
|
|
|
|
if (partsub == "A2477203307" || partsub == "A2477305603" || partsub == "A2477203207" ||
|
|
partsub == "A2477305503")
|
|
{
|
|
md.Des = "装饰条-喷涂";
|
|
}
|
|
|
|
if (partsub == "A2477205106" || partsub == "A2477305803" || partsub == "A2477205006" ||
|
|
partsub == "A2477305703")
|
|
{
|
|
md.Des = "装饰条-珍珠镍电镀";
|
|
}
|
|
#endregion
|
|
|
|
md.PartName = dt2.Rows[0]["PartName2"].ToString();
|
|
|
|
#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 左侧前门板";
|
|
type = 1;
|
|
report.LoadFromFile(@"D:\New\X247 左侧前门板.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002604" || partNo == "1230003130")
|
|
{
|
|
md.PartType = "X247 左侧后门板";
|
|
type = 1;
|
|
report.LoadFromFile(@"D:\New\X247 左侧后门板.grf");
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002602" || partNo == "1230003126")
|
|
{
|
|
md.PartType = "X247 右侧前门板";
|
|
type = 2;
|
|
|
|
report.LoadFromFile(@"D:\New\X247 右侧前门板.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002605" || partNo == "1230003134")
|
|
{
|
|
md.PartType = "X247 右侧后门板";
|
|
type = 2;
|
|
report.LoadFromFile(@"D:\New\X247 右侧后门板.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002609")
|
|
{
|
|
md.PartType = "X247 前部左侧轮眉";
|
|
type = 3;
|
|
report.LoadFromFile(@"D:\New\X247 前部左侧轮眉.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002615")
|
|
{
|
|
md.PartType = "X247 后部左侧后轮眉";
|
|
type = 3;
|
|
report.LoadFromFile(@"D:\New\X247 后部左侧后轮眉.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002612")
|
|
{
|
|
md.PartType = "X247 前部右侧轮眉";
|
|
type = 4;
|
|
report.LoadFromFile(@"D:\New\X247 前部右侧轮眉.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002617")
|
|
{
|
|
md.PartType = "X247 右侧后部后轮眉";
|
|
type = 4;
|
|
|
|
report.LoadFromFile(@"D:\New\X247 右侧后部后轮眉.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002619")
|
|
{
|
|
md.PartType = "X247 后部左侧前轮眉";
|
|
|
|
type = 5;
|
|
report.LoadFromFile(@"D:\New\X247 后部左侧轮眉.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002621")
|
|
{
|
|
md.PartType = "X247 后部右侧前轮眉";
|
|
|
|
type = 5;
|
|
|
|
report.LoadFromFile(@"D:\New\X247 后部右侧前轮眉.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002627")
|
|
{
|
|
md.PartType = "X247 后部左侧扰流板";
|
|
|
|
type = 6;
|
|
|
|
report.LoadFromFile(@"D:\New\X247 后部左侧扰流板眉.grf");
|
|
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
}
|
|
|
|
if (partNo == "1230002600")
|
|
{
|
|
md.PartType = "X247 后部右侧扰流板";
|
|
|
|
type = 7;
|
|
|
|
report.LoadFromFile(@"D:\New\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");
|
|
|
|
md.Flag = 0;
|
|
abll.AddInfo(md);
|
|
|
|
#endregion
|
|
|
|
#region 打印总成条码
|
|
|
|
report.Register("");
|
|
report.ConnectionString = ConfigurationManager.ConnectionStrings["report"].ToString();
|
|
report.Print(false);
|
|
abll.UpdateInfo(md);
|
|
|
|
#endregion
|
|
|
|
#region 更新订单完成数
|
|
|
|
pbll.UpdateCount(partsub, order);
|
|
|
|
#endregion
|
|
|
|
#region 保存记录
|
|
|
|
rmd.ID = Guid.NewGuid().ToString();
|
|
rmd.PartNo1 = textBox2.Text.Trim();
|
|
rmd.PartNo2 = md.PartNo;
|
|
rmd.OrderNo = order;
|
|
rmd.Type = type;
|
|
rbll.AddInfo(rmd);
|
|
|
|
#endregion
|
|
|
|
textBox1.Focus();
|
|
textBox2.Enabled = false;
|
|
textBox1.Text = "";
|
|
textBox2.Text = "";
|
|
initData();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 更新完成数
|
|
|
|
pbll.UpdateCount(textBox2.Text.Trim(), textBox4.Text.Trim());
|
|
|
|
#endregion
|
|
|
|
initList();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("匹配失败!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
textBox1.Text = "";
|
|
textBox2.Text = "";
|
|
textBox2.Enabled = false;
|
|
textBox1.Focus();
|
|
initData();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
MessageBox.Show("数据库连接失败!", "提示", MessageBoxButtons.OK);
|
|
}
|
|
}
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
//bindData();
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
AssemblyBLL bll=new AssemblyBLL();
|
|
AssemblyModel md=new AssemblyModel();
|
|
string part="";
|
|
GridppReport report = new GridppReport();
|
|
|
|
if (textBox3.Text.Trim() == "")
|
|
{
|
|
MessageBox.Show("总成条码不能为空!", "提示", MessageBoxButtons.OK);
|
|
textBox3.Focus();
|
|
return;
|
|
}
|
|
|
|
DataTable dt = bll.searchPartNo(textBox3.Text.Trim());
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
#region 补打
|
|
|
|
md.ID = Guid.NewGuid().ToString();
|
|
md.PartNo = textBox3.Text.Trim();
|
|
md.PartName = dt.Rows[0]["PartName"].ToString();
|
|
md.BatchNo = dt.Rows[0]["BatchNo"].ToString();
|
|
md.Color = dt.Rows[0]["Color"].ToString();
|
|
md.ColorNo = dt.Rows[0]["ColorNo"].ToString();
|
|
md.PartType = dt.Rows[0]["PartType"].ToString();
|
|
md.TapeBatchNo = dt.Rows[0]["TapeBatchNo"].ToString();
|
|
md.Validity = dt.Rows[0]["Validity"].ToString();
|
|
md.ValidityDate = dt.Rows[0]["ValidityDate"].ToString();
|
|
md.Des = dt.Rows[0]["Des"].ToString();
|
|
md.Flag = 1;
|
|
|
|
bll.AddInfo(md);
|
|
|
|
part = textBox3.Text.Trim().Substring(0, textBox3.Text.Trim().IndexOf("."));
|
|
|
|
if (part == "A2477203007" || part == "A2477203207" || part == "A2477205006")
|
|
{
|
|
md.PartType = "X247 左侧前门板";
|
|
report.LoadFromFile(@"D:\New\X247 左侧前门板.grf");
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
}
|
|
|
|
if (part == "A2477305303" || part == "A2477305503" || part == "A2477305703")
|
|
{
|
|
md.PartType = "X247 左侧后门板";
|
|
report.LoadFromFile(@"D:\New\X247 左侧后门板.grf");
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
}
|
|
|
|
if (part == "A2477203107" || part == "A2477203307" || part == "A2477205106")
|
|
{
|
|
md.PartType = "X247 右侧前门板";
|
|
report.LoadFromFile(@"D:\New\X247 右侧前门板.grf");
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer1"].ToString();
|
|
}
|
|
|
|
if (part == "A2477305403" || part == "A2477305603" || part == "A2477305803")
|
|
{
|
|
md.PartType = "X247 右侧后门板";
|
|
report.LoadFromFile(@"D:\New\X247 右侧后门板.grf");
|
|
report.Printer.PrinterName = ConfigurationManager.AppSettings["Printer2"].ToString();
|
|
}
|
|
|
|
#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 button1_Click(object sender, EventArgs e)
|
|
{
|
|
panel1.Visible = true;
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
panel1.Visible = false;
|
|
textBox3.Text = "";
|
|
}
|
|
|
|
private void textBox4_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
|
|
|
|
if (textBox4.Text.Trim().Length != 12)
|
|
{
|
|
MessageBox.Show("订单号有误,请重新扫描!", "提示", MessageBoxButtons.OK);
|
|
textBox4.Focus();
|
|
return;
|
|
}
|
|
|
|
|
|
#region 判断订单号是否存在
|
|
|
|
if (initList()) return;
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
}
|
|
}
|
|
|
|
private bool initList()
|
|
{
|
|
Plan247BLL bll = new Plan247BLL();
|
|
int a = 0;
|
|
this.listView1.Items.Clear();
|
|
|
|
DataTable dt = bll.SearhByOrderNo(textBox4.Text.Trim());
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
#region 判断订单是否生产完成
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
if (Convert.ToInt32(dt.Rows[i]["IsFinish"].ToString()) == 1)
|
|
{
|
|
a += 1;
|
|
if (a == dt.Rows.Count)
|
|
{
|
|
MessageBox.Show("订单已完成,请扫描其他订单!", "提示", MessageBoxButtons.OK);
|
|
textBox4.Focus();
|
|
return true;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ListViewItem lvi = new ListViewItem(dt.Rows[i]["OrderNo"].ToString());
|
|
lvi.SubItems.Add(dt.Rows[i]["PartNo"].ToString()); //后面添加的Item都为SubItems ,即为子项
|
|
lvi.SubItems.Add(dt.Rows[i]["PartName2"].ToString());
|
|
lvi.SubItems.Add(dt.Rows[i]["OrderCount"].ToString());
|
|
lvi.SubItems.Add(dt.Rows[i]["CompleteCount"].ToString());
|
|
listView1.Items.Add(lvi);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("订单号不存在,请重新扫描!", "提示", MessageBoxButtons.OK);
|
|
textBox4.Focus();
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|