From dc742547101803e0e15ea2b16b2d437d01c9ee11 Mon Sep 17 00:00:00 2001 From: "ruoxing.wang" <88384874@qq.com> Date: Tue, 3 Jun 2025 17:19:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=95=E5=B7=A5=E4=BD=8D=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E5=9C=A8=E4=B8=80=E6=A3=80=E8=BF=9B=E8=A1=8C=20=20=20=E7=82=B9?= =?UTF-8?q?=E4=BF=AE=E8=A1=A5=E5=B7=A5=E4=BD=8D=E9=9A=90=E8=97=8F=E5=85=B6?= =?UTF-8?q?=E5=AE=83=E6=8C=89=E9=92=AE=20=20=20=E7=82=B9=E4=BF=AE=E8=A1=A5?= =?UTF-8?q?=E5=B7=A5=E4=BD=8D=E5=8E=BB=E6=8E=89=E4=BA=86=E7=82=B9=E4=BF=AE?= =?UTF-8?q?=E8=A1=A5=E6=8C=89=E9=92=AE,=E7=BC=BA=E9=99=B7=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E4=B8=B2=E4=BD=8D=E7=BD=AE.=20=20=20=E7=82=B9?= =?UTF-8?q?=E4=BF=AE=E8=A1=A5=E5=B7=A5=E4=BD=8D=E5=92=8C=E4=BA=8C=E6=A3=80?= =?UTF-8?q?=E5=A4=9A=E5=B7=A5=E4=BD=8D,=E5=A2=9E=E5=8A=A0=E4=BA=A7?= =?UTF-8?q?=E7=BA=BF=E5=88=A4=E5=AE=9A,M2=E4=B8=8D=E8=83=BD=E6=89=ABM1?= =?UTF-8?q?=E7=9A=84=E4=BA=A7=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MESClassLibrary/BLL/BasicInfo/StationBLL.cs | 14 ++++ MESClassLibrary/DAL/BasicDAL.cs | 3 + MESClassLibrary/DAL/BasicInfo/StationDAL.cs | 13 ++++ PaintingPC/FrmQuality.cs | 82 +++++++++++++++------ 4 files changed, 89 insertions(+), 23 deletions(-) diff --git a/MESClassLibrary/BLL/BasicInfo/StationBLL.cs b/MESClassLibrary/BLL/BasicInfo/StationBLL.cs index 4478190..53967c7 100644 --- a/MESClassLibrary/BLL/BasicInfo/StationBLL.cs +++ b/MESClassLibrary/BLL/BasicInfo/StationBLL.cs @@ -77,6 +77,19 @@ namespace MESClassLibrary.BLL.BasicInfo } + + public DataTable GetStationInfo(string LineCode) + { + try + { + DataTable list = da.GetStationInfos(LineCode) ;//判断是否有重复数据 + return list; + } + catch (Exception) + { + return null; + } + } /// /// 添加信息 /// @@ -201,6 +214,7 @@ namespace MESClassLibrary.BLL.BasicInfo return ""; } } + public DataTable SearchInfoByNo(string station) { diff --git a/MESClassLibrary/DAL/BasicDAL.cs b/MESClassLibrary/DAL/BasicDAL.cs index e31373b..39b440f 100644 --- a/MESClassLibrary/DAL/BasicDAL.cs +++ b/MESClassLibrary/DAL/BasicDAL.cs @@ -123,6 +123,9 @@ namespace MESClassLibrary.DAL return GetSjBarCodeSerialNo(stockNo, batch); } } + + + public static DateTime GetServerTime() { string sql = ""; diff --git a/MESClassLibrary/DAL/BasicInfo/StationDAL.cs b/MESClassLibrary/DAL/BasicInfo/StationDAL.cs index af6e459..a03e83e 100644 --- a/MESClassLibrary/DAL/BasicInfo/StationDAL.cs +++ b/MESClassLibrary/DAL/BasicInfo/StationDAL.cs @@ -36,7 +36,20 @@ namespace MESClassLibrary.DAL.BasicInfo return null; } } + public DataTable GetStationInfos(string lineCode) + { + try + { + DataTable dt = SqlHelper.ExecuteDataset(SqlHelper.GetConnSting(), CommandType.Text, $"select s.* from tb_Station s ,tb_Line l where l.LineID = s.LineID and l.LineName='{lineCode}'", null).Tables[0]; + return dt; + } + catch (Exception ex) + { + LogErrBLL.AddInfo(ex.ToString(), MethodBase.GetCurrentMethod()); + return null; + } + } public bool UpdateTime(DateTime time,string staionNo) { try diff --git a/PaintingPC/FrmQuality.cs b/PaintingPC/FrmQuality.cs index c42e7fd..b203945 100644 --- a/PaintingPC/FrmQuality.cs +++ b/PaintingPC/FrmQuality.cs @@ -28,7 +28,10 @@ namespace PaintingPC private Dictionary _lastJustDict = new Dictionary(); private string _foreighColor = string.Empty; private string _lineCode = string.Empty; + private string _lineCodeSys = string.Empty; + private List _stations = new List(); private string _stationType = string.Empty; + private StationBLL _stationBLL = new StationBLL(); /// /// 从tb_ForeignColorMap表得到的零件号 /// @@ -45,6 +48,27 @@ namespace PaintingPC this.Size = new Size(1280, 1020); this._isWmsQuality = isWmsQuality; _lineCode = ConfigurationManager.AppSettings["LineCode"].ToString(); + if(_lineCode == "1") + { + _lineCodeSys = "1207"; + } + else if (_lineCode == "2") + { + _lineCodeSys = "1210"; + } + DataTable stationTable = _stationBLL.GetStationInfo(_lineCodeSys); + if(stationTable == null || stationTable.Rows.Count == 0) + { + ShowHint("查询产线["+ _lineCodeSys + "]关联工位时异常,请进行确认产线是否存在关联工位.", false); + } + if (stationTable.Rows.Count > 0) + { + _stations = stationTable.AsEnumerable().Select(p => p.Field("StationNo")).ToList(); + if(_stations.Count ==0 ) + ShowHint("产线[" + _lineCodeSys + "]不存在关联工位,请先进行配置.", false); + } + + _stationType = ConfigurationManager.AppSettings["Position"].ToString(); string disableButtons = ConfigurationManager.AppSettings["DisableButtons"].ToString(); string single = ConfigurationManager.AppSettings["SingleStation"].ToString(); @@ -87,7 +111,10 @@ namespace PaintingPC { btnAllowChangeColor.Visible = true; } - + if (_stationType == "下线点修补") + { + btnNok.Visible = false; + } // } } void HidenColorSelect(bool isHidden) @@ -125,11 +152,12 @@ namespace PaintingPC { try { - string title = _stationType; + string title = ConfigurationManager.AppSettings["Display"].ToString(); ; string workClass = Function.GetWorkClass2(); string station = ConfigurationManager.AppSettings["Station"].ToString(); labTitle.Text = title; + labWorkClass.Text = workClass; labStation.Text = station; labelVersion.Text = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); @@ -1059,10 +1087,14 @@ namespace PaintingPC DataTable dt3 = Function.SearchDefectInfo(ConfigurationManager.AppSettings["Station"].Trim()); if (dt3 != null && dt3.Rows.Count > 0) { - DataRow newRow = dt3.NewRow(); - newRow.ItemArray = dt3.Rows[0].ItemArray; - newRow["DefectName"] = "点修补"; - dt3.Rows.InsertAt(newRow, 0); + if(_stationType != "下线点修补") + { + DataRow newRow = dt3.NewRow(); + newRow.ItemArray = dt3.Rows[0].ItemArray; + newRow["DefectName"] = "点修补"; + dt3.Rows.InsertAt(newRow, 0); + } + drow = Convert.ToInt32(Math.Ceiling((double)dt3.Rows.Count / dcol)); Label[] dLb = new Label[7]; @@ -1080,19 +1112,7 @@ namespace PaintingPC dLb[i] = new Label(); if ((i + dcol * j) < dstr.Length) { - //if(i==0 && j == 0) - //{ - // Label lbl = new Label(); - // lbl.Text = "点修补"; - // lbl.Font = new Font(dLb[i].Font.FontFamily, 36, FontStyle.Bold); - // lbl.Size = new Size(170, 60); - // lbl.Location = new Point(20 + i * (dLb[i].Size.Width + 25), 5 + j * (dLb[i].Size.Height + 20)); - // lbl.BorderStyle = BorderStyle.FixedSingle; - // lbl.BackColor = Color.Red; - // lbl.TextAlign = ContentAlignment.MiddleCenter; - // panel2.Controls.Add(lbl); - // continue; - //} + dLb[i].Text = dstr[i + dcol * j].ToString(); dLb[i].Font = new Font(dLb[i].Font.FontFamily, 24, FontStyle.Bold); dLb[i].Size = new Size(150, 50); @@ -1231,8 +1251,18 @@ namespace PaintingPC position= dtInspect.Rows[0]["damnPosition"].ToString(); //缺陷位置 reason= dtInspect.Rows[0]["reason"].ToString(); //原因 paintId = dtInspect.Rows[0]["remark3"].ToString(); //原因 - - + + string stationNo = dtInspect.Rows[0]["stationNo"].ToString(); //质检工位 + if(!_stations.Contains(stationNo)) + { + string em = $"扫描条码[{barcode}]与当前产线[{_lineCodeSys}]不匹配,上一工序非当前产线完成!"; + MessageBox.Show(em); + ShowHint(em, false); + txtBarCode.Text = ""; + txtBarCode.TabIndex = 0; + txtBarCode.Select(); + return; + } #region 选中缺陷位置及原因 @@ -1304,7 +1334,7 @@ namespace PaintingPC paintId = info[2]; labProPosition.Tag = paintId; labProductInfo.Tag = Function.GetSide(barcode, paintId); - labProPosition.Text = labTitle.Text.Trim() + " " + labProductInfo.Tag.ToString().Replace(';', ' '); + labProPosition.Text = _stationType + " " + labProductInfo.Tag.ToString().Replace(';', ' '); if (info.Length == 4) { _foreignPartCode = info[3]; @@ -1346,7 +1376,7 @@ namespace PaintingPC { case "下线一检": return First(barcode); case "下线二检": return Second(barcode);; - case "点修补": return Third(barcode); + case "下线点修补": return Third(barcode); default:return true; } @@ -1355,6 +1385,12 @@ namespace PaintingPC private bool First(string barcode) { + if(_isSingleStation == true) + { + ShowHint("当前系统配置为[单工位生产],无法在此工位扫码,请去终检工位进行操作.", false); + return false; + } + DataTable dt = Function.GetLastResult(barcode); if (dt.Rows.Count > 0) {