Browse Source

单独打印中盒BUG修改

章政 8 years ago
parent
commit
08136039f3
1 changed files with 11 additions and 20 deletions
  1. 11 20
      UAS-出货标签管理/UAS_出货标签管理.cs

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

@@ -1439,7 +1439,6 @@ namespace UAS_LabelMachine
                 //查找是否存在该中盒号
                 List<int> MidRowIndex = new List<int>();
                 //缓存中盒数据
-                List<string> MidBoxCode = new List<string>();
                 for (int i = 0; i < LabelInf.RowCount; i++)
                 {
                     if (MidLabelNum.Text == LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString())
@@ -1447,11 +1446,6 @@ namespace UAS_LabelMachine
                         //找到了输入的中盒号停止循环
                         FindMidLabel = true;
                         MidLabelRowIndex = i;
-                    }
-                    //设置所有的中盒号的索引
-                    if (!MidBoxCode.Contains(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString()))
-                    {
-                        MidBoxCode.Add(LabelInf.Rows[i].Cells["pib_outboxcode1"].Value.ToString());
                         MidRowIndex.Add(i);
                     }
                 }
@@ -1623,17 +1617,7 @@ namespace UAS_LabelMachine
 
         private void MidBoxCodePrint(string la_id, int rowindex, int[] midindex)
         {
-            if (MidBoxCacheData.Rows.Count == 0)
-            {
-                MidIDAndOutboxcode.Clear();
-                for (int i = 0; i < midindex.Length; i++)
-                {
-                    MidIDAndOutboxcode.Add(LabelInf.Rows[midindex[i]].Cells["pib_id1"].Value.ToString(), LabelInf.Rows[midindex[i]].Cells["pib_outboxcode1"].Value.ToString());
-                }
-                GetMidBoxData();
-            }
             DataTable dt = (DataTable)dh.ExecuteSql("select lp_name,lp_sql from label left join LABELPARAMETER on la_id= lp_laid where la_id=" + la_id, "select");
-            string[] arg = MidBoxArgument.ToArray();
             for (int j = 0; j < MidDoc.Variables.FreeVariables.Count; j++)
             {
                 //将维护的模板参数和模板本身的参数名称进行比对
@@ -1657,7 +1641,6 @@ namespace UAS_LabelMachine
                             }
                             else
                             {
-                                DataRow[] dr = MidBoxCacheData.Select("pib_outboxcode1=" + pib_outboxcode1);
                                 if (MidDoc.Variables.FreeVariables.Item(j + 1).Name.ToLower().Contains("datecode1"))
                                 {
                                     if (LabelInf.Rows[rowindex].Cells["DateCode1"].Value != null)
@@ -1673,12 +1656,20 @@ namespace UAS_LabelMachine
                                     if (LabelInf.Rows[rowindex].Cells["pib_datecode"].Value != null)
                                         MidDoc.Variables.FreeVariables.Item(j + 1).Value = LabelInf.Rows[rowindex].Cells["pib_datecode"].Value.ToString();
                                 }
-                                else if (arg.Contains(MidDoc.Variables.FreeVariables.Item(j + 1).Name))
+                                else
                                 {
-                                    if (dr.Length > 0)
+                                    if (sql.ToLower().Contains("pib_qty"))
                                     {
-                                        MidDoc.Variables.FreeVariables.Item(j + 1).Value = dr[0][MidDoc.Variables.FreeVariables.Item(j + 1).Name].ToString();
+                                        sql = sql.Substring(0, sql.IndexOf("{")) + pib_id + sql.Substring(sql.IndexOf("}") + 1);
+                                        sql = sql.Substring(0, sql.LastIndexOf("=")) + "='" + pib_outboxcode1 + "' group by pib_outboxcode1";
+                                    }
+                                    else
+                                    {
+                                        sql = sql.Substring(0, sql.IndexOf("{"));
+                                        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 + "' and pib_outboxcode1='" + pib_outboxcode1 + "'";
                                     }
+                                    MidDoc.Variables.FreeVariables.Item(j + 1).Value = dh.GetLabelParam(sql).ToString();
                                 }
                                 LogManager.DoLog("打印参数【" + MidDoc.Variables.FreeVariables.Item(j + 1).Name + "】赋值," + "取值SQL:" + sql + ",取到值" + MidDoc.Variables.FreeVariables.Item(j + 1).Value);
                             }