Browse Source

栈板称重不勾选打印记录称重信息

shim 8 years ago
parent
commit
179a914978
1 changed files with 16 additions and 10 deletions
  1. 16 10
      UAS-MES/FunctionCode/Make/Make_PalletWeigh.cs

+ 16 - 10
UAS-MES/FunctionCode/Make/Make_PalletWeigh.cs

@@ -106,6 +106,13 @@ namespace UAS_MES.Make
                 {
                     //给页面赋值
                     BaseUtil.SetFormValue(this.Controls,dt);
+                    //刷新grid的历史称重信息;
+                    if (int.Parse(weight.Text) == 0)
+                    {
+                        OperateResult.AppendText("<<重量不能等于0\n", Color.Red);
+                        palletcode.Text = "";
+                        return;
+                    }
                     // 更新大箱重量
                     sql.Clear();
                     sql.Append("update package set pa_weight=:weight where pa_id=:pa_id ");
@@ -125,12 +132,16 @@ namespace UAS_MES.Make
                         dh.ExecuteSql(sql.GetString(), "insert", pa_makecode.Text, info.Rows[0]["ma_id"].ToString(), User.CurrentStepCode, User.CurrentStepName, "称重成功,栈板号:" + palletcode.Text + ",重量:" + weight.Text + "克", User.UserName, info.Rows[0]["ma_wccode"].ToString(), User.UserLineCode, User.UserSourceCode, palletcode.Text);
                         //提示信息栏显示:<< 栈板号:XXXX,重量:xxxx 克,
                         OperateResult.AppendText("<<栈板号:" + palletcode.Text + ",重量:" + weight.Text + "克\n", Color.Green);
+                        //刷新称重计数+1
+                        weightedNum.Text = int.Parse(weightedNum.Text) + 1 + "";
+                        recordResult(palletcode.Text, weight.Text, System.DateTime.Now.ToString());
                         //如果用户勾选了自动打印,调用打印, 打印成功,消息提示栏显示“打印成功”,“请输入栈板号”
                         if (autoPrint.Checked == true)
                         {
                             try
                             {
-                                if (PrintLabel.SelectedValue.ToString()=="") {
+                                if (PrintLabel.SelectedValue.ToString() == "")
+                                {
                                     OperateResult.AppendText(">>产品:" + pa_prodcode.Text + "未维护栈板标签模板\n", Color.Red);
                                     palletcode.Text = "";
                                     return;
@@ -151,18 +162,13 @@ namespace UAS_MES.Make
                             sql.Clear();
                             sql.Append("update package set pa_printcount= pa_printcount+1  where pa_id=:pa_id");
                             dh.ExecuteSql(sql.GetString(), "update", dt.Rows[0]["pa_id"].ToString());
-                            //刷新称重计数+1
-                            weightedNum.Text = int.Parse(weightedNum.Text) + 1 + "";
-                            //刷新grid的历史称重信息;
-                            if (int.Parse(weight.Text)==0) {
-                                OperateResult.AppendText("<<重量不能等于0\n", Color.Red);
-                                palletcode.Text = "";
-                                return;
-                            }
-                            recordResult(palletcode.Text,weight.Text, System.DateTime.Now.ToString());
                             //清空输入框中的值,扫描框置空定焦
                             palletcode.Text = "";
                         }
+                        else
+                        {
+                            OperateResult.AppendText("<<需打印请勾选自动打印\n", Color.Red);
+                        }
                     }
                 }
             }