callm 4 жил өмнө
parent
commit
7e13456683

+ 1 - 1
MaterialPrint/DataHelper.cs

@@ -31,7 +31,7 @@ namespace MaterialPrint
                     connection = new OracleConnection(DBConnectionString);
                 connection.Open();
             }
-            catch (Exception ) {  }
+            catch (Exception) { }
         }
 
         /// <summary>

+ 39 - 10
MaterialPrint/ReadTestInfo.cs

@@ -76,6 +76,28 @@ namespace MaterialPrint
             return add;
         }
 
+        public void GetAgingInfo(string FilePath)
+        {
+            //C:\Users\callm\Desktop\iNet
+            FilePath = @"C:\Users\callm\Desktop\iNet\RunIn.Log";
+            StreamReader sr = new StreamReader(FilePath);
+            
+            string StartTime = "";
+            string EndTime = "";
+            while (!sr.EndOfStream)
+            {
+                string str = sr.ReadLine();
+                if (str.Contains("Video Start"))
+                {
+                    StartTime = Regex.Match(str, @"\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2}").Value;
+                }
+                if (str.Contains("Video PASS"))
+                {
+                    EndTime = Regex.Match(str, @"\d{2}/\d{2}/\d{4} \d{2}:\d{2}:\d{2}").Value;
+                }
+            }
+            dh.ExecuteSql("update makeserial set ms_starttime=to_date('" + StartTime + "','dd/mm/yyyy hh24:mi:ss'),ms_endtime=to_date('" + EndTime + "','dd/mm/yyyy hh24:mi:ss') where ms_id='" + ms_id + "'", "select");
+        }
 
         public void GetWriteInfo(string FilePath)
         {
@@ -103,15 +125,16 @@ namespace MaterialPrint
             string PK = Regex.Match(exec("CheckupKey.exe", ""), @"The PKID is: \S+").Value.Replace("The PKID is: ", "");
             //判断KEY是否被使用过
             string keysn = dh.getFieldDataByCondition("makeserial", "ms_sncode", "ms_id<>" + ms_id + " and ms_key='" + PK + "'").ToString();
-            if (SerialNumber != SN.Text)
-            {
-                MessageBox.Show("扫描序列号:" + SN.Text + "和本机读取序列号:" + SerialNumber + "不一致");
-                return;
-            }
+            bool TestOK = true;
+            //if (SerialNumber != SN.Text)
+            //{
+            //    MessageBox.Show("扫描序列号:" + SN.Text + "和本机读取序列号:" + SerialNumber + "不一致");
+            //    TestOK = false;
+            //}
             if (keysn != "")
             {
                 MessageBox.Show("KEY:" + PK + "已被序列号:" + keysn + "使用");
-                return;
+                TestOK = false;
             }
             ResultView.DataSource = dt;
             foreach (var item in Dic)
@@ -129,10 +152,15 @@ namespace MaterialPrint
                 string sql = "insert into steptestdetail (std_id,std_sn,std_date,std_class,std_testresult,std_itemname)values";
                 sql += "(steptestdetail_seq.nextval,'" + SN.Text + "',to_timestamp('" + item.Value.Split('\t')[0] + "',";
                 sql += "'yyyy-mm-dd hh24:mi:ss.ff6'),'" + item.Key + "','" + result + "','" + itemname + "')";
-                dh.ExecuteSql(sql, "insert");
+                //测试OK才上传数据
+                if (TestOK)
+                    dh.ExecuteSql(sql, "insert");
+            }
+            if (TestOK)
+            {
+                dh.ExecuteSql("update makeserial set ms_key='" + PK + "' where ms_id=" + ms_id, "update");
+                MessageBox.Show("测试记录保存成功");
             }
-            dh.ExecuteSql("update makeserial set ms_key='" + PK + "' where ms_id=" + ms_id, "update");
-            MessageBox.Show("测试记录保存成功");
         }
 
         private void SN_KeyDown(object sender, KeyEventArgs e)
@@ -142,7 +170,8 @@ namespace MaterialPrint
                 ms_id = dh.getFieldDataByCondition("makeserial", "max(ms_id)", "ms_sncode='" + SN.Text + "' or ms_firstsn='" + SN.Text + "'").ToString();
                 if (ms_id != "")
                 {
-                    GetWriteInfo(@"C:\TEST_TOOL\SFTClassicLog.txt");
+                    GetAgingInfo("");
+                    //GetWriteInfo(@"C:\TEST_TOOL\SFTClassicLog.txt");
                 }
                 else
                 {

+ 6 - 6
UAS_MES_ODLF/FunctionCode/Special/Special_BoxSplit.Designer.cs

@@ -43,7 +43,7 @@
             this.Split.Image = null;
             this.Split.IsShowBorder = true;
             this.Split.Location = new System.Drawing.Point(534, 266);
-            this.Split.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Split.Margin = new System.Windows.Forms.Padding(4);
             this.Split.MoveImage = ((System.Drawing.Image)(resources.GetObject("Split.MoveImage")));
             this.Split.Name = "Split";
             this.Split.NormalImage = ((System.Drawing.Image)(resources.GetObject("Split.NormalImage")));
@@ -61,9 +61,9 @@
             this.Pallet_label.Location = new System.Drawing.Point(73, 264);
             this.Pallet_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.Pallet_label.Name = "Pallet_label";
-            this.Pallet_label.Size = new System.Drawing.Size(62, 41);
+            this.Pallet_label.Size = new System.Drawing.Size(93, 41);
             this.Pallet_label.TabIndex = 1;
-            this.Pallet_label.Text = "SN";
+            this.Pallet_label.Text = "MAC";
             // 
             // Pallate
             // 
@@ -71,7 +71,7 @@
             this.Pallate.BackColor = System.Drawing.Color.White;
             this.Pallate.ID = null;
             this.Pallate.Location = new System.Drawing.Point(182, 266);
-            this.Pallate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Pallate.Margin = new System.Windows.Forms.Padding(4);
             this.Pallate.Name = "Pallate";
             this.Pallate.Power = null;
             this.Pallate.Size = new System.Drawing.Size(292, 35);
@@ -84,7 +84,7 @@
             // 
             this.OperatResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.OperatResult.Location = new System.Drawing.Point(736, 120);
-            this.OperatResult.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.OperatResult.Margin = new System.Windows.Forms.Padding(4);
             this.OperatResult.Name = "OperatResult";
             this.OperatResult.Size = new System.Drawing.Size(404, 616);
             this.OperatResult.TabIndex = 3;
@@ -100,7 +100,7 @@
             this.Controls.Add(this.Pallet_label);
             this.Controls.Add(this.Split);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Special_BoxSplit";
             this.Tag = "Special!BoxSplit";
             this.Text = "拆箱处理";

+ 15 - 7
UAS_MES_ODLF/FunctionCode/Special/Special_BoxSplit.cs

@@ -30,19 +30,27 @@ namespace UAS_MES_NEW.Special
 
         private void Split_Click(object sender, EventArgs e)
         {
-            DataTable dt = (DataTable)dh.ExecuteSql("select mal_mac,mal_bt from makeaddresslist where mal_sncode='" + Pallate.Text + "'", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select si_mac,si_bt,si_sn from sninfo where si_mac='" + Pallate.Text + "'", "select");
             if (dt.Rows.Count > 0)
             {
-                string mac = dt.Rows[0]["mal_mac"].ToString();
-                dt = (DataTable)dh.ExecuteSql("select ms_firstsn from makeserial where ms_mac='" + mac + "'", "select");
+                string sn = dt.Rows[0]["si_sn"].ToString();
+                string si_mac = dt.Rows[0]["si_mac"].ToString();
+                dt = (DataTable)dh.ExecuteSql("select mal_mac,mal_bt,mal_sncode from makeaddresslist where mal_mac='" + Pallate.Text + "'", "select");
                 if (dt.Rows.Count > 0)
                 {
-                    string firstsn = dt.Rows[0]["ms_firstsn"].ToString();
-                    if (firstsn != Pallate.Text)
+                    string mal_sncode = dt.Rows[0]["mal_sncode"].ToString();
+                    if (sn != mal_sncode)
                     {
-                        dh.ExecuteSql("update makeaddresslist set mal_sncode='" + firstsn + "' where mal_sncode='" + Pallate.Text + "'", "update");
-                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "重新分配MAC", "分配成功", Pallate.Text, "");
+                        dh.ExecuteSql("update makeaddresslist set mal_sncode='" + sn + "' where mal_mac='" + si_mac + "'", "update");
+                        dh.ExecuteSql("update makeserial set ms_mac='',ms_bt='' where ms_firstsn='" + mal_sncode + "'", "update");
+                        OperatResult.AppendText("MAC" + Pallate.Text + "分配序列号" + sn, Color.Green);
                     }
+                    else
+                    {
+                        dh.ExecuteSql("update makeserial set ms_mac='',ms_bt='' where ms_mac='" + Pallate.Text + "' and ms_firstsn<>'" + sn + "'", "update");
+                        OperatResult.AppendText("MAC" + Pallate.Text + "分配序列号" + sn, Color.Green);
+                    }
+                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "重新分配MAC", "分配成功", Pallate.Text, "");
                 }
             }
             else

+ 1 - 1
UAS_MES_PW/FunctionCode/Make/Make_GetTestFileData.cs

@@ -83,7 +83,7 @@ namespace UAS_MES_NEW.Make
                         LoadCollectedNum();
                         string ms_prodcode = dh.getFieldDataByCondition("makeserial", "ms_prodcode", "ms_id='" + oMsid + "'").ToString();
                         DataTable dt = new DataTable();
-                        //BaseUtil.GetDataFromDevice("GETFILE", WatchPath.Text + " ./" + DateTime.Now.ToString("yyyy-MM-dd") + @"/" + sncode.Text);
+                        BaseUtil.GetDataFromDevice("GETFILE", WatchPath.Text + " ./" + DateTime.Now.ToString("yyyy-MM-dd") + @"/" + sncode.Text);
                         string[] files = Directory.GetFiles(Application.StartupPath + "/" + DateTime.Now.ToString("yyyy-MM-dd") + @"/" + sncode.Text, "*.csv");
                         BaseUtil.OpenCSVFile(ref dt, files[0]);
                         //移除标题行