diff --git a/PaintingPC/FrmQuality.cs b/PaintingPC/FrmQuality.cs index 9243037..eee5c92 100644 --- a/PaintingPC/FrmQuality.cs +++ b/PaintingPC/FrmQuality.cs @@ -13,6 +13,7 @@ using System.Reflection; using System.Threading; using System.Windows.Forms; using MESClassLibrary.BLL.BasicInfo; +using static System.Windows.Forms.AxHost; namespace PaintingPC { @@ -395,6 +396,58 @@ namespace PaintingPC MessageBox.Show("请先扫描数据,然后操作."); return; } + #region 返喷下线数据验证 + if (lableFP.Text.Contains("[返喷]")) + { + string barcode = txtBarCode.Text.Trim(); + DataTable dtInspect = Function.GetInspectInfoByBarCode2(barcode); + if (dtInspect != null && dtInspect.Rows.Count > 0) + { + string inspectResult = dtInspect.Rows[0]["inspectResult"].ToString(); //检测结果 + string inspectColorInfo = dtInspect.Rows[0]["remark1"].ToString(); //颜色 + if (inspectResult.Contains("打磨")) + { + string createTime = dtInspect.Rows[0]["createTime"].ToString(); //创建时间 + int count = 0; + string colorInfo = ""; + if (_lineCode == "2") + { + count = Function.GetProducColorFromWms(barcode, "TM_BJBMPT_MES_DATA", createTime ,ref colorInfo); + } + else if (_lineCode == "1") + { + count = Function.GetProducColorFromWms(barcode, "TM_BJBMPT_MES_DATA_OLD", createTime , ref colorInfo); + + } + else + { + + } + + if (count == 0) + { + MessageBox.Show("未发现返喷下线数据!,无法进行质量判定"); + return; + } + else + { + if(inspectColorInfo != colorInfo) + { + btnOk.Enabled = false; + btnRepair.Enabled = false; + btnNok.Enabled = false; + + MessageBox.Show("当前产品返喷颜色与原颜色不符,需报废!"); + return; + } + + } + } + } + + } + #endregion + ShowHint(""); #region 判断产品是否有颜色 string colorName = string.Empty; @@ -450,6 +503,58 @@ namespace PaintingPC return; } + #region 返喷下线数据验证 + if (lableFP.Text.Contains("[返喷]")) + { + string barcode = txtBarCode.Text.Trim(); + DataTable dtInspect = Function.GetInspectInfoByBarCode2(barcode); + if (dtInspect != null && dtInspect.Rows.Count > 0) + { + string inspectResult = dtInspect.Rows[0]["inspectResult"].ToString(); //检测结果 + string inspectColorInfo = dtInspect.Rows[0]["remark1"].ToString(); //颜色 + if (inspectResult.Contains("打磨")) + { + string createTime = dtInspect.Rows[0]["createTime"].ToString(); //创建时间 + int count = 0; + string colorInfo = ""; + if (_lineCode == "2") + { + count = Function.GetProducColorFromWms(barcode, "TM_BJBMPT_MES_DATA", createTime, ref colorInfo); + } + else if (_lineCode == "1") + { + count = Function.GetProducColorFromWms(barcode, "TM_BJBMPT_MES_DATA_OLD", createTime, ref colorInfo); + + } + else + { + + } + + if (count == 0) + { + MessageBox.Show("未发现返喷下线数据!,无法进行质量判定"); + return; + } + else + { + if (inspectColorInfo != colorInfo) + { + btnOk.Enabled = false; + btnRepair.Enabled = false; + btnNok.Enabled = false; + + MessageBox.Show("当前产品返喷颜色与原颜色不符,需报废!"); + return; + } + + } + } + } + + } + #endregion + if (MessageBox.Show($"确认对[{txtBarCode.Text}]进行[其它]判定?", "操作确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; ShowHint(""); #region 必须选择缺陷位置与缺陷原因,否则无法保存 @@ -582,6 +687,45 @@ namespace PaintingPC return; } + #region 返喷下线数据验证 + if (lableFP.Text.Contains("[返喷]")) + { + string barcode = txtBarCode.Text.Trim(); + DataTable dtInspect = Function.GetInspectInfoByBarCode2(barcode); + if (dtInspect != null && dtInspect.Rows.Count > 0) + { + string inspectResult = dtInspect.Rows[0]["inspectResult"].ToString(); //检测结果 + string inspectColorInfo = dtInspect.Rows[0]["remark1"].ToString(); //颜色 + if (inspectResult.Contains("打磨")) + { + string createTime = dtInspect.Rows[0]["createTime"].ToString(); //创建时间 + int count = 0; + string colorInfo = ""; + if (_lineCode == "2") + { + count = Function.GetProducColorFromWms(barcode, "TM_BJBMPT_MES_DATA", createTime, ref colorInfo); + } + else if (_lineCode == "1") + { + count = Function.GetProducColorFromWms(barcode, "TM_BJBMPT_MES_DATA_OLD", createTime, ref colorInfo); + + } + else + { + + } + + if (count == 0) + { + MessageBox.Show("未发现返喷下线数据!,无法进行质量判定"); + return; + } + } + } + + } + #endregion + // if (MessageBox.Show($"确认对[{txtBarCode.Text}]进行报废操作?", "操作确认", MessageBoxButtons.OKCancel) == DialogResult.Cancel) return; //UserInput(userName => { @@ -984,6 +1128,10 @@ namespace PaintingPC { try { + btnOk.Enabled = true; + btnRepair.Enabled = true; + btnNok.Enabled = true; + _colorHandChanged = false; lbForeig.Text = ""; ClearPage(); diff --git a/PaintingPC/Function.cs b/PaintingPC/Function.cs index caf7094..203cba4 100644 --- a/PaintingPC/Function.cs +++ b/PaintingPC/Function.cs @@ -2136,6 +2136,50 @@ namespace PaintingPC } } + public static int GetProducColorFromWms(string barcode, string tableName, string createTime, ref string colorInfo) + { + int count = 0; + string paintCode = ""; + #region 从WMS系统获得喷涂上件的颜色信息 + string wmsSql = $"select TypeCode,WMSColor as paintcode from {tableName} where ProductBarcode='{barcode}' and createTime > '{createTime}' order by createTime desc"; + + string wmsSqlConnString = ConfigurationManager.ConnectionStrings["WmsSqlConnString"].ToString(); + DataTable dtColor = SqlHelper.GetDataDateTable(wmsSqlConnString, CommandType.Text, wmsSql, null); + + if (dtColor != null && dtColor.Rows.Count > 0) + { + paintCode = dtColor.Rows[0]["paintcode"].ToString(); + } + else + { + paintCode = ""; + } + + #endregion + + #region 根据颜色代码查颜色 + + if (!string.IsNullOrWhiteSpace(paintCode) && paintCode.ToLower() != "na") + { + + string sql_1 = @"select Color from tb_PaintColorInfo where StockNo='" + barcode.Substring(0, 10) + @"' and Paint_No='" + paintCode + @"'"; + DataTable dt_1 = SqlHelper.GetDataDateTable(SqlHelper.SqlConnString, CommandType.Text, sql_1, null); + if (dt_1 != null && dt_1.Rows.Count > 0) + { + colorInfo = dt_1.Rows[0]["Color"].ToString(); + count = 1; + } + else + { + colorInfo = ""; + } + } + + #endregion + + return count; + } + public static string GetWorkClass2() { //bool classA = IsBetweenTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), "2019-06-12 08:00:00", "2019-06-12 20:00:00");