/// <summary> /// yamato打印, /// </summary> /// <param name="Sender"></param> /// <param name="e"></param> private void Timeryamato_Tick(object Sender, EventArgs e) { int worktype = 50; int p_id = GetprintID(); //得到打印插件ID //1.得到需要打印的包裹号 List <busi_printwork> list = CommPrint.GetprintInfo(p_id, worktype); //worktype =50 if (list.Count > 0) //有数据要打印 { foreach (var item in list) { if (!Queueyamato.Contains(item.p_Workid)) //data_10存的是包裹号 { Queueyamato.Enqueue(item.p_Workid); PrintListYamato.Add(item.p_Workid, item); } } } if (PrintListYamato.Count > 0)//字典中有数据 { try { long workid = Queueyamato.Peek(); busi_printwork mypackge = PrintListYamato[workid]; //取出队列中对象 //打印yamato Myamato pyamato = CommPrint.GetPrintyamato(mypackge); if (null == pyamato) { throw new Exception("系统中不存在此店铺名或者此包裹" + mypackge.data_10); } PrintYamato printer = new PrintYamato(pyamato); printer.Print(true); bool isok = CommPrint.FinshPrint(p_id, mypackge); //设置已打印的状态 if (!isok) { Log(mypackge.data_1 + "打印失败!"); } else { //打印完成清除出队列 Queueyamato.Dequeue(); PrintListYamato.Remove(workid); Hasprintcount++; label7.Text = Hasprintcount.ToString(); Log(mypackge.data_1 + "包裹号已打印。Yamato" + DateTime.Now.ToString()); } } catch (Exception ex) { Log(ex.ToString()); } } }
/// <summary> /// 包裹打印 /// </summary> /// <param name="Sender"></param> /// <param name="e"></param> private void Timerpackge_Tick(object Sender, EventArgs e) { int worktype = 30; int p_id = GetprintID(); //得到打印插件ID //1.得到需要打印的包裹号 List <busi_printwork> list = CommPrint.GetprintInfo(p_id, worktype); if (list.Count > 0)//有数据要打印 { foreach (var item in list) { if (!Queuepackge.Contains(item.p_Workid)) { Queuepackge.Enqueue(item.p_Workid); PrintListpackge.Add(item.p_Workid, item); } } } if (PrintListpackge.Count > 0)//队列中有数据 { try { long workid = Queuepackge.Peek(); busi_printwork mypackge = PrintListpackge[workid]; //取出队列中对象 //打印包裹 packgeInfoViewModel mymodel = CommPrint.GetPrintpackge(mypackge); if (null == mymodel) { throw new Exception("系统中不存在此店铺名或者此包裹" + mypackge.data_1); } PrintPackge printer = new PrintPackge(mymodel); printer.Print(true); bool isok = CommPrint.FinshPrint(p_id, mypackge); if (!isok) { Log(mypackge.data_1 + "打印失败!"); } else { //打印完成清除出队列 Queuepackge.Dequeue(); PrintListpackge.Remove(workid); Hasprintcount++; label7.Text = Hasprintcount.ToString(); Log(mypackge.data_1 + "包裹号已打印。" + DateTime.Now.ToString()); } } catch (Exception ex) { Log(ex.ToString()); } } }
/// <summary> /// 转运单打印 /// </summary> /// <param name="Sender"></param> /// <param name="e"></param> private void Timerzhuanyun_Tick(object Sender, EventArgs e) { int worktype = 40; int p_id = GetprintID(); //得到打印插件ID //1.得到需要打印的包裹号 List <busi_printwork> list = CommPrint.GetprintInfo(p_id, worktype); if (list.Count > 0)//有数据要打印 { foreach (var item in list) { if (!Queuezhuanyun.Contains(item.p_Workid)) { Queuezhuanyun.Enqueue(item.p_Workid); PrintListzhuanyun.Add(item.p_Workid, item); } } } if (PrintListzhuanyun.Count > 0)//队列中有数据 { try { long workid = Queuezhuanyun.Peek(); busi_printwork mypackge = PrintListzhuanyun[workid]; //取出队列中对象 zhuanyunInfo zhuanyun = new zhuanyunInfo(); zhuanyun.workid = mypackge.p_Workid.ObjToInt(); zhuanyun.zhuanyuncode = mypackge.data_1; //打印转运单 Printzhuanyun printer = new Printzhuanyun(zhuanyun); printer.Print(true); bool isok = CommPrint.FinshPrint(p_id, mypackge); if (!isok) { Log(mypackge.data_1 + "打印失败!"); } else { //打印完成清除出队列 Queuezhuanyun.Dequeue(); PrintListzhuanyun.Remove(workid); Hasprintcount++; label7.Text = Hasprintcount.ToString(); Log(mypackge.data_1 + "转运单已打印。" + DateTime.Now.ToString()); } } catch (Exception ex) { Log(ex.ToString()); } } }
/// <summary> /// Upacket打印 /// </summary> /// <param name="Sender"></param> /// <param name="e"></param> private void TimerUpacket_Tick(object Sender, EventArgs e) { int worktype = 70; int p_id = GetprintID(); //得到打印插件ID //1.得到需要打印的包裹号 List <busi_printwork> list = CommPrint.GetprintInfo(p_id, worktype); if (list.Count > 0)//有数据要打印 { foreach (var item in list) { if (!Queueupacket.Contains(item)) { Queueupacket.Enqueue(item); } } } if (Queueupacket.Count > 0)//队列中有数据 { try { busi_printwork mypackge = Queueupacket.Peek(); //取出队列中对象 //打印yamato MyUpacket pupacket = CommPrint.GetPrintUpacket(mypackge); if (null == pupacket) { throw new Exception("系统中不存在此店铺名或者此包裹" + mypackge.data_10); } PrintUpacket printer = new PrintUpacket(pupacket); printer.Print(true); //打印完成清除出队列 Queueupacket.Dequeue(); bool isok = CommPrint.FinshPrint(p_id, mypackge); if (!isok) { Log(mypackge.data_1 + "打印失败!"); } else { Hasprintcount++; label7.Text = Hasprintcount.ToString(); Log(mypackge.data_1 + "包裹号已打印。Upacket" + DateTime.Now.ToString()); } } catch (Exception ex) { Log(ex.ToString()); } } }