Pārlūkot izejas kodu

添加SOP上传功能

callm 2 dienas atpakaļ
vecāks
revīzija
c7bc2ad0bb

+ 194 - 30
UAS_MES_ZDXW/FunctionCode/Query/Query_SOP.Designer.cs

@@ -28,56 +28,220 @@
         /// </summary>
         /// </summary>
         private void InitializeComponent()
         private void InitializeComponent()
         {
         {
-            this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
-            this.Sn = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SNCodeEnterTextBox();
+            this.richTextBox1 = new System.Windows.Forms.RichTextBox();
+            this.ChoosePath = new System.Windows.Forms.OpenFileDialog();
             this.label1 = new System.Windows.Forms.Label();
             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();
             this.SuspendLayout();
             // 
             // 
-            // Sn
+            // richTextBox1
             // 
             // 
-            this.Sn.AllPower = null;
-            this.Sn.ID = null;
-            this.Sn.Location = new System.Drawing.Point(213, 357);
-            this.Sn.Name = "Sn";
-            this.Sn.Power = null;
-            this.Sn.Size = new System.Drawing.Size(283, 35);
-            this.Sn.Str = null;
-            this.Sn.Str1 = null;
-            this.Sn.Str2 = null;
-            this.Sn.TabIndex = 0;
-            this.Sn.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Sn_KeyDown);
+            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
             // label1
             // 
             // 
             this.label1.AutoSize = true;
             this.label1.AutoSize = true;
-            this.label1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(100, 355);
+            this.label1.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.label1.Location = new System.Drawing.Point(19, 448);
             this.label1.Name = "label1";
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(58, 37);
-            this.label1.TabIndex = 1;
-            this.label1.Text = "SN";
+            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 = "";
             // 
             // 
-            // Query_SOP
+            // SOP
             // 
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1494, 1075);
+            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.label1);
-            this.Controls.Add(this.Sn);
-            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(6);
-            this.Name = "Query_SOP";
-            this.Tag = "Query!SOP";
-            this.Text = "Query_SpecialReport";
-            this.Load += new System.EventHandler(this.Query_SpecialReport_Load);
+            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.ResumeLayout(false);
             this.PerformLayout();
             this.PerformLayout();
 
 
         }
         }
 
 
         #endregion
         #endregion
-        private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
-        private CustomControl.TextBoxWithIcon.SNCodeEnterTextBox Sn;
+        private System.Windows.Forms.RichTextBox richTextBox1;
+        private System.Windows.Forms.OpenFileDialog ChoosePath;
         private System.Windows.Forms.Label label1;
         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;
     }
     }
 }
 }

+ 378 - 28
UAS_MES_ZDXW/FunctionCode/Query/Query_SOP.cs

@@ -1,61 +1,411 @@
 using System;
 using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
+using System.IO;
 using System.Text;
 using System.Text;
 using System.Windows.Forms;
 using System.Windows.Forms;
+using System.Net;
+using System.Collections.Generic;
+using System.Threading;
+using System.Net.Sockets;
+using System.Data;
 using UAS_MES_NEW.DataOperate;
 using UAS_MES_NEW.DataOperate;
-using UAS_MES_NEW.Entity;
 using UAS_MES_NEW.PublicMethod;
 using UAS_MES_NEW.PublicMethod;
+using Spire.Xls;
+using UAS_MES_NEW.PublicForm;
+using System.Web.Script.Serialization;
 
 
 namespace UAS_MES_NEW.Query
 namespace UAS_MES_NEW.Query
 {
 {
     public partial class Query_SOP : Form
     public partial class Query_SOP : Form
     {
     {
+        DataHelper dh = new DataHelper();
 
 
-        DataHelper dh = SystemInf.dh;
+        string usercode;
+        string sourcecode;
 
 
-        public Query_SOP()
+        public Query_SOP(string iUserCode, string iSource)
         {
         {
+            usercode = iUserCode;
+            sourcecode = iSource;
             InitializeComponent();
             InitializeComponent();
         }
         }
 
 
-        private void Export_Click(object sender, EventArgs e)
+        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");
+            }
         }
         }
 
 
-        //选择导出Excel时是选择导出数据的还是模板
-        private void ExcelExport(string DataOrTemplet)
+        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);
+            }
         }
         }
 
 
-        private void Query_SpecialReport_Load(object sender, EventArgs e)
+        /// <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 Sn_KeyDown(object sender, KeyEventArgs e)
+        private void ChooseFile_Click(object sender, EventArgs e)
         {
         {
-            if (e.KeyData == Keys.Enter)
+            ChoosePath.Filter = "(*.xls)|*.xls|(*.xlsx)|*.xlsx";
+            DialogResult result = ChoosePath.ShowDialog();
+            if (result == DialogResult.OK)
             {
             {
-                dh.ExecuteSql("update craftmaterial set cm_status=-1 where cm_barcode='" + Sn.Text + "'", "update");
-                MessageBox.Show("解绑成功");
-                //DataTable dt = (DataTable)dh.ExecuteSql("select ms_prodcode from makeserial where ms_sncode='" + Sn.Text + "'", "select");
-                //if (dt.Rows.Count > 0)
-                //{
-                //    string prodcode = dt.Rows[0]["ms_prodcode"].ToString();
-                //    string FilePath = dh.getFieldDataByCondition("SOPDETAIL left join sop on so_id=sod_soid ", "sod_path", "so_prodcode='" + prodcode + "' and sod_stepcode='" + User.CurrentStepCode + "'").ToString();
-                //    System.Diagnostics.Process.Start(FilePath);
-                //}
-                //else
-                //{
-                //    MessageBox.Show("序列号" + Sn.Text + "不存在");
-                //}
+                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)
+        {
+
+        }
     }
     }
-}
+}

+ 16 - 1
UAS_MES_ZDXW/FunctionCode/Query/Query_SOP.resx

@@ -117,7 +117,22 @@
   <resheader name="writer">
   <resheader name="writer">
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
   </resheader>
-  <metadata name="folderBrowserDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+  <metadata name="ChoosePath.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>17, 17</value>
     <value>17, 17</value>
   </metadata>
   </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>
 </root>

+ 46 - 0
UAS_MES_ZDXW/PublicMethod/BaseUtil.cs

@@ -54,6 +54,52 @@ namespace UAS_MES_NEW.PublicMethod
             return data;
             return data;
         }
         }
 
 
+        public static Dictionary<string, object> ToDictionary(string JsonData)
+        {
+            object Data = null;
+            Dictionary<string, object> Dic = new Dictionary<string, object>();
+            if (JsonData.StartsWith("["))
+            {
+                //如果目标直接就为数组类型,则将会直接输出一个Key为List的List<Dictionary<string, object>>集合 
+                //使用示例List<Dictionary<string, object>> ListDic = (List<Dictionary<string, object>>)Dic["List"]; 
+                List<Dictionary<string, object>> List = new List<Dictionary<string, object>>();
+                MatchCollection ListMatch = Regex.Matches(JsonData, @"{[\s\S]+?}");//使用正则表达式匹配出JSON数组 
+                foreach (Match ListItem in ListMatch)
+                {
+                    List.Add(ToDictionary(ListItem.ToString()));//递归调用 
+                }
+                Data = List;
+                Dic.Add("List", Data);
+            }
+            else
+            {
+                MatchCollection Match = Regex.Matches(JsonData, @"""(.+?)"": {0,1}(\[[\s\S]+?\]|null|"".+?""|-{0,1}\d*)");//使用正则表达式匹配出JSON数据中的键与值 
+                foreach (Match item in Match)
+                {
+                    try
+                    {
+                        if (item.Groups[2].ToString().StartsWith("["))
+                        {
+                            //如果目标是数组,将会输出一个Key为当前Json的List<Dictionary<string, object>>集合 
+                            //使用示例List<Dictionary<string, object>> ListDic = (List<Dictionary<string, object>>)Dic["Json中的Key"]; 
+                            List<Dictionary<string, object>> List = new List<Dictionary<string, object>>();
+                            MatchCollection ListMatch = Regex.Matches(item.Groups[2].ToString(), @"{[\s\S]+?}");//使用正则表达式匹配出JSON数组 
+                            foreach (Match ListItem in ListMatch)
+                            {
+                                List.Add(ToDictionary(ListItem.ToString()));//递归调用 
+                            }
+                            Data = List;
+                        }
+                        else if (item.Groups[2].ToString().ToLower() == "null") Data = null;//如果数据为null(字符串类型),直接转换成null
+                        else Data = item.Groups[2].ToString(); //数据为数字、字符串中的一类,直接写入 
+                        Dic.Add(item.Groups[1].ToString(), Data);
+                    }
+                    catch { }
+                }
+            }
+            return Dic;
+        }
+
         public static string DToAny(double DB, int Type, string char_out)
         public static string DToAny(double DB, int Type, string char_out)
         {
         {
             string H = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
             string H = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";

+ 189 - 0
UAS_MES_ZDXW/PublicMethod/TcpServer.cs

@@ -0,0 +1,189 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+using UAS_MES_NEW.Query;
+
+namespace UAS_MES_NEW.PublicMethod
+{
+
+    public class TcpServer
+    {
+        //端口号
+        private int SocketServerPort = 8800;
+        //处理连接请求的线程
+        private Thread acceptConnectReqThd;
+
+        List<Socket> socket = new List<Socket>();
+
+        Socket socketWatch;
+
+        bool Watching;
+
+        RichTextBox OperatResult;
+        DataGridView dgv;
+
+        public bool Start()
+        {
+            try
+            {
+                //创建一个socket对象
+                socketWatch = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                //获取IP
+                IPAddress ip = IPAddress.Any;
+                //创建端口号
+                IPEndPoint port = new IPEndPoint(ip, SocketServerPort);
+                //监听
+                socketWatch.Bind(port);
+                Console.WriteLine("监听成功");
+                socketWatch.Listen(200);  //设定最大的挂起长度
+
+                //新建线程来处理连接请求
+                acceptConnectReqThd = new Thread(AcceptConnectReqHandler);
+                acceptConnectReqThd.IsBackground = true;
+                acceptConnectReqThd.Start(socketWatch);  //把socket对象当做参数传递给到线程里面的方法
+                foreach (Form openForm in Application.OpenForms)
+                {
+                    if (openForm is Query_SOP)
+                    {
+                        form = openForm;
+                    }
+                }
+                OperatResult = (RichTextBox)form.Controls["OperatResult"];
+                dgv = (DataGridView)form.Controls["SendDGV"];
+                return true;
+            }
+            catch (Exception)
+            {
+                return false;
+            }
+        }
+
+        private void AcceptConnectReqHandler(object _socket)
+        {
+            try
+            {
+                //服务端的socket对象
+                Socket serverSocket = (Socket)_socket;
+                Watching = true;
+                while (Watching)
+                {
+                    //获取客户端socket。Accept方法处理任何传入的连接请求,并返回可用于与远程主机通信数据的Socket对象,即客户端的socket。
+                    //这一句话会卡主线程。只要没有新的链接进来,就会一直卡主不动(等待中)。
+                    //收到连接事件后,会往下执行,通过while又回到这里继续等待
+                    Socket clientSocket = serverSocket.Accept();
+                    socket.Add(clientSocket);
+                    //创建接受客户端消息的线程
+                    Thread acceptMsgReqThd = new Thread(ReciveMsgReqHandler);
+                    acceptMsgReqThd.IsBackground = true;
+                    acceptMsgReqThd.Start(clientSocket);
+                }
+            }
+            catch (Exception e)
+            {
+                Console.WriteLine("服务端处理连接事件异常:" + e.ToString());
+            }
+        }
+        Form form = null;
+        private void ReciveMsgReqHandler(object _socket)
+        {
+            Socket clientSocket = (Socket)_socket;
+            try
+            {
+                while (true)
+                {
+                    //客户端连接成功后,接受来自客户端的消息
+                    if (clientSocket == null)
+                    {
+                        continue;
+                    }
+                    byte[] buffer = new byte[1024];  //数据缓冲区。
+                    //实际接收到的有效字节数
+                    //Receive也是个卡线程的方法
+                    //Console.WriteLine("等待接受客户端的数据:");
+                    //OperatResult.AppendText("等待接受客户端的数据,"+ clientSocket+ "\n");
+                    Console.WriteLine("等待接受客户端的数:");
+                    int dataLength = clientSocket.Receive(buffer);
+                    Console.WriteLine("接受到客户端的数据,字节数:" + dataLength);
+                    //OperatResult.AppendText("接受到客户端的数据,字节数:" + dataLength);
+                    //如果客户端关闭,发送的数据就为空,就跳出循环
+                    if (dataLength == 0)
+                    {
+                        break;
+                    }
+                    //假设收到的是个字符串(先这么假定),转成字符串处理
+                    string strMsg = Encoding.UTF8.GetString(buffer, 0, dataLength);
+                    Console.WriteLine("接受到客户端的消息:" + strMsg);
+                    for (int i = 0; i < dgv.Rows.Count; i++)
+                    {
+                        if (dgv.Rows[i].Cells["fp_name"].Value.ToString().Replace(".jpg", "") == strMsg.Replace("成功", ""))
+                        {
+                            Console.WriteLine(dgv.Rows[i].Cells["fp_name"].Value.ToString().Replace(".jpg", "") + strMsg.Replace("成功", ""));
+                            dgv.Rows[i].Cells["issend"].Value = "发送成功";
+                        }
+                    }
+                    OperatResult.AppendText("接受到客户端的消息:" + strMsg);
+                }
+                //中止当前线程
+                //Thread.CurrentThread.Abort();
+            }
+            catch (Exception e)
+            {
+                SocketException socketExp = e as SocketException;
+                if (socketExp != null && socketExp.NativeErrorCode == 10054)
+                {
+                    Console.WriteLine("socket客户端关闭:" + e.ToString());
+                }
+                else
+                {
+                    Console.WriteLine("======接受消息异常:" + e.ToString());
+                }
+                //中止当前线程
+                Thread.CurrentThread.Abort();
+            }
+        }
+
+        public void Send(string Command)
+        {
+            try
+            {
+                Console.WriteLine(Command);
+                foreach (Socket item in socket)
+                {
+                    item.Send(Encoding.Default.GetBytes(Command));
+                }
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine(ex.Message);
+            }
+        }
+
+        public void Stop()
+        {
+            //acceptConnectReqThd.Interrupt();
+            //acceptConnectReqThd.Abort();
+            //foreach (Socket item in socket)
+            //{
+            //    item.Disconnect(true);
+            //    item.Close();
+            //}
+            try
+            {
+                Watching = false;
+                socketWatch.Close();
+                socketWatch = null;
+                socket.Clear();
+            }
+            catch (Exception ex)
+            {
+                Console.WriteLine(ex.Message + ex.StackTrace);
+            }
+        }
+    }
+}

BIN
UAS_MES_ZDXW/Tool/Aspose.Cells.dll


BIN
UAS_MES_ZDXW/Tool/Spire.XLS.dll


+ 17 - 9
UAS_MES_ZDXW/UAS_MES_ZDXW.csproj

@@ -76,6 +76,9 @@
     <StartupObject>UAS_MES_NEW.Program</StartupObject>
     <StartupObject>UAS_MES_NEW.Program</StartupObject>
   </PropertyGroup>
   </PropertyGroup>
   <ItemGroup>
   <ItemGroup>
+    <Reference Include="Aspose.Cells">
+      <HintPath>Tool\Aspose.Cells.dll</HintPath>
+    </Reference>
     <Reference Include="DevComponents.DotNetBar2, Version=6.7.2.0, Culture=neutral, PublicKeyToken=bd7258ab2241255c, processorArchitecture=MSIL">
     <Reference Include="DevComponents.DotNetBar2, Version=6.7.2.0, Culture=neutral, PublicKeyToken=bd7258ab2241255c, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>
       <SpecificVersion>False</SpecificVersion>
       <HintPath>Tool\DevComponents.DotNetBar2.dll</HintPath>
       <HintPath>Tool\DevComponents.DotNetBar2.dll</HintPath>
@@ -161,6 +164,9 @@
       <SpecificVersion>False</SpecificVersion>
       <SpecificVersion>False</SpecificVersion>
       <HintPath>Tool\Seagull.BarTender.Print.dll</HintPath>
       <HintPath>Tool\Seagull.BarTender.Print.dll</HintPath>
     </Reference>
     </Reference>
+    <Reference Include="Spire.XLS">
+      <HintPath>Tool\Spire.XLS.dll</HintPath>
+    </Reference>
     <Reference Include="System" />
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
     <Reference Include="System.Core" />
@@ -168,6 +174,7 @@
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Web" />
     <Reference Include="System.Web" />
+    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Web.Services" />
     <Reference Include="System.Web.Services" />
     <Reference Include="System.Windows.Forms.DataVisualization" />
     <Reference Include="System.Windows.Forms.DataVisualization" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Xml.Linq" />
@@ -946,18 +953,18 @@
     <Compile Include="FunctionCode\Query\Query_SN.Designer.cs">
     <Compile Include="FunctionCode\Query\Query_SN.Designer.cs">
       <DependentUpon>Query_SN.cs</DependentUpon>
       <DependentUpon>Query_SN.cs</DependentUpon>
     </Compile>
     </Compile>
-    <Compile Include="FunctionCode\Query\Query_SOP.cs">
-      <SubType>Form</SubType>
-    </Compile>
-    <Compile Include="FunctionCode\Query\Query_SOP.Designer.cs">
-      <DependentUpon>Query_SOP.cs</DependentUpon>
-    </Compile>
     <Compile Include="FunctionCode\Query\Query_SpecialReport.cs">
     <Compile Include="FunctionCode\Query\Query_SpecialReport.cs">
       <SubType>Form</SubType>
       <SubType>Form</SubType>
     </Compile>
     </Compile>
     <Compile Include="FunctionCode\Query\Query_SpecialReport.Designer.cs">
     <Compile Include="FunctionCode\Query\Query_SpecialReport.Designer.cs">
       <DependentUpon>Query_SpecialReport.cs</DependentUpon>
       <DependentUpon>Query_SpecialReport.cs</DependentUpon>
     </Compile>
     </Compile>
+    <Compile Include="FunctionCode\Query\Query_SOP.cs">
+      <SubType>Form</SubType>
+    </Compile>
+    <Compile Include="FunctionCode\Query\Query_SOP.Designer.cs">
+      <DependentUpon>Query_SOP.cs</DependentUpon>
+    </Compile>
     <Compile Include="FunctionCode\SMT\SMT_ChangeLine.cs">
     <Compile Include="FunctionCode\SMT\SMT_ChangeLine.cs">
       <SubType>Form</SubType>
       <SubType>Form</SubType>
     </Compile>
     </Compile>
@@ -1213,6 +1220,7 @@
     <Compile Include="PublicMethod\ModeBusTCPServer.cs" />
     <Compile Include="PublicMethod\ModeBusTCPServer.cs" />
     <Compile Include="PublicMethod\Print.cs" />
     <Compile Include="PublicMethod\Print.cs" />
     <Compile Include="PublicMethod\ReadDataFromSerialPort.cs" />
     <Compile Include="PublicMethod\ReadDataFromSerialPort.cs" />
+    <Compile Include="PublicMethod\TcpServer.cs" />
     <EmbeddedResource Include="CustomControl\AccordionMenu\AccordionMenu.resx">
     <EmbeddedResource Include="CustomControl\AccordionMenu\AccordionMenu.resx">
       <DependentUpon>AccordionMenu.cs</DependentUpon>
       <DependentUpon>AccordionMenu.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>
@@ -1549,12 +1557,12 @@
     <EmbeddedResource Include="FunctionCode\Query\Query_SN.resx">
     <EmbeddedResource Include="FunctionCode\Query\Query_SN.resx">
       <DependentUpon>Query_SN.cs</DependentUpon>
       <DependentUpon>Query_SN.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>
-    <EmbeddedResource Include="FunctionCode\Query\Query_SOP.resx">
-      <DependentUpon>Query_SOP.cs</DependentUpon>
-    </EmbeddedResource>
     <EmbeddedResource Include="FunctionCode\Query\Query_SpecialReport.resx">
     <EmbeddedResource Include="FunctionCode\Query\Query_SpecialReport.resx">
       <DependentUpon>Query_SpecialReport.cs</DependentUpon>
       <DependentUpon>Query_SpecialReport.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>
+    <EmbeddedResource Include="FunctionCode\Query\Query_SOP.resx">
+      <DependentUpon>Query_SOP.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FunctionCode\SMT\SMT_ChangeLine.resx">
     <EmbeddedResource Include="FunctionCode\SMT\SMT_ChangeLine.resx">
       <DependentUpon>SMT_ChangeLine.cs</DependentUpon>
       <DependentUpon>SMT_ChangeLine.cs</DependentUpon>
     </EmbeddedResource>
     </EmbeddedResource>