|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.ComponentModel;
|
|
|
|
using System.Configuration;
|
|
|
|
using System.Data;
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
using System.Drawing;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Reflection;
|
|
|
|
using System.Text;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Windows.Forms;
|
|
|
|
using DBUtility;
|
|
|
|
using gregn6Lib;
|
|
|
|
using MESClassLibrary.BLL.Log;
|
|
|
|
using PunchAndWeld.DataSouce;
|
|
|
|
using PunchAndWeld.WebReference;
|
|
|
|
|
|
|
|
namespace PunchAndWeld
|
|
|
|
{
|
|
|
|
public partial class FrmDoorSillNew : Form
|
|
|
|
{
|
|
|
|
public bool IsChangeBox = false;
|
|
|
|
public bool IsPass = false;
|
|
|
|
private string IsHigh = "1";
|
|
|
|
|
|
|
|
private GridppReport Report = new GridppReport();
|
|
|
|
|
|
|
|
string[] partNo1 = new string[10];
|
|
|
|
string zcPartNo = "", planID = "", zcPartName = "", zcHigh = "", sn;
|
|
|
|
private string barCode1 = "", barCode2 = "", barCode3 = "";
|
|
|
|
string stationNo = "", stationId="";
|
|
|
|
|
|
|
|
public FrmDoorSillNew()
|
|
|
|
{
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void FrmDoorSillNew_Load(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
label5.Text = "当前版本:" + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
|
|
|
stationNo = ConfigurationManager.AppSettings["StationNo"].ToString();
|
|
|
|
stationId = ProScreenFunc.GetStationId(stationNo);
|
|
|
|
label1.Text = ProScreenFunc.GetStation(stationNo);
|
|
|
|
|
|
|
|
Control.CheckForIllegalCrossThreadCalls = false;
|
|
|
|
Thread t = new Thread(new ThreadStart(TimeGo));
|
|
|
|
t.Start();
|
|
|
|
if (ConfigurationManager.AppSettings["IsHaveVisual"] == "1")
|
|
|
|
{
|
|
|
|
SqlStart();
|
|
|
|
}
|
|
|
|
|
|
|
|
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, stationNo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
label1.Text = ProScreenFunc.GetStation(stationNo);
|
|
|
|
label2.Text = "";
|
|
|
|
label3.Text = "";
|
|
|
|
label4.Text = "";
|
|
|
|
//label5.Text = dt.Rows[0]["Des"].ToString();
|
|
|
|
label6.Text = "0";
|
|
|
|
label7.Text = "0";
|
|
|
|
label8.Text = "";
|
|
|
|
|
|
|
|
this.Tag = "";
|
|
|
|
planID = this.Tag.ToString();
|
|
|
|
textBox1.Tag = "";
|
|
|
|
textBox1.Text = "";
|
|
|
|
|
|
|
|
MessageBox.Show("无计划!", "提示", MessageBoxButtons.OK);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SetPage(DataTable dt,string stationNo)
|
|
|
|
{
|
|
|
|
textBox2.Text = "";
|
|
|
|
textBox2.Visible = false;
|
|
|
|
textBox3.Text = "";
|
|
|
|
textBox3.Visible = false;
|
|
|
|
textBox4.Text = "";
|
|
|
|
textBox4.Visible = false;
|
|
|
|
|
|
|
|
textBox5.Text = "";
|
|
|
|
textBox5.Visible = false;
|
|
|
|
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
#region 页面赋值
|
|
|
|
|
|
|
|
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) + "班";
|
|
|
|
|
|
|
|
this.Tag = dt.Rows[0]["ID"].ToString(); //计划ID
|
|
|
|
planID = this.Tag.ToString();
|
|
|
|
textBox1.Tag = dt.Rows[0]["ProductID1"].ToString();
|
|
|
|
textBox1.Text = "";
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
#region 绑定校验物料
|
|
|
|
|
|
|
|
InitList(stationNo, label3.Text,"");
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 上一计划
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
if (this.Tag == null || string.IsNullOrWhiteSpace(this.Tag.ToString()))
|
|
|
|
//if (this.Tag.ToString() == "" || string.IsNullOrWhiteSpace(this.Tag.ToString()))
|
|
|
|
{
|
|
|
|
MessageBox.Show("无上一计划!", "提示");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LoadPlanScreen(this.Tag.ToString(), "上一计划");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 下一计划
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void button2_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
if (this.Tag == null || string.IsNullOrWhiteSpace(this.Tag.ToString()))
|
|
|
|
//if (this.Tag.ToString() == "")
|
|
|
|
{
|
|
|
|
MessageBox.Show("无下一计划!", "提示");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
LoadPlanScreen(this.Tag.ToString(), "下一计划");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void LoadPlanScreen(string id, string plan)
|
|
|
|
{
|
|
|
|
//string stationNo = ConfigurationManager.AppSettings["StationNo"].ToString();
|
|
|
|
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreenPlan(id, stationNo, plan);
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
SetPage(dt, stationNo);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (plan == "下一计划")
|
|
|
|
MessageBox.Show("无下一计划");
|
|
|
|
else
|
|
|
|
MessageBox.Show("无上一计划");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 计划查询
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void button6_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
FrmProScreen2 frm = new FrmProScreen2();
|
|
|
|
frm.OkClick += (arg1) =>
|
|
|
|
{
|
|
|
|
this.Tag = arg1;
|
|
|
|
|
|
|
|
frm.Close();
|
|
|
|
LoadPlanScreen(arg1, "当前计划");
|
|
|
|
};
|
|
|
|
frm.ShowDialog();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void InitList(string stationNo, string partNo,string tempPartNo)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
listView1.Items.Clear();
|
|
|
|
DataTable dt = ProScreenFunc.GetOtherPart(stationNo, partNo);
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
for (int i = 0; i < dt.Rows.Count; i++)
|
|
|
|
{
|
|
|
|
ListViewItem lvi = new ListViewItem(dt.Rows[i]["PartNo"].ToString());
|
|
|
|
lvi.SubItems.Add(dt.Rows[i]["PartName"].ToString());
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(dt.Rows[i]["PartNo"].ToString()) && !string.IsNullOrWhiteSpace(dt.Rows[i]["IsCheck"].ToString()))
|
|
|
|
{
|
|
|
|
lvi.SubItems.Add("未通过");
|
|
|
|
}
|
|
|
|
lvi.SubItems.Add(dt.Rows[i]["Qty"].ToString());
|
|
|
|
|
|
|
|
listView1.Items.Add(lvi);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void textBox1_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (ConfigurationManager.AppSettings["IsHaveVisual"] == "1")
|
|
|
|
{
|
|
|
|
DataTable dt1 = ProScreenFunc.HavePrint(stationId);
|
|
|
|
if (dt1 != null && dt1.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
zcPartNo = dt1.Rows[0]["PartNo"].ToString();
|
|
|
|
if (ProScreenFunc.IsNeedVisual(zcPartNo))
|
|
|
|
{
|
|
|
|
MessageBox.Show("存在未打印标签的产品,不允许扫描!");
|
|
|
|
textBox1.SelectAll();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
CheckPartAndProduct();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void CheckPartAndProduct()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
textBox1.SelectAll();
|
|
|
|
string barcode = textBox1.Text.Trim();
|
|
|
|
|
|
|
|
if (barcode.Contains("."))
|
|
|
|
{
|
|
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ScanBarcode(string barcode)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
string productID1 = "",productID2 = "",partNo2="";
|
|
|
|
bool high = false;
|
|
|
|
string zcPartNo1 = label3.Text;
|
|
|
|
string zcPartName1 = label4.Text;
|
|
|
|
string planId = planID;
|
|
|
|
string tagId = this.Tag.ToString();
|
|
|
|
|
|
|
|
productID1 = textBox1.Tag.ToString();
|
|
|
|
|
|
|
|
|
|
|
|
high = ProScreenFunc.IsHigh(zcPartNo1);
|
|
|
|
|
|
|
|
if (high && !ProScreenFunc.IsScan(textBox1.Text.Trim()))
|
|
|
|
{
|
|
|
|
MessageBox.Show("无法装配,高配需要过激光切割!", "提示", MessageBoxButtons.OK);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!high && ProScreenFunc.IsScan(textBox1.Text.Trim()))
|
|
|
|
{
|
|
|
|
MessageBox.Show("无法装配,低配不需要过激光切割!", "提示", MessageBoxButtons.OK);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
string[] codeSpecial = ProScreenFunc.GetSpecialStockNo();
|
|
|
|
|
|
|
|
string code = barcode.Substring(0, 10);
|
|
|
|
if (codeSpecial.Contains(code))
|
|
|
|
{
|
|
|
|
productID2 = ProScreenFunc.GetProductID(code, "");
|
|
|
|
partNo2 = ProScreenFunc.GetPartNoByStockNo(code);
|
|
|
|
//AfterScanBarcode(barcode, productID2, productID1, this.Tag.ToString().Trim());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (barcode.Substring(0, 2) != "22")
|
|
|
|
{
|
|
|
|
string[] codeSpecial1 = ProScreenFunc.GetSpecialStockNo();
|
|
|
|
string code1 = barcode.Substring(0, 10);
|
|
|
|
if (codeSpecial1.Contains(code1))
|
|
|
|
{
|
|
|
|
productID2 = ProScreenFunc.GetProductID(code, "");
|
|
|
|
partNo2 = ProScreenFunc.GetPartNoByStockNo(code);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
productID2 = ProScreenFunc.GetProductID(barcode);
|
|
|
|
if (string.IsNullOrWhiteSpace(productID2))
|
|
|
|
{
|
|
|
|
string stockNo = barcode.Substring(0, 10);
|
|
|
|
productID2 = ProScreenFunc.GetProductID(stockNo, "");
|
|
|
|
}
|
|
|
|
partNo2 = ProScreenFunc.GetPartNoByID(productID2);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
ListViewItem liv = listView1.Items.Cast<ListViewItem>().First(x => x.SubItems[0].Text == partNo2);
|
|
|
|
int index = liv.Index;
|
|
|
|
if (index!=0)
|
|
|
|
{
|
|
|
|
MessageBox.Show("条码和总成不匹配!");
|
|
|
|
textBox1.SelectAll();
|
|
|
|
textBox1.Focus();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
listView1.Items[index].SubItems[2].Text = "通过";
|
|
|
|
|
|
|
|
bool isScan = ProScreenFunc.IsScan(barcode);
|
|
|
|
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 frm=new FrmProScreen3(parts);
|
|
|
|
frm.ShowDialog();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
ScanAll.ScanResult = true;
|
|
|
|
ScanAll.barCode1 = "";
|
|
|
|
ScanAll.barCode2 = "";
|
|
|
|
ScanAll.barCode3 = "";
|
|
|
|
ScanAll.barCode4 = "";
|
|
|
|
ScanAll.barCode5 = "";
|
|
|
|
ScanAll.barCode6 = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ScanAll.ScanResult)
|
|
|
|
{
|
|
|
|
bool aa = false,toWms=true;
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(ScanAll.partNo1))
|
|
|
|
{
|
|
|
|
ListViewItem liv1 = listView1.Items.Cast<ListViewItem>()
|
|
|
|
.First(x => x.SubItems[0].Text == ScanAll.partNo1);
|
|
|
|
int index1 = liv1.Index;
|
|
|
|
listView1.Items[index1].SubItems[2].Text = "通过";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(ScanAll.partNo2))
|
|
|
|
{
|
|
|
|
ListViewItem liv2 = listView1.Items.Cast<ListViewItem>()
|
|
|
|
.First(x => x.SubItems[0].Text == ScanAll.partNo2);
|
|
|
|
int index2 = liv2.Index;
|
|
|
|
listView1.Items[index2].SubItems[2].Text = "通过";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(ScanAll.partNo3))
|
|
|
|
{
|
|
|
|
ListViewItem liv3 = listView1.Items.Cast<ListViewItem>()
|
|
|
|
.First(x => x.SubItems[0].Text == ScanAll.partNo3);
|
|
|
|
int index3 = liv3.Index;
|
|
|
|
listView1.Items[index3].SubItems[2].Text = "通过";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(ScanAll.partNo4))
|
|
|
|
{
|
|
|
|
ListViewItem liv4 = listView1.Items.Cast<ListViewItem>()
|
|
|
|
.First(x => x.SubItems[0].Text == ScanAll.partNo4);
|
|
|
|
int index4 = liv4.Index;
|
|
|
|
listView1.Items[index4].SubItems[2].Text = "通过";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(ScanAll.partNo5))
|
|
|
|
{
|
|
|
|
ListViewItem liv5 = listView1.Items.Cast<ListViewItem>()
|
|
|
|
.First(x => x.SubItems[0].Text == ScanAll.partNo5);
|
|
|
|
int index5 = liv5.Index;
|
|
|
|
listView1.Items[index5].SubItems[2].Text = "通过";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(ScanAll.partNo6))
|
|
|
|
{
|
|
|
|
ListViewItem liv6 = listView1.Items.Cast<ListViewItem>()
|
|
|
|
.First(x => x.SubItems[0].Text == ScanAll.partNo6);
|
|
|
|
int index6 = liv6.Index;
|
|
|
|
listView1.Items[index6].SubItems[2].Text = "通过";
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ConfigurationManager.AppSettings["IsHaveVisual"] != "1")
|
|
|
|
{
|
|
|
|
if ((IsChangeBox && IsPass) || (!IsChangeBox ))
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
toWms = ProScreenFunc.IsToWms(barcode);
|
|
|
|
if (!toWms)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
partNo = zcPartNo1;
|
|
|
|
batchNo = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
|
|
|
WMSWebService webService = new WMSWebService();
|
|
|
|
webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"].ToString();
|
|
|
|
|
|
|
|
aa = webService.WMSInterfaceStockIn(barcode, partNo, batchNo, 1);
|
|
|
|
if (aa)
|
|
|
|
{
|
|
|
|
ProScreenFunc.SaveToWmsRecord(barcode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogHelper.WriteErrLogBase("工位:" + label1.Text.Trim() + ",一码到底调用WMS接口:" + ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
|
|
}
|
|
|
|
if (aa ||toWms)
|
|
|
|
{
|
|
|
|
DateTime time = DateTime.Now;
|
|
|
|
string tmp = ProScreenFunc.SerialNo(zcPartNo1, time.ToString("yyMMdd"));
|
|
|
|
if (tmp == "")
|
|
|
|
{
|
|
|
|
sn =
|
|
|
|
zcPartNo1 + "." + 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');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ProScreenFunc.SavePartAndProduct_New(barcode, productID2, productID1,
|
|
|
|
label2.Text.Trim(), label2.Text.Trim().Substring(0, 1) + "班", planId, sn,
|
|
|
|
ScanAll.barCode1, ScanAll.barCode2, ScanAll.barCode3,
|
|
|
|
ScanAll.barCode4, ScanAll.barCode5, ScanAll.barCode6,stationId, ConfigurationManager.AppSettings["StationDescription"]) <=0)
|
|
|
|
{
|
|
|
|
MessageBox.Show("连接数据库失败!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ProScreenFunc.SaveZcCode(barcode, zcPartNo1);
|
|
|
|
ProScreenFunc.AddCompleteCountAndFinish(planId);
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (ConfigurationManager.AppSettings["PrintEnable"].ToLower() == "true")
|
|
|
|
{
|
|
|
|
string path = "";
|
|
|
|
if (zcPartNo1.Contains("A2477900588-"))
|
|
|
|
{
|
|
|
|
path = Application.StartupPath + @"\aaa1.grf";
|
|
|
|
Report.Initialize +=
|
|
|
|
new _IGridppReportEvents_InitializeEventHandler(ReportInitialize1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
path = Application.StartupPath + @"\ZC.grf";
|
|
|
|
//Report.Initialize +=
|
|
|
|
// new _IGridppReportEvents_InitializeEventHandler(ReportInitialize);
|
|
|
|
|
|
|
|
DataTable headTable = new DataTable();
|
|
|
|
headTable.Columns.Add("SerialNo");
|
|
|
|
headTable.Columns.Add("oneBarCode");
|
|
|
|
headTable.Columns.Add("zcPartNo");
|
|
|
|
headTable.Columns.Add("zcName");
|
|
|
|
headTable.Columns.Add("zcState");
|
|
|
|
DataRow row = headTable.NewRow();
|
|
|
|
row["SerialNo"] = sn;
|
|
|
|
row["oneBarCode"] = barcode;
|
|
|
|
row["zcPartNo"] = zcPartNo1;
|
|
|
|
row["zcName"] = zcPartName1;
|
|
|
|
row["zcState"] = "";
|
|
|
|
|
|
|
|
string reportName = ConfigurationManager.AppSettings["Printer1"];
|
|
|
|
headTable.Rows.Add(row);
|
|
|
|
|
|
|
|
DataTable dtDetail=ProScreenFunc.GetOtherPart(stationNo,zcPartNo1);
|
|
|
|
|
|
|
|
ReportHelper rp = new ReportHelper(path, headTable, dtDetail,
|
|
|
|
(int)GRPaperOrientation.grpoDefault, 1, reportName);
|
|
|
|
rp.Report.Print(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
throw ex;
|
|
|
|
}
|
|
|
|
|
|
|
|
ProScreenFunc.UpdatePrintTime(ProScreenFunc.SearchIdByBarCode(barcode));
|
|
|
|
|
|
|
|
|
|
|
|
if (ProScreenFunc.CheckPlanCompleted(tagId))
|
|
|
|
{
|
|
|
|
//LoadScreen();
|
|
|
|
LoadPlanScreen(this.Tag.ToString(), "下一计划");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
label7.Text = ProScreenFunc.GetCompleteCount(tagId);
|
|
|
|
}
|
|
|
|
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreenByPlanID(tagId);
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
label7.Text = dt.Rows[0]["CompleteCount"].ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!aa && !toWms)
|
|
|
|
{
|
|
|
|
MessageBox.Show("入库失败!", "提示", MessageBoxButtons.OK);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
DateTime time = DateTime.Now;
|
|
|
|
string tmp = ProScreenFunc.SerialNo(zcPartNo1, time.ToString("yyMMdd"));
|
|
|
|
if (tmp == "")
|
|
|
|
{
|
|
|
|
sn =
|
|
|
|
zcPartNo1 + "." + 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');
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ProScreenFunc.SavePartAndProduct_New(barcode, productID2, productID1,
|
|
|
|
label2.Text.Trim(), label2.Text.Trim().Substring(0, 1) + "班", planId, sn,
|
|
|
|
ScanAll.barCode1, ScanAll.barCode2, ScanAll.barCode3,
|
|
|
|
ScanAll.barCode4, ScanAll.barCode5, ScanAll.barCode6,stationId, ConfigurationManager.AppSettings["StationDescription"]) <=0)
|
|
|
|
{
|
|
|
|
MessageBox.Show("连接数据库失败!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ProScreenFunc.SaveZcCode(barcode, zcPartNo1);
|
|
|
|
if (!ProScreenFunc.IsNeedVisual(zcPartNo1))
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
toWms = ProScreenFunc.IsToWms(barcode);
|
|
|
|
if (!toWms)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
partNo = zcPartNo1;
|
|
|
|
batchNo = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
|
|
|
WMSWebService webService = new WMSWebService();
|
|
|
|
webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"].ToString();
|
|
|
|
|
|
|
|
aa = webService.WMSInterfaceStockIn(barcode, partNo, batchNo, 1);
|
|
|
|
if (aa)
|
|
|
|
{
|
|
|
|
ProScreenFunc.SaveToWmsRecord(barcode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogHelper.WriteErrLogBase("工位:" + label1.Text.Trim() + ",一码到底调用WMS接口:" + ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aa || !toWms)
|
|
|
|
{
|
|
|
|
ProScreenFunc.AddCompleteCountAndFinish(planId);
|
|
|
|
|
|
|
|
if (ProScreenFunc.UpdatePrintTime(ProScreenFunc.SearchIdByBarCode(barcode))<=0)
|
|
|
|
{
|
|
|
|
MessageBox.Show("连接数据库失败!");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (ConfigurationManager.AppSettings["PrintEnable"].ToLower() == "true")
|
|
|
|
{
|
|
|
|
string path = "";
|
|
|
|
if (zcPartNo1.Contains("A2477900588-"))
|
|
|
|
{
|
|
|
|
path = Application.StartupPath + @"\aaa1.grf";
|
|
|
|
Report.Initialize +=
|
|
|
|
new _IGridppReportEvents_InitializeEventHandler(ReportInitialize1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
path = Application.StartupPath + @"\ZC.grf";
|
|
|
|
|
|
|
|
DataTable headTable = new DataTable();
|
|
|
|
headTable.Columns.Add("SerialNo");
|
|
|
|
headTable.Columns.Add("oneBarCode");
|
|
|
|
headTable.Columns.Add("zcPartNo");
|
|
|
|
headTable.Columns.Add("zcName");
|
|
|
|
headTable.Columns.Add("zcState");
|
|
|
|
DataRow row = headTable.NewRow();
|
|
|
|
row["SerialNo"] = sn;
|
|
|
|
row["oneBarCode"] = barcode;
|
|
|
|
row["zcPartNo"] = zcPartNo1;
|
|
|
|
row["zcName"] = zcPartName1;
|
|
|
|
row["zcState"] = "";
|
|
|
|
|
|
|
|
string reportName = ConfigurationManager.AppSettings["Printer1"];
|
|
|
|
headTable.Rows.Add(row);
|
|
|
|
|
|
|
|
DataTable dtDetail = ProScreenFunc.GetOtherPart(stationNo, zcPartNo1);
|
|
|
|
|
|
|
|
ReportHelper rp = new ReportHelper(path, headTable, dtDetail,
|
|
|
|
(int)GRPaperOrientation.grpoDefault, 1, reportName);
|
|
|
|
rp.Report.Print(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
throw ex;
|
|
|
|
}
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreenByPlanID(tagId);
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
label7.Text = dt.Rows[0]["CompleteCount"].ToString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!aa && !toWms)
|
|
|
|
{
|
|
|
|
MessageBox.Show("入库失败!", "提示", MessageBoxButtons.OK);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
InitList(stationNo, label3.Text, "");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void ReportInitialize1()
|
|
|
|
{
|
|
|
|
string barcode = textBox1.Text.Trim();
|
|
|
|
if (barcode.Contains("."))
|
|
|
|
{
|
|
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
|
|
}
|
|
|
|
DateTime time = DateTime.Now;
|
|
|
|
if (zcPartNo.Contains("A2477900588-"))
|
|
|
|
{
|
|
|
|
Report.ParameterByName("Des").Value = "X247S";
|
|
|
|
}
|
|
|
|
if (zcPartNo.Contains("A2477900000-"))
|
|
|
|
{
|
|
|
|
Report.ParameterByName("Des").Value = "H247S";
|
|
|
|
}
|
|
|
|
Report.ParameterByName("PartNo").Value = zcPartNo;
|
|
|
|
Report.ParameterByName("PartName").Value = zcPartName;
|
|
|
|
Report.ParameterByName("BatchNo").Value = time.ToString("yyMMdd");
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
|
|
|
Report.ParameterByName("SerialNo").Value = sn;
|
|
|
|
Report.ParameterByName("BarCode").Value = sn + ";24;2217;;.0;" + time.ToString("yyyy/MM/dd");
|
|
|
|
Report.ParameterByName("oneBarCode").Value = barcode;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 补打标签
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void button3_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
BusinessHelper.SetRePrint(textBox4);
|
|
|
|
//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;
|
|
|
|
}
|
|
|
|
|
|
|
|
LogSysBLL.AddInfo("条码:" + barcode + "补打标签", MethodBase.GetCurrentMethod());
|
|
|
|
|
|
|
|
string zcID = dtHg.Rows[0]["ZcID"].ToString();
|
|
|
|
string zcSn = dtHg.Rows[0]["SerialNo"].ToString();
|
|
|
|
ZcPrintLabel zl = ProScreenFunc.GetZcPrintLabel(zcID);
|
|
|
|
if (zl != null && zl.zcPartNo != null && zl.zcName != null)
|
|
|
|
{
|
|
|
|
if (ConfigurationManager.AppSettings["PrintEnable"].ToLower() == "true")
|
|
|
|
{
|
|
|
|
if (zl.zcPartNo.Contains("A2477900588-") || zl.zcPartNo.Contains("A2477900000-"))
|
|
|
|
{
|
|
|
|
string path = 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 = 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("SerialNo").Value = zcSn;
|
|
|
|
//Report1.ParameterByName("zcName").Value = zl.zcName;
|
|
|
|
//Report1.Print(false);
|
|
|
|
string path = Application.StartupPath + @"\ZC.grf";
|
|
|
|
//Report.Initialize +=
|
|
|
|
// new _IGridppReportEvents_InitializeEventHandler(ReportInitialize);
|
|
|
|
|
|
|
|
DataTable headTable = new DataTable();
|
|
|
|
headTable.Columns.Add("SerialNo");
|
|
|
|
headTable.Columns.Add("oneBarCode");
|
|
|
|
headTable.Columns.Add("zcPartNo");
|
|
|
|
headTable.Columns.Add("zcName");
|
|
|
|
headTable.Columns.Add("zcState");
|
|
|
|
DataRow row = headTable.NewRow();
|
|
|
|
row["SerialNo"] = zcSn;
|
|
|
|
row["oneBarCode"] = barcode;
|
|
|
|
row["zcPartNo"] = zl.zcPartNo;
|
|
|
|
row["zcName"] = zl.zcName;
|
|
|
|
row["zcState"] = dtHg.Rows[0]["ToVisual"].ToString() == "1" ? "" : "合格";
|
|
|
|
|
|
|
|
string reportName = ConfigurationManager.AppSettings["Printer1"];
|
|
|
|
headTable.Rows.Add(row);
|
|
|
|
|
|
|
|
DataTable dtDetail = ProScreenFunc.GetOtherPart(stationNo, zl.zcPartNo);
|
|
|
|
//DataRow[] drDetails = dtDetail.Select();
|
|
|
|
//foreach (DataRow drDetail in drDetails)
|
|
|
|
//{
|
|
|
|
// dtDetail.Rows.Add(drDetail.ItemArray);
|
|
|
|
//}
|
|
|
|
|
|
|
|
ReportHelper rp = new ReportHelper(path, headTable, dtDetail,
|
|
|
|
(int)GRPaperOrientation.grpoDefault, 1, reportName);
|
|
|
|
rp.Report.Print(false);
|
|
|
|
textBox4.SelectAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MessageBox.Show("根据总成号找不到对应名称,请维护基础数据!");
|
|
|
|
textBox4_DoubleClick(sender, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void textBox4_DoubleClick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
textBox4.Text = "";
|
|
|
|
textBox4.Visible = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SqlStart()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
SqlDependency.Start(SqlHelper.SqlConnString);
|
|
|
|
SqlDependencyWatch();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SqlDependencyWatch()
|
|
|
|
{
|
|
|
|
string sSQL = "SELECT [ToVisual] FROM [dbo].[tb_Punch_Code_Record]";
|
|
|
|
|
|
|
|
using (SqlConnection connection = new SqlConnection(SqlHelper.SqlConnString))
|
|
|
|
{
|
|
|
|
using (SqlCommand command = new SqlCommand(sSQL, connection))
|
|
|
|
{
|
|
|
|
command.CommandType = CommandType.Text;
|
|
|
|
connection.Open();
|
|
|
|
SqlDependency dependency = new SqlDependency(command);
|
|
|
|
dependency.OnChange += new OnChangeEventHandler(SQLTableOnChange);
|
|
|
|
SqlDataReader sdr = command.ExecuteReader();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void SQLTableOnChange(object sender, SqlNotificationEventArgs e)
|
|
|
|
{
|
|
|
|
SqlDependencyWatch();
|
|
|
|
AfterScanBarcode1();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void AfterScanBarcode1()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
string ID = "", barcode = "", productID2 = "", productID1 = "", planId1="", toVisual = "", zcPartNo1="", zcPartName1="", sn1="";
|
|
|
|
//DataTable dt1 = ProScreenFunc.HavePrint(ConfigurationManager.AppSettings["StationNo"]);
|
|
|
|
DataTable dt1 = ProScreenFunc.HavePrint(stationId);
|
|
|
|
if (dt1 != null && dt1.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
ID = dt1.Rows[0]["ID"].ToString();
|
|
|
|
barcode = dt1.Rows[0]["barcode"].ToString();
|
|
|
|
//oneBarCode = barcode;
|
|
|
|
zcPartNo1 = dt1.Rows[0]["PartNo"].ToString();
|
|
|
|
zcPartName1 = dt1.Rows[0]["ProductName"].ToString();
|
|
|
|
planId1 = dt1.Rows[0]["PlanID"].ToString();
|
|
|
|
sn1 = dt1.Rows[0]["SerialNo"].ToString();
|
|
|
|
toVisual = dt1.Rows[0]["ToVisual"].ToString();
|
|
|
|
|
|
|
|
if (!ProScreenFunc.IsNeedVisual(zcPartNo1))
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (toVisual=="0")
|
|
|
|
{
|
|
|
|
this.Invoke((EventHandler)(delegate
|
|
|
|
{
|
|
|
|
bool aa = false, toWms = true;
|
|
|
|
|
|
|
|
try
|
|
|
|
{
|
|
|
|
toWms = ProScreenFunc.IsToWms(barcode);
|
|
|
|
if (!toWms)
|
|
|
|
{
|
|
|
|
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);
|
|
|
|
|
|
|
|
batchNo = DateTime.Now.ToString("yyyyMMdd");
|
|
|
|
|
|
|
|
WMSWebService webService = new WMSWebService();
|
|
|
|
webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"];
|
|
|
|
|
|
|
|
aa = webService.WMSInterfaceStockIn(barcode, zcPartNo1, batchNo, 1);
|
|
|
|
if (aa)
|
|
|
|
{
|
|
|
|
ProScreenFunc.SaveToWmsRecord(barcode);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogHelper.WriteErrLogBase("工位:" + label1.Text.Trim() + ",一码到底调用WMS接口:" + ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aa || toWms)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (ConfigurationManager.AppSettings["PrintEnable"].ToLower() == "true")
|
|
|
|
{
|
|
|
|
string path = "";
|
|
|
|
if (zcPartNo1.Contains("A2477900588-"))
|
|
|
|
{
|
|
|
|
path = Application.StartupPath + @"\aaa1.grf";
|
|
|
|
Report.Initialize +=
|
|
|
|
new _IGridppReportEvents_InitializeEventHandler(ReportInitialize1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
path = Application.StartupPath + @"\ZC.grf";
|
|
|
|
DataTable headTable = new DataTable();
|
|
|
|
headTable.Columns.Add("SerialNo");
|
|
|
|
headTable.Columns.Add("oneBarCode");
|
|
|
|
headTable.Columns.Add("zcPartNo");
|
|
|
|
headTable.Columns.Add("zcName");
|
|
|
|
headTable.Columns.Add("zcState");
|
|
|
|
DataRow row = headTable.NewRow();
|
|
|
|
row["SerialNo"] = sn1;
|
|
|
|
row["oneBarCode"] = barcode;
|
|
|
|
row["zcPartNo"] = zcPartNo1;
|
|
|
|
row["zcName"] = zcPartName1;
|
|
|
|
row["zcState"] = "合格";
|
|
|
|
|
|
|
|
string reportName = ConfigurationManager.AppSettings["Printer1"];
|
|
|
|
headTable.Rows.Add(row);
|
|
|
|
|
|
|
|
DataTable dtDetail = ProScreenFunc.GetOtherPart(ConfigurationManager.AppSettings["StationNo"], zcPartNo1);
|
|
|
|
ReportHelper rp = new ReportHelper(path, headTable, dtDetail,
|
|
|
|
(int)GRPaperOrientation.grpoDefault, 1, reportName);
|
|
|
|
rp.Report.Print(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
throw ex;
|
|
|
|
}
|
|
|
|
ProScreenFunc.UpdatePrintTime(ID);
|
|
|
|
|
|
|
|
ProScreenFunc.AddCompleteCountAndFinish(planId1);
|
|
|
|
if (planID == planId1)
|
|
|
|
{
|
|
|
|
DataTable dt = ProScreenFunc.GetProScreenByPlanID(planId1);
|
|
|
|
if (dt != null && dt.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
label7.Text = dt.Rows[0]["CompleteCount"].ToString();
|
|
|
|
}
|
|
|
|
if (ProScreenFunc.CheckPlanCompleted(this.Tag.ToString().Trim()))
|
|
|
|
{
|
|
|
|
//LoadScreen();
|
|
|
|
LoadPlanScreen(this.Tag.ToString(), "下一计划");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
label7.Text = ProScreenFunc.GetCompleteCount(this.Tag.ToString().Trim());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (!aa && !toWms)
|
|
|
|
{
|
|
|
|
MessageBox.Show("WMS入库失败");
|
|
|
|
}
|
|
|
|
}));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void label9_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
if (ConfigurationManager.AppSettings["IsHaveVisual"] == "1")
|
|
|
|
{
|
|
|
|
SqlDependency.Stop(SqlHelper.SqlConnString);
|
|
|
|
}
|
|
|
|
|
|
|
|
Environment.Exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void listView1_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// 产品不良
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
/// <param name="e"></param>
|
|
|
|
private void button4_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
textBox3.Visible = true;
|
|
|
|
textBox3.Text = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
private void textBox3_KeyDown(object sender, KeyEventArgs e)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
if (e.KeyCode == Keys.Enter)
|
|
|
|
{
|
|
|
|
string zcId = "", zcPartNo="";
|
|
|
|
int toVisual = 0;
|
|
|
|
|
|
|
|
if (string.IsNullOrWhiteSpace(textBox3.Text))
|
|
|
|
{
|
|
|
|
MessageBox.Show("条码不能为空");
|
|
|
|
textBox3.SelectAll();
|
|
|
|
textBox3.Focus();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
string barcode="";
|
|
|
|
if (barcode.Contains("."))
|
|
|
|
{
|
|
|
|
barcode = ProScreenFunc.UniteBarCodeToOne(barcode);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
barcode = textBox3.Text.Trim();
|
|
|
|
}
|
|
|
|
|
|
|
|
DataTable dtHg = ProScreenFunc.GetGh(barcode);
|
|
|
|
if (dtHg == null || dtHg.Rows.Count < 1)
|
|
|
|
{
|
|
|
|
DataTable dtD = ProScreenFunc.DelInfoByBarCode(barcode);
|
|
|
|
if (dtD != null && dtD.Rows.Count > 0)
|
|
|
|
{
|
|
|
|
zcId = dtD.Rows[0]["ZcID"].ToString();
|
|
|
|
toVisual = int.Parse(dtD.Rows[0]["ToVisual"].ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MessageBox.Show("未装配,不能删除!");
|
|
|
|
textBox3.SelectAll();
|
|
|
|
textBox3.Focus();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZcPrintLabel zl = ProScreenFunc.GetZcPrintLabel(zcId);
|
|
|
|
if (zl != null)
|
|
|
|
{
|
|
|
|
zcPartNo = zl.zcPartNo;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ProScreenFunc.IsNeedVisual(zcPartNo))
|
|
|
|
{
|
|
|
|
if (toVisual == 0)
|
|
|
|
{
|
|
|
|
MessageBox.Show("无法删除,请联系IT人员!");
|
|
|
|
textBox3_DoubleClick(sender, e);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MessageBox.Show("无法删除,请联系IT人员!");
|
|
|
|
textBox3_DoubleClick(sender, e);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int x = ProScreenFunc.AddDel(barcode);
|
|
|
|
if (x > 0)
|
|
|
|
{
|
|
|
|
MessageBox.Show("删除成功!");
|
|
|
|
textBox3_DoubleClick(sender, e);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MessageBox.Show("删除失败!");
|
|
|
|
textBox3_DoubleClick(sender, e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void textBox3_DoubleClick(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
textBox3.Visible = false;
|
|
|
|
textBox3.Text = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
private void button7_Click(object sender, EventArgs e)
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
DialogResult result = MessageBox.Show("是否重新视觉检测?", "提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
|
|
|
|
if (result == DialogResult.OK)
|
|
|
|
{
|
|
|
|
int a = ProScreenFunc.VisualRetest(ConfigurationManager.AppSettings["StationNo"]);
|
|
|
|
if (a > 0)
|
|
|
|
{
|
|
|
|
MessageBox.Show("重置成功!");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
MessageBox.Show("重置失败!");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
LogErrBLL.AddInfo(ex.ToString(),MethodBase.GetCurrentMethod());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|