Sfoglia il codice sorgente

调整合并数量

章政 7 anni fa
parent
commit
c4da9c2025
1 ha cambiato i file con 30 aggiunte e 28 eliminazioni
  1. 30 28
      UAS-出货标签管理(泽天)/UAS_出货标签管理.cs

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

@@ -266,7 +266,7 @@ namespace UAS_LabelMachine
             if (CurrentUnit == "KPCS")
             {
                 //如果单位是KPCS则必须是1000的整数倍
-                if (Convert.ToDouble((double.Parse(Data["QTY"]) / 1000).ToString("0.000")) % Convert.ToDouble(double.Parse(CurrentZXBZ).ToString("0.000")) != 0)
+                if (Convert.ToDouble((double.Parse(Data["QTY"]) / 1000).ToString("0.000")) / Convert.ToDouble(double.Parse(CurrentZXBZ).ToString("0.000")) % 1 != 0)
                 {
                     MessageBox.Show("物料" + Data["PRCODE"] + "采集数量无法按照最小包装数拆分", "提示");
                     Input.SelectAll();
@@ -1061,21 +1061,6 @@ namespace UAS_LabelMachine
             //有数据的话默认取第一条的品牌去取采集策略
             if (LabelInf.Rows.Count > 0)
                 LabelInf.FirstDisplayedScrollingRowIndex = LabelInf.Rows.Count - 1;
-            //计算所有的采集数量
-            double CollectNum = 0;
-            double OutNum = 0;
-            for (int i = 0; i < GridPrcode.Rows.Count; i++)
-            {
-                string CurrentPrCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
-                string CurrentPDNO = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
-                string CurrentOutQTY = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
-                string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
-                CollectNum += double.Parse(collectqty == "" ? "0" : collectqty);
-                OutNum += double.Parse(CurrentOutQTY);
-                GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty;
-                GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = Convert.ToDouble(double.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - double.Parse(collectqty == "" ? "0" : collectqty)).ToString("0.000");
-            }
-            ProcessCount.Text = CollectNum + "/" + OutNum;
         }
 
         private void Refresh_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
@@ -1281,10 +1266,23 @@ namespace UAS_LabelMachine
         {
             GridPrcode.DataSource = (DataTable)dh.ExecuteSql("select pd_pdno,pd_custprodcode,pd_whcode,pd_prodcode,'0' CollectedNum,'0' UnCollectedNum,pd_outqty,pr_unit,pd_brand,pjd_zxbzs_user,pjd_id from prodiodetail left join prodinout on pi_id=pd_piid left join PRODJOINVENDDETAIL on pjd_brand =pd_brand and pjd_prodcode=pd_prodcode left join product on pd_prodcode=pr_code where pi_id='" + PI_ID + "' order by pd_pdno", "select");
             List<int> RemoveIndex = new List<int>();
+            double CollectNum = 0;
+            double OutNum = 0;
             if (Combindetail.Checked)
             {
                 int CurrentIndex = 0;
                 for (int i = 0; i < GridPrcode.Rows.Count; i++)
+                {
+                    string CurrentPrCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
+                    string CurrentPDNO = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
+                    string CurrentOutQTY = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
+                    string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
+                    CollectNum += double.Parse(collectqty == "" ? "0" : collectqty);
+                    OutNum += double.Parse(CurrentOutQTY);
+                    GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty == "" ? "0" : collectqty;
+                    GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = Convert.ToDouble(double.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - double.Parse(collectqty == "" ? "0" : collectqty)).ToString("0.000");
+                }
+                for (int i = 0; i < GridPrcode.Rows.Count; i++)
                 {
                     if (i + 1 < GridPrcode.Rows.Count)
                     {
@@ -1299,12 +1297,15 @@ namespace UAS_LabelMachine
                         if (BProdCode == FProdCode && BWhCode == FWhCode)
                         {
                             GridPrcode.Rows[CurrentIndex].Cells["pd_outqty"].Value = double.Parse(GridPrcode.Rows[CurrentIndex].Cells["pd_outqty"].Value.ToString()) + double.Parse(GridPrcode.Rows[i + 1].Cells["pd_outqty"].Value.ToString());
+                            GridPrcode.Rows[CurrentIndex].Cells["CollectedNum"].Value = double.Parse(GridPrcode.Rows[CurrentIndex].Cells["CollectedNum"].Value.ToString()) + double.Parse(GridPrcode.Rows[i + 1].Cells["CollectedNum"].Value.ToString());
+                            GridPrcode.Rows[CurrentIndex].Cells["UnCollectedNum"].Value = (double.Parse(GridPrcode.Rows[CurrentIndex].Cells["UnCollectedNum"].Value.ToString()) + double.Parse(GridPrcode.Rows[i + 1].Cells["UnCollectedNum"].Value.ToString())).ToString("0.000");
                             RemoveIndex.Add(i + 1);
                         }
                         else
                         {
                             CurrentIndex = i + 1;
                         }
+                      
                     }
                 }
                 foreach (int item in RemoveIndex.OrderByDescending(x => x))
@@ -1312,18 +1313,19 @@ namespace UAS_LabelMachine
                     GridPrcode.Rows.RemoveAt(item);
                 }
             }
-            double CollectNum = 0;
-            double OutNum = 0;
-            for (int i = 0; i < GridPrcode.Rows.Count; i++)
-            {
-                string CurrentPrCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
-                string CurrentPDNO = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
-                string CurrentOutQTY = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
-                string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
-                CollectNum += double.Parse(collectqty == "" ? "0" : collectqty);
-                OutNum += double.Parse(CurrentOutQTY);
-                GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty;
-                GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = Convert.ToDouble(double.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - double.Parse(collectqty == "" ? "0" : collectqty)).ToString("0.000");
+            else
+            {
+                for (int i = 0; i < GridPrcode.Rows.Count; i++)
+                {
+                    string CurrentPrCode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
+                    string CurrentPDNO = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
+                    string CurrentOutQTY = GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString();
+                    string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
+                    CollectNum += double.Parse(collectqty == "" ? "0" : collectqty);
+                    OutNum += double.Parse(CurrentOutQTY);
+                    GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty == "" ? "0" : collectqty;
+                    GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = Convert.ToDouble(double.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - double.Parse(collectqty == "" ? "0" : collectqty)).ToString("0.000");
+                }
             }
             ProcessCount.Text = CollectNum + "/" + OutNum;
             if (GridPrcode.Rows.Count > 0)