/// <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()); } } }
public Printzhuanyun(zhuanyunInfo pack) { packge = pack; }