Browse Source

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

Hcsy 8 years ago
parent
commit
f8e951b385

+ 10 - 2
UAS-MES/FunctionCode/Make/Make_BigBoxWeight.cs

@@ -132,14 +132,22 @@ namespace UAS_MES.Make
                     OperateResult.AppendText("<<<更新成功\n", Color.Green);
                     //刷新grid的历史称重信息;
                     recordResult(pa_outboxcode.Text, weight.Text, System.DateTime.Now.ToString());
-                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱"+ pa_outboxcode.Text + "称重:"+weight.Text, "称重成功", pa_outboxcode.Text, "");
+                    LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "大箱" + pa_outboxcode.Text + "称重:" + weight.Text, "称重成功", pa_outboxcode.Text, "");
                     LogicHandler.RecordProdWeight(pa_outboxcode.Text, "BIGBOX", float.Parse(ActualWeight.ToString()), "kg", User.UserLineCode, pa_prodcode.Text, User.UserSourceCode, User.UserName);
                     if (autoprint.Checked == true)
                     {
                         try
                         {
                             doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-                            Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text));
+                            string ErrorMessage = "";
+                            if (Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), pa_makecode.Text, pa_prodcode.Text, "大箱标", "0", out ErrorMessage))
+                            {
+
+                            }
+                            else
+                            {
+                                OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
+                            }
                             dh.ExecuteSql("update package set pa_printcount= pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                             printcount++;
                             weightsum.Text = printcount + "";

+ 11 - 4
UAS-MES/FunctionCode/Make/Make_CartonBoxWeigh.cs

@@ -93,7 +93,7 @@ namespace UAS_MES.Make
 
         private void 卡通箱称重_SizeChanged(object sender, EventArgs e)
         {
-            weight.Location = new Point(weight_label.Location.X + weight_label.Size.Width-10, weight_label.Location.Y-20);
+            weight.Location = new Point(weight_label.Location.X + weight_label.Size.Width - 10, weight_label.Location.Y - 20);
             asc.controlAutoSize(this);
         }
 
@@ -157,8 +157,7 @@ namespace UAS_MES.Make
                     {
                         if (PrintLabel.Items.Count > 0)
                         {
-                            doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-                            Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
+                            Confirm.PerformClick();
                         }
                         else
                         {
@@ -213,7 +212,15 @@ namespace UAS_MES.Make
         private void Confirm_Click(object sender, EventArgs e)
         {
             doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-            Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text));
+            string ErrorMessage = "";
+            if (Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrinterList.Text, outboxcode.Text, int.Parse(PrintNum.Text), ma_code.Text, pr_code.Text, "卡通箱标", "0", out ErrorMessage))
+            {
+
+            }
+            else
+            {
+                OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
+            }
         }
 
         //停止进程,关闭串口

+ 9 - 3
UAS-MES/FunctionCode/Make/Make_ColorBoxLabelPrint.cs

@@ -233,9 +233,15 @@ namespace UAS_MES.Make
                                     if (ErrorMessage.Contains("AFTERSUCCESS"))
                                         OperateResult.AppendText(">>" + ErrorMessage + "\n");
                                     doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-                                    Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, sncode.Text, int.Parse(PrintNum.Text));
-                                    //提示用户打印成功
-                                    OperateResult.AppendText(">>序列号:" + sncode.Text + "打印结束\n", Color.Green);
+                                    if (Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, sncode.Text, int.Parse(PrintNum.Text), oMakeCode, pr_code.Text, "彩盒标", "0", out ErrorMessage))
+                                    {
+                                        //提示用户打印成功
+                                        OperateResult.AppendText(">>序列号:" + sncode.Text + "打印结束\n", Color.Green);
+                                    }
+                                    else
+                                    {
+                                        OperateResult.AppendText(ErrorMessage + "\n", Color.Green);
+                                    }
                                     LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ma_code.Text, User.UserLineCode, User.UserSourceCode, "彩盒打印", "彩盒打印成功", sncode.Text, "");
                                     //刷新打印数量和剩余数量
                                     dt = (DataTable)dh.ExecuteSql("select ma_qty - nvl(mcd_inqty, 0) mcd_remainqty,mcd_okqty from make left join makecraftdetail on mcd_macode=ma_code where ma_code='" + ma_code.Text + "' and mcd_stepcode='" + User.CurrentStepCode + "'", "select");

+ 136 - 26
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.Designer.cs

@@ -93,6 +93,12 @@
             this.pa_sccode = new System.Windows.Forms.Label();
             this.ms_makecode = new System.Windows.Forms.Label();
             this.pa_standardqty = new System.Windows.Forms.Label();
+            this.Port = new UAS_MES.CustomControl.TextBoxWithIcon.EnterTextBox();
+            this.Port_label = new System.Windows.Forms.Label();
+            this.IP = new UAS_MES.CustomControl.TextBoxWithIcon.SnCollectionBox();
+            this.IP_label = new System.Windows.Forms.Label();
+            this.BuildServer = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
+            this.CloseServer = new UAS_MES.CustomControl.ButtonUtil.NormalButton();
             ((System.ComponentModel.ISupportInitialize)(this.PackageDetail)).BeginInit();
             this.groupBoxWithBorder1.SuspendLayout();
             this.groupBoxWithBorder2.SuspendLayout();
@@ -126,7 +132,7 @@
             // 
             this.pa_code_label.AutoSize = true;
             this.pa_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_code_label.Location = new System.Drawing.Point(17, 63);
+            this.pa_code_label.Location = new System.Drawing.Point(17, 61);
             this.pa_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_code_label.Name = "pa_code_label";
             this.pa_code_label.Size = new System.Drawing.Size(52, 27);
@@ -137,7 +143,7 @@
             // 
             this.PrintList_label.AutoSize = true;
             this.PrintList_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintList_label.Location = new System.Drawing.Point(9, 57);
+            this.PrintList_label.Location = new System.Drawing.Point(9, 55);
             this.PrintList_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintList_label.Name = "PrintList_label";
             this.PrintList_label.Size = new System.Drawing.Size(112, 27);
@@ -148,7 +154,7 @@
             // 
             this.PrintNum_label.AutoSize = true;
             this.PrintNum_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.PrintNum_label.Location = new System.Drawing.Point(260, 153);
+            this.PrintNum_label.Location = new System.Drawing.Point(260, 151);
             this.PrintNum_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.PrintNum_label.Name = "PrintNum_label";
             this.PrintNum_label.Size = new System.Drawing.Size(52, 27);
@@ -194,7 +200,7 @@
             // 
             this.label3.AutoSize = true;
             this.label3.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label3.Location = new System.Drawing.Point(9, 104);
+            this.label3.Location = new System.Drawing.Point(9, 102);
             this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label3.Name = "label3";
             this.label3.Size = new System.Drawing.Size(92, 27);
@@ -410,7 +416,7 @@
             // 
             this.OutBoxLength_label.AutoSize = true;
             this.OutBoxLength_label.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.OutBoxLength_label.Location = new System.Drawing.Point(137, 24);
+            this.OutBoxLength_label.Location = new System.Drawing.Point(137, 22);
             this.OutBoxLength_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.OutBoxLength_label.Name = "OutBoxLength_label";
             this.OutBoxLength_label.Size = new System.Drawing.Size(46, 24);
@@ -475,7 +481,7 @@
             // 
             this.pa_currentqty_label.AutoSize = true;
             this.pa_currentqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty_label.Location = new System.Drawing.Point(292, 105);
+            this.pa_currentqty_label.Location = new System.Drawing.Point(292, 103);
             this.pa_currentqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty_label.Name = "pa_currentqty_label";
             this.pa_currentqty_label.Size = new System.Drawing.Size(92, 27);
@@ -486,7 +492,7 @@
             // 
             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(292, 149);
+            this.pr_detail_label.Location = new System.Drawing.Point(292, 147);
             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);
@@ -497,7 +503,7 @@
             // 
             this.pa_currentqty.AutoSize = true;
             this.pa_currentqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_currentqty.Location = new System.Drawing.Point(404, 105);
+            this.pa_currentqty.Location = new System.Drawing.Point(404, 103);
             this.pa_currentqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pa_currentqty.Name = "pa_currentqty";
             this.pa_currentqty.Size = new System.Drawing.Size(0, 27);
@@ -507,7 +513,7 @@
             // 
             this.pr_code_label.AutoSize = true;
             this.pr_code_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code_label.Location = new System.Drawing.Point(17, 149);
+            this.pr_code_label.Location = new System.Drawing.Point(17, 147);
             this.pr_code_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code_label.Name = "pr_code_label";
             this.pr_code_label.Size = new System.Drawing.Size(92, 27);
@@ -518,7 +524,7 @@
             // 
             this.pr_detail.AutoSize = true;
             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(404, 149);
+            this.pr_detail.Location = new System.Drawing.Point(404, 147);
             this.pr_detail.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_detail.Name = "pr_detail";
             this.pr_detail.Size = new System.Drawing.Size(0, 27);
@@ -528,7 +534,7 @@
             // 
             this.pr_outboxinnerqty_label.AutoSize = true;
             this.pr_outboxinnerqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(17, 105);
+            this.pr_outboxinnerqty_label.Location = new System.Drawing.Point(17, 103);
             this.pr_outboxinnerqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_outboxinnerqty_label.Name = "pr_outboxinnerqty_label";
             this.pr_outboxinnerqty_label.Size = new System.Drawing.Size(92, 27);
@@ -539,7 +545,7 @@
             // 
             this.pr_code.AutoSize = true;
             this.pr_code.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_code.Location = new System.Drawing.Point(136, 149);
+            this.pr_code.Location = new System.Drawing.Point(136, 147);
             this.pr_code.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_code.MaximumSize = new System.Drawing.Size(200, 0);
             this.pr_code.Name = "pr_code";
@@ -550,7 +556,7 @@
             // AutoGenBoxCode
             // 
             this.AutoGenBoxCode.AutoSize = true;
-            this.AutoGenBoxCode.Location = new System.Drawing.Point(292, 63);
+            this.AutoGenBoxCode.Location = new System.Drawing.Point(292, 61);
             this.AutoGenBoxCode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.AutoGenBoxCode.Name = "AutoGenBoxCode";
             this.AutoGenBoxCode.Size = new System.Drawing.Size(114, 31);
@@ -610,7 +616,7 @@
             // 
             this.label1.AutoSize = true;
             this.label1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label1.Location = new System.Drawing.Point(371, 15);
+            this.label1.Location = new System.Drawing.Point(371, 13);
             this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label1.Name = "label1";
             this.label1.Size = new System.Drawing.Size(92, 27);
@@ -622,7 +628,7 @@
             this.checkweightlabel.AutoSize = true;
             this.checkweightlabel.CutLength = null;
             this.checkweightlabel.ForeColor = System.Drawing.Color.Black;
-            this.checkweightlabel.Location = new System.Drawing.Point(147, 18);
+            this.checkweightlabel.Location = new System.Drawing.Point(147, 16);
             this.checkweightlabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.checkweightlabel.MaximumSize = new System.Drawing.Size(267, 0);
             this.checkweightlabel.Name = "checkweightlabel";
@@ -633,7 +639,7 @@
             // 
             this.ob_nowcheckqty.AutoSize = true;
             this.ob_nowcheckqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty.Location = new System.Drawing.Point(479, 104);
+            this.ob_nowcheckqty.Location = new System.Drawing.Point(479, 102);
             this.ob_nowcheckqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty.Name = "ob_nowcheckqty";
             this.ob_nowcheckqty.Size = new System.Drawing.Size(0, 27);
@@ -643,7 +649,7 @@
             // 
             this.ob_batchqty.AutoSize = true;
             this.ob_batchqty.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty.Location = new System.Drawing.Point(479, 57);
+            this.ob_batchqty.Location = new System.Drawing.Point(479, 55);
             this.ob_batchqty.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty.Name = "ob_batchqty";
             this.ob_batchqty.Size = new System.Drawing.Size(0, 27);
@@ -653,7 +659,7 @@
             // 
             this.ob_nowcheckqty_label.AutoSize = true;
             this.ob_nowcheckqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(371, 104);
+            this.ob_nowcheckqty_label.Location = new System.Drawing.Point(371, 102);
             this.ob_nowcheckqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_nowcheckqty_label.Name = "ob_nowcheckqty_label";
             this.ob_nowcheckqty_label.Size = new System.Drawing.Size(92, 27);
@@ -664,7 +670,7 @@
             // 
             this.ob_batchqty_label.AutoSize = true;
             this.ob_batchqty_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_batchqty_label.Location = new System.Drawing.Point(371, 57);
+            this.ob_batchqty_label.Location = new System.Drawing.Point(371, 55);
             this.ob_batchqty_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_batchqty_label.Name = "ob_batchqty_label";
             this.ob_batchqty_label.Size = new System.Drawing.Size(92, 27);
@@ -716,7 +722,7 @@
             // 
             this.ob_checkno.AutoSize = true;
             this.ob_checkno.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.ob_checkno.Location = new System.Drawing.Point(479, 15);
+            this.ob_checkno.Location = new System.Drawing.Point(479, 13);
             this.ob_checkno.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.ob_checkno.Name = "ob_checkno";
             this.ob_checkno.Size = new System.Drawing.Size(0, 27);
@@ -791,7 +797,7 @@
             // 
             this.pr_cartonunit1.AutoSize = true;
             this.pr_cartonunit1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartonunit1.Location = new System.Drawing.Point(115, 154);
+            this.pr_cartonunit1.Location = new System.Drawing.Point(115, 152);
             this.pr_cartonunit1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonunit1.Name = "pr_cartonunit1";
             this.pr_cartonunit1.Size = new System.Drawing.Size(25, 27);
@@ -804,7 +810,7 @@
             // 
             this.pr_cartonunit.AutoSize = true;
             this.pr_cartonunit.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_cartonunit.Location = new System.Drawing.Point(73, 27);
+            this.pr_cartonunit.Location = new System.Drawing.Point(73, 25);
             this.pr_cartonunit.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonunit.Name = "pr_cartonunit";
             this.pr_cartonunit.Size = new System.Drawing.Size(25, 27);
@@ -816,7 +822,7 @@
             // 
             this.pr_cartonboxgw.AutoSize = true;
             this.pr_cartonboxgw.Font = new System.Drawing.Font("微软雅黑", 25F);
-            this.pr_cartonboxgw.Location = new System.Drawing.Point(19, 206);
+            this.pr_cartonboxgw.Location = new System.Drawing.Point(19, 204);
             this.pr_cartonboxgw.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.pr_cartonboxgw.Name = "pr_cartonboxgw";
             this.pr_cartonboxgw.Size = new System.Drawing.Size(0, 55);
@@ -826,7 +832,7 @@
             // 
             this.label4.AutoSize = true;
             this.label4.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label4.Location = new System.Drawing.Point(17, 154);
+            this.label4.Location = new System.Drawing.Point(17, 152);
             this.label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label4.Name = "label4";
             this.label4.Size = new System.Drawing.Size(92, 27);
@@ -838,7 +844,7 @@
             this.weight.AutoSize = true;
             this.weight.Font = new System.Drawing.Font("微软雅黑", 35F);
             this.weight.ForeColor = System.Drawing.Color.DarkGreen;
-            this.weight.Location = new System.Drawing.Point(19, 68);
+            this.weight.Location = new System.Drawing.Point(19, 66);
             this.weight.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.weight.Name = "weight";
             this.weight.Size = new System.Drawing.Size(0, 78);
@@ -848,7 +854,7 @@
             // 
             this.label2.AutoSize = true;
             this.label2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label2.Location = new System.Drawing.Point(17, 27);
+            this.label2.Location = new System.Drawing.Point(17, 25);
             this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(52, 27);
@@ -932,13 +938,111 @@
             this.pa_standardqty.TabIndex = 183;
             this.pa_standardqty.Visible = false;
             // 
+            // Port
+            // 
+            this.Port.AllPower = null;
+            this.Port.BackColor = System.Drawing.Color.White;
+            this.Port.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Port.ID = null;
+            this.Port.Location = new System.Drawing.Point(1005, 579);
+            this.Port.Margin = new System.Windows.Forms.Padding(4);
+            this.Port.Name = "Port";
+            this.Port.Power = null;
+            this.Port.Size = new System.Drawing.Size(150, 27);
+            this.Port.Str = null;
+            this.Port.Str1 = null;
+            this.Port.Str2 = null;
+            this.Port.TabIndex = 191;
+            // 
+            // Port_label
+            // 
+            this.Port_label.AutoSize = true;
+            this.Port_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.Port_label.Location = new System.Drawing.Point(925, 579);
+            this.Port_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.Port_label.Name = "Port_label";
+            this.Port_label.Size = new System.Drawing.Size(52, 27);
+            this.Port_label.TabIndex = 190;
+            this.Port_label.Text = "端口";
+            // 
+            // IP
+            // 
+            this.IP.AllPower = null;
+            this.IP.BackColor = System.Drawing.Color.White;
+            this.IP.Font = new System.Drawing.Font("微软雅黑", 9F);
+            this.IP.ID = null;
+            this.IP.Location = new System.Drawing.Point(1005, 537);
+            this.IP.Margin = new System.Windows.Forms.Padding(8, 9, 8, 9);
+            this.IP.Name = "IP";
+            this.IP.Power = null;
+            this.IP.Size = new System.Drawing.Size(150, 27);
+            this.IP.Str = null;
+            this.IP.Str1 = null;
+            this.IP.Str2 = null;
+            this.IP.TabIndex = 189;
+            // 
+            // IP_label
+            // 
+            this.IP_label.AutoSize = true;
+            this.IP_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.IP_label.Location = new System.Drawing.Point(925, 537);
+            this.IP_label.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
+            this.IP_label.Name = "IP_label";
+            this.IP_label.Size = new System.Drawing.Size(30, 27);
+            this.IP_label.TabIndex = 188;
+            this.IP_label.Text = "IP";
+            // 
+            // BuildServer
+            // 
+            this.BuildServer.AllPower = null;
+            this.BuildServer.BackColor = System.Drawing.Color.Transparent;
+            this.BuildServer.DownImage = ((System.Drawing.Image)(resources.GetObject("BuildServer.DownImage")));
+            this.BuildServer.Image = null;
+            this.BuildServer.IsShowBorder = true;
+            this.BuildServer.Location = new System.Drawing.Point(936, 626);
+            this.BuildServer.Margin = new System.Windows.Forms.Padding(4);
+            this.BuildServer.MoveImage = ((System.Drawing.Image)(resources.GetObject("BuildServer.MoveImage")));
+            this.BuildServer.Name = "BuildServer";
+            this.BuildServer.NormalImage = ((System.Drawing.Image)(resources.GetObject("BuildServer.NormalImage")));
+            this.BuildServer.Power = null;
+            this.BuildServer.Size = new System.Drawing.Size(80, 30);
+            this.BuildServer.TabIndex = 192;
+            this.BuildServer.Text = "开启服务";
+            this.BuildServer.UseVisualStyleBackColor = true;
+            this.BuildServer.Click += new System.EventHandler(this.BuildServer_Click);
+            // 
+            // CloseServer
+            // 
+            this.CloseServer.AllPower = null;
+            this.CloseServer.BackColor = System.Drawing.Color.Transparent;
+            this.CloseServer.DownImage = ((System.Drawing.Image)(resources.GetObject("CloseServer.DownImage")));
+            this.CloseServer.Image = null;
+            this.CloseServer.IsShowBorder = true;
+            this.CloseServer.Location = new System.Drawing.Point(1044, 626);
+            this.CloseServer.Margin = new System.Windows.Forms.Padding(4);
+            this.CloseServer.MoveImage = ((System.Drawing.Image)(resources.GetObject("CloseServer.MoveImage")));
+            this.CloseServer.Name = "CloseServer";
+            this.CloseServer.NormalImage = ((System.Drawing.Image)(resources.GetObject("CloseServer.NormalImage")));
+            this.CloseServer.Power = null;
+            this.CloseServer.Size = new System.Drawing.Size(80, 30);
+            this.CloseServer.TabIndex = 193;
+            this.CloseServer.Text = "关闭服务";
+            this.CloseServer.UseVisualStyleBackColor = true;
+            this.CloseServer.Click += new System.EventHandler(this.CloseServer_Click);
+            // 
             // Make_PackageCollectionWeigh
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
             this.ClientSize = new System.Drawing.Size(1172, 728);
+            this.Controls.Add(this.CloseServer);
+            this.Controls.Add(this.BuildServer);
+            this.Controls.Add(this.Port);
+            this.Controls.Add(this.Port_label);
             this.Controls.Add(this.pa_standardqty);
+            this.Controls.Add(this.IP);
             this.Controls.Add(this.ms_makecode);
+            this.Controls.Add(this.IP_label);
             this.Controls.Add(this.pa_sccode);
             this.Controls.Add(this.pa_checkno);
             this.Controls.Add(this.pa_downstatus);
@@ -1044,5 +1148,11 @@
         private System.Windows.Forms.Label OutBoxLength_label;
         private CustomControl.TextBoxWithIcon.SnCollectionBox OutBoxLength;
         private CustomControl.ButtonUtil.NormalButton RefreshWeigh;
+        private CustomControl.TextBoxWithIcon.EnterTextBox Port;
+        private System.Windows.Forms.Label Port_label;
+        private CustomControl.TextBoxWithIcon.SnCollectionBox IP;
+        private System.Windows.Forms.Label IP_label;
+        private CustomControl.ButtonUtil.NormalButton BuildServer;
+        private CustomControl.ButtonUtil.NormalButton CloseServer;
     }
 }

+ 36 - 51
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.cs

@@ -30,7 +30,7 @@ namespace UAS_MES.Make
         string oMakeCode = "";
         string oMsID = "";
         string oMsStatus = "";
-
+        ModeBusTCPServer md;
         string PR_CHECKCARTONW = "0";
         //称量的标准重量
         double Weight;
@@ -105,6 +105,7 @@ namespace UAS_MES.Make
                     OperateResult.AppendText(">>" + mes.Message + "\n", Color.Red);
             }
             sn_code.Focus();
+            md = new ModeBusTCPServer();
             dh = new DataHelper();
         }
 
@@ -433,6 +434,11 @@ namespace UAS_MES.Make
                                                 OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "重量不符合标准重量\n", Color.Red);
                                                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量不符合要求:" + weight.Text.Trim(), pa_outboxcode.Text, "");
                                                 LogicHandler.RecordProdWeight(pa_outboxcode.Text, "CARTON", float.Parse(ActWeigh.ToString()), "kg", User.UserLineCode, pr_code.Text, User.UserSourceCode, User.UserName);
+                                                //发送指令给机械臂NG
+                                                if (md.IsOpen)
+                                                {
+                                                    md.SendOrder("M502_ON");
+                                                }
                                                 return;
                                             }
                                         }
@@ -444,8 +450,12 @@ namespace UAS_MES.Make
                                         LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱称重", "称量完成:" + weight.Text.Trim(), pa_outboxcode.Text, "");
                                         LogicHandler.CartonBoxStepPass(pa_makecode.Text, User.UserSourceCode, pa_outboxcode.Text, User.UserCode, "卡通箱:" + pa_outboxcode.Text + "整箱过站", out ErrorMessage);
                                         dh.UpdateByCondition("package", "pa_nextstep='" + dh.getFieldDataByCondition("packagedetail left join makeserial on ms_sncode=pd_barcode and ms_makecode=pd_makecode", "max(ms_nextstepcode)", "pd_outboxcode='" + pa_outboxcode.Text + "'").ToString() + "', PA_CURRENTSTEP = '' ", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                                        //发送指令给机械臂NG
+                                        if (md.IsOpen)
+                                        {
+                                            md.SendOrder("M501_ON");
+                                        }
                                         LoadCheckQTY();
-
                                         OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "称量完成\n", Color.Green);
                                         if (AutoPrint.Checked)
                                             Print_Click(new object(), new EventArgs());
@@ -642,55 +652,6 @@ namespace UAS_MES.Make
             }
         }
 
-        //private void pr_outboxinnerqty_KeyDown(object sender, KeyEventArgs e)
-        //{
-        //    if (e.KeyCode == Keys.Enter)
-        //        ResetPackQTY();
-        //}
-
-        //private void pr_outboxinnerqty_Leave(object sender, EventArgs e)
-        //{
-        //    ResetPackQTY();
-        //}
-
-        //private void ResetPackQTY()
-        //{
-        //    //数据不符合限制的时候保持原有值
-        //    int curretnqty = int.Parse(pa_currentqty.Text == "" ? "0" : pa_currentqty.Text);
-        //    if (!(pr_outboxinnerqty.Value >= curretnqty))
-        //    {
-        //        pr_outboxinnerqty.Value = StandardQTY;
-        //    }
-        //    else
-        //    {
-        //        if (dh.CheckExist("package", "pa_outboxcode='" + pa_outboxcode.Text + "'"))
-        //        {
-        //            string checknostatus = dh.getFieldDataByCondition("oqcbatch", "ob_status", "ob_checkno='" + pa_checkno.Text + "'").ToString();
-        //            if (checknostatus == "" || checknostatus == "ENTERING")
-        //            {
-        //                if (pa_downstatus.Text == "0")
-        //                {
-        //                    if (dh.CheckExist("source", "sc_code='" + pa_sccode.Text + "' and  sc_stepcode='" + User.CurrentStepCode + "'"))
-        //                    {
-        //                        dh.UpdateByCondition("package", "pa_standardqty='" + pr_outboxinnerqty.Value + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
-        //                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, "", User.UserLineCode, User.UserSourceCode, "修改箱内容量", "原容量" + StandardQTY + ",修改为" + pr_outboxinnerqty.Value + "'", pa_outboxcode.Text, pa_checkno.Text);
-        //                        return;
-        //                    }
-        //                    else
-        //                        OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "当前所在工序不是登录岗位资源所在工序,不允许修改数量\n", Color.Red);
-        //                }
-        //                else
-        //                    OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "处于下地状态,不允许修改标准容量\n", Color.Red);
-        //            }
-        //            else
-        //                OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "处于送检中,不允许修改标准容量\n", Color.Red);
-        //        }
-        //        else
-        //            OperateResult.AppendText(">>箱号" + pa_outboxcode.Text + "不存在,修改容量无效\n", Color.Red);
-        //        pr_outboxinnerqty.Value = StandardQTY;
-        //    }
-        //}
-
         private void PrintLabel_SelectedValueChanged(object sender, EventArgs e)
         {
             if (PrintLabel.SelectedValue != null && PrintLabel.SelectedValue.ToString() != "System.Data.DataRowView")
@@ -850,5 +811,29 @@ namespace UAS_MES.Make
                     pr_cartonboxgw.Text = MinWeight + "-" + MaxWeight + dt.Rows[0]["pr_cartonunit"].ToString();
             }
         }
+
+        private void BuildServer_Click(object sender, EventArgs e)
+        {
+            if (!md.IsOpen)
+            {
+                md.IP = IP.Text;
+                md.Port = Port.Text;
+                md.Open();
+                OperateResult.AppendText(">>服务开启成功\n");
+            }
+            else
+                OperateResult.AppendText(">>服务已经开启\n");
+        }
+
+        private void CloseServer_Click(object sender, EventArgs e)
+        {
+            if (md.IsOpen)
+            {
+                md.Close();
+                OperateResult.AppendText(">>服务关闭成功\n");
+            }
+            else
+                OperateResult.AppendText(">>服务尚未开启\n");
+        }
     }
 }

+ 76 - 18
UAS-MES/FunctionCode/Make/Make_PackageCollectionWeigh.resx

@@ -212,24 +212,6 @@
   <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
     <value>True</value>
   </metadata>
-  <metadata name="pd_barcode.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_outboxcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_prodcode1.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_innerqty.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pa_indate.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
-  <metadata name="pd_id.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
-    <value>True</value>
-  </metadata>
   <data name="DeleteAll.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
     <value>
         iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
@@ -380,6 +362,82 @@
         2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
         zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
         ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="BuildServer.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
+        GcRORxHklpAIBHLfbILV8XxeNsMznJ35F5vu+82kWYuILD4N7oq75roCw27sb/x5WBdc27btntY64o/i
+        DnZjPxy4S6A0R6PHO1WUNHc9ep4uxIXd2D8eP/XZowWUThBG+n3p0stsKbbJ0qFDFFfscQuUbpzm9Pqx
+        Eh8c4PGLkuX0Nl+LDw4GJckUTRaO+OBQo+SKpitXfHAwKClfZuuN+OBgUDJV0NzxxAeHM5TFxhffGUpe
+        aFp5n+KDg0FRfHH8nfjgUKPoktztXnxwMCgFX7xdID441ChlRf7+ID44GBTNl21wFB8capSqot0xFB8c
+        /lE6Wa70IU5oH0Ziw/5cFebpoPUwHPbL04nCJKUgisWF3dgPB3gABc9v7fvBoBcnaVKdvkha2I39cPjx
+        oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="BuildServer.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
+        CEIQBEIgVFiS9qXWoDmp4/fHzDmjM2a+vU/QqUVX0DvwXxxn9fwYXJwYEcXWNzIWt83dcq7AsBv7LXgA
+        ZI0r71/aaqjCJf8o7sFu7IcDFwdK4vimrv1oSZXRnArdQFzYjf3pQkOzRxIoVWc6X5X6M7ruBGIr9mbU
+        9MIVe9hAcXvBO125WnxwgMcXSpcPF20tPjgYlI5eUK6lxAcHg9Lmw3nTFx8cDEpLLSjr+OKDg0FpqojO
+        Gp744GBQ3vyITutT8cHBoDheRCe1ifjgYFBe+ZCxJ+KDg0GpT0NKv4zFBweDUpuEdFQdiQ8OBsXmw2Fl
+        JD44/KCM53TwNBQfHAzKMx/2Hgfig8M3SrXYUasUfz67DwOxYf9dV5urg+RWzta4aEnxn83OfV9c2I39
+        cIAHUOJceTNbUfmW94GX0sJu7IcDPH5fXCe4EvfXxe5/D7ux3yKi2CfkPhTy27lqkwAAAABJRU5ErkJg
+        gg==
+</value>
+  </data>
+  <data name="BuildServer.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
+        4uUVEtTiPKVlom2wttM6IfF+15njXHRnL19jD/zFmanWV8zAEDNTp9OJS6/Sm2QUht3YH4cHtdvtF6k7
+        mUwG1tqd3FR3YTf2w0FKUVOu6XT68Xgw3+8PtWH/bDYbCkeLGo1Gz/d9JwzvrL0gCKx49KlerxtIBUGo
+        PjjAg2q1mqDc2fN99cEBHlStVk0oB+t56oMDPKhSqZggDNm1N/XBAR5ULpeNvGD46rrqgwM8qFQqGV8O
+        56ujPjjAg4rFosFL5ni5qA8O8KBCoWBuns/701l9cIAH5fN5QfF4dzipDw7woFwuZ+zN483+oD44wIOy
+        2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
+        zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
+        ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="CloseServer.DownImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFcSURBVFhH5di7UsJAFMbxtDT6QMI76IAFT0npIE0K
+        GcRORxHklpAIBHLfbILV8XxeNsMznJ35F5vu+82kWYuILD4N7oq75roCw27sb/x5WBdc27btntY64o/i
+        DnZjPxy4S6A0R6PHO1WUNHc9ep4uxIXd2D8eP/XZowWUThBG+n3p0stsKbbJ0qFDFFfscQuUbpzm9Pqx
+        Eh8c4PGLkuX0Nl+LDw4GJckUTRaO+OBQo+SKpitXfHAwKClfZuuN+OBgUDJV0NzxxAeHM5TFxhffGUpe
+        aFp5n+KDg0FRfHH8nfjgUKPoktztXnxwMCgFX7xdID441ChlRf7+ID44GBTNl21wFB8capSqot0xFB8c
+        /lE6Wa70IU5oH0Ziw/5cFebpoPUwHPbL04nCJKUgisWF3dgPB3gABc9v7fvBoBcnaVKdvkha2I39cPjx
+        oPrhusndcPinpIXd2N8gIusbTaFspKtR2SQAAAAASUVORK5CYII=
+</value>
+  </data>
+  <data name="CloseServer.MoveImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFzSURBVFhH5djNSgJRGMZxL2P2gTfQFbZvHSEZFBEW
+        CEIQBEIgVFiS9qXWoDmp4/fHzDmjM2a+vU/QqUVX0DvwXxxn9fwYXJwYEcXWNzIWt83dcq7AsBv7LXgA
+        ZI0r71/aaqjCJf8o7sFu7IcDFwdK4vimrv1oSZXRnArdQFzYjf3pQkOzRxIoVWc6X5X6M7ruBGIr9mbU
+        9MIVe9hAcXvBO125WnxwgMcXSpcPF20tPjgYlI5eUK6lxAcHg9Lmw3nTFx8cDEpLLSjr+OKDg0FpqojO
+        Gp744GBQ3vyITutT8cHBoDheRCe1ifjgYFBe+ZCxJ+KDg0GpT0NKv4zFBweDUpuEdFQdiQ8OBsXmw2Fl
+        JD44/KCM53TwNBQfHAzKMx/2Hgfig8M3SrXYUasUfz67DwOxYf9dV5urg+RWzta4aEnxn83OfV9c2I39
+        cIAHUOJceTNbUfmW94GX0sJu7IcDPH5fXCe4EvfXxe5/D7ux3yKi2CfkPhTy27lqkwAAAABJRU5ErkJg
+        gg==
+</value>
+  </data>
+  <data name="CloseServer.NormalImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+    <value>
+        iVBORw0KGgoAAAANSUhEUgAAAEUAAAAWCAYAAACWl1FwAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
+        dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAGVSURBVFhH5di7agJRFIXhDSKoYBQEC8FCECwEQRBE
+        4uUVEtTiPKVlom2wttM6IfF+15njXHRnL19jD/zFmanWV8zAEDNTp9OJS6/Sm2QUht3YH4cHtdvtF6k7
+        mUwG1tqd3FR3YTf2w0FKUVOu6XT68Xgw3+8PtWH/bDYbCkeLGo1Gz/d9JwzvrL0gCKx49KlerxtIBUGo
+        PjjAg2q1mqDc2fN99cEBHlStVk0oB+t56oMDPKhSqZggDNm1N/XBAR5ULpeNvGD46rrqgwM8qFQqGV8O
+        56ujPjjAg4rFosFL5ni5qA8O8KBCoWBuns/701l9cIAH5fN5QfF4dzipDw7woFwuZ+zN483+oD44wIOy
+        2azB52i13asPDvCgTCZjHGt5sdmqDw7woHQ6bRzX8ny1UR8c4EHJZNJc5fC7XKsPDvCgRCLR2x9Pzt9q
+        zT+Lpdqw/3A6W/HoUywWa32Nx8OL4zwffM8X6sJu7IcDPCgajaak7udoNNjsdgc81BZ2Yz8c4PH8cR2J
+        ROJSU3qXjMKwG/vjzEz/skOI3Zqgv7AAAAAASUVORK5CYII=
 </value>
   </data>
 </root>

+ 25 - 15
UAS-MES/FunctionCode/Make/Make_PalletWeigh.cs

@@ -97,12 +97,15 @@ namespace UAS_MES.Make
         private void palletcode_KeyDown(object sender, KeyEventArgs e)
         {
             //按下了enter键
-            if (e.KeyCode==Keys.Enter) {
-                if (palletcode.Text=="") {
+            if (e.KeyCode == Keys.Enter)
+            {
+                if (palletcode.Text == "")
+                {
                     OperateResult.AppendText("<<输入不能为空\n", Color.Red);
                     return;
                 }
-                if (weight.Text=="") {
+                if (weight.Text == "")
+                {
                     OperateResult.AppendText("<<未读取到重量信息\n", Color.Red);
                     return;
                 }
@@ -111,7 +114,7 @@ namespace UAS_MES.Make
                 sql.Append("select pa_id,pa_prodcode,pr_detail,pa_makecode,pa_salecode,pa_totalqty,");
                 sql.Append("pa_packageqty from package left join product on pr_code=pa_prodcode where ");
                 sql.Append("pa_outboxcode=:code and pa_type='3'");
-                dt = (DataTable)dh.ExecuteSql(sql.GetString(),"select",palletcode.Text);
+                dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select", palletcode.Text);
                 if (dt.Rows.Count == 0)
                 {
                     OperateResult.AppendText("<<无该栈板号\n", Color.Red, palletcode);
@@ -119,9 +122,9 @@ namespace UAS_MES.Make
                 else
                 {
                     //给页面赋值
-                    BaseUtil.SetFormValue(this.Controls,dt);
+                    BaseUtil.SetFormValue(this.Controls, dt);
                     //刷新grid的历史称重信息;
-                    if (double.Parse(weight.Text.Replace("kg","").Trim()) == 0)
+                    if (double.Parse(weight.Text.Replace("kg", "").Trim()) == 0)
                     {
                         OperateResult.AppendText("<<重量不能等于0\n", Color.Red, palletcode);
                         return;
@@ -129,11 +132,11 @@ namespace UAS_MES.Make
                     // 更新大箱重量
                     sql.Clear();
                     sql.Append("update package set pa_weight=:weight where pa_id=:pa_id ");
-                    dh.ExecuteSql(sql.GetString(),"update",weight.Text.Replace("kg","").Trim(),dt.Rows[0]["pa_id"].ToString());
+                    dh.ExecuteSql(sql.GetString(), "update", weight.Text.Replace("kg", "").Trim(), dt.Rows[0]["pa_id"].ToString());
                     //记录makeprocess    
                     //查询maid
-                    info = (DataTable)dh.ExecuteSql("select ma_id,ma_wccode from make where ma_code='"+pa_makecode.Text+"'","select");
-                    if (info.Rows.Count>0)
+                    info = (DataTable)dh.ExecuteSql("select ma_id,ma_wccode from make where ma_code='" + pa_makecode.Text + "'", "select");
+                    if (info.Rows.Count > 0)
                     {
                         //有值
                         //查询
@@ -142,11 +145,11 @@ namespace UAS_MES.Make
                         sql.Append("mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,");
                         sql.Append("mp_snoutboxcode) values ( makeprocess_seq.nextval,:makecode,:ma_id,:craftcode,:craftname,'栈板称重'");
                         sql.Append(",:result,sysdate,:inman,:workcenter,:linecode,:source,:palletcode) ");
-                        dh.ExecuteSql(sql.GetString(), "insert", pa_makecode.Text, info.Rows[0]["ma_id"].ToString(), User.CurrentStepCode, User.CurrentStepName, "称重成功,栈板号:" + palletcode.Text + ",重量:" + weight.Text.Trim() , User.UserName, info.Rows[0]["ma_wccode"].ToString(), User.UserLineCode, User.UserSourceCode, palletcode.Text);
+                        dh.ExecuteSql(sql.GetString(), "insert", pa_makecode.Text, info.Rows[0]["ma_id"].ToString(), User.CurrentStepCode, User.CurrentStepName, "称重成功,栈板号:" + palletcode.Text + ",重量:" + weight.Text.Trim(), User.UserName, info.Rows[0]["ma_wccode"].ToString(), User.UserLineCode, User.UserSourceCode, palletcode.Text);
                         //提示信息栏显示:<< 栈板号:XXXX,重量:xxxx 克,
                         OperateResult.AppendText("<<栈板号:" + palletcode.Text + ",重量:" + weight.Text.Trim() + "\n", Color.Green);
                         //记录日志
-                        LogicHandler.DoCommandLog(Tag.ToString(),User.UserCode,pa_makecode.Text,User.UserLineCode,User.UserSourceCode,"栈板称重","重量:" + weight.Text.Trim()+"\n",palletcode.Text,"");
+                        LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, pa_makecode.Text, User.UserLineCode, User.UserSourceCode, "栈板称重", "重量:" + weight.Text.Trim() + "\n", palletcode.Text, "");
                         //刷新称重计数+1
                         weightedNum.Text = double.Parse(weightedNum.Text) + 1 + "";
                         recordResult(palletcode.Text, weight.Text.Trim(), System.DateTime.Now.ToString());
@@ -162,13 +165,22 @@ namespace UAS_MES.Make
                         {
                             try
                             {
-                                if (PrintLabel.SelectedValue==null)
+                                if (PrintLabel.SelectedValue == null)
                                 {
                                     OperateResult.AppendText(">>产品:" + pa_prodcode.Text + "未维护栈板标签模板\n", Color.Red, palletcode);
                                     return;
                                 }
                                 doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-                                Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, palletcode.Text, int.Parse(PrintNum.Text));
+                                string ErrorMessage = "";
+                                if (Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, palletcode.Text, int.Parse(PrintNum.Text), pa_makecode.Text, pa_prodcode.Text, "栈板标", "0", out ErrorMessage))
+                                {
+                                    //打印成功,请输入栈板号
+                                    OperateResult.AppendText("<<打印成功\n", Color.Green);
+                                }
+                                else
+                                {
+                                    OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
+                                }
                             }
                             catch (Exception ex)
                             {
@@ -176,8 +188,6 @@ namespace UAS_MES.Make
                                 OperateResult.AppendText(">>请输入栈板号\n", Color.Black, palletcode);
                                 return;
                             }
-                            //打印成功,请输入栈板号
-                            OperateResult.AppendText("<<打印成功\n", Color.Green);
                             OperateResult.AppendText(">>请输入栈板号\n", Color.Black);
                             //更新栈板打印次数
                             sql.Clear();

+ 20 - 6
UAS-MES/FunctionCode/Make/Make_RePrintLabel.cs

@@ -50,6 +50,8 @@ namespace UAS_MES.Make
         DataTable formValue;//界面赋值
 
         string type = "";
+
+        string errorMessage = "";
         public Make_RePrintLabel()
         {
             InitializeComponent();
@@ -224,10 +226,16 @@ namespace UAS_MES.Make
                     return;
                 }
                 //判定通过进行打印
-                //按照打印张数打印
-                OperateResult.AppendText("<<打印成功\n", Color.Green);
                 doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-                Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text));
+                if (Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text),ms_makecode.Text,pr_code.Text,giftBox.Checked?"彩盒标":"机身标","-1",out errorMessage))
+                {
+                    //按照打印张数打印
+                    OperateResult.AppendText("<<打印成功\n", Color.Green);
+                }
+                else
+                {
+                    OperateResult.AppendText(errorMessage + "\n", Color.Red);
+                }
                 //打印成功,记录日志commandlog , cl_operate彩盒或者机身标补打印,cl_result补打印成功
                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, giftBox.Checked ? "彩盒标补打印" : "机身标补打印", "补打印成功", inputValue.Text, "");
                 //如果ms_downstatus<>0,则更新ms_downstatus=-1 where ms_id=?id,同时插入记录至表 MAKEDOWN
@@ -249,10 +257,16 @@ namespace UAS_MES.Make
                     OperateResult.AppendText("<<箱号:" + inputValue.Text + "错误,不存在\n", Color.Red);
                     return;
                 }
-                //判断通过,打印
-                OperateResult.AppendText("<<打印成功\n", Color.Green);
                 doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-                Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text));
+                if (Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), Printer.Text, inputValue.Text, int.Parse(printNum.Text),ms_makecode.Text,pr_code.Text,"卡通箱标","-1",out errorMessage))
+                {
+                    //判断通过,打印
+                    OperateResult.AppendText("<<打印成功\n", Color.Green);
+                }
+                else
+                {
+                    OperateResult.AppendText(errorMessage + "\n", Color.Red);
+                }
                 //打印成功,记录日志commandlog , cl_operate彩盒或者机身标补打印,cl_result补打印成功
                 LogicHandler.DoCommandLog(Tag.ToString(), User.UserCode, ms_makecode.Text, User.UserLineCode, User.UserSourceCode, "卡通箱标签补打印,箱号:" + inputValue.Text, "补打印成功", inputValue.Text, "");
                 //如果pa_downstatus<>0,则更新pa_downstatus=-1 where pa_outboxcode=?code,同时插入记录至表 MAKEDOWN

+ 7 - 1
UAS-MES/FunctionCode/Make/Make_SpecialCartonPack.cs

@@ -195,7 +195,13 @@ namespace UAS_MES.Make
                     dh.ExecuteSql("update package set pa_printcount=pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
                     OperateResult.AppendText(">>开始打印箱号" + pa_outboxcode.Text + "\n", Color.Black);
                     doc = lbl.Documents.Open(ftpOperater.DownLoadTo + PrintLabel.Text);
-                    Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text));
+                    if (Print.CodeSoft(Tag.ToString(), doc, PrintLabel.Text, PrintLabel.SelectedValue.ToString(), PrintList.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text),ms_makecode.Text,pr_code.Text,"卡通箱标","0",out ErrorMessage))
+                    {
+                    }
+                    else
+                    {
+                        OperateResult.AppendText(ErrorMessage + "\n", Color.Red);
+                    }
                     pa_outboxcode.Focus();
                     pa_outboxcode.SelectAll();
                 }

+ 56 - 6
UAS-MES/PublicMethod/ModeBusTCPServer.cs

@@ -23,8 +23,8 @@ namespace UAS_MES.PublicMethod
         Thread threadWatch = null; //负责监听客户端的线程
         Socket socketWatch = null; //负责监听客户端的套接字
         Socket socConnection;
-        string ip = "";
-        string port = "";
+        //等待机械臂完成动作
+        bool WaitFinish = true;
 
         public bool IsOpen
         {
@@ -39,12 +39,42 @@ namespace UAS_MES.PublicMethod
             }
         }
 
-        public ModeBusTCPServer(string IP, string Port)
+        public string IP
         {
-            ip = IP;
-            port = Port;
+            get
+            {
+                return iP;
+            }
+
+            set
+            {
+                iP = value;
+            }
+        }
+
+        public string Port
+        {
+            get
+            {
+                return port;
+            }
+
+            set
+            {
+                port = value;
+            }
+        }
+
+        private string iP;
+
+        private string port;
+
+        public ModeBusTCPServer()
+        {
+           
         }
 
+
         public void Open()
         {
             try
@@ -52,7 +82,7 @@ namespace UAS_MES.PublicMethod
                 //定义一个套接字用于监听客户端发来的信息  包含3个参数(IP4寻址协议,流式连接,TCP协议)
                 socketWatch = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
                 //服务端发送信息 需要1个IP地址和端口号
-                IPAddress ipaddress = IPAddress.Parse(ip);
+                IPAddress ipaddress = IPAddress.Parse(iP);
                 //将IP地址和端口号绑定到网络节点endpoint上 
                 IPEndPoint endpoint = new IPEndPoint(ipaddress, int.Parse(port));
                 //监听绑定的网络节点
@@ -88,6 +118,14 @@ namespace UAS_MES.PublicMethod
                 }
                 string stringdata = BitConverter.ToString(datashow);//把数组转换成16进制字符串
                 stringdata = stringdata.Replace("-", "");
+                //503口打开
+                if (stringdata.Substring(7, 1) == "1")
+                {
+                    socConnection.Send(M501_OFF);
+                    socConnection.Send(M502_OFF);
+                    socConnection.Send(M503_OFF);
+                    WaitFinish = false;
+                }
             }
         }
 
@@ -104,12 +142,24 @@ namespace UAS_MES.PublicMethod
             {
                 case "M501_ON":
                     socConnection.Send(M501_ON);
+                    WaitFinish = true;
+                    while (WaitFinish)
+                    {
+                        Thread.Sleep(80);
+                        socConnection.Send(M503_READ);
+                    }
                     break;
                 case "M501_OFF":
                     socConnection.Send(M501_OFF);
                     break;
                 case "M502_ON":
                     socConnection.Send(M502_ON);
+                    WaitFinish = true;
+                    while (WaitFinish)
+                    {
+                        Thread.Sleep(80);
+                        socConnection.Send(M503_READ);
+                    }
                     break;
                 case "M502_OFF":
                     socConnection.Send(M502_OFF);