Jelajahi Sumber

SOP修改内容提交

callm 1 tahun lalu
induk
melakukan
11b970af27

+ 69 - 25
FileWatcher/AutoMakeQTY.Designer.cs

@@ -36,7 +36,6 @@
             this.OperateResult = new System.Windows.Forms.RichTextBox();
             this.Clean = new System.Windows.Forms.Button();
             this.MakeCode_lable = new System.Windows.Forms.Label();
-            this.ma_code = new System.Windows.Forms.TextBox();
             this.Timer = new System.Windows.Forms.Timer(this.components);
             this.ATEFile = new System.IO.FileSystemWatcher();
             this.Type = new System.Windows.Forms.ComboBox();
@@ -45,9 +44,12 @@
             this.label2 = new System.Windows.Forms.Label();
             this.label3 = new System.Windows.Forms.Label();
             this.BaudRate = new System.Windows.Forms.TextBox();
-            this.ComPort = new FileWatcher.SerialPortCombox();
             this.NowQTY = new System.Windows.Forms.TextBox();
             this.label4 = new System.Windows.Forms.Label();
+            this.ComPort = new FileWatcher.SerialPortCombox();
+            this.li_code = new FileWatcher.SearchTextBox();
+            this.label5 = new System.Windows.Forms.Label();
+            this.ma_code = new FileWatcher.SearchTextBox();
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.ATEFile)).BeginInit();
             this.SuspendLayout();
@@ -115,14 +117,6 @@
             this.MakeCode_lable.TabIndex = 12;
             this.MakeCode_lable.Text = "工单号";
             // 
-            // ma_code
-            // 
-            this.ma_code.Location = new System.Drawing.Point(204, 220);
-            this.ma_code.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
-            this.ma_code.Name = "ma_code";
-            this.ma_code.Size = new System.Drawing.Size(436, 35);
-            this.ma_code.TabIndex = 17;
-            // 
             // Timer
             // 
             this.Timer.Interval = 2000;
@@ -141,7 +135,7 @@
             this.Type.Items.AddRange(new object[] {
             "投入",
             "产出"});
-            this.Type.Location = new System.Drawing.Point(204, 317);
+            this.Type.Location = new System.Drawing.Point(204, 366);
             this.Type.Name = "Type";
             this.Type.Size = new System.Drawing.Size(436, 32);
             this.Type.TabIndex = 18;
@@ -150,7 +144,7 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(34, 311);
+            this.label1.Location = new System.Drawing.Point(34, 360);
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(75, 38);
@@ -199,17 +193,9 @@
             this.BaudRate.Size = new System.Drawing.Size(146, 35);
             this.BaudRate.TabIndex = 24;
             // 
-            // ComPort
-            // 
-            this.ComPort.Location = new System.Drawing.Point(204, 120);
-            this.ComPort.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
-            this.ComPort.Name = "ComPort";
-            this.ComPort.Size = new System.Drawing.Size(176, 40);
-            this.ComPort.TabIndex = 21;
-            // 
             // NowQTY
             // 
-            this.NowQTY.Location = new System.Drawing.Point(204, 409);
+            this.NowQTY.Location = new System.Drawing.Point(204, 443);
             this.NowQTY.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
             this.NowQTY.Name = "NowQTY";
             this.NowQTY.Size = new System.Drawing.Size(146, 35);
@@ -219,18 +205,75 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 10.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(34, 406);
+            this.label4.Location = new System.Drawing.Point(34, 440);
             this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(133, 38);
             this.label4.TabIndex = 25;
             this.label4.Text = "当前计数";
             // 
+            // ComPort
+            // 
+            this.ComPort.Location = new System.Drawing.Point(204, 120);
+            this.ComPort.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
+            this.ComPort.Name = "ComPort";
+            this.ComPort.Size = new System.Drawing.Size(176, 40);
+            this.ComPort.TabIndex = 21;
+            // 
+            // 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(204, 291);
+            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(436, 41);
+            this.li_code.TabIndex = 28;
+            this.li_code.TableName = null;
+            this.li_code.TextBoxEnable = false;
+            // 
+            // label5
+            // 
+            this.label5.AutoSize = true;
+            this.label5.Font = new System.Drawing.Font("微软雅黑", 12F);
+            this.label5.Location = new System.Drawing.Point(34, 291);
+            this.label5.Name = "label5";
+            this.label5.Size = new System.Drawing.Size(82, 41);
+            this.label5.TabIndex = 27;
+            this.label5.Text = "线别";
+            // 
+            // ma_code
+            // 
+            this.ma_code.AllPower = null;
+            this.ma_code.Caller = null;
+            this.ma_code.Condition = null;
+            this.ma_code.DBTitle = null;
+            this.ma_code.FormName = null;
+            this.ma_code.Location = new System.Drawing.Point(204, 214);
+            this.ma_code.Name = "ma_code";
+            this.ma_code.Power = null;
+            this.ma_code.ReturnData = null;
+            this.ma_code.SelectField = null;
+            this.ma_code.SetValueField = null;
+            this.ma_code.Size = new System.Drawing.Size(436, 41);
+            this.ma_code.TabIndex = 29;
+            this.ma_code.TableName = null;
+            this.ma_code.TextBoxEnable = false;
+            // 
             // AutoMakeQTY
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1443, 640);
+            this.Controls.Add(this.ma_code);
+            this.Controls.Add(this.li_code);
+            this.Controls.Add(this.label5);
             this.Controls.Add(this.NowQTY);
             this.Controls.Add(this.label4);
             this.Controls.Add(this.BaudRate);
@@ -240,7 +283,6 @@
             this.Controls.Add(this.AutoStart);
             this.Controls.Add(this.label1);
             this.Controls.Add(this.Type);
-            this.Controls.Add(this.ma_code);
             this.Controls.Add(this.MakeCode_lable);
             this.Controls.Add(this.Clean);
             this.Controls.Add(this.OperateResult);
@@ -254,7 +296,7 @@
             this.Load += new System.EventHandler(this.Form1_Load);
             ((System.ComponentModel.ISupportInitialize)(this.XmlWatcher)).EndInit();
             ((System.ComponentModel.ISupportInitialize)(this.ATEFile)).EndInit();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }
@@ -268,7 +310,6 @@
         private System.Windows.Forms.RichTextBox OperateResult;
         private System.Windows.Forms.Button Clean;
         private System.Windows.Forms.Label MakeCode_lable;
-        private System.Windows.Forms.TextBox ma_code;
         private System.Windows.Forms.Timer Timer;
         private System.IO.FileSystemWatcher ATEFile;
         private System.Windows.Forms.ComboBox Type;
@@ -280,6 +321,9 @@
         private System.Windows.Forms.TextBox BaudRate;
         private System.Windows.Forms.TextBox NowQTY;
         private System.Windows.Forms.Label label4;
+        private SearchTextBox li_code;
+        private System.Windows.Forms.Label label5;
+        private SearchTextBox ma_code;
     }
 }
 

+ 78 - 8
FileWatcher/AutoMakeQTY.cs

@@ -56,8 +56,14 @@ namespace FileWatcher
             InitializeComponent();
             StartPosition = FormStartPosition.CenterScreen;
         }
+        DataTable Dbfind;
 
         string IPAddress = "";
+        private void nr_rule_DBChange(object sender, EventArgs e)
+        {
+            Dbfind = li_code.ReturnData;
+            BaseUtil.SetFormValue(this.Controls, Dbfind);
+        }
 
         private void Form1_Load(object sender, EventArgs e)
         {
@@ -86,26 +92,74 @@ namespace FileWatcher
                 BaudRate.Text = BaseUtil.GetCacheData("BaudRate").ToString();
             }
             catch (Exception ex) { MessageBox.Show(ex.Message); }
-        }
 
+
+        }
+        double lastqty = 0;
         private void SerialPort1_DataReceived(object sender, SerialDataReceivedEventArgs e)
         {
             int len = serialPort1.BytesToRead;
             Byte[] readBuffer = new Byte[len];
             serialPort1.Read(readBuffer, 0, len); //将数据读入缓存
             string data = BitConverter.ToString(readBuffer, 0, readBuffer.Length).Replace("-", "");
-            double Num1 = double.Parse(data.Substring(8, 2)) * 10000;
-            double Num2 = double.Parse(data.Substring(10, 2)) * 1000;
-            double Num3 = double.Parse(data.Substring(12, 2)) * 100;
-            double Num4 = double.Parse(data.Substring(14, 2)) * 10;
-            double Num5 = double.Parse(data.Substring(16, 2));
-            double qty = Num1 + Num2 + Num3 + Num4 + Num5;
-            NowQTY.Text = qty.ToString();
+
+            //Convert.ToInt32(data.Substring(6, 8), 16);
+            //Console.WriteLine(data.Substring(6, 2));
+            //double Num1 = double.Parse(data.Substring(8, 2)) * 10000;
+            //Console.WriteLine(data.Substring(8, 2));
+            //double Num2 = double.Parse(data.Substring(10, 2)) * 1000;
+            //Console.WriteLine(data.Substring(10, 2));
+            //double Num3 = double.Parse(data.Substring(12, 2)) * 100;
+            //Console.WriteLine(data.Substring(12, 2));
+            //double Num4 = double.Parse(data.Substring(14, 2)) * 10;
+            //Console.WriteLine(data.Substring(14, 2));
+            //double Num5 = double.Parse(data.Substring(16, 2));
+            if (data != "")
+            {
+                double qty = Convert.ToInt32(data.Substring(6, 8), 16);
+                if (lastqty > qty)
+                {
+                    lastqty = 0;
+                }
+                NowQTY.Text = qty.ToString();
+                if (Type.Text == "投入")
+                {
+                    string ma_inqty = dh.getFieldDataByCondition("make", "nvl(ma_inqty,0)", "ma_code='" + ma_code.Text + "'").ToString();
+                    dh.ExecuteSql("update make set ma_inqty=nvl(ma_inqty,0)+'" + (qty - lastqty) + "' where ma_code='" + ma_code.Text + "' ", "update");
+                    dh.ExecuteSql("insert into makehourcount(mhc_id,mhc_macode,mhc_indate,mhc_type,mhc_qty,mhc_linecode)" +
+                        "values(makehourcount_seq.nextval,'" + ma_code.Text + "',sysdate,'" + Type.Text + "','" + (qty - lastqty) + "','" + li_code.Text + "')", "insert");
+                }
+                else
+                {
+                    string ma_endqty = dh.getFieldDataByCondition("make", "nvl(ma_endqty,0)", "ma_code='" + ma_code.Text + "'").ToString();
+                    dh.ExecuteSql("update make set ma_endqty=nvl(ma_endqty,0)+'" + (qty - lastqty) + "' where ma_code='" + ma_code.Text + "' ", "update");
+                    dh.ExecuteSql("insert into makehourcount(mhc_id,mhc_macode,mhc_indate,mhc_type,mhc_qty,mhc_linecode)" +
+                             "values(makehourcount_seq.nextval,'" + ma_code.Text + "',sysdate,'" + Type.Text + "','" + (qty - lastqty) + "'),'" + li_code.Text + "'", "insert");
+                }
+                lastqty = qty;
+            }
         }
 
         private void ConnectDB()
         {
             dh = new DataHelper();
+            SystemInf.dh = dh;
+
+            ma_code.TableName = "make";
+            ma_code.SelectField = "ma_code # 工单号";
+            ma_code.FormName = Name;
+            ma_code.DBTitle = "工单查询";
+            ma_code.SetValueField = new string[] { "ma_code" };
+            ma_code.Condition = "";
+            ma_code.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;
         }
         SerialPort serialPort1 = new SerialPort();
 
@@ -116,6 +170,21 @@ namespace FileWatcher
             BaseUtil.SetCacheData("Type", Type.Text);
             BaseUtil.SetCacheData("ComPort", ComPort.Text);
             BaseUtil.SetCacheData("BaudRate", BaudRate.Text);
+            if (!dh.CheckExist("Make", "ma_code='" + ma_code.Text + "'"))
+            {
+                OperateResult.AppendText("工单号不能为空\n");
+                return;
+            }
+            if (!dh.CheckExist("line", "li_code='" + li_code.Text + "'"))
+            {
+                OperateResult.AppendText("线别不能为空\n");
+                return;
+            }
+            string ExitConfirm = MessageBox.Show(this, "确认计数器是否置为0?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+            if (ExitConfirm != "Yes")
+            {
+                return;
+            }
             //设置按钮不可点击
             StartWatch.Enabled = false;
             ma_code.Enabled = false;
@@ -133,6 +202,7 @@ namespace FileWatcher
                 else
                     OperateResult.AppendText(">>" + mes.Message + "\n");
             }
+
             OperateResult.AppendText("开始执行监控\n");
             Timer.Start();
         }

+ 7 - 2
FileWatcher/DataHelper.cs

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

+ 1 - 1
FileWatcher/Program.cs

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

+ 46 - 22
FileWatcher/SOP.Designer.cs

@@ -46,11 +46,13 @@
             this.SendDGV = new System.Windows.Forms.DataGridView();
             this.ChooseALL = new System.Windows.Forms.Button();
             this.ps_prodcode = new FileWatcher.SearchTextBox();
+            this.li_code = new FileWatcher.SearchTextBox();
+            this.GetSOP = new System.Windows.Forms.Button();
             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.li_code = new FileWatcher.SearchTextBox();
             ((System.ComponentModel.ISupportInitialize)(this.SendDGV)).BeginInit();
             this.SuspendLayout();
             // 
@@ -108,7 +110,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F);
-            this.label2.Location = new System.Drawing.Point(19, 356);
+            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;
@@ -210,6 +212,7 @@
             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";
@@ -235,7 +238,7 @@
             this.ps_prodcode.Condition = null;
             this.ps_prodcode.DBTitle = null;
             this.ps_prodcode.FormName = null;
-            this.ps_prodcode.Location = new System.Drawing.Point(216, 356);
+            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;
@@ -247,6 +250,34 @@
             this.ps_prodcode.TextBoxEnable = false;
             this.ps_prodcode.UserControlTextChanged += new FileWatcher.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);
+            // 
             // CheckColumn
             // 
             this.CheckColumn.DataPropertyName = "CheckColumn";
@@ -271,6 +302,14 @@
             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";
@@ -280,29 +319,12 @@
             this.issend.Visible = false;
             this.issend.Width = 200;
             // 
-            // 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;
-            // 
             // 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);
@@ -351,10 +373,12 @@
         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;
-        private SearchTextBox li_code;
     }
 }

+ 28 - 9
FileWatcher/SOP.cs

@@ -116,6 +116,20 @@ namespace FileWatcher
                 {
                     Directory.CreateDirectory(Application.StartupPath + @"\" + ps_prodcode.Text);
                 }
+                string sheetname = sheet.Name;
+                sheetname = sheetname.Replace("01", "1");
+                sheetname = sheetname.Replace("02", "2");
+                sheetname = sheetname.Replace("03", "3");
+                sheetname = sheetname.Replace("04", "4");
+                sheetname = sheetname.Replace("05", "5");
+                sheetname = sheetname.Replace("06", "6");
+                sheetname = sheetname.Replace("07", "7");
+                sheetname = sheetname.Replace("08", "8");
+                sheetname = sheetname.Replace("09", "9");
+                //if (sheetname.Contains("-"))
+                //{
+                //    sheetname = sheetname.Split('-')[0];
+                //}
                 int width = 0;
                 int height = 0;
                 //Console.WriteLine(sheet.Name);
@@ -141,17 +155,17 @@ namespace FileWatcher
                 imgOptions.PrintingPage = PrintingPageType.IgnoreBlank;
                 imgOptions.SetDesiredSize(1565, 1043);
                 SheetRender sr = new SheetRender((Aspose.Cells.Worksheet)sheet, imgOptions);
-                sr.ToImage(0, Application.StartupPath + @"\" + ps_prodcode.Text + @"\" + sheet.Name + ".jpg");
+                sr.ToImage(0, Application.StartupPath + @"\" + ps_prodcode.Text + @"\" + sheetname + ".jpg");
                 //// 创建一个图片
-                OperatResult.AppendText("解析图片【" + sheet.Name + ".jpg】" + "\n");
+                OperatResult.AppendText("解析图片【" + sheetname + ".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://113.98.196.181:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + ps_prodcode.Text + @"\" + sheet.Name + ".jpg", dic);
+                OperatResult.AppendText("上传文件【" + sheetname + ".jpg" + "】\n");
+                string fp_id = UploadFilesToRemoteUrl("http://113.98.196.181:8099/mes/MEScommon/uploadFiles.action?_noc=1", Application.StartupPath + @"\" + ps_prodcode.Text + @"\" + sheetname + ".jpg", 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,'" + sheet.Name + ".jpg" + ";" + fp_id + "' from ProductSOP where ps_prodcode='" + ps_prodcode.Text + "'", "insert");
+                dh.ExecuteSql("insert into ProductSOPdetail(psd_id,psd_psid,psd_attach) select ProductSOPdetail_seq.nextval,ps_id,'" + sheetname + ".jpg" + ";" + fp_id + "' from ProductSOP where ps_prodcode='" + ps_prodcode.Text + "'", "insert");
                 //if (fp_id != "")
                 //{
                 //    dh.ExecuteSql("update ProductSOP set ps_attachsop=ps_attachsop||" + fp_id + "||';' where ps_prodcode='" + pr_code.Text + "'", "update");
@@ -321,8 +335,8 @@ namespace FileWatcher
                             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)" +
-                          "values(soprelease_seq.nextval,'" + li_code.Text + "','" + path + "',0,'" + ps_prodcode.Text + "','" + SendDGV.Rows[i].Cells["fp_name"].Value.ToString().Replace(" ", "").Replace("(", "").Replace(")", "") + "') ", "insert");
+                            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, "");
@@ -377,7 +391,7 @@ namespace FileWatcher
             if (dt.Rows.Count > 0)
             {
                 string ps_id = dt.Rows[0]["ps_id"].ToString();
-                dt = (DataTable)dh.ExecuteSql("select fp_name,fp_path,'' issend from ProductSOPdetail left join " +
+                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)
                 {
@@ -388,7 +402,7 @@ namespace FileWatcher
 
         private void pr_code_Leave(object sender, EventArgs e)
         {
-            LoadPrCode();
+            //LoadPrCode();
         }
 
         bool AllChecked = false;
@@ -412,5 +426,10 @@ namespace FileWatcher
         {
             LoadPrCode();
         }
+
+        private void GetSOP_Click(object sender, EventArgs e)
+        {
+            LoadPrCode();
+        }
     }
 }

+ 3 - 0
FileWatcher/SOP.resx

@@ -129,6 +129,9 @@
   <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>

+ 7 - 6
FileWatcher/SearchTextBox.Designer.cs

@@ -38,14 +38,15 @@ namespace FileWatcher
             // Search_Icon
             // 
             this.Search_Icon.AllPower = null;
+            this.Search_Icon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
             this.Search_Icon.Cursor = System.Windows.Forms.Cursors.Hand;
-            this.Search_Icon.Dock = System.Windows.Forms.DockStyle.Right;
             this.Search_Icon.ErrorImage = global::FileWatcher.Properties.Resources.preview_16px_25980_easyicon_net;
             this.Search_Icon.Image = global::FileWatcher.Properties.Resources.preview_16px_25980_easyicon_net;
-            this.Search_Icon.Location = new System.Drawing.Point(183, 0);
+            this.Search_Icon.Location = new System.Drawing.Point(370, 0);
             this.Search_Icon.Name = "Search_Icon";
             this.Search_Icon.Power = "";
-            this.Search_Icon.Size = new System.Drawing.Size(21, 21);
+            this.Search_Icon.Size = new System.Drawing.Size(53, 35);
+            this.Search_Icon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
             this.Search_Icon.TabIndex = 1;
             this.Search_Icon.TabStop = false;
             this.Search_Icon.Click += new System.EventHandler(this.Search_Icon_Click);
@@ -59,7 +60,7 @@ namespace FileWatcher
             this.TextBox.Location = new System.Drawing.Point(0, 0);
             this.TextBox.Name = "TextBox";
             this.TextBox.Power = null;
-            this.TextBox.Size = new System.Drawing.Size(178, 35);
+            this.TextBox.Size = new System.Drawing.Size(364, 35);
             this.TextBox.Str = null;
             this.TextBox.Str1 = null;
             this.TextBox.Str2 = null;
@@ -74,11 +75,11 @@ namespace FileWatcher
             this.Controls.Add(this.Search_Icon);
             this.Controls.Add(this.TextBox);
             this.Name = "SearchTextBox";
-            this.Size = new System.Drawing.Size(204, 21);
+            this.Size = new System.Drawing.Size(426, 42);
             this.Load += new System.EventHandler(this.SearchTextBox_Load);
             this.SizeChanged += new System.EventHandler(this.SearchTextBox_SizeChanged);
             ((System.ComponentModel.ISupportInitialize)(this.Search_Icon)).EndInit();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
             this.PerformLayout();
 
         }

+ 1 - 1
FileWatcher/SerialPortCombox.Designer.cs

@@ -51,7 +51,7 @@
             this.Name = "SerialPortCombox";
             this.Size = new System.Drawing.Size(279, 40);
             this.Load += new System.EventHandler(this.SerialPortCombox_Load);
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
 
         }