ソースを参照

Merge branch 'master' of ssh://10.10.100.21/source/mes-client

Hcsy 8 年 前
コミット
10e90ab531

+ 5 - 2
UAS-MES/FunctionCode/Make/Make_NewMatainInf.cs

@@ -194,10 +194,13 @@ namespace UAS_MES.Make
                 }
                 string mbccomponent = GetListViewSelectedItemText(mbc_component_lsv, 0);
                 string nrgcode = GetListViewSelectedItemText(nrg_name_lsv, 0);
+                string nrgname = GetListViewSelectedItemText(nrg_name_lsv, 1);
                 string nrcode = GetListViewSelectedItemText(nr_name_lsv, 0);
                 string nrname = GetListViewSelectedItemText(nr_name_lsv, 1);
                 string mbrdutycode = GetListViewSelectedItemText(mbr_dutycode_lsv, 0);
+                string mbrdutyname = GetListViewSelectedItemText(mbr_dutycode_lsv, 1);
                 string mbrsolutioncode = GetListViewSelectedItemText(mbr_solutioncode_lsv, 0);
+                string mbrsolutionname = GetListViewSelectedItemText(mbr_solutioncode_lsv, 1);
                 dt = (DataTable)dh.ExecuteSql("select ms_makecode from makeserial where ms_id='" + msid + "' and ms_sncode='" + sncode + "' and (ms_status=3 or ms_reworkstatus=3) ", "select");
                 if (dt.Rows.Count > 0)
                 {
@@ -230,9 +233,9 @@ namespace UAS_MES.Make
                         sql.Clear();
                         sql.Append("insert into makebadreason (mbr_mbid,mbr_id,mbr_brcode,mbr_solutioncode,");
                         sql.Append("mbr_dutycode,mbr_brgcode,mbr_badcode,mbr_sncode,mbr_makecode,mbr_indate,");
-                        sql.Append("mbr_inman) select '" + mbid + "','" + mbr_id + "','" + nrcode + "',");
+                        sql.Append("mbr_inman,mbr_brname,mbr_solutionname,mbr_badname,mbr_brgname,mbr_dutyname) select '" + mbid + "','" + mbr_id + "','" + nrcode + "',");
                         sql.Append("'" + mbrsolutioncode + "','" + mbrdutycode + "','" + nrgcode + "','" + bccode + "',");
-                        sql.Append("'" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "' from dual");
+                        sql.Append("'" + sncode + "','" + macode + "',sysdate,'" + User.UserCode + "','" + nrname + "','" + mbrsolutionname + "','" + bc_name.Text + "','" + nrgname + "','" + mbrdutyname + "' from dual");
                         dh.ExecuteSql(sql.GetString(), "insert");
                     }
                 }

+ 7 - 4
UAS-MES/FunctionCode/OQC/OQC_PlanMaintain.cs

@@ -202,13 +202,16 @@ namespace UAS_MES.OQC
         {
             if (al_code.Text != "" || ob_maxngacceptqty.Text != "")
             {
-                if (Checkob_maxngacceptqty())
+                if (dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno='" + ob_checkno.Text + "'").ToString() == "UNCHECK")
                 {
-                    SaveConfiguration_Click(sender, e);
+                    if (Checkob_maxngacceptqty())
+                    {
+                        SaveConfiguration_Click(sender, e);
+                    }
                 }
+                else OperateResult.AppendText(">>送检批次必须为待检验状态\n", Color.Red);
             }
-            else
-                OperateResult.AppendText(">>AQL和最大不合格允许通过数至少填写一个\n", Color.Red);
+            else OperateResult.AppendText(">>AQL和最大不合格允许通过数至少填写一个\n", Color.Red);
         }
 
         //对于最大不合格允通过数的校验

+ 136 - 0
UAS-MES/PublicMethod/ModeBusTCPServer.cs

@@ -0,0 +1,136 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Text;
+using System.Threading;
+using System.Windows.Forms;
+
+namespace UAS_MES.PublicMethod
+{
+    class ModeBusTCPServer
+    {
+        //M501指令OK,M502指令OK
+        byte[] M501_ON = new byte[] { 0x00, 0x05, 0x11, 0xF5, 0xFF, 0x00, 0x98, 0xE5 };
+        byte[] M501_OFF = new byte[] { 0x00, 0x05, 0x11, 0xF5, 0x00, 0x00, 0xD9, 0x15 };
+        byte[] M502_ON = new byte[] { 0x00, 0x05, 0x11, 0xF6, 0xFF, 0x00, 0x68, 0xE5 };
+        byte[] M502_OFF = new byte[] { 0x00, 0x05, 0x11, 0xF6, 0x00, 0x00, 0x29, 0x15 };
+
+        private bool isOpen = false;
+
+        Thread threadWatch = null; //负责监听客户端的线程
+        Socket socketWatch = null; //负责监听客户端的套接字
+        List<Socket> socConnections = new List<Socket>();  //创建一个负责和客户端通信的套接字 
+        List<Thread> dictThread = new List<Thread>();
+        string ip = "";
+        string port = "";
+
+        public bool IsOpen
+        {
+            get
+            {
+                return isOpen;
+            }
+
+            set
+            {
+                isOpen = value;
+            }
+        }
+
+        public ModeBusTCPServer(string IP, string Port)
+        {
+            ip = IP;
+            port = Port;
+        }
+
+        public void Open()
+        {
+            try
+            {
+                //定义一个套接字用于监听客户端发来的信息  包含3个参数(IP4寻址协议,流式连接,TCP协议)
+                socketWatch = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+                //服务端发送信息 需要1个IP地址和端口号
+                IPAddress ipaddress = IPAddress.Parse(ip);
+                //将IP地址和端口号绑定到网络节点endpoint上 
+                IPEndPoint endpoint = new IPEndPoint(ipaddress, int.Parse(port));
+                //监听绑定的网络节点
+                socketWatch.Bind(endpoint);
+                //将套接字的监听队列长度限制为20
+                socketWatch.Listen(20);
+                //创建一个监听线程 
+                threadWatch = new Thread(WatchConnecting);
+                //将窗体线程设置为与后台同步
+                threadWatch.IsBackground = true;
+                //启动线程
+                threadWatch.Start();
+                isOpen = true;
+            }
+            catch (Exception e)
+            {
+                MessageBox.Show(e.Message);
+            }
+        }
+
+        private void WatchConnecting()
+        {
+            while (true)  //持续不断监听客户端发来的请求
+            {
+                Socket socConnection = socketWatch.Accept();
+                //创建一个通信线程 
+                ParameterizedThreadStart pts = new ParameterizedThreadStart(ServerRecMsg);
+                Thread thr = new Thread(pts);
+                thr.IsBackground = true;
+                socConnections.Add(socConnection);
+                //启动线程
+                thr.Start(socConnection);
+                dictThread.Add(thr);
+            }
+        }
+
+        public void Close()
+        {
+            threadWatch.Abort();
+            socketWatch.Close();
+            isOpen = false;
+        }
+
+        private void ServerRecMsg(object obj)
+        {
+            Socket soc = obj as Socket;
+            byte[] data = new byte[1024];
+            soc.Receive(data);
+            int length = data[5];
+            byte[] datashow = new byte[length + 6];
+            for (int i = 0; i <= length + 5; i++)
+                datashow[i] = data[i];
+            string stringdata = BitConverter.ToString(datashow);//把数组转换成16进制字符串
+            Console.WriteLine(stringdata);
+        }
+
+        public void SendOrder(string Code)
+        {
+            foreach (Socket socConnection in socConnections)
+            {
+                switch (Code)
+                {
+                    case "M501_ON":
+                        socConnection.Send(M501_ON);
+                        break;
+                    case "M501_OFF":
+                        socConnection.Send(M501_OFF);
+                        break;
+                    case "M502_ON":
+                        socConnection.Send(M502_ON);
+                        break;
+                    case "M502_OFF":
+                        socConnection.Send(M502_OFF);
+                        break;
+                    default:
+                        break;
+                }
+            }
+        }
+    }
+}

+ 7 - 2
UAS_AutoPass/AutoAnalysisXml.cs

@@ -408,13 +408,18 @@ namespace UAS_AutoPass
 
         private void RecordBadInfo(string sncode, string makecode, string filename, string combine, string[] badcode, string[] badlocation)
         {
+            string[] ID = dh.GetSEQ("makebad_seq", badcode.Length);
             sql.Clear();
             sql.Append("insert into makebad(mb_id,mb_makecode,mb_mscode,mb_sncode,mb_inman,mb_indate,mb_stepcode");
-            sql.Append(",mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_status,mb_badremark) select makebad_seq.nextval");
+            sql.Append(",mb_sourcecode,mb_badcode,mb_bgcode,mb_badtable,mb_status,mb_badremark) select :ID");
             sql.Append(",ma_code,ms_code,ms_sncode,'" + iusercode + "',sysdate,'" + istepcode + "','" + isource + "',");
             sql.Append(":bc_code,'" + ibadgroup + "','','0',:location from make left join makeSerial on ms_makecode=ma_code ");
             sql.Append("where ms_sncode='" + sncode + "' and ms_makecode='" + makecode + "'");
-            dh.BatchInsert(sql.ToString(), new string[] { "bc_code", "location" }, badcode, badlocation);
+            dh.BatchInsert(sql.ToString(), new string[] {"ID", "bc_code", "location" }, ID, badcode, badlocation);
+            sql.Clear();
+            sql.Append("update makebad set mb_badname=(select DISTINCT bc_name from badcode where bc_code=mb_badcode),mb_bgname=(select DISTINCT bg_name from badgroup where bg_code=mb_bgcode) ");
+            sql.Append("where mb_id=:ID");
+            dh.BatchInsert(sql.ToString(), new string[] { "ID" }, ID);
             //记录判断日志
             if (dh.getFieldDataByCondition("source", "sc_scantype", "sc_code='" + isource + "'").ToString() == "REJUCE")
             {

+ 13 - 11
UAS_AutoPass/Form2.Designer.cs

@@ -40,23 +40,23 @@
             this.label1.BackColor = System.Drawing.SystemColors.Menu;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.label1.ForeColor = System.Drawing.Color.Black;
-            this.label1.Location = new System.Drawing.Point(10, 8);
-            this.label1.MaximumSize = new System.Drawing.Size(300, 0);
+            this.label1.Location = new System.Drawing.Point(13, 10);
+            this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.label1.MaximumSize = new System.Drawing.Size(400, 0);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(0, 21);
+            this.label1.Size = new System.Drawing.Size(0, 27);
             this.label1.TabIndex = 0;
             // 
             // checkBox1
             // 
             this.checkBox1.AutoSize = true;
             this.checkBox1.BackColor = System.Drawing.SystemColors.Menu;
-            this.checkBox1.Checked = true;
-            this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
             this.checkBox1.Font = new System.Drawing.Font("宋体", 7.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.checkBox1.ForeColor = System.Drawing.Color.Black;
-            this.checkBox1.Location = new System.Drawing.Point(10, 54);
+            this.checkBox1.Location = new System.Drawing.Point(13, 68);
+            this.checkBox1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.checkBox1.Name = "checkBox1";
-            this.checkBox1.Size = new System.Drawing.Size(84, 14);
+            this.checkBox1.Size = new System.Drawing.Size(107, 17);
             this.checkBox1.TabIndex = 1;
             this.checkBox1.Text = "是否自动隐藏";
             this.checkBox1.UseVisualStyleBackColor = false;
@@ -66,9 +66,10 @@
             // 
             this.panel1.Controls.Add(this.checkBox1);
             this.panel1.Controls.Add(this.label1);
-            this.panel1.Location = new System.Drawing.Point(2, 0);
+            this.panel1.Location = new System.Drawing.Point(3, 0);
+            this.panel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.panel1.Name = "panel1";
-            this.panel1.Size = new System.Drawing.Size(310, 73);
+            this.panel1.Size = new System.Drawing.Size(413, 91);
             this.panel1.TabIndex = 2;
             this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
             this.panel1.MouseEnter += new System.EventHandler(this.Form2_MouseEnter);
@@ -76,13 +77,14 @@
             // 
             // Tip
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.BackColor = System.Drawing.SystemColors.Menu;
-            this.ClientSize = new System.Drawing.Size(312, 78);
+            this.ClientSize = new System.Drawing.Size(416, 98);
             this.Controls.Add(this.panel1);
             this.ForeColor = System.Drawing.Color.White;
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
+            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
             this.Name = "Tip";
             this.Text = "Form2";
             this.TopMost = true;