章政 6 лет назад
Родитель
Сommit
b7e06e469e

+ 26 - 6
UAS-出货标签管理(贸易版)/UAS_出货标签管理.cs

@@ -1340,6 +1340,10 @@ namespace UAS_LabelMachine
                         return;
                     }
                 }
+                else
+                {
+                    end = LabelInf.Rows.Count - 1;
+                }
                 MidBoxArgument.Clear();
                 List<int> MidOutBoxCode = new List<int>();
                 List<int> MidOutBoxCodeIndex = new List<int>();
@@ -1590,15 +1594,31 @@ namespace UAS_LabelMachine
             LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
             //查询本地数据库
             sql.Clear();
-            sql.Append("select * from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "' limit 0,1 ");
+            sql.Append("select count(1) from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'");
             DataTable dt = (DataTable)sdh.ExecuteSql(sql.ToString(), "select");
+            int rowcount = int.Parse(dt.Rows[0][0].ToString());
             //如果本地没有缓存过
-            if (dt.Rows.Count == 0)
+            if (rowcount == 0 || rowcount != LabelInfDataTable.Rows.Count)
             {
-                //检验查询的字段和本地数据库字段是否匹配
-                sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
-                //将数据保存在本地数据库
-                sdh.SaveDataTable(LabelInfDataTable, "prodiobarcode");
+                if (rowcount != LabelInfDataTable.Rows.Count && rowcount != 0)
+                {
+                    string close = MessageBox.Show(this.ParentForm, "本地条码和服务器条码数量不一致,覆盖本地条码", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
+                    if (close == "Yes")
+                    {
+                        sdh.ExecuteSql("delete from prodiobarcode where pib_inoutno='" + pi_inoutno.Text + "'", "delete");
+                        //检验查询的字段和本地数据库字段是否匹配
+                        sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
+                        //将数据保存在本地数据库
+                        sdh.SaveDataTable(LabelInfDataTable, "prodiobarcode");
+                    }
+                }
+                else
+                {
+                    //检验查询的字段和本地数据库字段是否匹配
+                    sdh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
+                    //将数据保存在本地数据库
+                    sdh.SaveDataTable(LabelInfDataTable, "prodiobarcode");
+                }
             }
             else if (LabelInfDataTable.Columns.Count != dt.Columns.Count)
             {

+ 11 - 10
UAS-出货标签管理(贸易版)/生成条码.cs

@@ -220,18 +220,19 @@ namespace UAS_LabelMachine
                     ArrayList<string> midcode = new ArrayList<string>();
                     ArrayList<string> barcode = new ArrayList<string>();
                     ArrayList<string> custbarcode = new ArrayList<string>();
-                    int restqty1 = 0;
+                    decimal restqty1 = 0;
                     if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value != null && ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
                     {
                         string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
                         for (int k = 0; k < restqty.Length; k++)
                         {
                             string mid_code = dh.getFieldDataByCondition("PRODIOBARCODE", "nvl(max(to_number(PIB_OUTBOXCODE1)),0)+1", "PIB_INOUTNO='" + pi_inoutno.Text + "'").ToString();
-                            int.TryParse(restqty[k], out restqty1);
+                            decimal.TryParse(restqty[k], out restqty1);
                             barcode.Add(BarcodeMethod1(pd_id, pr_id, pib_barcode));
                             custbarcode.Add(BarcodeMethod1(PrefixFixed, Suffix, SerialNumIndex, SerialNumLength, Radix));
                             midcode.Add(mid_code);
                             pib_inqty.Add(restqty1.ToString());
+                            //剩余生成的数量需要减掉尾数
                         }
                     }
                     //循环中盒号的个数,取当前出入库单最大 的中盒号+1
@@ -408,19 +409,19 @@ namespace UAS_LabelMachine
             object pd_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value;
             object mid_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["mid_qty"].Value;
             object pd_totalqty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_totalqty"].Value;
-            int restqty1 = 0;
+            decimal restqty1 = 0;
             if (ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value != null && ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString() != "")
             {
                 string[] restqty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pib_restqty1"].Value.ToString().Split(',');
                 for (int k = 0; k < restqty.Length; k++)
                 {
-                    int qty = 0;
-                    int.TryParse(restqty[k], out qty);
+                    decimal qty = 0;
+                    decimal.TryParse(restqty[k], out qty);
                     restqty1 += qty;
                 }
             }
-            ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value = decimal.Parse(pd_totalqty.ToString()) - restqty1;
-            pd_qty = ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value;
+            //ProdIoInfDGV.Rows[e.RowIndex].Cells["pd_qty"].Value = decimal.Parse(pd_qty.ToString()) - restqty1;
+            pd_qty = decimal.Parse(pd_qty.ToString()) - restqty1;
             if (pr_zxbzs != null && pd_qty != null && mid_qty != null)
             {
                 decimal 最小包装量 = decimal.Parse(pr_zxbzs.ToString());
@@ -449,14 +450,14 @@ namespace UAS_LabelMachine
             for (int i = 0; i < ProdIoInfDGV.Rows.Count; i++)
             {
                 ProdIoInfDGV.Rows[i].Cells["mid_qty"].Value = MidCapacity.Text;
-                int restqty1 = 0;
+                decimal restqty1 = 0;
                 if (ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value != null && ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString() != "")
                 {
                     string[] restqty = ProdIoInfDGV.Rows[i].Cells["pib_restqty1"].Value.ToString().Split(',');
                     for (int k = 0; k < restqty.Length; k++)
                     {
-                        int qty = 0;
-                        int.TryParse(restqty[k], out qty);
+                        decimal qty = 0;
+                        decimal.TryParse(restqty[k], out qty);
                         restqty1 += qty;
                     }
                 }