Browse Source

小数问题

章政 7 years ago
parent
commit
6157232629

File diff suppressed because it is too large
+ 224 - 187
UAS-出货标签管理(泽天)/UAS_出货标签管理.Designer.cs


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

@@ -261,29 +261,29 @@ namespace UAS_LabelMachine
             }
             int CodeCount = 0;
             //如果单位是KPCS则需要除1000
-            int CollectNum = 0;
+            float CollectNum = 0;
             if (CurrentUnit == "KPCS")
             {
                 //如果单位是KPCS则必须是1000的整数倍
-                if (int.Parse(Data["QTY"]) % 1000 != 0 || int.Parse(Data["QTY"]) / 1000 % int.Parse(CurrentZXBZ) != 0)
+                if ((int.Parse(Data["QTY"]) > 1000&& int.Parse(Data["QTY"]) % 1000 != 0) || int.Parse(Data["QTY"]) / 1000 % float.Parse(CurrentZXBZ) != 0)
                 {
                     MessageBox.Show("物料" + Data["PRCODE"] + "采集数量无法按照最小包装数拆分", "提示");
                     Input.SelectAll();
                     return;
                 }
-                CodeCount = int.Parse(Data["QTY"]) / 1000 / int.Parse(CurrentZXBZ);
-                CollectNum = int.Parse(Data["QTY"]) / 1000;
+                CodeCount = int.Parse((float.Parse(Data["QTY"]) / 1000 / float.Parse(CurrentZXBZ)).ToString());
+                CollectNum = float.Parse(Data["QTY"]) / 1000;
             }
             else
             {
-                if (int.Parse(Data["QTY"]) % int.Parse(CurrentZXBZ) != 0)
+                if (float.Parse(Data["QTY"]) % float.Parse(CurrentZXBZ) != 0)
                 {
                     MessageBox.Show("采集【数量】无法按照最小包装数拆分", "提示");
                     Input.SelectAll();
                     return;
                 }
-                CodeCount = int.Parse(Data["QTY"]) / int.Parse(CurrentZXBZ);
-                CollectNum = int.Parse(Data["QTY"]);
+                CodeCount = int.Parse((float.Parse(Data["QTY"]) / float.Parse(CurrentZXBZ)).ToString());
+                CollectNum = float.Parse(Data["QTY"]);
             }
             string pib_barcode = Data.ContainsKey("SERIAL") ? Data["SERIAL"] : "";
             //获取ID
@@ -308,8 +308,8 @@ namespace UAS_LabelMachine
             }
             //计算当前采集数量
             string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
-            int CollectQty = (collectqty == "" ? 0 : int.Parse(collectqty));
-            if (CollectQty + CollectNum > int.Parse(CurrentPrCount))
+            float CollectQty = (collectqty == "" ? 0 : float.Parse(collectqty));
+            if (CollectQty + CollectNum > float.Parse(CurrentPrCount))
             {
                 MessageBox.Show("物料" + Data["PRCODE"] + "采集后数量为" + (CollectQty + CollectNum) + ",【超出】本行出货数量" + CurrentPrCount, "提示");
                 Input.SelectAll();
@@ -364,16 +364,16 @@ namespace UAS_LabelMachine
             }
             //采集后重新计数,自动跳到下一行
             collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
-            CollectQty = (collectqty == "" ? 0 : int.Parse(collectqty));
+            CollectQty = (collectqty == "" ? 0 : float.Parse(collectqty));
             //采集达到了数量进行换行
-            if (CollectQty == int.Parse(CurrentPrCount))
+            if (CollectQty == float.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 && int.Parse(outqty) > int.Parse(collectnum == "" ? "0" : collectnum))
+                    if (GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString() == CurrentPrCode && float.Parse(outqty) > float.Parse(collectnum == "" ? "0" : collectnum))
                     {
                         if (int.Parse(GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString()) > int.Parse(CurrentPDNO))
                         {
@@ -389,7 +389,7 @@ namespace UAS_LabelMachine
                 {
                     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))
+                    if (float.Parse(outqty) > float.Parse(collectnum == "" ? "0" : collectnum))
                     {
                         GridPrcode.Rows[i].Selected = true;
                         GridPrcode.FirstDisplayedScrollingRowIndex = i;
@@ -583,7 +583,7 @@ namespace UAS_LabelMachine
                     {
                         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))
+                        if (float.Parse(outqty) > float.Parse(collectnum == "" ? "0" : collectnum))
                         {
                             GridPrcode.Rows[i].Selected = true;
                             GridPrcode.FirstDisplayedScrollingRowIndex = i;
@@ -1066,7 +1066,7 @@ namespace UAS_LabelMachine
                 string CurrentPDNO = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
                 string collectqty = (LabelInfDataTable.Compute("sum(pib_qty)", "pib_prodcode='" + CurrentPrCode + "' and pib_pdno='" + CurrentPDNO + "'").ToString());
                 GridPrcode.Rows[i].Cells["CollectedNum"].Value = collectqty;
-                GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = int.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - int.Parse(collectqty == "" ? "0" : collectqty);
+                GridPrcode.Rows[i].Cells["UnCollectedNum"].Value = float.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString()) - float.Parse(collectqty == "" ? "0" : collectqty);
             }
         }
 
@@ -1284,7 +1284,7 @@ namespace UAS_LabelMachine
 
         private void OutBoxNum_Click(object sender, EventArgs e)
         {
-            string OutBox=OutBoxNum.Text;
+            string OutBox = OutBoxNum.Text;
             OutBoxNum.Items.Clear();
             DataTable dt = (DataTable)dh.ExecuteSql("select distinct pib_outboxcode2 from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode2)", "select");
             ItemObject io = new ItemObject("新增", "新增");
@@ -1507,9 +1507,9 @@ namespace UAS_LabelMachine
                 {
                     SolidBrush solidBrush = new SolidBrush(Color.FromArgb(51, 153, 255));
                     if (GridPrcode.Rows[e.RowIndex].Cells["UnCollectedNum"].Value.ToString() == "0")
-                        e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.LightSeaGreen, e.CellBounds);
+                        e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.White, e.CellBounds);
                     else
-                        e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.Gray, e.CellBounds);
+                        e.Graphics.FillRectangle(mouseOver ? solidBrush : Brushes.Red, e.CellBounds);
                     Rectangle border = e.CellBounds;
                     border.Width -= 1;
                     e.Graphics.DrawRectangle(Pens.White, border);

Some files were not shown because too many files changed in this diff