瀏覽代碼

测试项目,SOP,日志抓取修改

callm 1 年之前
父節點
當前提交
48925b4e8b

+ 2 - 2
FileWatcher/AutoAnalysisDevice.cs

@@ -60,7 +60,7 @@ namespace FileWatcher
         /// </summary>
         List<string> _FileName = new List<string>();
 
-        string master = "WKS";
+        string master = "HUAG";
 
         ftpOperater ftp = new ftpOperater();
 
@@ -125,7 +125,7 @@ namespace FileWatcher
 
         private void ConnectDB()
         {
-            DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.253)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+            DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID="+Master+";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
             dh = new DataHelper();
         }
 

+ 1 - 1
FileWatcher/AutoAnalysisXml.Designer.cs

@@ -279,7 +279,7 @@
             this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.MaximizeBox = false;
             this.Name = "AutoAnalysisXml";
-            this.Text = "UAS自动过站解析器 2022-07-20  15:05";
+            this.Text = "UAS自动过站解析器 2024-03-04";
             this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
             this.Load += new System.EventHandler(this.Form1_Load);
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).EndInit();

+ 2 - 2
FileWatcher/AutoAnalysisXml.cs

@@ -105,7 +105,7 @@ namespace FileWatcher
             {
                 if (Master.Text == DB.Rows[i]["ma_user"].ToString())
                 {
-                    DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DGW;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+                    DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
                     dh = new DataHelper();
                 }
             }
@@ -143,7 +143,7 @@ namespace FileWatcher
             {
                 if (Master.Text == DB.Rows[i]["ma_user"].ToString())
                 {
-                    DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DGW;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+                    DataHelper.DBConnectionString = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=HUAG;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
                     dh = new DataHelper();
                     LogicHandler.dh = new DataHelper();
                 }

+ 3 - 73
FileWatcher/AutoAnalysisXmlByStep.Designer.cs

@@ -38,15 +38,10 @@
             this.ChooseFolder = new System.Windows.Forms.Button();
             this.OperateResult = new System.Windows.Forms.RichTextBox();
             this.Clean = new System.Windows.Forms.Button();
-            this.MakeCode_lable = new System.Windows.Forms.Label();
             this.label4 = new System.Windows.Forms.Label();
             this.Master = new System.Windows.Forms.ComboBox();
             this.AutoStart = new System.Windows.Forms.CheckBox();
-            this.ma_code = new System.Windows.Forms.TextBox();
-            this.BatchAnalysus = new System.Windows.Forms.Button();
             this.Timer = new System.Windows.Forms.Timer(this.components);
-            this.Device = new System.Windows.Forms.ComboBox();
-            this.label3 = new System.Windows.Forms.Label();
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             this.SuspendLayout();
             // 
@@ -85,7 +80,7 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(48, 400);
+            this.label1.Location = new System.Drawing.Point(48, 350);
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(162, 38);
@@ -95,7 +90,7 @@
             // FolderPath
             // 
             this.FolderPath.Enabled = false;
-            this.FolderPath.Location = new System.Drawing.Point(218, 400);
+            this.FolderPath.Location = new System.Drawing.Point(218, 350);
             this.FolderPath.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.FolderPath.Name = "FolderPath";
             this.FolderPath.Size = new System.Drawing.Size(436, 35);
@@ -104,7 +99,7 @@
             // ChooseFolder
             // 
             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(686, 394);
+            this.ChooseFolder.Location = new System.Drawing.Point(686, 344);
             this.ChooseFolder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.ChooseFolder.Name = "ChooseFolder";
             this.ChooseFolder.Size = new System.Drawing.Size(156, 48);
@@ -134,17 +129,6 @@
             this.Clean.UseVisualStyleBackColor = true;
             this.Clean.Click += new System.EventHandler(this.Clean_Click);
             // 
-            // MakeCode_lable
-            // 
-            this.MakeCode_lable.AutoSize = true;
-            this.MakeCode_lable.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.MakeCode_lable.Location = new System.Drawing.Point(48, 311);
-            this.MakeCode_lable.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.MakeCode_lable.Name = "MakeCode_lable";
-            this.MakeCode_lable.Size = new System.Drawing.Size(104, 38);
-            this.MakeCode_lable.TabIndex = 12;
-            this.MakeCode_lable.Text = "工单号";
-            // 
             // label4
             // 
             this.label4.AutoSize = true;
@@ -181,68 +165,19 @@
             this.AutoStart.Visible = false;
             this.AutoStart.CheckedChanged += new System.EventHandler(this.AutoStart_CheckedChanged);
             // 
-            // ma_code
-            // 
-            this.ma_code.Location = new System.Drawing.Point(218, 311);
-            this.ma_code.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
-            this.ma_code.Name = "ma_code";
-            this.ma_code.Size = new System.Drawing.Size(436, 35);
-            this.ma_code.TabIndex = 17;
-            // 
-            // BatchAnalysus
-            // 
-            this.BatchAnalysus.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.BatchAnalysus.Location = new System.Drawing.Point(686, 308);
-            this.BatchAnalysus.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
-            this.BatchAnalysus.Name = "BatchAnalysus";
-            this.BatchAnalysus.Size = new System.Drawing.Size(156, 48);
-            this.BatchAnalysus.TabIndex = 18;
-            this.BatchAnalysus.Text = "批量解析";
-            this.BatchAnalysus.UseVisualStyleBackColor = true;
-            this.BatchAnalysus.Click += new System.EventHandler(this.BatchAnalysus_Click);
-            // 
             // Timer
             // 
             this.Timer.Interval = 10000;
             this.Timer.Tick += new System.EventHandler(this.Timer_Tick);
             // 
-            // Device
-            // 
-            this.Device.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.Device.FormattingEnabled = true;
-            this.Device.Items.AddRange(new object[] {
-            "AOI设备",
-            "测试设备"});
-            this.Device.Location = new System.Drawing.Point(218, 222);
-            this.Device.Margin = new System.Windows.Forms.Padding(6);
-            this.Device.Name = "Device";
-            this.Device.Size = new System.Drawing.Size(436, 32);
-            this.Device.TabIndex = 20;
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(48, 222);
-            this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(75, 38);
-            this.label3.TabIndex = 19;
-            this.label3.Text = "工序";
-            // 
             // AutoAnalysisXmlByStep
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1443, 640);
-            this.Controls.Add(this.Device);
-            this.Controls.Add(this.label3);
-            this.Controls.Add(this.BatchAnalysus);
-            this.Controls.Add(this.ma_code);
             this.Controls.Add(this.AutoStart);
             this.Controls.Add(this.Master);
             this.Controls.Add(this.label4);
-            this.Controls.Add(this.MakeCode_lable);
             this.Controls.Add(this.Clean);
             this.Controls.Add(this.OperateResult);
             this.Controls.Add(this.ChooseFolder);
@@ -273,15 +208,10 @@
         private System.Windows.Forms.Button ChooseFolder;
         private System.Windows.Forms.RichTextBox OperateResult;
         private System.Windows.Forms.Button Clean;
-        private System.Windows.Forms.Label MakeCode_lable;
         private System.Windows.Forms.ComboBox Master;
         private System.Windows.Forms.Label label4;
         private System.Windows.Forms.CheckBox AutoStart;
-        private System.Windows.Forms.TextBox ma_code;
-        private System.Windows.Forms.Button BatchAnalysus;
         private System.Windows.Forms.Timer Timer;
-        private System.Windows.Forms.ComboBox Device;
-        private System.Windows.Forms.Label label3;
     }
 }
 

+ 31 - 47
FileWatcher/AutoAnalysisXmlByStep.cs

@@ -59,7 +59,7 @@ namespace FileWatcher
         /// </summary>
         List<string> _FileName = new List<string>();
 
-        ftpOperater ftp = new ftpOperater();
+        ftpOperater ftp;
         string imaster;
 
         public AutoAnalysisXmlByStep()
@@ -78,9 +78,11 @@ namespace FileWatcher
             imaster = iMaster;
             StartPosition = FormStartPosition.CenterScreen;
         }
-
+        string fieltype = "";
+        string ftpulr = "";
         private void Form1_Load(object sender, EventArgs e)
         {
+
             tipform.Show();
             CheckForIllegalCrossThreadCalls = false;
             FormBorderStyle = FormBorderStyle.FixedSingle;
@@ -91,6 +93,10 @@ namespace FileWatcher
             stw.StartPosition = FormStartPosition.CenterScreen;
             stw.ShowDialog();
             List<string> CacheInf = new List<string>();
+            ftpulr = dh.getFieldDataByCondition("configs", "data", "code='UploadFTP' and caller='MESSetting'").ToString();
+            fieltype = dh.getFieldDataByCondition("configs", "data", "code='UploadFile' and caller='MESSetting'").ToString();
+            string[] FTPInf = ftpulr.Split('#');
+            ftp = new ftpOperater(FTPInf[0], FTPInf[1], FTPInf[2]);
             //获取缓存信息
             try
             {
@@ -100,19 +106,6 @@ namespace FileWatcher
                 //AutoStart.Checked = (bool)BaseUtil.GetCacheData("AutoStart");
             }
             catch (Exception ex) { MessageBox.Show(ex.Message); }
-
-            //获取岗位资源相关信息
-            DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
-            if (dt.Rows.Count > 0)
-            {
-                ilinecode = dt.Rows[0]["sc_linecode"].ToString();
-                istepcode = dt.Rows[0]["sc_stepcode"].ToString();
-                ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
-            }
-            dt = (DataTable)dh.ExecuteSql("select st_name,st_code from step", "select");
-            Device.DataSource = dt;
-            Device.DisplayMember = "st_name";
-            Device.ValueMember = "st_code";
         }
 
         private void ConnectDB()
@@ -135,14 +128,9 @@ namespace FileWatcher
                     return;
                 }
             }
-            //存在工单必须是已下放状态
-            if ((!dh.CheckExist("make", "ma_code='" + ma_code.Text + "'") || ma_code.Text == ""))
-            {
-                OperateResult.AppendText("工单不存在或者未下放\n");
-                return;
-            }
+
             XmlWatcher.Path = FolderPath.Text;
-            XmlWatcher.Filter = "*.txt";
+            XmlWatcher.Filter = "*.*";
             XmlWatcher.EnableRaisingEvents = true;
             //设置缓存数据
             //BaseUtil.SetCacheData("FolderPath", FolderPath.Text);
@@ -155,7 +143,6 @@ namespace FileWatcher
             StartWatch.Enabled = false;
             ChooseFolder.Enabled = false;
             Master.Enabled = false;
-            ma_code.Enabled = false;
             StopWatch.Enabled = true;
             OperateResult.AppendText("开始执行监控\n");
         }
@@ -169,7 +156,14 @@ namespace FileWatcher
 
         private void XmlWatcher_Created(object sender, FileSystemEventArgs e)
         {
-
+            string[] str = fieltype.Split('#');
+            for (int i = 0; i < str.Length; i++)
+            {
+                if (e.FullPath.EndsWith(str[i]))
+                {
+                    TxtHandleProcess(e.FullPath);
+                }
+            }
         }
 
         private void TxtHandleProcess(string FileName)
@@ -183,24 +177,15 @@ namespace FileWatcher
                 string folderpath = FileName.Substring(0, FileName.LastIndexOf(@"\"));
                 string SN = FileName.Substring(FileName.LastIndexOf(@"\") + 1);
                 {
-                    string makecode = ma_code.Text;
-                    DataTable dt = (DataTable)dh.ExecuteSql("select sc_linecode,sc_stepcode,st_badgroupcode from source left join step on sc_stepcode=st_code where sc_code='" + isource + "'", "select");
-                    if (dt.Rows.Count > 0)
-                    {
-                        ilinecode = dt.Rows[0]["sc_linecode"].ToString();
-                        istepcode = dt.Rows[0]["sc_stepcode"].ToString();
-                        ibadgroup = dt.Rows[0]["st_badgroupcode"].ToString();
-                    }
-                    ma_code.Text = makecode;
                     try
                     {
-                        string ftppath = "/" + imaster + "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
+                        string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
                         ftp.UpLoadFile(folderpath, SN, ftppath, "");
-                        int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class,STD_RESCODE,std_stepcode)select STEPTESTDETAIL_seq.nextval,'" + SN + "','" + ma_code + "',sysdate,'http://81.71.42.91:8099/ftp/" + imaster + "/" + ftppath + SN + ".txt" + "','" + isource + "','" + Device.SelectedValue + "' from dual", "insert").ToString());
+                        int num = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class,STD_RESCODE,std_stepcode)select STEPTESTDETAIL_seq.nextval,'" + SN + "','',sysdate,'" + ftpulr.Split('#')[0] + imaster + "/" + ftppath + SN + ".txt" + "','" + isource + "','' from dual", "insert").ToString());
                         if (num > 0)
                         {
                             OperateResult.AppendText("序列号:" + SN + "上传成功\n");
-                            File.Delete(FileName);
+                            //File.Delete(FileName);
                         }
                     }
                     catch (Exception ex)
@@ -219,7 +204,6 @@ namespace FileWatcher
         {
             XmlWatcher.EnableRaisingEvents = false;
             StartWatch.Enabled = true;
-            ma_code.Enabled = true;
             Master.Enabled = true;
             ChooseFolder.Enabled = true;
 
@@ -293,20 +277,20 @@ namespace FileWatcher
 
         private void BatchAnalysus_Click(object sender, EventArgs e)
         {
-            var AllXmls = Directory.GetFiles(FolderPath.Text, "*.txt");
-            foreach (var Xml in AllXmls)
-            {
-                TxtHandleProcess(Xml);
-            }
+            //var AllXmls = Directory.GetFiles(FolderPath.Text, "*.txt");
+            //foreach (var Xml in AllXmls)
+            //{
+            //    TxtHandleProcess(Xml);
+            //}
         }
 
         private void Timer_Tick(object sender, EventArgs e)
         {
-            var AllXmls = Directory.GetFiles(FolderPath.Text, "*.*", SearchOption.AllDirectories).Where(s => s.EndsWith(".txt") || s.EndsWith(".ini"));
-            foreach (var Xml in AllXmls)
-            {
-                TxtHandleProcess(Xml);
-            }
+            //var AllXmls = Directory.GetFiles(FolderPath.Text, "*.*", SearchOption.AllDirectories).Where(s => s.EndsWith(".txt") || s.EndsWith(".ini"));
+            //foreach (var Xml in AllXmls)
+            //{
+            //    TxtHandleProcess(Xml);
+            //}
         }
     }
 }

+ 2 - 2
FileWatcher/DataHelper.cs

@@ -9,9 +9,9 @@ namespace FileWatcher
    public class DataHelper
     {
         //系统默认的的连接字符串
-        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DGW;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        private string ConnectionStrings = "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.98.0.21)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         //用户选择的数据库的连接字符串
-        public static string DBConnectionString= "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=DGW;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=81.71.42.91)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+        public static string DBConnectionString= "Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.98.0.21)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
         public static OracleConnection connection = null;
         OracleCommand command = null;
         int ReconnectTime = 0;

+ 2 - 2
FileWatcher/Form4.cs

@@ -49,11 +49,11 @@ namespace FileWatcher
             string json = "";
             string json1 = "";
             MESHelper mes = new MESHelper();
-            mes.GetMEIOrNetCodeRange(null, "354904108016523", "", out json1, out json);
+            mes.GetMEIOrNetCodeRange("204295642X000002", "", "", out json1, out json);
             //mes.GetMobileAllInfo("F45112235030001",  out json1, out json);
             //Console.WriteLine(mes.CheckRoutePassed("S558B231013033559", "IMEI-01", out json));
             //Console.WriteLine(mes.GetMEIOrNetCodeRange(null, "352977841215497", null, out json1, out json));
-
+            Console.WriteLine(json1);
             Console.WriteLine(json);
 
             //mes.CheckRoutePassed( "204295638R002314", "ZZ_01_ATI", out json);

+ 1 - 1
FileWatcher/Login.cs

@@ -18,7 +18,7 @@ namespace FileWatcher
         private void CheckLogin_Click(object sender, EventArgs e)
         {
             string ErrMessage = "";
-            DataHelper.DBConnectionString = "Password=select!#%*(;User ID=" + Master.Text + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.253)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+            DataHelper.DBConnectionString = "Password=select!#%*(;User ID=" + Master.Text + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.98.0.21)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
             //重新执行一遍构造函数使得重置之后的链接字符串生效
             dh = new DataHelper();
             AutoAnalysisXmlByStep.dh = dh;

+ 1 - 1
FileWatcher/Program.cs

@@ -45,7 +45,7 @@ namespace FileWatcher
                 Application.EnableVisualStyles();
                 Application.SetCompatibleTextRenderingDefault(false);
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
-                    Application.Run(new AutoAnalysisXml());
+                    Application.Run(new Form4());
                 else
                 {
                     //创建启动对象

+ 6 - 6
FileWatcher/SOP.cs

@@ -37,10 +37,10 @@ namespace FileWatcher
         {
             pr_code.Text = FilePath.Text.Substring(FilePath.Text.LastIndexOf(@"\") + 1).Replace(".xls", "").Replace(".xlsx", "");
             pr_code_Leave(new object(), new EventArgs());
-            DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where instr('" + pr_code.Text + "',ps_prodcode)>0 ", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + pr_code.Text + "' ", "select");
             if (dt.Rows.Count == 0)
             {
-                DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_code from product where instr('" + pr_code.Text + "',pr_code)>0", "select");
+                DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_code from product where pr_code='" + pr_code.Text + "'", "select");
                 if (dt1.Rows.Count > 0)
                 {
                     string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
@@ -92,8 +92,8 @@ namespace FileWatcher
                 {
                     Directory.CreateDirectory(Application.StartupPath + @"\" + pr_code.Text);
                 }
-                sheet.Pictures.Add(0, 18, @"图片\电子受控章.png");
-                sheet.Pictures.Add(0, 15, @"图片\签名.png");
+                //sheet.Pictures.Add(0, 18, @"图片\电子受控章.png");
+                //sheet.Pictures.Add(0, 15, @"图片\签名.png");
                 sheet.PageSetup.LeftMargin = 0;
                 sheet.PageSetup.RightMargin = 0;
                 sheet.PageSetup.BottomMargin = 0;
@@ -110,7 +110,7 @@ namespace FileWatcher
                 dic.Add("em_code", "ADMIN");
                 dic.Add("caller", "ProductSOP");
                 OperatResult.AppendText("上传文件【" + sheet.Name + ".jpg" + "】\n");
-                string fp_id = UploadFilesToRemoteUrl("http://192.168.101.253:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg", dic);
+                string fp_id = UploadFilesToRemoteUrl("http://10.98.0.21:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg", dic);
                 if (fp_id != "")
                 {
                     dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
@@ -343,7 +343,7 @@ namespace FileWatcher
 
         private void LoadPrCode()
         {
-            DataTable dt = (DataTable)dh.ExecuteSql("select pr_code,pr_spec,pr_detail from product where instr('" + pr_code.Text + "',pr_code)>0", "select");
+            DataTable dt = (DataTable)dh.ExecuteSql("select pr_code,pr_spec,pr_detail from product where pr_code='" + pr_code.Text + "'", "select");
             if (dt.Rows.Count > 0)
             {
                 pr_spec.Clear();

+ 13 - 0
FileWatcher/ftpOperater.cs

@@ -33,6 +33,19 @@ namespace FileWatcher
             //status = BaseUtil.connectState(FTPInf);
         }
 
+        public ftpOperater(string IP,string user,string password)
+        {
+        
+            this.ftpServerIP = IP;
+            this.ftpUser = user;
+            this.ftpPwd = password;
+            //string FTPInf = Properties.Settings.Default.Properties["FTPAddress"].DefaultValue.ToString();
+
+            //连接共享文件夹
+            //status = BaseUtil.connectState(FTPInf);
+        }
+
+
         #region
         public void UpLoadFile(string filepath, string filename, string UploadFolder,string BackUp)
         {