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.
2079 lines
82 KiB
2079 lines
82 KiB
using MESClassLibrary.BLL.PunchAndWeld;
|
|
using OPCAutomation;
|
|
using PunchAndWeld.DataSouce;
|
|
using PunchAndWeld.WebReference;
|
|
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;
|
|
using System.Windows.Forms;
|
|
using gregn6Lib;
|
|
using MESClassLibrary.BLL.Log;
|
|
|
|
namespace PunchAndWeld
|
|
{
|
|
public partial class FrmProScreenBumperS : Form
|
|
{
|
|
OPCHelper opcHelper = new OPCHelper();
|
|
private string strHostIP = "";
|
|
PunchAdressBLL bll = new PunchAdressBLL();
|
|
public bool IsChangeBox = false;
|
|
public bool IsPass = false;
|
|
private string IsHigh = "1";
|
|
string zcPartNo = "", productName = "";
|
|
|
|
private GridppReport Report = new GridppReport();
|
|
private string oneBarCode = "", stationNo ="", stationId = "";
|
|
|
|
|
|
public FrmProScreenBumperS()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FrmProScreenBumper_Load(object sender, EventArgs e)
|
|
{
|
|
//this.WindowState = FormWindowState.Maximized;
|
|
stationNo = ConfigurationManager.AppSettings["StationNo"];
|
|
stationId = ProScreenFunc.GetStationId(stationNo);
|
|
label1.Text = ProScreenFunc.GetStation(stationNo);
|
|
Control.CheckForIllegalCrossThreadCalls = false;
|
|
Thread t = new Thread(new ThreadStart(TimeGo));
|
|
t.Start();
|
|
|
|
if (stationNo != "ZP70")
|
|
{
|
|
textBox1.TabIndex = 0;
|
|
textBox1.Select();
|
|
}
|
|
else
|
|
{
|
|
txtBoxL.Select();
|
|
txtBoxL.Focus();
|
|
}
|
|
|
|
if (stationNo == "ZP89" || stationNo == "ZP90")
|
|
{
|
|
button4.Visible = false;
|
|
button5.Visible = false;
|
|
button6.Visible = false;
|
|
}
|
|
|
|
timer1.Enabled = true;
|
|
|
|
try
|
|
{
|
|
if (opcHelper.CreateServer())
|
|
{
|
|
if (opcHelper.ConnectServer(strHostIP, "Kepware.KEPServerEX.V6"))
|
|
{
|
|
opcHelper.Connected = true;
|
|
|
|
|
|
opcHelper.opcGroups = opcHelper.opcServer.OPCGroups;
|
|
opcHelper.opcGroup1 = opcHelper.opcGroups.Add("DeviceRead");
|
|
opcHelper.opcGroup2 = opcHelper.opcGroups.Add("DeviceWrite");
|
|
opcHelper.SetGroupProperty(opcHelper.opcGroup1, 500);
|
|
opcHelper.SetGroupProperty(opcHelper.opcGroup2, 500);
|
|
|
|
opcHelper.opcItems1 = opcHelper.opcGroup1.OPCItems;
|
|
opcHelper.opcItems1.DefaultIsActive = true;
|
|
|
|
DataTable dt = bll.SearchInfo(ConfigurationManager.AppSettings["DeviceNo"], 0);
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
opcHelper.opcItemm1 = new OPCItem[dt.Rows.Count];
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
{
|
|
opcHelper.opcItemm1[i] = opcHelper.opcItems1.AddItem(dt.Rows[i]["Address"].ToString(), i);
|
|
}
|
|
}
|
|
|
|
opcHelper.opcItems2 = opcHelper.opcGroup2.OPCItems;
|
|
opcHelper.opcItems2.DefaultIsActive = true;
|
|
|
|
DataTable dt1 = bll.SearchInfo(ConfigurationManager.AppSettings["DeviceNo"], 1);
|
|
if (dt1 != null && dt1.Rows.Count > 0)
|
|
{
|
|
if (stationNo == "ZP61")
|
|
{
|
|
opcHelper.opcItemm2 = new OPCItem[dt1.Rows.Count + 16];
|
|
}
|
|
else if (stationNo == "ZP88")
|
|
{
|
|
opcHelper.opcItemm2 = new OPCItem[dt1.Rows.Count + 1];
|
|
}
|
|
else
|
|
{
|
|
opcHelper.opcItemm2 = new OPCItem[dt1.Rows.Count];
|
|
}
|
|
|
|
for (int i = 0; i < dt1.Rows.Count; i++)
|
|
{
|
|
opcHelper.opcItemm2[i] = opcHelper.opcItems2.AddItem(dt1.Rows[i]["Address"].ToString(), i);
|
|
if (stationNo == "ZP88" && i == dt1.Rows.Count - 1)
|
|
{
|
|
string[] tempStr = dt1.Rows[i]["Address"].ToString().Split('.');
|
|
opcHelper.opcItemm2[i+1] = opcHelper.opcItems2.AddItem(tempStr[0]+"."+ tempStr[1]+ ".StartM", i+1);
|
|
}
|
|
}
|
|
|
|
if (stationNo == "ZP61")
|
|
{
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 0] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.White1", dt1.Rows.Count + 0);
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 1] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.White2", dt1.Rows.Count + 1);
|
|
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 2] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Black1", dt1.Rows.Count + 2);
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 3] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Black2", dt1.Rows.Count + 3);
|
|
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 4] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Silver1", dt1.Rows.Count + 4);
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 5] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Silver2", dt1.Rows.Count + 5);
|
|
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 6] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.White3", dt1.Rows.Count + 6);
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 7] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.White4", dt1.Rows.Count + 7);
|
|
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 8] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Gray1", dt1.Rows.Count + 8);
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 9] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Gray2", dt1.Rows.Count + 9);
|
|
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 10] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Blue1", dt1.Rows.Count + 10);
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 11] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Blue2", dt1.Rows.Count + 11);
|
|
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 12] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Green1", dt1.Rows.Count + 12);
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 13] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Green2", dt1.Rows.Count + 13);
|
|
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 14] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Black3", dt1.Rows.Count + 14);
|
|
opcHelper.opcItemm2[dt1.Rows.Count + 15] = opcHelper.opcItems2.AddItem("BBMPT.Punch167.Black4", dt1.Rows.Count + 15);
|
|
}
|
|
|
|
|
|
}
|
|
|
|
opcHelper.opcGroup1.DataChange += new DIOPCGroupEvent_DataChangeEventHandler(opcGroup1_DataChange);
|
|
|
|
|
|
if (opcHelper.ReadSingleValueFromOPC1(2).ToLower() == "true")
|
|
{
|
|
lbState.Text = "等待放件状态";
|
|
}
|
|
else
|
|
{
|
|
lbState.Text = "设备未准备OK";
|
|
}
|
|
|
|
if (opcHelper.ReadSingleValueFromOPC1(0).ToLower() == "true")
|
|
{
|
|
lbFinish.Text = "运行完成";
|
|
//textBox1.Enabled = true;
|
|
}
|
|
else
|
|
{
|
|
lbFinish.Text = "正在运行";
|
|
//textBox1.Enabled = false;
|
|
}
|
|
|
|
if (opcHelper.ReadSingleValueFromOPC1(4).ToLower() == "true")
|
|
{
|
|
lbOK.Text = "NG";
|
|
}
|
|
else
|
|
{
|
|
lbOK.Text = "OK";
|
|
}
|
|
|
|
if (opcHelper.ReadSingleValueFromOPC2(1) == 1)
|
|
{
|
|
lbmode.Text = "手动";
|
|
}
|
|
else if (opcHelper.ReadSingleValueFromOPC2(1) == 2)
|
|
{
|
|
lbmode.Text = "复位";
|
|
}
|
|
else if (opcHelper.ReadSingleValueFromOPC2(1) == 3)
|
|
{
|
|
lbmode.Text = "自动";
|
|
}
|
|
else if (opcHelper.ReadSingleValueFromOPC2(1) == 4)
|
|
{
|
|
lbmode.Text = "半自动";
|
|
}
|
|
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("创建OPC服务失败!", "提示", MessageBoxButtons.OK);
|
|
opcHelper.Connected = false;
|
|
LogHelper.WriteErrLogBase("工位:" + label1.Text + "创建OPC服务失败!", MethodBase.GetCurrentMethod().Name);
|
|
return;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
|
|
LoadScreen();
|
|
}
|
|
|
|
private void TimeGo()
|
|
{
|
|
System.Timers.Timer timer = new System.Timers.Timer();
|
|
timer.Interval = 10;
|
|
timer.Enabled = true;
|
|
timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Tick);
|
|
}
|
|
|
|
private void timer_Tick(object sender, EventArgs e)
|
|
{
|
|
label9.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
Thread.Sleep(500);
|
|
}
|
|
|
|
public void LoadScreen()
|
|
{
|
|
//string stationNo = ConfigurationManager.AppSettings["StationNo"].ToString();
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreen(stationNo);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
SetPage(dt);
|
|
}
|
|
|
|
}
|
|
|
|
public void SetPage(DataTable dt)
|
|
{
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
textBox3.Text = "";
|
|
textBox3.Visible = false;
|
|
txtBoxL.Text = "";
|
|
txtBoxR.Text = "";
|
|
IsHigh = "1";
|
|
PanelRD.Visible = false;
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
|
|
label1.Text = dt.Rows[0]["Des"].ToString();
|
|
label2.Text = dt.Rows[0]["OrderNo"].ToString();
|
|
label3.Text = dt.Rows[0]["PartNo"].ToString();
|
|
label4.Text = dt.Rows[0]["ProductName"].ToString();
|
|
//label5.Text = dt.Rows[0]["Des"].ToString();
|
|
label6.Text = dt.Rows[0]["OrderCount"].ToString();
|
|
label7.Text = dt.Rows[0]["CompleteCount"].ToString();
|
|
label8.Text = dt.Rows[0]["OrderNo"].ToString().Substring(0, 1) + "班";
|
|
label10.Text = dt.Rows[0]["BadCount"].ToString();
|
|
IsHigh = dt.Rows[0]["IsHigh"].ToString();
|
|
|
|
this.Tag = dt.Rows[0]["ID"].ToString();
|
|
textBox1.Tag = dt.Rows[0]["ProductID1"].ToString();
|
|
textBox1.Text = "";
|
|
|
|
if (stationNo == "ZP61")
|
|
{
|
|
|
|
if (label4.Text.Contains("极地白"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(1);
|
|
opcHelper.opcItemm2[5].Write(1);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
if (label4.Text.Contains("曜"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(1);
|
|
opcHelper.opcItemm2[7].Write(1);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
if (label4.Text.Contains("银"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(1);
|
|
opcHelper.opcItemm2[9].Write(1);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
if (label4.Text.Contains("乳石白"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(1);
|
|
opcHelper.opcItemm2[11].Write(1);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
if (label4.Text.Contains("石墨灰"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(1);
|
|
opcHelper.opcItemm2[13].Write(1);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#region 竞技蓝
|
|
|
|
if (label4.Text.Contains("竞技蓝"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(1);
|
|
opcHelper.opcItemm2[15].Write(1);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 松石绿
|
|
|
|
if (label4.Text.Contains("绿松蓝"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(1);
|
|
opcHelper.opcItemm2[17].Write(1);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 鲁宾黑
|
|
|
|
if (label4.Text.Contains("鲁宾黑"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(1);
|
|
opcHelper.opcItemm2[19].Write(1);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
|
|
if (stationNo == "ZP70" || stationNo == "ZP72"|| stationNo == "ZP80")
|
|
{
|
|
OpenPanelRD();
|
|
}
|
|
}
|
|
}
|
|
|
|
private void OpenPanelRD()
|
|
{
|
|
if (stationNo == "ZP70")
|
|
{
|
|
lbBoxL.Text = "扫描奔驰标";
|
|
LbBoxR.Visible = false;
|
|
txtBoxR.Visible = false;
|
|
button7.Visible = false;
|
|
}
|
|
|
|
if (stationNo == "ZP72" ||stationNo == "ZP80")
|
|
{
|
|
button7.Visible = false;
|
|
}
|
|
PanelRD.Visible = true;
|
|
txtBoxL.Select();
|
|
txtBoxL.Focus();
|
|
}
|
|
|
|
private void textBox1_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
//CheckPartAndProduct();
|
|
string sbState = lbState.Text.Trim();
|
|
if (string.IsNullOrWhiteSpace(sbState) || sbState.Contains("未"))
|
|
{
|
|
MessageBox.Show("设备未准备OK");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
if (stationNo != "ZP61" && stationNo != "ZP67" && stationNo != "ZP69" && stationNo != "ZP87" && stationNo != "ZP88" && stationNo != "ZP89" && stationNo != "ZP90")
|
|
{
|
|
CheckPartAndProduct();
|
|
}
|
|
else
|
|
{
|
|
CheckPartAndProduct_New();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void CheckPartAndProduct()
|
|
{
|
|
textBox1.SelectAll();
|
|
string barcode = textBox1.Text.Trim();
|
|
|
|
|
|
|
|
if (barcode.Contains("."))
|
|
{
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
|
|
}
|
|
|
|
if (ProScreenFunc.SjBarCodeIsInStockIn(barcode) == false)
|
|
{
|
|
MessageBox.Show($"扫描条码[{barcode}]不存在喷涂下线记录,请更换其他油漆件重新操作!");
|
|
textBox1.Text = "";
|
|
return;
|
|
}
|
|
|
|
oneBarCode = barcode;
|
|
|
|
|
|
if (ProScreenFunc.HaveScan(barcode))
|
|
{
|
|
DialogResult result = MessageBox.Show("条码为" + barcode + "的蒙皮已经冲孔,是否重新冲孔?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
|
|
if (result == DialogResult.OK)
|
|
{
|
|
FrmPassWord pass = new FrmPassWord();
|
|
pass.OkBtnClick += (arg1) =>
|
|
{
|
|
if (!string.IsNullOrEmpty(arg1) &&
|
|
arg1.ToLower() == ConfigurationManager.AppSettings["password"].ToLower())
|
|
{
|
|
pass.Close();
|
|
|
|
ScanBarcode(barcode);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("密码错误,请重新输入!", "提示", MessageBoxButtons.OK);
|
|
}
|
|
};
|
|
pass.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ScanBarcode(barcode);
|
|
}
|
|
|
|
}
|
|
|
|
public void CheckPartAndProduct_New()
|
|
{
|
|
textBox1.SelectAll();
|
|
string barcode = textBox1.Text.Trim();
|
|
|
|
if (barcode.Contains("."))
|
|
{
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
|
|
}
|
|
|
|
if (ProScreenFunc.SjBarCodeIsInStockIn(barcode) == false)
|
|
{
|
|
MessageBox.Show($"扫描条码[{barcode}]不存在喷涂下线记录,请更换其他油漆件重新操作!");
|
|
textBox1.Text = "";
|
|
return;
|
|
}
|
|
|
|
oneBarCode = barcode;
|
|
|
|
|
|
if (ProScreenFunc.HaveScan(barcode))
|
|
{
|
|
string tmpZc = ProScreenFunc.StockZcCode(barcode);
|
|
string[] aa = ProScreenFunc.GetSpecialHybrid();
|
|
string[] bb = tmpZc.Split('-');
|
|
|
|
if (aa.Count(p => p == bb[0]) == 0)
|
|
{
|
|
|
|
DialogResult result = MessageBox.Show("条码为" + barcode + "的蒙皮已经冲孔,是否重新冲孔?", "提示",
|
|
MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
|
|
if (result == DialogResult.OK)
|
|
{
|
|
FrmPassWord pass = new FrmPassWord();
|
|
pass.OkBtnClick += (arg1) =>
|
|
{
|
|
if (!string.IsNullOrEmpty(arg1) &&
|
|
arg1.ToLower() == ConfigurationManager.AppSettings["password"].ToLower())
|
|
{
|
|
pass.Close();
|
|
|
|
ScanBarcode_New(oneBarCode);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("密码错误,请重新输入!", "提示", MessageBoxButtons.OK);
|
|
}
|
|
};
|
|
pass.ShowDialog();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
//if (barcode.Substring(0, 10) == "2200000176")
|
|
//{
|
|
// MessageBox.Show("条码为" + barcode + "的已经是高配无需再次冲孔");
|
|
// return;
|
|
//}
|
|
ScanBarcode_New(oneBarCode);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
ScanBarcode_New(oneBarCode);
|
|
}
|
|
}
|
|
|
|
private void ScanBarcode(string barcode)
|
|
{
|
|
string productID1 = textBox1.Tag.ToString().Trim();
|
|
string productID2 = "";
|
|
|
|
string[] codeSpecial = { "2200000057", "2200000058" };
|
|
string code = barcode.Substring(0, 10);
|
|
//string stationNo = ConfigurationManager.AppSettings["StationNo"];
|
|
if (codeSpecial.Contains(code))
|
|
{
|
|
productID2 = ProScreenFunc.GetProductID(code, "");
|
|
AfterScanBarcode(barcode, productID2, productID1, this.Tag.ToString().Trim());
|
|
}
|
|
else
|
|
{
|
|
if (barcode.Substring(0, 2) != "22")
|
|
{
|
|
string stockNo = barcode.Substring(0, 10);
|
|
productID2 = ProScreenFunc.GetProductID(stockNo, "");
|
|
}
|
|
else
|
|
{
|
|
productID2 = ProScreenFunc.GetProductID(barcode);
|
|
}
|
|
|
|
if (!ProScreenFunc.CheckPartAndProduct(productID1, productID2))
|
|
{
|
|
MessageBox.Show("当前扫描的零件与总成不匹配,请检查后再扫描");
|
|
textBox1.Text = "";
|
|
}
|
|
else
|
|
{
|
|
|
|
ScanAll.ScanResult = false;
|
|
|
|
OtherPart parts = ProScreenFunc.HaveOtherPart(stationNo, productID1);
|
|
if ((parts != null) && ((!string.IsNullOrWhiteSpace(parts.productID3)) || (!string.IsNullOrWhiteSpace(parts.productID4)) || (!string.IsNullOrWhiteSpace(parts.productID5)) || (!string.IsNullOrWhiteSpace(parts.productID6)) || (!string.IsNullOrWhiteSpace(parts.productID7)) || (!string.IsNullOrWhiteSpace(parts.productID8))))
|
|
{
|
|
FrmProScreen3 frm3 = new FrmProScreen3(parts);
|
|
frm3.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
ScanAll.ScanResult = true;
|
|
ScanAll.barCode1 = "";
|
|
ScanAll.barCode2 = "";
|
|
ScanAll.barCode3 = "";
|
|
ScanAll.barCode4 = "";
|
|
ScanAll.barCode5 = "";
|
|
ScanAll.barCode6 = "";
|
|
}
|
|
|
|
if (ScanAll.ScanResult)
|
|
{
|
|
if (stationNo == "ZP70" || stationNo == "ZP72" || stationNo == "ZP80")
|
|
{
|
|
if (IsPass)
|
|
{
|
|
|
|
if (ConfigurationManager.AppSettings["DeviceNo"] != "BMPTJQSB-05-166")
|
|
{
|
|
if (IsHigh == "0")
|
|
{
|
|
opcHelper.opcItemm2[3].Write("1");
|
|
opcHelper.opcItemm2[1].Write("0");
|
|
opcHelper.opcItemm2[2].Write("1");
|
|
}
|
|
else
|
|
{
|
|
opcHelper.opcItemm2[3].Write("1");
|
|
opcHelper.opcItemm2[2].Write("0");
|
|
opcHelper.opcItemm2[1].Write("1");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (IsHigh == "0")
|
|
{
|
|
opcHelper.opcItemm2[2].Write("1");
|
|
}
|
|
else
|
|
{
|
|
opcHelper.opcItemm2[1].Write("1");
|
|
}
|
|
}
|
|
|
|
AfterScanBarcode(barcode, productID2, productID1, this.Tag.ToString().Trim());
|
|
}
|
|
else
|
|
{
|
|
if (stationNo == "ZP70")
|
|
{
|
|
MessageBox.Show("未校验奔驰标!", "提示", MessageBoxButtons.OK);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("未校验雷达支架!", "提示", MessageBoxButtons.OK);
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
|
|
if (ConfigurationManager.AppSettings["DeviceNo"] != "BMPTJQSB-05-166")
|
|
{
|
|
if (IsHigh == "0")
|
|
{
|
|
opcHelper.opcItemm2[3].Write("1");
|
|
opcHelper.opcItemm2[1].Write("0");
|
|
opcHelper.opcItemm2[2].Write("1");
|
|
}
|
|
else
|
|
{
|
|
opcHelper.opcItemm2[3].Write("1");
|
|
opcHelper.opcItemm2[2].Write("0");
|
|
opcHelper.opcItemm2[1].Write("1");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (IsHigh == "0")
|
|
{
|
|
opcHelper.opcItemm2[2].Write("1");
|
|
//opcItemm2[2].Write("1");
|
|
}
|
|
else
|
|
{
|
|
opcHelper.opcItemm2[1].Write("1");
|
|
//opcItemm2[1].Write("1");
|
|
}
|
|
}
|
|
|
|
AfterScanBarcode(barcode, productID2, productID1, this.Tag.ToString().Trim());
|
|
}
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void AfterScanBarcode(string barcode, string productID2, string productID1, string planID)
|
|
{
|
|
if ((IsChangeBox == true && IsPass) || (IsChangeBox == false))
|
|
{
|
|
int res = 0;
|
|
|
|
try
|
|
{
|
|
LogHelper.WriteSysLogBase("条码号:" + barcode + "工位:" + label1.Text.Trim() + ",一码到底调用WMS接口", MethodBase.GetCurrentMethod().Name);
|
|
|
|
string stockNo = "";
|
|
string batchNo = "";
|
|
string partNo = "";
|
|
ProScreenFunc.GetCode(barcode, out stockNo, out batchNo, out partNo);
|
|
|
|
partNo = label3.Text.Trim();
|
|
batchNo = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
WMSWebService webService = new WMSWebService();
|
|
webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"].ToString();
|
|
|
|
webService.WMSInterfaceStockIn(barcode, partNo, batchNo, 1);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase("工位:" + label1.Text.Trim() + ",一码到底调用WMS接口:" + ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
|
|
string sn="";
|
|
|
|
|
|
if (stationNo == "ZP83")
|
|
{
|
|
res=ProScreenFunc.SavePartAndProduct_New(barcode, productID2, productID1,
|
|
label2.Text.Trim(), label8.Text, planID, sn,
|
|
ScanAll.barCode1, ScanAll.barCode2, ScanAll.barCode3,
|
|
ScanAll.barCode4, ScanAll.barCode5, ScanAll.barCode6,stationId, ConfigurationManager.AppSettings["StationDescription"]);
|
|
}
|
|
else
|
|
{
|
|
res = ProScreenFunc.SavePartAndProduct(barcode, productID2, productID1, label2.Text, label8.Text, planID, stationId, ConfigurationManager.AppSettings["StationDescription"]);
|
|
}
|
|
|
|
if (res<=0)
|
|
{
|
|
MessageBox.Show("连接数据库失败!");
|
|
return;
|
|
}
|
|
|
|
ProScreenFunc.SaveZcCode(barcode, label3.Text.Trim());
|
|
ProScreenFunc.AddCompleteCount(this.Tag.ToString().Trim());
|
|
|
|
try
|
|
{
|
|
if (ConfigurationManager.AppSettings["PrintEnable"].ToLower() == "true")
|
|
{
|
|
string path = "";
|
|
if (label3.Text.Trim().Contains("A2477900588-"))
|
|
{
|
|
path = Application.StartupPath + @"\aaa1.grf";
|
|
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(ReportInitialize1);
|
|
}
|
|
else
|
|
{
|
|
path = Application.StartupPath + @"\aaa.grf";
|
|
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(ReportInitialize);
|
|
}
|
|
|
|
Report.Register("");
|
|
Report.LoadFromFile(path);
|
|
|
|
//Report.DesignPaperOrientation = GRPaperOrientation.grpoLandscape;
|
|
//report.PrintPreview(true);
|
|
Report.Print(false);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
|
|
if (ProScreenFunc.CheckPlanCompleted(this.Tag.ToString().Trim()))
|
|
{
|
|
LoadScreen();
|
|
}
|
|
else
|
|
{
|
|
label7.Text = (Tools.NumericParse.StringToInt(label7.Text.Trim()) + 1).ToString();
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("雷达支架不匹配");
|
|
}
|
|
}
|
|
|
|
private void ScanBarcode_New(string barCode)
|
|
{
|
|
try
|
|
{
|
|
string productId1 = "", productId2 = "";
|
|
string tmpZc = ProScreenFunc.StockZcCode(barCode);
|
|
string[] aa = ProScreenFunc.GetSpecialHybrid();
|
|
string[] bb = tmpZc.Split('-');
|
|
if (aa.Count(p => p == bb[0]) > 0)
|
|
{
|
|
if (ConfigurationManager.AppSettings["StationNo"] == "ZP61")
|
|
{
|
|
productId2 = ProScreenFunc.GetProductIDByPartNo(tmpZc);
|
|
}
|
|
else
|
|
{
|
|
opcHelper.opcItemm2[1].Write("1");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (ConfigurationManager.AppSettings["StationNo"] == "ZP61")
|
|
{
|
|
if (!string.IsNullOrEmpty(tmpZc))
|
|
{
|
|
if (tmpZc.Contains("PH"))
|
|
{
|
|
opcHelper.opcItemm2[1].Write("1");
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
productId2 = ProScreenFunc.GetProductID(barCode);
|
|
}
|
|
|
|
if (ConfigurationManager.AppSettings["StationNo"] == "ZP61")
|
|
{
|
|
string productID1 = textBox1.Tag.ToString().Trim();
|
|
if (!ProScreenFunc.CheckPartAndProduct(productID1, productId2))
|
|
{
|
|
MessageBox.Show("当前扫描的零件与总成不匹配,请检查后再扫描");
|
|
textBox1.SelectAll ();
|
|
textBox1.Focus ();
|
|
return;
|
|
}
|
|
}
|
|
string stationId = ProScreenFunc.GetStationId(ConfigurationManager.AppSettings["StationNo"]);
|
|
DataTable dt = ProScreenFunc.GetProductInfo1(productId2, stationId);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
productId1 = dt.Rows[0]["ProductID1"].ToString();
|
|
zcPartNo = dt.Rows[0]["PartNo"].ToString();
|
|
IsHigh = dt.Rows[0]["IsHigh"].ToString();
|
|
productName = dt.Rows[0]["ProductName"].ToString();
|
|
|
|
|
|
ScanAll.ScanResult = false;
|
|
|
|
OtherPart parts = ProScreenFunc.HaveOtherPart(label1.Text.Trim(), productId1);
|
|
if ((parts != null) && ((!string.IsNullOrWhiteSpace(parts.productID3)) || (!string.IsNullOrWhiteSpace(parts.productID4)) || (!string.IsNullOrWhiteSpace(parts.productID5))))
|
|
{
|
|
FrmProScreen3 frm3 = new FrmProScreen3(parts);
|
|
frm3.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
ScanAll.ScanResult = true;
|
|
}
|
|
|
|
if (ScanAll.ScanResult)
|
|
{
|
|
|
|
if (ConfigurationManager.AppSettings["DeviceNo"] != "BMPTJQSB-05-166")
|
|
{
|
|
if (stationNo=="ZP88")
|
|
{
|
|
if (IsHigh == "0")
|
|
{
|
|
opcHelper.opcItemm2[3].Write("1");
|
|
opcHelper.opcItemm2[1].Write("0");
|
|
opcHelper.opcItemm2[2].Write("1");
|
|
opcHelper.opcItemm2[4].Write("0");
|
|
}
|
|
else if (IsHigh == "1")
|
|
{
|
|
opcHelper.opcItemm2[3].Write("1");
|
|
opcHelper.opcItemm2[2].Write("0");
|
|
opcHelper.opcItemm2[1].Write("1");
|
|
opcHelper.opcItemm2[4].Write("0");
|
|
}
|
|
else if (IsHigh == "2")
|
|
{
|
|
opcHelper.opcItemm2[4].Write("1");
|
|
opcHelper.opcItemm2[3].Write("1");
|
|
opcHelper.opcItemm2[2].Write("0");
|
|
opcHelper.opcItemm2[1].Write("0");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (IsHigh == "0")
|
|
{
|
|
opcHelper.opcItemm2[3].Write("1");
|
|
opcHelper.opcItemm2[1].Write("0");
|
|
opcHelper.opcItemm2[2].Write("1");
|
|
}
|
|
else if (IsHigh == "1")
|
|
{
|
|
opcHelper.opcItemm2[3].Write("1");
|
|
opcHelper.opcItemm2[2].Write("0");
|
|
opcHelper.opcItemm2[1].Write("1");
|
|
}
|
|
else if (IsHigh == "2")
|
|
{
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
if (IsHigh == "0")
|
|
{
|
|
opcHelper.opcItemm2[2].Write("1");
|
|
}
|
|
else if (IsHigh == "1")
|
|
{
|
|
opcHelper.opcItemm2[1].Write("1");
|
|
}
|
|
}
|
|
|
|
if (ConfigurationManager.AppSettings["StationNo"] == "ZP61")
|
|
{
|
|
|
|
#region 极地白
|
|
|
|
if (productName.Contains("极地白"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(1);
|
|
opcHelper.opcItemm2[5].Write(1);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 曜岩黑
|
|
|
|
if (productName.Contains("曜"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(1);
|
|
opcHelper.opcItemm2[7].Write(1);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 高科技银
|
|
|
|
if (productName.Contains("银"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(1);
|
|
opcHelper.opcItemm2[9].Write(1);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 乳石白
|
|
|
|
if (productName.Contains("乳石白"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(1);
|
|
opcHelper.opcItemm2[11].Write(1);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 石墨灰
|
|
|
|
if (productName.Contains("石墨灰"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(1);
|
|
opcHelper.opcItemm2[13].Write(1);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 竞技蓝
|
|
|
|
if (productName.Contains("竞技蓝"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(1);
|
|
opcHelper.opcItemm2[15].Write(1);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 松石绿
|
|
|
|
if (productName.Contains("绿松蓝"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(1);
|
|
opcHelper.opcItemm2[17].Write(1);
|
|
|
|
opcHelper.opcItemm2[18].Write(0);
|
|
opcHelper.opcItemm2[19].Write(0);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 鲁宾黑
|
|
|
|
if (productName.Contains("鲁宾黑"))
|
|
{
|
|
opcHelper.opcItemm2[4].Write(0);
|
|
opcHelper.opcItemm2[5].Write(0);
|
|
|
|
opcHelper.opcItemm2[6].Write(0);
|
|
opcHelper.opcItemm2[7].Write(0);
|
|
|
|
opcHelper.opcItemm2[8].Write(0);
|
|
opcHelper.opcItemm2[9].Write(0);
|
|
|
|
opcHelper.opcItemm2[10].Write(0);
|
|
opcHelper.opcItemm2[11].Write(0);
|
|
|
|
opcHelper.opcItemm2[12].Write(0);
|
|
opcHelper.opcItemm2[13].Write(0);
|
|
|
|
opcHelper.opcItemm2[14].Write(0);
|
|
opcHelper.opcItemm2[15].Write(0);
|
|
|
|
opcHelper.opcItemm2[16].Write(0);
|
|
opcHelper.opcItemm2[17].Write(0);
|
|
|
|
opcHelper.opcItemm2[18].Write(1);
|
|
opcHelper.opcItemm2[19].Write(1);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
|
|
DateTime time = DateTime.Now;
|
|
string tmp = ProScreenFunc.SerialNo(zcPartNo, time.ToString("yyMMdd"));
|
|
string sn = "";
|
|
if (tmp == "")
|
|
{
|
|
sn =
|
|
zcPartNo + "." + time.ToString("yyMMdd") + ".000001";
|
|
}
|
|
else
|
|
{
|
|
sn = tmp.Substring(0, tmp.Length - 6) +
|
|
(int.Parse(tmp.Substring(tmp.Length - 6, 6)) + 1).ToString()
|
|
.PadLeft(6, '0');
|
|
}
|
|
|
|
AfterScanBarcode_New(barCode, productId2, productId1, zcPartNo, sn);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("当前扫描的零件未设置对应的总成,请检查后再扫描");
|
|
textBox1.SelectAll();
|
|
textBox1.Focus();
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod());
|
|
MessageBox.Show("连接数据库超时!");
|
|
}
|
|
}
|
|
|
|
private void AfterScanBarcode_New(string barcode, string productId2, string productId1, string zcPartNo,string sn)
|
|
{
|
|
if ((IsChangeBox == true && IsPass) || (IsChangeBox == false))
|
|
{
|
|
|
|
try
|
|
{
|
|
LogHelper.WriteSysLogBase("条码号:" + barcode + "工位:" + label1.Text.Trim() + ",一码到底调用WMS接口", MethodBase.GetCurrentMethod().Name);
|
|
|
|
string stockNo = "";
|
|
string batchNo = "";
|
|
batchNo = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
WMSWebService webService = new WMSWebService();
|
|
webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"].ToString();
|
|
|
|
webService.WMSInterfaceStockIn(barcode, zcPartNo, batchNo, 1);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase("工位:" + label1.Text.Trim() + ",一码到底调用WMS接口:" + ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
ProScreenFunc.SavePartAndProduct2(barcode, productId2, productId1, "", "", "",sn,ProScreenFunc.GetStationId(ConfigurationManager.AppSettings["StationNo"]), ConfigurationManager.AppSettings["StationDescription"]);
|
|
ProScreenFunc.SaveZcCode(barcode, zcPartNo);
|
|
try
|
|
{
|
|
if (ConfigurationManager.AppSettings["PrintEnable"].ToLower() == "true")
|
|
{
|
|
string path = Application.StartupPath + @"\aaa.grf";
|
|
Report.Initialize += new _IGridppReportEvents_InitializeEventHandler(ReportInitialize_New);
|
|
|
|
Report.Register("");
|
|
Report.LoadFromFile(path);
|
|
Report.Print(false);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw ex;
|
|
}
|
|
|
|
|
|
label7.Text = ProScreenFunc.CompleteQty(ProScreenFunc.GetStationId(ConfigurationManager.AppSettings["StationNo"])).ToString();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("雷达支架不匹配");
|
|
}
|
|
}
|
|
private void ReportInitialize()
|
|
{
|
|
Report.ParameterByName("oneBarCode").Value = oneBarCode;
|
|
Report.ParameterByName("zcPartNo").Value = label3.Text.Trim();
|
|
Report.ParameterByName("zcName").Value = label4.Text.Trim();
|
|
}
|
|
|
|
private void ReportInitialize_New()
|
|
{
|
|
Report.ParameterByName("oneBarCode").Value = oneBarCode;
|
|
Report.ParameterByName("zcPartNo").Value = zcPartNo;
|
|
Report.ParameterByName("zcName").Value = productName;
|
|
}
|
|
|
|
private void ReportInitialize1()
|
|
{
|
|
string barcode = textBox1.Text.Trim();
|
|
if (barcode.Contains("."))
|
|
{
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
}
|
|
DateTime time = DateTime.Now;
|
|
if (label3.Text.Trim().Contains("A2477900588-"))
|
|
{
|
|
Report.ParameterByName("Des").Value = "X247S";
|
|
}
|
|
if (label3.Text.Trim().Contains("A2477900000-"))
|
|
{
|
|
Report.ParameterByName("Des").Value = "H247S";
|
|
}
|
|
Report.ParameterByName("PartNo").Value = label3.Text.Trim();
|
|
Report.ParameterByName("PartName").Value = label4.Text.Trim();
|
|
Report.ParameterByName("BatchNo").Value = time.ToString("yyMMdd");
|
|
string tmp = ProScreenFunc.SerialNo(label3.Text.Trim(), time.ToString("yyMMdd"));
|
|
string sn = "";
|
|
if (tmp == "")
|
|
{
|
|
sn =
|
|
label3.Text.Trim() + "." + time.ToString("yyMMdd") + ".000001";
|
|
}
|
|
else
|
|
{
|
|
sn = tmp.Substring(0, tmp.Length - 6) +
|
|
(int.Parse(tmp.Substring(tmp.Length - 6, 6)) + 1).ToString()
|
|
.PadLeft(6, '0');
|
|
}
|
|
|
|
Report.ParameterByName("SerialNo").Value = sn;
|
|
Report.ParameterByName("BarCode").Value = sn + ";24;2217;;.0;" + time.ToString("yyyy/MM/dd");
|
|
Report.ParameterByName("oneBarCode").Value = barcode;
|
|
//Report.ParameterByName("PartName").Value = label4.Text.Trim();
|
|
//Report.ParameterByName("BatchNo").Value = time.ToString("yyMMdd");
|
|
//string tmp = ProScreenFunc.SerialNo(label3.Text.Trim(), time.ToString("yyMMdd"));
|
|
//string sn = "";
|
|
//if (tmp == "")
|
|
//{
|
|
// sn =
|
|
// label3.Text.Trim() + "." + time.ToString("yyMMdd") + ".000001";
|
|
//}
|
|
//else
|
|
//{
|
|
// sn = tmp.Substring(0, tmp.Length - 6) +
|
|
// (int.Parse(tmp.Substring(tmp.Length - 6, 6)) + 1).ToString()
|
|
// .PadLeft(6, '0');
|
|
//}
|
|
|
|
//Report.ParameterByName("SerialNo").Value = sn;
|
|
//Report.ParameterByName("BarCode").Value = sn + ";24;2217;;.0;" + time.ToString("yyyy/MM/dd");
|
|
}
|
|
|
|
private void timer1_Tick(object sender, EventArgs e)
|
|
{
|
|
string orderNo = label2.Text.Trim();
|
|
if (string.IsNullOrWhiteSpace(orderNo))
|
|
{
|
|
LoadScreen();
|
|
}
|
|
}
|
|
|
|
public void LoadPlanScreen(string id, string plan)
|
|
{
|
|
string stationNo = ConfigurationManager.AppSettings["StationNo"];
|
|
IsPass = false;
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreenPlan(id, stationNo, plan);
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
{
|
|
SetPage(dt);
|
|
}
|
|
else
|
|
{
|
|
if (plan == "下一计划")
|
|
{
|
|
MessageBox.Show("无下一计划");
|
|
textBox1.SelectAll();
|
|
textBox1.Focus();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("无上一计划");
|
|
textBox1.SelectAll();
|
|
textBox1.Focus();
|
|
}
|
|
}
|
|
textBox1.SelectAll();
|
|
textBox1.Focus();
|
|
}
|
|
|
|
#region 按钮
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
LoadPlanScreen(this.Tag.ToString(), "上一计划");
|
|
if (ConfigurationManager.AppSettings["StationNo"] == "ZP70")
|
|
{
|
|
txtBoxL.Select();
|
|
txtBoxL.Focus();
|
|
}
|
|
}
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
{
|
|
LoadPlanScreen(this.Tag.ToString(), "下一计划");
|
|
if (ConfigurationManager.AppSettings["StationNo"] == "ZP70")
|
|
{
|
|
txtBoxL.Select();
|
|
txtBoxL.Focus();
|
|
}
|
|
}
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
{
|
|
textBox2.Visible = true;
|
|
textBox2.Focus();
|
|
}
|
|
|
|
private void button5_Click(object sender, EventArgs e)
|
|
{
|
|
textBox3.Visible = true;
|
|
textBox3.Focus();
|
|
}
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
{
|
|
FrmProScreen2 frm = new FrmProScreen2();
|
|
frm.Show();
|
|
}
|
|
|
|
private void textBox2_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string barcode = textBox2.Text.Trim();
|
|
if (barcode.Contains("."))
|
|
{
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
}
|
|
|
|
#region 不合格扫码后先判断该条码是否已经变成总成,如果没有变成总成,报错未进行装配,如果已是总成,那么完成数减一,不合格数加一
|
|
|
|
if (ProScreenFunc.HaveScan(barcode))
|
|
{
|
|
#region 调WMS接口--20200522注销:不需要调WMS接口
|
|
|
|
//try
|
|
//{
|
|
// LogHelper.WriteSysLogBase("条码号:" + barcode + "工位:" + label1.Text.Trim() + ",一码到底调用WMS接口", MethodBase.GetCurrentMethod().Name);
|
|
|
|
// string stockNo = "";
|
|
// string batchNo = "";
|
|
// string partNo = "";
|
|
// ProScreenFunc.GetCode(barcode, out stockNo, out batchNo, out partNo);
|
|
|
|
// partNo = label3.Text.Trim();
|
|
// batchNo = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
// WMSWebService webService = new WMSWebService();
|
|
// webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"].ToString();
|
|
|
|
// webService.WMSInterfaceStockIn(barcode, partNo, batchNo, 0);
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// LogHelper.WriteErrLogBase("工位:" + label1.Text.Trim() + ",一码到底调用WMS接口:" + ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region 不良数+1,完成数-1,不能扣当前计划,查询以前扫码记录,扣减相应计划
|
|
|
|
//根据条码查计划,传计划ID
|
|
string planID = ProScreenFunc.GetPlanIDByBarcode(barcode);
|
|
ProScreenFunc.AddBadCount(planID.Trim());
|
|
ProScreenFunc.SubCompleteCount(planID.Trim());
|
|
|
|
ProScreenFunc.SaveRecord2(barcode, "0", planID);
|
|
|
|
#endregion
|
|
|
|
//根据计划ID查计划,页面赋值
|
|
DataTable dt = ProScreenFunc.GetProScreenByPlanID(this.Tag.ToString().Trim());
|
|
SetPage(dt);
|
|
|
|
//label10.Text = (Tools.NumericParse.StringToInt(label10.Text.Trim()) + 1).ToString();
|
|
//label7.Text = (Tools.NumericParse.StringToInt(label7.Text.Trim()) - 1).ToString();
|
|
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("还未进行装配!", "提示");
|
|
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
}
|
|
|
|
#endregion
|
|
|
|
}
|
|
else if (e.KeyCode == Keys.Escape)
|
|
{
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
}
|
|
|
|
}
|
|
|
|
private void textBox3_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string barcode = textBox3.Text.Trim();
|
|
if (barcode.Contains("."))
|
|
{
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
}
|
|
|
|
#region 调WMS接口--20200522注销:不需要调WMS接口
|
|
|
|
//try
|
|
//{
|
|
// LogHelper.WriteSysLogBase("条码号:" + barcode + "工位:" + label1.Text.Trim() + ",一码到底调用WMS接口", MethodBase.GetCurrentMethod().Name);
|
|
// string stockNo = "";
|
|
// string batchNo = "";
|
|
// string partNo = "";
|
|
// ProScreenFunc.GetCode(barcode, out stockNo, out batchNo, out partNo);
|
|
|
|
// partNo = label3.Text.Trim();
|
|
// batchNo = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
// WMSWebService webService = new WMSWebService();
|
|
// webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"].ToString();
|
|
|
|
// webService.WMSInterfaceStockIn(barcode, partNo, batchNo, 1);
|
|
//}
|
|
//catch (Exception ex)
|
|
//{
|
|
// LogHelper.WriteErrLogBase("工位:" + label1.Text.Trim() + ",一码到底调用WMS接口:" + ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
//}
|
|
|
|
#endregion
|
|
|
|
#region 不良数-1,完成数+1
|
|
|
|
string planID = ProScreenFunc.GetPlanIDByBarcode(barcode);
|
|
ProScreenFunc.SubBadCount(planID.Trim());
|
|
ProScreenFunc.AddCompleteCount(planID.Trim());
|
|
|
|
ProScreenFunc.SaveRecord2(barcode, "1", planID);
|
|
|
|
#endregion
|
|
|
|
if (ProScreenFunc.CheckPlanCompleted(this.Tag.ToString().Trim()))
|
|
{
|
|
LoadScreen();
|
|
}
|
|
else
|
|
{
|
|
//label10.Text = (Tools.NumericParse.StringToInt(label10.Text.Trim()) - 1).ToString();
|
|
//label7.Text = (Tools.NumericParse.StringToInt(label7.Text.Trim()) + 1).ToString();
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreenByPlanID(this.Tag.ToString().Trim());
|
|
SetPage(dt);
|
|
}
|
|
|
|
textBox3.Text = "";
|
|
textBox3.Visible = false;
|
|
}
|
|
else if (e.KeyCode == Keys.Escape)
|
|
{
|
|
textBox3.Text = "";
|
|
textBox3.Visible = false;
|
|
}
|
|
}
|
|
|
|
private void textBox3_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
textBox3.Text = "";
|
|
textBox3.Visible = false;
|
|
}
|
|
|
|
private void textBox2_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
textBox2.Text = "";
|
|
textBox2.Visible = false;
|
|
}
|
|
|
|
#endregion
|
|
|
|
private void label9_Click(object sender, EventArgs e)
|
|
{
|
|
Environment.Exit(0);
|
|
}
|
|
|
|
|
|
void opcGroup1_DataChange(int TransactionID, int NumItems, ref Array ClientHandles, ref Array ItemValues, ref Array Qualities, ref Array TimeStamps)
|
|
{
|
|
try
|
|
{
|
|
for (int i = 1; i <= NumItems; i++)
|
|
{
|
|
int handle = Convert.ToInt32(ClientHandles.GetValue(i).ToString().Trim());
|
|
string value = ItemValues.GetValue(i).ToString();
|
|
string address = opcHelper.opcItemm1[(Convert.ToInt32(ClientHandles.GetValue(i)))].ItemID;
|
|
|
|
if (handle == 0)
|
|
{
|
|
if (value == "1" || value.ToUpper() == "TRUE")
|
|
{
|
|
lbFinish.Text = "运行完成";
|
|
|
|
}
|
|
else
|
|
{
|
|
lbFinish.Text = "正在运行";
|
|
}
|
|
}
|
|
|
|
if (handle == 1)
|
|
{
|
|
if (value == "1")
|
|
{
|
|
lbmode.Text = "手动";
|
|
}
|
|
else if (value == "2")
|
|
{
|
|
lbmode.Text = "复位";
|
|
}
|
|
else if (value == "3")
|
|
{
|
|
lbmode.Text = "自动";
|
|
}
|
|
else if (value == "4")
|
|
{
|
|
lbmode.Text = "半自动";
|
|
}
|
|
}
|
|
if (handle == 2)
|
|
{
|
|
if (value == "1" || value.ToUpper() == "TRUE")
|
|
{
|
|
lbState.Text = "等待放件状态";
|
|
}
|
|
else
|
|
{
|
|
lbState.Text = "设备未准备OK";
|
|
}
|
|
}
|
|
|
|
if (handle == 3 || handle == 4)
|
|
{
|
|
if (value == "1" || value.ToUpper() == "TRUE")
|
|
{
|
|
IsChangeBox = true;
|
|
OpenPanelRD();
|
|
}
|
|
else
|
|
{
|
|
IsChangeBox = false;
|
|
//PanelRD.Visible = false;
|
|
}
|
|
}
|
|
|
|
|
|
if (handle == 5)
|
|
{
|
|
if (value == "1" || value.ToUpper() == "TRUE")
|
|
{
|
|
lbOK.Text = "NG";
|
|
}
|
|
else
|
|
{
|
|
lbOK.Text = "OK";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
|
|
private void button7_Click(object sender, EventArgs e)
|
|
{
|
|
txtBoxL.Text = "";
|
|
txtBoxR.Text = "";
|
|
PanelRD.Visible = false;
|
|
}
|
|
|
|
private void txtBoxL_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
if (ConfigurationManager.AppSettings["StationNo"] == "ZP70")
|
|
{
|
|
if (label3.Text.Contains("A1778858705P-") || label3.Text.Contains("A1778858705W-"))
|
|
{
|
|
if (txtBoxL.Text.Trim() == "A0008176203")
|
|
{
|
|
IsPass = true;
|
|
txtBoxL.Text = "";
|
|
PanelRD.Visible = false;
|
|
textBox1.Focus();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("奔驰标条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxL.SelectAll();
|
|
}
|
|
}
|
|
if (label3.Text.Contains("A1778858705AP-") || label3.Text.Contains("A1778858705AW-"))
|
|
{
|
|
if (txtBoxL.Text.Trim() == "A0008170408")
|
|
{
|
|
IsPass = true;
|
|
txtBoxL.Text = "";
|
|
PanelRD.Visible = false;
|
|
textBox1.Focus();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("奔驰标条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxL.SelectAll();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
string[] barCode1 = txtBoxL.Text.Split('.');
|
|
if (barCode1.Length > 0)
|
|
{
|
|
string[] part = barCode1[0].Split('-');
|
|
if (part.Length == 2)
|
|
{
|
|
txtBoxR.Focus();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("左雷达支架条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxL.SelectAll();
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("左雷达支架条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxL.SelectAll();
|
|
return;
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
|
|
private void txtBoxR_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
string color1 = "", color2 = "";
|
|
|
|
string[] barCode2 = txtBoxR.Text.Split('.');
|
|
|
|
if (barCode2.Length > 0)
|
|
{
|
|
string[] part = barCode2[0].Split('-');
|
|
if (part.Length == 2)
|
|
{
|
|
color2 = part[1].ToString();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("右雷达支架条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxR.SelectAll();
|
|
return;
|
|
}
|
|
|
|
string[] barCode1 = txtBoxL.Text.Split('.');
|
|
string[] part1 = barCode1[0].Split('-');
|
|
|
|
color1 = part1[1].ToString();
|
|
|
|
if (color1 != color2)
|
|
{
|
|
MessageBox.Show("左右雷达支架不匹配,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxR.SelectAll();
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
|
|
string[] planCs = label3.Text.Trim().Split('-');
|
|
if (planCs.Length > 1)
|
|
{
|
|
string planC = planCs[1];
|
|
if (planC == color1)
|
|
{
|
|
IsPass = true;
|
|
|
|
txtBoxL.Text = "";
|
|
txtBoxR.Text = "";
|
|
PanelRD.Visible = false;
|
|
|
|
textBox1.Focus();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
IsPass = false;
|
|
MessageBox.Show("雷达支架颜色与计划颜色不一致");
|
|
|
|
txtBoxL.Text = "";
|
|
txtBoxR.Text = "";
|
|
txtBoxL.Focus();
|
|
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("右雷达支架条码有误,请重新扫描!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
txtBoxL.SelectAll();
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
{
|
|
textBox4.Text = "";
|
|
textBox4.Visible = true;
|
|
textBox4.Focus();
|
|
}
|
|
|
|
private void textBox4_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.Enter)
|
|
{
|
|
try
|
|
{
|
|
string barcode = textBox4.Text.Trim();
|
|
if (barcode.Contains("."))
|
|
{
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
}
|
|
|
|
DataTable dtHg = ProScreenFunc.GetGh(barcode);
|
|
if (dtHg == null || dtHg.Rows.Count < 1)
|
|
{
|
|
MessageBox.Show("未装配,不能补打标签!");
|
|
textBox4_DoubleClick(sender, e);
|
|
return;
|
|
}
|
|
|
|
DataTable dtBl = ProScreenFunc.GetBl(barcode);
|
|
if (dtBl != null && dtBl.Rows.Count > 0)
|
|
{
|
|
DateTime hgTime = (DateTime)Tools.NumericParse.StringToDateTime("1900-01-01 00:00:00");
|
|
DataTable dtHG1 = ProScreenFunc.GetHG_New(barcode);
|
|
if (dtHG1 != null && dtHG1.Rows.Count > 0)
|
|
{
|
|
hgTime = (DateTime)Tools.NumericParse.StringToDateTime(dtHG1.Rows[0]["CreateTime"].ToString());
|
|
}
|
|
|
|
DateTime blTime = (DateTime)Tools.NumericParse.StringToDateTime(dtBl.Rows[0]["createTime"].ToString());
|
|
if (DateTime.Compare(blTime, hgTime) > 0)
|
|
{
|
|
MessageBox.Show("产品不良,不能补打标签!");
|
|
textBox4_DoubleClick(sender, e);
|
|
return;
|
|
}
|
|
}
|
|
|
|
|
|
LogSysBLL.AddInfo("条码:" + barcode + "补打标签", MethodBase.GetCurrentMethod());
|
|
|
|
string zcID = dtHg.Rows[0]["ZcID"].ToString();
|
|
ZcPrintLabel zl = ProScreenFunc.GetZcPrintLabel(zcID);
|
|
if (zl != null && zl.zcPartNo != null && zl.zcName != null)
|
|
{
|
|
if (ConfigurationManager.AppSettings["PrintEnable"].ToString().ToLower() == "true")
|
|
{
|
|
if (zl.zcPartNo.Contains("A2477900588-") || zl.zcPartNo.Contains("A2477900000-"))
|
|
{
|
|
string path = System.Windows.Forms.Application.StartupPath + @"\aaa1.grf";
|
|
|
|
GridppReport Report2 = new GridppReport();
|
|
Report2.Register("");
|
|
Report2.LoadFromFile(path);
|
|
if (zl.zcPartNo.Contains("A2477900588-"))
|
|
{
|
|
Report2.ParameterByName("Des").Value = "X247S";
|
|
}
|
|
if (zl.zcPartNo.Contains("A2477900000-"))
|
|
{
|
|
Report2.ParameterByName("Des").Value = "H247S";
|
|
}
|
|
Report2.ParameterByName("PartNo").Value = zl.zcPartNo;
|
|
Report2.ParameterByName("PartName").Value = zl.zcName;
|
|
string sn = dtHg.Rows[0]["SerialNo"].ToString();
|
|
Report2.ParameterByName("SerialNo").Value = sn;
|
|
string[] tmp = sn.Split('.');
|
|
Report2.ParameterByName("BarCode").Value = sn + ";24;2217;;.0;" + tmp[1];
|
|
Report2.ParameterByName("oneBarCode").Value = barcode;
|
|
Report2.ParameterByName("BatchNo").Value = tmp[1];
|
|
Report2.Print(false);
|
|
textBox4.SelectAll();
|
|
}
|
|
else
|
|
{
|
|
string path = System.Windows.Forms.Application.StartupPath + @"\aaa.grf";
|
|
|
|
GridppReport Report1 = new GridppReport();
|
|
Report1.Register("");
|
|
Report1.LoadFromFile(path);
|
|
Report1.ParameterByName("oneBarCode").Value = barcode;
|
|
Report1.ParameterByName("zcPartNo").Value = zl.zcPartNo;
|
|
Report1.ParameterByName("zcName").Value = zl.zcName;
|
|
Report1.Print(false);
|
|
textBox4.SelectAll();
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("根据总成号找不到对应名称,请维护基础数据!");
|
|
textBox4_DoubleClick(sender, e);
|
|
return;
|
|
}
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
textBox4_DoubleClick(sender, e);
|
|
}
|
|
}
|
|
else if (e.KeyCode == Keys.Escape)
|
|
{
|
|
textBox4_DoubleClick(sender, e);
|
|
}
|
|
}
|
|
|
|
private void textBox4_DoubleClick(object sender, EventArgs e)
|
|
{
|
|
textBox4.Text = "";
|
|
textBox4.Visible = false;
|
|
}
|
|
|
|
private void label10_Click(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
|