章政 7 лет назад
Родитель
Сommit
5c812b551c
1 измененных файлов с 10 добавлено и 31 удалено
  1. 10 31
      UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

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

@@ -372,26 +372,6 @@ namespace UAS_LabelMachine
             //采集达到了数量进行换行
             if (CollectQty == double.Parse(CurrentPrCount))
             {
-                //for (int i = 0; i < GridPrcode.Rows.Count; i++)
-                //{
-                //    string outqty = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
-                //    string collectnum = GridPrcode.Rows[i].Cells["CollectedNum"].Value.ToString();
-                //    //采集之前的行,如后续行有物料编号相同的并且编号较大的跳到这样
-                //    if (GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString() == CurrentPrCode && double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
-                //    {
-                //        if (int.Parse(GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString()) > int.Parse(CurrentPDNO))
-                //        {
-                //            GridPrcode.Rows[i].Selected = true;
-                //            if (i - 1 > 0)
-                //                GridPrcode.FirstDisplayedScrollingRowIndex = i - 1;
-                //            else
-                //                GridPrcode.FirstDisplayedScrollingRowIndex = i;
-                //            Input.Clear();
-                //            OutBoxNum_Click(new object(), new EventArgs());
-                //            return;
-                //        }
-                //    }
-                //}
                 DataGridViewSelectedRowCollection selectrow = GridPrcode.SelectedRows;
                 if (selectrow.Count > 0)
                 {
@@ -402,7 +382,6 @@ namespace UAS_LabelMachine
                         if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
                         {
                             GridPrcode.Rows[selectrow[0].Index + 1].Selected = true;
-                            GridPrcode.FirstDisplayedScrollingRowIndex = selectrow[0].Index + 1;
                         }
                     }
                 }
@@ -568,8 +547,8 @@ namespace UAS_LabelMachine
                         if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
                         {
                             GridPrcode.Rows[i].Selected = true;
-                            if (i - 1 > 0)
-                                GridPrcode.FirstDisplayedScrollingRowIndex = i - 1;
+                            if (i - 2 >= 0)
+                                GridPrcode.FirstDisplayedScrollingRowIndex = i - 2;
                             else
                                 GridPrcode.FirstDisplayedScrollingRowIndex = i;
                         }
@@ -1084,7 +1063,6 @@ namespace UAS_LabelMachine
             {
                 BaseUtil.FillDgvWithDataTable(LabelInf, LabelInfDataTable);
             }
-            //有数据的话默认取第一条的品牌去取采集策略
             if (LabelInf.Rows.Count > 0)
                 LabelInf.FirstDisplayedScrollingRowIndex = LabelInf.Rows.Count - 1;
             double CollectNum = 0;
@@ -1355,7 +1333,6 @@ namespace UAS_LabelMachine
                 CurrentPrCount = GridPrcode.Rows[0].Cells["pd_outqty"].Value.ToString();
                 CurrentBrand = GridPrcode.Rows[0].Cells["pd_brand"].Value.ToString();
                 GridPrcode.Rows[0].Selected = true;
-                GridPrcode.FirstDisplayedScrollingRowIndex = 0;
             }
         }
 
@@ -1474,8 +1451,10 @@ namespace UAS_LabelMachine
             CurrentPrCount = GridPrcode.Rows[e.RowIndex].Cells["pd_outqty"].Value.ToString();
             CurrentBrand = GridPrcode.Rows[e.RowIndex].Cells["pd_brand"].Value.ToString();
             GridPrcode.Rows[e.RowIndex].Selected = true;
-            GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex;
-            //dh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' and pib_pdno='" + CurrentPDNO + "' and pib_prodcode='" + CurrentPrCode + "'", "delete");
+            if (e.RowIndex - 2 >= 0)
+                GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex - 2;
+            else
+                GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex;
             LoadGridData(sender, new EventArgs());
         }
 
@@ -1491,8 +1470,8 @@ namespace UAS_LabelMachine
                 CurrentPrCount = GridPrcode.Rows[dsc[0].Index].Cells["pd_outqty"].Value.ToString();
                 CurrentBrand = GridPrcode.Rows[dsc[0].Index].Cells["pd_brand"].Value.ToString();
                 GridPrcode.Rows[dsc[0].Index].Selected = true;
-                if (dsc[0].Index - 1 > 0)
-                    GridPrcode.FirstDisplayedScrollingRowIndex = dsc[0].Index - 1;
+                if (dsc[0].Index - 2 >= 0)
+                    GridPrcode.FirstDisplayedScrollingRowIndex = dsc[0].Index - 2;
                 else
                     GridPrcode.FirstDisplayedScrollingRowIndex = dsc[0].Index;
             }
@@ -1505,8 +1484,8 @@ namespace UAS_LabelMachine
             if (e.RowIndex >= 0)
             {
                 GridPrcode.Rows[e.RowIndex].Selected = true;
-                if (e.RowIndex - 1 > 0)
-                    GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex - 1;
+                if (e.RowIndex - 2 > 0)
+                    GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex - 2;
                 else
                     GridPrcode.FirstDisplayedScrollingRowIndex = e.RowIndex;
             }