فهرست منبع

大箱采集修改

Hcsy 8 سال پیش
والد
کامیت
abc914b9f2
2فایلهای تغییر یافته به همراه69 افزوده شده و 69 حذف شده
  1. 21 33
      UAS-MES/FunctionCode/Make/Make_BigBoxWeight.Designer.cs
  2. 48 36
      UAS-MES/FunctionCode/Make/Make_BigBoxWeight.cs

+ 21 - 33
UAS-MES/FunctionCode/Make/Make_BigBoxWeight.Designer.cs

@@ -48,11 +48,10 @@
             this.autoprint = new System.Windows.Forms.CheckBox();
             this.已称 = new System.Windows.Forms.Label();
             this.showResult = new System.Windows.Forms.ListView();
+            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.箱号 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.重量 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
             this.称重时间 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
-            this.ComList = new UAS_MES.CustomControl.ComBoxWithFocus.SerialPortCombox();
             this.BaudRate = new UAS_MES.CustomControl.TextBoxWithIcon.NumOnlyTextBox();
             this.weightsum = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
             this.pa_packageqty = new UAS_MES.CustomControl.ValueLabel.ValueLabel();
@@ -75,7 +74,7 @@
             // 
             this.label15.AutoSize = true;
             this.label15.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label15.Location = new System.Drawing.Point(22, 19);
+            this.label15.Location = new System.Drawing.Point(22, 17);
             this.label15.Name = "label15";
             this.label15.Size = new System.Drawing.Size(86, 31);
             this.label15.TabIndex = 57;
@@ -131,7 +130,7 @@
             // 
             this.pa_makecode_label.AutoSize = true;
             this.pa_makecode_label.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_makecode_label.Location = new System.Drawing.Point(24, 191);
+            this.pa_makecode_label.Location = new System.Drawing.Point(34, 191);
             this.pa_makecode_label.Name = "pa_makecode_label";
             this.pa_makecode_label.Size = new System.Drawing.Size(58, 21);
             this.pa_makecode_label.TabIndex = 73;
@@ -151,7 +150,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(24, 333);
+            this.label2.Location = new System.Drawing.Point(24, 327);
             this.label2.Name = "label2";
             this.label2.Size = new System.Drawing.Size(74, 21);
             this.label2.TabIndex = 75;
@@ -161,7 +160,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(24, 412);
+            this.pr_detail_label.Location = new System.Drawing.Point(24, 406);
             this.pr_detail_label.Name = "pr_detail_label";
             this.pr_detail_label.Size = new System.Drawing.Size(74, 21);
             this.pr_detail_label.TabIndex = 76;
@@ -276,6 +275,10 @@
             this.showResult.UseCompatibleStateImageBehavior = false;
             this.showResult.View = System.Windows.Forms.View.Details;
             // 
+            // columnHeader1
+            // 
+            this.columnHeader1.Text = "";
+            // 
             // 箱号
             // 
             this.箱号.Text = "箱号";
@@ -292,25 +295,12 @@
             this.称重时间.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
             this.称重时间.Width = 150;
             // 
-            // columnHeader1
-            // 
-            this.columnHeader1.Text = "";
-            // 
-            // ComList
-            // 
-            this.ComList.Location = new System.Drawing.Point(491, 91);
-            this.ComList.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
-            this.ComList.Name = "ComList";
-            this.ComList.Size = new System.Drawing.Size(119, 20);
-            this.ComList.TabIndex = 187;
-            this.ComList.Visible = false;
-            // 
             // BaudRate
             // 
             this.BaudRate.AllPower = null;
             this.BaudRate.BackColor = System.Drawing.Color.White;
             this.BaudRate.ID = null;
-            this.BaudRate.Location = new System.Drawing.Point(491, 63);
+            this.BaudRate.Location = new System.Drawing.Point(709, 101);
             this.BaudRate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.BaudRate.Name = "BaudRate";
             this.BaudRate.Negative = false;
@@ -327,7 +317,7 @@
             this.weightsum.AutoSize = true;
             this.weightsum.CutLength = null;
             this.weightsum.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.weightsum.Location = new System.Drawing.Point(566, 122);
+            this.weightsum.Location = new System.Drawing.Point(540, 123);
             this.weightsum.MaximumSize = new System.Drawing.Size(150, 0);
             this.weightsum.Name = "weightsum";
             this.weightsum.Size = new System.Drawing.Size(0, 27);
@@ -339,7 +329,7 @@
             this.pa_packageqty.AutoSize = true;
             this.pa_packageqty.CutLength = null;
             this.pa_packageqty.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_packageqty.Location = new System.Drawing.Point(335, 254);
+            this.pa_packageqty.Location = new System.Drawing.Point(335, 257);
             this.pa_packageqty.MaximumSize = new System.Drawing.Size(150, 0);
             this.pa_packageqty.Name = "pa_packageqty";
             this.pa_packageqty.Size = new System.Drawing.Size(0, 27);
@@ -351,7 +341,7 @@
             this.pa_salecode.AutoSize = true;
             this.pa_salecode.CutLength = null;
             this.pa_salecode.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_salecode.Location = new System.Drawing.Point(335, 185);
+            this.pa_salecode.Location = new System.Drawing.Point(335, 188);
             this.pa_salecode.MaximumSize = new System.Drawing.Size(150, 0);
             this.pa_salecode.Name = "pa_salecode";
             this.pa_salecode.Size = new System.Drawing.Size(0, 27);
@@ -363,7 +353,7 @@
             this.pr_detail.AutoSize = true;
             this.pr_detail.CutLength = null;
             this.pr_detail.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pr_detail.Location = new System.Drawing.Point(108, 408);
+            this.pr_detail.Location = new System.Drawing.Point(108, 403);
             this.pr_detail.MaximumSize = new System.Drawing.Size(150, 0);
             this.pr_detail.Name = "pr_detail";
             this.pr_detail.Size = new System.Drawing.Size(0, 27);
@@ -375,7 +365,7 @@
             this.pa_prodcode.AutoSize = true;
             this.pa_prodcode.CutLength = null;
             this.pa_prodcode.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_prodcode.Location = new System.Drawing.Point(108, 333);
+            this.pa_prodcode.Location = new System.Drawing.Point(108, 324);
             this.pa_prodcode.MaximumSize = new System.Drawing.Size(150, 0);
             this.pa_prodcode.Name = "pa_prodcode";
             this.pa_prodcode.Size = new System.Drawing.Size(0, 27);
@@ -388,7 +378,7 @@
             this.pa_totalqty.AutoSize = true;
             this.pa_totalqty.CutLength = null;
             this.pa_totalqty.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_totalqty.Location = new System.Drawing.Point(108, 260);
+            this.pa_totalqty.Location = new System.Drawing.Point(108, 259);
             this.pa_totalqty.MaximumSize = new System.Drawing.Size(150, 0);
             this.pa_totalqty.Name = "pa_totalqty";
             this.pa_totalqty.Size = new System.Drawing.Size(0, 27);
@@ -400,7 +390,7 @@
             this.pa_makecode.AutoSize = true;
             this.pa_makecode.CutLength = null;
             this.pa_makecode.Font = new System.Drawing.Font("微软雅黑", 15F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.pa_makecode.Location = new System.Drawing.Point(98, 185);
+            this.pa_makecode.Location = new System.Drawing.Point(108, 188);
             this.pa_makecode.MaximumSize = new System.Drawing.Size(150, 0);
             this.pa_makecode.Name = "pa_makecode";
             this.pa_makecode.Size = new System.Drawing.Size(0, 27);
@@ -414,7 +404,7 @@
             this.StartWeight.DownImage = ((System.Drawing.Image)(resources.GetObject("StartWeight.DownImage")));
             this.StartWeight.Image = ((System.Drawing.Image)(resources.GetObject("StartWeight.Image")));
             this.StartWeight.IsShowBorder = true;
-            this.StartWeight.Location = new System.Drawing.Point(491, 26);
+            this.StartWeight.Location = new System.Drawing.Point(481, 14);
             this.StartWeight.MoveImage = ((System.Drawing.Image)(resources.GetObject("StartWeight.MoveImage")));
             this.StartWeight.Name = "StartWeight";
             this.StartWeight.NormalImage = ((System.Drawing.Image)(resources.GetObject("StartWeight.NormalImage")));
@@ -432,7 +422,7 @@
             this.StopWeight.DownImage = ((System.Drawing.Image)(resources.GetObject("StopWeight.DownImage")));
             this.StopWeight.Image = ((System.Drawing.Image)(resources.GetObject("StopWeight.Image")));
             this.StopWeight.IsShowBorder = true;
-            this.StopWeight.Location = new System.Drawing.Point(586, 26);
+            this.StopWeight.Location = new System.Drawing.Point(576, 14);
             this.StopWeight.MoveImage = ((System.Drawing.Image)(resources.GetObject("StopWeight.MoveImage")));
             this.StopWeight.Name = "StopWeight";
             this.StopWeight.NormalImage = ((System.Drawing.Image)(resources.GetObject("StopWeight.NormalImage")));
@@ -483,7 +473,7 @@
             this.pa_outboxcode.BackColor = System.Drawing.Color.White;
             this.pa_outboxcode.Font = new System.Drawing.Font("微软雅黑", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.pa_outboxcode.ID = null;
-            this.pa_outboxcode.Location = new System.Drawing.Point(133, 11);
+            this.pa_outboxcode.Location = new System.Drawing.Point(132, 14);
             this.pa_outboxcode.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
             this.pa_outboxcode.Name = "pa_outboxcode";
             this.pa_outboxcode.Power = "ifwrite";
@@ -498,9 +488,8 @@
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(1147, 588);
+            this.ClientSize = new System.Drawing.Size(1147, 552);
             this.Controls.Add(this.showResult);
-            this.Controls.Add(this.ComList);
             this.Controls.Add(this.BaudRate);
             this.Controls.Add(this.weightsum);
             this.Controls.Add(this.已称);
@@ -578,7 +567,6 @@
         private CustomControl.ValueLabel.ValueLabel pa_packageqty;
         private System.Windows.Forms.Label 已称;
         private CustomControl.ValueLabel.ValueLabel weightsum;
-        private CustomControl.ComBoxWithFocus.SerialPortCombox ComList;
         private CustomControl.TextBoxWithIcon.NumOnlyTextBox BaudRate;
         private System.Windows.Forms.ListView showResult;
         public System.Windows.Forms.ColumnHeader 箱号;

+ 48 - 36
UAS-MES/FunctionCode/Make/Make_BigBoxWeight.cs

@@ -34,7 +34,7 @@ namespace UAS_MES.Make
         ApplicationClass lbl;
 
         Thread thread;
-        
+
         Thread InitPrint;
 
         //打印计数
@@ -46,8 +46,8 @@ namespace UAS_MES.Make
         //存储当前大箱号
         string outboxcode = "";
         //记录称重串口号和波特率
-        string Comlist;
-        string Baurate;
+        string Comlist = "";
+        string Baurate = "";
 
         public Make_BigBoxWeight()
         {
@@ -89,7 +89,7 @@ namespace UAS_MES.Make
                 sql.Clear();
                 sql.Append(" select pa_id,pa_prodcode,pr_spec,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='"+ pa_outboxcode.Text + "' and pa_type=2");
+                sql.Append(" pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type=2");
                 dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 outboxcode = pa_outboxcode.Text;
                 BaseUtil.CleanForm(this);
@@ -99,50 +99,62 @@ namespace UAS_MES.Make
                     BaseUtil.SetFormValue(this.Controls, dt);
                     pa_outboxcode.Text = outboxcode;
                 }
-                else {
+                else
+                {
                     OperateResult.AppendText(">>箱号不存在\n", Color.Red);
                     return;
                 }
                 int ActualWeight = int.Parse(weight.Text == "" ? "0" : weight.Text);
-                //更新大箱重量
-                sql.Clear();
-                sql.Append("update package set pa_weight='"+ActualWeight+ "' where pa_outboxcode= '"+ pa_outboxcode.Text + "'");
-                dh.ExecuteSql(sql.GetString(),"update");
-                OperateResult.AppendText("<<<箱号:" + pa_outboxcode.Text + ",重量:"+ ActualWeight + "克\n", Color.Green);
-                //记录makeprocess     
-                sql.Clear();
-                sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid,mp_stepcode,mp_stepname ,");
-                sql.Append("mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snoutboxcode)");
-                sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,'" + User.CurrentStepCode + "','" + User.CurrentStepName + "',");
-                sql.Append("'" + "大箱称重" + "','" + "称重成功,大箱箱号"+pa_outboxcode.Text +",重量:"+ ActualWeight + "克" + "',sysdate,'" + User.UserName + "',ma_wccode,'" + User.UserLineCode + "','" + User.UserSourceCode + "',");
-                sql.Append("'"+ pa_outboxcode.Text + "' from make left join makeserial on ms_makecode=ma_code  ");
-                sql.Append("where ma_code='" + pa_makecode.Text + "'");
-                dh.ExecuteSql(sql.GetString(), "insert");
-                OperateResult.AppendText("<<<更新成功\n", Color.Green);
-
-                if (autoprint.Checked == true)
+                if (ActualWeight > 0)
                 {
-                    try
+                    //更新大箱重量
+                    sql.Clear();
+                    sql.Append("update package set pa_weight='" + ActualWeight + "' where pa_outboxcode= '" + pa_outboxcode.Text + "'");
+                    dh.ExecuteSql(sql.GetString(), "update");
+                    OperateResult.AppendText("<<<箱号:" + pa_outboxcode.Text + ",重量:" + ActualWeight + "克\n", Color.Green);
+                    //记录makeprocess     
+                    sql.Clear();
+                    sql.Append("insert into MakeProcess(mp_id,mp_makecode,mp_maid,mp_stepcode,mp_stepname ,");
+                    sql.Append("mp_kind,mp_result,mp_indate,mp_inman,mp_wccode,mp_linecode,mp_sourcecode,mp_snoutboxcode)");
+                    sql.Append("select MakeProcess_seq.nextval, ma_code,ma_id,'" + User.CurrentStepCode + "','" + User.CurrentStepName + "',");
+                    sql.Append("'" + "大箱称重" + "','" + "称重成功,大箱箱号" + pa_outboxcode.Text + ",重量:" + ActualWeight + "克" + "',sysdate,'" + User.UserName + "',ma_wccode,'" + User.UserLineCode + "','" + User.UserSourceCode + "',");
+                    sql.Append("'" + pa_outboxcode.Text + "' from make left join makeserial on ms_makecode=ma_code  ");
+                    sql.Append("where ma_code='" + pa_makecode.Text + "'");
+                    dh.ExecuteSql(sql.GetString(), "insert");
+                    OperateResult.AppendText("<<<更新成功\n", Color.Green);
+                    if (autoprint.Checked == true)
                     {
-                        Print.CodeSoft(lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), Printer.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
-                        dh.ExecuteSql("update package set pa_printcount= pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
-                        printcount++;
-                        weightsum.Text = printcount + "";
-                        //刷新grid的历史称重信息;
-                        recordResult(pa_outboxcode.Text, weight.Text, System.DateTime.Now.ToString());
-                        //清空输入框中的值,扫描框置空定焦
-                        pa_outboxcode.Text = "";
-                        pa_outboxcode.Focus();
+                        try
+                        {
+                            Print.CodeSoft(lbl, PrintLabel.Text.Split(':')[1], PrintLabel.SelectedValue.ToString(), Printer.Text, pa_outboxcode.Text, int.Parse(PrintNum.Text), indate[PrintLabel.SelectedIndex]);
+                            dh.ExecuteSql("update package set pa_printcount= pa_printcount+1 where pa_outboxcode='" + pa_outboxcode.Text + "'", "update");
+                            printcount++;
+                            weightsum.Text = printcount + "";
+                            //刷新grid的历史称重信息;
+                            recordResult(pa_outboxcode.Text, weight.Text, System.DateTime.Now.ToString());
+                            //清空输入框中的值,扫描框置空定焦
+                            pa_outboxcode.Text = "";
+                            pa_outboxcode.Focus();
+                        }
+                        catch(Exception eb)
+                        {
+                            if (PrintLabel.SelectedValue == null)
+                            {
+                                OperateResult.AppendText(">>产品:" + pa_prodcode.Text + "未维护大箱标签模板\n", Color.Red);
+                                pa_outboxcode.Text = "";
+                                pa_outboxcode.Focus();
+                            }else
+                            OperateResult.AppendText("<<<打印失败:"+eb.Message+"\n", Color.Red);
+                        }
                     }
-                    catch
+                    else
                     {
-                        OperateResult.AppendText("<<<打印失败\n", Color.Red);
+                        OperateResult.AppendText("<<<需打印请勾选自动打印\n", Color.Red);
                     }
                 }
                 else {
-                        OperateResult.AppendText("<<<需打印请勾选自动打印\n", Color.Red);
+                       OperateResult.AppendText("<<<大箱重量应大于0\n", Color.Red);
                 }
-
             }
         }