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.
1595 lines
57 KiB
1595 lines
57 KiB
using PaintingPC.Model;
|
|
using PaintingPC.WebReference;
|
|
using System;
|
|
using System.Configuration;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
|
|
namespace PaintingPC
|
|
{
|
|
public partial class FrmFirstCheck : Form
|
|
{
|
|
public delegate void SideButtonDelegate(object sender);
|
|
private static SideButtonDelegate method;
|
|
|
|
//静态变量
|
|
#region 抛光
|
|
/// <summary>
|
|
/// 缺陷部位
|
|
/// </summary>
|
|
public static string damnPosition1 = "";
|
|
/// <summary>
|
|
/// 原因
|
|
/// </summary>
|
|
public static string reason1 = "";
|
|
/// <summary>
|
|
/// 缺陷部位
|
|
/// </summary>
|
|
public static string damnPosition2 = "";
|
|
/// <summary>
|
|
/// 原因
|
|
/// </summary>
|
|
public static string reason2 = "";
|
|
/// <summary>
|
|
/// 缺陷部位
|
|
/// </summary>
|
|
public static string damnPosition3 = "";
|
|
/// <summary>
|
|
/// 原因
|
|
/// </summary>
|
|
public static string reason3 = "";
|
|
/// <summary>
|
|
/// 缺陷部位
|
|
/// </summary>
|
|
public static string damnPosition4 = "";
|
|
/// <summary>
|
|
/// 原因
|
|
/// </summary>
|
|
public static string reason4 = "";
|
|
#endregion
|
|
|
|
#region 报废
|
|
/// <summary>
|
|
/// 报废-缺陷部位
|
|
/// </summary>
|
|
public static string abt_damnPosition1 = "";
|
|
/// <summary>
|
|
/// 报废-原因
|
|
/// </summary>
|
|
public static string abt_reason1 = "";
|
|
/// <summary>
|
|
/// 报废-缺陷部位
|
|
/// </summary>
|
|
public static string abt_damnPosition2 = "";
|
|
/// <summary>
|
|
/// 报废-原因
|
|
/// </summary>
|
|
public static string abt_reason2 = "";
|
|
/// <summary>
|
|
/// 报废-缺陷部位
|
|
/// </summary>
|
|
public static string abt_damnPosition3 = "";
|
|
/// <summary>
|
|
/// 报废-原因
|
|
/// </summary>
|
|
public static string abt_reason3 = "";
|
|
/// <summary>
|
|
/// 报废-缺陷部位
|
|
/// </summary>
|
|
public static string abt_damnPosition4 = "";
|
|
/// <summary>
|
|
/// 报废-原因
|
|
/// </summary>
|
|
public static string abt_reason4 = "";
|
|
#endregion
|
|
|
|
#region 修改颜色
|
|
|
|
public static string ColorName = "";
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 当前滑撬号
|
|
/// </summary>
|
|
public static string skid_No = "";
|
|
static DateTime lighttimerStart = Convert.ToDateTime("2019-01-01 00:00:00");
|
|
|
|
public FrmFirstCheck()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void FrmFirstCheck_Load(object sender, EventArgs e)
|
|
{
|
|
var serverUrl = "http://10.60.101.10:8013/";
|
|
var updateXmlFileName = "PaintUpdate.xml";
|
|
var updater = new AutoUpdater();
|
|
if (updater.CheckUpdateLoad(serverUrl, updateXmlFileName))
|
|
{
|
|
Environment.Exit(0);
|
|
}
|
|
Control.CheckForIllegalCrossThreadCalls = false;
|
|
|
|
string stockNo = "";
|
|
string batchNo = "";
|
|
string partNo = "";
|
|
|
|
labChangeColor.Visible = ConfigurationManager.AppSettings["IsShowChangeColor"].ToString() == "1" ? true : false;
|
|
|
|
Function.GetCode("22000001382011050095", out stockNo, out batchNo, out partNo);
|
|
InitPage();
|
|
}
|
|
|
|
public void InitPage()
|
|
{
|
|
try
|
|
{
|
|
string title = ConfigurationManager.AppSettings["Position"].ToString();
|
|
string station = ConfigurationManager.AppSettings["Station"].ToString();
|
|
|
|
labTitle.Text = title;
|
|
labWorkClass.Text = Function.GetWorkClass();
|
|
labStation.Text = station;
|
|
labelVersion.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();
|
|
|
|
Program.IP = ConfigurationManager.AppSettings["IP"].ToString();
|
|
|
|
ClearStaticString();
|
|
|
|
//滑撬号初始值
|
|
txtSideNo.Text = ConfigurationManager.AppSettings["SkidNoStart"].ToString();
|
|
btnSide_Click((object)1, new EventArgs());
|
|
|
|
//System.Threading.Timer timer = new System.Threading.Timer(delegate
|
|
//{
|
|
// labTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
//},
|
|
//null,
|
|
//2000,
|
|
//1000
|
|
//);
|
|
|
|
Thread t = new Thread(new ThreadStart(TimeGo));
|
|
t.Start();
|
|
|
|
Thread t2 = new Thread(new ThreadStart(LightTimerGo));
|
|
t2.Start();
|
|
}
|
|
catch (Exception ex)
|
|
{ }
|
|
}
|
|
|
|
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)
|
|
{
|
|
labTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
|
|
Thread.Sleep(500);
|
|
}
|
|
|
|
private void LightTimerGo()
|
|
{
|
|
System.Timers.Timer LightTimer = new System.Timers.Timer();
|
|
LightTimer.Interval = 100;
|
|
LightTimer.Enabled = true;
|
|
LightTimer.Elapsed += new System.Timers.ElapsedEventHandler(LightTimer_Tick);
|
|
}
|
|
|
|
private void sideBtnMethod(object sender)
|
|
{
|
|
Button btn = sender as Button;
|
|
txtSideNo.Text += btn.Text;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 清空页面
|
|
/// </summary>
|
|
public void ClearPage()
|
|
{
|
|
#region 清空页面
|
|
|
|
labXingHao1.Text = "";
|
|
labXingHao2.Text = "";
|
|
labXingHao3.Text = "";
|
|
labXingHao4.Text = "";
|
|
labColor1.Text = "";
|
|
labColor2.Text = "";
|
|
labColor3.Text = "";
|
|
labColor4.Text = "";
|
|
labBarCode1.Text = "";
|
|
labBarCode2.Text = "";
|
|
labBarCode3.Text = "";
|
|
labBarCode4.Text = "";
|
|
labColor1.Tag = "";
|
|
labColor2.Tag = "";
|
|
labColor3.Tag = "";
|
|
labColor4.Tag = "";
|
|
|
|
labDefect1.Text = "";
|
|
labDefect2.Text = "";
|
|
labDefect3.Text = "";
|
|
labDefect4.Text = "";
|
|
|
|
#region 抛光
|
|
damnPosition1 = "";
|
|
reason1 = "";
|
|
damnPosition2 = "";
|
|
reason2 = "";
|
|
damnPosition2 = "";
|
|
reason3 = "";
|
|
damnPosition4 = "";
|
|
reason4 = "";
|
|
#endregion
|
|
|
|
#region 报废
|
|
/// <summary>
|
|
/// 报废-缺陷部位
|
|
/// </summary>
|
|
abt_damnPosition1 = "";
|
|
/// <summary>
|
|
/// 报废-原因
|
|
/// </summary>
|
|
abt_reason1 = "";
|
|
/// <summary>
|
|
/// 报废-缺陷部位
|
|
/// </summary>
|
|
abt_damnPosition2 = "";
|
|
/// <summary>
|
|
/// 报废-原因
|
|
/// </summary>
|
|
abt_reason2 = "";
|
|
|
|
abt_damnPosition3 = "";
|
|
abt_reason3 = "";
|
|
abt_damnPosition4 = "";
|
|
abt_reason4 = "";
|
|
#endregion
|
|
|
|
#region 修改颜色
|
|
|
|
ColorName = "";
|
|
|
|
#endregion
|
|
|
|
#region 清空选择按钮
|
|
|
|
ClearControlColor(SetControlGroup1());
|
|
ClearControlColor(SetControlGroup2());
|
|
ClearControlColor(SetControlGroup3());
|
|
ClearControlColor(SetControlGroup4());
|
|
|
|
#endregion
|
|
|
|
#endregion
|
|
}
|
|
|
|
/// <summary>
|
|
/// 清空静态字段值
|
|
/// </summary>
|
|
public void ClearStaticString()
|
|
{
|
|
#region 抛光
|
|
damnPosition1 = "";
|
|
reason1 = "";
|
|
damnPosition2 = "";
|
|
reason2 = "";
|
|
damnPosition3 = "";
|
|
reason3 = "";
|
|
damnPosition4 = "";
|
|
reason4 = "";
|
|
#endregion
|
|
|
|
#region 报废
|
|
/// <summary>
|
|
/// 报废-缺陷部位
|
|
/// </summary>
|
|
abt_damnPosition1 = "";
|
|
/// <summary>
|
|
/// 报废-原因
|
|
/// </summary>
|
|
abt_reason1 = "";
|
|
/// <summary>
|
|
/// 报废-缺陷部位
|
|
/// </summary>
|
|
abt_damnPosition2 = "";
|
|
/// <summary>
|
|
/// 报废-原因
|
|
/// </summary>
|
|
abt_reason2 = "";
|
|
|
|
abt_damnPosition3 = "";
|
|
abt_reason3 = "";
|
|
abt_damnPosition4 = "";
|
|
abt_reason4 = "";
|
|
#endregion
|
|
|
|
#region 修改颜色
|
|
|
|
ColorName = "";
|
|
|
|
#endregion
|
|
}
|
|
|
|
#region 滑撬号数字按钮
|
|
private void btnSide1_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSide2_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSide3_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSide4_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSide5_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSide6_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSide7_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSide8_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSide9_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSide10_Click(object sender, EventArgs e)
|
|
{
|
|
method = new SideButtonDelegate(sideBtnMethod);
|
|
method(sender);
|
|
}
|
|
|
|
private void btnSideBack_Click(object sender, EventArgs e)
|
|
{
|
|
string txt = txtSideNo.Text;
|
|
if (!string.IsNullOrWhiteSpace(txt))
|
|
{
|
|
txt = txt.Remove(txt.Length - 1, 1);
|
|
txtSideNo.Text = txt;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 根据滑撬号获取条码
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnSide_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
ClearPage();
|
|
|
|
string sideNo = txtSideNo.Text.Trim();
|
|
if (!string.IsNullOrWhiteSpace(sideNo))
|
|
{
|
|
|
|
#region 获取AB,上中下
|
|
|
|
string side = "";
|
|
string title = ConfigurationManager.AppSettings["Position"].Trim();
|
|
if (title.Contains("A"))
|
|
{
|
|
side = "Side_1_BC01";
|
|
}
|
|
else
|
|
{
|
|
side = "Side_2_BC01";
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 根据滑撬号查找颜色,判断产品转几圈,一圈的获取第一个条码(多圈的获取下面有数据的行),看是几层, 获取要取的side_1_BC0X
|
|
|
|
int circle = Function.GetCircle(sideNo);
|
|
|
|
string no = ""; string aa = "";
|
|
no = Function.GetForeignBarCode(sideNo, side, circle, out aa); //获取条码
|
|
|
|
string sideBCstring = Function.GetForeignBCString(no, title); //获取BC列名
|
|
#endregion
|
|
|
|
#region 去老外库获取条码,获取页面信息
|
|
|
|
string Side_BC_1 = "";
|
|
string Side_BC_2 = "";
|
|
string Side_BC_3 = "";
|
|
string Side_BC_4 = "";
|
|
|
|
if (!string.IsNullOrWhiteSpace(sideBCstring))
|
|
{
|
|
string[] str = sideBCstring.Split(';');
|
|
if (str.Length > 1)
|
|
{
|
|
if (str.Length == 2)
|
|
{
|
|
Side_BC_1 = str[0].Trim();
|
|
Side_BC_2 = str[1].Trim();
|
|
}
|
|
if (str.Length == 3)
|
|
{
|
|
Side_BC_1 = str[0].Trim();
|
|
Side_BC_2 = str[1].Trim();
|
|
Side_BC_3 = str[2].Trim();
|
|
}
|
|
if (str.Length == 4)
|
|
{
|
|
Side_BC_1 = str[0].Trim();
|
|
Side_BC_2 = str[1].Trim();
|
|
Side_BC_3 = str[2].Trim();
|
|
Side_BC_4 = str[3].Trim();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Side_BC_1 = str[0].Trim();
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
label7.Text = Side_BC_1;
|
|
label9.Text = Side_BC_2;
|
|
label6.Text = Side_BC_3;
|
|
label17.Text = Side_BC_4;
|
|
|
|
string orderNumber = "";
|
|
string barcode1 = Function.GetForeignBarCode(sideNo, Side_BC_1, circle, out orderNumber);
|
|
string barcode11 = Function.GetForeignShangBarCode(sideNo, Side_BC_1, orderNumber);
|
|
|
|
if (barcode1.Trim() == barcode11.Trim())
|
|
{
|
|
labBarCode1.Text = Function.GetForeignBarCode(sideNo, Side_BC_1, circle, out orderNumber);
|
|
labBarCode2.Text = Function.GetForeignBarCode(sideNo, Side_BC_2, circle, out orderNumber);
|
|
labBarCode3.Text = Function.GetForeignBarCode(sideNo, Side_BC_3, circle, out orderNumber);
|
|
labBarCode4.Text = Function.GetForeignBarCode(sideNo, Side_BC_4, circle, out orderNumber);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("喷涂下线条码与喷涂上线给出条码不一致,请几秒后点击 获取 按钮重新获取条码数据");
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
labBarCode1.Text = "";
|
|
labBarCode2.Text = "";
|
|
labBarCode3.Text = "";
|
|
labBarCode4.Text = "";
|
|
}
|
|
|
|
#region 查询外国数据库获取颜色
|
|
|
|
string colorInfo = "";
|
|
string colorName = Function.GetForeignDataColor(sideNo, out colorInfo);
|
|
if (!string.IsNullOrWhiteSpace(colorName))
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(labBarCode1.Text))
|
|
{
|
|
labColor1.Text = colorName;
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(labBarCode2.Text))
|
|
{
|
|
labColor2.Text = colorName;
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(labBarCode3.Text))
|
|
{
|
|
labColor3.Text = colorName;
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(labBarCode4.Text))
|
|
{
|
|
labColor4.Text = colorName;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
labColor1.Text = "";
|
|
labColor2.Text = "";
|
|
labColor3.Text = "";
|
|
labColor4.Text = "";
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(colorInfo))
|
|
{
|
|
labColor1.Tag = colorInfo;
|
|
labColor2.Tag = colorInfo;
|
|
labColor3.Tag = colorInfo;
|
|
labColor4.Tag = colorInfo;
|
|
}
|
|
else
|
|
{
|
|
labColor1.Tag = "";
|
|
labColor2.Tag = "";
|
|
labColor3.Tag = "";
|
|
labColor4.Tag = "";
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 方案2:如果老外库里取不到条码和颜色,读取扫描的滑撬号和条码号
|
|
|
|
//if (string.IsNullOrWhiteSpace(labBarCode1.Text.Trim()) || string.IsNullOrWhiteSpace(labBarCode2.Text.Trim()))
|
|
if (string.IsNullOrWhiteSpace(labBarCode1.Text.Trim()))
|
|
{
|
|
string bcStrs = "";
|
|
DataTable dtBarCode = Function.GetMesBarCode(labTitle.Text.Trim(), txtSideNo.Text.Trim(), out bcStrs);
|
|
if (dtBarCode != null && dtBarCode.Rows.Count > 0)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(bcStrs))
|
|
{
|
|
string[] bcStr = bcStrs.Split(';');
|
|
if (bcStr.Length >= 1)
|
|
{
|
|
string colName = bcStr[0];
|
|
label7.Text = colName;
|
|
labBarCode1.Text = dtBarCode.Rows[0][colName].ToString().Trim();
|
|
|
|
#region 颜色1
|
|
if (string.IsNullOrWhiteSpace(labColor1.Text))
|
|
{
|
|
string color = dtBarCode.Rows[0]["ColorInfo"].ToString();
|
|
labColor1.Tag = color;
|
|
if (!string.IsNullOrWhiteSpace(color))
|
|
{
|
|
string[] colStr = color.Split(',');
|
|
if (colStr.Length > 1)
|
|
{
|
|
labColor1.Text = colStr[0];
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
if (bcStr.Length >= 2)
|
|
{
|
|
string colName = bcStr[1];
|
|
label9.Text = colName;
|
|
labBarCode2.Text = dtBarCode.Rows[0][colName].ToString().Trim();
|
|
|
|
#region 颜色2
|
|
|
|
if (string.IsNullOrWhiteSpace(labColor2.Text))
|
|
{
|
|
string color = dtBarCode.Rows[0]["ColorInfo"].ToString();
|
|
labColor2.Tag = color;
|
|
if (!string.IsNullOrWhiteSpace(color))
|
|
{
|
|
string[] colStr = color.Split(',');
|
|
if (colStr.Length > 1)
|
|
{
|
|
labColor2.Text = colStr[0];
|
|
}
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获得第一个型号名称
|
|
|
|
string stockNo = "";
|
|
string batchNo = "";
|
|
string partNo = "";
|
|
Function.GetCode(labBarCode1.Text.Trim(), out stockNo, out batchNo, out partNo);
|
|
|
|
{
|
|
string productName = "";
|
|
Function.GetInfoByStockNo(stockNo, partNo, out productName);
|
|
labXingHao1.Text = productName;
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 获得第二个型号名称
|
|
|
|
stockNo = "";
|
|
batchNo = "";
|
|
partNo = "";
|
|
Function.GetCode(labBarCode2.Text.Trim(), out stockNo, out batchNo, out partNo);
|
|
{
|
|
string productName = "";
|
|
Function.GetInfoByStockNo(stockNo, partNo, out productName);
|
|
labXingHao2.Text = productName;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获得第三个型号名称
|
|
|
|
stockNo = "";
|
|
batchNo = "";
|
|
partNo = "";
|
|
Function.GetCode(labBarCode3.Text.Trim(), out stockNo, out batchNo, out partNo);
|
|
{
|
|
string productName = "";
|
|
Function.GetInfoByStockNo(stockNo, partNo, out productName);
|
|
labXingHao3.Text = productName;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 获得第四个型号名称
|
|
|
|
stockNo = "";
|
|
batchNo = "";
|
|
partNo = "";
|
|
Function.GetCode(labBarCode4.Text.Trim(), out stockNo, out batchNo, out partNo);
|
|
{
|
|
string productName = "";
|
|
Function.GetInfoByStockNo(stockNo, partNo, out productName);
|
|
labXingHao4.Text = productName;
|
|
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 控制按钮是否可点选
|
|
|
|
ButtonDisable();
|
|
|
|
#endregion
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase("喷涂一检滑撬号获取:" + ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
|
|
#region 设置控件是否选中的颜色
|
|
|
|
/// <summary>
|
|
/// 设置控件颜色,是否选中
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="Chose"></param>
|
|
/// <param name="NoChose"></param>
|
|
public void ColorMethod(object sender, Color Chose, Color NoChose)
|
|
{
|
|
Button btn = sender as Button;
|
|
if (btn.BackColor != Chose)
|
|
{
|
|
btn.BackColor = Chose;
|
|
btnSubmit.BackColor = Color.GreenYellow;
|
|
|
|
if (lighttimerStart.ToString() == "2019-01-01 00:00:00")
|
|
{
|
|
lighttimerStart = DateTime.Now;
|
|
}
|
|
//Thread t = new Thread(new ThreadStart(LightTimerStart));
|
|
//t.Start();
|
|
}
|
|
else
|
|
{
|
|
btn.BackColor = NoChose;
|
|
btnSubmit.BackColor = Color.FromArgb(192, 192, 255);
|
|
}
|
|
}
|
|
|
|
private void LightTimer_Tick(object sender, EventArgs e)
|
|
{
|
|
if (lighttimerStart.ToString() != "2019-01-01 00:00:00")
|
|
{
|
|
TimeSpan span = DateTime.Now.Subtract(lighttimerStart);
|
|
if (span.Seconds >= 60)
|
|
{
|
|
if (labTitle.BackColor == Color.LightGray)
|
|
{
|
|
labTitle.BackColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
labTitle.BackColor = Color.LightGray;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 清除控件选中
|
|
/// </summary>
|
|
/// <param name="controls"></param>
|
|
public void ClearControlColor(Control[] controls)
|
|
{
|
|
foreach (Control c in controls)
|
|
{
|
|
c.BackColor = Color.LightGray;
|
|
}
|
|
}
|
|
|
|
private Control[] SetControlGroup1()
|
|
{
|
|
Control[] controls = { btnPass1, btnAbt1, btnRepair1 };
|
|
return controls;
|
|
}
|
|
private Control[] SetControlGroup2()
|
|
{
|
|
Control[] controls = { btnPass2, btnAbt2, btnRepair2 };
|
|
return controls;
|
|
}
|
|
|
|
private Control[] SetControlGroup3()
|
|
{
|
|
Control[] controls = { btnPass3, btnAbt3, btnRepair3 };
|
|
return controls;
|
|
}
|
|
|
|
private Control[] SetControlGroup4()
|
|
{
|
|
Control[] controls = { btnPass4, btnAbt4, btnRepair4 };
|
|
return controls;
|
|
}
|
|
|
|
private void ButtonDisable()
|
|
{
|
|
if (string.IsNullOrWhiteSpace(labBarCode1.Text.Trim()))
|
|
{
|
|
btnPass1.Enabled = false;
|
|
btnAbt1.Enabled = false;
|
|
btnRepair1.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
btnPass1.Enabled = true;
|
|
btnAbt1.Enabled = true;
|
|
btnRepair1.Enabled = true;
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(labBarCode2.Text.Trim()))
|
|
{
|
|
btnPass2.Enabled = false;
|
|
btnAbt2.Enabled = false;
|
|
btnRepair2.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
btnPass2.Enabled = true;
|
|
btnAbt2.Enabled = true;
|
|
btnRepair2.Enabled = true;
|
|
}
|
|
|
|
if (string.IsNullOrWhiteSpace(labBarCode3.Text.Trim()))
|
|
{
|
|
btnPass3.Enabled = false;
|
|
btnAbt3.Enabled = false;
|
|
btnRepair3.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
btnPass3.Enabled = true;
|
|
btnAbt3.Enabled = true;
|
|
btnRepair3.Enabled = true;
|
|
}
|
|
if (string.IsNullOrWhiteSpace(labBarCode4.Text.Trim()))
|
|
{
|
|
btnPass4.Enabled = false;
|
|
btnAbt4.Enabled = false;
|
|
btnRepair4.Enabled = false;
|
|
}
|
|
else
|
|
{
|
|
btnPass4.Enabled = true;
|
|
btnAbt4.Enabled = true;
|
|
btnRepair4.Enabled = true;
|
|
}
|
|
}
|
|
|
|
private void btnPass1_Click(object sender, EventArgs e)
|
|
{
|
|
ClearControlColor(SetControlGroup1());
|
|
ColorMethod(sender, Color.GreenYellow, Color.LightGray);
|
|
}
|
|
|
|
private void btnPass2_Click(object sender, EventArgs e)
|
|
{
|
|
ClearControlColor(SetControlGroup2());
|
|
ColorMethod(sender, Color.GreenYellow, Color.LightGray);
|
|
}
|
|
|
|
private void btnAbt1_Click(object sender, EventArgs e)
|
|
{
|
|
ClearControlColor(SetControlGroup1());
|
|
ColorMethod(sender, Color.Red, Color.LightGray);
|
|
|
|
abt_damnPosition1 = "";
|
|
abt_reason1 = "";
|
|
|
|
string barcode = labBarCode1.Text.Trim();
|
|
FrmChooseDamnPosition frm = new FrmChooseDamnPosition(barcode);
|
|
frm.ShowDialog();
|
|
abt_damnPosition1 = FrmChooseDamnPosition.DamnPosition;
|
|
abt_reason1 = FrmChooseDamnPosition.Reason;
|
|
|
|
labDefect1.Text = ConcatDefect("[报废]", abt_damnPosition1, abt_reason1);
|
|
}
|
|
|
|
private void btnAbt2_Click(object sender, EventArgs e)
|
|
{
|
|
ClearControlColor(SetControlGroup2());
|
|
ColorMethod(sender, Color.Red, Color.LightGray);
|
|
|
|
abt_damnPosition2 = "";
|
|
abt_reason2 = "";
|
|
|
|
string barcode = labBarCode1.Text.Trim();
|
|
FrmChooseDamnPosition frm = new FrmChooseDamnPosition(barcode);
|
|
frm.ShowDialog();
|
|
abt_damnPosition2 = FrmChooseDamnPosition.DamnPosition;
|
|
abt_reason2 = FrmChooseDamnPosition.Reason;
|
|
|
|
labDefect2.Text = ConcatDefect("[报废]", abt_damnPosition2, abt_reason2);
|
|
}
|
|
|
|
private void btnRepair1_Click(object sender, EventArgs e)
|
|
{
|
|
damnPosition1 = "";
|
|
reason1 = "";
|
|
|
|
ClearControlColor(SetControlGroup1());
|
|
ColorMethod(sender, Color.Yellow, Color.LightGray);
|
|
|
|
string barcode = labBarCode1.Text.Trim();
|
|
FrmChooseDamnPosition frm = new FrmChooseDamnPosition(barcode);
|
|
frm.ShowDialog();
|
|
damnPosition1 = FrmChooseDamnPosition.DamnPosition;
|
|
reason1 = FrmChooseDamnPosition.Reason;
|
|
|
|
labDefect1.Text = ConcatDefect("[抛光]", damnPosition1, reason1);
|
|
}
|
|
|
|
private void btnRepair2_Click(object sender, EventArgs e)
|
|
{
|
|
damnPosition2 = "";
|
|
reason2 = "";
|
|
|
|
ClearControlColor(SetControlGroup2());
|
|
ColorMethod(sender, Color.Yellow, Color.LightGray);
|
|
|
|
string barcode = labBarCode2.Text.Trim();
|
|
FrmChooseDamnPosition frm = new FrmChooseDamnPosition(barcode);
|
|
frm.ShowDialog();
|
|
damnPosition2 = FrmChooseDamnPosition.DamnPosition;
|
|
reason2 = FrmChooseDamnPosition.Reason;
|
|
|
|
labDefect2.Text = ConcatDefect("[抛光]", damnPosition2, reason2);
|
|
}
|
|
|
|
private string ConcatDefect(string str1, string str2, string str3)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(str2) && !string.IsNullOrWhiteSpace(str3))
|
|
{
|
|
return str1 + str2 + ":" + str3 + " ";
|
|
}
|
|
else
|
|
{
|
|
return "";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 提交
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void btnSubmit_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
InspectModel model1 = new InspectModel();
|
|
InspectModel model2 = new InspectModel();
|
|
InspectModel model3 = new InspectModel();
|
|
InspectModel model4 = new InspectModel();
|
|
|
|
#region 有条码的必须进行点选,否则不允许提交
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode1.Text))
|
|
{
|
|
if (btnPass1.BackColor == Color.LightGray && btnRepair1.BackColor == Color.LightGray && btnAbt1.BackColor == Color.LightGray)
|
|
{
|
|
MessageBox.Show("条码:" + labBarCode1.Text.Trim() + "没有录入质检结果,不能提交,请补全!");
|
|
return;
|
|
}
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(labBarCode2.Text))
|
|
{
|
|
if (btnPass2.BackColor == Color.LightGray && btnRepair2.BackColor == Color.LightGray && btnAbt2.BackColor == Color.LightGray)
|
|
{
|
|
MessageBox.Show("条码:" + labBarCode2.Text.Trim() + "没有录入质检结果,不能提交,请补全!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode3.Text))
|
|
{
|
|
if (btnPass3.BackColor == Color.LightGray && btnRepair3.BackColor == Color.LightGray && btnAbt3.BackColor == Color.LightGray)
|
|
{
|
|
MessageBox.Show("条码:" + labBarCode3.Text.Trim() + "没有录入质检结果,不能提交,请补全!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode4.Text))
|
|
{
|
|
if (btnPass4.BackColor == Color.LightGray && btnRepair4.BackColor == Color.LightGray && btnAbt4.BackColor == Color.LightGray)
|
|
{
|
|
MessageBox.Show("条码:" + labBarCode4.Text.Trim() + "没有录入质检结果,不能提交,请补全!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 没有颜色信息无法保存
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode1.Text))
|
|
{
|
|
if (labColor1.Tag.ToString().Length < 3)
|
|
{
|
|
MessageBox.Show("条码:" + labBarCode1.Text.Trim() + "没有颜色信息,不能提交,请补全!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode2.Text))
|
|
{
|
|
if (labColor2.Tag.ToString().Length < 3)
|
|
{
|
|
MessageBox.Show("条码:" + labBarCode2.Text.Trim() + "没有颜色信息,不能提交,请补全!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode3.Text))
|
|
{
|
|
if (labColor3.Tag.ToString().Length < 3)
|
|
{
|
|
MessageBox.Show("条码:" + labBarCode3.Text.Trim() + "没有颜色信息,不能提交,请补全!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode4.Text))
|
|
{
|
|
if (labColor4.Tag.ToString().Length < 3)
|
|
{
|
|
MessageBox.Show("条码:" + labBarCode4.Text.Trim() + "没有颜色信息,不能提交,请补全!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 保存条码1
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode1.Text.Trim()))
|
|
{
|
|
LogHelper.WriteSysLogBase("条码:" + labBarCode1.Text.Trim() + "准备存入Inspect表", MethodBase.GetCurrentMethod().Name);
|
|
|
|
if (btnPass1.BackColor == Color.LightGray && btnRepair1.BackColor == Color.LightGray && btnAbt1.BackColor == Color.LightGray)
|
|
{
|
|
MessageBox.Show("请录入检验结果!");
|
|
return;
|
|
}
|
|
model1.ID = Guid.NewGuid().ToString();
|
|
model1.barcode = labBarCode1.Text.Trim();
|
|
|
|
string[] strs = labTitle.Text.Trim().Split(' ');
|
|
if (strs.Length >= 3)
|
|
{
|
|
model1.side = strs[1].Trim();
|
|
}
|
|
|
|
model1.position = labTitle.Text.Trim();
|
|
model1.stationNo = labStation.Text;
|
|
model1.workClass = labWorkClass.Text;
|
|
|
|
if (btnPass1.BackColor != Color.LightGray && btnAbt1.BackColor == Color.LightGray && btnRepair1.BackColor == Color.LightGray)
|
|
{
|
|
model1.inspectResult = "[合格]";
|
|
}
|
|
if (btnPass1.BackColor == Color.LightGray && btnAbt1.BackColor != Color.LightGray && btnRepair1.BackColor == Color.LightGray)
|
|
{
|
|
model1.inspectResult = "[报废]";
|
|
model1.damnPosition = abt_damnPosition1;
|
|
model1.reason = abt_reason1;
|
|
|
|
if (string.IsNullOrWhiteSpace(model1.damnPosition) || string.IsNullOrWhiteSpace(model1.reason))
|
|
{
|
|
MessageBox.Show("必须选择报废位置及报废原因!");
|
|
return;
|
|
}
|
|
}
|
|
if (btnPass1.BackColor == Color.LightGray && btnAbt1.BackColor == Color.LightGray && btnRepair1.BackColor != Color.LightGray)
|
|
{
|
|
model1.inspectResult = "[抛光]";
|
|
model1.damnPosition = damnPosition1;
|
|
model1.reason = reason1;
|
|
|
|
if (string.IsNullOrWhiteSpace(model1.damnPosition) || string.IsNullOrWhiteSpace(model1.reason))
|
|
{
|
|
MessageBox.Show("必须选择抛光位置及抛光原因!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (rdo1.Checked)
|
|
{
|
|
model1.productOption = "1";
|
|
}
|
|
else if (rdo2.Checked)
|
|
{
|
|
model1.productOption = "2";
|
|
}
|
|
else if (rdo3.Checked)
|
|
{
|
|
model1.productOption = "3";
|
|
}
|
|
|
|
model1.productInfo = labColor1.Tag.ToString().Trim() + "," + labXingHao1.Text.Trim();
|
|
model1.InspectTimes = "1";
|
|
|
|
if (!string.IsNullOrWhiteSpace(model1.barcode))
|
|
{
|
|
Function.InsertInspect(model1);
|
|
}
|
|
|
|
LogHelper.WriteSysLogBase("条码:" + model1.barcode + "存入Inspect表完毕", MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
#region 保存条码2
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode2.Text.Trim()))
|
|
{
|
|
LogHelper.WriteSysLogBase("条码:" + labBarCode2.Text.Trim() + "准备存入Inspect表", MethodBase.GetCurrentMethod().Name);
|
|
|
|
if (btnPass2.BackColor == Color.LightGray && btnRepair2.BackColor == Color.LightGray && btnAbt2.BackColor == Color.LightGray)
|
|
{
|
|
MessageBox.Show("请录入检验结果!");
|
|
return;
|
|
}
|
|
|
|
model2.ID = Guid.NewGuid().ToString();
|
|
model2.barcode = labBarCode2.Text.Trim();
|
|
|
|
string[] strss = labTitle.Text.Trim().Split(' ');
|
|
if (strss.Length >= 3)
|
|
{
|
|
model2.side = strss[1].Trim();
|
|
}
|
|
|
|
model2.position = labTitle.Text.Trim();
|
|
model2.stationNo = labStation.Text;
|
|
model2.workClass = labWorkClass.Text;
|
|
|
|
if (btnPass2.BackColor != Color.LightGray && btnAbt2.BackColor == Color.LightGray && btnRepair2.BackColor == Color.LightGray)
|
|
{
|
|
model2.inspectResult = "[合格]";
|
|
}
|
|
if (btnPass2.BackColor == Color.LightGray && btnAbt2.BackColor != Color.LightGray && btnRepair2.BackColor == Color.LightGray)
|
|
{
|
|
model2.inspectResult = "[报废]";
|
|
model2.damnPosition = abt_damnPosition2;
|
|
model2.reason = abt_reason2;
|
|
|
|
if (string.IsNullOrWhiteSpace(model2.damnPosition) || string.IsNullOrWhiteSpace(model2.reason))
|
|
{
|
|
MessageBox.Show("必须选择报废位置及报废原因!");
|
|
return;
|
|
}
|
|
}
|
|
if (btnPass2.BackColor == Color.LightGray && btnAbt2.BackColor == Color.LightGray && btnRepair2.BackColor != Color.LightGray)
|
|
{
|
|
model2.inspectResult = "[抛光]";
|
|
model2.damnPosition = damnPosition2;
|
|
model2.reason = reason2;
|
|
|
|
if (string.IsNullOrWhiteSpace(model2.damnPosition) || string.IsNullOrWhiteSpace(model2.reason))
|
|
{
|
|
MessageBox.Show("必须选择抛光位置及抛光原因!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (rdo1.Checked)
|
|
{
|
|
model2.productOption = "1";
|
|
}
|
|
else if (rdo2.Checked)
|
|
{
|
|
model2.productOption = "2";
|
|
}
|
|
else if (rdo3.Checked)
|
|
{
|
|
model2.productOption = "3";
|
|
}
|
|
|
|
model2.productInfo = labColor2.Tag.ToString().Trim() + "," + labXingHao2.Text.Trim();
|
|
model2.InspectTimes = "1";
|
|
|
|
if (!string.IsNullOrWhiteSpace(model2.barcode))
|
|
{
|
|
Function.InsertInspect(model2);
|
|
}
|
|
|
|
LogHelper.WriteSysLogBase("条码:" + model2.barcode + "存入Inspect表完毕", MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 保存条码3
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode3.Text.Trim()))
|
|
{
|
|
LogHelper.WriteSysLogBase("条码:" + labBarCode3.Text.Trim() + "准备存入Inspect表", MethodBase.GetCurrentMethod().Name);
|
|
|
|
if (btnPass3.BackColor == Color.LightGray && btnRepair3.BackColor == Color.LightGray && btnAbt3.BackColor == Color.LightGray)
|
|
{
|
|
MessageBox.Show("请录入检验结果!");
|
|
return;
|
|
}
|
|
|
|
model3.ID = Guid.NewGuid().ToString();
|
|
model3.barcode = labBarCode3.Text.Trim();
|
|
|
|
string[] strss = labTitle.Text.Trim().Split(' ');
|
|
if (strss.Length >= 3)
|
|
{
|
|
model3.side = strss[1].Trim();
|
|
}
|
|
|
|
model3.position = labTitle.Text.Trim();
|
|
model3.stationNo = labStation.Text;
|
|
model3.workClass = labWorkClass.Text;
|
|
|
|
if (btnPass3.BackColor != Color.LightGray && btnAbt3.BackColor == Color.LightGray && btnRepair3.BackColor == Color.LightGray)
|
|
{
|
|
model3.inspectResult = "[合格]";
|
|
}
|
|
if (btnPass3.BackColor == Color.LightGray && btnAbt3.BackColor != Color.LightGray && btnRepair3.BackColor == Color.LightGray)
|
|
{
|
|
model3.inspectResult = "[报废]";
|
|
model3.damnPosition = abt_damnPosition3;
|
|
model3.reason = abt_reason3;
|
|
|
|
if (string.IsNullOrWhiteSpace(model3.damnPosition) || string.IsNullOrWhiteSpace(model3.reason))
|
|
{
|
|
MessageBox.Show("必须选择报废位置及报废原因!");
|
|
return;
|
|
}
|
|
}
|
|
if (btnPass3.BackColor == Color.LightGray && btnAbt3.BackColor == Color.LightGray && btnRepair3.BackColor != Color.LightGray)
|
|
{
|
|
model3.inspectResult = "[抛光]";
|
|
model3.damnPosition = damnPosition3;
|
|
model3.reason = reason3;
|
|
|
|
if (string.IsNullOrWhiteSpace(model3.damnPosition) || string.IsNullOrWhiteSpace(model3.reason))
|
|
{
|
|
MessageBox.Show("必须选择抛光位置及抛光原因!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (rdo1.Checked)
|
|
{
|
|
model3.productOption = "1";
|
|
}
|
|
else if (rdo2.Checked)
|
|
{
|
|
model3.productOption = "2";
|
|
}
|
|
else if (rdo3.Checked)
|
|
{
|
|
model3.productOption = "3";
|
|
}
|
|
|
|
model3.productInfo = labColor3.Tag.ToString().Trim() + "," + labXingHao3.Text.Trim();
|
|
model3.InspectTimes = "1";
|
|
|
|
if (!string.IsNullOrWhiteSpace(model3.barcode))
|
|
{
|
|
Function.InsertInspect(model3);
|
|
}
|
|
|
|
LogHelper.WriteSysLogBase("条码:" + model3.barcode + "存入Inspect表完毕", MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 保存条码4
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode4.Text.Trim()))
|
|
{
|
|
LogHelper.WriteSysLogBase("条码:" + labBarCode4.Text.Trim() + "准备存入Inspect表", MethodBase.GetCurrentMethod().Name);
|
|
|
|
if (btnPass4.BackColor == Color.LightGray && btnRepair4.BackColor == Color.LightGray && btnAbt4.BackColor == Color.LightGray)
|
|
{
|
|
MessageBox.Show("请录入检验结果!");
|
|
return;
|
|
}
|
|
|
|
model4.ID = Guid.NewGuid().ToString();
|
|
model4.barcode = labBarCode4.Text.Trim();
|
|
|
|
string[] strss = labTitle.Text.Trim().Split(' ');
|
|
if (strss.Length >= 3)
|
|
{
|
|
model4.side = strss[1].Trim();
|
|
}
|
|
|
|
model4.position = labTitle.Text.Trim();
|
|
model4.stationNo = labStation.Text;
|
|
model4.workClass = labWorkClass.Text;
|
|
|
|
if (btnPass4.BackColor != Color.LightGray && btnAbt4.BackColor == Color.LightGray && btnRepair4.BackColor == Color.LightGray)
|
|
{
|
|
model4.inspectResult = "[合格]";
|
|
}
|
|
if (btnPass4.BackColor == Color.LightGray && btnAbt4.BackColor != Color.LightGray && btnRepair4.BackColor == Color.LightGray)
|
|
{
|
|
model4.inspectResult = "[报废]";
|
|
model4.damnPosition = abt_damnPosition4;
|
|
model4.reason = abt_reason4;
|
|
|
|
if (string.IsNullOrWhiteSpace(model4.damnPosition) || string.IsNullOrWhiteSpace(model4.reason))
|
|
{
|
|
MessageBox.Show("必须选择报废位置及报废原因!");
|
|
return;
|
|
}
|
|
}
|
|
if (btnPass4.BackColor == Color.LightGray && btnAbt4.BackColor == Color.LightGray && btnRepair4.BackColor != Color.LightGray)
|
|
{
|
|
model4.inspectResult = "[抛光]";
|
|
model4.damnPosition = damnPosition4;
|
|
model4.reason = reason4;
|
|
|
|
if (string.IsNullOrWhiteSpace(model4.damnPosition) || string.IsNullOrWhiteSpace(model4.reason))
|
|
{
|
|
MessageBox.Show("必须选择抛光位置及抛光原因!");
|
|
return;
|
|
}
|
|
}
|
|
|
|
if (rdo1.Checked)
|
|
{
|
|
model4.productOption = "1";
|
|
}
|
|
else if (rdo2.Checked)
|
|
{
|
|
model4.productOption = "2";
|
|
}
|
|
else if (rdo3.Checked)
|
|
{
|
|
model4.productOption = "3";
|
|
}
|
|
|
|
model4.productInfo = labColor4.Tag.ToString().Trim() + "," + labXingHao4.Text.Trim();
|
|
model4.InspectTimes = "1";
|
|
|
|
if (!string.IsNullOrWhiteSpace(model4.barcode))
|
|
{
|
|
Function.InsertInspect(model4);
|
|
}
|
|
|
|
LogHelper.WriteSysLogBase("条码:" + model4.barcode + "存入Inspect表完毕", MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 报废则调WMS WebService,入库,大线报废由0改成2
|
|
|
|
try
|
|
{
|
|
WMSWebService webService = new WMSWebService();
|
|
webService.Url = ConfigurationManager.AppSettings["WMSWebServiceURL"].ToString();
|
|
//webService.Timeout = 120000;
|
|
|
|
string errorReason = "";
|
|
|
|
if (model1.inspectResult == "[报废]" && !string.IsNullOrWhiteSpace(model1.barcode.Trim()))
|
|
{
|
|
webService.WMSSprayingForCS(model1.barcode, 2, out errorReason);
|
|
LogHelper.WriteSysLogBase("条码:" + model1.barcode + "调用WMSSprayingForCS完成", MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
if (model2.inspectResult == "[报废]" && !string.IsNullOrWhiteSpace(model2.barcode.Trim()))
|
|
{
|
|
webService.WMSSprayingForCS(model2.barcode, 2, out errorReason);
|
|
LogHelper.WriteSysLogBase("条码:" + model2.barcode + "调用WMSSprayingForCS完成", MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
if (model3.inspectResult == "[报废]" && !string.IsNullOrWhiteSpace(model3.barcode.Trim()))
|
|
{
|
|
webService.WMSSprayingForCS(model3.barcode, 2, out errorReason);
|
|
LogHelper.WriteSysLogBase("条码:" + model3.barcode + "调用WMSSprayingForCS完成", MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
if (model4.inspectResult == "[报废]" && !string.IsNullOrWhiteSpace(model4.barcode.Trim()))
|
|
{
|
|
webService.WMSSprayingForCS(model4.barcode, 2, out errorReason);
|
|
LogHelper.WriteSysLogBase("条码:" + model4.barcode + "调用WMSSprayingForCS完成", MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteErrLogBase("喷涂一检提交调用WMS接口:"+ ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 点击提交,滑撬号+1,执行滑撬号获取事件
|
|
|
|
#region 清空页面按钮选择
|
|
|
|
ClearControlColor(SetControlGroup1());
|
|
ClearControlColor(SetControlGroup2());
|
|
ClearControlColor(SetControlGroup3());
|
|
ClearControlColor(SetControlGroup4());
|
|
|
|
#endregion
|
|
|
|
int no = 0;
|
|
Int32.TryParse(txtSideNo.Text.Trim(), out no);
|
|
no = no + 1;
|
|
int skidMax = Function.GetskidMax();
|
|
if (no >= skidMax)
|
|
{
|
|
no = 1;
|
|
}
|
|
skid_No = no.ToString();
|
|
txtSideNo.Text = skid_No;
|
|
|
|
LogHelper.WriteSysLogBase("条码:" + model1.barcode + "," + model2.barcode + "," + model3.barcode + "," + model4.barcode + "进入滑撬号:" + txtSideNo.Text, MethodBase.GetCurrentMethod().Name);
|
|
btnSide_Click(sender, e);
|
|
|
|
#endregion
|
|
|
|
btnSubmit.BackColor = Color.FromArgb(192, 192, 255);
|
|
lighttimerStart = Convert.ToDateTime("2019-01-01 00:00:00");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LogHelper.WriteLogManager(ex);
|
|
LogHelper.WriteErrLogBase(ex.ToString(), MethodBase.GetCurrentMethod().Name);
|
|
}
|
|
}
|
|
|
|
#region 修改颜色
|
|
/// <summary>
|
|
/// 修改颜色
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void labChangeColor_Click(object sender, EventArgs e)
|
|
{
|
|
ColorName = "";
|
|
labColor1.Tag = "";
|
|
labColor2.Tag = "";
|
|
labColor3.Tag = "";
|
|
labColor2.Tag = "";
|
|
bool isShow = true;
|
|
|
|
DialogResult result = MessageBox.Show("确定要修改颜色?", "提示", 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();
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("密码错误,请重新输入!", "提示", MessageBoxButtons.OK);
|
|
isShow = false;
|
|
}
|
|
};
|
|
pass.ShowDialog();
|
|
}
|
|
else
|
|
{
|
|
return;
|
|
}
|
|
if (!isShow)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(ColorName))
|
|
{
|
|
string[] str = ColorName.Split(',');
|
|
if (str.Length >= 3)
|
|
{
|
|
if (!string.IsNullOrWhiteSpace(labBarCode1.Text))
|
|
{
|
|
labColor1.Text = str[0];
|
|
labColor1.Tag = ColorName;
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode2.Text))
|
|
{
|
|
labColor2.Text = str[0];
|
|
labColor2.Tag = ColorName;
|
|
}
|
|
if (!string.IsNullOrWhiteSpace(labBarCode3.Text))
|
|
{
|
|
labColor3.Text = str[0];
|
|
labColor3.Tag = ColorName;
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(labBarCode4.Text))
|
|
{
|
|
labColor4.Text = str[0];
|
|
labColor4.Tag = ColorName;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
private void labChangeColor_MouseMove(object sender, MouseEventArgs e)
|
|
{
|
|
Label lab = sender as Label;
|
|
lab.BackColor = Color.Turquoise;
|
|
}
|
|
|
|
private void labChangeColor_MouseLeave(object sender, EventArgs e)
|
|
{
|
|
Label lab = sender as Label;
|
|
lab.BackColor = Color.FromArgb(192, 255, 255);
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 点击右上角关闭窗口
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void labTime_Click(object sender, EventArgs e)
|
|
{
|
|
Environment.Exit(0);
|
|
}
|
|
|
|
private void labWorkClass_Click(object sender, EventArgs e)
|
|
{
|
|
Function.ChangeWorkClass(labWorkClass);
|
|
}
|
|
|
|
private void btnPass3_Click(object sender, EventArgs e)
|
|
{
|
|
ClearControlColor(SetControlGroup3());
|
|
ColorMethod(sender, Color.GreenYellow, Color.LightGray);
|
|
}
|
|
|
|
private void btnPass4_Click(object sender, EventArgs e)
|
|
{
|
|
ClearControlColor(SetControlGroup4());
|
|
ColorMethod(sender, Color.GreenYellow, Color.LightGray);
|
|
}
|
|
|
|
private void btnRepair3_Click(object sender, EventArgs e)
|
|
{
|
|
damnPosition3 = "";
|
|
reason3 = "";
|
|
|
|
ClearControlColor(SetControlGroup3());
|
|
ColorMethod(sender, Color.Yellow, Color.LightGray);
|
|
|
|
string barcode = labBarCode3.Text.Trim();
|
|
FrmChooseDamnPosition frm = new FrmChooseDamnPosition(barcode);
|
|
frm.ShowDialog();
|
|
damnPosition3 = FrmChooseDamnPosition.DamnPosition;
|
|
reason3 = FrmChooseDamnPosition.Reason;
|
|
|
|
labDefect3.Text = ConcatDefect("[抛光]", damnPosition3, reason3);
|
|
}
|
|
|
|
private void btnRepair4_Click(object sender, EventArgs e)
|
|
{
|
|
damnPosition4 = "";
|
|
reason4 = "";
|
|
|
|
ClearControlColor(SetControlGroup4());
|
|
ColorMethod(sender, Color.Yellow, Color.LightGray);
|
|
|
|
string barcode = labBarCode4.Text.Trim();
|
|
FrmChooseDamnPosition frm = new FrmChooseDamnPosition(barcode);
|
|
frm.ShowDialog();
|
|
damnPosition4 = FrmChooseDamnPosition.DamnPosition;
|
|
reason4 = FrmChooseDamnPosition.Reason;
|
|
|
|
labDefect4.Text = ConcatDefect("[抛光]", damnPosition4, reason4);
|
|
}
|
|
|
|
private void btnAbt3_Click(object sender, EventArgs e)
|
|
{
|
|
ClearControlColor(SetControlGroup3());
|
|
ColorMethod(sender, Color.Red, Color.LightGray);
|
|
|
|
abt_damnPosition3 = "";
|
|
abt_reason3 = "";
|
|
|
|
string barcode = labBarCode3.Text.Trim();
|
|
FrmChooseDamnPosition frm = new FrmChooseDamnPosition(barcode);
|
|
frm.ShowDialog();
|
|
abt_damnPosition3 = FrmChooseDamnPosition.DamnPosition;
|
|
abt_reason3 = FrmChooseDamnPosition.Reason;
|
|
|
|
labDefect3.Text = ConcatDefect("[报废]", abt_damnPosition3, abt_reason3);
|
|
}
|
|
|
|
private void btnAbt4_Click(object sender, EventArgs e)
|
|
{
|
|
ClearControlColor(SetControlGroup4());
|
|
ColorMethod(sender, Color.Red, Color.LightGray);
|
|
|
|
abt_damnPosition4 = "";
|
|
abt_reason4 = "";
|
|
|
|
string barcode = labBarCode4.Text.Trim();
|
|
FrmChooseDamnPosition frm = new FrmChooseDamnPosition(barcode);
|
|
frm.ShowDialog();
|
|
abt_damnPosition4 = FrmChooseDamnPosition.DamnPosition;
|
|
abt_reason4 = FrmChooseDamnPosition.Reason;
|
|
|
|
labDefect4.Text = ConcatDefect("[报废]", abt_damnPosition4, abt_reason4);
|
|
}
|
|
|
|
}
|
|
}
|
|
|