瀏覽代碼

数据库地址修改

callm 5 月之前
父節點
當前提交
116c450eb6

+ 1 - 1
UAS_MES_BG/App.config

@@ -78,7 +78,7 @@
   <applicationSettings>
     <UAS_MES_NEW.Properties.Settings>
       <setting name="MES" serializeAs="String">
-        <value>Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.208)(PORT=11717)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</value>
+        <value>Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.92)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</value>
       </setting>
     </UAS_MES_NEW.Properties.Settings>
     <UAS_MES.Properties.Settings>

+ 387 - 0
UAS_MES_BG/FunctionCode/Query/Query_SOP.Designer.cs

@@ -0,0 +1,387 @@
+using UAS_MES_NEW.CustomControl.TextBoxWithIcon;
+
+namespace UAS_MES_NEW.Query
+{
+    partial class Query_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.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.pr_spec = new System.Windows.Forms.RichTextBox();
+            this.label5 = new System.Windows.Forms.Label();
+            this.SendDGV = new System.Windows.Forms.DataGridView();
+            this.CheckColumn = new System.Windows.Forms.DataGridViewCheckBoxColumn();
+            this.fp_name = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.fp_path = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.psd_iskey = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.issend = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.ChooseALL = new System.Windows.Forms.Button();
+            this.ps_prodcode = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.li_code = new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox();
+            this.GetSOP = new System.Windows.Forms.Button();
+            ((System.ComponentModel.ISupportInitialize)(this.SendDGV)).BeginInit();
+            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, 666);
+            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, 666);
+            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);
+            // 
+            // label2
+            // 
+            this.label2.AutoSize = true;
+            this.label2.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.label2.Location = new System.Drawing.Point(19, 311);
+            this.label2.Name = "label2";
+            this.label2.Size = new System.Drawing.Size(82, 41);
+            this.label2.TabIndex = 10;
+            this.label2.Text = "机型";
+            // 
+            // OperatResult
+            // 
+            this.OperatResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.OperatResult.Location = new System.Drawing.Point(865, 841);
+            this.OperatResult.Name = "OperatResult";
+            this.OperatResult.Size = new System.Drawing.Size(1068, 381);
+            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, 666);
+            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, 22);
+            this.label3.Name = "label3";
+            this.label3.Size = new System.Drawing.Size(146, 41);
+            this.label3.TabIndex = 14;
+            this.label3.Text = "产品名称";
+            this.label3.Visible = false;
+            // 
+            // label4
+            // 
+            this.label4.AutoSize = true;
+            this.label4.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.label4.Location = new System.Drawing.Point(19, 115);
+            this.label4.Name = "label4";
+            this.label4.Size = new System.Drawing.Size(146, 41);
+            this.label4.TabIndex = 15;
+            this.label4.Text = "产品规格";
+            this.label4.Visible = false;
+            // 
+            // 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, 22);
+            this.pr_detail.Name = "pr_detail";
+            this.pr_detail.Size = new System.Drawing.Size(0, 41);
+            this.pr_detail.TabIndex = 16;
+            this.pr_detail.Visible = false;
+            // 
+            // 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;
+            // 
+            // pr_spec
+            // 
+            this.pr_spec.Enabled = false;
+            this.pr_spec.Location = new System.Drawing.Point(218, 123);
+            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 = "";
+            this.pr_spec.Visible = false;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.label5.Location = new System.Drawing.Point(19, 580);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(82, 41);
+            this.label5.TabIndex = 20;
+            this.label5.Text = "线别";
+            // 
+            // SendDGV
+            // 
+            this.SendDGV.AllowUserToAddRows = false;
+            this.SendDGV.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+            this.SendDGV.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.SendDGV.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
+            this.CheckColumn,
+            this.fp_name,
+            this.fp_path,
+            this.psd_iskey,
+            this.issend});
+            this.SendDGV.Location = new System.Drawing.Point(865, 61);
+            this.SendDGV.Name = "SendDGV";
+            this.SendDGV.RowHeadersWidth = 82;
+            this.SendDGV.RowTemplate.Height = 37;
+            this.SendDGV.Size = new System.Drawing.Size(1068, 759);
+            this.SendDGV.TabIndex = 22;
+            // 
+            // CheckColumn
+            // 
+            this.CheckColumn.DataPropertyName = "CheckColumn";
+            this.CheckColumn.HeaderText = "勾选";
+            this.CheckColumn.MinimumWidth = 100;
+            this.CheckColumn.Name = "CheckColumn";
+            this.CheckColumn.Width = 200;
+            // 
+            // fp_name
+            // 
+            this.fp_name.DataPropertyName = "fp_name";
+            this.fp_name.HeaderText = "文件名";
+            this.fp_name.MinimumWidth = 10;
+            this.fp_name.Name = "fp_name";
+            this.fp_name.Width = 200;
+            // 
+            // fp_path
+            // 
+            this.fp_path.DataPropertyName = "fp_path";
+            this.fp_path.HeaderText = "路径";
+            this.fp_path.MinimumWidth = 10;
+            this.fp_path.Name = "fp_path";
+            this.fp_path.Width = 200;
+            // 
+            // psd_iskey
+            // 
+            this.psd_iskey.DataPropertyName = "psd_iskey";
+            this.psd_iskey.HeaderText = "是否关键工序";
+            this.psd_iskey.MinimumWidth = 10;
+            this.psd_iskey.Name = "psd_iskey";
+            this.psd_iskey.Width = 200;
+            // 
+            // issend
+            // 
+            this.issend.DataPropertyName = "issend";
+            this.issend.HeaderText = "是否成功发送";
+            this.issend.MinimumWidth = 10;
+            this.issend.Name = "issend";
+            this.issend.Visible = false;
+            this.issend.Width = 200;
+            // 
+            // ChooseALL
+            // 
+            this.ChooseALL.Location = new System.Drawing.Point(865, 61);
+            this.ChooseALL.Name = "ChooseALL";
+            this.ChooseALL.Size = new System.Drawing.Size(80, 42);
+            this.ChooseALL.TabIndex = 23;
+            this.ChooseALL.Text = "全选";
+            this.ChooseALL.UseVisualStyleBackColor = true;
+            this.ChooseALL.Click += new System.EventHandler(this.ChooseALL_Click);
+            // 
+            // ps_prodcode
+            // 
+            this.ps_prodcode.AllPower = null;
+            this.ps_prodcode.Caller = null;
+            this.ps_prodcode.Condition = null;
+            this.ps_prodcode.DBTitle = null;
+            this.ps_prodcode.FormName = null;
+            this.ps_prodcode.Location = new System.Drawing.Point(216, 311);
+            this.ps_prodcode.Name = "ps_prodcode";
+            this.ps_prodcode.Power = null;
+            this.ps_prodcode.ReturnData = null;
+            this.ps_prodcode.SelectField = null;
+            this.ps_prodcode.SetValueField = null;
+            this.ps_prodcode.Size = new System.Drawing.Size(582, 41);
+            this.ps_prodcode.TabIndex = 24;
+            this.ps_prodcode.TableName = null;
+            this.ps_prodcode.TextBoxEnable = false;
+            this.ps_prodcode.UserControlTextChanged += new UAS_MES_NEW.CustomControl.TextBoxWithIcon.SearchTextBox.OnTextChange(this.ps_prodcode_UserControlTextChanged);
+            // 
+            // li_code
+            // 
+            this.li_code.AllPower = null;
+            this.li_code.Caller = null;
+            this.li_code.Condition = null;
+            this.li_code.DBTitle = null;
+            this.li_code.FormName = null;
+            this.li_code.Location = new System.Drawing.Point(218, 580);
+            this.li_code.Name = "li_code";
+            this.li_code.Power = null;
+            this.li_code.ReturnData = null;
+            this.li_code.SelectField = null;
+            this.li_code.SetValueField = null;
+            this.li_code.Size = new System.Drawing.Size(582, 41);
+            this.li_code.TabIndex = 25;
+            this.li_code.TableName = null;
+            this.li_code.TextBoxEnable = false;
+            // 
+            // GetSOP
+            // 
+            this.GetSOP.Location = new System.Drawing.Point(638, 379);
+            this.GetSOP.Name = "GetSOP";
+            this.GetSOP.Size = new System.Drawing.Size(160, 42);
+            this.GetSOP.TabIndex = 26;
+            this.GetSOP.Text = "获取SOP";
+            this.GetSOP.UseVisualStyleBackColor = true;
+            this.GetSOP.Click += new System.EventHandler(this.GetSOP_Click);
+            // 
+            // Query_SOP
+            // 
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+            this.ClientSize = new System.Drawing.Size(1945, 1234);
+            this.Controls.Add(this.GetSOP);
+            this.Controls.Add(this.li_code);
+            this.Controls.Add(this.ps_prodcode);
+            this.Controls.Add(this.ChooseALL);
+            this.Controls.Add(this.SendDGV);
+            this.Controls.Add(this.label5);
+            this.Controls.Add(this.pr_spec);
+            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.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.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Name = "Query_SOP";
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
+            this.Text = "SOP管理";
+            this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
+            this.Load += new System.EventHandler(this.Form3_Load);
+            ((System.ComponentModel.ISupportInitialize)(this.SendDGV)).EndInit();
+            this.ResumeLayout(true);
+            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.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.RichTextBox pr_spec;
+        private System.Windows.Forms.Label label5;
+        private System.Windows.Forms.DataGridView SendDGV;
+        private System.Windows.Forms.Button ChooseALL;
+        private SearchTextBox ps_prodcode;
+        private SearchTextBox li_code;
+        private System.Windows.Forms.Button GetSOP;
+        private System.Windows.Forms.DataGridViewCheckBoxColumn CheckColumn;
+        private System.Windows.Forms.DataGridViewTextBoxColumn fp_name;
+        private System.Windows.Forms.DataGridViewTextBoxColumn fp_path;
+        private System.Windows.Forms.DataGridViewTextBoxColumn psd_iskey;
+        private System.Windows.Forms.DataGridViewTextBoxColumn issend;
+    }
+}

+ 460 - 0
UAS_MES_BG/FunctionCode/Query/Query_SOP.cs

@@ -0,0 +1,460 @@
+using System;
+using System.IO;
+using System.Text;
+using System.Windows.Forms;
+using System.Net;
+using System.Collections.Generic;
+using System.Threading;
+using System.Data;
+using System.Drawing.Imaging;
+using System.Drawing;
+using UAS_MES_NEW.Entity;
+using UAS_MES_NEW.PublicMethod;
+using Aspose.Cells;
+using UAS_MES_NEW.DataOperate;
+using UAS_MES_NEW.PublicForm;
+using Aspose.Cells.Drawing;
+using Aspose.Cells.Rendering;
+using System.Web.Script.Serialization;
+
+namespace UAS_MES_NEW.Query
+{
+    public partial class Query_SOP : Form
+    {
+        DataHelper dh;
+
+        string usercode;
+        string sourcecode;
+        DataTable Dbfind;
+
+        public Query_SOP()
+        {
+            usercode = "";
+            sourcecode = "";
+            InitializeComponent();
+        }
+
+        private void Form3_Load(object sender, EventArgs e)
+        {
+            CheckForIllegalCrossThreadCalls = false;
+
+            ps_prodcode.TableName = "productsop";
+            ps_prodcode.SelectField = "ps_prodcode # SOP编号";
+            ps_prodcode.FormName = Name;
+            ps_prodcode.DBTitle = "SOP查询";
+            ps_prodcode.SetValueField = new string[] { "ps_prodcode" };
+            ps_prodcode.Condition = "";
+            ps_prodcode.DbChange += nr_rule_DBChange;
+
+            li_code.TableName = "line";
+            li_code.SelectField = "li_code # 线别编号,li_name # 线别名称";
+            li_code.FormName = Name;
+            li_code.DBTitle = "线别查询";
+            li_code.SetValueField = new string[] { "li_code" };
+            li_code.Condition = "";
+            li_code.DbChange += nr_rule_DBChange;
+            dh = SystemInf.dh;
+        }
+
+        private void nr_rule_DBChange(object sender, EventArgs e)
+        {
+            Dbfind = ps_prodcode.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+        }
+
+
+        void uploadfile()
+        {
+            if (FilePath.Text == "")
+            {
+                MessageBox.Show("文件不能为空!");
+                return;
+            }
+            ps_prodcode.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 ps_prodcode='" + ps_prodcode.Text + "' ", "select");
+            if (dt.Rows.Count == 0)
+            {
+                string code = LogicHandler.GetPiInoutCode("ProductSOP", "1");
+                dh.ExecuteSql("insert into productsop(ps_id,ps_code,ps_prodcode,ps_indate,ps_inman,ps_status,ps_statuscode)values(productsop_seq.nextval,'" + code + "','" + ps_prodcode.Text + "',sysdate,'" + usercode + "','在录入','ENTERING')", "insert");
+            }
+            else
+            {
+                string ps_id = dt.Rows[0]["ps_id"].ToString();
+                dh.ExecuteSql("delete from ProductSOPdetail where psd_psid='" + ps_id + "'", "delete");
+                ps_prodcode.Text = dt.Rows[0]["ps_prodcode"].ToString();
+            }
+
+            Workbook workbook = new Workbook(FilePath.Text);
+            List<Worksheet> list = new List<Worksheet>();
+            List<string> filename = new List<string>();
+            dh.ExecuteSql("update ProductSOP set ps_attachsop='' where ps_prodcode='" + ps_prodcode.Text + "'", "update");
+            OperatResult.AppendText("一共Sheet: " + workbook.Worksheets.Count + "\n");
+            //try
+            //{
+            for (int i = 0; i < workbook.Worksheets.Count; i++)
+            {
+                if (workbook.Worksheets[i].Name != "物料清单")
+                {
+                    OperatResult.AppendText("正在解析Sheet" + workbook.Worksheets[i].Name + "\n");
+                    Worksheet she = workbook.Worksheets[i];
+                    if (JPG.Checked)
+                    {
+                        var myThread = new Thread(() => SaveFileToJPG(she));
+                        myThread.Start();
+                        filename.Add(she.Name + ".jpg");
+                    }
+                }
+            }
+            //}
+            //catch (Exception ex)
+            //{
+            //    OperatResult.AppendText(ex.Message + "\n");
+            //}
+        }
+
+        private void SaveFileToJPG(Worksheet sheet)
+        {
+            try
+            {
+                //OperatResult.AppendText("解析图片【" + sheet.Name + ".jpg】添加水印" + "\n");
+                if (!Directory.Exists(Application.StartupPath + @"\" + ps_prodcode.Text))
+                {
+                    Directory.CreateDirectory(Application.StartupPath + @"\" + ps_prodcode.Text);
+                }
+                string sheetname = sheet.Name;
+                ProcessWorksheet(sheet, Application.StartupPath + @"\" + ps_prodcode.Text + @"\");
+            }
+            catch (Exception ex)
+            {
+                OperatResult.AppendText(ex.Message + ex.StackTrace);
+            }
+        }
+
+        /// <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", "上传失败", ps_prodcode.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【图片格式】", "上传成功", ps_prodcode.Text, "");
+            }
+            else
+            {
+                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "上传SOP【PDF格式】", "上传成功", ps_prodcode.Text, "");
+            }
+        }
+
+        private void OperatResult_TextChanged(object sender, EventArgs e)
+        {
+            //OperatResult.SelectionStart = Text.Length;
+            OperatResult.ScrollToCaret();
+        }
+
+
+
+        private void SendSop_Click(object sender, EventArgs e)
+        {
+            try
+            {
+                if (li_code.Text == "" || ps_prodcode.Text == "")
+                {
+                    MessageBox.Show("线别和SOP文档不能为空");
+                    return;
+                }
+                if (SendDGV.Rows.Count > 0)
+                {
+                    List<Dictionary<string, string>> listr = new List<Dictionary<string, string>>();
+                    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 < SendDGV.Rows.Count; i++)
+                    {
+                        if (SendDGV.Rows[i].Cells["CheckColumn"].FormattedValue.ToString().ToUpper() == "TRUE")
+                        {
+                            Dictionary<string, string> dic1 = new Dictionary<string, string>();
+                            path = SendDGV.Rows[i].Cells["fp_path"].Value.ToString();
+                            path = encryptBASE64(path.Replace("/app/uas/webapps/postattach", pathroot)).Replace("\\s*|\r|\n|\t", "");
+                            dic1.Add("path", path);
+                            dic1.Add("filename", SendDGV.Rows[i].Cells["fp_name"].Value.ToString().Replace(" ", "").Replace("(", "").Replace(")", ""));
+                            dic1.Add("ps_prodcode", ps_prodcode.Text);
+                            listr.Add(dic1);
+                            dh.ExecuteSql("insert into soprelease(SR_ID, SR_LINECODE, SR_PATH, SR_STATUS, SR_MACHINETYPE, SR_FILENAME,sr_ifkeyset)" +
+                          "values(soprelease_seq.nextval,'" + li_code.Text + "','" + path + "',0,'" + ps_prodcode.Text + "','" + SendDGV.Rows[i].Cells["fp_name"].Value.ToString().Replace(" ", "").Replace("(", "").Replace(")", "") + "','" + SendDGV.Rows[i].Cells["psd_iskey"].Value + "') ", "insert");
+                        }
+                    }
+                    LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播成功", ps_prodcode.Text, "");
+                    MessageBox.Show("文档[" + ps_prodcode.Text + "]下放成功");
+                }
+                else
+                {
+                    MessageBox.Show("产品编号" + ps_prodcode.Text + "未维护SOP文档");
+                    LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败,未维护SOP文档", ps_prodcode.Text, "");
+                }
+            }
+            catch (Exception ex)
+            {
+                LogicHandler.DoCommandLog("SOP", usercode, "", "", sourcecode, "广播SOP", "广播失败", ps_prodcode.Text, "");
+                Console.WriteLine(ex.Message + ex.StackTrace);
+            }
+        }
+
+        public string encryptBASE64(string key)
+        {
+            Console.WriteLine(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 * from productsop where ps_prodcode='" + ps_prodcode.Text + "'", "select");
+            if (dt.Rows.Count > 0)
+            {
+                string ps_id = dt.Rows[0]["ps_id"].ToString();
+                dt = (DataTable)dh.ExecuteSql("select fp_name,fp_path,'' issend,psd_iskey from ProductSOPdetail left join " +
+                    "filepath on FP_ID=substr(PSD_ATTACH,instr(PSD_ATTACH,';')+1)  where psd_psid=" + ps_id, "select");
+                if (dt.Rows.Count > 0)
+                {
+                    SendDGV.DataSource = dt;
+                }
+            }
+        }
+
+        private void pr_code_Leave(object sender, EventArgs e)
+        {
+            //LoadPrCode();
+        }
+
+        bool AllChecked = false;
+        private void ChooseALL_Click(object sender, EventArgs e)
+        {
+            if (AllChecked)
+            {
+                foreach (DataGridViewRow dr in SendDGV.Rows)
+                    dr.Cells[0].Value = false;
+                AllChecked = false;
+            }
+            else
+            {
+                foreach (DataGridViewRow dr in SendDGV.Rows)
+                    dr.Cells[0].Value = true;
+                AllChecked = true;
+            }
+        }
+
+        private void ProcessWorksheet(Worksheet worksheet, string outputFolder)
+        {
+            // 获取工作表中的所有图片
+            List<Picture> pictures = new List<Picture>();
+            foreach (Aspose.Cells.Drawing.Picture picture in worksheet.Pictures)
+            {
+                pictures.Add(picture);
+            }
+
+            // 获取使用的行数
+            int totalRows = worksheet.Cells.MaxDataRow + 1;
+            int imageIndex = 1;
+
+            // 每30行生成一张图片
+            for (int startRow = 0; startRow < totalRows; startRow += 30)
+            {
+                int endRow = Math.Min(startRow + 29, totalRows - 1);
+
+                // 创建图片选项
+                ImageOrPrintOptions options = new ImageOrPrintOptions();
+                options.ImageFormat = ImageFormat.Png;
+                options.OnePagePerSheet = false;
+                options.PrintingPage = PrintingPageType.IgnoreBlank;
+
+                worksheet.PageSetup.PrintArea = $"A{startRow + 1}:AC{endRow + 1}";
+                // 设置只渲染指定的行范围
+
+                // 创建SheetRender对象
+                SheetRender sr = new SheetRender(worksheet, options);
+
+                string imagename = $"{worksheet.Name}_{imageIndex}.png";
+                // 获取渲染后的图像
+                Bitmap bitmap = sr.ToImage(0);
+                string imagePath = "";
+                // 如果有图片在当前行范围内,将它们添加到最终图像中
+                if (pictures.Count > 0)
+                {
+                    using (Bitmap finalImage = new Bitmap(bitmap.Width, bitmap.Height))
+                    using (Graphics g = Graphics.FromImage(finalImage))
+                    {
+                        // 绘制Excel内容
+                        g.DrawImage(bitmap, 0, 0);
+
+                        // 绘制原始Excel中的图片
+                        int yOffset = bitmap.Height;
+                        // 保存图像
+                        imagePath = Path.Combine(outputFolder, $"{worksheet.Name}_{imageIndex}.png");
+                        finalImage.Save(imagePath, ImageFormat.Png);
+                        Console.WriteLine($"Saved: {imagePath}");
+                    }
+                }
+                else
+                {
+                    // 如果没有图片,直接保存渲染的图像
+                    imagePath = Path.Combine(outputFolder, $"{worksheet.Name}_{imageIndex}.png");
+                    bitmap.Save(imagePath, ImageFormat.Png);
+                    Console.WriteLine($"Saved: {imagePath}");
+                }
+                imageIndex++;
+                OperatResult.AppendText("解析图片【" + imagePath + ".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("上传文件【" + imagePath + ".jpg" + "】\n");
+                string fp_id = UploadFilesToRemoteUrl("http://120.24.241.233:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + ps_prodcode.Text + @"\" + imagename, dic);
+                string ps_id = dh.getFieldDataByCondition("ProductSOP", "ps_id", "ps_prodcode='" + ps_prodcode.Text + "'").ToString();
+                dh.ExecuteSql("insert into ProductSOPdetail(psd_id,psd_psid,psd_attach) select ProductSOPdetail_seq.nextval,ps_id,'" + imagename + ";" + fp_id + "' from ProductSOP where ps_prodcode='" + ps_prodcode.Text + "'", "insert");
+            }
+        }
+
+        private void ps_prodcode_UserControlTextChanged(object sender, EventArgs e)
+        {
+            LoadPrCode();
+        }
+
+        private void GetSOP_Click(object sender, EventArgs e)
+        {
+            LoadPrCode();
+        }
+    }
+}

+ 138 - 0
UAS_MES_BG/FunctionCode/Query/Query_SOP.resx

@@ -0,0 +1,138 @@
+<?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>

+ 2 - 2
UAS_MES_BG/Login.cs

@@ -89,8 +89,8 @@ namespace UAS_MES_NEW
             //设置选中数据库的链接
             string DBUser = DB.SelectedValue.ToString().Split('#')[0];
             string Address = DB.SelectedValue.ToString().Split('#')[1];
-            //DataHelper.DBConnectionString = "Password=select!#%*(;User ID=" + DBUser + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" + Address + ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
-            DataHelper.DBConnectionString = "Password=select!#%*(;User ID=" + DBUser + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.208)(PORT=11717)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+            DataHelper.DBConnectionString = "Password=select!#%*(;User ID=" + DBUser + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=" + Address + ")(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
+            //DataHelper.DBConnectionString = "Password=select!#%*(;User ID=" + DBUser + ";Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.208)(PORT=11717)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));";
             SystemInf.CurrentDB = DBUser;
             //设置屏幕的宽高信息
             SystemInf.ScreenWidth = Screen.PrimaryScreen.WorkingArea.Width;

+ 1 - 1
UAS_MES_BG/Properties/Settings.settings

@@ -33,7 +33,7 @@
       <Value Profile="(Default)" />
     </Setting>
     <Setting Name="MES" Type="System.String" Scope="Application">
-      <Value Profile="(Default)">Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.208)(PORT=11717)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</Value>
+      <Value Profile="(Default)">Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=false;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.92)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));</Value>
     </Setting>
   </Settings>
 </SettingsFile>

+ 3 - 3
UAS_MES_BG/Properties/Settings1.Designer.cs

@@ -12,7 +12,7 @@ namespace UAS_MES_NEW.Properties {
     
     
     [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
-    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.8.0.0")]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.6.0.0")]
     internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
         
         private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -146,8 +146,8 @@ namespace UAS_MES_NEW.Properties {
         [global::System.Configuration.ApplicationScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
         [global::System.Configuration.DefaultSettingValueAttribute("Connection Timeout=0;Pooling=false;Password=select!#%*(;User ID=N_MES;Pooling=fal" +
-            "se;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.1.81.2" +
-            "08)(PORT=11717)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));")]
+            "se;Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1" +
+            ".92)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=orcl)));")]
         public string MES {
             get {
                 return ((string)(this["MES"]));

+ 47 - 0
UAS_MES_BG/PublicMethod/BaseUtil.cs

@@ -12,6 +12,7 @@ using System.Net;
 using System.Net.Sockets;
 using System.Reflection;
 using System.Text;
+using System.Text.RegularExpressions;
 using System.Threading;
 using System.Windows.Forms;
 using System.Windows.Forms.DataVisualization.Charting;
@@ -56,6 +57,52 @@ namespace UAS_MES_NEW.PublicMethod
             return selectConetnt.Remove(selectConetnt.Length - 1, 1).ToString();
         }
 
+        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;
+        }
+
         /// <summary>
         /// 禁止DataGirdView排序
         /// </summary>

二進制
UAS_MES_BG/Tool/Aspose.Cells.dll


+ 13 - 1
UAS_MES_BG/UAS_MES_BG.csproj

@@ -76,6 +76,9 @@
     <StartupObject>UAS_MES_NEW.Program</StartupObject>
   </PropertyGroup>
   <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">
       <SpecificVersion>False</SpecificVersion>
       <HintPath>Tool\DevComponents.DotNetBar2.dll</HintPath>
@@ -84,7 +87,6 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>Tool\DevExpress.BonusSkins.v15.2.dll</HintPath>
     </Reference>
-    <Reference Include="DevExpress.Charts.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.DataAccess.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
     <Reference Include="DevExpress.Map.v15.2.Core, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
@@ -158,6 +160,7 @@
     <Reference Include="System.ServiceModel" />
     <Reference Include="System.Speech" />
     <Reference Include="System.Web" />
+    <Reference Include="System.Web.Extensions" />
     <Reference Include="System.Web.Services" />
     <Reference Include="System.Windows.Forms.DataVisualization" />
     <Reference Include="System.Xml.Linq" />
@@ -911,6 +914,12 @@
     <Compile Include="FunctionCode\Query\Query_ProductTraceBack.Designer.cs">
       <DependentUpon>Query_ProductTraceBack.cs</DependentUpon>
     </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">
       <SubType>Form</SubType>
     </Compile>
@@ -1516,6 +1525,9 @@
     <EmbeddedResource Include="FunctionCode\Query\Query_ProductTraceBack.resx">
       <DependentUpon>Query_ProductTraceBack.cs</DependentUpon>
     </EmbeddedResource>
+    <EmbeddedResource Include="FunctionCode\Query\Query_SOP.resx">
+      <DependentUpon>Query_SOP.cs</DependentUpon>
+    </EmbeddedResource>
     <EmbeddedResource Include="FunctionCode\Query\Query_SpecialReport.resx">
       <DependentUpon>Query_SpecialReport.cs</DependentUpon>
     </EmbeddedResource>