|
|
@@ -477,27 +477,18 @@ namespace UAS_LabelMachine
|
|
|
CollectData.Add(ItemData[i].ToString().ToUpper(), Input.Text.Split(sg_separator.Text.ToCharArray())[i]);
|
|
|
}
|
|
|
//首先判断当前采集的个数,如果采集的个数为1则不对数据进行分隔符验证
|
|
|
- if (ItemData.Length == 1)
|
|
|
+ if (ItemData.Length > 0)
|
|
|
{
|
|
|
- CollectData.Clear();
|
|
|
- CollectData.Add(ItemData[0].ToString().ToUpper(), Input.Text);
|
|
|
+ //CollectData.Clear();
|
|
|
+ //for (int i = 0; i < ItemData.Length; i++)
|
|
|
+ //{
|
|
|
+ // CollectData.Add(ItemData[i].ToString().ToUpper(), Input.Text);
|
|
|
+ //}
|
|
|
//勾选了自动匹配调用该函数
|
|
|
if (AutoMatch.Checked)
|
|
|
SetAutoMatchRow();
|
|
|
//将筛选之后的值赋给Cell
|
|
|
- SetDataToCell(ref CollectData, ItemData[0].ToString().ToUpper());
|
|
|
- }
|
|
|
- //如果本次采集的数据分割后和当前的采集项目个数不一样提示用户错误
|
|
|
- else if (CollectData.ToArray().Length == ItemData.Length)
|
|
|
- {
|
|
|
- for (int i = 0; i < ItemData.Length; i++)
|
|
|
- {
|
|
|
- //勾选了自动匹配调用该函数
|
|
|
- if (AutoMatch.Checked)
|
|
|
- SetAutoMatchRow();
|
|
|
- //将筛选之后的值赋给Cell
|
|
|
- SetDataToCell(ref CollectData, ItemData[i].ToString().ToUpper());
|
|
|
- }
|
|
|
+ SetDataToCell(ref CollectData);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -661,6 +652,7 @@ namespace UAS_LabelMachine
|
|
|
else
|
|
|
Print.BarTender.SinglePrint(SingleFormat, SingleLabelParam, pib_id);
|
|
|
LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
|
|
|
+ sdh.ExecuteSql("update prodibarcode set pib_ifprint=-1 where pib_id='" + pib_id + "'", "update");
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
|
@@ -686,127 +678,136 @@ namespace UAS_LabelMachine
|
|
|
/// </summary>
|
|
|
/// <param name="data"></param>
|
|
|
/// <param name="kind"></param>
|
|
|
- private void SetDataToCell(ref Dictionary<string, string> setdata, string kind)
|
|
|
+ private void SetDataToCell(ref Dictionary<string, string> setdata)
|
|
|
{
|
|
|
int length = setdata.Count;
|
|
|
- for (int j = 0; j < length; j++)
|
|
|
+ string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
|
+ string LotNo = "";
|
|
|
+ string DateCode = "";
|
|
|
+ foreach (var item in setdata)
|
|
|
{
|
|
|
string[] data = new string[setdata.Count];
|
|
|
for (int i = 0; i < length; i++)
|
|
|
{
|
|
|
- data[i] = setdata[kind];
|
|
|
+ data[i] = setdata[item.Key];
|
|
|
+ }
|
|
|
+ DataGridViewCell cell = null;
|
|
|
+ string Matchstr = "";
|
|
|
+ switch (item.Key)
|
|
|
+ {
|
|
|
+ case "DATECODE":
|
|
|
+ cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"];
|
|
|
+ Matchstr = MatchStr(item.Value, "DATECODE");
|
|
|
+ DateCode = Matchstr;
|
|
|
+ length--;
|
|
|
+ break;
|
|
|
+ case "LOTNO":
|
|
|
+ cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"];
|
|
|
+ Matchstr = MatchStr(item.Value, "LOTNO");
|
|
|
+ LotNo = Matchstr;
|
|
|
+ length--;
|
|
|
+ break;
|
|
|
+ case "MPN":
|
|
|
+ cell = LabelInf.Rows[CurrentRowIndex].Cells["pr_vendprodcode"];
|
|
|
+ Matchstr = MatchStr(item.Value, "MPN");
|
|
|
+ //采集的供应商号不匹配的话
|
|
|
+ if (cell.Value.ToString() != Matchstr)
|
|
|
+ {
|
|
|
+ CollectVeProdCodePass = false;
|
|
|
+ //添加需要重绘的Cell
|
|
|
+ LabelInf.Refresh();
|
|
|
+ MessageLog.AppendText(">>供应商物料编号不匹配\n", Color.Red);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LabelInf.Refresh();
|
|
|
+ CollectVeProdCodePass = true;
|
|
|
+ }
|
|
|
+ length--;
|
|
|
+ break;
|
|
|
+ case "QTY":
|
|
|
+ cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_qty"];
|
|
|
+ Matchstr = MatchStr(item.Value, "QTY");
|
|
|
+ //如果采集的数量不相等的话
|
|
|
+ if (cell.Value.ToString() != Matchstr)
|
|
|
+ {
|
|
|
+ CollectQTYPass = false;
|
|
|
+ LabelInf.Refresh();
|
|
|
+ MessageLog.AppendText(">>数量不匹配\n", Color.Red);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LabelInf.Refresh();
|
|
|
+ CollectQTYPass = true;
|
|
|
+ }
|
|
|
+ length--;
|
|
|
+ break;
|
|
|
+ case "品牌":
|
|
|
+ cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"];
|
|
|
+ Matchstr = MatchStr(item.Value, "品牌");
|
|
|
+ //如果采集的数量不相等的话
|
|
|
+ if (cell.Value.ToString() != Matchstr)
|
|
|
+ {
|
|
|
+ CollectQTYPass = false;
|
|
|
+ LabelInf.Refresh();
|
|
|
+ MessageLog.AppendText(">>品牌不匹配\n", Color.Red);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LabelInf.Refresh();
|
|
|
+ CollectQTYPass = true;
|
|
|
+ }
|
|
|
+ length--;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ break;
|
|
|
}
|
|
|
- for (int i = 0; i < data.Length; i++)
|
|
|
+ //如果数据为空或者数据不为空的时候但是和需要采集的数据不相等的情况下进行采集
|
|
|
+ //MPN和QTY只做比较不需要赋值
|
|
|
+ if (cell.Value.ToString() == "" || cell.Value.ToString() != Matchstr)
|
|
|
{
|
|
|
- DataGridViewCell cell = null;
|
|
|
- string Matchstr = "";
|
|
|
- switch (kind.ToString().ToUpper())
|
|
|
+ string MatchResult = "";
|
|
|
+ if (item.Key != "MPN" && item.Key != "QTY" && item.Key != "品牌")
|
|
|
{
|
|
|
- case "DATECODE":
|
|
|
- cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"];
|
|
|
- Matchstr = MatchStr(data[j], "DATECODE");
|
|
|
- setdata.Remove("DATECODE");
|
|
|
- length--;
|
|
|
+ DataTable dt = (DataTable)LabelInf.DataSource;
|
|
|
+ cell.Value = Matchstr;
|
|
|
+ MatchResult = "成功";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ MatchResult = "失败";
|
|
|
+ switch (SiItem[item.Key]["si_kind"])
|
|
|
+ {
|
|
|
+ case "索引字符":
|
|
|
+ LogManager.DoLog("采集项" + item.Key + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[item.Key]["si_kind"] + ",使用字符" + SiItem[item.Key]["si_indexstring"] + ",匹配后字符串" + Matchstr);
|
|
|
break;
|
|
|
- case "LOTNO":
|
|
|
- cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"];
|
|
|
- Matchstr = MatchStr(data[j], "LOTNO");
|
|
|
- setdata.Remove("LOTNO");
|
|
|
- length--;
|
|
|
+ case "起始位置":
|
|
|
+ LogManager.DoLog("采集项" + item.Key + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[item.Key]["si_kind"] + ",从第" + SiItem[item.Key]["si_index"] + "位开始匹配,匹配后字符串" + Matchstr);
|
|
|
break;
|
|
|
- case "MPN":
|
|
|
- cell = LabelInf.Rows[CurrentRowIndex].Cells["pr_vendprodcode"];
|
|
|
- Matchstr = MatchStr(data[j], "MPN");
|
|
|
- //采集的供应商号不匹配的话
|
|
|
- if (cell.Value.ToString() != Matchstr)
|
|
|
- {
|
|
|
- CollectVeProdCodePass = false;
|
|
|
- //添加需要重绘的Cell
|
|
|
- LabelInf.Refresh();
|
|
|
- MessageLog.AppendText(">>供应商物料编号不匹配\n", Color.Red);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LabelInf.Refresh();
|
|
|
- CollectVeProdCodePass = true;
|
|
|
- }
|
|
|
- setdata.Remove("MPN");
|
|
|
- length--;
|
|
|
+ case "二次解析":
|
|
|
+ LogManager.DoLog("采集项" + item.Key + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[item.Key]["si_kind"] + ",匹配后字符串" + Matchstr);
|
|
|
break;
|
|
|
- case "QTY":
|
|
|
- cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_qty"];
|
|
|
- Matchstr = MatchStr(data[j], "QTY");
|
|
|
- //如果采集的数量不相等的话
|
|
|
- if (cell.Value.ToString() != Matchstr)
|
|
|
- {
|
|
|
- CollectQTYPass = false;
|
|
|
- LabelInf.Refresh();
|
|
|
- MessageLog.AppendText(">>数量不匹配\n", Color.Red);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LabelInf.Refresh();
|
|
|
- CollectQTYPass = true;
|
|
|
- }
|
|
|
- setdata.Remove("QTY");
|
|
|
- length--;
|
|
|
- break;
|
|
|
- case "品牌":
|
|
|
- cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_brand"];
|
|
|
- Matchstr = MatchStr(data[j], "品牌");
|
|
|
- //如果采集的数量不相等的话
|
|
|
- if (cell.Value.ToString() != Matchstr)
|
|
|
- {
|
|
|
- CollectQTYPass = false;
|
|
|
- LabelInf.Refresh();
|
|
|
- MessageLog.AppendText(">>品牌不匹配\n", Color.Red);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- LabelInf.Refresh();
|
|
|
- CollectQTYPass = true;
|
|
|
- }
|
|
|
- setdata.Remove("品牌");
|
|
|
- length--;
|
|
|
+ case "全部":
|
|
|
+ LogManager.DoLog("采集项" + item.Key + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[item.Key]["si_kind"] + ",匹配后字符串" + Matchstr);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
- //如果数据为空或者数据不为空的时候但是和需要采集的数据不相等的情况下进行采集
|
|
|
- //MPN和QTY只做比较不需要赋值
|
|
|
- if (cell.Value.ToString() == "" || cell.Value.ToString() != Matchstr)
|
|
|
- {
|
|
|
- string MatchResult = "";
|
|
|
- if (kind != "MPN" && kind != "QTY" && kind != "品牌")
|
|
|
- {
|
|
|
- DataTable dt = (DataTable)LabelInf.DataSource;
|
|
|
- cell.Value = Matchstr;
|
|
|
- MatchResult = "成功";
|
|
|
- }
|
|
|
- else
|
|
|
- MatchResult = "失败";
|
|
|
- switch (SiItem[kind]["si_kind"])
|
|
|
- {
|
|
|
- case "索引字符":
|
|
|
- LogManager.DoLog("采集项" + kind + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[kind]["si_kind"] + ",使用字符" + SiItem[kind]["si_indexstring"] + ",匹配后字符串" + Matchstr);
|
|
|
- break;
|
|
|
- case "起始位置":
|
|
|
- LogManager.DoLog("采集项" + kind + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[kind]["si_kind"] + ",从第" + SiItem[kind]["si_index"] + "位开始匹配,匹配后字符串" + Matchstr);
|
|
|
- break;
|
|
|
- case "二次解析":
|
|
|
- LogManager.DoLog("采集项" + kind + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[kind]["si_kind"] + ",匹配后字符串" + Matchstr);
|
|
|
- break;
|
|
|
- case "全部":
|
|
|
- LogManager.DoLog("采集项" + kind + ",匹配结果:【" + MatchResult + "】,匹配方式:" + SiItem[kind]["si_kind"] + ",匹配后字符串" + Matchstr);
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- LogManager.DoLog("采集项" + kind + ",匹配结果:【成功】,匹配方式:" + SiItem[kind]["si_kind"] + ",,匹配后字符串" + Matchstr);
|
|
|
}
|
|
|
+ else
|
|
|
+ LogManager.DoLog("采集项" + item.Key + ",匹配结果:【成功】,匹配方式:" + SiItem[item.Key]["si_kind"] + ",,匹配后字符串" + Matchstr);
|
|
|
+ }
|
|
|
+ sql.Clear();
|
|
|
+ sql.Append("update prodiobarcode set pib_ifpick=-1");
|
|
|
+ if (LotNo != "")
|
|
|
+ {
|
|
|
+ sql.Append(",pib_lotno='" + LotNo + "'");
|
|
|
+ }
|
|
|
+ if (DateCode != "")
|
|
|
+ {
|
|
|
+ sql.Append(",pib_datecode='" + DateCode + "' ");
|
|
|
}
|
|
|
+ sql.Append("where pib_id='" + pib_id + "'");
|
|
|
+ sdh.ExecuteSql(sql.ToString(), "update");
|
|
|
//添加外箱号,如果外箱号的箱内容量不为0并且已经采集完成
|
|
|
SetOutBoxCode2(false);
|
|
|
}
|
|
|
@@ -1217,6 +1218,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
//勾选为已打印
|
|
|
LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
|
|
|
+ sdh.ExecuteSql("update prodibarcode set pib_ifprint=-1 where pib_id='" + pib_id + "'", "update");
|
|
|
}
|
|
|
catch (Exception ex) { LogManager.DoLog(ex.Message); }
|
|
|
}
|