章政 8 жил өмнө
parent
commit
8b60545da2

+ 2 - 60
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -1136,9 +1136,9 @@ namespace UAS_LabelMachine
                 outboxcode1.Add(LabelInf.Rows[0].Cells["pib_outboxcode1"].Value.ToString(), true);
                 for (int i = 0; i < LabelInf.Rows.Count; i++)
                 {
+                    SingleID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
                     if (LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifprint"].FormattedValue.ToString() != "True")
                     {
-                        SingleID.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString());
                         //如果不存在中盒号则进行添加
                         if (!MidIDAndOutboxcode.ContainsValue(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
                             MidIDAndOutboxcode.Add(LabelInf.Rows[i].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
@@ -1233,7 +1233,7 @@ namespace UAS_LabelMachine
                         }
                         catch (Exception ex) { LogManager.DoLog(ex.Message); }
                     }
-                    if (MidLabelAutoPrint.Checked && LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True")
+                    if (MidLabelAutoPrint.Checked && LabelInf.Rows[i].Cells["Choose"].FormattedValue.ToString() == "True" && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue !=null&& LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() == "True")
                     {
                         //判断当前行的盒号和下一行不相等或者已经是最后一行了
                         if (i + 1 == LabelInf.RowCount || LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() != LabelInf.Rows[i + 1 == LabelInf.RowCount ? i : i + 1].Cells["pib_outboxcode1"].Value.ToString())
@@ -1268,39 +1268,11 @@ namespace UAS_LabelMachine
         /// </summary>
         private void GetSingleBoxData()
         {
-            StringBuilder pib_id_string = new StringBuilder();
             //id数组
             string[] pib_id_arr = SingleID.ToArray();
-            //id个数
-            int pib_id_length = pib_id_arr.Length;
             //将所有的列存在在这里
             List<DataTable> AllSingleBoxCacheData = new List<DataTable>();
             //每五百条拼接一次条件
-            int fivehundred_count = pib_id_length / 500 + 1;
-            //当前打印的索引
-            int CurrentCount = 0;
-            for (int i = 0; i < fivehundred_count; i++)
-            {
-                //本次循环的数量
-                int count = 0;
-                pib_id_string.Append("(");
-                if (i + 1 == fivehundred_count)
-                    count = pib_id_length - i * 500;
-                else
-                    count = 500;
-                //当前执行的索引
-                int LastCount = CurrentCount;
-                for (int j = CurrentCount; j < LastCount + count - 1; j++)
-                {
-                    pib_id_string.Append(pib_id_arr[j] + ",");
-                    CurrentCount = CurrentCount + 1;
-                }
-                pib_id_string.Append(pib_id_arr[CurrentCount]);
-                CurrentCount = CurrentCount + 1;
-                pib_id_string.Append(")");
-                if (i + 1 != fivehundred_count)
-                    pib_id_string.Append(" or pib_id in ");
-            }
             //手动添加ID列
             DataColumn datacolumn = new DataColumn("pib_id");
             if (!SingleBoxCacheData.Columns.Contains("pib_id"))
@@ -1354,38 +1326,9 @@ namespace UAS_LabelMachine
             //记录一个ID用来取中盒的数量
             string pib_id = pib_id_arr[0];
             //id个数
-            int pib_id_length = pib_id_arr.Length;
             //将所有的列存在在这里
             List<DataTable> AllMidBoxCacheData = new List<DataTable>();
             //每五百条拼接一次条件
-            int fivehundred_count = pib_id_length / 900 + 1;
-            //当前打印的索引
-            int CurrentCount = 0;
-            for (int i = 0; i < fivehundred_count; i++)
-            {
-                //本次循环的数量
-                int count = 0;
-                pib_condition_string.Append("(");
-                pib_qtycondition_string.Append("(");
-                if (i + 1 == fivehundred_count)
-                    count = pib_id_length - i * 900;
-                else
-                    count = 900;
-                //当前执行的索引
-                int LastCount = CurrentCount;
-                for (int j = LastCount; j < LastCount + count - 1; j++)
-                {
-                    pib_condition_string.Append(pib_id_arr[j] + ",");
-                    pib_qtycondition_string.Append(pib_outbox_arr[j] + ",");
-                    CurrentCount = CurrentCount + 1;
-                }
-                pib_condition_string.Append(pib_id_arr[CurrentCount]);
-                pib_qtycondition_string.Append(pib_outbox_arr[CurrentCount]);
-                pib_condition_string.Append(")");
-                pib_qtycondition_string.Append(")");
-                if (i + 1 != fivehundred_count)
-                    pib_condition_string.Append(" or pib_id in ");
-            }
             //手动添加ID列
             DataColumn IDColumn = new DataColumn("pib_id");
             DataColumn OutBoxColumn = new DataColumn("pib_outboxcode1");
@@ -1418,7 +1361,6 @@ namespace UAS_LabelMachine
                             sql = sql.Substring(0, sql.LastIndexOf("="));
                             sql = sql + " in (select distinct pib_outboxcode1 from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "')" + " and pib_inoutno='" + pi_inoutno.Text + "' order by to_number(pib_outboxcode1)";
                         }
-                        Console.WriteLine(sql);
                         DataTable temp = dh.getFieldsDatasByCondition(sql);
                         temp.Columns[0].ColumnName = MidDoc.Variables.FreeVariables.Item(j + 1).Name;
                         AllMidBoxCacheData.Add(temp);