Esempio n. 1
0
        private void PrintCertificate(ERP.Model.FrameProcessCertificateInfo info, string checker)
        {
            var orderLabelInfo = new OrderLabelInfo
            {
                OrderNo        = info.OrderNo,
                FrameGoodsName = info.FrameGoodsName,
                GlassGoodsName = info.GlassGoodsName,
                RightEyeInfo   = info.RightEyeInfo,
                LeftEyeInfo    = info.LeftEyeInfo
            };

            var logoName = @"kede";

            if (AppSetting.JingTuoSaleFilialeID.Equals(info.SaleFilialeID))
            {
                logoName = @"han";
            }

            //打印镜片
            _printImage = DrawCertificateLabel.DrawToOpticImage(AppSetting.Label.With, AppSetting.Label.Height, AppSetting.Label.DPI, info.Optician, info.OperationTime, orderLabelInfo, checker, logoName);
            var docPrint = new PrintDocument
            {
                PrinterSettings = { PrinterName = _printer }
            };

            docPrint.PrintPage += Document_PrintPage;
            docPrint.Print();

            //记录工作日志
            FrameProcessManager.AddCheckGlassOperation(_personnelId, lb_RealName.Text, info.OrderId, tb_ProcessNo.Text.Trim());
        }
Esempio n. 2
0
        private static Bitmap DrawOrderLabel(OrderLabelInfo orderLabelInfo, float dpi, float bs)
        {
            var fontEN = new Font("Arial", 6f * bs);
            //var fontCN = new Font("微软雅黑", 6f * bs);
            var      widthPX  = DrawTools.Millimeter2Pix(38, dpi);
            var      heightPX = DrawTools.Millimeter2Pix(20, dpi);
            var      bitmap   = new Bitmap(widthPX, heightPX, PixelFormat.Format32bppPArgb);
            Graphics graphics = Graphics.FromImage(bitmap);

            bitmap.SetResolution(dpi, dpi);
            graphics.Clear(Color.White);

            //设定Y坐标
            var y = 3;
            var x = DrawTools.Millimeter2Pix(3, dpi);

            //开始绘画
            DrawString(graphics, orderLabelInfo.OrderNo, fontEN, Color.Black, x, y);
            y += fontEN.Height;
            DrawString(graphics, orderLabelInfo.FrameGoodsName, fontEN, Color.Black, x, y);
            y += fontEN.Height;
            DrawString(graphics, orderLabelInfo.GlassGoodsName, fontEN, Color.Black, x, y);
            y += fontEN.Height;
            DrawString(graphics, orderLabelInfo.RightEyeInfo, fontEN, Color.Black, x, y);
            y += fontEN.Height;
            DrawString(graphics, orderLabelInfo.LeftEyeInfo, fontEN, Color.Black, x, y);

            //做旋转
            bitmap.RotateFlip(RotateFlipType.Rotate180FlipY);
            bitmap.RotateFlip(RotateFlipType.Rotate180FlipX);
            graphics.Save();
            graphics.Dispose();
            return(bitmap);
        }
Esempio n. 3
0
        public string ItemInfo(int id)
        {
            try
            {
                List <OrderLabelInfo> list = new List <OrderLabelInfo>();
                string sql = String.Format(@"select T2.sphh,a.bz as dj,a.id as zbid,a.mc as pm,b.mc as zxbz ,T3.mc,t2.lymxid,t4.lsdj,t5.xh,t4.spmc
from Yf_T_bjdbjzb a
INNER JOIN Yf_T_bjdbjzb b ON  a.ssid=b.id 
inner join yf_T_bjdlb T ON a.id=T.tplx
INNER JOIN YX_T_dddjmx T2 ON T.id=t2.lymxid
INNER JOIN Yf_T_bjdbjzb T3 on T3.lx=905 and T.sylx=T3.id 
INNER JOIN YX_T_Spdmb t4 on t2.sphh=t4.sphh
inner join yf_v_rinsingtemplate t5 on t5.id=T.lydjid
where a.lx=903 and T2.id={0}", id);
                using (IDataReader reader = dal.ExecuteReader(sql))
                {
                    while (reader.Read())
                    {
                        OrderLabelInfo item = new OrderLabelInfo();
                        item.Sphh     = reader["sphh"].ToString();
                        item.Dj       = reader["dj"].ToString(); //等级
                        item.Pm       = reader["pm"].ToString();
                        item.Zxbz     = reader["zxbz"].ToString();
                        item.Aqlb     = reader["mc"].ToString();
                        item.Mxid     = reader["lymxid"].ToString();
                        item.Lsdj     = decimal.Parse(reader["lsdj"].ToString());//零售单价
                        item.Template = reader["xh"].ToString();
                        item.Iname    = reader["spmc"].ToString();
                        item.ProDate  = GetProductionDate(item.Sphh);

                        list.Add(item);
                    }
                }
                foreach (OrderLabelInfo info in list)
                {
                    sql = string.Format("select pdjg,sz from yf_T_bjdmxb where mxid={0} AND bzzid<=3 and bzzid>=0 ", info.Mxid);
                    List <MaterialInfo> mlist = new List <MaterialInfo>();
                    using (IDataReader reader = dal.ExecuteReader(sql))
                    {
                        while (reader.Read())
                        {
                            MaterialInfo m = new MaterialInfo();
                            m.Title = reader["pdjg"].ToString();
                            m.Value = reader["sz"].ToString();
                            mlist.Add(m);
                        }
                    }
                    info.Material = mlist;
                }

                return(xmlHelper.ToString <List <OrderLabelInfo> >(list));
            }
            catch (Exception ex)
            {
                return(ex.ToString());
            }
        }
Esempio n. 4
0
        /// <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);
        }
Esempio n. 5
0
        /// <summary>
        /// 打印镜片标签图片
        /// </summary>
        /// <param name="widthMM"></param>
        /// <param name="heightMM"></param>
        /// <param name="dpi"></param>
        /// <param name="optician">配镜师</param>
        /// <param name="operationTime"></param>
        /// <param name="orderLabelInfo"></param>
        /// <param name="checker">检验师</param>
        /// <param name="logoName"></param>
        /// <returns></returns>
        public static Image DrawToOpticImage(int widthMM, int heightMM, float dpi, string optician, DateTime operationTime, OrderLabelInfo orderLabelInfo, string checker, string logoName)
        {
            float    bs        = dpi / DrawTools.CURRENT_DPI;
            var      widthPX   = DrawTools.Millimeter2Pix(widthMM, dpi);
            var      heightPX  = DrawTools.Millimeter2Pix(heightMM, dpi);
            var      allBitmap = new Bitmap(widthPX, heightPX, PixelFormat.Format32bppPArgb);
            Graphics graphics  = Graphics.FromImage(allBitmap);

            allBitmap.SetResolution(dpi, dpi);
            graphics.Clear(Color.White);
            var       y = 1;
            const int X = 1;

            // 间隔空隙
            y += DrawTools.Millimeter2Pix(2, dpi);
            var logImg = Image.FromFile(Framework.Common.ServerInfo.SystemPath + string.Format(@"\Logo\{0}.jpg", logoName));
            var logbp  = GetThumbnail(logImg, DrawTools.Millimeter2Pix(10, dpi), DrawTools.Millimeter2Pix(20, dpi));

            DrawImage(graphics, logbp, (widthPX - logbp.Width) / 2, y);

            // 间隔空隙
            y += logbp.Height + DrawTools.Millimeter2Pix(1, dpi);

            //绘画订单信息标签
            var orderLabel = DrawOpticOrderLabel(widthMM, heightMM - 14, optician, operationTime, orderLabelInfo, checker, dpi, bs);

            DrawImage(graphics, orderLabel, X, y);

            //下一张间隔
            //y += opticianLabel.Height-14;
            //y += DrawTools.Millimeter2Pix(14, dpi);

            //绘画配镜师标签
            //var opticianLabel = DrawOpticOperationLabel(optician,operationTime, dpi, bs);
            //DrawImage(graphics, opticianLabel, X, y);



            ////下一张间隔
            //y += orderLabel.Height;
            //y += DrawTools.Millimeter2Pix(5, dpi);

            //绘画检验师
            //var checkLabel = DrawChecker(checker, orderLabelInfo.OrderNo, dpi, bs);
            //DrawImage(graphics, checkLabel, X, y);

            //下一张间隔
            //y += checkLabel.Height;
            //y += DrawTools.Millimeter2Pix(5, dpi);

            //同样再绘画检验师
            //DrawImage(graphics, checkLabel, X, y);


            graphics.Save();
            graphics.Dispose();
            return(allBitmap);
        }
Esempio n. 6
0
        //private static Bitmap DrawOpticOperationLabel(string optician, DateTime operationTime, float dpi, float bs)
        //{
        //    var fontCN7 = new Font("Arial", 7f * bs);
        //    var fontEN6 = new Font("Arial", 6f * bs);
        //    var widthPX = DrawTools.Millimeter2Pix(38, dpi);
        //    var heightPX = DrawTools.Millimeter2Pix(13, dpi);
        //    var bitmap = new Bitmap(widthPX, heightPX, PixelFormat.Format32bppPArgb);
        //    Graphics graphics = Graphics.FromImage(bitmap);
        //    bitmap.SetResolution(dpi, dpi);
        //    graphics.Clear(Color.White);

        //    //设定Y坐标
        //    var y = 5;
        //    var x = DrawTools.Millimeter2Pix(0, dpi);


        //    graphics.Save();
        //    graphics.Dispose();
        //    return bitmap;
        //}

        private static Bitmap DrawOpticOrderLabel(int widthMM, int heightMM, string optician, DateTime operationTime, OrderLabelInfo orderLabelInfo, string checker, float dpi, float bs)
        {
            var      fontNB   = new Font("Arial", 6f * bs);
            var      fontCN   = new Font("Arial", 7f * bs);
            var      widthPX  = DrawTools.Millimeter2Pix(widthMM, dpi);
            var      heightPX = DrawTools.Millimeter2Pix(heightMM, dpi);
            var      bitmap   = new Bitmap(widthPX, heightPX, PixelFormat.Format32bppPArgb);
            Graphics graphics = Graphics.FromImage(bitmap);

            bitmap.SetResolution(dpi, dpi);
            graphics.Clear(Color.White);

            //设定Y坐标
            var y = 3;
            var x = DrawTools.Millimeter2Pix(3, dpi);

            //开始绘画
            DrawString(graphics, "工单:" + orderLabelInfo.OrderNo, fontCN, Color.Black, x, y);
            y += fontCN.Height;
            DrawString(graphics, "配镜:" + optician, fontCN, Color.Black, x, y);
            y += fontCN.Height;
            DrawString(graphics, "时间: " + operationTime.ToString("yy-MM-dd HH:mm"), fontCN, Color.Black, x, y);
            y += fontCN.Height;
            DrawString(graphics, "质检:" + checker, fontCN, Color.Black, x, y);
            y += fontCN.Height;
            DrawString(graphics, "执行标准:", fontCN, Color.Black, x, y);
            y += fontCN.Height;
            DrawString(graphics, "QB-2506-2001 GB10810.1-2005", fontNB, Color.Black, x, y);
            y += fontNB.Height;
            DrawString(graphics, "QB-2682-2005 GB10810.3-2006", fontNB, Color.Black, x, y);

            y += 35;
            //条码对象
            var ex2 = new CBarcodeX
            {
                Data      = orderLabelInfo.OrderNo,
                ShowText  = false,
                Symbology = bcType.Code128,
                Font      = new Font("Arial", 12)
            };
            var barcodeImage = ex2.Image(widthPX - DrawTools.Millimeter2Pix(3, dpi), DrawTools.Millimeter2Pix(10, dpi));

            DrawImage(graphics, barcodeImage, (widthPX - barcodeImage.Width) / 2, y);//画上条码

            //做旋转
            //bitmap.RotateFlip(RotateFlipType.Rotate180FlipY);
            //bitmap.RotateFlip(RotateFlipType.Rotate180FlipX);
            graphics.Save();
            graphics.Dispose();
            return(bitmap);
        }
Esempio n. 7
0
        /// <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);
        }
Esempio n. 8
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="widthMM"></param>
        /// <param name="heightMM"></param>
        /// <param name="dpi"></param>
        /// <param name="optician">配镜师</param>
        /// <param name="operationTime"></param>
        /// <param name="orderLabelInfo"></param>
        /// <param name="checker">检验师</param>
        /// <returns></returns>
        public static Image DrawToImage(int widthMM, int heightMM, float dpi, string optician, DateTime operationTime, OrderLabelInfo orderLabelInfo, string checker)
        {
            float bs = dpi / DrawTools.CURRENT_DPI;

            var      widthPX   = DrawTools.Millimeter2Pix(widthMM, dpi);
            var      heightPX  = DrawTools.Millimeter2Pix(heightMM, dpi);
            var      allBitmap = new Bitmap(widthPX, heightPX, PixelFormat.Format32bppPArgb);
            Graphics graphics  = Graphics.FromImage(allBitmap);

            allBitmap.SetResolution(dpi, dpi);
            graphics.Clear(Color.White);
            var       y = 1;
            const int X = 0;


            // 间隔空隙两张
            y += DrawTools.Millimeter2Pix(50, dpi);

            //绘画配镜师标签
            var opticianLabel = DrawOpticianLabel(optician, operationTime, dpi, bs);

            DrawImage(graphics, opticianLabel, X, y);

            //下一张间隔
            //y += opticianLabel.Height-14;
            y += DrawTools.Millimeter2Pix(14, dpi);

            //绘画订单信息标签
            var orderLabel = DrawOrderLabel(orderLabelInfo, dpi, bs);

            DrawImage(graphics, orderLabel, X, y);

            //下一张间隔
            y += orderLabel.Height;
            y += DrawTools.Millimeter2Pix(5, dpi);

            //绘画检验师
            var checkLabel = DrawChecker(checker, orderLabelInfo.OrderNo, dpi, bs);

            DrawImage(graphics, checkLabel, X, y);

            //下一张间隔
            y += checkLabel.Height;
            //y += DrawTools.Millimeter2Pix(5, dpi);

            //同样再绘画检验师
            DrawImage(graphics, checkLabel, X, y);


            graphics.Save();
            graphics.Dispose();
            return(allBitmap);
        }