Browse Source

优化扣料逻辑

callm 4 days ago
parent
commit
817b58ae30

+ 1 - 0
FileWatcher/AutoSMTRXY.Designer.cs

@@ -246,6 +246,7 @@
             0,
             0,
             0});
+            this.pr_pcbacount.ValueChanged += new System.EventHandler(this.pr_pcbacount_ValueChanged);
             // 
             // label7
             // 

+ 8 - 1
FileWatcher/AutoSMTRXY.cs

@@ -234,7 +234,8 @@ namespace FileWatcher
                     " from devsmtlocation left  join    (select DSL_LINECODE alllincode,Dsl_Location allLocation, " +
                     " sum(dsl_madeqty)allmadeqty from devsmtlocation    group by  DSL_LINECODE,Dsl_Location)A on  " +
                     " alllincode=devsmtlocation.dsl_linecode and allLocation=dsl_location left join barcode  " +
-                    " on dsl_barcode = bar_code where  dsl_status=0 and dsl_usable=1 and dsl_linecode='" + li_code.Text + "')  ");
+                    " on dsl_barcode = bar_code where  dsl_status=0 and dsl_usable=1 and dsl_linecode='" + li_code.Text + "' and DSL_GETQTY*0.1>dsl_remainqty)" +
+                    " ");
                 System.Data.DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
                 for (int i = 0; i < dt.Rows.Count; i++)
                 {
@@ -399,6 +400,7 @@ namespace FileWatcher
             {
                 return;
             }
+            dh.ExecuteSql("update product set pr_pcbacount='" + pr_pcbacount.Value + "' where pr_code=(select ma_prodcode from make where ma_code='" + ma_code.Text + "')", "update");
             //设置按钮不可点击
             StartWatch.Enabled = false;
             ma_code.Enabled = false;
@@ -765,5 +767,10 @@ namespace FileWatcher
                 OperateResult.AppendText("写入失败,未维护参数\n");
             }
         }
+
+        private void pr_pcbacount_ValueChanged(object sender, EventArgs e)
+        {
+            dh.ExecuteSql("update product set pr_pcbacount='"+pr_pcbacount.Value+"' where pr_code=(select ma_prodcode from make where ma_code='"+ma_code.Text+"')", "update");
+        }
     }
 }

+ 0 - 36
FileWatcher/FileWatcher.csproj

@@ -188,12 +188,6 @@
     <Compile Include="RichTextAutoBottom.Designer.cs">
       <DependentUpon>RichTextAutoBottom.cs</DependentUpon>
     </Compile>
-    <Compile Include="SOP_PNE.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="SOP_PNE.Designer.cs">
-      <DependentUpon>SOP_PNE.cs</DependentUpon>
-    </Compile>
     <Compile Include="UploadMakePlan.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -310,12 +304,6 @@
     <Compile Include="SerialPortCombox.Designer.cs">
       <DependentUpon>SerialPortCombox.cs</DependentUpon>
     </Compile>
-    <Compile Include="SOP.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="SOP.Designer.cs">
-      <DependentUpon>SOP.cs</DependentUpon>
-    </Compile>
     <Compile Include="ftpOperater.cs" />
     <Compile Include="LoadingCircle.cs">
       <SubType>Component</SubType>
@@ -338,12 +326,6 @@
     </Compile>
     <Compile Include="SystemInf.cs" />
     <Compile Include="TcpServer.cs" />
-    <Compile Include="测试记录解析.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="测试记录解析.Designer.cs">
-      <DependentUpon>测试记录解析.cs</DependentUpon>
-    </Compile>
     <Compile Include="Form1.cs">
       <SubType>Form</SubType>
     </Compile>
@@ -352,12 +334,6 @@
     </Compile>
     <Compile Include="Program.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="首件仪上传.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="首件仪上传.Designer.cs">
-      <DependentUpon>首件仪上传.cs</DependentUpon>
-    </Compile>
     <EmbeddedResource Include="AutoAnalysisDeviceKS.resx">
       <DependentUpon>AutoAnalysisDeviceKS.cs</DependentUpon>
     </EmbeddedResource>
@@ -367,9 +343,6 @@
     <EmbeddedResource Include="AutoSMTRXYSetting.resx">
       <DependentUpon>AutoSMTRXYSetting.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="SOP_PNE.resx">
-      <DependentUpon>SOP_PNE.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="UploadMakePlan.resx">
       <DependentUpon>UploadMakePlan.cs</DependentUpon>
     </EmbeddedResource>
@@ -428,18 +401,12 @@
     <EmbeddedResource Include="SerialPortCombox.resx">
       <DependentUpon>SerialPortCombox.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="SOP.resx">
-      <DependentUpon>SOP.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="Login.resx">
       <DependentUpon>Login.cs</DependentUpon>
     </EmbeddedResource>
     <EmbeddedResource Include="SetLoadingWindow.resx">
       <DependentUpon>SetLoadingWindow.cs</DependentUpon>
     </EmbeddedResource>
-    <EmbeddedResource Include="测试记录解析.resx">
-      <DependentUpon>测试记录解析.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="Form1.resx">
       <DependentUpon>Form1.cs</DependentUpon>
     </EmbeddedResource>
@@ -453,9 +420,6 @@
       <DependentUpon>Resources.resx</DependentUpon>
       <DesignTime>True</DesignTime>
     </Compile>
-    <EmbeddedResource Include="首件仪上传.resx">
-      <DependentUpon>首件仪上传.cs</DependentUpon>
-    </EmbeddedResource>
     <None Include="app.config" />
     <None Include="packages.config" />
     <None Include="Properties\Settings.settings">

+ 0 - 247
FileWatcher/SOP.Designer.cs

@@ -1,247 +0,0 @@
-namespace FileWatcher
-{
-    partial class SOP
-    {
-        /// <summary>
-        /// Required designer variable.
-        /// </summary>
-        private System.ComponentModel.IContainer components = null;
-
-        /// <summary>
-        /// Clean up any resources being used.
-        /// </summary>
-        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        #region Windows Form Designer generated code
-
-        /// <summary>
-        /// Required method for Designer support - do not modify
-        /// the contents of this method with the code editor.
-        /// </summary>
-        private void InitializeComponent()
-        {
-            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
-            this.ChoosePath = new System.Windows.Forms.OpenFileDialog();
-            this.label1 = new System.Windows.Forms.Label();
-            this.FilePath = new System.Windows.Forms.TextBox();
-            this.ChooseFile = new System.Windows.Forms.Button();
-            this.UploadSOP = new System.Windows.Forms.Button();
-            this.pr_code = new System.Windows.Forms.TextBox();
-            this.label2 = new System.Windows.Forms.Label();
-            this.OperatResult = new System.Windows.Forms.RichTextBox();
-            this.SendSop = new System.Windows.Forms.Button();
-            this.label3 = new System.Windows.Forms.Label();
-            this.label4 = new System.Windows.Forms.Label();
-            this.pr_detail = new System.Windows.Forms.Label();
-            this.JPG = new System.Windows.Forms.RadioButton();
-            this.PDF = new System.Windows.Forms.RadioButton();
-            this.pr_spec = new System.Windows.Forms.RichTextBox();
-            this.SuspendLayout();
-            // 
-            // richTextBox1
-            // 
-            this.richTextBox1.Location = new System.Drawing.Point(-43, -88);
-            this.richTextBox1.Name = "richTextBox1";
-            this.richTextBox1.Size = new System.Drawing.Size(100, 96);
-            this.richTextBox1.TabIndex = 5;
-            this.richTextBox1.Text = "";
-            // 
-            // ChoosePath
-            // 
-            this.ChoosePath.FileName = "ChoosePath";
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label1.Location = new System.Drawing.Point(19, 448);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(146, 41);
-            this.label1.TabIndex = 6;
-            this.label1.Text = "SOP文件";
-            // 
-            // FilePath
-            // 
-            this.FilePath.Enabled = false;
-            this.FilePath.Location = new System.Drawing.Point(218, 453);
-            this.FilePath.Name = "FilePath";
-            this.FilePath.Size = new System.Drawing.Size(582, 35);
-            this.FilePath.TabIndex = 7;
-            // 
-            // ChooseFile
-            // 
-            this.ChooseFile.Location = new System.Drawing.Point(218, 611);
-            this.ChooseFile.Name = "ChooseFile";
-            this.ChooseFile.Size = new System.Drawing.Size(160, 42);
-            this.ChooseFile.TabIndex = 8;
-            this.ChooseFile.Text = "选择文件";
-            this.ChooseFile.UseVisualStyleBackColor = true;
-            this.ChooseFile.Click += new System.EventHandler(this.ChooseFile_Click);
-            // 
-            // UploadSOP
-            // 
-            this.UploadSOP.Location = new System.Drawing.Point(424, 611);
-            this.UploadSOP.Name = "UploadSOP";
-            this.UploadSOP.Size = new System.Drawing.Size(160, 42);
-            this.UploadSOP.TabIndex = 9;
-            this.UploadSOP.Text = "上传文件";
-            this.UploadSOP.UseVisualStyleBackColor = true;
-            this.UploadSOP.Click += new System.EventHandler(this.UploadSOP_Click);
-            // 
-            // pr_code
-            // 
-            this.pr_code.Location = new System.Drawing.Point(218, 152);
-            this.pr_code.Name = "pr_code";
-            this.pr_code.Size = new System.Drawing.Size(582, 35);
-            this.pr_code.TabIndex = 11;
-            this.pr_code.KeyDown += new System.Windows.Forms.KeyEventHandler(this.pr_code_KeyDown);
-            this.pr_code.Leave += new System.EventHandler(this.pr_code_Leave);
-            // 
-            // label2
-            // 
-            this.label2.AutoSize = true;
-            this.label2.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label2.Location = new System.Drawing.Point(19, 147);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(146, 41);
-            this.label2.TabIndex = 10;
-            this.label2.Text = "产品编号";
-            // 
-            // OperatResult
-            // 
-            this.OperatResult.Location = new System.Drawing.Point(823, 32);
-            this.OperatResult.Name = "OperatResult";
-            this.OperatResult.Size = new System.Drawing.Size(1110, 874);
-            this.OperatResult.TabIndex = 12;
-            this.OperatResult.Text = "";
-            this.OperatResult.TextChanged += new System.EventHandler(this.OperatResult_TextChanged);
-            // 
-            // SendSop
-            // 
-            this.SendSop.Location = new System.Drawing.Point(640, 611);
-            this.SendSop.Name = "SendSop";
-            this.SendSop.Size = new System.Drawing.Size(160, 42);
-            this.SendSop.TabIndex = 13;
-            this.SendSop.Text = "广播SOP";
-            this.SendSop.UseVisualStyleBackColor = true;
-            this.SendSop.Click += new System.EventHandler(this.SendSop_Click);
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label3.Location = new System.Drawing.Point(19, 240);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(146, 41);
-            this.label3.TabIndex = 14;
-            this.label3.Text = "产品名称";
-            // 
-            // label4
-            // 
-            this.label4.AutoSize = true;
-            this.label4.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label4.Location = new System.Drawing.Point(19, 333);
-            this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(146, 41);
-            this.label4.TabIndex = 15;
-            this.label4.Text = "产品规格";
-            // 
-            // pr_detail
-            // 
-            this.pr_detail.AutoSize = true;
-            this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.pr_detail.Location = new System.Drawing.Point(211, 240);
-            this.pr_detail.Name = "pr_detail";
-            this.pr_detail.Size = new System.Drawing.Size(0, 41);
-            this.pr_detail.TabIndex = 16;
-            // 
-            // JPG
-            // 
-            this.JPG.AutoSize = true;
-            this.JPG.Checked = true;
-            this.JPG.Location = new System.Drawing.Point(251, 534);
-            this.JPG.Name = "JPG";
-            this.JPG.Size = new System.Drawing.Size(89, 28);
-            this.JPG.TabIndex = 18;
-            this.JPG.TabStop = true;
-            this.JPG.Text = "图片";
-            this.JPG.UseVisualStyleBackColor = true;
-            // 
-            // PDF
-            // 
-            this.PDF.AutoSize = true;
-            this.PDF.Location = new System.Drawing.Point(382, 534);
-            this.PDF.Name = "PDF";
-            this.PDF.Size = new System.Drawing.Size(77, 28);
-            this.PDF.TabIndex = 18;
-            this.PDF.TabStop = true;
-            this.PDF.Text = "PDF";
-            this.PDF.UseVisualStyleBackColor = true;
-            // 
-            // pr_spec
-            // 
-            this.pr_spec.Enabled = false;
-            this.pr_spec.Location = new System.Drawing.Point(218, 341);
-            this.pr_spec.Name = "pr_spec";
-            this.pr_spec.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
-            this.pr_spec.Size = new System.Drawing.Size(580, 94);
-            this.pr_spec.TabIndex = 19;
-            this.pr_spec.Text = "";
-            // 
-            // SOP
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1945, 934);
-            this.Controls.Add(this.pr_spec);
-            this.Controls.Add(this.PDF);
-            this.Controls.Add(this.JPG);
-            this.Controls.Add(this.pr_detail);
-            this.Controls.Add(this.label4);
-            this.Controls.Add(this.label3);
-            this.Controls.Add(this.SendSop);
-            this.Controls.Add(this.OperatResult);
-            this.Controls.Add(this.pr_code);
-            this.Controls.Add(this.label2);
-            this.Controls.Add(this.UploadSOP);
-            this.Controls.Add(this.ChooseFile);
-            this.Controls.Add(this.FilePath);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.richTextBox1);
-            this.MaximizeBox = false;
-            this.Name = "SOP";
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "SOP管理";
-            this.Load += new System.EventHandler(this.Form3_Load);
-            this.ResumeLayout(false);
-            this.PerformLayout();
-
-        }
-
-        #endregion
-        private System.Windows.Forms.RichTextBox richTextBox1;
-        private System.Windows.Forms.OpenFileDialog ChoosePath;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.TextBox FilePath;
-        private System.Windows.Forms.Button ChooseFile;
-        private System.Windows.Forms.Button UploadSOP;
-        private System.Windows.Forms.TextBox pr_code;
-        private System.Windows.Forms.Label label2;
-        private System.Windows.Forms.RichTextBox OperatResult;
-        private System.Windows.Forms.Button SendSop;
-        private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.Label label4;
-        private System.Windows.Forms.Label pr_detail;
-        private System.Windows.Forms.RadioButton JPG;
-        private System.Windows.Forms.RadioButton PDF;
-        private System.Windows.Forms.RichTextBox pr_spec;
-    }
-}

+ 0 - 408
FileWatcher/SOP.cs

@@ -1,408 +0,0 @@
-using System;
-using System.IO;
-using System.Text;
-using System.Windows.Forms;
-using Spire.Xls;
-using System.Net;
-using System.Collections.Generic;
-using System.Threading;
-using System.Net.Sockets;
-using System.Data;
-using System.Web.Script.Serialization;
-
-namespace FileWatcher
-{
-    public partial class SOP : Form
-    {
-        DataHelper dh = new DataHelper();
-
-        string usercode;
-        string sourcecode;
-
-        public SOP(string iUserCode, string iSource)
-        {
-            usercode = iUserCode;
-            sourcecode = iSource;
-            InitializeComponent();
-        }
-
-        private void Form3_Load(object sender, EventArgs e)
-        {
-            CheckForIllegalCrossThreadCalls = false;
-        }
-
-        void uploadfile()
-        {
-            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");
-            if (dt.Rows.Count == 0)
-            {
-                DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_code from product where instr('" + pr_code.Text + "',pr_code)>0", "select");
-                if (dt1.Rows.Count > 0)
-                {
-                    string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
-                    pr_code.Text = dt1.Rows[0]["pr_code"].ToString();
-                    dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman)values(productsop_seq.nextval,'" + code + "','" + pr_code.Text + "',sysdate,'" + usercode + "')", "insert");
-                }
-                else
-                {
-                    MessageBox.Show("产品编号" + pr_code.Text + "不存在");
-                    return;
-                }
-            }
-            else
-            {
-                pr_code.Text = dt.Rows[0]["ps_prodcode"].ToString();
-            }
-            Workbook workbook = new Workbook();
-            workbook.LoadFromFile(FilePath.Text);
-            workbook.ConverterSetting.JPEGQuality = 100;
-            workbook.ConverterSetting.XDpi = 600;
-            workbook.ConverterSetting.YDpi = 600;
-            List<Worksheet> list = new List<Worksheet>();
-            List<string> filename = new List<string>();
-            dh.ExecuteSql("update ProductSOP set ps_attachsop='' where ps_prodcode='" + pr_code.Text + "'", "update");
-            OperatResult.AppendText("一共Sheet: " + workbook.Worksheets.Count + "\n");
-            try
-            {
-                for (int i = 0; i < workbook.Worksheets.Count; i++)
-                {
-                    for (int k = 0; k < workbook.Worksheets[i].TextBoxes.Count; k++)
-                    {
-                        if (workbook.Worksheets[i].TextBoxes[k].RichText.Text.Length > 1)
-                        {
-                            //OperatResult.AppendText(workbook.Worksheets[i].TextBoxes[k].ID + " " + workbook.Worksheets[i].TextBoxes[k].Name + " " + workbook.Worksheets[i].TextBoxes[k].RichText.GetFont(0).FontName + " " + workbook.Worksheets[i].TextBoxes[k].RichText.GetFont(0).Size);
-                            workbook.Worksheets[i].TextBoxes[k].RichText.Text = workbook.Worksheets[i].TextBoxes[k].RichText.Text;
-                            workbook.Worksheets[i].TextBoxes[k].Width = workbook.Worksheets[i].TextBoxes[k].Width * 2;
-                            workbook.Worksheets[i].TextBoxes[k].Height = workbook.Worksheets[i].TextBoxes[k].Height * 2;
-                            workbook.Worksheets[i].TextBoxes[k].HAlignment = CommentHAlignType.Center;
-                        }
-                    }
-                    Workbook bw = new Workbook();
-                    Worksheet she = bw.CreateEmptySheet();
-                    she.Name = workbook.Worksheets[i].Name;
-                    she.CopyFrom(workbook.Worksheets[i]);
-                    if (JPG.Checked)
-                    {
-                        var myThread = new Thread(() => SaveFileToJPG(she));
-                        myThread.Start();
-                        filename.Add(she.Name + ".jpg");
-                    }
-                    else
-                    {
-                        var myThread = new Thread(() => SaveFileToPDF(she));
-                        myThread.Start();
-                        filename.Add(she.Name + ".pdf");
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                OperatResult.AppendText(ex.Message + "\n");
-            }
-        }
-
-        private void SaveFileToPDF(Worksheet sheet)
-        {
-            if (!Directory.Exists(Application.StartupPath + @"\" + pr_code.Text))
-            {
-                Directory.CreateDirectory(Application.StartupPath + @"\" + pr_code.Text);
-            }
-            sheet.SaveToPdf(Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".pdf");
-            OperatResult.AppendText("解析PDF【" + sheet.Name + ".pdf】" + "\n");
-            Dictionary<string, object> dic = new Dictionary<string, object>();
-            dic.Add("em_name", "管理员");
-            dic.Add("em_code", "ADMIN");
-            dic.Add("caller", "ProductSOP");
-            OperatResult.AppendText("上传文件【" + sheet.Name + ".pdf" + "】\n");
-            string fp_id = UploadFilesToRemoteUrl("http://192.168.101.253:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".pdf", dic);
-            if (fp_id != "")
-            {
-                dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
-            }
-        }
-
-        private void SaveFileToJPG(Worksheet sheet)
-        {
-            try
-            {
-                if (!Directory.Exists(Application.StartupPath + @"\" + pr_code.Text))
-                {
-                    Directory.CreateDirectory(Application.StartupPath + @"\" + pr_code.Text);
-                }
-                ExcelPicture picture = sheet.Pictures.Add(@"图片\电子受控章.png");
-                picture.Width = 113;
-                picture.Height = 38;
-                picture.LeftColumn = 20;
-                picture.TopRowOffset = 20;
-                ExcelPicture picture1 = sheet.Pictures.Add(@"图片\签名.png");
-                picture1.Width = 100;
-                picture1.Height = 38;
-                picture1.LeftColumn = 15;
-                picture1.TopRowOffset = 600;
-                sheet.SaveToImage(Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg");
-                OperatResult.AppendText("解析图片【" + sheet.Name + ".jpg】" + "\n");
-                Dictionary<string, object> dic = new Dictionary<string, object>();
-                dic.Add("em_name", "管理员");
-                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);
-                if (fp_id != "")
-                {
-                    dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
-                }
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine(ex.Message);
-            }
-        }
-
-        /// <summary>
-        /// 请求上传图片到阿里云
-        /// </summary>
-        /// <param name="url">上传地址</param>
-        /// <param name="filepath">本地文件路径</param>
-        /// <param name="dic">上传的数据信息</param>
-        /// <returns></returns>
-        public string UploadFilesToRemoteUrl(string url1, string filepath, Dictionary<string, object> dic)
-        {
-            try
-            {
-                ServicePointManager.DefaultConnectionLimit = 50;
-
-                string boundary = DateTime.Now.Ticks.ToString("x");
-
-                byte[] boundarybytes = System.Text.Encoding.UTF8.GetBytes("--" + boundary + "\r\n");
-
-                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url1);
-                request.Method = "POST";
-                request.Timeout = 10 * 10000;
-                request.ContentType = "multipart/form-data; boundary=" + boundary;
-
-                Stream rs = request.GetRequestStream();
-
-                var endBoundaryBytes = Encoding.UTF8.GetBytes("--" + boundary + "--\r\n");
-
-                string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n" + "\r\n" + "{1}" + "\r\n";
-                if (dic != null)
-                {
-                    foreach (string key in dic.Keys)
-                    {
-                        rs.Write(boundarybytes, 0, boundarybytes.Length);
-
-                        string formitem = string.Format(formdataTemplate, key, dic[key]);
-
-                        byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
-
-                        rs.Write(formitembytes, 0, formitembytes.Length);
-                    }
-
-                }
-
-                string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n\r\n";
-                {
-                    rs.Write(boundarybytes, 0, boundarybytes.Length);
-
-                    var header = string.Format(headerTemplate, "file", Path.GetFileName(filepath));
-
-                    var headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
-
-                    rs.Write(headerbytes, 0, headerbytes.Length);
-
-                    using (var fileStream = new FileStream(filepath, FileMode.Open, FileAccess.Read))
-                    {
-                        var buffer = new byte[1024];
-
-                        var bytesRead = 0;
-
-                        while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
-                        {
-                            rs.Write(buffer, 0, bytesRead);
-                        }
-                    }
-                    var cr = Encoding.UTF8.GetBytes("\r\n");
-
-                    rs.Write(cr, 0, cr.Length);
-                }
-
-                rs.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
-
-                var response = request.GetResponse() as HttpWebResponse;
-
-                StreamReader newReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
-                string Content = newReader.ReadToEnd();
-                Dictionary<string, object> dic1 = new Dictionary<string, object>();
-                List<Dictionary<string, object>> dic2 = null;
-                dic1 = BaseUtil.ToDictionary(Content);
-                dic2 = dic1["data"] as List<Dictionary<string, object>>;
-                string fp_id = "";
-                if (dic2[0]["filepath"] != null)
-                {
-                    fp_id = dic2[0]["filepath"].ToString();
-                }
-                if (response.StatusCode == HttpStatusCode.OK)
-                {
-                    return fp_id;
-                }
-            }
-            catch (Exception e)
-            {
-                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP", "上传失败", pr_code.Text, "");
-                Console.WriteLine(e.Message + e.StackTrace);
-            }
-            return "";
-        }
-
-        private void ChooseFile_Click(object sender, EventArgs e)
-        {
-            ChoosePath.Filter = "(*.xls)|*.xls|(*.xlsx)|*.xlsx";
-            DialogResult result = ChoosePath.ShowDialog();
-            if (result == DialogResult.OK)
-            {
-                FilePath.Text = ChoosePath.FileName;
-            }
-        }
-
-        private void UploadSOP_Click(object sender, EventArgs e)
-        {
-            Thread thread = new Thread(uploadfile);
-            SetLoadingWindow stw = new SetLoadingWindow(thread, "上传文件");
-            stw.StartPosition = FormStartPosition.CenterScreen;
-            stw.ShowDialog();
-            if (JPG.Checked)
-            {
-                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【图片格式】", "上传成功", pr_code.Text, "");
-            }
-            else
-            {
-                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【PDF格式】", "上传成功", pr_code.Text, "");
-            }
-        }
-
-        private void OperatResult_TextChanged(object sender, EventArgs e)
-        {
-            //OperatResult.SelectionStart = Text.Length;
-            OperatResult.ScrollToCaret();
-        }
-
-        TcpServer tcpserver = new TcpServer();
-
-        private void SendSop_Click(object sender, EventArgs e)
-        {
-            try
-            {
-                IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
-                string IPAddress = "";
-                for (int i = 0; i < IpEntry.AddressList.Length; i++)
-                {
-                    if (IpEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
-                    {
-                        IPAddress = IpEntry.AddressList[i].ToString();
-                    }
-                }
-                dh.ExecuteSql("update SOPSOURCE set SS_BRDIP='" + IPAddress + "'", "update");
-                DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + pr_code.Text + "'", "select");
-                if (dt.Rows.Count > 0)
-                {
-                    tcpserver.Start();
-                    Thread.Sleep(5000);
-                    List<Dictionary<string, string>> listr = new List<Dictionary<string, string>>();
-                    string PS_ATTACHSOP = dt.Rows[0]["PS_ATTACHSOP"].ToString();
-                    PS_ATTACHSOP = PS_ATTACHSOP.Substring(0, PS_ATTACHSOP.Length - 1).Replace(";", ",");
-                    dt = (DataTable)dh.ExecuteSql("select fp_path, fp_name from filepath where fp_id in (" + PS_ATTACHSOP + ") and nvl(fp_path, ' ') <> ' '", "select");
-                    JavaScriptSerializer jss = new JavaScriptSerializer();
-                    Dictionary<string, object> map1 = new Dictionary<string, object>();
-                    Dictionary<string, object> map = new Dictionary<string, object>();
-                    string path;
-                    string pathroot = dh.GetConfig("filePathUrl", "sys").ToString();
-                    for (int i = 0; i < dt.Rows.Count; i++)
-                    {
-                        Dictionary<string, string> dic1 = new Dictionary<string, string>();
-                        path = dt.Rows[i]["fp_path"].ToString();
-                        path = encryptBASE64(path.Replace("/app/uas/webapps/postattach", pathroot)).Replace("\\s*|\r|\n|\t", "");
-                        dic1.Add("path", path);
-                        dic1.Add("filename", dt.Rows[i]["fp_name"].ToString().Replace(" ", "").Replace("(", "").Replace(")", ""));
-                        dic1.Add("ps_prodcode", pr_code.Text);
-                        listr.Add(dic1);
-                    }
-                    map1.Add("ps_code", "");
-                    map1.Add("url", listr);
-                    map.Add("success", true);
-                    map.Add("data", map1);
-                    tcpserver.Send(jss.Serialize(map));
-                    tcpserver.Stop();
-                    LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播成功", pr_code.Text, "");
-                    MessageBox.Show("产品编号" + pr_code.Text + "广播成功");
-                }
-                else
-                {
-                    MessageBox.Show("产品编号" + pr_code.Text + "未维护SOP文档");
-                    LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败,未维护SOP文档", pr_code.Text, "");
-                }
-            }
-            catch (Exception ex)
-            {
-                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败", pr_code.Text, "");
-                Console.WriteLine(ex.Message + ex.StackTrace);
-            }
-        }
-
-        public string encryptBASE64(string key)
-        {
-            byte[] bytes = Encoding.Default.GetBytes(key);
-            return Convert.ToBase64String(bytes);
-        }
-
-        public static string EncodeBase64(string code_type, string code)
-        {
-            string encode = "";
-            byte[] bytes = Encoding.GetEncoding(code_type).GetBytes(code);
-            try
-            {
-                encode = Convert.ToBase64String(bytes);
-            }
-            catch
-            {
-                encode = code;
-            }
-            return encode;
-        }
-
-        private void pr_code_KeyDown(object sender, KeyEventArgs e)
-        {
-            if (e.KeyCode == Keys.Enter)
-            {
-                LoadPrCode();
-            }
-        }
-
-        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");
-            if (dt.Rows.Count > 0)
-            {
-                pr_spec.Clear();
-                pr_spec.AppendText(dt.Rows[0]["pr_spec"].ToString());
-                pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
-                pr_code.Text = dt.Rows[0]["pr_code"].ToString();
-            }
-            else
-            {
-                MessageBox.Show("产品编号" + pr_code.Text + "不存在");
-            }
-        }
-
-        private void pr_code_Leave(object sender, EventArgs e)
-        {
-            LoadPrCode();
-        }
-
-        private void pr_spec_Click(object sender, EventArgs e)
-        {
-
-        }
-    }
-}

+ 0 - 138
FileWatcher/SOP.resx

@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-  <!-- 
-    Microsoft ResX Schema 
-    
-    Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
-    associated with the data types.
-    
-    Example:
-    
-    ... ado.net/XML headers & schema ...
-    <resheader name="resmimetype">text/microsoft-resx</resheader>
-    <resheader name="version">2.0</resheader>
-    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
-    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
-    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
-    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
-    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
-        <value>[base64 mime encoded serialized .NET Framework object]</value>
-    </data>
-    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
-        <comment>This is a comment</comment>
-    </data>
-                
-    There are any number of "resheader" rows that contain simple 
-    name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
-    mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
-    extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
-    read any of the formats listed below.
-    
-    mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
-            : and then encoded with base64 encoding.
-    
-    mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
-            : and then encoded with base64 encoding.
-
-    mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
-            : using a System.ComponentModel.TypeConverter
-            : and then encoded with base64 encoding.
-    -->
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" use="required" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <metadata name="ChoosePath.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
-  <metadata name="CheckColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="fp_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="fp_path.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="psd_iskey.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="issend.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-</root>

+ 0 - 247
FileWatcher/SOP_PNE.Designer.cs

@@ -1,247 +0,0 @@
-namespace FileWatcher
-{
-    partial class SOP_PNE
-    {
-        /// <summary>
-        /// Required designer variable.
-        /// </summary>
-        private System.ComponentModel.IContainer components = null;
-
-        /// <summary>
-        /// Clean up any resources being used.
-        /// </summary>
-        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        #region Windows Form Designer generated code
-
-        /// <summary>
-        /// Required method for Designer support - do not modify
-        /// the contents of this method with the code editor.
-        /// </summary>
-        private void InitializeComponent()
-        {
-            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
-            this.ChoosePath = new System.Windows.Forms.OpenFileDialog();
-            this.label1 = new System.Windows.Forms.Label();
-            this.FilePath = new System.Windows.Forms.TextBox();
-            this.ChooseFile = new System.Windows.Forms.Button();
-            this.UploadSOP = new System.Windows.Forms.Button();
-            this.pr_code = new System.Windows.Forms.TextBox();
-            this.label2 = new System.Windows.Forms.Label();
-            this.OperatResult = new System.Windows.Forms.RichTextBox();
-            this.SendSop = new System.Windows.Forms.Button();
-            this.label3 = new System.Windows.Forms.Label();
-            this.label4 = new System.Windows.Forms.Label();
-            this.pr_detail = new System.Windows.Forms.Label();
-            this.JPG = new System.Windows.Forms.RadioButton();
-            this.PDF = new System.Windows.Forms.RadioButton();
-            this.pr_spec = new System.Windows.Forms.RichTextBox();
-            this.SuspendLayout();
-            // 
-            // richTextBox1
-            // 
-            this.richTextBox1.Location = new System.Drawing.Point(-43, -88);
-            this.richTextBox1.Name = "richTextBox1";
-            this.richTextBox1.Size = new System.Drawing.Size(100, 96);
-            this.richTextBox1.TabIndex = 5;
-            this.richTextBox1.Text = "";
-            // 
-            // ChoosePath
-            // 
-            this.ChoosePath.FileName = "ChoosePath";
-            // 
-            // label1
-            // 
-            this.label1.AutoSize = true;
-            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label1.Location = new System.Drawing.Point(19, 448);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(146, 41);
-            this.label1.TabIndex = 6;
-            this.label1.Text = "SOP文件";
-            // 
-            // FilePath
-            // 
-            this.FilePath.Enabled = false;
-            this.FilePath.Location = new System.Drawing.Point(218, 453);
-            this.FilePath.Name = "FilePath";
-            this.FilePath.Size = new System.Drawing.Size(582, 35);
-            this.FilePath.TabIndex = 7;
-            // 
-            // ChooseFile
-            // 
-            this.ChooseFile.Location = new System.Drawing.Point(218, 611);
-            this.ChooseFile.Name = "ChooseFile";
-            this.ChooseFile.Size = new System.Drawing.Size(160, 42);
-            this.ChooseFile.TabIndex = 8;
-            this.ChooseFile.Text = "选择文件";
-            this.ChooseFile.UseVisualStyleBackColor = true;
-            this.ChooseFile.Click += new System.EventHandler(this.ChooseFile_Click);
-            // 
-            // UploadSOP
-            // 
-            this.UploadSOP.Location = new System.Drawing.Point(424, 611);
-            this.UploadSOP.Name = "UploadSOP";
-            this.UploadSOP.Size = new System.Drawing.Size(160, 42);
-            this.UploadSOP.TabIndex = 9;
-            this.UploadSOP.Text = "上传文件";
-            this.UploadSOP.UseVisualStyleBackColor = true;
-            this.UploadSOP.Click += new System.EventHandler(this.UploadSOP_Click);
-            // 
-            // pr_code
-            // 
-            this.pr_code.Location = new System.Drawing.Point(218, 152);
-            this.pr_code.Name = "pr_code";
-            this.pr_code.Size = new System.Drawing.Size(582, 35);
-            this.pr_code.TabIndex = 11;
-            this.pr_code.KeyDown += new System.Windows.Forms.KeyEventHandler(this.pr_code_KeyDown);
-            this.pr_code.Leave += new System.EventHandler(this.pr_code_Leave);
-            // 
-            // label2
-            // 
-            this.label2.AutoSize = true;
-            this.label2.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label2.Location = new System.Drawing.Point(19, 147);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(146, 41);
-            this.label2.TabIndex = 10;
-            this.label2.Text = "产品编号";
-            // 
-            // OperatResult
-            // 
-            this.OperatResult.Location = new System.Drawing.Point(823, 32);
-            this.OperatResult.Name = "OperatResult";
-            this.OperatResult.Size = new System.Drawing.Size(1110, 874);
-            this.OperatResult.TabIndex = 12;
-            this.OperatResult.Text = "";
-            this.OperatResult.TextChanged += new System.EventHandler(this.OperatResult_TextChanged);
-            // 
-            // SendSop
-            // 
-            this.SendSop.Location = new System.Drawing.Point(640, 611);
-            this.SendSop.Name = "SendSop";
-            this.SendSop.Size = new System.Drawing.Size(160, 42);
-            this.SendSop.TabIndex = 13;
-            this.SendSop.Text = "广播SOP";
-            this.SendSop.UseVisualStyleBackColor = true;
-            this.SendSop.Click += new System.EventHandler(this.SendSop_Click);
-            // 
-            // label3
-            // 
-            this.label3.AutoSize = true;
-            this.label3.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label3.Location = new System.Drawing.Point(19, 240);
-            this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(146, 41);
-            this.label3.TabIndex = 14;
-            this.label3.Text = "产品名称";
-            // 
-            // label4
-            // 
-            this.label4.AutoSize = true;
-            this.label4.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label4.Location = new System.Drawing.Point(19, 333);
-            this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(146, 41);
-            this.label4.TabIndex = 15;
-            this.label4.Text = "产品规格";
-            // 
-            // pr_detail
-            // 
-            this.pr_detail.AutoSize = true;
-            this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.pr_detail.Location = new System.Drawing.Point(211, 240);
-            this.pr_detail.Name = "pr_detail";
-            this.pr_detail.Size = new System.Drawing.Size(0, 41);
-            this.pr_detail.TabIndex = 16;
-            // 
-            // JPG
-            // 
-            this.JPG.AutoSize = true;
-            this.JPG.Checked = true;
-            this.JPG.Location = new System.Drawing.Point(251, 534);
-            this.JPG.Name = "JPG";
-            this.JPG.Size = new System.Drawing.Size(89, 28);
-            this.JPG.TabIndex = 18;
-            this.JPG.TabStop = true;
-            this.JPG.Text = "图片";
-            this.JPG.UseVisualStyleBackColor = true;
-            // 
-            // PDF
-            // 
-            this.PDF.AutoSize = true;
-            this.PDF.Location = new System.Drawing.Point(382, 534);
-            this.PDF.Name = "PDF";
-            this.PDF.Size = new System.Drawing.Size(77, 28);
-            this.PDF.TabIndex = 18;
-            this.PDF.TabStop = true;
-            this.PDF.Text = "PDF";
-            this.PDF.UseVisualStyleBackColor = true;
-            // 
-            // pr_spec
-            // 
-            this.pr_spec.Enabled = false;
-            this.pr_spec.Location = new System.Drawing.Point(218, 341);
-            this.pr_spec.Name = "pr_spec";
-            this.pr_spec.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.None;
-            this.pr_spec.Size = new System.Drawing.Size(580, 94);
-            this.pr_spec.TabIndex = 19;
-            this.pr_spec.Text = "";
-            // 
-            // SOP
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1945, 934);
-            this.Controls.Add(this.pr_spec);
-            this.Controls.Add(this.PDF);
-            this.Controls.Add(this.JPG);
-            this.Controls.Add(this.pr_detail);
-            this.Controls.Add(this.label4);
-            this.Controls.Add(this.label3);
-            this.Controls.Add(this.SendSop);
-            this.Controls.Add(this.OperatResult);
-            this.Controls.Add(this.pr_code);
-            this.Controls.Add(this.label2);
-            this.Controls.Add(this.UploadSOP);
-            this.Controls.Add(this.ChooseFile);
-            this.Controls.Add(this.FilePath);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.richTextBox1);
-            this.MaximizeBox = false;
-            this.Name = "SOP";
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "SOP管理";
-            this.Load += new System.EventHandler(this.Form3_Load);
-            this.ResumeLayout(false);
-            this.PerformLayout();
-
-        }
-
-        #endregion
-        private System.Windows.Forms.RichTextBox richTextBox1;
-        private System.Windows.Forms.OpenFileDialog ChoosePath;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.TextBox FilePath;
-        private System.Windows.Forms.Button ChooseFile;
-        private System.Windows.Forms.Button UploadSOP;
-        private System.Windows.Forms.TextBox pr_code;
-        private System.Windows.Forms.Label label2;
-        private System.Windows.Forms.RichTextBox OperatResult;
-        private System.Windows.Forms.Button SendSop;
-        private System.Windows.Forms.Label label3;
-        private System.Windows.Forms.Label label4;
-        private System.Windows.Forms.Label pr_detail;
-        private System.Windows.Forms.RadioButton JPG;
-        private System.Windows.Forms.RadioButton PDF;
-        private System.Windows.Forms.RichTextBox pr_spec;
-    }
-}

+ 0 - 408
FileWatcher/SOP_PNE.cs

@@ -1,408 +0,0 @@
-using System;
-using System.IO;
-using System.Text;
-using System.Windows.Forms;
-using Spire.Xls;
-using System.Net;
-using System.Collections.Generic;
-using System.Threading;
-using System.Net.Sockets;
-using System.Data;
-using System.Web.Script.Serialization;
-
-namespace FileWatcher
-{
-    public partial class SOP_PNE : Form
-    {
-        DataHelper dh = new DataHelper();
-
-        string usercode;
-        string sourcecode;
-
-        public SOP_PNE(string iUserCode, string iSource)
-        {
-            usercode = iUserCode;
-            sourcecode = iSource;
-            InitializeComponent();
-        }
-
-        private void Form3_Load(object sender, EventArgs e)
-        {
-            CheckForIllegalCrossThreadCalls = false;
-        }
-
-        void uploadfile()
-        {
-            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");
-            if (dt.Rows.Count == 0)
-            {
-                DataTable dt1 = (DataTable)dh.ExecuteSql("select pr_code from product where instr('" + pr_code.Text + "',pr_code)>0", "select");
-                if (dt1.Rows.Count > 0)
-                {
-                    string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
-                    pr_code.Text = dt1.Rows[0]["pr_code"].ToString();
-                    dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman)values(productsop_seq.nextval,'" + code + "','" + pr_code.Text + "',sysdate,'" + usercode + "')", "insert");
-                }
-                else
-                {
-                    MessageBox.Show("产品编号" + pr_code.Text + "不存在");
-                    return;
-                }
-            }
-            else
-            {
-                pr_code.Text = dt.Rows[0]["ps_prodcode"].ToString();
-            }
-            Workbook workbook = new Workbook();
-            workbook.LoadFromFile(FilePath.Text);
-            workbook.ConverterSetting.JPEGQuality = 100;
-            workbook.ConverterSetting.XDpi = 600;
-            workbook.ConverterSetting.YDpi = 600;
-            List<Worksheet> list = new List<Worksheet>();
-            List<string> filename = new List<string>();
-            dh.ExecuteSql("update ProductSOP set ps_attachsop='' where ps_prodcode='" + pr_code.Text + "'", "update");
-            OperatResult.AppendText("一共Sheet: " + workbook.Worksheets.Count + "\n");
-            try
-            {
-                for (int i = 0; i < workbook.Worksheets.Count; i++)
-                {
-                    for (int k = 0; k < workbook.Worksheets[i].TextBoxes.Count; k++)
-                    {
-                        if (workbook.Worksheets[i].TextBoxes[k].RichText.Text.Length > 1)
-                        {
-                            //OperatResult.AppendText(workbook.Worksheets[i].TextBoxes[k].ID + " " + workbook.Worksheets[i].TextBoxes[k].Name + " " + workbook.Worksheets[i].TextBoxes[k].RichText.GetFont(0).FontName + " " + workbook.Worksheets[i].TextBoxes[k].RichText.GetFont(0).Size);
-                            workbook.Worksheets[i].TextBoxes[k].RichText.Text = workbook.Worksheets[i].TextBoxes[k].RichText.Text;
-                            workbook.Worksheets[i].TextBoxes[k].Width = workbook.Worksheets[i].TextBoxes[k].Width * 2;
-                            workbook.Worksheets[i].TextBoxes[k].Height = workbook.Worksheets[i].TextBoxes[k].Height * 2;
-                            workbook.Worksheets[i].TextBoxes[k].HAlignment = CommentHAlignType.Center;
-                        }
-                    }
-                    Workbook bw = new Workbook();
-                    Worksheet she = bw.CreateEmptySheet();
-                    she.Name = workbook.Worksheets[i].Name;
-                    she.CopyFrom(workbook.Worksheets[i]);
-                    if (JPG.Checked)
-                    {
-                        var myThread = new Thread(() => SaveFileToJPG(she));
-                        myThread.Start();
-                        filename.Add(she.Name + ".jpg");
-                    }
-                    else
-                    {
-                        var myThread = new Thread(() => SaveFileToPDF(she));
-                        myThread.Start();
-                        filename.Add(she.Name + ".pdf");
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                OperatResult.AppendText(ex.Message + "\n");
-            }
-        }
-
-        private void SaveFileToPDF(Worksheet sheet)
-        {
-            if (!Directory.Exists(Application.StartupPath + @"\" + pr_code.Text))
-            {
-                Directory.CreateDirectory(Application.StartupPath + @"\" + pr_code.Text);
-            }
-            sheet.SaveToPdf(Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".pdf");
-            OperatResult.AppendText("解析PDF【" + sheet.Name + ".pdf】" + "\n");
-            Dictionary<string, object> dic = new Dictionary<string, object>();
-            dic.Add("em_name", "管理员");
-            dic.Add("em_code", "ADMIN");
-            dic.Add("caller", "ProductSOP");
-            OperatResult.AppendText("上传文件【" + sheet.Name + ".pdf" + "】\n");
-            string fp_id = UploadFilesToRemoteUrl("http://erp.ubtob.net:11773/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".pdf", dic);
-            if (fp_id != "")
-            {
-                dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
-            }
-        }
-
-        private void SaveFileToJPG(Worksheet sheet)
-        {
-            try
-            {
-                if (!Directory.Exists(Application.StartupPath + @"\" + pr_code.Text))
-                {
-                    Directory.CreateDirectory(Application.StartupPath + @"\" + pr_code.Text);
-                }
-                ExcelPicture picture = sheet.Pictures.Add(@"图片\电子受控章.png");
-                picture.Width = 113;
-                picture.Height = 38;
-                picture.LeftColumn = 20;
-                picture.TopRowOffset = 20;
-                ExcelPicture picture1 = sheet.Pictures.Add(@"图片\签名.png");
-                picture1.Width = 100;
-                picture1.Height = 38;
-                picture1.LeftColumn = 15;
-                picture1.TopRowOffset = 600;
-                sheet.SaveToImage(Application.StartupPath + @"\" + pr_code.Text + @"\" + sheet.Name + ".jpg");
-                OperatResult.AppendText("解析图片【" + sheet.Name + ".jpg】" + "\n");
-                Dictionary<string, object> dic = new Dictionary<string, object>();
-                dic.Add("em_name", "管理员");
-                dic.Add("em_code", "ADMIN");
-                dic.Add("caller", "ProductSOP");
-                OperatResult.AppendText("上传文件【" + sheet.Name + ".jpg" + "】\n");
-                string fp_id = UploadFilesToRemoteUrl("http://erp.ubtob.net:11773/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");
-                }
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine(ex.Message);
-            }
-        }
-
-        /// <summary>
-        /// 请求上传图片到阿里云
-        /// </summary>
-        /// <param name="url">上传地址</param>
-        /// <param name="filepath">本地文件路径</param>
-        /// <param name="dic">上传的数据信息</param>
-        /// <returns></returns>
-        public string UploadFilesToRemoteUrl(string url1, string filepath, Dictionary<string, object> dic)
-        {
-            try
-            {
-                ServicePointManager.DefaultConnectionLimit = 50;
-
-                string boundary = DateTime.Now.Ticks.ToString("x");
-
-                byte[] boundarybytes = System.Text.Encoding.UTF8.GetBytes("--" + boundary + "\r\n");
-
-                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url1);
-                request.Method = "POST";
-                request.Timeout = 10 * 10000;
-                request.ContentType = "multipart/form-data; boundary=" + boundary;
-
-                Stream rs = request.GetRequestStream();
-
-                var endBoundaryBytes = Encoding.UTF8.GetBytes("--" + boundary + "--\r\n");
-
-                string formdataTemplate = "Content-Disposition: form-data; name=\"{0}\"\r\n" + "\r\n" + "{1}" + "\r\n";
-                if (dic != null)
-                {
-                    foreach (string key in dic.Keys)
-                    {
-                        rs.Write(boundarybytes, 0, boundarybytes.Length);
-
-                        string formitem = string.Format(formdataTemplate, key, dic[key]);
-
-                        byte[] formitembytes = System.Text.Encoding.UTF8.GetBytes(formitem);
-
-                        rs.Write(formitembytes, 0, formitembytes.Length);
-                    }
-
-                }
-
-                string headerTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n\r\n";
-                {
-                    rs.Write(boundarybytes, 0, boundarybytes.Length);
-
-                    var header = string.Format(headerTemplate, "file", Path.GetFileName(filepath));
-
-                    var headerbytes = System.Text.Encoding.UTF8.GetBytes(header);
-
-                    rs.Write(headerbytes, 0, headerbytes.Length);
-
-                    using (var fileStream = new FileStream(filepath, FileMode.Open, FileAccess.Read))
-                    {
-                        var buffer = new byte[1024];
-
-                        var bytesRead = 0;
-
-                        while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
-                        {
-                            rs.Write(buffer, 0, bytesRead);
-                        }
-                    }
-                    var cr = Encoding.UTF8.GetBytes("\r\n");
-
-                    rs.Write(cr, 0, cr.Length);
-                }
-
-                rs.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
-
-                var response = request.GetResponse() as HttpWebResponse;
-
-                StreamReader newReader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
-                string Content = newReader.ReadToEnd();
-                Dictionary<string, object> dic1 = new Dictionary<string, object>();
-                List<Dictionary<string, object>> dic2 = null;
-                dic1 = BaseUtil.ToDictionary(Content);
-                dic2 = dic1["data"] as List<Dictionary<string, object>>;
-                string fp_id = "";
-                if (dic2[0]["filepath"] != null)
-                {
-                    fp_id = dic2[0]["filepath"].ToString();
-                }
-                if (response.StatusCode == HttpStatusCode.OK)
-                {
-                    return fp_id;
-                }
-            }
-            catch (Exception e)
-            {
-                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP", "上传失败", pr_code.Text, "");
-                Console.WriteLine(e.Message + e.StackTrace);
-            }
-            return "";
-        }
-
-        private void ChooseFile_Click(object sender, EventArgs e)
-        {
-            ChoosePath.Filter = "(*.xls)|*.xls|(*.xlsx)|*.xlsx";
-            DialogResult result = ChoosePath.ShowDialog();
-            if (result == DialogResult.OK)
-            {
-                FilePath.Text = ChoosePath.FileName;
-            }
-        }
-
-        private void UploadSOP_Click(object sender, EventArgs e)
-        {
-            Thread thread = new Thread(uploadfile);
-            SetLoadingWindow stw = new SetLoadingWindow(thread, "上传文件");
-            stw.StartPosition = FormStartPosition.CenterScreen;
-            stw.ShowDialog();
-            if (JPG.Checked)
-            {
-                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【图片格式】", "上传成功", pr_code.Text, "");
-            }
-            else
-            {
-                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【PDF格式】", "上传成功", pr_code.Text, "");
-            }
-        }
-
-        private void OperatResult_TextChanged(object sender, EventArgs e)
-        {
-            //OperatResult.SelectionStart = Text.Length;
-            OperatResult.ScrollToCaret();
-        }
-
-        TcpServer tcpserver = new TcpServer();
-
-        private void SendSop_Click(object sender, EventArgs e)
-        {
-            try
-            {
-                IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
-                string IPAddress = "";
-                for (int i = 0; i < IpEntry.AddressList.Length; i++)
-                {
-                    if (IpEntry.AddressList[i].AddressFamily == AddressFamily.InterNetwork)
-                    {
-                        IPAddress = IpEntry.AddressList[i].ToString();
-                    }
-                }
-                dh.ExecuteSql("update SOPSOURCE set SS_BRDIP='" + IPAddress + "'", "update");
-                DataTable dt = (DataTable)dh.ExecuteSql("select * from productsop where ps_prodcode='" + pr_code.Text + "'", "select");
-                if (dt.Rows.Count > 0)
-                {
-                    tcpserver.Start();
-                    Thread.Sleep(5000);
-                    List<Dictionary<string, string>> listr = new List<Dictionary<string, string>>();
-                    string PS_ATTACHSOP = dt.Rows[0]["PS_ATTACHSOP"].ToString();
-                    PS_ATTACHSOP = PS_ATTACHSOP.Substring(0, PS_ATTACHSOP.Length - 1).Replace(";", ",");
-                    dt = (DataTable)dh.ExecuteSql("select fp_path, fp_name from filepath where fp_id in (" + PS_ATTACHSOP + ") and nvl(fp_path, ' ') <> ' '", "select");
-                    JavaScriptSerializer jss = new JavaScriptSerializer();
-                    Dictionary<string, object> map1 = new Dictionary<string, object>();
-                    Dictionary<string, object> map = new Dictionary<string, object>();
-                    string path;
-                    string pathroot = dh.GetConfig("filePathUrl", "sys").ToString();
-                    for (int i = 0; i < dt.Rows.Count; i++)
-                    {
-                        Dictionary<string, string> dic1 = new Dictionary<string, string>();
-                        path = dt.Rows[i]["fp_path"].ToString();
-                        path = encryptBASE64(path.Replace("/app/uas/webapps/postattach", pathroot)).Replace("\\s*|\r|\n|\t", "");
-                        dic1.Add("path", path);
-                        dic1.Add("filename", dt.Rows[i]["fp_name"].ToString().Replace(" ", "").Replace("(", "").Replace(")", ""));
-                        dic1.Add("ps_prodcode", pr_code.Text);
-                        listr.Add(dic1);
-                    }
-                    map1.Add("ps_code", "");
-                    map1.Add("url", listr);
-                    map.Add("success", true);
-                    map.Add("data", map1);
-                    tcpserver.Send(jss.Serialize(map));
-                    tcpserver.Stop();
-                    LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播成功", pr_code.Text, "");
-                    MessageBox.Show("产品编号" + pr_code.Text + "广播成功");
-                }
-                else
-                {
-                    MessageBox.Show("产品编号" + pr_code.Text + "未维护SOP文档");
-                    LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败,未维护SOP文档", pr_code.Text, "");
-                }
-            }
-            catch (Exception ex)
-            {
-                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败", pr_code.Text, "");
-                Console.WriteLine(ex.Message + ex.StackTrace);
-            }
-        }
-
-        public string encryptBASE64(string key)
-        {
-            byte[] bytes = Encoding.Default.GetBytes(key);
-            return Convert.ToBase64String(bytes);
-        }
-
-        public static string EncodeBase64(string code_type, string code)
-        {
-            string encode = "";
-            byte[] bytes = Encoding.GetEncoding(code_type).GetBytes(code);
-            try
-            {
-                encode = Convert.ToBase64String(bytes);
-            }
-            catch
-            {
-                encode = code;
-            }
-            return encode;
-        }
-
-        private void pr_code_KeyDown(object sender, KeyEventArgs e)
-        {
-            if (e.KeyCode == Keys.Enter)
-            {
-                LoadPrCode();
-            }
-        }
-
-        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");
-            if (dt.Rows.Count > 0)
-            {
-                pr_spec.Clear();
-                pr_spec.AppendText(dt.Rows[0]["pr_spec"].ToString());
-                pr_detail.Text = dt.Rows[0]["pr_detail"].ToString();
-                pr_code.Text = dt.Rows[0]["pr_code"].ToString();
-            }
-            else
-            {
-                MessageBox.Show("产品编号" + pr_code.Text + "不存在");
-            }
-        }
-
-        private void pr_code_Leave(object sender, EventArgs e)
-        {
-            LoadPrCode();
-        }
-
-        private void pr_spec_Click(object sender, EventArgs e)
-        {
-
-        }
-    }
-}

+ 0 - 138
FileWatcher/SOP_PNE.resx

@@ -1,138 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-  <!-- 
-    Microsoft ResX Schema 
-    
-    Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
-    associated with the data types.
-    
-    Example:
-    
-    ... ado.net/XML headers & schema ...
-    <resheader name="resmimetype">text/microsoft-resx</resheader>
-    <resheader name="version">2.0</resheader>
-    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
-    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
-    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
-    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
-    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
-        <value>[base64 mime encoded serialized .NET Framework object]</value>
-    </data>
-    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
-        <comment>This is a comment</comment>
-    </data>
-                
-    There are any number of "resheader" rows that contain simple 
-    name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
-    mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
-    extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
-    read any of the formats listed below.
-    
-    mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
-            : and then encoded with base64 encoding.
-    
-    mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
-            : and then encoded with base64 encoding.
-
-    mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
-            : using a System.ComponentModel.TypeConverter
-            : and then encoded with base64 encoding.
-    -->
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" use="required" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <metadata name="ChoosePath.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>17, 17</value>
-  </metadata>
-  <metadata name="CheckColumn.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="fp_name.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="fp_path.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="psd_iskey.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="issend.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-</root>

+ 0 - 187
FileWatcher/测试记录解析.Designer.cs

@@ -1,187 +0,0 @@
-namespace FileWatcher
-{
-    partial class 测试记录解析
-    {
-        /// <summary>
-        /// 必需的设计器变量。
-        /// </summary>
-        private System.ComponentModel.IContainer components = null;
-
-        /// <summary>
-        /// 清理所有正在使用的资源。
-        /// </summary>
-        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        #region Windows 窗体设计器生成的代码
-
-        /// <summary>
-        /// 设计器支持所需的方法 - 不要修改
-        /// 使用代码编辑器修改此方法的内容。
-        /// </summary>
-        private void InitializeComponent()
-        {
-            this.components = new System.ComponentModel.Container();
-            this.OperateResult = new System.Windows.Forms.RichTextBox();
-            this.timer1 = new System.Windows.Forms.Timer(this.components);
-            this.Start = new System.Windows.Forms.Button();
-            this.ChooseBackUpFolder = new System.Windows.Forms.Button();
-            this.BackUpFolderPath = new System.Windows.Forms.TextBox();
-            this.label2 = new System.Windows.Forms.Label();
-            this.ChooseFolder = new System.Windows.Forms.Button();
-            this.FolderPath = new System.Windows.Forms.TextBox();
-            this.label1 = new System.Windows.Forms.Label();
-            this.SuspendLayout();
-            // 
-            // OperateResult
-            // 
-            this.OperateResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.OperateResult.Location = new System.Drawing.Point(15, 185);
-            this.OperateResult.Margin = new System.Windows.Forms.Padding(6);
-            this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(1372, 656);
-            this.OperateResult.TabIndex = 0;
-            this.OperateResult.Text = "";
-            // 
-            // timer1
-            // 
-            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
-            // 
-            // Start
-            // 
-            this.Start.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
-            this.Start.Location = new System.Drawing.Point(891, 37);
-            this.Start.Name = "Start";
-            this.Start.Size = new System.Drawing.Size(141, 40);
-            this.Start.TabIndex = 1;
-            this.Start.Text = "开始监控";
-            this.Start.UseVisualStyleBackColor = true;
-            this.Start.Click += new System.EventHandler(this.Start_Click);
-            // 
-            // ChooseBackUpFolder
-            // 
-            this.ChooseBackUpFolder.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            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(658, 111);
-            this.ChooseBackUpFolder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
-            this.ChooseBackUpFolder.Name = "ChooseBackUpFolder";
-            this.ChooseBackUpFolder.Size = new System.Drawing.Size(156, 48);
-            this.ChooseBackUpFolder.TabIndex = 17;
-            this.ChooseBackUpFolder.Text = "选择文件夹";
-            this.ChooseBackUpFolder.UseVisualStyleBackColor = true;
-            this.ChooseBackUpFolder.Click += new System.EventHandler(this.ChooseBackUpFolder_Click);
-            // 
-            // BackUpFolderPath
-            // 
-            this.BackUpFolderPath.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.BackUpFolderPath.Enabled = false;
-            this.BackUpFolderPath.Location = new System.Drawing.Point(190, 118);
-            this.BackUpFolderPath.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
-            this.BackUpFolderPath.Name = "BackUpFolderPath";
-            this.BackUpFolderPath.Size = new System.Drawing.Size(436, 35);
-            this.BackUpFolderPath.TabIndex = 16;
-            // 
-            // label2
-            // 
-            this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.label2.AutoSize = true;
-            this.label2.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(20, 115);
-            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(162, 38);
-            this.label2.TabIndex = 15;
-            this.label2.Text = "备份文件夹";
-            // 
-            // ChooseFolder
-            // 
-            this.ChooseFolder.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            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(658, 29);
-            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);
-            this.ChooseFolder.TabIndex = 14;
-            this.ChooseFolder.Text = "选择文件夹";
-            this.ChooseFolder.UseVisualStyleBackColor = true;
-            this.ChooseFolder.Click += new System.EventHandler(this.ChooseFolder_Click);
-            // 
-            // FolderPath
-            // 
-            this.FolderPath.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.FolderPath.Enabled = false;
-            this.FolderPath.Location = new System.Drawing.Point(190, 35);
-            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);
-            this.FolderPath.TabIndex = 13;
-            // 
-            // label1
-            // 
-            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            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(20, 29);
-            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);
-            this.label1.TabIndex = 12;
-            this.label1.Text = "监控文件夹";
-            // 
-            // 测试记录解析
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1402, 856);
-            this.Controls.Add(this.ChooseBackUpFolder);
-            this.Controls.Add(this.BackUpFolderPath);
-            this.Controls.Add(this.label2);
-            this.Controls.Add(this.ChooseFolder);
-            this.Controls.Add(this.FolderPath);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.Start);
-            this.Controls.Add(this.OperateResult);
-            this.Margin = new System.Windows.Forms.Padding(6);
-            this.Name = "测试记录解析";
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "测试文件监控";
-            this.Load += new System.EventHandler(this.Form1_Load);
-            this.ResumeLayout(true);
-            this.PerformLayout();
-
-        }
-
-        #endregion
-        private System.Windows.Forms.RichTextBox OperateResult;
-        private System.Windows.Forms.Timer timer1;
-        private System.Windows.Forms.Button Start;
-        private System.Windows.Forms.Button ChooseBackUpFolder;
-        private System.Windows.Forms.TextBox BackUpFolderPath;
-        private System.Windows.Forms.Label label2;
-        private System.Windows.Forms.Button ChooseFolder;
-        private System.Windows.Forms.TextBox FolderPath;
-        private System.Windows.Forms.Label label1;
-    }
-}
-

+ 0 - 203
FileWatcher/测试记录解析.cs

@@ -1,203 +0,0 @@
-using Microsoft.Win32;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Diagnostics;
-using System.IO;
-using System.Text;
-using System.Threading;
-using System.Windows.Forms;
-
-namespace FileWatcher
-{
-    public partial class 测试记录解析 : Form
-    {
-
-        DataHelper dh = new DataHelper();
-
-        ftpOperater ftp = new ftpOperater();
-
-        public 测试记录解析()
-        {
-            InitializeComponent();
-        }
-
-        private void Form1_Load(object sender, EventArgs e)
-        {
-            timer1.Interval = 1000 * 10;
-            OperateResult.AppendText("连接上服务器\n");
-            //timer1.Start();
-        }
-
-        public void DoLog(string Message)
-        {
-            try
-            {
-                StreamWriter sw = File.AppendText(DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
-                sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + Message + "\n");
-                sw.Close();
-            }
-            catch (Exception) { }
-        }
-
-        /// <summary>
-        /// 私有变量
-        /// </summary>
-        private List<FileInfo> lst = new List<FileInfo>();
-        /// <summary>
-        /// 获得目录下所有文件或指定文件类型文件(包含所有子文件夹)
-        /// </summary>
-        /// <param name="path">文件夹路径</param>
-        /// <param name="extName">扩展名可以多个 例如 .mp3.wma.rm</param>
-        /// <returns>List<FileInfo></returns>
-
-        public static List<FileInfo> getFile(string path, string extName, List<FileInfo> lst)
-        {
-            try
-            {
-                string[] directories = Directory.GetDirectories(path);
-                DirectoryInfo directoryInfo = new DirectoryInfo(path);
-                FileInfo[] files = directoryInfo.GetFiles();
-                if (files.Length != 0 || directories.Length != 0)
-                {
-                    FileInfo[] array = files;
-                    foreach (FileInfo fileInfo in array)
-                    {
-                        if (extName.ToLower().IndexOf(fileInfo.Extension.ToLower()) >= 0)
-                        {
-                            lst.Add(fileInfo);
-                        }
-                    }
-                    string[] array2 = directories;
-                    foreach (string path2 in array2)
-                    {
-                        getFile(path2, extName, lst);
-                    }
-                }
-                return lst;
-            }
-            catch (Exception ex)
-            {
-                throw ex;
-            }
-        }
-
-
-        /// <summary>
-        /// 私有方法,递归获取指定类型文件,包含子文件夹
-        /// </summary>
-        /// <param name="path"></param>
-        /// <param name="extName"></param>
-        private void getdir(string path, string extName)
-        {
-            try
-            {
-                string[] directories = Directory.GetDirectories(path);
-                DirectoryInfo directoryInfo = new DirectoryInfo(path);
-                FileInfo[] files = directoryInfo.GetFiles();
-                if (files.Length != 0 || directories.Length != 0)
-                {
-                    string text = "";
-                    string text2 = "";
-                    FileInfo[] array = files;
-                    foreach (FileInfo fileInfo in array)
-                    {
-                        text2 = fileInfo.FullName.Substring(0, fileInfo.FullName.LastIndexOf("\\"));
-                        text = text2.Substring(text2.LastIndexOf("\\") + 1);
-                        if (fileInfo.FullName.Contains("SN_"))
-                        {
-                            StreamReader streamReader = new StreamReader(fileInfo.FullName);
-                            while (!streamReader.EndOfStream)
-                            {
-                                string text3 = streamReader.ReadLine();
-                                string text4 = text3.Split(':')[0].Trim();
-                                string text5 = text3.Split(':')[1].Trim();
-                                dh.ExecuteSql("insert into windowsninfo(ws_id,ws_sncode,ws_type,ws_value,ws_indate)values(windowsninfo_seq.nextval,'" + text + "','" + text4 + "','" + text5 + "',sysdate)", "insert");
-                            }
-                            streamReader.Close();
-                        }
-                        try
-                        {
-                            string uploadFolder = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/" + text2.Substring(text2.LastIndexOf("\\") + 1) + "/";
-                            ftp.UpLoadFile(text2, fileInfo.Name, uploadFolder, BackUpFolderPath.Text);
-                        }
-                        catch (Exception ex)
-                        {
-                            Console.WriteLine(ex.Message);
-                        }
-                    }
-                    FileInfo[] array2 = files;
-                    foreach (FileInfo fileInfo2 in array2)
-                    {
-                        try
-                        {
-                            if (!Directory.Exists(BackUpFolderPath.Text + "\\" + text + "\\"))
-                            {
-                                Directory.CreateDirectory(BackUpFolderPath.Text + "\\" + text + "\\");
-                            }
-                            File.Move(fileInfo2.FullName, BackUpFolderPath.Text + "\\" + text + "\\" + fileInfo2.Name);
-                        }
-                        catch (Exception ex2)
-                        {
-                            Console.WriteLine(ex2.Message);
-                        }
-                    }
-                    try
-                    {
-                        Directory.Delete(text2);
-                    }
-                    catch (Exception)
-                    {
-                    }
-                    string[] array3 = directories;
-                    foreach (string path2 in array3)
-                    {
-                        getdir(path2, extName);
-                    }
-                }
-            }
-            catch (Exception ex4)
-            {
-                Console.WriteLine(ex4.Message);
-            }
-        }
-
-        private void timer1_Tick(object sender, EventArgs e)
-        {
-            try
-            {
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine(ex.Message);
-            }
-        }
-
-        private void ChooseFolder_Click(object sender, EventArgs e)
-        {
-            FolderBrowserDialog folder = new FolderBrowserDialog();
-            folder.Description = "选择监控文件夹";
-            DialogResult result = folder.ShowDialog();
-            if (result == DialogResult.OK)
-            {
-                FolderPath.Text = folder.SelectedPath;
-            }
-        }
-
-        private void ChooseBackUpFolder_Click(object sender, EventArgs e)
-        {
-            FolderBrowserDialog folder = new FolderBrowserDialog();
-            folder.Description = "选择备份文件夹";
-            DialogResult result = folder.ShowDialog();
-            if (result == DialogResult.OK)
-            {
-                BackUpFolderPath.Text = folder.SelectedPath;
-            }
-        }
-
-        private void Start_Click(object sender, EventArgs e)
-        {
-            timer1.Start();
-        }
-    }
-}

+ 0 - 123
FileWatcher/测试记录解析.resx

@@ -1,123 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-  <!-- 
-    Microsoft ResX Schema 
-    
-    Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
-    associated with the data types.
-    
-    Example:
-    
-    ... ado.net/XML headers & schema ...
-    <resheader name="resmimetype">text/microsoft-resx</resheader>
-    <resheader name="version">2.0</resheader>
-    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
-    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
-    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
-    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
-    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
-        <value>[base64 mime encoded serialized .NET Framework object]</value>
-    </data>
-    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
-        <comment>This is a comment</comment>
-    </data>
-                
-    There are any number of "resheader" rows that contain simple 
-    name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
-    mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
-    extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
-    read any of the formats listed below.
-    
-    mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
-            : and then encoded with base64 encoding.
-    
-    mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
-            : and then encoded with base64 encoding.
-
-    mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
-            : using a System.ComponentModel.TypeConverter
-            : and then encoded with base64 encoding.
-    -->
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" use="required" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
-    <value>228, 17</value>
-  </metadata>
-</root>

+ 0 - 151
FileWatcher/首件仪上传.Designer.cs

@@ -1,151 +0,0 @@
-namespace FileWatcher
-{
-    partial class 首件仪上传
-    {
-        /// <summary>
-        /// 必需的设计器变量。
-        /// </summary>
-        private System.ComponentModel.IContainer components = null;
-
-        /// <summary>
-        /// 清理所有正在使用的资源。
-        /// </summary>
-        /// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
-        protected override void Dispose(bool disposing)
-        {
-            if (disposing && (components != null))
-            {
-                components.Dispose();
-            }
-            base.Dispose(disposing);
-        }
-
-        #region Windows 窗体设计器生成的代码
-
-        /// <summary>
-        /// 设计器支持所需的方法 - 不要修改
-        /// 使用代码编辑器修改此方法的内容。
-        /// </summary>
-        private void InitializeComponent()
-        {
-            this.OperateResult = new System.Windows.Forms.RichTextBox();
-            this.Start = new System.Windows.Forms.Button();
-            this.ChooseFolder = new System.Windows.Forms.Button();
-            this.FolderPath = new System.Windows.Forms.TextBox();
-            this.label1 = new System.Windows.Forms.Label();
-            this.label2 = new System.Windows.Forms.Label();
-            this.ma_code = new System.Windows.Forms.TextBox();
-            this.SuspendLayout();
-            // 
-            // OperateResult
-            // 
-            this.OperateResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
-            | System.Windows.Forms.AnchorStyles.Left) 
-            | System.Windows.Forms.AnchorStyles.Right)));
-            this.OperateResult.Location = new System.Drawing.Point(38, 15);
-            this.OperateResult.Margin = new System.Windows.Forms.Padding(6);
-            this.OperateResult.Name = "OperateResult";
-            this.OperateResult.Size = new System.Drawing.Size(1336, 600);
-            this.OperateResult.TabIndex = 0;
-            this.OperateResult.Text = "";
-            // 
-            // Start
-            // 
-            this.Start.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            this.Start.Location = new System.Drawing.Point(623, 788);
-            this.Start.Name = "Start";
-            this.Start.Size = new System.Drawing.Size(141, 40);
-            this.Start.TabIndex = 1;
-            this.Start.Text = "上传文件";
-            this.Start.UseVisualStyleBackColor = true;
-            this.Start.Click += new System.EventHandler(this.Start_Click);
-            // 
-            // ChooseFolder
-            // 
-            this.ChooseFolder.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            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(669, 720);
-            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);
-            this.ChooseFolder.TabIndex = 14;
-            this.ChooseFolder.Text = "选择文件夹";
-            this.ChooseFolder.UseVisualStyleBackColor = true;
-            this.ChooseFolder.Click += new System.EventHandler(this.ChooseFolder_Click);
-            // 
-            // FolderPath
-            // 
-            this.FolderPath.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            this.FolderPath.Enabled = false;
-            this.FolderPath.Location = new System.Drawing.Point(201, 726);
-            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);
-            this.FolderPath.TabIndex = 13;
-            // 
-            // label1
-            // 
-            this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            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(31, 720);
-            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(104, 38);
-            this.label1.TabIndex = 12;
-            this.label1.Text = "文件夹";
-            // 
-            // label2
-            // 
-            this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            this.label2.AutoSize = true;
-            this.label2.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(80, 654);
-            this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
-            this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(104, 38);
-            this.label2.TabIndex = 15;
-            this.label2.Text = "工单号";
-            // 
-            // ma_code
-            // 
-            this.ma_code.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
-            this.ma_code.Location = new System.Drawing.Point(201, 660);
-            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 = 16;
-            // 
-            // 首件仪上传
-            // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
-            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1402, 845);
-            this.Controls.Add(this.ma_code);
-            this.Controls.Add(this.label2);
-            this.Controls.Add(this.ChooseFolder);
-            this.Controls.Add(this.FolderPath);
-            this.Controls.Add(this.label1);
-            this.Controls.Add(this.Start);
-            this.Controls.Add(this.OperateResult);
-            this.Margin = new System.Windows.Forms.Padding(6);
-            this.Name = "首件仪上传";
-            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
-            this.Text = "测试文件监控";
-            this.Load += new System.EventHandler(this.Form1_Load);
-            this.ResumeLayout(true);
-            this.PerformLayout();
-
-        }
-
-        #endregion
-        private System.Windows.Forms.RichTextBox OperateResult;
-        private System.Windows.Forms.Button Start;
-        private System.Windows.Forms.Button ChooseFolder;
-        private System.Windows.Forms.TextBox FolderPath;
-        private System.Windows.Forms.Label label1;
-        private System.Windows.Forms.Label label2;
-        private System.Windows.Forms.TextBox ma_code;
-    }
-}
-

+ 0 - 224
FileWatcher/首件仪上传.cs

@@ -1,224 +0,0 @@
-using Microsoft.Win32;
-using System;
-using System.Collections.Generic;
-using System.Data;
-using System.Diagnostics;
-using System.IO;
-using System.Net;
-using System.Text;
-using System.Text.RegularExpressions;
-using System.Threading;
-using System.Windows.Forms;
-
-namespace FileWatcher
-{
-    public partial class 首件仪上传 : Form
-    {
-
-        DataHelper dh = new DataHelper();
-
-        ftpOperater ftp = new ftpOperater();
-
-        public 首件仪上传()
-        {
-            InitializeComponent();
-        }
-
-        private void Form1_Load(object sender, EventArgs e)
-        {
-            OperateResult.AppendText("连接上服务器\n");
-            //timer1.Start();
-        }
-
-        public void DoLog(string Message)
-        {
-            try
-            {
-                StreamWriter sw = File.AppendText(DateTime.Now.ToString("yyyy-MM-dd") + ".txt");
-                sw.WriteLine("\n【时间】" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + Message + "\n");
-                sw.Close();
-            }
-            catch (Exception) { }
-        }
-
-        /// <summary>
-        /// 私有变量
-        /// </summary>
-        private List<FileInfo> lst = new List<FileInfo>();
-        /// <summary>
-        /// 获得目录下所有文件或指定文件类型文件(包含所有子文件夹)
-        /// </summary>
-        /// <param name="path">文件夹路径</param>
-        /// <param name="extName">扩展名可以多个 例如 .mp3.wma.rm</param>
-        /// <returns>List<FileInfo></returns>
-        public List<FileInfo> getFile(string path, string extName)
-        {
-            getdir(path, extName);
-            return lst;
-        }
-
-        /// <summary>
-        /// 私有方法,递归获取指定类型文件,包含子文件夹
-        /// </summary>
-        /// <param name="path"></param>
-        /// <param name="extName"></param>
-        private void getdir(string path, string extName)
-        {
-            try
-            {
-                string[] dir = Directory.GetDirectories(path); //文件夹列表   
-                DirectoryInfo fdir = new DirectoryInfo(path);
-                FileInfo[] file = fdir.GetFiles();
-                //FileInfo[] file = Directory.GetFiles(path); //文件列表   
-                if (file.Length != 0 || dir.Length != 0) //当前目录文件或文件夹不为空                   
-                {
-                    string SN = "";
-                    string folderpath = "";
-                    foreach (FileInfo f in file) //显示当前目录所有文件   
-                    {
-                        string filename = f.FullName;
-                        if (filename.Substring(filename.LastIndexOf(".") + 1).ToUpper() == "INI")
-                        {
-                            folderpath = f.FullName.Substring(0, f.FullName.LastIndexOf(@"\"));
-                            SN = f.Name.Split('.')[0].ToUpper().Split('_')[0];
-                            //if (SN.Length == 12)
-                            //{
-                            try
-                            {
-                                string ftppath = "/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
-                                ftp.UpLoadFile(folderpath, f.Name, ftppath, "");
-                                int dt = int.Parse(dh.ExecuteSql("insert into STEPTESTDETAIL (std_id,std_sn,std_makecode,std_indate,std_class)values( STEPTESTDETAIL_seq.nextval,'" + SN + "','" + ma_code.Text + "',sysdate,'http://113.98.196.181:8099/ftp" + ftppath + f.Name + "')", "insert").ToString());
-                                if (dt > 0)
-                                {
-                                    OperateResult.AppendText("序列号:" + SN + "上传成功\n");
-                                }
-                                //else
-                                //{
-                                //    OperateResult.AppendText("序列号: " + SN + "前工段未扫描\n");
-                                //    MessageBox.Show("序列号: " + SN + "前工段未扫描", "信息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly);
-                                //}
-                            }
-                            catch (Exception ex)
-                            {
-                                Console.WriteLine(ex.Message);
-                            }
-                            File.Delete(f.FullName);
-                            //}
-                        }
-                    }
-                }
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine(ex.Message);
-            }
-        }
-
-        private void timer1_Tick(object sender, EventArgs e)
-        {
-            try
-            {
-                getFile(FolderPath.Text, ".txt");
-            }
-            catch (Exception ex)
-            {
-                Console.WriteLine(ex.Message);
-            }
-        }
-
-        /// <summary>
-        /// 获得目录下所有文件或指定文件类型文件(包含所有子文件夹)
-        /// </summary>
-        /// <param name="path">文件夹路径</param>
-        /// <param name="extName">扩展名可以多个 例如 .mp3.wma.rm</param>
-        /// <returns>List<FileInfo></returns>
-        public static List<FileInfo> getFile(string path, string extName, List<FileInfo> lst)
-        {
-            try
-            {
-                string[] dir = Directory.GetDirectories(path); //文件夹列表  
-                DirectoryInfo fdir = new DirectoryInfo(path);
-                FileInfo[] file = fdir.GetFiles();
-                //FileInfo[] file = Directory.GetFiles(path); //文件列表  
-                if (file.Length != 0 || dir.Length != 0) //当前目录文件或文件夹不为空          
-                {
-                    foreach (FileInfo f in file) //显示当前目录所有文件  
-                    {
-                        if (extName.ToLower().IndexOf(f.Extension.ToLower()) >= 0)
-                        {
-                            lst.Add(f);
-                        }
-                    }
-                    foreach (string d in dir)
-                    {
-                        getFile(d, extName, lst);//递归  
-                    }
-                }
-                return lst;
-            }
-            catch (Exception ex)
-            {
-                throw ex;
-            }
-        }
-
-        private void ChooseFolder_Click(object sender, EventArgs e)
-        {
-            FolderBrowserDialog folder = new FolderBrowserDialog();
-            folder.Description = "选择监控文件夹";
-            DialogResult result = folder.ShowDialog();
-            if (result == DialogResult.OK)
-            {
-                FolderPath.Text = folder.SelectedPath;
-            }
-        }
-
-        private void ChooseBackUpFolder_Click(object sender, EventArgs e)
-        {
-            FolderBrowserDialog folder = new FolderBrowserDialog();
-            folder.Description = "选择备份文件夹";
-            DialogResult result = folder.ShowDialog();
-            if (result == DialogResult.OK)
-            {
-                // BackUpFolderPath.Text = folder.SelectedPath;
-            }
-        }
-
-        private void Start_Click(object sender, EventArgs e)
-        {
-            if (!dh.CheckExist("make", "ma_code='" + ma_code.Text + "'"))
-            {
-                OperateResult.AppendText("工单" + ma_code.Text + "不存在\n");
-                return;
-            }
-            //ftp.UpLoadFile(text2, fileInfo.Name, uploadFolder, BackUpFolderPath.Text);
-            string[] files = Directory.GetFiles(FolderPath.Text);
-            foreach (var file in files)
-            {
-                string text2 = file.Substring(0, file.LastIndexOf("\\"));
-                string text = file.Substring(file.LastIndexOf("\\") + 1);
-
-                for (int i = 0; i < text.Length; i++)
-                {
-                    if (Regex.IsMatch(text.ToString(), @"[\u4E00-\u9FA5]+$"))
-                    {
-                        OperateResult.AppendText("文件名不允许包含\n");
-                        return;
-                    }
-                }
-                if (!dh.CheckExist("SMTCHECKFIRST", "scf_filepath='" + text + "'"))
-                {
-                    dh.ExecuteSql("insert into SMTCHECKFIRST(scf_id,scf_indate,scf_filepath,scd_makecode)values(" +
-                    "SMTCHECKFIRST_seq.nextval,sysdate,'http://113.98.196.181:8099/ftp/" + DateTime.Now.ToString("yyyy-MM-dd") + "/" + text + "','" + ma_code.Text + "')", "insert");
-                    string uploadFolder = "/CheckFirst/" + DateTime.Now.ToString("yyyy-MM-dd") + "/";
-                    ftp.UpLoadFile(text2, text, uploadFolder, "");
-                    OperateResult.AppendText("文件【" + text + "】上传成功\n");
-                }
-                else
-                {
-                    OperateResult.AppendText("文件【" + text + "】已存在\n");
-                }
-            }
-        }
-    }
-}

+ 0 - 120
FileWatcher/首件仪上传.resx

@@ -1,120 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<root>
-  <!-- 
-    Microsoft ResX Schema 
-    
-    Version 2.0
-    
-    The primary goals of this format is to allow a simple XML format 
-    that is mostly human readable. The generation and parsing of the 
-    various data types are done through the TypeConverter classes 
-    associated with the data types.
-    
-    Example:
-    
-    ... ado.net/XML headers & schema ...
-    <resheader name="resmimetype">text/microsoft-resx</resheader>
-    <resheader name="version">2.0</resheader>
-    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
-    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
-    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
-    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
-    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
-        <value>[base64 mime encoded serialized .NET Framework object]</value>
-    </data>
-    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
-        <comment>This is a comment</comment>
-    </data>
-                
-    There are any number of "resheader" rows that contain simple 
-    name/value pairs.
-    
-    Each data row contains a name, and value. The row also contains a 
-    type or mimetype. Type corresponds to a .NET class that support 
-    text/value conversion through the TypeConverter architecture. 
-    Classes that don't support this are serialized and stored with the 
-    mimetype set.
-    
-    The mimetype is used for serialized objects, and tells the 
-    ResXResourceReader how to depersist the object. This is currently not 
-    extensible. For a given mimetype the value must be set accordingly:
-    
-    Note - application/x-microsoft.net.object.binary.base64 is the format 
-    that the ResXResourceWriter will generate, however the reader can 
-    read any of the formats listed below.
-    
-    mimetype: application/x-microsoft.net.object.binary.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
-            : and then encoded with base64 encoding.
-    
-    mimetype: application/x-microsoft.net.object.soap.base64
-    value   : The object must be serialized with 
-            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
-            : and then encoded with base64 encoding.
-
-    mimetype: application/x-microsoft.net.object.bytearray.base64
-    value   : The object must be serialized into a byte array 
-            : using a System.ComponentModel.TypeConverter
-            : and then encoded with base64 encoding.
-    -->
-  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
-    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
-    <xsd:element name="root" msdata:IsDataSet="true">
-      <xsd:complexType>
-        <xsd:choice maxOccurs="unbounded">
-          <xsd:element name="metadata">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" />
-              </xsd:sequence>
-              <xsd:attribute name="name" use="required" type="xsd:string" />
-              <xsd:attribute name="type" type="xsd:string" />
-              <xsd:attribute name="mimetype" type="xsd:string" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="assembly">
-            <xsd:complexType>
-              <xsd:attribute name="alias" type="xsd:string" />
-              <xsd:attribute name="name" type="xsd:string" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="data">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
-              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
-              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
-              <xsd:attribute ref="xml:space" />
-            </xsd:complexType>
-          </xsd:element>
-          <xsd:element name="resheader">
-            <xsd:complexType>
-              <xsd:sequence>
-                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
-              </xsd:sequence>
-              <xsd:attribute name="name" type="xsd:string" use="required" />
-            </xsd:complexType>
-          </xsd:element>
-        </xsd:choice>
-      </xsd:complexType>
-    </xsd:element>
-  </xsd:schema>
-  <resheader name="resmimetype">
-    <value>text/microsoft-resx</value>
-  </resheader>
-  <resheader name="version">
-    <value>2.0</value>
-  </resheader>
-  <resheader name="reader">
-    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-  <resheader name="writer">
-    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
-  </resheader>
-</root>