Browse Source

修复中盒不按顺序打印的BUG

章政 8 years ago
parent
commit
e7784da4fe

File diff suppressed because it is too large
+ 187 - 214
UAS-出货标签管理/UAS_出货标签管理.Designer.cs


+ 31 - 11
UAS-出货标签管理/UAS_出货标签管理.cs

@@ -134,8 +134,6 @@ namespace UAS_LabelMachine
         ArrayList<ArrayList<string>> ScanData;
         ArrayList<string> GetData;
 
-
-
         public UAS_出货标签打印()
         {
             InitializeComponent();
@@ -188,6 +186,11 @@ namespace UAS_LabelMachine
 
             CollectionUnit.Text = "盘";
             Point pt = new Point();
+            //禁止所有列的排序
+            foreach (DataGridViewColumn dgv in LabelInf.Columns)
+            {
+                dgv.SortMode = DataGridViewColumnSortMode.NotSortable;
+            }
             int ScreenWidth = Screen.GetWorkingArea(pt).Width;
             //如果分辨率大的设置的字体对应的变大 
             if (ScreenWidth > 1366)
@@ -1119,6 +1122,25 @@ namespace UAS_LabelMachine
 
         private void SingleBoxPrint()
         {
+            try
+            {
+                if (SingleDoc.Variables.FreeVariables.Count == 0) { }
+            }
+            catch (Exception)
+            {
+                MessageBox.Show("单盘标签未维护参数");
+            }
+            if (MidLabelAutoPrint.Checked)
+            {
+                try
+                {
+                    if (MidDoc.Variables.FreeVariables.Count == 0) { }
+                }
+                catch (Exception)
+                {
+                    MessageBox.Show("中盘标签未维护参数");
+                }
+            }
             string la_id = SingleLabelCombox.SelectedValue.ToString().Split('#')[0];
             string cl_labelname = SingleLabelCombox.Text;
             string LabelUrl = dh.getFieldDataByCondition("label left join customerlabel on la_code=cl_labelcode", "cl_labelurl", "la_id='" + la_id + "' and cl_labelname='" + cl_labelname + "'").ToString();
@@ -1149,10 +1171,10 @@ namespace UAS_LabelMachine
                     return;
                 }
                 //打印的时候如果不存在数据开始缓存
-                if (MidBoxCacheData.Rows.Count == 0)
-                    GetMidBoxData();
                 if (SingleBoxCacheData.Rows.Count == 0)
                     GetSingleBoxData();
+                if (MidBoxCacheData.Rows.Count == 0)
+                    GetMidBoxData();
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
                     if (i + 1 < LabelInf.RowCount)
@@ -1207,7 +1229,7 @@ namespace UAS_LabelMachine
                                 }
                                 else if (arg.Contains(SingleDoc.Variables.FreeVariables.Item(j + 1).Name))
                                     SingleDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][SingleDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
-                                ParamLog.AppendLine("打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
+                                ParamLog.AppendLine("pib_id:" + LabelInf.Rows[i].Cells["pib_id1"].Value.ToString() + ",SingleDoc打印参数【" + SingleDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取到值" + SingleDoc.Variables.FreeVariables.Item(j + 1).Value);
                             }
                             LogManager.DoLog(ParamLog.ToString());
                             //保存参数打印
@@ -1304,7 +1326,7 @@ namespace UAS_LabelMachine
                         string sql = dt.Rows[k]["lp_sql"].ToString();
                         sql = sql.Substring(0, sql.IndexOf("{"));
                         sql = sql.Substring(0, sql.LastIndexOf("="));
-                        DataTable temp = dh.getFieldsDatasByCondition(sql + " in " + pib_id_string.ToString());
+                        DataTable temp = dh.getFieldsDatasByCondition(sql.Replace(" from ", " ,pib_id PIBID from ") + " in " + pib_id_string.ToString() + " ORDER by pib_id");
                         temp.Columns[0].ColumnName = SingleDoc.Variables.FreeVariables.Item(j + 1).Name;
                         AllSingleBoxCacheData.Add(temp);
                     }
@@ -1320,7 +1342,7 @@ namespace UAS_LabelMachine
                     //由于之前加了一个ID列,导致j从1开始
                     for (int j = 1; j < SingleBoxCacheData.Columns.Count; j++)
                     {
-                        dr[Temp[j - 1].Columns[0].ColumnName] = Temp[j - 1].Rows[i][0].ToString();
+                        dr[Temp[j - 1].Columns[0].ColumnName] = (Temp[j - 1].Select("PIBID=" + pib_id_arr[i]))[0][0];
                     }
                     SingleBoxCacheData.Rows.Add(dr);
                 }
@@ -1393,13 +1415,13 @@ namespace UAS_LabelMachine
                         {
                             sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
                             sql = sql.Substring(0, sql.LastIndexOf("=")) + " in " + pib_qtycondition_string.ToString() + sql.Substring(sql.LastIndexOf("}") + 1);
-                            Console.WriteLine(sql);
+                            sql = "select * from (" + sql + ") order by instr ('" + pib_qtycondition_string.ToString() + "',pib_outboxcode1)";
                         }
                         else
                         {
                             sql = sql.Substring(0, sql.IndexOf("{"));
                             sql = sql.Substring(0, sql.LastIndexOf("="));
-                            sql = sql + " in " + pib_condition_string.ToString();
+                            sql = sql + " in " + pib_condition_string.ToString() + " order by instr('" + pib_condition_string.ToString() + "',pib_id)";
                         }
                         DataTable temp = dh.getFieldsDatasByCondition(sql);
                         temp.Columns[0].ColumnName = MidDoc.Variables.FreeVariables.Item(j + 1).Name;
@@ -1418,9 +1440,7 @@ namespace UAS_LabelMachine
                     dr["pib_outboxcode1"] = pib_outbox_arr[i];
                     //由于之前加了一个ID列和箱号,导致j从2开始
                     for (int j = 2; j < MidBoxCacheData.Columns.Count; j++)
-                    {
                         dr[Temp[j - 2].Columns[0].ColumnName] = Temp[j - 2].Rows[i][0].ToString();
-                    }
                     MidBoxCacheData.Rows.Add(dr);
                 }
             }

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