Преглед на файлове

优化窗口和核对提示

yhluo преди 4 месеца
родител
ревизия
7ae275ab97
променени са 3 файла, в които са добавени 116 реда и са изтрити 103 реда
  1. 44 93
      UAS_MES_HGS/FunctionCode/Make/Make_ParseLog.Designer.cs
  2. 47 9
      UAS_MES_HGS/FunctionCode/Make/Make_ParseLog.cs
  3. 25 1
      UAS_MES_HGS/PublicMethod/LogicHandler.cs

+ 44 - 93
UAS_MES_HGS/FunctionCode/Make/Make_ParseLog.Designer.cs

@@ -34,26 +34,19 @@
             this.txtPath = new System.Windows.Forms.TextBox();
             this.Choose = new System.Windows.Forms.Button();
             this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
-            this.logList = new System.Windows.Forms.ListView();
-            this.sn = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.time = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.fileName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.panel1 = new System.Windows.Forms.Panel();
+            this.lstOk = new System.Windows.Forms.ListBox();
+            this.lstFiles = new System.Windows.Forms.ListBox();
             this.onWatch = new System.Windows.Forms.Button();
             this.claerBtn = new System.Windows.Forms.Button();
             this.LockMakeCode = new UAS_MES_NEW.CustomControl.CustomCheckBox.LockCheckBox();
             this.ma_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.MaCodeSearchTextBox();
             this.allParse = new System.Windows.Forms.Button();
             this.label3 = new System.Windows.Forms.Label();
-            this.panel2 = new System.Windows.Forms.Panel();
-            this.panel4 = new System.Windows.Forms.Panel();
-            this.lstFiles = new System.Windows.Forms.ListBox();
-            this.panel3 = new System.Windows.Forms.Panel();
             this.openFileDialog2 = new System.Windows.Forms.OpenFileDialog();
+            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
             this.panel1.SuspendLayout();
-            this.panel2.SuspendLayout();
-            this.panel4.SuspendLayout();
-            this.panel3.SuspendLayout();
+            this.tableLayoutPanel1.SuspendLayout();
             this.SuspendLayout();
             // 
             // Device
@@ -114,38 +107,6 @@
             this.openFileDialog1.FileName = "openFileDialog1";
             this.openFileDialog1.RestoreDirectory = true;
             // 
-            // logList
-            // 
-            this.logList.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
-            this.sn,
-            this.time,
-            this.fileName});
-            this.logList.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.logList.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.logList.HideSelection = false;
-            this.logList.Location = new System.Drawing.Point(0, 0);
-            this.logList.Name = "logList";
-            this.logList.Size = new System.Drawing.Size(326, 530);
-            this.logList.TabIndex = 6;
-            this.logList.UseCompatibleStateImageBehavior = false;
-            this.logList.View = System.Windows.Forms.View.Details;
-            this.logList.Visible = false;
-            // 
-            // sn
-            // 
-            this.sn.Text = "序号";
-            this.sn.Width = 55;
-            // 
-            // time
-            // 
-            this.time.Text = "时间";
-            this.time.Width = 220;
-            // 
-            // fileName
-            // 
-            this.fileName.Text = "文件名称";
-            this.fileName.Width = 380;
-            // 
             // panel1
             // 
             this.panel1.BackColor = System.Drawing.SystemColors.Control;
@@ -166,6 +127,27 @@
             this.panel1.Size = new System.Drawing.Size(1304, 296);
             this.panel1.TabIndex = 7;
             // 
+            // lstOk
+            // 
+            this.lstOk.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lstOk.FormattingEnabled = true;
+            this.lstOk.ItemHeight = 18;
+            this.lstOk.Location = new System.Drawing.Point(655, 3);
+            this.lstOk.Name = "lstOk";
+            this.lstOk.Size = new System.Drawing.Size(646, 524);
+            this.lstOk.TabIndex = 1;
+            // 
+            // lstFiles
+            // 
+            this.lstFiles.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lstFiles.FormattingEnabled = true;
+            this.lstFiles.ItemHeight = 18;
+            this.lstFiles.Location = new System.Drawing.Point(3, 3);
+            this.lstFiles.Name = "lstFiles";
+            this.lstFiles.Size = new System.Drawing.Size(646, 524);
+            this.lstFiles.TabIndex = 0;
+            this.lstFiles.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lstFiles_DrawItem_1);
+            // 
             // onWatch
             // 
             this.onWatch.Cursor = System.Windows.Forms.Cursors.Hand;
@@ -245,56 +227,32 @@
             this.label3.TabIndex = 6;
             this.label3.Text = "工单";
             // 
-            // panel2
-            // 
-            this.panel2.Controls.Add(this.panel4);
-            this.panel2.Controls.Add(this.panel3);
-            this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.panel2.Location = new System.Drawing.Point(0, 296);
-            this.panel2.Name = "panel2";
-            this.panel2.Size = new System.Drawing.Size(1304, 530);
-            this.panel2.TabIndex = 8;
-            // 
-            // panel4
-            // 
-            this.panel4.Controls.Add(this.lstFiles);
-            this.panel4.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.panel4.Location = new System.Drawing.Point(0, 0);
-            this.panel4.Name = "panel4";
-            this.panel4.Size = new System.Drawing.Size(978, 530);
-            this.panel4.TabIndex = 2;
-            // 
-            // lstFiles
-            // 
-            this.lstFiles.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.lstFiles.FormattingEnabled = true;
-            this.lstFiles.ItemHeight = 18;
-            this.lstFiles.Location = new System.Drawing.Point(0, 0);
-            this.lstFiles.Name = "lstFiles";
-            this.lstFiles.Size = new System.Drawing.Size(978, 530);
-            this.lstFiles.TabIndex = 0;
-            this.lstFiles.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.lstFiles_DrawItem_1);
-            // 
-            // panel3
-            // 
-            this.panel3.Controls.Add(this.logList);
-            this.panel3.Dock = System.Windows.Forms.DockStyle.Right;
-            this.panel3.Location = new System.Drawing.Point(978, 0);
-            this.panel3.Name = "panel3";
-            this.panel3.Size = new System.Drawing.Size(326, 530);
-            this.panel3.TabIndex = 1;
-            // 
             // openFileDialog2
             // 
             this.openFileDialog2.FileName = "openFileDialog2";
             // 
+            // tableLayoutPanel1
+            // 
+            this.tableLayoutPanel1.ColumnCount = 2;
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableLayoutPanel1.Controls.Add(this.lstOk, 1, 0);
+            this.tableLayoutPanel1.Controls.Add(this.lstFiles, 0, 0);
+            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 296);
+            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+            this.tableLayoutPanel1.RowCount = 1;
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+            this.tableLayoutPanel1.Size = new System.Drawing.Size(1304, 530);
+            this.tableLayoutPanel1.TabIndex = 8;
+            // 
             // Make_ParseLog
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.SystemColors.Window;
             this.ClientSize = new System.Drawing.Size(1304, 826);
-            this.Controls.Add(this.panel2);
+            this.Controls.Add(this.tableLayoutPanel1);
             this.Controls.Add(this.panel1);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
             this.Name = "Make_ParseLog";
@@ -302,9 +260,7 @@
             this.Load += new System.EventHandler(this.Make_ParseLog_Load);
             this.panel1.ResumeLayout(false);
             this.panel1.PerformLayout();
-            this.panel2.ResumeLayout(false);
-            this.panel4.ResumeLayout(false);
-            this.panel3.ResumeLayout(false);
+            this.tableLayoutPanel1.ResumeLayout(false);
             this.ResumeLayout(false);
 
         }
@@ -317,12 +273,7 @@
         private System.Windows.Forms.TextBox txtPath;
         private System.Windows.Forms.Button Choose;
         private System.Windows.Forms.OpenFileDialog openFileDialog1;
-        private System.Windows.Forms.ListView logList;
         private System.Windows.Forms.Panel panel1;
-        private System.Windows.Forms.Panel panel2;
-        private System.Windows.Forms.ColumnHeader time;
-        private System.Windows.Forms.ColumnHeader fileName;
-        private System.Windows.Forms.ColumnHeader sn;
         private System.Windows.Forms.Label label3;
         private System.Windows.Forms.Button allParse;
         private CustomControl.TextBoxWithIcon.MaCodeSearchTextBox ma_code;
@@ -330,8 +281,8 @@
         private System.Windows.Forms.OpenFileDialog openFileDialog2;
         private System.Windows.Forms.ListBox lstFiles;
         private System.Windows.Forms.Button claerBtn;
-        private System.Windows.Forms.Panel panel4;
-        private System.Windows.Forms.Panel panel3;
         private System.Windows.Forms.Button onWatch;
+        private System.Windows.Forms.ListBox lstOk;
+        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
     }
 }

+ 47 - 9
UAS_MES_HGS/FunctionCode/Make/Make_ParseLog.cs

@@ -324,7 +324,7 @@ namespace UAS_MES_NEW.Make
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                         if (dt.Rows.Count == 0 || dt.Rows[0]["MAL_SNCODE"].ToString() == "")
                         {
-                            LogMessage($"文件 {PathName}, 解析SN: {currItem[1]}无匹配过站SN");
+                            LogMessage($"文件 {PathName}, 匹配NG: {currItem[1]}无对应SN");
                             break;
                         }
 
@@ -336,6 +336,11 @@ namespace UAS_MES_NEW.Make
                         logArr.Add(itemLog);
                     }
                 }
+                if(logArr.Count == 0)
+                {
+                    return;
+                }
+
                 if (InsertDb(logArr, PathName, fileNum))
                 {
                     if (ConsoleLog(restOfStream, PathName))
@@ -359,9 +364,9 @@ namespace UAS_MES_NEW.Make
                 List<string> param = new List<string>() { };
                 foreach (var item in logs)
                 {
-                    if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, item.SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
+                    if (LogicHandler.CheckStepSNAndMacode(ma_code.Text, User.UserSourceCode, item.SN, User.UserCode,false ,out omakeCode, out oMsid, out oErrorMessage))
                     {
-                        if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, item.SN, "日志解析", "OK", User.UserCode, out oErrorMessage))
+                        if (LogicHandler.SetStepResult(omakeCode, User.UserSourceCode, item.SN, "日志解析", "OK", User.UserCode, false ,out oErrorMessage))
                         {
                             string sqlStr = $@"select ma_code,nvl(mcd_okqty,0) mcd_okqty,ma_prodcode,pr_detail,ma_qty - nvl(mcd_okqty, 0) remain_qty 
                                         from make left join makecraftdetail on mcd_maid=ma_id left join product on pr_code = ma_prodcode 
@@ -382,6 +387,11 @@ namespace UAS_MES_NEW.Make
                             dh.CallProcedure("cs_insert_testdetail", ref paramList);
                             LogMessage($"文件: {PathName},共{fileNum}条记录SN: {item.SN}解析已过站");
                             param.Clear();
+
+                            if (logs.IndexOf(item) == logs.Count - 1)
+                            {
+                                return true;
+                            }
                         }
                         else
                         {
@@ -392,6 +402,7 @@ namespace UAS_MES_NEW.Make
                     else
                     {
                         LogMessage($"过站核对NG:{oErrorMessage}");
+                        break;
                     }
                 }
                 return false;
@@ -442,14 +453,41 @@ namespace UAS_MES_NEW.Make
 
         private void LogMessage(string message)
         {
-            if (lstFiles.InvokeRequired)
+            bool isNg;
+            if (message.ToUpper().Contains("NG"))
             {
-                lstFiles.Invoke(new Action<string>(LogMessage), message);
-                return;
+                isNg = true;
+            }
+            else if (message.ToUpper().Contains("ERROR"))
+            {
+                isNg = true;
+            }
+            else
+            {
+                isNg = false;
+            }
+
+            if (isNg) 
+            {
+                if (lstFiles.InvokeRequired)
+                {
+                    lstFiles.Invoke(new Action<string>(LogMessage), message);
+                    return;
+                }
+                lstFiles.Items.Add($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] {message}");
+                lstFiles.TopIndex = lstFiles.Items.Count - 1;
+                lstFiles.DrawMode = DrawMode.OwnerDrawFixed;
+            }
+            else
+            {
+                if (lstOk.InvokeRequired)
+                {
+                    lstOk.Invoke(new Action<string>(LogMessage), message);
+                    return;
+                }
+                lstOk.Items.Add($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] {message}");
+                lstOk.TopIndex = lstFiles.Items.Count - 1;
             }
-            lstFiles.Items.Add($"[{DateTime.Now:yyyy-MM-dd HH:mm:ss}] {message}");
-            lstFiles.TopIndex = lstFiles.Items.Count - 1;
-            lstFiles.DrawMode = DrawMode.OwnerDrawFixed;
         }
 
         private void lstFiles_DrawItem_1(object sender, DrawItemEventArgs e)

+ 25 - 1
UAS_MES_HGS/PublicMethod/LogicHandler.cs

@@ -193,7 +193,25 @@ namespace UAS_MES_NEW.PublicMethod
                 return false;
             }
         }
-
+        public static bool CheckStepSNAndMacode(string iMakeCode, string iSourceCode, string iSN, string iUserCode, bool isHaveDiag, out string oMakeCode, out string oMsID, out string oErrorMessage)
+        {
+            oErrorMessage = "";
+            oMakeCode = "";
+            oMsID = "";
+            string[] param = new string[] { iMakeCode, iSourceCode, iSN, iUserCode, oMakeCode, oMsID, oErrorMessage };
+            dh.CallProcedure("CS_CHECKSTEPSNANDMACODE", ref param);
+            oMakeCode = param[4];
+            oMsID = param[5];
+            oErrorMessage = param[6];
+            if (oErrorMessage == "" || oErrorMessage == null || oErrorMessage == "null")
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
         public static void GetQuerySql(string iCondition, out string v_sql, out string v_sql1)
         {
             v_sql = "";
@@ -728,6 +746,12 @@ namespace UAS_MES_NEW.PublicMethod
             return result;
         }
 
+        public static bool SetStepResult(string iMakeCode, string iSourceCode, string iSN, string iMPKind, string iResult, string iUserCode, bool isHaveDiag ,out string oErrorMessage)
+        {
+            bool result = CS_SetResult(iMakeCode, iSourceCode, iSN, iUserCode, iResult, out oErrorMessage);
+            return result;
+        }
+
         public static bool CS_SetResult(string iMakeCode, string iSourceCode, string iSN, string iUserCode, string iResult, out string oErrorMessage)
         {
             oErrorMessage = "";