Przeglądaj źródła

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

Hcsy 8 lat temu
rodzic
commit
45ac142c92

+ 21 - 38
UAS-MES/Form1.Designer.cs

@@ -32,12 +32,10 @@
             this.button2 = new System.Windows.Forms.Button();
             this.button3 = new System.Windows.Forms.Button();
             this.button4 = new System.Windows.Forms.Button();
-            this.progressBar1 = new System.Windows.Forms.ProgressBar();
-            this.textBoxWithPlaceHolder1 = new UAS_MES.CustomControl.TextBoxWithIcon.TextBoxWithPlaceHolder();
-            this.serialPortCombox1 = new UAS_MES.CustomControl.ComBoxWithFocus.SerialPortCombox();
             this.txtMsg = new System.Windows.Forms.RichTextBox();
             this.txtIP = new System.Windows.Forms.TextBox();
             this.txtPORT = new System.Windows.Forms.TextBox();
+            this.enterTextBox2 = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
             this.SuspendLayout();
             // 
             // button1
@@ -62,12 +60,12 @@
             // 
             // button3
             // 
-            this.button3.Location = new System.Drawing.Point(407, 198);
+            this.button3.Location = new System.Drawing.Point(424, 198);
             this.button3.Margin = new System.Windows.Forms.Padding(4);
             this.button3.Name = "button3";
             this.button3.Size = new System.Drawing.Size(100, 29);
             this.button3.TabIndex = 0;
-            this.button3.Text = "button3";
+            this.button3.Text = "OPEN";
             this.button3.UseVisualStyleBackColor = true;
             this.button3.Click += new System.EventHandler(this.button3_Click_1);
             // 
@@ -78,35 +76,10 @@
             this.button4.Name = "button4";
             this.button4.Size = new System.Drawing.Size(100, 29);
             this.button4.TabIndex = 2;
-            this.button4.Text = "button4";
+            this.button4.Text = "Send";
             this.button4.UseVisualStyleBackColor = true;
             this.button4.Click += new System.EventHandler(this.button4_Click);
             // 
-            // progressBar1
-            // 
-            this.progressBar1.ForeColor = System.Drawing.SystemColors.ControlDarkDark;
-            this.progressBar1.Location = new System.Drawing.Point(288, 112);
-            this.progressBar1.Margin = new System.Windows.Forms.Padding(4);
-            this.progressBar1.Name = "progressBar1";
-            this.progressBar1.Size = new System.Drawing.Size(448, 29);
-            this.progressBar1.TabIndex = 3;
-            // 
-            // textBoxWithPlaceHolder1
-            // 
-            this.textBoxWithPlaceHolder1.BackColor = System.Drawing.Color.White;
-            this.textBoxWithPlaceHolder1.Location = new System.Drawing.Point(697, 198);
-            this.textBoxWithPlaceHolder1.Name = "textBoxWithPlaceHolder1";
-            this.textBoxWithPlaceHolder1.PlaceHolder = "123123";
-            this.textBoxWithPlaceHolder1.Size = new System.Drawing.Size(241, 25);
-            this.textBoxWithPlaceHolder1.TabIndex = 4;
-            // 
-            // serialPortCombox1
-            // 
-            this.serialPortCombox1.Location = new System.Drawing.Point(398, 61);
-            this.serialPortCombox1.Name = "serialPortCombox1";
-            this.serialPortCombox1.Size = new System.Drawing.Size(186, 25);
-            this.serialPortCombox1.TabIndex = 6;
-            // 
             // txtMsg
             // 
             this.txtMsg.Location = new System.Drawing.Point(424, 320);
@@ -129,19 +102,31 @@
             this.txtPORT.Name = "txtPORT";
             this.txtPORT.Size = new System.Drawing.Size(100, 25);
             this.txtPORT.TabIndex = 9;
-            this.txtPORT.Text = "502";
+            this.txtPORT.Text = "8080";
+            // 
+            // enterTextBox2
+            // 
+            this.enterTextBox2.AllPower = null;
+            this.enterTextBox2.BackColor = System.Drawing.Color.White;
+            this.enterTextBox2.ID = null;
+            this.enterTextBox2.Location = new System.Drawing.Point(753, 270);
+            this.enterTextBox2.Name = "enterTextBox2";
+            this.enterTextBox2.Power = null;
+            this.enterTextBox2.Size = new System.Drawing.Size(196, 25);
+            this.enterTextBox2.Str = null;
+            this.enterTextBox2.Str1 = null;
+            this.enterTextBox2.Str2 = null;
+            this.enterTextBox2.TabIndex = 10;
             // 
             // Form1
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1239, 738);
+            this.Controls.Add(this.enterTextBox2);
             this.Controls.Add(this.txtPORT);
             this.Controls.Add(this.txtIP);
             this.Controls.Add(this.txtMsg);
-            this.Controls.Add(this.serialPortCombox1);
-            this.Controls.Add(this.textBoxWithPlaceHolder1);
-            this.Controls.Add(this.progressBar1);
             this.Controls.Add(this.button4);
             this.Controls.Add(this.button3);
             this.Margin = new System.Windows.Forms.Padding(4);
@@ -163,11 +148,9 @@
         private CustomControl.SetLoading.LoadingCircle loadingCircle1;
         private System.Windows.Forms.Button button3;
         private System.Windows.Forms.Button button4;
-        private System.Windows.Forms.ProgressBar progressBar1;
-        private CustomControl.TextBoxWithIcon.TextBoxWithPlaceHolder textBoxWithPlaceHolder1;
-        private CustomControl.ComBoxWithFocus.SerialPortCombox serialPortCombox1;
         private System.Windows.Forms.RichTextBox txtMsg;
         private System.Windows.Forms.TextBox txtIP;
         private System.Windows.Forms.TextBox txtPORT;
+        private CustomControl.TextBoxWithIcon.EnterTextBox enterTextBox2;
     }
 }

+ 7 - 139
UAS-MES/Form1.cs

@@ -31,7 +31,7 @@ namespace UAS_MES
             InitializeComponent();
         }
 
-      
+
 
         private void Form1_Load(object sender, EventArgs e)
         {
@@ -41,7 +41,7 @@ namespace UAS_MES
             //Com.BaudRate = 9600;
             //Com.StopBits = StopBits.One;
             //Com.Parity = Parity.None;
-  
+
         }
 
         [DllImport("WinIo64.dll")]
@@ -71,149 +71,17 @@ namespace UAS_MES
         private static IntPtr state_port = (IntPtr)0x379;    //状态端口地址 S3-S7 只能读取5位  
         private static IntPtr control_port = (IntPtr)0x37A;  //控制端口地址 C0-C3 只能控制或输出4位  
 
-        /// <summary>  
-        /// 设定DataPort输出  
-        /// </summary>  
-        /// <param name="WriteValue">设定值:范围为0~255</param>  
-        private void setDateBuff(int WriteValue)
-        {
-            IntPtr m_nport = data_port;                 //数据端口地址data_port  
-
-            int m_nValue = WriteValue;
-
-            //调用WinIo库函数SetPortVal写端口值  
-            SetPortVal(m_nport, m_nValue, 1);           //write a BYTE value to an I/O port  
-        }
-
-        /// <summary>  
-        /// 设定ControlPort输出  
-        /// 高4位默认设置,请不要修改,因此输出时保持高位值不变,将要输出的值从低4位输出  
-        /// Control端口C2读写正常,C0、C1、C3写入0则输出高电平,写入1输出低电平;读取亦然  
-        /// </summary>  
-        /// <param name="WriteValue">设定值</param>  
-        private void setControlBuff(int WriteValue)
-        {
-            IntPtr m_nport = control_port;              //获得控制端口地址  
-            //获得控制端口的值,  
-            int temp_dwPortVal = 0;
-            GetPortVal(m_nport, out temp_dwPortVal, 1); //reads a BYTE value from an I/O port  
-
-            int temp_aa = temp_dwPortVal & 0xF0;        //将低4位置为0;高4位不变  
-
-            int WriValue = WriteValue & 0x0F;           //取设定值低4位;高4位为0  
-            temp_aa = temp_aa | WriteValue;             //合并端口值高4位与设定值低4位  
-            temp_aa = temp_aa ^ 0x0B;                   //将低4位中C0、C1、C3取反(0->1;1->0)(保证设定值与实际电平相吻合)  
-            SetPortVal(m_nport, temp_aa, 1);            //写出的值中,高4位保持端口原来的值不变,低4位实际输出  
-        }
-
-        /// <summary>  
-        /// 读取ControlPort值  
-        /// Control端口C2读取正常,C0、C1、C3高电平则读入0,低电平则读入1  
-        /// </summary>  
-        /// <returns>返回C0-C3 四个端口的值:范围为0~15</returns>  
-        private int getControlBuff()
-        {
-            IntPtr m_nport = control_port;              //控制端口地址data_port  
-
-            int m_nValue = 0;
-            //调用WinIo库函数SetPortVal写端口值  
-            GetPortVal(m_nport, out m_nValue, 1);      //reads a BYTE value from an I/O port  
-
-            int ValueGet = m_nValue ^ 0x0B;            //将低4位中C0、C1、C3取反(0->1;1->0)  
-            ValueGet = ValueGet & 0x0F;                //去掉高4位值  
-            return ValueGet;
-        }
-
-        /// <summary>  
-        /// 读取StatePort值  
-        /// State端口S7高电平则读入0,低电平则读入1;其他正常  
-        /// </summary>  
-        /// <returns>返回S3-S7 五个端口的值:范围0-31</returns>  
-        private int getStateBuff()
-        {
-            IntPtr m_nport = state_port;               //控制端口地址state_port  
-
-            int dwPortVal = 0;
-            GetPortVal(m_nport, out dwPortVal, 1);    //reads a BYTE value from an I/O port  
-
-            int ValueGet = dwPortVal ^ 0x80;          //将S7取反(保证读取与实际电平相吻合)  
-            ValueGet = ValueGet & 0xF8;               //去掉S0 ~S2位;  
-            ValueGet = ValueGet >> 3;                 //右移3位,将S7~S3变为低5位  
-            return ValueGet;
-        }
-
-        public bool OpenWinIo()
-        {
-            if (InitializeWinIo())
-            {
-                this.online = true;
-                return true;
-            }
-            else
-            {
-                this.online = false;
-                return false;
-            }
-        }
-
-        public void CloseWinIo()
-        {
-            ShutdownWinIo();
-            this.online = false;
-        }
-
-        SerialPort Com = new SerialPort();
-
+        ModeBusTCPServer md;
         private void button3_Click_1(object sender, EventArgs e)
         {
-            //byte[] byteArr = new byte[20];
-            //Com.Write(byteArr, 0, byteArr.Length);
-            //CloseWinIo();
+            md = new ModeBusTCPServer(txtIP.Text, txtPORT.Text);
+            md.Open();
+            txtMsg.AppendText("SUCCESS");
         }
 
-        Thread threadWatch = null; //负责监听客户端的线程
-        Socket socketWatch = null; //负责监听客户端的套接字
-        //创建一个负责和客户端通信的套接字 
-        List<Socket> socConnections = new List<Socket>();
-        List<Thread> dictThread = new List<Thread>();
         private void button4_Click(object sender, EventArgs e)
         {
-            CheckForIllegalCrossThreadCalls = false;
-            //定义一个套接字用于监听客户端发来的信息  包含3个参数(IP4寻址协议,流式连接,TCP协议)
-            socketWatch = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
-            //服务端发送信息 需要1个IP地址和端口号
-            IPAddress ipaddress = IPAddress.Parse(txtIP.Text.Trim()); //获取文本框输入的IP地址
-            //将IP地址和端口号绑定到网络节点endpoint上 
-            IPEndPoint endpoint = new IPEndPoint(ipaddress, int.Parse(txtPORT.Text.Trim())); //获取文本框上输入的端口号
-            //监听绑定的网络节点
-            socketWatch.Bind(endpoint);
-            //将套接字的监听队列长度限制为20
-            socketWatch.Listen(20);
-            //创建一个监听线程 
-            threadWatch = new Thread(WatchConnecting);
-            //将窗体线程设置为与后台同步
-            threadWatch.IsBackground = true;
-            //启动线程
-            threadWatch.Start();
-            //启动线程后 txtMsg文本框显示相应提示
-            txtMsg.AppendText("开始监听客户端传来的信息!" + "\r\n");
-
-        }
-
-        private void WatchConnecting()
-        {
-            while (true)
-            {
-                byte[] data = new byte[1024];
-                socketWatch.Receive(data);
-                int length = data[5];
-                byte[] datashow = new byte[length + 6];
-                Console.WriteLine(data);
-                for (int i = 0; i <= length + 5; i++)
-                    datashow[i] = data[i];
-                string stringdata = BitConverter.ToString(datashow);//把数组转换成16进制字符串
-                Console.WriteLine(stringdata);
-            }
+            md.SendOrder(enterTextBox2.Text);
         }
     }
 }

+ 36 - 36
UAS-MES/FunctionCode/Make/Make_Repair.Designer.cs

@@ -106,7 +106,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ma_craftcode_label.AutoSize = true;
             this.ma_craftcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ma_craftcode_label.Location = new System.Drawing.Point(20, 85);
+            this.ma_craftcode_label.Location = new System.Drawing.Point(20, 84);
             this.ma_craftcode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ma_craftcode_label.Name = "ma_craftcode_label";
             this.ma_craftcode_label.Size = new System.Drawing.Size(92, 27);
@@ -119,7 +119,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.st_rstepcode_label.AutoSize = true;
             this.st_rstepcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.st_rstepcode_label.Location = new System.Drawing.Point(353, 85);
+            this.st_rstepcode_label.Location = new System.Drawing.Point(353, 84);
             this.st_rstepcode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.st_rstepcode_label.Name = "st_rstepcode_label";
             this.st_rstepcode_label.Size = new System.Drawing.Size(92, 27);
@@ -132,7 +132,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_prodcode_label.AutoSize = true;
             this.ms_prodcode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_prodcode_label.Location = new System.Drawing.Point(544, 38);
+            this.ms_prodcode_label.Location = new System.Drawing.Point(544, 37);
             this.ms_prodcode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_prodcode_label.Name = "ms_prodcode_label";
             this.ms_prodcode_label.Size = new System.Drawing.Size(92, 27);
@@ -179,7 +179,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_sncode_label.AutoSize = true;
             this.ms_sncode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_sncode_label.Location = new System.Drawing.Point(20, 36);
+            this.ms_sncode_label.Location = new System.Drawing.Point(20, 35);
             this.ms_sncode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_sncode_label.Name = "ms_sncode_label";
             this.ms_sncode_label.Size = new System.Drawing.Size(72, 27);
@@ -192,7 +192,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_makecode_label.AutoSize = true;
             this.ms_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode_label.Location = new System.Drawing.Point(271, 38);
+            this.ms_makecode_label.Location = new System.Drawing.Point(271, 37);
             this.ms_makecode_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_makecode_label.Name = "ms_makecode_label";
             this.ms_makecode_label.Size = new System.Drawing.Size(72, 27);
@@ -347,7 +347,7 @@
             this.nr_code.AutoSize = true;
             this.nr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.nr_code.ForeColor = System.Drawing.Color.Black;
-            this.nr_code.Location = new System.Drawing.Point(1120, 76);
+            this.nr_code.Location = new System.Drawing.Point(1120, 75);
             this.nr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.nr_code.Name = "nr_code";
             this.nr_code.Size = new System.Drawing.Size(0, 27);
@@ -357,7 +357,7 @@
             // mb_badremark
             // 
             this.mb_badremark.Location = new System.Drawing.Point(977, 179);
-            this.mb_badremark.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
+            this.mb_badremark.Margin = new System.Windows.Forms.Padding(5);
             this.mb_badremark.Name = "mb_badremark";
             this.mb_badremark.Size = new System.Drawing.Size(187, 26);
             this.mb_badremark.TabIndex = 127;
@@ -371,7 +371,7 @@
             this.ms_sncode.AutoSize = true;
             this.ms_sncode.CutLength = null;
             this.ms_sncode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_sncode.Location = new System.Drawing.Point(120, 38);
+            this.ms_sncode.Location = new System.Drawing.Point(120, 37);
             this.ms_sncode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_sncode.MaximumSize = new System.Drawing.Size(200, 0);
             this.ms_sncode.Name = "ms_sncode";
@@ -501,7 +501,7 @@
             this.GetSNCode.BackColor = System.Drawing.Color.White;
             this.GetSNCode.ID = null;
             this.GetSNCode.Location = new System.Drawing.Point(325, 668);
-            this.GetSNCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.GetSNCode.Margin = new System.Windows.Forms.Padding(4);
             this.GetSNCode.Name = "GetSNCode";
             this.GetSNCode.Power = null;
             this.GetSNCode.Size = new System.Drawing.Size(249, 25);
@@ -520,7 +520,7 @@
             this.NewRepairInf.Image = null;
             this.NewRepairInf.IsShowBorder = true;
             this.NewRepairInf.Location = new System.Drawing.Point(367, 616);
-            this.NewRepairInf.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.NewRepairInf.Margin = new System.Windows.Forms.Padding(4);
             this.NewRepairInf.MoveImage = ((System.Drawing.Image)(resources.GetObject("NewRepairInf.MoveImage")));
             this.NewRepairInf.Name = "NewRepairInf";
             this.NewRepairInf.NormalImage = ((System.Drawing.Image)(resources.GetObject("NewRepairInf.NormalImage")));
@@ -540,7 +540,7 @@
             this.SaveRepairInf.Image = null;
             this.SaveRepairInf.IsShowBorder = true;
             this.SaveRepairInf.Location = new System.Drawing.Point(1061, 321);
-            this.SaveRepairInf.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.SaveRepairInf.Margin = new System.Windows.Forms.Padding(4);
             this.SaveRepairInf.MoveImage = ((System.Drawing.Image)(resources.GetObject("SaveRepairInf.MoveImage")));
             this.SaveRepairInf.Name = "SaveRepairInf";
             this.SaveRepairInf.NormalImage = ((System.Drawing.Image)(resources.GetObject("SaveRepairInf.NormalImage")));
@@ -561,7 +561,7 @@
             this.DeleteRepairInf.Image = null;
             this.DeleteRepairInf.IsShowBorder = true;
             this.DeleteRepairInf.Location = new System.Drawing.Point(513, 616);
-            this.DeleteRepairInf.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.DeleteRepairInf.Margin = new System.Windows.Forms.Padding(4);
             this.DeleteRepairInf.MoveImage = ((System.Drawing.Image)(resources.GetObject("DeleteRepairInf.MoveImage")));
             this.DeleteRepairInf.Name = "DeleteRepairInf";
             this.DeleteRepairInf.NormalImage = ((System.Drawing.Image)(resources.GetObject("DeleteRepairInf.NormalImage")));
@@ -581,7 +581,7 @@
             this.mbl_loc.BackColor = System.Drawing.Color.White;
             this.mbl_loc.ID = null;
             this.mbl_loc.Location = new System.Drawing.Point(349, 361);
-            this.mbl_loc.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.mbl_loc.Margin = new System.Windows.Forms.Padding(4);
             this.mbl_loc.Name = "mbl_loc";
             this.mbl_loc.Power = null;
             this.mbl_loc.Size = new System.Drawing.Size(161, 25);
@@ -601,7 +601,7 @@
             this.mbr_solutioncode.Enabled = false;
             this.mbr_solutioncode.ID = null;
             this.mbr_solutioncode.Location = new System.Drawing.Point(669, 286);
-            this.mbr_solutioncode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.mbr_solutioncode.Margin = new System.Windows.Forms.Padding(4);
             this.mbr_solutioncode.Name = "mbr_solutioncode";
             this.mbr_solutioncode.Power = null;
             this.mbr_solutioncode.Size = new System.Drawing.Size(160, 25);
@@ -620,7 +620,7 @@
             this.mbc_component.Enabled = false;
             this.mbc_component.ID = null;
             this.mbc_component.Location = new System.Drawing.Point(349, 288);
-            this.mbc_component.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.mbc_component.Margin = new System.Windows.Forms.Padding(4);
             this.mbc_component.Name = "mbc_component";
             this.mbc_component.Power = null;
             this.mbc_component.Size = new System.Drawing.Size(160, 25);
@@ -639,7 +639,7 @@
             this.mbr_dutycode.Enabled = false;
             this.mbr_dutycode.ID = null;
             this.mbr_dutycode.Location = new System.Drawing.Point(977, 236);
-            this.mbr_dutycode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.mbr_dutycode.Margin = new System.Windows.Forms.Padding(4);
             this.mbr_dutycode.Name = "mbr_dutycode";
             this.mbr_dutycode.Power = null;
             this.mbr_dutycode.Size = new System.Drawing.Size(160, 25);
@@ -658,7 +658,7 @@
             this.nr_name.Enabled = false;
             this.nr_name.ID = null;
             this.nr_name.Location = new System.Drawing.Point(669, 236);
-            this.nr_name.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.nr_name.Margin = new System.Windows.Forms.Padding(4);
             this.nr_name.Name = "nr_name";
             this.nr_name.Power = null;
             this.nr_name.Size = new System.Drawing.Size(160, 25);
@@ -678,7 +678,7 @@
             this.nrg_name.Enabled = false;
             this.nrg_name.ID = null;
             this.nrg_name.Location = new System.Drawing.Point(349, 236);
-            this.nrg_name.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.nrg_name.Margin = new System.Windows.Forms.Padding(4);
             this.nrg_name.Name = "nrg_name";
             this.nrg_name.Power = null;
             this.nrg_name.Size = new System.Drawing.Size(160, 25);
@@ -697,7 +697,7 @@
             this.bc_name.Enabled = false;
             this.bc_name.ID = null;
             this.bc_name.Location = new System.Drawing.Point(669, 179);
-            this.bc_name.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.bc_name.Margin = new System.Windows.Forms.Padding(4);
             this.bc_name.Name = "bc_name";
             this.bc_name.Power = null;
             this.bc_name.Size = new System.Drawing.Size(160, 25);
@@ -717,7 +717,7 @@
             this.bg_name.ForeColor = System.Drawing.Color.Red;
             this.bg_name.ID = null;
             this.bg_name.Location = new System.Drawing.Point(349, 180);
-            this.bg_name.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.bg_name.Margin = new System.Windows.Forms.Padding(4);
             this.bg_name.Name = "bg_name";
             this.bg_name.Power = null;
             this.bg_name.Size = new System.Drawing.Size(160, 25);
@@ -731,7 +731,7 @@
             // 
             this.OperatResult.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.OperatResult.Location = new System.Drawing.Point(977, 359);
-            this.OperatResult.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.OperatResult.Margin = new System.Windows.Forms.Padding(4);
             this.OperatResult.Name = "OperatResult";
             this.OperatResult.Size = new System.Drawing.Size(208, 312);
             this.OperatResult.TabIndex = 87;
@@ -744,7 +744,7 @@
             this.ms_makecode.AutoSize = true;
             this.ms_makecode.CutLength = null;
             this.ms_makecode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_makecode.Location = new System.Drawing.Point(377, 38);
+            this.ms_makecode.Location = new System.Drawing.Point(377, 37);
             this.ms_makecode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_makecode.MaximumSize = new System.Drawing.Size(200, 0);
             this.ms_makecode.Name = "ms_makecode";
@@ -758,7 +758,7 @@
             this.ms_prodcode.AutoSize = true;
             this.ms_prodcode.CutLength = null;
             this.ms_prodcode.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_prodcode.Location = new System.Drawing.Point(672, 38);
+            this.ms_prodcode.Location = new System.Drawing.Point(672, 37);
             this.ms_prodcode.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_prodcode.MaximumSize = new System.Drawing.Size(200, 0);
             this.ms_prodcode.Name = "ms_prodcode";
@@ -773,7 +773,7 @@
             this.pr_detail.AutoSize = true;
             this.pr_detail.CutLength = null;
             this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail.Location = new System.Drawing.Point(977, 38);
+            this.pr_detail.Location = new System.Drawing.Point(977, 37);
             this.pr_detail.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_detail.Name = "pr_detail";
@@ -788,7 +788,7 @@
             this.Clean.Image = null;
             this.Clean.IsShowBorder = true;
             this.Clean.Location = new System.Drawing.Point(1043, 678);
-            this.Clean.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Clean.Margin = new System.Windows.Forms.Padding(4);
             this.Clean.MoveImage = ((System.Drawing.Image)(resources.GetObject("Clean.MoveImage")));
             this.Clean.Name = "Clean";
             this.Clean.NormalImage = ((System.Drawing.Image)(resources.GetObject("Clean.NormalImage")));
@@ -809,7 +809,7 @@
             this.cd_stepcode.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.cd_stepcode.FormName = null;
             this.cd_stepcode.Location = new System.Drawing.Point(475, 86);
-            this.cd_stepcode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.cd_stepcode.Margin = new System.Windows.Forms.Padding(4);
             this.cd_stepcode.Name = "cd_stepcode";
             this.cd_stepcode.Power = "ifspecial";
             this.cd_stepcode.ReturnData = null;
@@ -818,7 +818,7 @@
             this.cd_stepcode.Size = new System.Drawing.Size(200, 28);
             this.cd_stepcode.TabIndex = 68;
             this.cd_stepcode.TableName = null;
-            this.cd_stepcode.Tag = "ms_stepcode";
+            this.cd_stepcode.Tag = "";
             this.cd_stepcode.TextBoxEnable = false;
             // 
             // cr_code
@@ -830,7 +830,7 @@
             this.cr_code.Font = new System.Drawing.Font("微软雅黑", 9F);
             this.cr_code.FormName = null;
             this.cr_code.Location = new System.Drawing.Point(121, 86);
-            this.cr_code.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.cr_code.Margin = new System.Windows.Forms.Padding(4);
             this.cr_code.Name = "cr_code";
             this.cr_code.Power = "ifspecial";
             this.cr_code.ReturnData = null;
@@ -851,7 +851,7 @@
             this.NewBadCode.Image = null;
             this.NewBadCode.IsShowBorder = true;
             this.NewBadCode.Location = new System.Drawing.Point(219, 616);
-            this.NewBadCode.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.NewBadCode.Margin = new System.Windows.Forms.Padding(4);
             this.NewBadCode.MoveImage = ((System.Drawing.Image)(resources.GetObject("NewBadCode.MoveImage")));
             this.NewBadCode.Name = "NewBadCode";
             this.NewBadCode.NormalImage = ((System.Drawing.Image)(resources.GetObject("NewBadCode.NormalImage")));
@@ -872,7 +872,7 @@
             this.SaveBadLocation.Image = null;
             this.SaveBadLocation.IsShowBorder = true;
             this.SaveBadLocation.Location = new System.Drawing.Point(513, 359);
-            this.SaveBadLocation.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.SaveBadLocation.Margin = new System.Windows.Forms.Padding(4);
             this.SaveBadLocation.MoveImage = ((System.Drawing.Image)(resources.GetObject("SaveBadLocation.MoveImage")));
             this.SaveBadLocation.Name = "SaveBadLocation";
             this.SaveBadLocation.NormalImage = ((System.Drawing.Image)(resources.GetObject("SaveBadLocation.NormalImage")));
@@ -893,7 +893,7 @@
             this.Scrap.Image = null;
             this.Scrap.IsShowBorder = true;
             this.Scrap.Location = new System.Drawing.Point(841, 82);
-            this.Scrap.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Scrap.Margin = new System.Windows.Forms.Padding(4);
             this.Scrap.MoveImage = ((System.Drawing.Image)(resources.GetObject("Scrap.MoveImage")));
             this.Scrap.Name = "Scrap";
             this.Scrap.NormalImage = ((System.Drawing.Image)(resources.GetObject("Scrap.NormalImage")));
@@ -914,7 +914,7 @@
             this.RepairComplete.Image = null;
             this.RepairComplete.IsShowBorder = true;
             this.RepairComplete.Location = new System.Drawing.Point(715, 82);
-            this.RepairComplete.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.RepairComplete.Margin = new System.Windows.Forms.Padding(4);
             this.RepairComplete.MoveImage = ((System.Drawing.Image)(resources.GetObject("RepairComplete.MoveImage")));
             this.RepairComplete.Name = "RepairComplete";
             this.RepairComplete.NormalImage = ((System.Drawing.Image)(resources.GetObject("RepairComplete.NormalImage")));
@@ -932,7 +932,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.pr_detail_label.AutoSize = true;
             this.pr_detail_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail_label.Location = new System.Drawing.Point(849, 38);
+            this.pr_detail_label.Location = new System.Drawing.Point(849, 37);
             this.pr_detail_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail_label.Name = "pr_detail_label";
             this.pr_detail_label.Size = new System.Drawing.Size(92, 27);
@@ -945,7 +945,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_checkno.AutoSize = true;
             this.ms_checkno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_checkno.Location = new System.Drawing.Point(1055, 36);
+            this.ms_checkno.Location = new System.Drawing.Point(1055, 35);
             this.ms_checkno.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_checkno.Name = "ms_checkno";
             this.ms_checkno.Size = new System.Drawing.Size(92, 27);
@@ -959,7 +959,7 @@
             | System.Windows.Forms.AnchorStyles.Left)));
             this.ms_reworkcheckno.AutoSize = true;
             this.ms_reworkcheckno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ms_reworkcheckno.Location = new System.Drawing.Point(1057, 76);
+            this.ms_reworkcheckno.Location = new System.Drawing.Point(1057, 75);
             this.ms_reworkcheckno.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ms_reworkcheckno.Name = "ms_reworkcheckno";
             this.ms_reworkcheckno.Size = new System.Drawing.Size(92, 27);
@@ -1041,7 +1041,7 @@
             this.Controls.Add(this.bc_name_label);
             this.Controls.Add(this.bg_name_label);
             this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
-            this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
+            this.Margin = new System.Windows.Forms.Padding(4);
             this.Name = "Make_Repair";
             this.Tag = "Make!Repair";
             this.Text = "维修作业";

+ 17 - 8
UAS-MES/FunctionCode/Make/Make_Repair.cs

@@ -202,10 +202,10 @@ namespace UAS_MES.Make
                     {
                         //验证makeserial或者ms_firstsn表序列号是否存在
                         sql.Clear();
-                        sql.Append("select max(ms_id) ms_id,ms_makecode,ms_stepcode,ms_firstsn,ms_prodcode,ms_sncode,pr_detail,ms_stepcode,ms_craftcode,ms_checkno,ms_ifrework,ms_reworkcheckno ");
+                        sql.Append("select max(ms_id) ms_id,ms_makecode,ms_stepcode,ms_firstsn,ms_prodcode,ms_sncode,pr_detail,ms_craftcode,ms_checkno,ms_ifrework,ms_reworkcheckno ");
                         sql.Append("from makeserial left join product on pr_code=ms_prodcode where ms_makecode ='" + macode + "' and(ms_sncode");
                         sql.Append("='" + GetSNCode.Text + "' or ms_firstsn in (select firstsn from makesnrelation where ");
-                        sql.Append("sn='" + GetSNCode.Text + "')) group by ms_makecode,ms_stepcode,ms_prodcode,ms_sncode,pr_detail,ms_firstsn,ms_stepcode,ms_craftcode,ms_checkno,ms_ifrework,ms_reworkcheckno");
+                        sql.Append("sn='" + GetSNCode.Text + "')) group by ms_makecode,ms_stepcode,ms_prodcode,ms_sncode,pr_detail,ms_firstsn,ms_craftcode,ms_checkno,ms_ifrework,ms_reworkcheckno");
                         dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                         if (dt.Rows.Count > 0)
                         {
@@ -214,6 +214,7 @@ namespace UAS_MES.Make
                             BaseUtil.SetFormValue(this.Controls, dt);
                             //判断是否当前工单途程的上料记录
                             firstsn = dt.Rows[0]["ms_firstsn"].ToString();
+                            string cdstepcode = "";
                             sql.Clear();
                             sql.Append("select cm_craftcode,cm_stepcode,cm_soncode,min(cm_indate)cm_indate,sum(case when cm_status=-1 ");
                             sql.Append("then 0 else 1 end)qty from craftmaterial left join product on pr_code=cm_soncode where(cm_sncode ");
@@ -223,7 +224,7 @@ namespace UAS_MES.Make
                             dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                             if (dt.Rows.Count > 0)
                             {
-                                cd_stepcode.Text = LogicHandler.GetNextStep(dt.Rows[0]["cm_craftcode"].ToString(), dt.Rows[0]["cm_stepcode"].ToString(), ms_prodcode.Text);
+                                cdstepcode = LogicHandler.GetNextStep(dt.Rows[0]["cm_craftcode"].ToString(), dt.Rows[0]["cm_stepcode"].ToString(), ms_prodcode.Text);
                             }
                             else
                             {
@@ -236,18 +237,26 @@ namespace UAS_MES.Make
                                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                                 if (dt.Rows.Count > 0)
                                 {
-                                    cd_stepcode.Text = dt.Rows[0]["cm_stepcode"].ToString();
+                                    cdstepcode = dt.Rows[0]["cm_stepcode"].ToString();
                                 }
                             }
-                            //如果ms_stepcode和扣料工序均没有查到返修的工序
-                            if (cd_stepcode.Text == "")
+                            if (cdstepcode == "")
                             {
                                 sql.Clear();
                                 sql.Append("select cd_stepcode from craft left join craftdetail on cr_id =cd_crid where ");
-                                sql.Append("cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "' order by cd_detno");
+                                sql.Append("cr_code='" + cr_code.Text + "' and cr_prodcode='" + ms_prodcode.Text + "' and nvl(cd_ifburnin,0)<>0 order by cd_detno");
                                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
-                                cd_stepcode.Text = dt.Rows[0][0].ToString();
+                                if (dt.Rows.Count > 0)
+                                {
+                                    cdstepcode = dt.Rows[0][0].ToString();
+                                }
+                            }
+                            //如果ms_stepcode和扣料工序均没有查到返修的工序
+                            if (cdstepcode == "")
+                            {
+                                cdstepcode = ms_stepcode;
                             }
+                            cd_stepcode.Text = cdstepcode;
                             LoadBadInfTree(sender, e);
                         }
                         else OperatResult.AppendText(">>" + ErrorMessage + "\n", Color.Red);