Browse Source

BUG修改

章政 7 years ago
parent
commit
02c02226cc
1 changed files with 25 additions and 12 deletions
  1. 25 12
      UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

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

@@ -308,19 +308,20 @@ namespace UAS_LabelMachine
                         break;
                 }
             }
+            //校验DateCode是否过期
             if (!CheckDateCode(Data["DATECODE"]))
             {
-                MessageBox.Show("物料DateCode超出校验日期");
+                MessageBox.Show("物料"+Data["PRCODE"]+"【DateCode超出校验日期");
                 return;
             }
             if (Data["PRCODE"] != CurrentPrCode)
             {
-                MessageBox.Show("当前采集物料编号不对应,请重新采集", "提示");
+                MessageBox.Show("当前采集物料编号不对应,请重新采集", "提示");
                 return;
             }
             if (Data["BRAND"] != CurrentBrand)
             {
-                MessageBox.Show("当前采集品牌不对应,请重新采集", "提示");
+                MessageBox.Show("当前采集品牌不对应,请重新采集", "提示");
                 return;
             }
             int CodeCount = 0;
@@ -330,7 +331,7 @@ namespace UAS_LabelMachine
             {
                 if (int.Parse(Data["QTY"]) / 1000 % int.Parse(CurrentZXBZ) != 0)
                 {
-                    MessageBox.Show("采集数量无法按照最小包装数拆分");
+                    MessageBox.Show("物料"+Data["PRCODE"]+"采集数量无法按照最小包装数拆分","提示");
                     return;
                 }
                 CodeCount = int.Parse(Data["QTY"]) / 1000 / int.Parse(CurrentZXBZ);
@@ -340,7 +341,7 @@ namespace UAS_LabelMachine
             {
                 if (int.Parse(Data["QTY"]) % int.Parse(CurrentZXBZ) != 0)
                 {
-                    MessageBox.Show("采集数量无法按照最小包装数拆分", "提示");
+                    MessageBox.Show("采集数量无法按照最小包装数拆分", "提示");
                     return;
                 }
                 CodeCount = int.Parse(Data["QTY"]) / int.Parse(CurrentZXBZ);
@@ -375,7 +376,7 @@ namespace UAS_LabelMachine
             int CollectQty = (collectqty == "" ? 0 : int.Parse(collectqty));
             if (CollectQty + CollectNum > int.Parse(CurrentPrCount))
             {
-                MessageBox.Show("采集后超出数量", "提示");
+                MessageBox.Show("物料"+Data["PRCODE"]+"采集后超出数量", "提示");
                 return;
             }
             List<string> CustBarCode = new List<string>();
@@ -446,6 +447,13 @@ namespace UAS_LabelMachine
             {
                 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 (int.Parse(outqty) > int.Parse(collectnum == "" ? "0" : collectnum))
+                    {
+                        GridPrcode.Rows[i].Selected = true;
+                    }
+                    //采集之前的行,如后续行有物料编号相同的并且编号较大的跳到这样
                     if (GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString() == CurrentPrCode)
                     {
                         if (int.Parse(GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString()) > int.Parse(CurrentPDNO))
@@ -455,11 +463,6 @@ namespace UAS_LabelMachine
                         }
                     }
                 }
-                DataGridViewSelectedRowCollection dsc = GridPrcode.SelectedRows;
-                if (dsc[0].Index + 1 < GridPrcode.Rows.Count)
-                {
-                    GridPrcode.Rows[dsc[0].Index + 1].Selected = true;
-                }
             }
             OutBoxNum_Click(new object(), new EventArgs());
         }
@@ -694,6 +697,16 @@ namespace UAS_LabelMachine
                     MidIDAndOutboxcode.Clear();
                     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 (int.Parse(outqty) > int.Parse(collectnum == "" ? "0" : collectnum))
+                        {
+                            GridPrcode.Rows[i].Selected = true;
+                        }
+                    }
                     thread = new Thread(GetInOutInfAndLabelFile);
                     stw = new SetLoadingWindow(thread, "正在获取打印标签");
                     BaseUtil.SetFormCenter(stw);
@@ -1267,7 +1280,7 @@ namespace UAS_LabelMachine
             TotalCount.Text = LabelInf.RowCount.ToString();
             if (LabelInf.Rows.Count > 0)
                 LabelInf.FirstDisplayedScrollingRowIndex = LabelInf.Rows.Count - 1;
-
+            //计算所有的采集数量
             for (int i = 0; i < GridPrcode.Rows.Count; i++)
             {
                 string CurrentPrCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();