|
|
@@ -273,11 +273,11 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
DateCode = matchs[index].Value;
|
|
|
}
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_datecode"].Value = DateCode;
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_datecode"] = DateCode;
|
|
|
break;
|
|
|
case "LotNo":
|
|
|
LotNo = matchs[index].Value;
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_lotno"].Value = LotNo;
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_lotno"] = LotNo;
|
|
|
break;
|
|
|
case "PN":
|
|
|
PN = matchs[index].Value;
|
|
|
@@ -307,12 +307,14 @@ namespace UAS_LabelMachine
|
|
|
LabelInf.Refresh();
|
|
|
}
|
|
|
}
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_ifpick"] = true;
|
|
|
LabelInf.Refresh();
|
|
|
}
|
|
|
|
|
|
private void BackendCheckFunction(string msg, string pib_id)
|
|
|
{
|
|
|
+ Console.WriteLine(System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
|
|
|
+ DataTable dtt = LabelInf.DataSource as DataTable;
|
|
|
string[] msgArr = msg.Split('@');
|
|
|
//需要校验2项数据,完成校验后此项的值需要为2则表示校验成功
|
|
|
int checkItemCount = 0;
|
|
|
@@ -359,7 +361,7 @@ namespace UAS_LabelMachine
|
|
|
MessageBox.Show("复核不通过");
|
|
|
return;
|
|
|
}
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_ifrecheck"].Value = true;
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_ifrecheck"] = true;
|
|
|
adh.ExecuteSql("update prodiobarcode set pib_ifrecheck=-1 where pib_id=" + pib_id, "update");
|
|
|
LabelInf.Refresh();
|
|
|
//获取当前最大的箱号
|
|
|
@@ -398,14 +400,26 @@ namespace UAS_LabelMachine
|
|
|
outboxcode1 = outboxcode1 + 1;
|
|
|
}
|
|
|
}
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode1"].Value = outboxcode1;
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_outboxcode2"].Value = outboxcode2;
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_outboxcode1"] = outboxcode1;
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_outboxcode2"] = outboxcode2;
|
|
|
adh.ExecuteSql("update prodiobarcode set pib_outboxcode2=" + outboxcode2 + ",pib_outboxcode1=" + outboxcode1 + ",pib_lotno='" + LotNo + "',pib_datecode='" + DateCode + "',pib_ifpick=-1 where pib_id=" + pib_id, "update");
|
|
|
LabelInf.Refresh();
|
|
|
if (CurrentRowIndex + 1 < LabelInf.Rows.Count)
|
|
|
CurrentRowIndex = CurrentRowIndex + 1;
|
|
|
RefreshProcessData();
|
|
|
- LogicHandler.CheckUploadData(pi_inoutno.Text, UploadNum);
|
|
|
+ if (CurrentRowIndex - 10 > 0)
|
|
|
+ LabelInf.FirstDisplayedScrollingRowIndex = CurrentRowIndex - 10;
|
|
|
+ //如果成功上传了数据
|
|
|
+ if (LogicHandler.CheckUploadData(pi_inoutno.Text, UploadNum))
|
|
|
+ {
|
|
|
+ for (int i = 0; i < dtt.Rows.Count; i++)
|
|
|
+ {
|
|
|
+ if (dtt.Rows[i]["pib_ifrecheck"].ToString() != "0" && dtt.Rows[i]["pib_ifupload"].ToString() == "0")
|
|
|
+ {
|
|
|
+ dtt.Rows[i]["pib_ifupload"] = -1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//只执行一次窗体自适应
|
|
|
@@ -468,10 +482,9 @@ namespace UAS_LabelMachine
|
|
|
if (CollectVeProdCodePass && CollectQTYPass)
|
|
|
{
|
|
|
//如果按盒号采集,所有的此盒的均更新为
|
|
|
- DataTable dt = (DataTable)MidSource.DataSource;
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_ifpick"].Value = true;
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_ifpick"] = true;
|
|
|
LogicHandler.UpdateRowPicked(LabelInf.Rows[CurrentRowIndex].Cells["pib_id"].Value);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["Choose"].Value = true;
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["Choose"] = true;
|
|
|
//勾选了单盘自动打印
|
|
|
if (SingleLabelAutoPrint.Checked)
|
|
|
{
|
|
|
@@ -526,7 +539,7 @@ namespace UAS_LabelMachine
|
|
|
SingleDoc.Printer.SwitchTo(SingleLabelPrinter.Text);
|
|
|
SingleDoc.PrintDocument();
|
|
|
LogicHandler.UpdateRowPrinted(pib_id);
|
|
|
- LabelInf.Rows[CurrentRowIndex].Cells["pib_ifprint"].Value = true;
|
|
|
+ LabelInfDataTable.Rows[CurrentRowIndex]["pib_ifprint"] = true;
|
|
|
}
|
|
|
|
|
|
//关闭窗口前提示用户确认
|
|
|
@@ -850,7 +863,7 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
//勾选为已打印
|
|
|
- LabelInf.Rows[i].Cells["pib_ifprint"].Value = true;
|
|
|
+ LabelInfDataTable.Rows[i]["pib_ifprint"] = true;
|
|
|
}
|
|
|
catch (Exception ex) { LogManager.DoLog(ex.Message); }
|
|
|
}
|
|
|
@@ -883,9 +896,9 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
for (int i = begin - 1; i < end; i++)
|
|
|
{
|
|
|
- LabelInf.Rows[i].Cells["Choose"].Value = true;
|
|
|
- LabelInf.Rows[i].Cells["pib_ifpick"].Value = true;
|
|
|
- LabelInf.Rows[i].Cells["pib_ifprint"].Value = false;
|
|
|
+ LabelInfDataTable.Rows[i]["Choose"] = true;
|
|
|
+ LabelInfDataTable.Rows[i]["pib_ifpick"] = true;
|
|
|
+ LabelInfDataTable.Rows[i]["pib_ifprint"] = false;
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -1178,7 +1191,7 @@ namespace UAS_LabelMachine
|
|
|
if (LabelInf.Rows.Count > 0)
|
|
|
{
|
|
|
//设置初始化的采集进度
|
|
|
- int Count = 0;
|
|
|
+ int Count = Count = adh.getRowCount("prodiobarcode", "pib_ifrecheck=-1");
|
|
|
string midboxcode = "";
|
|
|
string outboxcode = "";
|
|
|
if (CurrentRowIndex - 1 >= 0)
|
|
|
@@ -1187,11 +1200,6 @@ namespace UAS_LabelMachine
|
|
|
midboxcode = LabelInf.Rows[CurrentRowIndex - 1].Cells["pib_outboxcode1"].Value.ToString();
|
|
|
}
|
|
|
//未超出当前范围的时候
|
|
|
- for (int i = 0; i < LabelInf.RowCount; i++)
|
|
|
- {
|
|
|
- if (LabelInf.Rows[i].Cells["pib_ifrecheck"].FormattedValue.ToString() == "True")
|
|
|
- Count++;
|
|
|
- }
|
|
|
int midboxcount = adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode1=" + (midboxcode == "" ? "0" : midboxcode));
|
|
|
int outboxcount = adh.getRowCount("prodiobarcode", "pib_inoutno='" + pi_inoutno.Text + "' and pib_outboxcode2=" + (outboxcode == "" ? "0" : outboxcode));
|
|
|
midboxProcess.Text = midboxcount + "/" + MidBoxCapacity.Value;
|
|
|
@@ -1200,7 +1208,7 @@ namespace UAS_LabelMachine
|
|
|
Process_midboxcode.Text = midboxcode;
|
|
|
Process_outboxcode.Text = outboxcode;
|
|
|
//设置当前总数和已采集数量
|
|
|
- CollectedCount.Text = Count.ToString() + "/" + LabelInf.Rows.Count;
|
|
|
+ CollectedCount.Text = Count + "/" + PageNum.Text;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1212,6 +1220,7 @@ namespace UAS_LabelMachine
|
|
|
int PageSize = 1000;
|
|
|
int DataSize = 0;
|
|
|
int MaxPageSize = 0;
|
|
|
+ DataTable LabelInfDataTable;
|
|
|
/// <summary>
|
|
|
/// 自定义函数 加载明细行的数据,多处使用添加进函数
|
|
|
/// </summary>
|
|
|
@@ -1227,8 +1236,8 @@ namespace UAS_LabelMachine
|
|
|
sql.Append(" and pib_pdno between " + DetailRange1.Value + " and " + DetailRange2.Value);
|
|
|
}
|
|
|
sql.Append(" order by rownum");
|
|
|
- dt = (DataTable)adh.ExecuteSql(sql.ToString(), "select");
|
|
|
- if (dt.Rows.Count == 0)
|
|
|
+ LabelInfDataTable = (DataTable)adh.ExecuteSql(sql.ToString(), "select");
|
|
|
+ if (LabelInfDataTable.Rows.Count == 0)
|
|
|
{
|
|
|
//嵌套查询重置RowNum
|
|
|
sql.Clear();
|
|
|
@@ -1236,18 +1245,18 @@ namespace UAS_LabelMachine
|
|
|
sql.Append("pib_id,pib_pdid,pib_piid,pib_pdno,pib_prodcode,nvl(nvl(pd_brand,pib_brand),pr_brand)pib_brand, pr_vendprodcode,pib_lotno,pib_datecode,pib_qty,pr_spec,pi_title,pr_zxbzs,pr_unit,pib_barcode,pib_outboxcode1,");
|
|
|
sql.Append("pib_outboxcode2,nvl(pib_ifpick,0)pib_ifpick,nvl(pib_ifprint,0)pib_ifprint from prodiobarcode left join prodinout on pib_piid=pi_id left join prodiodetail on pib_piid=pd_piid and pd_pdno=pib_pdno and ");
|
|
|
sql.Append("pd_prodcode=pib_prodcode left join product on pr_code=pib_prodcode left join sale on sa_code=pib_ordercode where pib_piid='" + PI_ID + "' order by to_number(pib_id))t");
|
|
|
- dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
+ LabelInfDataTable = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
//检验查询的字段和本地数据库字段是否匹配
|
|
|
- adh.AddColumFromDataTable(dt, "prodiobarcode");
|
|
|
+ adh.AddColumFromDataTable(LabelInfDataTable, "prodiobarcode");
|
|
|
//将数据保存在本地数据库
|
|
|
- adh.SaveDataTable(dt, "prodiobarcode");
|
|
|
+ adh.SaveDataTable(LabelInfDataTable, "prodiobarcode");
|
|
|
if (!DetailRange.Checked)
|
|
|
{
|
|
|
- dt = BaseUtil.filterDataTable(dt, "rownum <=" + PageSize);
|
|
|
+ LabelInfDataTable = BaseUtil.filterDataTable(LabelInfDataTable, "rownum <=" + PageSize);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- dt = BaseUtil.filterDataTable(dt, "rownum <=" + PageSize + " and pib_pdno >= " + DetailRange1.Value + " and pib_pdno<=" + DetailRange2.Value);
|
|
|
+ LabelInfDataTable = BaseUtil.filterDataTable(LabelInfDataTable, "rownum <=" + PageSize + " and pib_pdno >= " + DetailRange1.Value + " and pib_pdno<=" + DetailRange2.Value);
|
|
|
}
|
|
|
}
|
|
|
//获取数据总条数
|
|
|
@@ -1262,8 +1271,7 @@ namespace UAS_LabelMachine
|
|
|
PageNum.Text = "总数" + DataSize;
|
|
|
MaxPageSize = DataSize % PageSize == 0 ? DataSize / PageSize : (DataSize / PageSize) + 1;
|
|
|
PageInf.Text = CurrentPage + "/" + MaxPageSize;
|
|
|
- MidSource.DataSource = dt;
|
|
|
- BaseUtil.FillDgvWithDataTable(LabelInf, (DataTable)MidSource.DataSource);
|
|
|
+ BaseUtil.FillDgvWithDataTable(LabelInf, LabelInfDataTable);
|
|
|
//获取系统设置的上传数量,如参数异常则默认为100
|
|
|
dt = (DataTable)adh.ExecuteSql("select uploadnum,splitback,splitfront from dataextra", "select");
|
|
|
if (dt.Rows.Count > 0)
|
|
|
@@ -1483,7 +1491,7 @@ namespace UAS_LabelMachine
|
|
|
if (result == DialogResult.OK)
|
|
|
{
|
|
|
ExcelHandler eh = new ExcelHandler();
|
|
|
- DataTable dt = ((DataTable)MidSource.DataSource).Copy();
|
|
|
+ DataTable dt = LabelInfDataTable;
|
|
|
for (int i = dt.Columns.Count - 1; i >= 0; i--)
|
|
|
{
|
|
|
for (int j = 0; j < LabelInf.Columns.Count; j++)
|
|
|
@@ -1642,7 +1650,16 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void PLCStart_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+ DataTable dt = (DataTable)adh.ExecuteSql("select * from cominfo", "select");
|
|
|
+ DataRow[] dr = dt.Select("comtype='PLC1'");
|
|
|
+ if (dr.Length > 0)
|
|
|
+ {
|
|
|
+ PLC1.PortName = dr[0]["COM"].ToString();
|
|
|
+ PLC1.Tag = "FrontendCheck";
|
|
|
+ PLC1.BaudRate = int.Parse(dr[0]["BaudRate"].ToString());
|
|
|
+ PLC1.DataReceived += Serial_DataReceived;
|
|
|
+ PLC1.Open();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private void PLCStop_Click(object sender, EventArgs e)
|
|
|
@@ -1652,12 +1669,16 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
private void ButtonCollectPass_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+ string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
|
+ int pib_pdno = int.Parse(LabelInf.Rows[CurrentRowIndex].Cells["pib_pdno"].Value.ToString());
|
|
|
+ FrontCheckFunction("");
|
|
|
}
|
|
|
|
|
|
private void ButtonRecheckPass_Click(object sender, EventArgs e)
|
|
|
{
|
|
|
-
|
|
|
+ string pib_id = LabelInf.Rows[CurrentRowIndex].Cells["pib_id1"].Value.ToString();
|
|
|
+ int pib_pdno = int.Parse(LabelInf.Rows[CurrentRowIndex].Cells["pib_pdno"].Value.ToString());
|
|
|
+ BackendCheckFunction("", pib_id);
|
|
|
}
|
|
|
|
|
|
private void ButtonSetMidBox_Click(object sender, EventArgs e)
|