Browse Source

有条码不良直接判断

章政 7 years ago
parent
commit
cf922a0e38

+ 10 - 10
UAS_AutoPass/AutoAnalysisXml.Designer.cs

@@ -58,7 +58,7 @@
             // 
             this.StartWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.StartWatch.Location = new System.Drawing.Point(145, 256);
-            this.StartWatch.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.StartWatch.Margin = new System.Windows.Forms.Padding(2);
             this.StartWatch.Name = "StartWatch";
             this.StartWatch.Size = new System.Drawing.Size(64, 28);
             this.StartWatch.TabIndex = 0;
@@ -71,7 +71,7 @@
             this.StopWatch.Enabled = false;
             this.StopWatch.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.StopWatch.Location = new System.Drawing.Point(249, 256);
-            this.StopWatch.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.StopWatch.Margin = new System.Windows.Forms.Padding(2);
             this.StopWatch.Name = "StopWatch";
             this.StopWatch.Size = new System.Drawing.Size(64, 28);
             this.StopWatch.TabIndex = 1;
@@ -94,7 +94,7 @@
             // 
             this.FolderPath.Enabled = false;
             this.FolderPath.Location = new System.Drawing.Point(112, 139);
-            this.FolderPath.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.FolderPath.Margin = new System.Windows.Forms.Padding(2);
             this.FolderPath.Name = "FolderPath";
             this.FolderPath.Size = new System.Drawing.Size(220, 21);
             this.FolderPath.TabIndex = 3;
@@ -103,7 +103,7 @@
             // 
             this.ChooseFolder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.ChooseFolder.Location = new System.Drawing.Point(346, 139);
-            this.ChooseFolder.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.ChooseFolder.Margin = new System.Windows.Forms.Padding(2);
             this.ChooseFolder.Name = "ChooseFolder";
             this.ChooseFolder.Size = new System.Drawing.Size(78, 24);
             this.ChooseFolder.TabIndex = 6;
@@ -114,7 +114,7 @@
             // OperateResult
             // 
             this.OperateResult.Location = new System.Drawing.Point(446, 11);
-            this.OperateResult.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.OperateResult.Margin = new System.Windows.Forms.Padding(2);
             this.OperateResult.Name = "OperateResult";
             this.OperateResult.Size = new System.Drawing.Size(211, 270);
             this.OperateResult.TabIndex = 7;
@@ -124,7 +124,7 @@
             // 
             this.Clean.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.Clean.Location = new System.Drawing.Point(524, 287);
-            this.Clean.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.Clean.Margin = new System.Windows.Forms.Padding(2);
             this.Clean.Name = "Clean";
             this.Clean.Size = new System.Drawing.Size(56, 24);
             this.Clean.TabIndex = 8;
@@ -136,7 +136,7 @@
             // 
             this.ChooseBackUpFolder.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.ChooseBackUpFolder.Location = new System.Drawing.Point(346, 201);
-            this.ChooseBackUpFolder.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.ChooseBackUpFolder.Margin = new System.Windows.Forms.Padding(2);
             this.ChooseBackUpFolder.Name = "ChooseBackUpFolder";
             this.ChooseBackUpFolder.Size = new System.Drawing.Size(78, 24);
             this.ChooseBackUpFolder.TabIndex = 11;
@@ -148,7 +148,7 @@
             // 
             this.BackUpFolderPath.Enabled = false;
             this.BackUpFolderPath.Location = new System.Drawing.Point(112, 201);
-            this.BackUpFolderPath.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.BackUpFolderPath.Margin = new System.Windows.Forms.Padding(2);
             this.BackUpFolderPath.Name = "BackUpFolderPath";
             this.BackUpFolderPath.Size = new System.Drawing.Size(220, 21);
             this.BackUpFolderPath.TabIndex = 10;
@@ -209,7 +209,7 @@
             // ma_code
             // 
             this.ma_code.Location = new System.Drawing.Point(112, 80);
-            this.ma_code.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.ma_code.Margin = new System.Windows.Forms.Padding(2);
             this.ma_code.Name = "ma_code";
             this.ma_code.Size = new System.Drawing.Size(220, 21);
             this.ma_code.TabIndex = 17;
@@ -234,7 +234,7 @@
             this.Controls.Add(this.label1);
             this.Controls.Add(this.StopWatch);
             this.Controls.Add(this.StartWatch);
-            this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
+            this.Margin = new System.Windows.Forms.Padding(2);
             this.MaximizeBox = false;
             this.Name = "AutoAnalysisXml";
             this.Text = "UAS自动过站解析器";

+ 14 - 2
UAS_AutoPass/AutoAnalysisXml.cs

@@ -53,6 +53,10 @@ namespace UAS_AutoPass
         /// 缓存的文件夹
         /// </summary>
         public static string CachePathFolder = Environment.GetEnvironmentVariable("windir").Substring(0, 1) + @":/UAS_MES/XmlAnalysor/";
+        /// <summary>
+        /// 需要解析的文件名
+        /// </summary>
+        List<string> _FileName = new List<string>();
 
         public AutoAnalysisXml()
         {
@@ -96,7 +100,7 @@ namespace UAS_AutoPass
             {
                 if (Master.Text == DB.Rows[i]["ma_user"].ToString())
                 {
-                    DataHelper.DBConnectionString = "Data Source=192.168.230.200/orcl;User ID=" + DB.Rows[i]["ma_user"] + ";PassWord=" + DB.Rows[i]["ms_pwd"]; ;
+                    DataHelper.DBConnectionString = "Data Source=" + DB.Rows[i]["ma_inneraddress"] + ";User ID=" + DB.Rows[i]["ma_user"] + ";PassWord=" + DB.Rows[i]["ms_pwd"]; ;
                     dh = new DataHelper();
                 }
             }
@@ -300,7 +304,7 @@ namespace UAS_AutoPass
                             case "NG":
                                 RecordBadInfo(sncode, makecode, e.Name, "", badcode.ToArray(), badlocation.ToArray());
                                 //所有的序列号均采集为良品
-                                if (!LogicHandler.SetStepResult(makecode, isource, sncode, "自动过站采集", "OK", iusercode, out oErrMessage))
+                                if (!LogicHandler.SetTestNGDetail(sncode, makecode, iusercode, isource, test_result, out oErrMessage))
                                 {
                                     OperateResult.AppendText(oErrMessage + "\n");
                                     return;
@@ -346,6 +350,14 @@ namespace UAS_AutoPass
             }
         }
 
+        /// <summary>
+        /// 使用进程处理文件,避免界面假死
+        /// </summary>
+        private void XmlHandleProcess()
+        {
+
+        }
+
         private void RecordBadInfo(string sncode, string makecode, string filename, string combine, string[] badcode, string[] badlocation)
         {
             sql.Clear();

+ 57 - 0
UAS_AutoPass/ToolClass/LogicHandler.cs

@@ -65,6 +65,63 @@ namespace UAS_AutoPass.ToolClass
             }
         }
 
+        public static bool SetTestNGDetail(string iSnCode, string iMakeCode, string iUserCode, string iSourceCode, string iResult, out string oErrorMessage)
+        {
+            oErrorMessage = "";
+            string StepCode = "";
+            string StepName = "";
+            if (iResult == "" || iResult == null)
+                iResult = "检查未通过";
+            GetStepCodeAndNameBySource(iSourceCode, ref StepCode, ref StepName);
+            //更新序列号已经采集的工序 ms_paststep 已采集数据,更新下一工序
+            //如果存在送检批号则进行删除
+            if (dh.CheckExist("oqcbatchdetail", "obd_sncode='" + iSnCode + "'"))
+            {
+                string checkno = dh.getFieldDataByCondition("oqcbatchdetail", "obd_checkno", "obd_sncode='" + iSnCode + "'").ToString();
+                dh.ExecuteSql("delete from oqcbatchdetail where obd_sncode='" + iSnCode + "'", "delete");
+                dh.ExecuteSql("update oqcbatch set ob_nowcheckqty=ob_nowcheckqty-1 where ob_checkno='" + checkno + "'", "update");
+            }
+            //之前保存的不良就不再调用
+            DataTable dt = dh.getFieldsDataByCondition("makeserial", new string[] { "ms_stepcode", "nvl(ms_ifrework,0)ms_ifrework" }, "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
+            if (dt.Rows.Count > 0)
+            {
+                string ifrework = dt.Rows[0]["ms_ifrework"].ToString();
+                string ms_stepcode = dt.Rows[0]["ms_stepcode"].ToString();
+                if (ms_stepcode == StepCode)
+                {
+                    if (ifrework == "0")
+                        dh.UpdateByCondition("makeserial", "ms_status=3", "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
+                    else
+                        dh.UpdateByCondition("makeserial", "ms_reworkstatus=3", "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
+                }
+                else
+                {
+                    if (ifrework == "0")
+                        dh.UpdateByCondition("makeserial", "ms_nextstepcode='',ms_paststep = ms_paststep ||'," + StepCode + "',ms_status=3", "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "' ");
+                    else
+                        dh.UpdateByCondition("makeserial", "ms_nextstepcode='',ms_paststep = ms_paststep ||'," + StepCode + "',ms_reworkstatus=3", "ms_sncode='" + iSnCode + "' and ms_makecode='" + iMakeCode + "'");
+                    SetStepResult(iMakeCode, iSourceCode, iSnCode, "不良采集", iResult, iUserCode, out oErrorMessage);
+                }
+            }
+            return true;
+        }
+
+        /// <summary>
+        /// 获取步骤代码和名称
+        /// </summary>
+        /// <param name="Source"></param>
+        /// <param name="StepCode"></param>
+        /// <param name="StepName"></param>
+        private static void GetStepCodeAndNameBySource(string Source, ref string StepCode, ref string StepName)
+        {
+            DataTable dt = dh.getFieldsDataByCondition("source", new string[] { "sc_stepcode", "sc_stepname", "sc_linecode" }, "sc_code='" + Source + "'");
+            if (dt.Rows.Count > 0)
+            {
+                StepCode = dt.Rows[0]["sc_stepcode"].ToString();
+                StepName = dt.Rows[0]["sc_stepname"].ToString();
+            }
+        }
+
         public static bool CheckUserAndResourcePassed(string iUserCode, string iSourceCode, out string oErrorMessage)
         {
             oErrorMessage = "";