/// <summary> /// 得到打印信息 /// </summary> /// <param name="packge"></param> /// <returns></returns> public static MyUpacket GetPrintUpacket(busi_printwork packge) { using (var db = SugarDao.GetInstance(Getconnstring.Getmyconnstring())) { try { yamatoShopname aa = db.Queryable<busi_sendorder>().JoinTable<busi_custorder>((s1, s2) => s1.custorder_id == s2.order_id) .JoinTable<busi_custorder, base_shop>((s1, s2, s3) => s2.shop_id == s3.shop_id) .JoinTable<base_shop, base_platform>((s1, s3, s4) => s3.platform_id == s4.platform_id) .Where<busi_sendorder>(s1 => s1.order_code == packge.data_10) .Select<base_shop, base_platform, yamatoShopname>((s1, s3, s4) => new yamatoShopname() { shopname = s3.shop_name, platfromname = s4.platform_name, Shopaddress = s3.shop_address, Shopphone = s3.shop_telephone, Shopzip = s3.shop_zipcode, Companyname = "" }).FirstOrDefault(); if (null == aa) { throw new Exception("无法得到发货定订单信息"); } MyUpacket pupacket = new MyUpacket(); pupacket.Shopname = aa.shopname; pupacket.Platform = aa.platfromname; pupacket.Shopzip = aa.Shopzip; pupacket.Shopphone = aa.Shopphone; pupacket.Shopaddress = aa.Shopaddress; pupacket.Companyname = "株式会社ジャパンドレス"; //-------------------------------------------------- pupacket.data_1 = packge.data_1; pupacket.data_2 = packge.data_2; pupacket.data_3 = packge.data_3; pupacket.data_4 = packge.data_4; pupacket.data_5 = packge.data_5; pupacket.data_6 = packge.data_6; pupacket.data_7 = packge.data_7; pupacket.data_8 = packge.data_8; pupacket.data_9 = packge.data_9; pupacket.data_10 = packge.data_10; pupacket.create_DateTime = packge.create_DateTime; pupacket.create_UserID = packge.create_UserID; pupacket.edit_DateTime = packge.edit_DateTime; pupacket.p_idPoint = packge.p_idPoint; pupacket.p_Status = packge.p_Status; pupacket.p_Workid = packge.p_Workid; pupacket.p_WorkRemarks = packge.p_WorkRemarks; pupacket.p_WorkType = packge.p_WorkType; pupacket.Print_DateTime = packge.Print_DateTime; return pupacket; } catch (Exception ex) { throw ex; } } }
public MyUpacket pwork; //打印信息存储类 //通过构造函数传递进来 public PrintUpacket(MyUpacket p, string a = "Tel: 050-5803-2394", string b = "【差出人·返還先】〒: 332-0027", string c = "埼玉県川口市緑町9-35", string d = "株)ジャパンドレス", string e = "0366674879250", string f = "", string g = "") { this.pwork = p; this.ourtelephone = a; this.ourzipcode = b; this.ouraddress = c; this.ouraddress2 = g; this.ourname = d; this.ourCode = e; this.SKUS = f; }
/// <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.p_Workid)) { Queueupacket.Enqueue(item.p_Workid); PrintListUpacket.Add(item.p_Workid, item); } } } if (PrintListUpacket.Count > 0)//队列中有数据 { try { long workid = Queueupacket.Peek(); busi_printwork mypackge = PrintListUpacket[workid]; //取出队列中对象 //打印yamato MyUpacket pupacket = CommPrint.GetPrintUpacket(mypackge); if (null == pupacket) { throw new Exception("系统中不存在此店铺名或者此包裹" + mypackge.data_10); } PrintUpacket printer = new PrintUpacket(pupacket); printer.Print(true); bool isok = CommPrint.FinshPrint(p_id, mypackge); if (!isok) { Log(mypackge.data_1 + "打印失败!"); } else { //打印完成清除出队列 Queueupacket.Dequeue(); PrintListUpacket.Remove(workid); Hasprintcount++; label7.Text = Hasprintcount.ToString(); Log(mypackge.data_1 + "包裹号已打印。Upacket" + DateTime.Now.ToString()); } } catch (Exception ex) { Log(ex.ToString()); } } }
public MyUpacket pwork; //打印信息存储类 //通过构造函数传递进来 public PrintUpacket(MyUpacket p) { pwork = p; }