Example #1
0
        public IResult <LabelPrintResponse> PrintLabel(LabelPrintResource resource)
        {
            var printDetails = new LabelPrint
            {
                LabelType        = resource.LabelType,
                LinesForPrinting = new LabelPrintContents
                {
                    SupplierId = resource.LinesForPrinting.SupplierId,
                    Addressee  = resource.LinesForPrinting.Addressee,
                    Addressee2 = resource.LinesForPrinting.Addressee2,
                    AddressId  = resource.LinesForPrinting.AddressId,
                    Line1      = resource.LinesForPrinting.Line1,
                    Line2      = resource.LinesForPrinting.Line2,
                    Line3      = resource.LinesForPrinting.Line3,
                    Line4      = resource.LinesForPrinting.Line4,
                    Line5      = resource.LinesForPrinting.Line5,
                    Line6      = resource.LinesForPrinting.Line6,
                    Line7      = resource.LinesForPrinting.Line7,
                    PostalCode = resource.LinesForPrinting.PostalCode,
                    Country    = resource.LinesForPrinting.Country,
                    PoNumber   = resource.LinesForPrinting.PoNumber,
                    PartNumber = resource.LinesForPrinting.PartNumber,
                    Qty        = resource.LinesForPrinting.Qty,
                    Initials   = resource.LinesForPrinting.Initials,
                    Date       = resource.LinesForPrinting.Date
                },
                Printer  = resource.Printer,
                Quantity = resource.Quantity
            };

            var result = this.labelPrintingService.PrintLabel(printDetails);

            return(new SuccessResult <LabelPrintResponse>(result));
        }
Example #2
0
        /// <summary>
        /// 打印
        /// </summary>
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            var             a   = expressGrid.GetLabelList();
            LabelPrintModel lpm = new LabelPrintModel((ExpressModel)expressPrintVM.中快递, 300);

            lpm.标签 = a;

            LabelPrint p = new LabelPrint(lpm, "快递");

            p.AdvancedPrint();
        }
Example #3
0
        public void SetUp()
        {
            var labelPrint = new LabelPrint
            {
                LabelType        = (int)GeneralPurposeLabelTypes.Labels.Small,
                Printer          = (int)LabelPrinters.Printers.ProdLbl1,
                Quantity         = 2,
                LinesForPrinting = new LabelPrintContents {
                    Line1 = "this line 1", Line2 = "twoooo"
                }
            };

            this.result = this.Sut.PrintLabel(labelPrint);
        }
Example #4
0
        public void SetUp()
        {
            var labelPrint = new LabelPrint
            {
                LabelType        = (int)GeneralPurposeLabelTypes.Labels.SmallBoldText,
                Printer          = (int)LabelPrinters.Printers.ProdLbl1,
                Quantity         = 7,
                LinesForPrinting = new LabelPrintContents {
                    Line1 = "bold yin"
                }
            };

            this.result = this.Sut.PrintLabel(labelPrint);
        }
Example #5
0
        public void SetUp()
        {
            var labelPrint = new LabelPrint
            {
                LabelType        = (int)GeneralPurposeLabelTypes.Labels.LargeWeeText,
                Printer          = (int)LabelPrinters.Printers.ProdLbl2,
                Quantity         = 3,
                LinesForPrinting = new LabelPrintContents
                {
                    Line1 = "Large and small",
                    Line2 = "line2",
                    Line3 = "three",
                    Line4 = "four line",
                    Line5 = "funf",
                    Line6 = "siiiixz",
                    Line7 = "siben"
                }
            };

            this.result = this.Sut.PrintLabel(labelPrint);
        }
Example #6
0
        public void SetUp()
        {
            var labelPrint = new LabelPrint
            {
                LabelType        = (int)GeneralPurposeLabelTypes.Labels.GoodsInLabel,
                Printer          = (int)LabelPrinters.Printers.ProdLbl2,
                Quantity         = 9,
                LinesForPrinting = new LabelPrintContents
                {
                    AddressId  = "11",
                    SupplierId = "77",
                    PoNumber   = "PCAS",
                    PartNumber = "PCSM",
                    Qty        = "99",
                    Initials   = "IC",
                    Date       = "30 Jan 2020"
                }
            };

            this.result = this.Sut.PrintLabel(labelPrint);
        }
Example #7
0
        public void SetUp()
        {
            var labelPrint = new LabelPrint
            {
                LabelType        = (int)GeneralPurposeLabelTypes.Labels.AddressLabel,
                Printer          = (int)LabelPrinters.Printers.ProdLbl2,
                Quantity         = 6,
                LinesForPrinting = new LabelPrintContents
                {
                    SupplierId = "77",
                    AddressId  = "11",
                    Addressee  = "la addressee",
                    Addressee2 = "duexieme addressee",
                    Line1      = "Large and small",
                    Line2      = "line2",
                    Line3      = "three",
                    Line4      = "four line",
                    PostalCode = "G1",
                    Country    = "schottland"
                }
            };

            this.result = this.Sut.PrintLabel(labelPrint);
        }
Example #8
0
    protected void TextBox2_TextChanged(object sender, EventArgs e)
    {
        string t1 = TextBox1.Text.Trim();
        if (t1 != "")
        {

            if (_strpart != "" && TextBox2.Text.Trim() != "")
            {

                Part _part = service.getPart(TextBox1.Text.Trim());
                int oldqty = service.getQty(_part.Id.ToString());
                int newqty = oldqty + int.Parse(TextBox2.Text.Trim());

                if (int.Parse(TextBox2.Text.Trim()) > newqty)
                {
                    Label1.Visible = true;
                    Label1.Text = "ยอดเกินจำนวน !!!";
                    return;
                }

                DateTime dt = DateTime.Now;
                string _dtDate = dt.ToString("dd/MM/yyyy");

                string[] _days = Regex.Split(_dtDate, "/");
                int year = Convert.ToInt32(_days[2]) - 543;
                int mount = Convert.ToInt32(_days[1]);
                int day = Convert.ToInt32(_days[0]);

                // save
                Label lbl = new Label();
                lbl.Id = service.getMaxId();
                lbl.PartName = _part.CustomerPart;
                lbl.SerialNo = /* "B" + */StringExt.StringFromRight(year.ToString(), 2) + mount.ToString("00") + service.getLine(mount.ToString()).ToString("00000");
                lbl.PrintTime = _dtDate;
                lbl.Line = "B";
                lbl.Ckt = _part.Ckt;
                lbl.Model = _part.Model;
                lbl.OilType = _part.OilType;
                lbl.OilWeight = _part.OilWeight;
                lbl.Status = "1";
                lbl.Run = service.getLine(mount.ToString()).ToString();
                lbl.MM = dt.ToString("MM");

                ReportDocument rd = new ReportDocument();
                List<LabelPrint> labelPrints = new List<LabelPrint>();
                LabelPrint lprint = new LabelPrint();
                lprint.CustomerPart = _part.CustomerPart;
                lprint.Ckt = _part.Ckt;
                lprint.SerialNo = lbl.SerialNo;
                lprint.Model = _part.Model;
                lprint.OilWeight = _part.OilWeight;
                lprint.OilType = _part.OilType;
                labelPrints.Add(lprint);

                rd.Load(MapPath("CrystalReport.rpt"));
                rd.SetDataSource(labelPrints);

                            // string PrinterName = "EPSON TM-T81 ReceiptSA4";
                            //  PrinterSettings printerSetting = new PrinterSettings();
                            // PrinterName = printerSetting.PrinterName.ToString();
                            //  rd.PrintOptions.PrinterName = PrinterName;

               // rd.PrintToPrinter(1, false, 1, 1);

                int result = service.CreateLabel(lbl);

                if (result > -1)
                {
                    Console.WriteLine("Insert Complete");
                }
                else
                {
                    Console.WriteLine("Insert Not Complete");
                }

                Response.Redirect("About.aspx?part=" + _part.Id+"&qty="+TextBox2.Text.Trim());

            }

        }
    }
Example #9
0
        public static string ProcPrintJob(string e, ref int errorCode, ref String errorMessage)
        {
            LabelPrint print        = new LabelPrint();
            HashMap    map          = JsonConvert.DeserializeObject <HashMap>(e);
            String     LabelContent = map["labelJsonData"].ToString();
            String     printer      = map.GetValue <String>("printName");

            //如果设置了全局当前打印机,就用当前打印机打印
            //提供web修改接口
            if (Setting.globalPrinter != null && Setting.globalPrinter != "")
            {
                printer = Setting.globalPrinter;
            }
            String tempatePath = map.GetValue <String>("tempatePath");
            int    copys       = map.GetValue <int>("copys");

            try
            {
                PrintX.LeanMES.Plugin.LabelPrint.PrintHlper.Copys = copys;
            }
            catch (Exception err)
            {
                Console.WriteLine(err.Message);
                copys = 1;
            }

            int linkFlag = 0;

            try
            {
                map.GetValue <int>("linkFlag");
            }
            catch (Exception err)
            {
                Console.WriteLine(err.Message);
                linkFlag = 1;
            }

            Tools.PubMessage("是否连板--------" + linkFlag);
            if (linkFlag < 1)
            {
                //连扳标记
                linkFlag = 0;
            }
            if (copys < 1)
            {
                //打印份数
                PrintX.LeanMES.Plugin.LabelPrint.PrintHlper.Copys = 1;

                copys = 1;
            }


            Tools.PubMessage("打印份数--------" + copys);
            string           snString = "";
            List <LabelData> list     = new List <LabelData>();
            List <LabelInfo> list2    = new List <LabelInfo>();

            list = Deserialization.JSONStringToList <LabelData>(LabelContent);
            try
            {
                //加速赋值
                Parallel.For(0, list.Count, i =>
                {
                    list2 = Deserialization.JSONStringToList <LabelInfo>(JsonConvert.SerializeObject(list[i].LabelContent));
                    for (int j = 0; j < list2.Count; j++)
                    {
                        snString = list2[j].Value;
                    }
                });
            }
            catch (Exception err)
            {
                errorMessage = "解析打印内容的json失败,请校验格式是否正确,您传递的格式为:" + e + "触发的异常信息为:\n" + err.Message;
                errorCode    = -1;
            }

            try
            {
                Tools.PubMessage("准备打印--------");

                Tools.PubMessage("打印模板--------" + tempatePath);

                Tools.PubMessage("打印机--------" + printer);

                print.PrintLabelUseCodeSoft9(tempatePath, LabelContent, copys, "cn", printer, ref errorCode,

                                             ref errorMessage, linkFlag);
            }
            catch (Exception er)
            {
                Tools.PubMessage("发生异常咯--------" + er.Message);
                errorMessage = er.Message;
                errorCode    = -1;
            }


            //重置打印份数
            PrintX.LeanMES.Plugin.LabelPrint.PrintHlper.Copys = 1;



            //组装返回结果
            HashMap responseBean = new HashMap();

            if (errorCode == 0)
            {
                errorMessage = "打印成功";
            }
            responseBean.Add("errorMessage", errorMessage);
            responseBean.Add("errorCode", errorCode);
            responseBean.Add("key", "PrintJob");


            return(JsonConvert.SerializeObject(responseBean));
        }
Example #10
0
        // 라벨프린트 클릭
        private void btnPrint_Click(object sender, EventArgs e)
        {
            isPrinting = true;
            if (!LabelPrint.PrinterConnectionOpen())
            {
                return;
            }

            // 라벨발행
            int index;

            for (int i = 0; i < gridView3.SelectedRowsCount; i++)
            {
                index = gridView3.GetSelectedRows()[i];
                gridView3.FocusedRowHandle = index;
                Application.DoEvents();
                bool isPrintable = (gridView3.GetRowCellValue(index, "LBL_NO").ToString().Contains("불가") ? false : true);
                if (!isPrintable)
                {
                    continue;
                }

                int LBL_QTY = Convert.ToInt32(gridView3.GetRowCellValue(index, "LBL_QTY").ToString());
                for (int j = 1; j < LBL_QTY + 1; j++)
                {
                    if (!isPrinting)
                    {
                        return;
                    }
                    data.ITEM_NM        = gridView3.GetRowCellValue(index, "ITEM_NM").ToString();
                    data.ITEM_NO        = gridView3.GetRowCellValue(index, "ITEM_NO").ToString();
                    data.KEEP_CONDITION = gridView3.GetRowCellValue(index, "STORE_CONDI").ToString();
                    data.LBL_NO         = gridView3.GetRowCellValue(index, "LBL_NO").ToString();
                    data.LOT_NO         = gridView3.GetRowCellValue(index, "LOT_NO").ToString();
                    data.VENDOR_NM      = gridView3.GetRowCellValue(index, "VENDOR_NM").ToString();
                    data.ORDER_QTY      = string.Format("{0:#,#.#####}", Convert.ToDecimal(gridView3.GetRowCellValue(index, "ITEM_QTY")));
                    data.LABEL_QTY      = gridView3.GetRowCellValue(index, "LBL_QTY").ToString();
                    data.UNIT           = gridView3.GetRowCellValue(index, "UNIT").ToString();
                    data.LABEL_SEQ      = j.ToString();
                    if ((gridView3.GetRowCellValue(index, "IN_DATE") == null) ||
                        (gridView3.GetRowCellValue(index, "IN_DATE").ToString() == ""))
                    {
                        data.UNLOAD_DATE = "";
                    }
                    else
                    {
                        data.UNLOAD_DATE = DateTime.ParseExact(gridView3.GetRowCellValue(index, "IN_DATE").ToString(), "yyyyMMdd", null).ToString("yyyy-MM-dd");
                    }

                    if ((gridView3.GetRowCellValue(index, "USE_DEADLN") == null) ||
                        (gridView3.GetRowCellValue(index, "USE_DEADLN").ToString() == ""))
                    {
                        data.USE_DEADLN = "";
                    }
                    else
                    {
                        data.USE_DEADLN = DateTime.ParseExact(gridView3.GetRowCellValue(index, "USE_DEADLN").ToString(), "yyyyMMdd", null).ToString("yyyy-MM-dd");
                    }

                    LabelPrint.PrintLabel("전체라벨발행", "재고이관", "재고이관", data);

                    System.Threading.Thread.Sleep(1000);
                }
            }
        }