|
@@ -406,7 +406,6 @@ namespace UAS_LabelMachine
|
|
|
CustBarCode.Add("");
|
|
|
}
|
|
|
}
|
|
|
- Console.WriteLine("1" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
|
|
|
sql.Clear();
|
|
|
sql.Append("insert into prodiobarcode(PIB_ID,PIB_PRODCODE,PIB_INDATE,PIB_INOUTNO,PIB_PIID,PIB_PDNO, PIB_PDID,PIB_PICLASS,");
|
|
|
sql.Append("PIB_BARCODE,PIB_CUSTBARCODE,PIB_QTY,pib_brand,pib_datecode,pib_lotno,PIB_OUTBOXCODE2,pib_inman,PIB_IFPRINT,PIB_ORDERCODE,PIB_CUSTPO,pib_remark,pib_midcapatity,pib_custcode) ");
|
|
@@ -435,7 +434,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
MessageBox.Show("未成功插入数据,请核对出货单当前明细", "提示");
|
|
|
}
|
|
|
- Console.WriteLine("2" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
|
|
|
|
|
|
//更新流水号
|
|
|
LoadGridData(new object(), new EventArgs());
|
|
@@ -475,7 +473,6 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
dh.UpdateByCondition("prodinout", "pi_user_packingstatus='Packed'", "pi_inoutno='" + pi_inoutno.Text + "'");
|
|
|
}
|
|
|
- Console.WriteLine("7" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
|
|
|
|
|
|
receiveClient.Client.Send(Encoding.ASCII.GetBytes(GetSendCode("ReadId1|,|OK|,|Y")));
|
|
|
//采集达到了数量进行换行
|
|
@@ -531,7 +528,7 @@ namespace UAS_LabelMachine
|
|
|
pibid += PIBID[i];
|
|
|
}
|
|
|
if (!SingleLabelCombox.SelectedValue.ToString().Contains("System.Data.DataRowView"))
|
|
|
- SingleReport.Load(@"C:\打印标签\立景创新LP.frx");
|
|
|
+ SingleReport.Load(SingleLabelCombox.SelectedValue.ToString());
|
|
|
for (int j = 0; j < SingleReport.Parameters.Count; j++)
|
|
|
{
|
|
|
SingleReport.SetParameterValue(SingleReport.Parameters[j].Name, "");
|
|
@@ -543,7 +540,6 @@ namespace UAS_LabelMachine
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- Console.WriteLine("3" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
|
|
|
|
|
|
StringBuilder sql = new StringBuilder();
|
|
|
sql.Clear();
|
|
@@ -558,10 +554,9 @@ namespace UAS_LabelMachine
|
|
|
sql.Append("to_char(ADD_MONTHS(to_date(week_to_date(pib_datecode),'yyyy-mm-dd'),36),'yyyy-iw')有效期三年_年周,");
|
|
|
sql.Append("wh_ppmc_user 中文品牌,em_code 装箱员编号,em_name 装箱员名称 from prodiobarcode left join prodinout on pib_piid=pi_id left join product on pib_prodcode=pr_code left join ProdIODetail on pd_id=PIB_PDID ");
|
|
|
sql.Append("left join PRODJOINVENDDETAIL on pjd_brand=pib_brand and pjd_prodcode=pib_prodcode left join customer on pi_cardcode=cu_code left join productcustomer on pc_custid=cu_id and pc_prodcode=pd_prodcode ");
|
|
|
- sql.Append("and pc_custprodcode=pd_custprodcode left join WareHouse on wh_code=pd_whcode left join employee on em_code=pib_inman where pib_id='" + pibid + "' order by pib_custbarcode)");
|
|
|
+ sql.Append("and pc_custprodcode=pd_custprodcode left join WareHouse on wh_code=pd_whcode left join employee on em_code=pib_inman where pib_id='" + pibid + "' order by pib_custbarcode)prodiosingleinfo_view");
|
|
|
//DataTable dt = (DataTable)dh.ExecuteSql("select * from PRODIOSINGLEINFO_VIEW where 主键ID in (" + pibid + ")", "select");
|
|
|
DataTable dt = (DataTable)dh.ExecuteSql(sql.ToString(), "select");
|
|
|
- Console.WriteLine("4" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
|
|
|
|
|
|
SingleReport.RegisterData(dt, "prodiosingleinfo_view");
|
|
|
SingleReport.GetDataSource("prodiosingleinfo_view").Enabled = true;
|
|
@@ -570,9 +565,7 @@ namespace UAS_LabelMachine
|
|
|
|
|
|
try
|
|
|
{
|
|
|
- Console.WriteLine("5" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
|
|
|
SingleReport.Print();
|
|
|
- Console.WriteLine("6" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss fff"));
|
|
|
}
|
|
|
catch (Exception e)
|
|
|
{
|
|
@@ -671,6 +664,7 @@ namespace UAS_LabelMachine
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
+ PassTenCount = 1;
|
|
|
if (pi_cardcode.Text != "ZGCC")
|
|
|
{
|
|
|
CustomerLabel.Enabled = false;
|
|
@@ -2447,40 +2441,40 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
while (IsOnline(receiveClient))
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- //创建接收数据的字节流
|
|
|
- byte[] getData = new byte[1024];
|
|
|
- //从网络流中读取数据
|
|
|
- ns.Read(getData, 0, getData.Length);
|
|
|
- //将字节数组转换成文本形式
|
|
|
- string getMsg = Encoding.Default.GetString(getData);
|
|
|
- if (getMsg.Contains("ReadId"))
|
|
|
- {
|
|
|
- string msgStr = getMsg.Trim('\0').Replace("ReadId1|,|", "");
|
|
|
- msgStr = Regex.Match(msgStr, @"[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+").Value;
|
|
|
- //设置索引和内容
|
|
|
- // msgStr = msgStr.Split(ps_split.ToCharArray()[0])[dataindex];
|
|
|
- Input.Text = msgStr;
|
|
|
- Input_KeyDown(Input, new KeyEventArgs(Keys.Enter));
|
|
|
- }
|
|
|
- }
|
|
|
- catch (ThreadAbortException)
|
|
|
- {
|
|
|
- //捕捉到线程被终止异常则表示是人为的断开TCP连接
|
|
|
- //不弹出错误提示
|
|
|
- break;
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- //接受消息发生异常
|
|
|
- MessageBox.Show(e.Message);
|
|
|
- receiveClient.Client.Send(Encoding.ASCII.GetBytes("ReadId1|,|NG|,|Y"));
|
|
|
- //并释放相关资源
|
|
|
- //if (ns != null)
|
|
|
- // ns.Dispose();
|
|
|
- //break;
|
|
|
- }
|
|
|
+ //try
|
|
|
+ //{
|
|
|
+ //创建接收数据的字节流
|
|
|
+ byte[] getData = new byte[1024];
|
|
|
+ //从网络流中读取数据
|
|
|
+ ns.Read(getData, 0, getData.Length);
|
|
|
+ //将字节数组转换成文本形式
|
|
|
+ string getMsg = Encoding.Default.GetString(getData);
|
|
|
+ if (getMsg.Contains("ReadId"))
|
|
|
+ {
|
|
|
+ string msgStr = getMsg.Trim('\0').Replace("ReadId1|,|", "");
|
|
|
+ msgStr = Regex.Match(msgStr, @"[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+").Value;
|
|
|
+ //设置索引和内容
|
|
|
+ // msgStr = msgStr.Split(ps_split.ToCharArray()[0])[dataindex];
|
|
|
+ Input.Text = msgStr;
|
|
|
+ Input_KeyDown(Input, new KeyEventArgs(Keys.Enter));
|
|
|
+ }
|
|
|
+ //}
|
|
|
+ //catch (ThreadAbortException)
|
|
|
+ //{
|
|
|
+ // //捕捉到线程被终止异常则表示是人为的断开TCP连接
|
|
|
+ // //不弹出错误提示
|
|
|
+ // break;
|
|
|
+ //}
|
|
|
+ //catch (Exception e)
|
|
|
+ //{
|
|
|
+ // //接受消息发生异常
|
|
|
+ // MessageBox.Show(e.Message);
|
|
|
+ // receiveClient.Client.Send(Encoding.ASCII.GetBytes("ReadId1|,|NG|,|Y"));
|
|
|
+ // //并释放相关资源
|
|
|
+ // //if (ns != null)
|
|
|
+ // // ns.Dispose();
|
|
|
+ // //break;
|
|
|
+ //}
|
|
|
}
|
|
|
MessageBox.Show("网络中断");
|
|
|
}
|
|
@@ -2489,85 +2483,94 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
while (IsOnline(sendClient))
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- //创建接收数据的字节流
|
|
|
- byte[] getData = new byte[1024];
|
|
|
- //从网络流中读取数据 z
|
|
|
- ns1.Read(getData, 0, getData.Length);
|
|
|
- //将字节数组转换成文本形式
|
|
|
- string getMsg = Encoding.Default.GetString(getData);
|
|
|
- if (getMsg.Contains("ReadId3"))
|
|
|
+ //try
|
|
|
+ //{
|
|
|
+ //创建接收数据的字节流
|
|
|
+ byte[] getData = new byte[1024];
|
|
|
+ //从网络流中读取数据 z
|
|
|
+ ns1.Read(getData, 0, getData.Length);
|
|
|
+ //将字节数组转换成文本形式
|
|
|
+ string getMsg = Encoding.Default.GetString(getData);
|
|
|
+ if (getMsg.Contains("ReadId3"))
|
|
|
+ {
|
|
|
+ string msgStr = getMsg.Trim('\0').Replace("ReadId3|,|", "");
|
|
|
+ string temp = Regex.Match(msgStr, @"[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+\*[A-Za-z0-9]+").Value;
|
|
|
+ string pr_code = "";
|
|
|
+ //如果不存在原厂标签的话
|
|
|
+ if (temp != "")
|
|
|
{
|
|
|
- string msgStr = getMsg.Trim('\0').Replace("ReadId3|,|", "");
|
|
|
- msgStr = msgStr.Split(ps_split.ToCharArray()[0])[dataindex];
|
|
|
- string pr_code = msgStr.Split('*')[0];
|
|
|
- //是否发送当前行装最后一盘,如发送则不进行装最后的数量
|
|
|
- bool SendLast = false;
|
|
|
- for (int i = GridPrcode.Rows.Count - 1; i >= 0; i--)
|
|
|
+ pr_code = temp.Split('*')[0];
|
|
|
+ }
|
|
|
+ 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)
|
|
|
{
|
|
|
- //获取复核的数据
|
|
|
- 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 && checknum < outqty / zxbzs)
|
|
|
+ checknum = checknum + 1;
|
|
|
+ GridPrcode.Rows[i].Cells["checknum"].Value = checknum;
|
|
|
+ if (checknum < outqty / zxbzs)
|
|
|
{
|
|
|
- checknum = checknum + 1;
|
|
|
- GridPrcode.Rows[i].Cells["checknum"].Value = checknum;
|
|
|
- if (checknum < outqty / zxbzs)
|
|
|
- {
|
|
|
- dh.UpdateByCondition("CS$InoutPrcode", "checknum=nvl(checknum,0)+1", "pd_inoutno='" + pi_inoutno.Text + "' and pd_pdno='" + pdno + "' and combined=" + combined);
|
|
|
- }
|
|
|
- else if (checknum == outqty / zxbzs)
|
|
|
- {
|
|
|
- dh.UpdateByCondition("CS$InoutPrcode", "checknum=nvl(checknum,0)+1", "pd_inoutno='" + pi_inoutno.Text + "' and pd_pdno='" + pdno + "' and combined=" + combined);
|
|
|
- sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|1"));
|
|
|
- checknum = 0;
|
|
|
- SendLast = true;
|
|
|
- PassTenCount = 0;
|
|
|
- }
|
|
|
+ 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");
|
|
|
}
|
|
|
- }
|
|
|
- //DataGridViewSelectedRowCollection selectrow = GridPrcode.SelectedRows;
|
|
|
- //达到了中盒容量之后
|
|
|
- if (PassTenCount == MidboxCapacity.Value)
|
|
|
- {
|
|
|
- sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|4"));
|
|
|
- PassTenCount = 0;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- //如果发送了最后一盒,则不发送继续堆叠的指令
|
|
|
- if (!SendLast)
|
|
|
+ else if (checknum == outqty / zxbzs)
|
|
|
{
|
|
|
- sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|0"));
|
|
|
+ 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;
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
- PassTenCount = PassTenCount + 1;
|
|
|
}
|
|
|
- //设置索引和内容
|
|
|
- //msgStr = msgStr.Split(ps_split.ToCharArray()[0])[dataindex];
|
|
|
- //Input.Text = msgStr;
|
|
|
- //Input_KeyDown(Input, new KeyEventArgs(Keys.Enter));
|
|
|
- }
|
|
|
- catch (ThreadAbortException)
|
|
|
- {
|
|
|
- //捕捉到线程被终止异常则表示是人为的断开TCP连接
|
|
|
- //不弹出错误提示
|
|
|
- break;
|
|
|
- }
|
|
|
- catch (Exception e)
|
|
|
- {
|
|
|
- //接受消息发生异常
|
|
|
- MessageBox.Show(e.Message);
|
|
|
- sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId1|,|NG|,|Y"));
|
|
|
- //并释放相关资源
|
|
|
- //if (ns != null)
|
|
|
- // ns.Dispose();
|
|
|
- //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;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //如果发送了最后一盒,则不发送继续堆叠的指令
|
|
|
+ if (!SendLast)
|
|
|
+ {
|
|
|
+ Console.WriteLine("ReadId3|,|OK|,|0");
|
|
|
+ sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId3|,|OK|,|0"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ CurrentBoxNum.Value = PassTenCount;
|
|
|
+ PassTenCount = PassTenCount + 1;
|
|
|
+ }
|
|
|
+ //设置索引和内容
|
|
|
+ //msgStr = msgStr.Split(ps_split.ToCharArray()[0])[dataindex];
|
|
|
+ //Input.Text = msgStr;
|
|
|
+ //Input_KeyDown(Input, new KeyEventArgs(Keys.Enter));
|
|
|
+ //}
|
|
|
+ //catch (ThreadAbortException)
|
|
|
+ //{
|
|
|
+ // //捕捉到线程被终止异常则表示是人为的断开TCP连接
|
|
|
+ // //不弹出错误提示
|
|
|
+ // break;
|
|
|
+ //}
|
|
|
+ //catch (Exception e)
|
|
|
+ //{
|
|
|
+ // //接受消息发生异常
|
|
|
+ // MessageBox.Show(e.Message+e.StackTrace);
|
|
|
+ // sendClient.Client.Send(Encoding.ASCII.GetBytes("ReadId1|,|NG|,|Y"));
|
|
|
+ // //并释放相关资源
|
|
|
+ // //if (ns != null)
|
|
|
+ // // ns.Dispose();
|
|
|
+ // //break;
|
|
|
+ //}
|
|
|
}
|
|
|
MessageBox.Show("网络中断");
|
|
|
}
|
|
@@ -2597,5 +2600,18 @@ namespace UAS_LabelMachine
|
|
|
{
|
|
|
return !((c.Client.Poll(1000, SelectMode.SelectRead) && (c.Client.Available == 0)) || !c.Client.Connected);
|
|
|
}
|
|
|
+
|
|
|
+ private void CurrentBoxNum_ValueChanged(object sender, EventArgs e)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void CurrentBoxNum_KeyDown(object sender, KeyEventArgs e)
|
|
|
+ {
|
|
|
+ if (e.KeyCode == Keys.Enter)
|
|
|
+ {
|
|
|
+ PassTenCount = int.Parse(CurrentBoxNum.Value.ToString()) + 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
}
|