diff --git a/JY.Inspection/Config/Configure.ini b/JY.Inspection/Config/Configure.ini index 22f726a..d55fbf5 100644 --- a/JY.Inspection/Config/Configure.ini +++ b/JY.Inspection/Config/Configure.ini @@ -22,7 +22,7 @@ GradingMesUrl=http://10.22.167.141/core/api/public/eve/pm/eqm/new/grading ResultProcessMesUrl=http://10.22.167.2/core/api/public/product/process/param/new/result StationArrivalUrl=http://10.22.167.2/core/api/public/formation/section/arrival/bz StationExitUrl=http://10.22.167.2/core/api/public/eve/pm/formation-section/bz -LoginMesUrl=http://127.0.0.1/ +LoginMesUrl=http://10.22.167.2/core/api/public/equipment/base/user/permission/verify NGMessage=²»·ÖÀà,ÕýÃæ(2D/3D),·´Ãæ(2D/3D),×ó²àÃæ(2D/3D),ÓҲàÃæ(2D/3D),¶¥Ãæ(2D/3D),µ×Ãæ(2D/3D),µ×WE2,µ×WE2,µ×WE3,µ×WE4,ÖÐME1,ÖÐME2,ÖÐME3,ÖÐME1,¼«Öù(POS/NEG),·À±¬·§(PRO),ɨÂëNG,·ֵµNG,ÆäËû CCDResultMessage=²»·ÖÀà,NG,OK Grading1=K77 diff --git a/JY.Inspection/Frm/FrmCCDQuery.designer.cs b/JY.Inspection/Frm/FrmCCDQuery.designer.cs index d0176ae..6ac831f 100644 --- a/JY.Inspection/Frm/FrmCCDQuery.designer.cs +++ b/JY.Inspection/Frm/FrmCCDQuery.designer.cs @@ -49,9 +49,10 @@ // // btnSelect // - this.btnSelect.Location = new System.Drawing.Point(578, 26); + this.btnSelect.Location = new System.Drawing.Point(771, 32); + this.btnSelect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnSelect.Name = "btnSelect"; - this.btnSelect.Size = new System.Drawing.Size(75, 23); + this.btnSelect.Size = new System.Drawing.Size(100, 29); this.btnSelect.TabIndex = 12; this.btnSelect.Text = "查询"; this.btnSelect.UseSelectable = true; @@ -60,9 +61,10 @@ // metroLabel2 // this.metroLabel2.AutoSize = true; - this.metroLabel2.Location = new System.Drawing.Point(1062, 31); + this.metroLabel2.Location = new System.Drawing.Point(1416, 39); + this.metroLabel2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.metroLabel2.Name = "metroLabel2"; - this.metroLabel2.Size = new System.Drawing.Size(18, 19); + this.metroLabel2.Size = new System.Drawing.Size(19, 20); this.metroLabel2.TabIndex = 11; this.metroLabel2.Text = "~"; this.metroLabel2.Visible = false; @@ -70,9 +72,10 @@ // metroLabel1 // this.metroLabel1.AutoSize = true; - this.metroLabel1.Location = new System.Drawing.Point(928, 37); + this.metroLabel1.Location = new System.Drawing.Point(1237, 46); + this.metroLabel1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.metroLabel1.Name = "metroLabel1"; - this.metroLabel1.Size = new System.Drawing.Size(79, 19); + this.metroLabel1.Size = new System.Drawing.Size(84, 20); this.metroLabel1.TabIndex = 10; this.metroLabel1.Text = "查询时间:"; this.metroLabel1.Visible = false; @@ -81,10 +84,11 @@ // this.dtEndTime.CustomFormat = "yyyy-MM-dd"; this.dtEndTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; - this.dtEndTime.Location = new System.Drawing.Point(1086, 26); - this.dtEndTime.MinimumSize = new System.Drawing.Size(4, 29); + this.dtEndTime.Location = new System.Drawing.Point(1448, 32); + this.dtEndTime.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.dtEndTime.MinimumSize = new System.Drawing.Size(0, 30); this.dtEndTime.Name = "dtEndTime"; - this.dtEndTime.Size = new System.Drawing.Size(106, 29); + this.dtEndTime.Size = new System.Drawing.Size(140, 30); this.dtEndTime.TabIndex = 9; this.dtEndTime.Value = new System.DateTime(2022, 3, 5, 0, 0, 0, 0); this.dtEndTime.Visible = false; @@ -93,10 +97,11 @@ // this.dtStartTime.CustomFormat = "yyyy-MM-dd"; this.dtStartTime.Format = System.Windows.Forms.DateTimePickerFormat.Custom; - this.dtStartTime.Location = new System.Drawing.Point(1008, 32); - this.dtStartTime.MinimumSize = new System.Drawing.Size(4, 29); + this.dtStartTime.Location = new System.Drawing.Point(1344, 40); + this.dtStartTime.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.dtStartTime.MinimumSize = new System.Drawing.Size(0, 30); this.dtStartTime.Name = "dtStartTime"; - this.dtStartTime.Size = new System.Drawing.Size(104, 29); + this.dtStartTime.Size = new System.Drawing.Size(137, 30); this.dtStartTime.TabIndex = 8; this.dtStartTime.Value = new System.DateTime(2022, 3, 5, 0, 0, 0, 0); this.dtStartTime.Visible = false; @@ -104,9 +109,10 @@ // lblSelectStures // this.lblSelectStures.AutoSize = true; - this.lblSelectStures.Location = new System.Drawing.Point(833, 32); + this.lblSelectStures.Location = new System.Drawing.Point(1111, 40); + this.lblSelectStures.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.lblSelectStures.Name = "lblSelectStures"; - this.lblSelectStures.Size = new System.Drawing.Size(0, 12); + this.lblSelectStures.Size = new System.Drawing.Size(0, 15); this.lblSelectStures.TabIndex = 14; // // dgvData @@ -139,7 +145,8 @@ this.dgvData.EnableHeadersVisualStyles = false; this.dgvData.Font = new System.Drawing.Font("Segoe UI", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel); this.dgvData.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); - this.dgvData.Location = new System.Drawing.Point(3, 3); + this.dgvData.Location = new System.Drawing.Point(4, 4); + this.dgvData.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.dgvData.Name = "dgvData"; this.dgvData.ReadOnly = true; this.dgvData.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; @@ -156,7 +163,7 @@ this.dgvData.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; this.dgvData.RowTemplate.Height = 23; this.dgvData.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.dgvData.Size = new System.Drawing.Size(1371, 174); + this.dgvData.Size = new System.Drawing.Size(1828, 217); this.dgvData.TabIndex = 15; // // txtOrderNum @@ -165,9 +172,10 @@ // // this.txtOrderNum.CustomButton.Image = null; - this.txtOrderNum.CustomButton.Location = new System.Drawing.Point(130, 1); + this.txtOrderNum.CustomButton.Location = new System.Drawing.Point(233, 1); + this.txtOrderNum.CustomButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtOrderNum.CustomButton.Name = ""; - this.txtOrderNum.CustomButton.Size = new System.Drawing.Size(21, 21); + this.txtOrderNum.CustomButton.Size = new System.Drawing.Size(36, 34); this.txtOrderNum.CustomButton.Style = MetroFramework.MetroColorStyle.Blue; this.txtOrderNum.CustomButton.TabIndex = 1; this.txtOrderNum.CustomButton.Theme = MetroFramework.MetroThemeStyle.Light; @@ -175,7 +183,8 @@ this.txtOrderNum.CustomButton.Visible = false; this.txtOrderNum.FontSize = MetroFramework.MetroTextBoxSize.Medium; this.txtOrderNum.Lines = new string[0]; - this.txtOrderNum.Location = new System.Drawing.Point(378, 29); + this.txtOrderNum.Location = new System.Drawing.Point(504, 36); + this.txtOrderNum.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.txtOrderNum.MaxLength = 32767; this.txtOrderNum.Name = "txtOrderNum"; this.txtOrderNum.PasswordChar = '\0'; @@ -185,7 +194,7 @@ this.txtOrderNum.SelectionLength = 0; this.txtOrderNum.SelectionStart = 0; this.txtOrderNum.ShortcutsEnabled = true; - this.txtOrderNum.Size = new System.Drawing.Size(152, 23); + this.txtOrderNum.Size = new System.Drawing.Size(203, 29); this.txtOrderNum.TabIndex = 16; this.txtOrderNum.UseSelectable = true; this.txtOrderNum.WaterMark = "输入要查询的工单"; @@ -195,17 +204,19 @@ // metroLabel8 // this.metroLabel8.AutoSize = true; - this.metroLabel8.Location = new System.Drawing.Point(331, 30); + this.metroLabel8.Location = new System.Drawing.Point(441, 38); + this.metroLabel8.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.metroLabel8.Name = "metroLabel8"; - this.metroLabel8.Size = new System.Drawing.Size(51, 19); + this.metroLabel8.Size = new System.Drawing.Size(54, 20); this.metroLabel8.TabIndex = 17; this.metroLabel8.Text = "工单:"; // // btnExcel // - this.btnExcel.Location = new System.Drawing.Point(695, 26); + this.btnExcel.Location = new System.Drawing.Point(927, 32); + this.btnExcel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.btnExcel.Name = "btnExcel"; - this.btnExcel.Size = new System.Drawing.Size(75, 23); + this.btnExcel.Size = new System.Drawing.Size(100, 29); this.btnExcel.TabIndex = 18; this.btnExcel.Text = "导出"; this.btnExcel.UseSelectable = true; @@ -219,19 +230,20 @@ this.tableLayoutPanel1.ColumnCount = 1; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel1.Controls.Add(this.dgvData, 0, 0); - this.tableLayoutPanel1.Location = new System.Drawing.Point(4, 72); + this.tableLayoutPanel1.Location = new System.Drawing.Point(5, 90); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25.45455F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 74.54546F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(1377, 708); + this.tableLayoutPanel1.Size = new System.Drawing.Size(1836, 885); this.tableLayoutPanel1.TabIndex = 19; // // FrmCCDQuery // - this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); + this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1386, 788); + this.ClientSize = new System.Drawing.Size(1848, 985); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.lblSelectStures); this.Controls.Add(this.btnExcel); @@ -243,7 +255,9 @@ this.Controls.Add(this.dtEndTime); this.Controls.Add(this.dtStartTime); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "FrmCCDQuery"; + this.Padding = new System.Windows.Forms.Padding(27, 75, 27, 25); this.Resizable = false; this.ShadowType = MetroFramework.Forms.MetroFormShadowType.SystemShadow; this.Text = "CCD统计数据查询"; diff --git a/JY.Inspection/Frm/FrmHistoricalDataQuery.cs b/JY.Inspection/Frm/FrmHistoricalDataQuery.cs index 83abbdf..45c2706 100644 --- a/JY.Inspection/Frm/FrmHistoricalDataQuery.cs +++ b/JY.Inspection/Frm/FrmHistoricalDataQuery.cs @@ -1,21 +1,25 @@ -using System; +using JY.DAL; +using JY.Inspection.Enums; +using JY.Inspection.Mes; +using JY.MES; +using JY.MES.Entity; +using JY.MES.Enum; +using JY.MES.MES; +using JY.Model; +using JY.Model.Enums; +using JY.Utility; +using JYControl; +using MiniExcelLibs; +using Newtonsoft.Json; +using OfficeOpenXml; +using System; +using System.Collections.Generic; using System.Data; +using System.Drawing; using System.IO; +using System.Text; using System.Threading; using System.Windows.Forms; -using JY.DAL; -using JY.Utility; -using System.Drawing; -using Newtonsoft.Json; -using JYControl; -using JY.MES.Entity; -using JY.MES; -using OfficeOpenXml; -using MiniExcelLibs; -using System.Collections.Generic; -using JY.Inspection.Enums; -using JY.Model.Enums; -using JY.Model; namespace JY.Inspection.Frm { @@ -133,7 +137,8 @@ namespace JY.Inspection.Frm EnumSearchType curEnum = EnumSearchType.ArrivalStation; if (this.InvokeRequired) { - this.BeginInvoke(new Action(() => { + this.Invoke(new Action(() => + { var curItem = cbSelectType.SelectedItem as ComboItem; curEnum = curItem.Value.ToEnum(); })); @@ -225,7 +230,6 @@ namespace JY.Inspection.Frm private void btnSelect_Click(object sender, EventArgs e) { - try { tSo = new Thread(new ThreadStart(ThreadWork)); @@ -355,6 +359,8 @@ namespace JY.Inspection.Frm /// private void btnUpMES_Click(object sender, EventArgs e) { + StringBuilder sb = new StringBuilder(); + if (dgvData.Columns.Count <= 1) { MessageBox.Show("请先查询数据,再进行上传MES操作", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); @@ -403,83 +409,101 @@ namespace JY.Inspection.Frm else//下料 { // TODO 结果数据上传 + sb.Clear(); + + int i = 0; foreach (DataGridViewRow row in dgvData.Rows) { + i++; + if (Convert.ToBoolean(row.Cells[0].Value)) { if (Convert.ToInt32(row.Cells["状态"].Value) == 1 || Convert.ToInt32(row.Cells["状态"].Value) == 2) { - MessageBox.Show("勾选电芯数据已上传", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - return; + sb.AppendLine($"第{i}行数据: 勾选电芯数据已上传"); + continue; } else - { - // TODO 获取出站数据上传MES - JY.MES.FMS.FMS_Out fMS_Out = new MES.FMS.FMS_Out(); - //fMS_In.deviceCode = Global.systemConfig.eqp_code; - //fMS_In.houseCode = "test11"; - //fMS_In.skuCode = m.BarCode; - //fMS_In.systemCode = "win10"; - //fMS_In.processCode = Global.systemConfig.seq_code; - //fMS_In.ngCode = ""; - //fMS_Out.systemCode = Global.systemConfig.systemCode; - //fMS_Out.houseCode = Global.systemConfig.houseCode; - //fMS_Out.skuCode = Convert.ToString(row.Cells["条码"].Value); - //fMS_Out.deviceCode = Global.systemConfig.deviceCode; - //fMS_Out.processCode = Global.systemConfig.processCode; - fMS_Out.testResult = "NG"; - fMS_Out.ngCode = "0"; + { + // 获取出站数据上传MES + BlankingData data = GetBlankingData(row); - JY.MES.FMS.processData ProData = new JY.MES.FMS.processData(); + if (data == null) + { + sb.AppendLine($"第{i}行数据: 获取出站数据失败, 跳过该数据"); + continue; + } - ProData.inTime = Convert.ToString(row.Cells["进站时间"].Value); - ProData.outTime = Convert.ToString(row.Cells["进站时间"].Value); - ProData.cspdjg = Convert.ToString(row.Cells["综合结果"].Value); - ProData.cssj = ""; - ProData.cspc = ""; - ProData.csjg = Convert.ToString(row.Cells["综合结果"].Value); - ProData.fcbj = ""; - ProData.fccs = ""; - ProData.fcsj = ""; - ProData.fcyy = ""; - ProData.ngyy = Convert.ToString(row.Cells["备注"].Value); - ProData.ngsj = ""; - ProData.ngwz = ""; - ProData.hjwd = ""; - ProData.hjsd = ""; - ProData.kqjjd = ""; - ProData.workShift = Convert.ToString(row.Cells["班次"].Value); - fMS_Out.processData = ProData; - - string strJosn = JsonConvert.SerializeObject(fMS_Out); - LogManagerControl.AddLog($"PC->FMS[电芯出站]:{strJosn}", LogAddtype.MES); - var result = JY.MES.FMS.MesHelper_EVE.MES_Outbound(fMS_Out); - string strRes = "statusCode:" + "[" + result.statusCode + "]" + "statusMessage" + "[" + result.statusMessage + "]"; - LogManagerControl.AddLog($"FMS->PC[电芯出站]:{strRes}", LogAddtype.MES); - - string NowTime = DateTime.Now.ToString("yyyy - MM - dd HH: mm: ss"); - var result1 = @" UPDATE BlankingData set Flag=2,strUploadMESTime='" + NowTime + "' where[ID]=" + Convert.ToInt32(row.Cells["唯一ID"].Value); - //var result2 = @" UPDATE BlankingData set UploadMESTime='" + NowTime + "' where[ID]='" + Convert.ToString(row.Cells["唯一ID"].Value) + "'"; - DataTable dt = SqlHelper.QueryTable(result1); + MesCallResult resMes = new MESDataCombin().ProductResultParameters(data); + if (!resMes.IsSuccess) + { + if (resMes.ErrorType == MesErrorType.NetworkError || resMes.ErrorType == MesErrorType.NetworkTimeout) + { + sb.AppendLine($"第{i}行数据: 结果数据上传MES超时或无法访问MES服务器"); + LogManagerControl.AddLog("结果数据上传MES超时或无法访问MES服务器", LogAddtype.local, Logtype.Error); + } + else + { + string errMsg = resMes.OriResponse == null ? resMes.ErrorMessage : resMes.OriResponse.ToString(); + sb.AppendLine($"第{i}行数据: 结果数据上传MES失败NG,{errMsg}"); + LogManagerControl.AddLog("结果数据上传MES失败NG," + errMsg, LogAddtype.local, Logtype.Error); + } + } } } } } } - catch + catch(Exception ex) { - MessageBox.Show("手动上传MES失败", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show($"手动上传MES失败: {ex.ToString()}", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } - MessageBox.Show("手动上传MES成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - + if (sb.Length > 0) + { + // 弹出错误信息 + MessageBox.Show(sb.ToString(), "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Error); + } + else + { + MessageBox.Show("手动上传MES成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); + } } private BlankingData GetBlankingData(DataGridViewRow row) { - // TODO 获取BlankingData - return null; + // 获取BlankingData + BlankingData data = new BlankingData(); + data.ID = Convert.ToInt32(row.Cells["ID"].Value); + data.TD = Convert.ToInt32(row.Cells["序号"].Value); + data.WorkShift = row.Cells["班次"].Value?.ToString(); + data.TDGroup = Convert.ToInt32(row.Cells["主道"].Value); + data.ArrivalBarCode = row.Cells["入站条码"].Value?.ToString(); + data.DepartureBarCode = row.Cells["出站条码"].Value?.ToString(); + data.TMDB = row.Cells["条码对比"].Value?.ToString(); + data.OutTime = row.Cells["出站时间"].Value?.ToString(); + data.CCD1 = row.Cells["正面(2D/3D)"].Value?.ToString(); + data.CCD2 = row.Cells["反面(2D/3D)"].Value?.ToString(); + data.CCD3 = row.Cells["左侧面(2D/3D)"].Value?.ToString(); + data.CCD4 = row.Cells["右侧面(2D/3D)"].Value?.ToString(); + data.CCD5 = row.Cells["顶面(2D/3D)"].Value?.ToString(); + data.CCD6 = row.Cells["底面(2D/3D)"].Value?.ToString(); + data.CCD7 = row.Cells["底WE1"].Value?.ToString(); + data.CCD8 = row.Cells["底WE2"].Value?.ToString(); + data.CCD9 = row.Cells["底WE3"].Value?.ToString(); + data.CCD10 = row.Cells["底WE4"].Value?.ToString(); + data.CCD11 = row.Cells["中ME1"].Value?.ToString(); + data.CCD12 = row.Cells["中ME2"].Value?.ToString(); + data.CCD13 = row.Cells["中ME3"].Value?.ToString(); + data.CCD14 = row.Cells["中ME4"].Value?.ToString(); + data.CCD15 = row.Cells["极柱(POS/NEG)"].Value?.ToString(); + data.CCD16 = row.Cells["防爆阀(PRO)"].Value?.ToString(); + data.Result = row.Cells["综合结果"].Value?.ToString(); + data.Remark = row.Cells["备注"].Value?.ToString(); + data.Flag = Convert.ToInt32(row.Cells["状态"].Value); + + return data; } ///