/// <summary> /// 促销品吊牌补打 /// </summary> /// <param name="barcode"></param> /// <returns></returns> public string orderDetailByBarcod40mm(string barcode) { string sql = string.Format(@"select dbo.f_EBPwd(t3.tm) qrcode,t1.sphh,t2.tm tm1,t3.tm tm2,t2.cmdm,t1.zbyid,t1.lymxid,t5.yphh,t1.sl0,t4.hx from yx_v_dddjcmmx t1 INNER JOIN (select sphh,cmdm,tm from yx_t_tmb where tzid=1 and tmlx=1) t2 on t1.cmdm=t2.cmdm and t1.sphh=t2.sphh INNER JOIN (select sphh,cmdm,tm from yx_t_tmb where tzid=1 and tmlx=2) t3 on t1.cmdm=t3.cmdm and t1.sphh=t3.sphh INNER JOIN YX_T_Spdmb t5 ON t1.sphh=t5.sphh inner join yx_v_sphxggb t4 on t5.yphh=t4.yphh and t2.cmdm=t4.cmdm where t3.tm = '{0}' AND T1.DJLX=905 AND t1.djzt=1 ", barcode); List <OrderLabelDetail> list = new List <OrderLabelDetail>(); using (IDataReader reader = dal.ExecuteReader(sql)) { while (reader.Read()) { OrderLabelDetail detail = new OrderLabelDetail(); detail.Spid = reader["tm2"].ToString(); detail.Qrcode = reader["qrcode"].ToString(); detail.Sphh = reader["sphh"].ToString(); detail.Tm = reader["tm1"].ToString(); detail.Hx = reader["hx"].ToString(); detail.Sn = ""; //detail.Lsdj = reader["lsdj"].ToString(); detail.Num = int.Parse(reader["sl0"].ToString()); list.Add(detail); } } return(xmlHelper.ToString <List <OrderLabelDetail> >(list)); }
private void LoadData() { WebService.LabelPrint serv = new WebService.LabelPrint(); string rel = serv.BarCodeOrderId(txtBarCode.Text); List <OrderLabelInfo> Labels = Serializer.XmlDeSerialize <List <OrderLabelInfo> >(rel); if (Labels.Count == 0) { MessageBox.Show("找不到该条码"); return; } foreach (OrderLabelInfo lable in Labels) { if (!dictLable.ContainsKey(lable.Sphh)) { dictLable.Add(lable.Sphh, lable); } } /*条码明细*/ rel = serv.BarCodeDetail(txtBarCode.Text); OrderLabelDetail detail = Serializer.XmlDeSerialize <OrderLabelDetail>(rel); ListViewItem lvi = new ListViewItem(new string[] { detail.Spid, detail.Tm, detail.Qrcode, detail.Hx, detail.Lsdj }); DetailList.Add(detail); listView1.Items.Add(lvi); txtBarCode.Text = ""; loading.hide(); }
/// <summary> /// 绘制一张标签 /// </summary> /// <param name="topx"></param> /// <param name="topy"></param> /// <param name="grap"></param> /// <param name="detail"></param> private void Tag_Draw(int topx, int topy, Graphics grap, OrderLabelDetail detail) { OrderLabelInfo currLable = DictLabel[detail.Sphh]; //Form1.log.InfoFormat("货号:{0} 品名:{1} QRCOE:{2} Spid:{3}", // detail.Sphh, currLable.Pm, detail.Qrcode, detail.Spid); string tm = "http://tm.lilanz.com/tm.aspx?id=" + detail.Qrcode; QRCodeEncoder qrcode = new QRCodeEncoder(); qrcode.QRCodeScale = 1; qrcode.QRCodeVersion = 4; Bitmap bitQR = qrcode.Encode(tm); Image ImgCode128 = Code128Rendering.MakeBarcodeImage(detail.Spid, 1, false); Bitmap bitCode128 = new Bitmap(ImgCode128); /*ean 13*/ Ean13 _ean13 = new Ean13(detail.Tm); _ean13.Scale = 1f; /* * grap.DrawEllipse(pen, topx + 22, topy + 6, 1, 1); * grap.DrawEllipse(penWhite, topx + 22, topy - 8, 1, 1); */ grap.DrawString("合 格 证", FontTitle, brush, new Point(topx + 18, topy + 10)); DrawItem(grap, "品名:", currLable.Pm, topx + 5, topy + 15); DrawItem2(grap, "货号:", detail.Sphh, topx + 5, topy + 18); DrawItem2(grap, "号型:", detail.Hx, topx + 5, topy + 21); DrawMaterial(grap, currLable.Material, topx + 5, topy + 24);//纤维含量 currY += 3; DrawLevel(grap, currLable.Dj, detail.Sn, topx + 5, currY); //等级 currY += 3; DrawStandard(grap, currLable.Zxbz, topx + 5, currY); currY += 3; DrawSecurity(grap, currLable.Aqlb, topx + 5, currY); DrawItemPrice(grap, String.Format("¥{0}", currLable.Lsdj), topx, topy + 63); _ean13.DrawEan13Barcode(grap, new Point(topx + 5, topy + 70));//ean 13 grap.DrawImage(bitCode128, new Rectangle(topx + 4, topy + 80, 38, 6), 0, 0, bitCode128.Width, bitCode128.Height, GraphicsUnit.Pixel); grap.DrawString(detail.Spid, FontCode128, brush, new Point(topx + 8, topy + 86)); grap.DrawString("(仅供内部使用)", font5, brush, new Point(topx + 16, topy + 89)); grap.DrawImage(bitQR, new Rectangle(topx + 16, topy + 92, 13, 13), 0, 0, bitQR.Width, bitQR.Height, GraphicsUnit.Pixel); }
public string orderDetailItem(int id, string sphh) { string sql = String.Format(@"SELECT t4.gg, dbo.f_EBPwd(spid) qrcode,spid,tm,t2.sphh,t2.tm1,t2.tm2,t4.hx,t3.lsdj,dbo.f_36(t1.lsh-100000) sn,t4.hx2,t2.zbyid,t2.cmdm,t3.tml FROM yx_T_spidb t1 INNER JOIN ( select distinct t1.sphh,t2.tm tm1,t3.tm tm2,t2.cmdm,t1.zbyid from yx_v_dddjcmmx t1 INNER JOIN (select sphh,cmdm,tm from yx_t_tmb where tzid=1 and tmlx=1) t2 on t1.cmdm=t2.cmdm and t1.sphh=t2.sphh INNER JOIN (select sphh,cmdm,tm from yx_t_tmb where tzid=1 and tmlx=2) t3 on t1.cmdm=t3.cmdm and t1.sphh=t3.sphh where id={0} ) t2 ON t1.tm=t2.tm2 INNER JOIN YX_T_Spdmb t3 ON t2.sphh=t3.sphh left join yx_v_sphxggb t4 on t3.yphh=t4.yphh and t2.cmdm=t4.cmdm where lydjid={0} AND t3.sphh='{1}' ORDER BY t2.sphh,t2.cmdm,spid", id, sphh); List <OrderLabelDetail> list = new List <OrderLabelDetail>(); Dictionary <string, decimal> filler = ItemFillter(sphh); using (IDataReader reader = dal.ExecuteReader(sql)) { while (reader.Read()) { OrderLabelDetail detail = new OrderLabelDetail(); detail.Spid = reader["spid"].ToString(); detail.Qrcode = reader["qrcode"].ToString(); detail.Sphh = reader["sphh"].ToString(); detail.Tm = reader["tm1"].ToString(); detail.Filler = 0;//默认为0嗯 if (!reader.IsDBNull(0)) { if (reader["hx2"].ToString().Trim() == "") { detail.Hx = reader["hx"].ToString(); } else { detail.Hx = String.Format("上衣:{0} 裤子:{1}", reader["hx"].ToString().TrimEnd(), reader["hx2"].ToString().TrimEnd()); } detail.Gg = reader["gg"].ToString(); } string cmdm = reader["cmdm"].ToString().Remove(0, 2); if (filler.ContainsKey(cmdm)) { detail.Filler = filler[cmdm]; } detail.Sn = reader["sn"].ToString(); //detail.Lsdj = reader["lsdj"].ToString(); list.Add(detail); } } return(xmlHelper.ToString <List <OrderLabelDetail> >(list)); }
public string BarCodeDetail(String barcode) { OrderLabelDetail detail = new OrderLabelDetail(); String sql = String.Format(@"SELECT t1.spid,dbo.f_EBPwd(t1.spid) barcode,t1.tm,t1.lydjid,t2.yid,t3.cmdm,t3.sphh, dbo.f_36(t1.lsh-100000) sn FROM YX_T_Spidb t1 inner join yx_t_dddjb t2 on t1.lydjid=t2.id INNER JOIN yx_t_tmb t3 ON t1.tm=t3.tm and t3.tzid=1 and t3.tmlx=2 and t1.spid='{0}'", barcode); using (IDataReader reader = dal.ExecuteReader(sql)) { if (reader.Read()) { detail.Spid = reader[0].ToString(); detail.Qrcode = reader[1].ToString(); detail.Sphh = reader["sphh"].ToString(); detail.Cmdm = reader["cmdm"].ToString(); detail.HxKind = int.Parse(reader["yid"].ToString()); detail.Sn = reader["sn"].ToString(); } } sql = String.Format(@"select tm,t2.yphh,t2.lsdj from yx_t_tmb t1 inner join YX_T_Spdmb t2 on t1.sphh=t2.sphh where t1.tzid=1 and tmlx=1 and cmdm='{0}' and t1.sphh='{1}'", detail.Cmdm, detail.Sphh); using (IDataReader reader = dal.ExecuteReader(sql)) { if (reader.Read()) { detail.Tm = reader[0].ToString(); detail.Yphh = reader[1].ToString(); detail.Lsdj = reader[2].ToString(); } } sql = String.Format("SELECT hx,hx2,gg from yx_v_sphxggb where yphh='{0}' and cmdm='{1}'", detail.Yphh, detail.Cmdm); using (IDataReader reader = dal.ExecuteReader(sql)) { if (reader.Read()) { detail.Hx = reader[0].ToString(); if (reader[1].ToString().Trim() != "") { detail.Hx = String.Format("上衣:{0} 裤子:{1}", reader[0].ToString().Trim(), reader[1].ToString().Trim()); } detail.Gg = reader[2].ToString(); } } Dictionary <string, decimal> filler = ItemFillter(detail.Sphh); string cmdm = detail.Cmdm.ToString().Remove(0, 2); if (filler.ContainsKey(cmdm)) { detail.Filler = filler[cmdm]; } return(xmlHelper.ToString <OrderLabelDetail>(detail)); }
/// <summary> /// 绘制一张标签 /// </summary> /// <param name="topx"></param> /// <param name="topy"></param> /// <param name="grap"></param> /// <param name="detail"></param> private void Tag_Draw(int topx, int topy, Graphics grap, OrderLabelDetail detail) { OrderLabelInfo currLable = DictLabel[detail.Sphh]; CurrentTemp = currLable.Template; string tm = "http://tm.lilanz.com/tm.aspx?id=" + detail.Qrcode; QRCodeEncoder qrcode = new QRCodeEncoder(); qrcode.QRCodeScale = 1; qrcode.QRCodeVersion = 4; Bitmap bitQR = qrcode.Encode(tm); Image ImgCode128 = Code128Rendering.MakeBarcodeImage(detail.Spid, 1, false); Bitmap bitCode128 = new Bitmap(ImgCode128); /*ean 13*/ Ean13 _ean13 = new Ean13(detail.Tm); _ean13.Scale = 1f; /* * grap.DrawEllipse(pen, topx + 22, topy + 6, 1, 1); * grap.DrawEllipse(penWhite, topx + 22, topy - 8, 1, 1); */ //grap.DrawRectangle(pen, topx, topy, LabelWidth, LabelHeigth); grap.DrawString("合 格 证", FontTitle, brush, new Point(topx + (LabelWidth - 8) / 2, topy + 10)); DrawItem(grap, "品名:", currLable.Pm, topx + 5, topy + 15); DrawItem2(grap, "货号:", detail.Sphh, topx + 5, topy + 18); currY = topy + 21; if (detail.Gg == null) { detail.Gg = ""; } if (detail.Hx == null) { detail.Hx = ""; } if (detail.Hx.TrimEnd().Length > 0 || detail.Gg.TrimEnd().Length > 0) { if (detail.Hx.TrimEnd().Length > 0) { DrawItem2(grap, "号型:", detail.Hx, topx + 5, currY); } else { DrawItem2(grap, "规格:", detail.Gg, topx + 5, currY); } currY = currY + 3; } /* * 40mm促销品 */ if (LabelWidth == 40) { DrawItem(grap, "颜色:", currLable.Iname.Split('-')[1], topx + 5, currY); currY = currY + 3; } if (currLable.Template.TrimEnd().ToUpper() != "K") { DrawMaterial(grap, "纤维含量:", currLable.Material, topx + 5, currY);//纤维含量 } else { DrawMaterial(grap, "材质:", currLable.Material, topx + 5, currY);//纤维含量 currY += 3; DrawItem(grap, "生产日期:", currLable.ProDate.ToString("yyyy-MM-dd"), topx + 5, currY); /* * J版需要打生产日期、商标 */ } currY += 3; DrawLevel(grap, currLable.Dj, detail.Sn, topx + 5, currY); //等级 currY += 3; DrawStandard(grap, currLable.Zxbz, topx + 5, currY); currY += 3; DrawSecurity(grap, currLable.Aqlb, topx + 5, currY); currY = topy + (LabelHeigth - 43); DrawItemPrice(grap, String.Format("¥{0}", currLable.Lsdj), topx, currY); _ean13.DrawEan13Barcode(grap, new Point(topx + (LabelWidth - 36) / 2, currY));//ean 13 currY += 10; grap.DrawImage(bitCode128, new Rectangle(topx + 3, currY, (LabelWidth - 6), 6), 0, 0, bitCode128.Width, bitCode128.Height, GraphicsUnit.Pixel); //左右各留3mm currY += 6; float FontWidth = grap.MeasureString(detail.Spid, FontCode128).Width; grap.DrawString(detail.Spid, FontCode128, brush, new Point(topx + (LabelWidth - (int)FontWidth) / 2, currY)); currY += 3; grap.DrawString("(仅供内部使用)", font5, brush, new Point(topx + (LabelWidth - 12) / 2, currY)); currY += 3; grap.DrawImage(bitQR, new Rectangle(topx + (LabelWidth - 13) / 2, currY, 13, 13), 0, 0, bitQR.Width, bitQR.Height, GraphicsUnit.Pixel); }