浏览代码

修改栈板采集BUG

章政 8 年之前
父节点
当前提交
1f5cd1cf52
共有 1 个文件被更改,包括 16 次插入18 次删除
  1. 16 18
      UAS-MES/FunctionCode/Make/Make_PalletCollection.cs

+ 16 - 18
UAS-MES/FunctionCode/Make/Make_PalletCollection.cs

@@ -84,13 +84,12 @@ namespace UAS_MES.Make
             if (e.KeyCode == Keys.Enter)
             {
                 sql.Clear();
-                sql.Append("select pa_makecode,pa_id,nvl(pa_standardqty,PR_PALLETQTY)pa_standardqty,pa_status,pa_packageqty,pa_totalqty,pa_currentqty,pa_outboxcode,pa_totalqty,pa_custcode ");
+                sql.Append("select pa_makecode,pa_id,pa_status,pa_standardqty,pa_packageqty,pa_totalqty,pa_currentqty,pa_outboxcode,pa_totalqty,pa_custcode ");
                 sql.Append("from package left join packagedetail on pa_id =pd_paid left join product on pr_code=pd_prodcode where pa_outboxcode='" + pa_outboxcode.Text + "' and pa_type =3");
                 DataTable dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                 if (dt.Rows.Count > 0)
                 {
                     BaseUtil.SetFormValue(Controls, dt);
-                    stantdqty = dt.Rows[0]["pa_standardqty"].ToString();
                     LoadGridData();
                     pa_id = dt.Rows[0]["pa_id"].ToString();
                     outboxcode.Focus();
@@ -112,15 +111,11 @@ namespace UAS_MES.Make
                         return;
                     }
                     sql.Clear();
-                    sql.Append("select pd_makecode pa_makecode,nvl(pa_downstatus,0)pa_downstatus,pr_packrule,nvl(pa_standardqty,PR_PALLETQTY)pa_standardqty,pa_id,pd_prodcode pa_prodcode,pa_mothercode,pa_salecode,pa_status,pa_nextstep from packagedetail ");
+                    sql.Append("select pd_makecode pa_makecode,nvl(pa_downstatus,0)pa_downstatus,pr_packrule,pa_id,pd_prodcode pa_prodcode,pa_mothercode,pa_salecode,pa_status,pa_nextstep from packagedetail ");
                     sql.Append("left join package on pd_paid=pa_id left join product on pr_code=pd_prodcode where pd_outboxcode='" + outboxcode.Text + "'");
                     dt = (DataTable)dh.ExecuteSql(sql.GetString(), "select");
                     if (dt.Rows.Count > 0)
                     {
-                        if (pa_standardqty.Text != "")
-                        {
-                            dt.Columns.Remove("pa_standardqty");
-                        }
                         BaseUtil.SetFormValue(this.Controls, dt);
                         if (dt.Rows[0]["pa_downstatus"].ToString() != "0")
                         {
@@ -219,7 +214,7 @@ namespace UAS_MES.Make
                                 if (dt.Rows[0]["pa_status"].ToString() == "1")
                                 {
                                     pa_totalqty.Text = dh.getFieldDataByCondition("package", "pa_totalqty", "pa_outboxcode='" + pa_outboxcode.Text + "'").ToString();
-                                    if (int.Parse(pa_totalqty.Text == "" ? "0" : pa_totalqty.Text) + sonboxtotalqty > int.Parse(pa_standardqty.Text))
+                                    if (int.Parse(pa_totalqty.Text == "" ? "0" : pa_totalqty.Text) + sonboxtotalqty > int.Parse(pa_standardqty.Text == "" ? "0" : pa_standardqty.Text))
                                     {
                                         OperateResult.AppendText(">>采集箱号" + outboxcode.Text + "后超出容量\n", Color.Red, outboxcode);
                                         return;
@@ -448,20 +443,23 @@ namespace UAS_MES.Make
 
         private void ResetPackageQTY()
         {
-            DataTable dt = (DataTable)dh.ExecuteSql("select pa_totalqty from package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
-            if (dt.Rows.Count > 0)
+            if (pa_outboxcode.Text != "")
             {
-                string total = dt.Rows[0]["pa_totalqty"].ToString();
-                if (int.Parse(pa_standardqty.Text) >= int.Parse(total))
+                DataTable dt = (DataTable)dh.ExecuteSql("select pa_totalqty,pa_status from package where pa_outboxcode='" + pa_outboxcode.Text + "'", "select");
+                if (dt.Rows.Count > 0)
                 {
-                    dh.UpdateByCondition("package", "pa_standardqty='" + pa_standardqty.Text + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
-                    OperateResult.AppendText(">>修改容量成功,已修改为" + pa_standardqty.Text + "\n", Color.Green);
-                    return;
+                    string total = dt.Rows[0]["pa_totalqty"].ToString();
+                    if (int.Parse(pa_standardqty.Text) >= int.Parse(total))
+                    {
+                        dh.UpdateByCondition("package", "pa_standardqty='" + pa_standardqty.Text + "'", "pa_outboxcode='" + pa_outboxcode.Text + "'");
+                        OperateResult.AppendText(">>修改容量成功,已修改为" + pa_standardqty.Text + "\n", Color.Green);
+                        return;
+                    }
+                    else OperateResult.AppendText(">>容量不能小于已装数量\n", Color.Red);
                 }
-                else OperateResult.AppendText(">>容量不能小于已装数量\n", Color.Red);
+                else OperateResult.AppendText(">>栈板号不存在\n", Color.Red);
+                pa_standardqty.Text = stantdqty;
             }
-            else OperateResult.AppendText(">>栈板号不存在\n", Color.Red);
-            pa_standardqty.Text = stantdqty;
         }
     }
 }