浏览代码

跳行调整

章政 7 年之前
父节点
当前提交
a9e59f3269
共有 1 个文件被更改,包括 26 次插入23 次删除
  1. 26 23
      UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

+ 26 - 23
UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

@@ -389,16 +389,19 @@ namespace UAS_LabelMachine
                         }
                     }
                 }
-                //for (int i = GridPrcode.Rows.Count - 1; i >= 0; i--)
-                //{
-                //    string outqty = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
-                //    string collectnum = GridPrcode.Rows[i].Cells["CollectedNum"].Value.ToString();
-                //    if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
-                //    {
-                //        GridPrcode.Rows[i].Selected = true;
-                //        GridPrcode.FirstDisplayedScrollingRowIndex = i;
-                //    }
-                //}
+                DataGridViewSelectedRowCollection selectrow = GridPrcode.SelectedRows;
+                if (selectrow.Count > 0)
+                {
+                    if (selectrow[0].Index + 1 < GridPrcode.Rows.Count) {
+                        string outqty = GridPrcode.Rows[selectrow[0].Index + 1].Cells["pd_outqty"].Value.ToString();
+                        string collectnum = GridPrcode.Rows[selectrow[0].Index + 1].Cells["CollectedNum"].Value.ToString();
+                        if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
+                        {
+                            GridPrcode.Rows[selectrow[0].Index + 1].Selected = true;
+                            GridPrcode.FirstDisplayedScrollingRowIndex = selectrow[0].Index + 1;
+                        }
+                    }
+                }
             }
             Input.Clear();
             OutBoxNum_Click(new object(), new EventArgs());
@@ -584,19 +587,19 @@ namespace UAS_LabelMachine
                     SingleID.Clear();
                     Input.Focus();
                     ////从后往前找未采集的行
-                    //for (int i = GridPrcode.Rows.Count - 1; i >= 0; i--)
-                    //{
-                    //    string outqty = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
-                    //    string collectnum = GridPrcode.Rows[i].Cells["CollectedNum"].Value.ToString();
-                    //    if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
-                    //    {
-                    //        GridPrcode.Rows[i].Selected = true;
-                    //        if (i - 1 > 0)
-                    //            GridPrcode.FirstDisplayedScrollingRowIndex = i - 1;
-                    //        else
-                    //            GridPrcode.FirstDisplayedScrollingRowIndex = i;
-                    //    }
-                    //}
+                    for (int i = GridPrcode.Rows.Count - 1; i >= 0; i--)
+                    {
+                        string outqty = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
+                        string collectnum = GridPrcode.Rows[i].Cells["CollectedNum"].Value.ToString();
+                        if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
+                        {
+                            GridPrcode.Rows[i].Selected = true;
+                            if (i - 1 > 0)
+                                GridPrcode.FirstDisplayedScrollingRowIndex = i - 1;
+                            else
+                                GridPrcode.FirstDisplayedScrollingRowIndex = i;
+                        }
+                    }
                     bi_inman.Text = dh.getFieldDataByCondition("barcodeio left join employee on bi_inman=em_code", "wm_concat(distinct em_name)", "bi_piid=" + PI_ID).ToString();
                     pib_inman.Text = dh.getFieldDataByCondition("prodiobarcode left join employee on pib_inman=em_code", "wm_concat(distinct em_name)", "pib_piid=" + PI_ID).ToString();
                     Attach = (DataTable)dh.ExecuteSql("select lap_param lp_name,lap_value lp_sql from LABELATTACHPARAMETER where lap_custcode='" + pi_cardcode.Text + "'", "select");