Пример #1
0
        private void DrawBarcodeImage(string goodsCode, string goodsName, string sellPrice)
        {
            IDrawLabel draw;

            if (radioButton_KEDE.Checked)
            {
                draw = new DrawShopKedePriceLabel(39, 43, 300);
            }
            else if (radioButton_KD.Checked)
            {
                draw = new DrawShopKDPriceLabel(65, 19, 300);
            }
            else
            {
                MessageBox.Show(@"请选择打印店面模版,是KD还是Kede", @"打印提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            var goodsInfo = new DrawGoodsInfo
            {
                GoodsCode = goodsCode,
                GoodsName = goodsName,
                SellPrice = sellPrice
            };
            Image image = draw.DrawToImage(goodsInfo);

            _currentImage = image;
        }
Пример #2
0
        private void StartPrintBarcode(string labelType, string txtString, string printer)
        {
            IDrawLabel draw;

            if (radioButton_KEDE.Checked)
            {
                draw = new DrawShopKedePriceLabel(39, 43, 300);
            }
            else if (radioButton_KD.Checked)
            {
                draw = new DrawShopKDPriceLabel(65, 19, 300);
            }
            else
            {
                MessageBox.Show(@"请选择打印店面模版,是KD还是Kede", @"打印提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                return;
            }
            if (labelType == "2")
            {
                IList <GoodsBarcodeInfo> goodsBarcodeList = ReadGoodsBarcode(labelType, txtString);
                if ((goodsBarcodeList == null) || (goodsBarcodeList.Count == 0))
                {
                    MessageBox.Show(@"输入的单据号没有相关的出库商品信息!", @"打印提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
                else
                {
                    var service = new GlassGoodsLabelPrintService(printer, goodsBarcodeList);
                    service.StartPrintMany(draw);
                }
            }
            else if (labelType == "1")
            {
                string           goodscode        = tb_InputKey.Text.Trim();
                GoodsBarcodeInfo goodsBarcodeInfo = _stockManager.GetGoodsBarcodeInfo(goodscode);
                if (goodsBarcodeInfo != null)
                {
                    new GlassGoodsLabelPrintService(printer).PrintGoods(draw, goodsBarcodeInfo);
                }
                else
                {
                    MessageBox.Show("未能获取商品信息", "打印提示", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }
            }
        }