Преглед на файлове

添加可打印指定行号

章政 преди 8 години
родител
ревизия
482310b7b9
променени са 2 файла, в които са добавени 16 реда и са изтрити 10 реда
  1. 1 1
      UAS-出货标签管理/UAS_出货标签管理.Designer.cs
  2. 15 9
      UAS-出货标签管理/UAS_出货标签管理.cs

+ 1 - 1
UAS-出货标签管理/UAS_出货标签管理.Designer.cs

@@ -1496,7 +1496,7 @@
             // LogingOut
             // 
             this.LogingOut.AutoSize = true;
-            this.LogingOut.Location = new System.Drawing.Point(114, 3);
+            this.LogingOut.Location = new System.Drawing.Point(114, 16);
             this.LogingOut.Name = "LogingOut";
             this.LogingOut.Size = new System.Drawing.Size(42, 21);
             this.LogingOut.TabIndex = 77;

+ 15 - 9
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -1244,6 +1244,8 @@ namespace UAS_LabelMachine
                     }
                 }
                 dh.BatchInsert("update prodiobarcode set pib_printdate=sysdate where pib_id=:pib_id", new string[] { "pib_id" }, SingleID.ToArray());
+                MidBoxCacheData.Clear();
+                BaseUtil.CleanDataTable(MidBoxCacheData);
                 if (CheckedRowCount == 0)
                     MessageBox.Show("未勾选打印明细!");
                 else if (CurrentRowIndex + 1 < LabelInf.Rows.Count)
@@ -1317,6 +1319,11 @@ namespace UAS_LabelMachine
             //id数组
             string[] pib_id_arr = MidIDAndOutboxcode.Keys.ToArray();
             string[] pib_outbox_arr = MidIDAndOutboxcode.Values.ToArray();
+            if (pib_id_arr.Length == 0)
+            {
+                MessageBox.Show("未勾选打印明细");
+                return;
+            }
             //记录一个ID用来取中盒的数量
             string pib_id = pib_id_arr[0];
             //id个数
@@ -1355,7 +1362,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);
@@ -1390,8 +1396,8 @@ namespace UAS_LabelMachine
                 {
                     try
                     {
-                        int begin = int.Parse(SingleBoxBegin.Text);
-                        int end = int.Parse(SingleBoxEnd.Text);
+                        int begin = int.Parse(SingleBoxBegin.Text == "" ? "1" : SingleBoxBegin.Text);
+                        int end = int.Parse(SingleBoxEnd.Text == "" ? LabelInf.Rows.Count.ToString() : SingleBoxEnd.Text);
                         if (begin > 0 && end <= LabelInf.Rows.Count)
                         {
                             for (int i = begin - 1; i < end; i++)
@@ -1432,20 +1438,20 @@ namespace UAS_LabelMachine
                 {
                     try
                     {
-                        begin = int.Parse(MidBoxBegin.Text);
-                        end = int.Parse(MidBoxEnd.Text);
+                        begin = int.Parse(MidBoxBegin.Text == "" ? "1" : MidBoxBegin.Text);
+                        end = int.Parse(MidBoxEnd.Text == "" ? LabelInf.Rows[LabelInf.Rows.Count - 1].Cells["pib_outboxcode1"].Value.ToString() : MidBoxEnd.Text);
                         int minmidbox = int.Parse(LabelInf.Rows[0].Cells["pib_outboxcode1"].Value.ToString());
                         int maxmidbox = int.Parse(LabelInf.Rows[LabelInf.Rows.Count - 1].Cells["pib_outboxcode1"].Value.ToString());
-                        if (begin > minmidbox && end <= maxmidbox)
+                        if (begin >= minmidbox && end <= maxmidbox)
                         {
                             //设置中盒打印范围的行号
                             for (int i = 0; i < LabelInf.Rows.Count; i++)
                             {
-                                if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == MidBoxBegin.Text)
+                                if (int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()) == begin)
                                 {
                                     begin = i;
                                 }
-                                if (LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString() == MidBoxEnd.Text)
+                                if (int.Parse(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()) == end)
                                 {
                                     end = i;
                                 }
@@ -1469,7 +1475,7 @@ namespace UAS_LabelMachine
                 List<int> MidOutBoxCode = new List<int>();
                 List<int> MidOutBoxCodeIndex = new List<int>();
                 string la_id = MidLabelCombox.SelectedValue.ToString().Split('#')[0];
-                for (int i = (begin == 0 ? 0 : begin); i < (end == 0 ? LabelInf.Rows.Count : end); i++)
+                for (int i = (begin == 0 ? 0 : begin); i <= (end == 0 ? LabelInf.Rows.Count - 1 : end); i++)
                 {
                     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());