|
@@ -104,12 +104,14 @@ namespace UAS_LabelMachine
|
|
|
string[] PIBID;
|
|
|
|
|
|
DataTable Attach;
|
|
|
-
|
|
|
+ //传送贴标角度
|
|
|
string Angle = "";
|
|
|
|
|
|
string X = "";
|
|
|
|
|
|
string Y = "";
|
|
|
+ //贴标机采集的行数
|
|
|
+ int MachineCollectRowIndex = 0;
|
|
|
|
|
|
public UAS_出货标签打印(string Master)
|
|
|
{
|
|
@@ -239,7 +241,7 @@ namespace UAS_LabelMachine
|
|
|
string[] SplitData = Input.Text.Split('*');
|
|
|
if (SplitData.Length < 5)
|
|
|
{
|
|
|
- MessageBox.Show("数据格式错误,无法解析", "提示");
|
|
|
+ richTextAutoBottom1.AppendText("数据格式错误,无法解析\n");
|
|
|
if (ConnectToMachine)
|
|
|
{
|
|
|
receiveClient.Client.Send(Encoding.ASCII.GetBytes("ReadId1|,|NG|,|Y"));
|
|
@@ -279,27 +281,24 @@ namespace UAS_LabelMachine
|
|
|
//校验DateCode是否过期
|
|
|
if (!CheckDateCode(Data["DATECODE"]))
|
|
|
{
|
|
|
- string close = MessageBox.Show(this.ParentForm, "物料" + Data["PRCODE"] + "【DateCode】超出校验日期,是否继续", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
- if (close != "Yes")
|
|
|
- {
|
|
|
- Input.SelectAll();
|
|
|
- return;
|
|
|
- }
|
|
|
+ richTextAutoBottom1.AppendText("物料" + Data["PRCODE"] + "【DateCode】超出校验日期,是否继续\n");
|
|
|
+ Input.SelectAll();
|
|
|
+ receiveClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId1|,|NG|,|Y")));
|
|
|
+ return;
|
|
|
}
|
|
|
if (Data["PRCODE"] != CurrentPrCode)
|
|
|
{
|
|
|
- MessageBox.Show("当前采集【物料编号】不对应,请重新采集", "提示");
|
|
|
+ richTextAutoBottom1.AppendText("当前采集【物料编号】不对应,请重新采集\n");
|
|
|
Input.SelectAll();
|
|
|
+ receiveClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId1|,|NG|,|Y")));
|
|
|
return;
|
|
|
}
|
|
|
if (Data["BRAND"] != CurrentBrand)
|
|
|
{
|
|
|
- string close = MessageBox.Show(this.ParentForm, "当前采集【品牌】不对应,是否继续采集", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question).ToString();
|
|
|
- if (close != "Yes")
|
|
|
- {
|
|
|
- Input.SelectAll();
|
|
|
- return;
|
|
|
- }
|
|
|
+ richTextAutoBottom1.AppendText("当前采集【品牌】不对应,是否继续采集\n");
|
|
|
+ Input.SelectAll();
|
|
|
+ receiveClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId1|,|NG|,|Y")));
|
|
|
+ return;
|
|
|
}
|
|
|
int CodeCount = 0;
|
|
|
//如果单位是KPCS则需要除1000
|
|
@@ -315,10 +314,11 @@ namespace UAS_LabelMachine
|
|
|
MessageBox.Show("请检查最小包装数");
|
|
|
}
|
|
|
//如果单位是KPCS则必须是1000的整数倍
|
|
|
- if (int.Parse((Convert.ToDouble((double.Parse(Data["QTY"]) / 1000).ToString("0.000")) / Convert.ToDouble(double.Parse(CurrentZXBZ).ToString("0.000"))).ToString()) % 1 != 0)
|
|
|
+ if (decimal.Parse((Convert.ToDouble((double.Parse(Data["QTY"]) / 1000).ToString("0.000")) / Convert.ToDouble(double.Parse(CurrentZXBZ).ToString("0.000"))).ToString()) % 1 != 0)
|
|
|
{
|
|
|
- MessageBox.Show("物料" + Data["PRCODE"] + "采集数量无法按照最小包装数拆分", "提示");
|
|
|
+ richTextAutoBottom1.AppendText("物料" + Data["PRCODE"] + "采集数量无法按照最小包装数拆分\n");
|
|
|
Input.SelectAll();
|
|
|
+ receiveClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId1|,|NG|,|Y")));
|
|
|
return;
|
|
|
}
|
|
|
CodeCount = int.Parse((double.Parse(Data["QTY"]) / 1000 / double.Parse(CurrentZXBZ)).ToString());
|
|
@@ -328,7 +328,8 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
if (double.Parse(Data["QTY"]) % double.Parse(CurrentZXBZ) != 0)
|
|
|
{
|
|
|
- MessageBox.Show("采集【数量】无法按照最小包装数拆分", "提示");
|
|
|
+ richTextAutoBottom1.AppendText("采集【数量】无法按照最小包装数拆分\n");
|
|
|
+ receiveClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId1|,|NG|,|Y")));
|
|
|
Input.SelectAll();
|
|
|
return;
|
|
|
}
|
|
@@ -417,7 +418,7 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
rowsnum = dh.BatchInsert(sql.ToString(), new string[] { "PIB_ID", "PIB_CUSTBARCODE" }, PIBID, CustBarCode.ToArray());
|
|
|
}
|
|
|
- catch (Exception e)
|
|
|
+ catch (Exception)
|
|
|
{
|
|
|
if (ReSetType != " ")
|
|
|
{
|
|
@@ -434,7 +435,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
MessageBox.Show("未成功插入数据,请核对出货单当前明细", "提示");
|
|
|
}
|
|
|
-
|
|
|
//更新流水号
|
|
|
LoadGridData(new object(), new EventArgs());
|
|
|
if (LabelInf.Rows.Count > 0)
|
|
@@ -443,13 +443,14 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
if (SingleLabelAutoPrint.Checked)
|
|
|
{
|
|
|
- thread = new Thread(AutoPrintSingleLabel);
|
|
|
- stw = new SetLoadingWindow(thread, "正在打印单盘标签");
|
|
|
- BaseUtil.SetFormCenter(stw);
|
|
|
- stw.ShowDialog();
|
|
|
+ //thread = new Thread(AutoPrintSingleLabel);
|
|
|
+ //stw = new SetLoadingWindow(thread, "正在打印单盘标签");
|
|
|
+ //BaseUtil.SetFormCenter(stw);
|
|
|
+ //stw.ShowDialog();
|
|
|
receiveClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId1|,|OK|,|Y")));
|
|
|
}
|
|
|
- else {
|
|
|
+ else
|
|
|
+ {
|
|
|
receiveClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId1|,|OK|,|N")));
|
|
|
}
|
|
|
if (SumQty.Columns.Count == 0)
|
|
@@ -705,6 +706,7 @@ namespace UAS_LabelMachine
|
|
|
if (double.Parse(outqty) > double.Parse(collectnum == "" ? "0" : collectnum))
|
|
|
{
|
|
|
GridPrcode.Rows[i].Selected = true;
|
|
|
+ MachineCollectRowIndex = GridPrcode.SelectedRows[0].Index;
|
|
|
if (i - 2 >= 0)
|
|
|
GridPrcode.FirstDisplayedScrollingRowIndex = i - 2;
|
|
|
else
|
|
@@ -1831,6 +1833,7 @@ namespace UAS_LabelMachine
|
|
|
if (GridPrcode.SelectedRows.Count > 0)
|
|
|
{
|
|
|
DataGridViewSelectedRowCollection dsc = GridPrcode.SelectedRows;
|
|
|
+ MachineCollectRowIndex = GridPrcode.SelectedRows[0].Index;
|
|
|
CurrentPrCode = GridPrcode.Rows[dsc[0].Index].Cells["pd_prodcode"].Value.ToString();
|
|
|
CurrentZXBZ = GridPrcode.Rows[dsc[0].Index].Cells["pjd_zxbzs_user"].Value.ToString();
|
|
|
CurrentUnit = GridPrcode.Rows[dsc[0].Index].Cells["pr_unit"].Value.ToString();
|
|
@@ -2515,37 +2518,39 @@ namespace UAS_LabelMachine
|
|
|
bool SendLast = false;
|
|
|
for (int i = 0; i < GridPrcode.Rows.Count; i++)
|
|
|
{
|
|
|
- //获取复核的数据
|
|
|
- int checknum = int.Parse(GridPrcode.Rows[i].Cells["checknum"].Value.ToString());
|
|
|
- double outqty = double.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString());
|
|
|
- double zxbzs = double.Parse(GridPrcode.Rows[i].Cells["PJD_ZXBZS_USER"].Value.ToString());
|
|
|
- string Prcode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
|
|
|
- string pdno = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
|
|
|
- if ((pr_code == Prcode || pr_code == "") && checknum < outqty / zxbzs)
|
|
|
+ //采集哪行复核哪行
|
|
|
+ if (i == MachineCollectRowIndex)
|
|
|
{
|
|
|
- checknum = checknum + 1;
|
|
|
- GridPrcode.Rows[i].Cells["checknum"].Value = checknum;
|
|
|
- if (checknum < outqty / zxbzs)
|
|
|
- {
|
|
|
- dh.ExecuteSql("update CS$InoutPrcode set checknum=nvl(checknum,0)+1 where pd_inoutno='" + pi_inoutno.Text + "' and pd_pdno='" + pdno + "' and combined=" + combined, "update");
|
|
|
- }
|
|
|
- else if (checknum == outqty / zxbzs)
|
|
|
+ //获取复核的数据
|
|
|
+ int checknum = int.Parse(GridPrcode.Rows[i].Cells["checknum"].Value.ToString());
|
|
|
+ double outqty = double.Parse(GridPrcode.Rows[i].Cells["pd_outqty"].Value.ToString());
|
|
|
+ double zxbzs = double.Parse(GridPrcode.Rows[i].Cells["PJD_ZXBZS_USER"].Value.ToString());
|
|
|
+ string Prcode = GridPrcode.Rows[i].Cells["pd_prodcode"].Value.ToString();
|
|
|
+ string pdno = GridPrcode.Rows[i].Cells["pd_pdno"].Value.ToString();
|
|
|
+ if ((pr_code == Prcode || pr_code == "") && checknum < outqty / zxbzs)
|
|
|
{
|
|
|
- dh.ExecuteSql("update CS$InoutPrcode set checknum=nvl(checknum,0)+1 where pd_inoutno='" + pi_inoutno.Text + "' and pd_pdno='" + pdno + "' and combined=" + combined, "update");
|
|
|
- Console.WriteLine("ReadId3|,|OK|,|1");
|
|
|
- sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|1"));
|
|
|
- checknum = 0;
|
|
|
- SendLast = true;
|
|
|
- PassTenCount = 0;
|
|
|
+ checknum = checknum + 1;
|
|
|
+ GridPrcode.Rows[i].Cells["checknum"].Value = checknum;
|
|
|
+ if (checknum < outqty / zxbzs)
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update CS$InoutPrcode set checknum=nvl(checknum,0)+1 where pd_inoutno='" + pi_inoutno.Text + "' and pd_pdno='" + pdno + "' and combined=" + combined, "update");
|
|
|
+ }
|
|
|
+ else if (checknum == outqty / zxbzs)
|
|
|
+ {
|
|
|
+ dh.ExecuteSql("update CS$InoutPrcode set checknum=nvl(checknum,0)+1 where pd_inoutno='" + pi_inoutno.Text + "' and pd_pdno='" + pdno + "' and combined=" + combined, "update");
|
|
|
+ sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|1"));
|
|
|
+ checknum = 0;
|
|
|
+ SendLast = true;
|
|
|
+ PassTenCount = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
}
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
//DataGridViewSelectedRowCollection selectrow = GridPrcode.SelectedRows;
|
|
|
//达到了中盒容量之后
|
|
|
if (PassTenCount == MidboxCapacity.Value)
|
|
|
{
|
|
|
- Console.WriteLine("ReadId3|,|OK|,|1");
|
|
|
sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|1"));
|
|
|
PassTenCount = 0;
|
|
|
}
|
|
@@ -2554,7 +2559,6 @@ namespace UAS_LabelMachine
|
|
|
//如果发送了最后一盒,则不发送继续堆叠的指令
|
|
|
if (!SendLast)
|
|
|
{
|
|
|
- Console.WriteLine("ReadId3|,|OK|,|0");
|
|
|
sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|0"));
|
|
|
}
|
|
|
}
|