Browse Source

优化juki贴片机对接

yhluo 5 months ago
parent
commit
a390bc39e5
1 changed files with 12 additions and 12 deletions
  1. 12 12
      UAS_MES_BG/FunctionCode/Make/Make_ParseLog.cs

+ 12 - 12
UAS_MES_BG/FunctionCode/Make/Make_ParseLog.cs

@@ -312,14 +312,16 @@ namespace UAS_MES_NEW.Make
                 if (dt.Rows.Count > 0)
                 {
                     string currentDate = DateTime.Now.ToString("yyyyMMddHHmmss");
+                    string currentDate1 = DateTime.Now.ToString("yyyy-MM-dd");
                     XmlWriterSettings settings = new XmlWriterSettings
                     {
-                        Indent = true,
-                        Encoding = System.Text.Encoding.UTF8
+                        Indent = true
+                        //,Encoding = System.Text.Encoding.UTF8
                     };
                     foreach (DataRow dr in dt.Rows)
                     {
-                        var hasFileAry = Directory.GetFiles(outXmlFilePath, $"*.{currFileType}");
+                        #region
+                        /*var hasFileAry = Directory.GetFiles(outXmlFilePath, $"*.{currFileType}");
                         string xmlName;
                         if (hasFileAry.Length > 0)
                         {
@@ -329,12 +331,14 @@ namespace UAS_MES_NEW.Make
 
                             string seqNumStr = lastFile.Substring(lastFile.Length - 7, 3);
                             string fileSeqNum = (int.Parse(seqNumStr) + 1).ToString().PadLeft(seqNumStr.Length, '0'); ;
-                            xmlName = $"1.08_{currentDate}_{currentDate}{fileSeqNum}.xml";
+                            xmlName = $"1.08_{currentDate}_{currentDate}{fileSeqNum}__RequestTotalProduction.xml";
                         }
                         else
                         {
-                            xmlName = $"1.08_{currentDate}_{currentDate}001.xml";
-                        }
+                            xmlName = $"1.08_{currentDate}_{currentDate}001__RequestTotalProduction.xml";
+                        }*/
+                        #endregion
+                        string xmlName = $"1.08__{currentDate1}T101505_{currentDate}001__RequestTotalProduction.xml";
                         string fullPath = Path.Combine(outXmlFilePath, xmlName);
 
                         using (XmlWriter writer = XmlWriter.Create(fullPath, settings))
@@ -345,20 +349,16 @@ namespace UAS_MES_NEW.Make
                             writer.WriteEndElement();
                             writer.WriteEndDocument();
                         }
-                        if (File.Exists(fullPath))
-                        {
-                            File.ReadAllText(fullPath);
-                        }
 
                         sql.Clear();
-                        sql.Append($"UPDATE devicedata SET dd_status = -1 WHERE dd_name = '{dr["dd_name"].ToString()}'");
+                        sql.Append($"UPDATE devicedata SET dd_status = -1 WHERE dd_name = '{dr["dd_name"].ToString()}' and dd_status = 0");
                         dh.ExecuteSql(sql.GetString(), "update");
                     }
                 }
             }
             catch (Exception ex)
             {
-                MessageBox.Show(this.ParentForm, ex.Message, "警告");
+                LogMessage($"写入指令文件异常: {ex.Message}");
             }
         }