Jelajahi Sumber

日志上传修改

callm 5 bulan lalu
induk
melakukan
9bc2a286fa
1 mengubah file dengan 34 tambahan dan 24 penghapusan
  1. 34 24
      UAS_MES_BG/FunctionCode/Make/Make_ParseLog.cs

+ 34 - 24
UAS_MES_BG/FunctionCode/Make/Make_ParseLog.cs

@@ -39,7 +39,7 @@ namespace UAS_MES_NEW.Make
         DataHelper dh;
         string currFileType = "";
 
-        string SN,omakeCode, oMsid, oErrorMessage= "";
+        string SN, omakeCode, oMsid, oErrorMessage = "";
         string equiType = "";
         private void Make_ParseLog_Load(object sender, EventArgs e)
         {
@@ -116,7 +116,7 @@ namespace UAS_MES_NEW.Make
             {
                 Device.Focus();
                 Device.SelectAll();
-                MessageBox.Show(this.ParentForm,"请选择设备", "提示");
+                MessageBox.Show(this.ParentForm, "请选择设备", "提示");
                 return;
             }
             if (!String.IsNullOrEmpty(txtPath.Text))
@@ -124,7 +124,8 @@ namespace UAS_MES_NEW.Make
                 txtPath.Focus();
                 txtPath.SelectAll();
             }
-            try {
+            try
+            {
                 FolderBrowserDialog dialog = new FolderBrowserDialog();
                 switch (Device.SelectedIndex)
                 {
@@ -278,33 +279,42 @@ namespace UAS_MES_NEW.Make
                             }
                             string xmlContent = File.ReadAllText(file);
                             var xmlList = ParseXml(xmlContent);
-                            if(ConsoleLog(xmlContent, file))
+                            if (ConsoleLog(xmlContent, file))
                             {
                                 File.Delete(file);
                             }
                             List<string> param = new List<string>() { };
                             string PS_CODE = "";
                             LogicHandler.GetSerialNumByCaller("Make!ParseLog", out PS_CODE);
-
+                            List<string> MachineName = new List<string>();
+                            List<string> Part = new List<string>();
+                            List<string> Station = new List<string>();
+                            List<string> ReelNo = new List<string>();
+                            string Part_ = "";
                             foreach (var item in xmlList)
                             {
-                                param.Clear();
-                                param.Add(item.MachineName);
-                                param.Add(item.Part);
-                                param.Add(item.Station);
-                                param.Add(item.ReelNo);
-                                param.Add(User.UserCode);
-                                param.Add(PS_CODE);
-                                string res = "";
-                                param.Add(res);
-                                string[] paramList = param.ToArray();
-                                dh.CallProcedure("CS_INSERT_STATION", ref paramList);
-                                res = paramList[6];
-                                if (!string.IsNullOrEmpty(res))
-                                {
-                                    LogMessage(res);
-                                }
+                                MachineName.Add(item.MachineName);
+                                Part_ = item.Part;
+                                Station.Add(item.Station);
+                                ReelNo.Add(item.ReelNo);
+                            }
+                            string ps_id = "";
+                            if (!dh.CheckExist("productsmt", "ps_prodcode='" + Part_ + "'"))
+                            {
+                                ps_id = dh.GetSEQ("productsmt_seq");
+                                dh.ExecuteSql("insert into productsmt(ps_id,ps_prodcode,ps_linecode,ps_status,ps_statuscode)" +
+                                    "values('" + ps_id + "','" + Part_ + "','','在录入','ENTERING')", "insert");
+                            }
+                            else
+                            {
+                                ps_id = dh.getFieldDataByCondition("productsmt", "ps_id", "ps_prodcode='"+Part_+"'").ToString();
                             }
+                            sql.Clear();
+                            sql.Append("insert into productsmtlocation(PSL_ID, PSL_PSID, PSL_DETNO, PSL_PRODCODE, PSL_REPCODE, PSL_LOCATION, PSL_BASEQTY, PSL_TABLE)" +
+                                "select productsmtlocation_seq.nextval," + ps_id + ",rownum,:ReelNo,:ReelNo,:Station,BD_BASEQTY,'' from bom@ERP " +
+                                "left join bomdetail@ERP on bo_id=bd_bomid where bo_mothercode='" + Part_ + "' and BD_SONCODE=:ReelNo");
+                            dh.BatchInsert(sql.GetString(), new string[] { "ReelNo", "ReelNo", "Station", "Part", "ReelNo" },
+                                ReelNo.ToArray(), ReelNo.ToArray(), Station.ToArray(), Part.ToArray(), ReelNo.ToArray());
                             Console.WriteLine();
                         }
                     }
@@ -374,7 +384,7 @@ namespace UAS_MES_NEW.Make
                     File.Delete(PathName);
                 }
             }
-            catch (Exception ex) 
+            catch (Exception ex)
             {
                 MessageBox.Show(this.ParentForm, ex.Message, "警告");
             }
@@ -620,7 +630,7 @@ namespace UAS_MES_NEW.Make
             public string MachineName { set; get; }
 
             public string Part { set; get; }
-            public string Station {  set; get; }
+            public string Station { set; get; }
             public string ReelNo { set; get; }
         }
 
@@ -628,7 +638,7 @@ namespace UAS_MES_NEW.Make
         {
             public string Code { set; get; }
 
-            public List<string> Local{ set; get; }
+            public List<string> Local { set; get; }
         }
 
         private class PrinterData