|
|
@@ -62,10 +62,6 @@ namespace UAS_LabelMachine
|
|
|
string Brand;
|
|
|
string PI_ID;
|
|
|
/// <summary>
|
|
|
- /// 当前扫描的项目
|
|
|
- /// </summary>
|
|
|
- int CurrentItemIndex = 0;
|
|
|
- /// <summary>
|
|
|
/// 当前扫描的所在行
|
|
|
/// </summary>
|
|
|
int CurrentRowIndex = 0;
|
|
|
@@ -84,15 +80,10 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
bool logout = false;
|
|
|
|
|
|
- //每个不同序号存在的
|
|
|
- object[] ItemData;
|
|
|
-
|
|
|
DataTable SingleLabelParam;
|
|
|
DataTable MidLabelParam;
|
|
|
DataTable OutLabelParam;
|
|
|
|
|
|
- Dictionary<string, string> CollectData;
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 存放单盘的ID
|
|
|
/// </summary>
|
|
|
@@ -125,13 +116,10 @@ namespace UAS_LabelMachine
|
|
|
/// 是否获取过箱号
|
|
|
/// </summary>
|
|
|
bool GetPackingCode = false;
|
|
|
- /*用于存放采集项目的Grid信息*/
|
|
|
- Dictionary<string, Dictionary<string, string>> SiItem;
|
|
|
+
|
|
|
+ Dictionary<int, string> Si_Item = new Dictionary<int, string>();
|
|
|
/*需要重绘的Cell*/
|
|
|
Dictionary<DataGridViewCell, bool> PaintCell = new Dictionary<DataGridViewCell, bool>();
|
|
|
- //使用二维数组进行排序
|
|
|
- ArrayList<ArrayList<string>> ScanData;
|
|
|
- ArrayList<string> GetData;
|
|
|
/// <summary>
|
|
|
/// 是否通过选择Combox来改变打开的文件
|
|
|
/// </summary>
|
|
|
@@ -152,7 +140,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
base.WndProc(ref m);
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
|
|
|
private void 贴标机条码打印_Load(object sender, EventArgs e)
|
|
|
{
|
|
|
@@ -326,57 +314,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //放大镜选择后出发的事件
|
|
|
- private void sg_code_UserControlTextChanged(object sender, EventArgs e)
|
|
|
- {
|
|
|
- //取已启用的的按照采集次序排序
|
|
|
- dt = (DataTable)dh.ExecuteSql("select si_item,si_detno,sg_separator,si_kind,si_expression,si_expressionitem,si_index,si_indexstring,si_length from scanitem left join scangroup on si_sgid=sg_id where sg_code='" + sg_code.Text + "' and si_enable<>0 order by si_detno,si_innerdetno", "select");
|
|
|
- BaseUtil.FillDgvWithDataTable(Si_ItemDGV, dt);
|
|
|
- if (dt.Rows.Count > 0)
|
|
|
- {
|
|
|
- sg_separator.Text = dt.Rows[0]["sg_separator"].ToString();
|
|
|
- }
|
|
|
- //按DetNo排列之后的采集项
|
|
|
- ScanData = new ArrayList<ArrayList<string>>();
|
|
|
- //每个采集项目的子项
|
|
|
- GetData = new ArrayList<string>();
|
|
|
- //将数据添加进一个List的二维数组中
|
|
|
- for (int i = 0; i < Si_ItemDGV.RowCount; i++)
|
|
|
- {
|
|
|
- //如果不包含这个则添加进数组
|
|
|
- if (!GetData.Contains(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString()))
|
|
|
- {
|
|
|
- GetData.Add(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString());
|
|
|
- }
|
|
|
- //如果和后一个的采集次序相同
|
|
|
- if (((i + 1) < Si_ItemDGV.RowCount) && Si_ItemDGV.Rows[i].Cells["si_detno"].Value.ToString() == Si_ItemDGV.Rows[i + 1].Cells["si_detno"].Value.ToString())
|
|
|
- {
|
|
|
- GetData.Add(Si_ItemDGV.Rows[i + 1].Cells["si_item"].Value.ToString());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ScanData.Add(GetData);
|
|
|
- //添加完一次数据需要一个新的List
|
|
|
- GetData = new ArrayList<string>();
|
|
|
- }
|
|
|
- }
|
|
|
- RemindUser();
|
|
|
- if (ScanData.ToArray().Length > 0)
|
|
|
- {
|
|
|
- object[] arr = (ScanData.ToArray()[0] as ArrayList<string>).ToArray();
|
|
|
- if (arr.Contains("MPN"))
|
|
|
- {
|
|
|
- AutoMatch.CheckState = CheckState.Checked;
|
|
|
- AutoMatch.Enabled = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- AutoMatch.CheckState = CheckState.Unchecked;
|
|
|
- AutoMatch.Enabled = false;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
//输入框Enter事件
|
|
|
private void Input_KeyDown(object sender, KeyEventArgs e)
|
|
|
{
|
|
|
@@ -396,133 +333,12 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 设置自动匹配的数据的行号
|
|
|
- /// </summary>
|
|
|
- /// <returns></returns>
|
|
|
- private void SetAutoMatchRow()
|
|
|
- {
|
|
|
- //采集策略的第一组数据
|
|
|
- string[] arr = new string[ItemData.Length];
|
|
|
- if (sg_separator.Text == "")
|
|
|
- {
|
|
|
- for (int i = 0; i < arr.Length; i++)
|
|
|
- {
|
|
|
- arr[i] = BackCheck.Text;
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- arr = BackCheck.Text.Split(sg_separator.Text.ToCharArray()).ToArray();
|
|
|
- }
|
|
|
- bool FindAutoMatch = false;
|
|
|
- for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
- {
|
|
|
- for (int j = 0; j < arr.Length; j++)
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pr_vendprodcode"].Value.ToString() == MatchStr(arr[j].ToString(), "MPN") && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
|
|
|
- {
|
|
|
- CurrentRowIndex = i;
|
|
|
- FindAutoMatch = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (FindAutoMatch)
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/// <summary>
|
|
|
/// 采集数据
|
|
|
/// </summary>
|
|
|
private void CollectInputData()
|
|
|
{
|
|
|
LogManager.DoLog("采集数据【" + BackCheck.Text + "】,使用采集策略编号【" + sg_code.Text + "】");
|
|
|
- //按DetNo排列之后的采集项
|
|
|
- ScanData = new ArrayList<ArrayList<string>>();
|
|
|
- //每个采集项目的子项
|
|
|
- GetData = new ArrayList<string>();
|
|
|
- //用于保存采集策略的具体信息
|
|
|
- SiItem = new Dictionary<string, Dictionary<string, string>>();
|
|
|
- for (int i = 0; i < Si_ItemDGV.RowCount; i++)
|
|
|
- {
|
|
|
- //如果不包含这个则添加进数组
|
|
|
- if (!GetData.Contains(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString()))
|
|
|
- GetData.Add(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString());
|
|
|
- //如果和后一个的采集次序相同
|
|
|
- if (((i + 1) < Si_ItemDGV.RowCount) && Si_ItemDGV.Rows[i].Cells["si_detno"].Value.ToString() == Si_ItemDGV.Rows[i + 1].Cells["si_detno"].Value.ToString())
|
|
|
- GetData.Add(Si_ItemDGV.Rows[i + 1].Cells["si_item"].Value.ToString());
|
|
|
- else
|
|
|
- {
|
|
|
- ScanData.Add(GetData);
|
|
|
- //添加完一次数据需要一个新的List
|
|
|
- GetData = new ArrayList<string>();
|
|
|
- }
|
|
|
- Dictionary<string, string> item = new Dictionary<string, string>();
|
|
|
- for (int j = 0; j < Si_ItemDGV.ColumnCount; j++)
|
|
|
- {
|
|
|
- item.Add(Si_ItemDGV.Columns[j].DataPropertyName, Si_ItemDGV.Rows[i].Cells[j].Value.ToString());
|
|
|
- }
|
|
|
- SiItem.Add(Si_ItemDGV.Rows[i].Cells["si_item"].Value.ToString().ToUpper(), item);
|
|
|
- }
|
|
|
- //采集项目的数组
|
|
|
- ItemData = (ScanData.ToArray()[CurrentItemIndex] as ArrayList<string>).ToArray();
|
|
|
- //分隔符不为空的时候 //采集的项和Grid的数目不等
|
|
|
- //用户采集的数据的分割数组
|
|
|
- CollectData = new Dictionary<string, string>();
|
|
|
- if (sg_separator.Text == "")
|
|
|
- {
|
|
|
- for (int i = 0; i < ItemData.Length; i++)
|
|
|
- CollectData.Add(ItemData[i].ToString().ToUpper(), BackCheck.Text);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- int DataCount = BackCheck.Text.Split(sg_separator.Text.ToCharArray()).Length;
|
|
|
- if (DataCount > ItemData.Length)
|
|
|
- {
|
|
|
- MessageBox.Show("采集数据大于采集项次");
|
|
|
- return;
|
|
|
- }
|
|
|
- else if (DataCount < ItemData.Length)
|
|
|
- {
|
|
|
- MessageBox.Show("采集数据小于采集项次");
|
|
|
- return;
|
|
|
- }
|
|
|
- for (int i = 0; i < DataCount; i++)
|
|
|
- CollectData.Add(ItemData[i].ToString().ToUpper(), BackCheck.Text.Split(sg_separator.Text.ToCharArray())[i]);
|
|
|
- }
|
|
|
- //首先判断当前采集的个数,如果采集的个数为1则不对数据进行分隔符验证
|
|
|
- if (ItemData.Length == 1)
|
|
|
- {
|
|
|
- CollectData.Clear();
|
|
|
- CollectData.Add(ItemData[0].ToString().ToUpper(), BackCheck.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());
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- MessageBox.Show("所采集的数据个数和采集项目不符");
|
|
|
- return;
|
|
|
- }
|
|
|
- //采集项目的索引+1
|
|
|
- CurrentItemIndex = CurrentItemIndex + 1;
|
|
|
- //如果已经采集完了最后一个
|
|
|
- if (CurrentItemIndex == ScanData.ToArray().Length)
|
|
|
{
|
|
|
//数据校验均已通过则勾选上已采集
|
|
|
if (CollectVeProdCodePass && CollectQTYPass)
|
|
|
@@ -622,8 +438,6 @@ namespace UAS_LabelMachine
|
|
|
if (!AutoMatch.Checked)
|
|
|
SetRowIndexToCollectRow();
|
|
|
}
|
|
|
- //当前项目已采集完成,重置采集项目
|
|
|
- CurrentItemIndex = 0;
|
|
|
//未勾选自动匹配,设置到下一个未采集的行
|
|
|
if (!AutoMatch.Checked)
|
|
|
SetRowIndexToCollectRow();
|
|
|
@@ -637,23 +451,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
string LastRowProd = LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_prodcode"].Value.ToString();
|
|
|
string CurrentRowProd = LabelInf.Rows[CurrentRowIndex].Cells["pib_prodcode"].Value.ToString();
|
|
|
- //如果两行的物料资料不相等的话
|
|
|
- if (LastRowProd != CurrentRowProd)
|
|
|
- SetOutBoxCapacity(CurrentRowProd);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 根据物料资料的参数设置外箱容量
|
|
|
- /// </summary>
|
|
|
- /// <param name="pr_code"></param>
|
|
|
- private void SetOutBoxCapacity(string pr_code)
|
|
|
- {
|
|
|
- DataTable temp = (DataTable)dh.ExecuteSql("select pr_qtyperplace,pr_zxbzs from product where pr_code='" + pr_code + "'", "select");
|
|
|
- if (temp.Rows.Count > 0)
|
|
|
- {
|
|
|
- //try { OutboxCapacity.Value = (decimal)temp.Rows[0]["pr_qtyperplace"] / (decimal)temp.Rows[0]["pr_zxbzs"]; }
|
|
|
- //catch (Exception) { }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -711,143 +508,6 @@ namespace UAS_LabelMachine
|
|
|
private void RemindUser()
|
|
|
{
|
|
|
SetRowIndexToCollectRow();
|
|
|
- if (ScanData.ToArray().Length > 0)
|
|
|
- {
|
|
|
- object[] arr = (ScanData.ToArray()[CurrentItemIndex] as ArrayList<string>).ToArray();
|
|
|
- string Inf = "";
|
|
|
- for (int i = 0; i < arr.Length; i++)
|
|
|
- {
|
|
|
- Inf += arr[i] + " ";
|
|
|
- }
|
|
|
- MessageLog.AppendText(">>当前采集行" + (CurrentRowIndex + 1) + ",请采集" + Inf + "\n", Color.Green);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- /// <summary>
|
|
|
- /// 自定义函数 将匹配之后的值设置到Cell中,传递引用,每次赋值之后从List中移除已使用过的
|
|
|
- /// </summary>
|
|
|
- /// <param name="data"></param>
|
|
|
- /// <param name="kind"></param>
|
|
|
- private void SetDataToCell(ref Dictionary<string, string> setdata, string kind)
|
|
|
- {
|
|
|
- int length = setdata.Count;
|
|
|
- for (int j = 0; j < length; j++)
|
|
|
- {
|
|
|
- string[] data = new string[setdata.Count];
|
|
|
- for (int i = 0; i < length; i++)
|
|
|
- {
|
|
|
- data[i] = setdata[kind];
|
|
|
- }
|
|
|
- for (int i = 0; i < data.Length; i++)
|
|
|
- {
|
|
|
- DataGridViewCell cell = null;
|
|
|
- string Matchstr = "";
|
|
|
- switch (kind.ToString().ToUpper())
|
|
|
- {
|
|
|
- case "DATECODE":
|
|
|
- cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"];
|
|
|
- Matchstr = MatchStr(data[j], "DATECODE");
|
|
|
- setdata.Remove("DATECODE");
|
|
|
- length--;
|
|
|
- break;
|
|
|
- case "LOTNO":
|
|
|
- cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"];
|
|
|
- Matchstr = MatchStr(data[j], "LOTNO");
|
|
|
- setdata.Remove("LOTNO");
|
|
|
- length--;
|
|
|
- break;
|
|
|
- case "MPN":
|
|
|
- cell = LabelInf.Rows[CurrentRowIndex].Cells["pr_vendprodcode"];
|
|
|
- Matchstr = MatchStr(data[j], "MPN");
|
|
|
- //采集的供应商号不匹配的话
|
|
|
- if (cell.Value.ToString() != Matchstr)
|
|
|
- {
|
|
|
- CollectVeProdCodePass = false;
|
|
|
- //添加需要重绘的Cell
|
|
|
- if (PaintCell.ContainsKey(cell))
|
|
|
- PaintCell.Remove(cell);
|
|
|
- PaintCell.Add(cell, false);
|
|
|
- LabelInf.Refresh();
|
|
|
- MessageLog.AppendText(">>供应商物料编号不匹配\n", Color.Red);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (PaintCell.ContainsKey(cell))
|
|
|
- PaintCell.Remove(cell);
|
|
|
- PaintCell.Add(cell, true);
|
|
|
- LabelInf.Refresh();
|
|
|
- CollectVeProdCodePass = true;
|
|
|
- }
|
|
|
- setdata.Remove("MPN");
|
|
|
- length--;
|
|
|
- break;
|
|
|
- case "QTY":
|
|
|
- cell = LabelInf.Rows[CurrentRowIndex].Cells["pib_qty"];
|
|
|
- Matchstr = MatchStr(data[j], "QTY");
|
|
|
- //如果采集的数量不相等的话
|
|
|
- if (cell.Value.ToString() != Matchstr)
|
|
|
- {
|
|
|
- CollectQTYPass = false;
|
|
|
- //添加需要重绘的Cell
|
|
|
- if (PaintCell.ContainsKey(cell))
|
|
|
- PaintCell.Remove(cell);
|
|
|
- PaintCell.Add(cell, false);
|
|
|
- LabelInf.Refresh();
|
|
|
- MessageLog.AppendText(">>数量不匹配\n", Color.Red);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (PaintCell.ContainsKey(cell))
|
|
|
- PaintCell.Remove(cell);
|
|
|
- PaintCell.Add(cell, true);
|
|
|
- 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;
|
|
|
- //添加需要重绘的Cell
|
|
|
- if (PaintCell.ContainsKey(cell))
|
|
|
- PaintCell.Remove(cell);
|
|
|
- PaintCell.Add(cell, false);
|
|
|
- LabelInf.Refresh();
|
|
|
- MessageLog.AppendText(">>品牌不匹配\n", Color.Red);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (PaintCell.ContainsKey(cell))
|
|
|
- PaintCell.Remove(cell);
|
|
|
- PaintCell.Add(cell, true);
|
|
|
- LabelInf.Refresh();
|
|
|
- CollectQTYPass = true;
|
|
|
- }
|
|
|
- setdata.Remove("品牌");
|
|
|
- length--;
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- //如果数据为空或者数据不为空的时候但是和需要采集的数据不相等的情况下进行采集
|
|
|
- //MPN和QTY只做比较不需要赋值
|
|
|
- if (cell.Value.ToString() == "" || cell.Value.ToString() != Matchstr)
|
|
|
- {
|
|
|
- if (kind != "MPN" && kind != "QTY" && kind != "品牌")
|
|
|
- {
|
|
|
- DataTable dt = (DataTable)MidSource.DataSource;
|
|
|
- cell.Value = Matchstr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- //添加外箱号,如果外箱号的箱内容量不为0并且已经采集完成
|
|
|
- SetOutBoxCode2(false);
|
|
|
}
|
|
|
|
|
|
//
|
|
|
@@ -909,85 +569,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- /// <summary>
|
|
|
- /// 自定义函数 根据匹配规则
|
|
|
- /// si_item的二维数组,str是需要赋值的字符串,item表示DateCode,LotNo等
|
|
|
- /// </summary>
|
|
|
- /// <param name="SiItem"></param>
|
|
|
- /// <param name="str"></param>
|
|
|
- /// <param name="item"></param>
|
|
|
- /// <returns></returns>
|
|
|
- private string MatchStr(string str, string item)
|
|
|
- {
|
|
|
- string kind = SiItem[item]["si_kind"];
|
|
|
- //起始字符不为空的时候
|
|
|
- switch (kind)
|
|
|
- {
|
|
|
- case "起始位置":
|
|
|
- if (SiItem[item]["si_index"] != "")
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- //长度不为空的时候按照指定的长度去取数据
|
|
|
- if (SiItem[item]["si_length"] != "")
|
|
|
- str = str.Substring(int.Parse(SiItem[item]["si_index"]), int.Parse(SiItem[item]["si_length"]));
|
|
|
- //长度为空的时候取index之后的全部数据
|
|
|
- else
|
|
|
- str = str.Substring(int.Parse(SiItem[item]["si_index"]));
|
|
|
- }
|
|
|
- catch (Exception e) { LogManager.DoLog(e.StackTrace); }
|
|
|
- }
|
|
|
- break;
|
|
|
- case "索引字符":
|
|
|
- try
|
|
|
- {
|
|
|
- if (SiItem[item]["si_indexstring"] != "")
|
|
|
- {
|
|
|
- //长度不为空的时候按照指定的长度去取数据
|
|
|
- if (SiItem[item]["si_length"] != "")
|
|
|
- str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1, int.Parse(SiItem[item]["si_length"]));
|
|
|
- //长度为空的时候取index之后的全部数据
|
|
|
- else
|
|
|
- str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (Exception e) { LogManager.DoLog(e.StackTrace); }
|
|
|
- break;
|
|
|
- case "二次解析":
|
|
|
- if (SiItem[item]["si_indexstring"] != "")
|
|
|
- {
|
|
|
- //长度不为空的时候按照指定的长度去取数据
|
|
|
- if (SiItem[item]["si_length"] != "")
|
|
|
- str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1, int.Parse(SiItem[item]["si_length"]));
|
|
|
- //长度为空的时候取index之后的全部数据
|
|
|
- else
|
|
|
- str = str.Substring(str.IndexOf(SiItem[item]["si_indexstring"]) + 1);
|
|
|
- }
|
|
|
- str = Analysis.AnalysisData(Brand, item, str);
|
|
|
- break;
|
|
|
- case "全部":
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- if (SiItem[item]["si_expression"] != "")
|
|
|
- {
|
|
|
- string log = "使用正则表达式" + SiItem[item]["si_expression"] + "匹配数据" + str;
|
|
|
- reg = new Regex(SiItem[item]["si_expression"]);
|
|
|
- try
|
|
|
- {
|
|
|
- str = reg.Matches(str)[int.Parse(SiItem[item]["si_expressionitem"].ToString()) - 1].Value;
|
|
|
- }
|
|
|
- catch (Exception)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
- log += ",匹配后数据" + str;
|
|
|
- LogManager.DoLog(log);
|
|
|
- }
|
|
|
- return str;
|
|
|
- }
|
|
|
-
|
|
|
//关闭窗口前提示用户确认
|
|
|
private void 贴标机条码打印_FormClosing(object sender, FormClosingEventArgs e)
|
|
|
{
|
|
|
@@ -1126,8 +707,6 @@ namespace UAS_LabelMachine
|
|
|
stw = new SetLoadingWindow(thread, "正在获取打印标签");
|
|
|
BaseUtil.SetFormCenter(stw);
|
|
|
stw.ShowDialog();
|
|
|
- //重置采集项次
|
|
|
- CurrentItemIndex = 0;
|
|
|
LogManager.DoLog("输入单号【" + pi_inoutno.Text + "】");
|
|
|
}
|
|
|
else
|
|
|
@@ -1656,8 +1235,26 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
Brand = LabelInf.Rows[0].Cells["pib_brand"].FormattedValue.ToString();
|
|
|
if (Brand != "")
|
|
|
- sg_code.Text = dh.getFieldDataByCondition("scangroup", "sg_code", "sg_brand='" + Brand + "'").ToString();
|
|
|
- SetOutBoxCapacity(LabelInf.Rows[0].Cells["pib_prodcode"].Value.ToString());
|
|
|
+ {
|
|
|
+ dt = (DataTable)dh.ExecuteSql("select sg_script,sg_id from scangroup where sg_brand='" + Brand + "'", "select");
|
|
|
+ if (dt.Rows.Count > 0)
|
|
|
+ {
|
|
|
+ string sgid = dt.Rows[0]["sg_id"].ToString();
|
|
|
+ string sgscript = dt.Rows[0]["sg_script"].ToString();
|
|
|
+ DataTable dt1 = (DataTable)dh.ExecuteSql("select si_name,si_item,si_expression from scanitem where si_sgid='" + sgid + "'", "select");
|
|
|
+ for (int i = 0; i < dt1.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (sgscript.IndexOf(dt1.Rows[i]["si_name"].ToString()) != 0)
|
|
|
+ {
|
|
|
+ Si_Item.Add(sgscript.IndexOf(dt1.Rows[i]["si_name"].ToString()), dt1.Rows[i]["si_item"].ToString());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //根据索引进行排序
|
|
|
+ Si_Item = (from entry in Si_Item
|
|
|
+ orderby entry.Key ascending
|
|
|
+ select entry).ToDictionary(pair => pair.Key, pair => pair.Value);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
//绑定数据之后往下找到未采集的数据显示在当前采集的栏目
|
|
|
for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
@@ -1759,7 +1356,6 @@ namespace UAS_LabelMachine
|
|
|
private void pr_code_UserControlTextChanged(object sender, EventArgs e)
|
|
|
{
|
|
|
//用户在重新勾选后重置采集项目的索引
|
|
|
- CurrentItemIndex = 0;
|
|
|
for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
{
|
|
|
if (pr_code.Text == LabelInf.Rows[i].Cells["pib_prodcode"].Value.ToString() && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
|
|
|
@@ -1791,7 +1387,6 @@ namespace UAS_LabelMachine
|
|
|
if (LabelInf.Rows[i].Cells["pib_pdno"].Value.ToString() == griddetno.Text && LabelInf.Rows[i].Cells["pib_ifpick"].FormattedValue.ToString() != "True")
|
|
|
{
|
|
|
FindDetno = true;
|
|
|
- CurrentItemIndex = 0;
|
|
|
CurrentRowIndex = i;
|
|
|
RemindUser();
|
|
|
break;
|
|
|
@@ -2086,7 +1681,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
case "采集策略设置":
|
|
|
采集策略_NEW form = new 采集策略_NEW();
|
|
|
- form.FormClosed += sg_code_UserControlTextChanged;
|
|
|
BaseUtil.SetFormCenter(form);
|
|
|
form.ShowDialog();
|
|
|
break;
|