|
|
@@ -850,6 +850,7 @@ namespace UAS_LabelMachine
|
|
|
if (kind != "MPN" && kind != "QTY" && kind != "品牌")
|
|
|
{
|
|
|
DataTable dt = (DataTable)MidSource.DataSource;
|
|
|
+ Console.WriteLine(cell.ValueType);
|
|
|
cell.Value = Matchstr;
|
|
|
MatchResult = "成功";
|
|
|
}
|
|
|
@@ -1359,39 +1360,49 @@ namespace UAS_LabelMachine
|
|
|
if (!SingleBoxCacheData.Columns.Contains("pib_id"))
|
|
|
SingleBoxCacheData.Columns.Add(datacolumn);
|
|
|
//获取打印的SQL
|
|
|
- for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
|
|
|
+ try
|
|
|
{
|
|
|
- //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
- for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
|
|
|
+ for (int j = 0; j < SingleDoc.Variables.FreeVariables.Count; j++)
|
|
|
{
|
|
|
- if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
+ //将维护的模板参数和模板本身的参数名称进行比对
|
|
|
+ for (int k = 0; k < SingleLabelParam.Rows.Count; k++)
|
|
|
{
|
|
|
- DataColumn dc = new DataColumn(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
|
|
|
- SingleBoxCacheData.Columns.Add(dc);
|
|
|
- SingleBoxArgument.Add(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
|
|
|
- string sql = SingleLabelParam.Rows[k]["lp_sql"].ToString();
|
|
|
- sql = sql.Substring(0, sql.IndexOf("{"));
|
|
|
- sql = sql.Substring(0, sql.LastIndexOf("="));
|
|
|
- DataTable temp = dh.getFieldsDatasByCondition(sql.Replace(" from ", " ,pib_id PIBID from ") + " in (select pib_id from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "') ORDER by pib_id");
|
|
|
- temp.Columns[0].ColumnName = SingleDoc.Variables.FreeVariables.Item(j + 1).Name;
|
|
|
- AllSingleBoxCacheData.Add(temp);
|
|
|
+ if (SingleDoc.Variables.FreeVariables.Item(j + 1).Name == SingleLabelParam.Rows[k]["lp_name"].ToString())
|
|
|
+ {
|
|
|
+ DataColumn dc = new DataColumn(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
|
|
|
+ SingleBoxCacheData.Columns.Add(dc);
|
|
|
+ SingleBoxArgument.Add(SingleDoc.Variables.FreeVariables.Item(j + 1).Name);
|
|
|
+ string sql = SingleLabelParam.Rows[k]["lp_sql"].ToString();
|
|
|
+ sql = sql.Substring(0, sql.IndexOf("{"));
|
|
|
+ sql = sql.Substring(0, sql.LastIndexOf("="));
|
|
|
+ DataTable temp = dh.getFieldsDatasByCondition(sql.Replace(" from ", " ,pib_id PIBID from ") + " in (select pib_id from PRODIOBARCODE where pib_inoutno='" + pi_inoutno.Text + "') ORDER by pib_id");
|
|
|
+ temp.Columns[0].ColumnName = SingleDoc.Variables.FreeVariables.Item(j + 1).Name;
|
|
|
+ AllSingleBoxCacheData.Add(temp);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- DataTable[] Temp = AllSingleBoxCacheData.ToArray();
|
|
|
- //将所有数据写入到CacheData中
|
|
|
- if (Temp.Length > 0)
|
|
|
- for (int i = 0; i < Temp[0].Rows.Count; i++)
|
|
|
- {
|
|
|
- DataRow dr = SingleBoxCacheData.NewRow();
|
|
|
- dr["pib_id"] = pib_id_arr[i];
|
|
|
- //由于之前加了一个ID列,导致j从1开始
|
|
|
- for (int j = 1; j < SingleBoxCacheData.Columns.Count; j++)
|
|
|
+ DataTable[] Temp = AllSingleBoxCacheData.ToArray();
|
|
|
+ //将所有数据写入到CacheData中
|
|
|
+ if (Temp.Length > 0)
|
|
|
+ for (int i = 0; i < Temp[0].Rows.Count; i++)
|
|
|
{
|
|
|
- dr[Temp[j - 1].Columns[0].ColumnName] = (Temp[j - 1].Select("PIBID=" + pib_id_arr[i]))[0][0];
|
|
|
+ DataRow dr = SingleBoxCacheData.NewRow();
|
|
|
+ dr["pib_id"] = pib_id_arr[i];
|
|
|
+ //由于之前加了一个ID列,导致j从1开始
|
|
|
+ for (int j = 1; j < SingleBoxCacheData.Columns.Count; j++)
|
|
|
+ {
|
|
|
+ dr[Temp[j - 1].Columns[0].ColumnName] = (Temp[j - 1].Select("PIBID=" + pib_id_arr[i]))[0][0];
|
|
|
+ }
|
|
|
+ SingleBoxCacheData.Rows.Add(dr);
|
|
|
}
|
|
|
- SingleBoxCacheData.Rows.Add(dr);
|
|
|
- }
|
|
|
+ }
|
|
|
+ catch (Exception)
|
|
|
+ {
|
|
|
+
|
|
|
+ SingleBoxArgument.Clear();
|
|
|
+ SingleBoxCacheData.Clear();
|
|
|
+ BaseUtil.CleanDataTable(SingleBoxCacheData);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/// <summary>
|