Example #1
0
        private void btnOnedimensionalcode_Press(object sender, EventArgs e)
        {
            Commands2.Clear();
            Commands2.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
            Commands2.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledBarcode));
            Commands2.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.AbsoluteLocation));
            Commands2.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
            Commands2.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, "6925303721367"));
            Commands2.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledBarcode));
            Commands2.Add(new PosPrinterContentEntity(System.Environment.NewLine));
            Commands2.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

            posPrinter2.Print(Commands2, (obj, args) =>
            {
                if (args.isError == true)
                {
                    this.Toast("Error: " + args.error);
                }
                else
                {
                    this.Toast("打印成功");
                }
            }
                              );
        }
Example #2
0
        private void btnSteptoblackmark_Press(object sender, EventArgs e)
        {
            PosPrinterEntityCollection Commands1 = new PosPrinterEntityCollection();

            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Turnonblackmark));
            //Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Center));
            //Commands1.Add(new PosPrinterBarcodeEntity(PosBarcodeType.QRCODE, "6925303721367"));
            //Commands1.Add(new PosPrinterContentEntity("产品名称:" + "aaaaaa" + System.Environment.NewLine));
            //Commands1.Add(new PosPrinterContentEntity("产品编码:" + "aaaaaa" + System.Environment.NewLine));
            // Commands1.Add(new PosPrinterContentEntity("规格:" + "aaaaaa" + System.Environment.NewLine));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Steptoblackmark));
            //Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Turnoffblackmark));
            posPrinter1.Print(Commands1, (obj, args) =>
            {
                if (args.isError == true)
                {
                    this.Toast("Error: " + args.error);
                }
                else
                {
                    this.Toast("打印成功");
                }
            });
        }
Example #3
0
        /// <summary>
        /// ºÄ²ÄÌõÂë´òÓ¡
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrint_Press(object sender, EventArgs e)
        {
            try
            {
                PosPrinterEntityCollection Commands = new PosPrinterEntityCollection();
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledBarcode));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.AbsoluteLocation));
                Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
                Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, CID));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledBarcode));
                Commands.Add(new PosPrinterContentEntity(System.Environment.NewLine));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

                posPrinter1.Print(Commands, (obj, args) =>
                {
                    if (args.isError == true)
                    {
                        this.Toast("Error: " + args.error);
                    }
                    else
                    {
                        this.Toast("´òÓ¡³É¹¦");
                    }
                });
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Example #4
0
        /// <summary>
        /// 打印
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnPrint_Press(object sender, EventArgs e)
        {
            try
            {
                AssetsOutputDto            outputDto = _autofacConfig.SettingService.GetAssetsByID(AssId);
                PosPrinterEntityCollection Commands  = new PosPrinterEntityCollection();
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledBarcode));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.AbsoluteLocation));
                Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
                Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, outputDto.SN));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledBarcode));
                Commands.Add(new PosPrinterContentEntity(System.Environment.NewLine));
                Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

                posPrinter1.Print(Commands, (obj, args) =>
                {
                    if (args.isError == true)
                    {
                        this.Toast("Error: " + args.error);
                    }
                    else
                    {
                        this.Toast("打印成功");
                    }
                });
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Example #5
0
        /// <summary>
        /// 点击ActionButton
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmAssets_ActionButtonPress(object sender, ActionButtonPressEventArgs e)
        {
            try
            {
                switch (e.Index)
                {
                case 0:         //资产调拨
                    //调拨
                    frmAssTransferRows frmT = new frmAssTransferRows();
                    this.Form.Show(frmT);
                    break;

                case 1:
                    //资产打印
                    try
                    {
                        if (string.IsNullOrEmpty(SelectAssId))
                        {
                            throw new Exception("请先选择资产.");
                        }
                        AssetsOutputDto            outputDto = _autofacConfig.SettingService.GetAssetsByID(SelectAssId);
                        PosPrinterEntityCollection Commands  = new PosPrinterEntityCollection();
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledBarcode));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.AbsoluteLocation));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, outputDto.SN));
                        //Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, "E2000017320082231027BD"));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledBarcode));
                        Commands.Add(new PosPrinterContentEntity(System.Environment.NewLine));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

                        posPrinter1.Print(Commands, (obj, args) =>
                        {
                            if (args.isError == true)
                            {
                                this.Toast("Error: " + args.error);
                            }
                            else
                            {
                                this.Toast("打印成功");
                            }
                        });
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Example #6
0
 private void SmobilerForm1_Load(object sender, EventArgs e)
 {
     Commands3.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
     Commands3.Add(new PosPrinterBarcodeEntity(PosBarcodeType.QRCODE, "1A115090109566C"));
     Commands3.Add(new PosPrinterContentEntity(System.Environment.NewLine));
     Commands3.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));
 }
Example #7
0
        /// <summary>
        /// 点击ActionButton
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmAssets_ActionButtonPress(object sender, ActionButtonPressEventArgs e)
        {
            try
            {
                switch (e.Index)
                {
                case 0:         //资产新增
                    try
                    {
                        if (Client.Session["Role"].ToString() == "SMOSECUser")
                        {
                            throw new Exception("当前用户没有权限添加资产!");
                        }
                        frmAssetsCreate assetsCreate = new frmAssetsCreate();
                        Show(assetsCreate, (MobileForm sender1, object args) =>
                        {
                            if (assetsCreate.ShowResult == ShowResult.Yes)
                            {
                                Bind();
                            }
                        }
                             );
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;

                case 1:
                    //资产复制
                    try
                    {
                        if (string.IsNullOrEmpty(SelectAssId))
                        {
                            throw new Exception("请先选择资产.");
                        }
                        var assets = _autofacConfig.SettingService.GetAssetsByID(SelectAssId);

                        frmAssetsCreate assetsCreate = new frmAssetsCreate
                        {
                            DatePickerBuy    = { Value = assets.BuyDate },
                            DepId            = assets.DepartmentId,
                            btnDep           = { Text = assets.DepartmentName + "   > " },
                            DatePickerExpiry = { Value = assets.ExpiryDate },
                            ImgPicture       = { ResourceID = assets.Image },
                            LocationId       = assets.LocationId,
                            btnLocation      = { Text = assets.LocationName },
                            ManagerId        = assets.Manager,
                            txtManager       = { Text = assets.ManagerName },
                            txtName          = { Text = assets.Name },
                            txtNote          = { Text = assets.Note },
                            txtPlace         = { Text = assets.Place },
                            txtPrice         = { Text = assets.Price.ToString() },
                            txtSpe           = { Text = assets.Specification },
                            TypeId           = assets.TypeId,
                            btnType          = { Text = assets.TypeName },
                            txtUnit          = { Text = assets.Unit },
                            txtVendor        = { Text = assets.Vendor }
                        };

                        Show(assetsCreate, (MobileForm sender1, object args) =>
                        {
                            if (assetsCreate.ShowResult == ShowResult.Yes)
                            {
                                Bind();
                            }
                        }
                             );
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;

                case 2:
                    //资产领用
                    frmCollarOrder frmCO = new frmCollarOrder();
                    Form.Show(frmCO);
                    break;

                case 3:
                    //资产借用
                    frmBorrowOrder frmBO = new frmBorrowOrder();
                    Form.Show(frmBO);
                    break;

                case 4:
                    //维修登记
                    frmRepairRowsSN frmR = new frmRepairRowsSN();
                    this.Form.Show(frmR);
                    break;

                case 5:
                    //报废
                    frmScrapRowsSN frmS = new frmScrapRowsSN();
                    this.Form.Show(frmS);
                    break;

                case 6:
                    //调拨
                    frmTransferRowsSN frmT = new frmTransferRowsSN();
                    this.Form.Show(frmT);
                    break;

                case 7:
                    try
                    {
                        if (string.IsNullOrEmpty(SelectAssId))
                        {
                            throw new Exception("请先选择资产.");
                        }
                        AssetsOutputDto            outputDto = _autofacConfig.SettingService.GetAssetsByID(SelectAssId);
                        PosPrinterEntityCollection Commands  = new PosPrinterEntityCollection();
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledBarcode));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.AbsoluteLocation));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, outputDto.SN));
                        //Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, "E2000017320082231027BD"));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledBarcode));
                        Commands.Add(new PosPrinterContentEntity(System.Environment.NewLine));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

                        posPrinter1.Print(Commands, (obj, args) =>
                        {
                            if (args.isError == true)
                            {
                                this.Toast("Error: " + args.error);
                            }
                            else
                            {
                                this.Toast("打印成功");
                            }
                        });
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Example #8
0
        /// <summary>
        /// 点击ActionButton
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void frmAssTemplate_ActionButtonPress(object sender, ActionButtonPressEventArgs e)
        {
            try
            {
                switch (e.Index)
                {
                case 0:         //模板新增
                    try
                    {
                        frmAssTemplateCreate assTemplateCreate = new frmAssTemplateCreate();
                        Show(assTemplateCreate, (MobileForm sender1, object args) =>
                        {
                            if (assTemplateCreate.ShowResult == ShowResult.Yes)
                            {
                                Bind();
                            }
                        }
                             );
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;

                case 1:
                    //模板复制
                    try
                    {
                        if (string.IsNullOrEmpty(SelectTemplateId))
                        {
                            throw new Exception("请先选择模板.");
                        }
                        var assTemplate = _autofacConfig.SettingService.GetAtbyId(SelectTemplateId);

                        frmAssTemplateCreate assTemplateCreate = new frmAssTemplateCreate
                        {
                            ImgPicture = { ResourceID = assTemplate.IMAGE },
                            txtName    = { Text = assTemplate.NAME },
                            txtNote    = { Text = assTemplate.NOTE },
                            txtPrice   = { Text = assTemplate.PRICE.ToString() },
                            txtSpe     = { Text = assTemplate.SPECIFICATION },
                            btnType    = { Text = assTemplate.TYPEID, Tag = assTemplate.TYPEID },
                            txtUnit    = { Text = assTemplate.UNIT },
                            txtVendor  = { Text = assTemplate.VENDOR }
                        };

                        Show(assTemplateCreate, (MobileForm sender1, object args) =>
                        {
                            if (assTemplateCreate.ShowResult == ShowResult.Yes)
                            {
                                Bind();
                            }
                        }
                             );
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;

                case 2:
                    //打印标签
                    try
                    {
                        if (string.IsNullOrEmpty(SelectTemplateId))
                        {
                            throw new Exception("请先选择模板.");
                        }
                        AssTemplate outputDto = _autofacConfig.SettingService.GetAtbyId(SelectTemplateId);
                        PosPrinterEntityCollection Commands = new PosPrinterEntityCollection();
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledBarcode));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.AbsoluteLocation));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
                        Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, outputDto.TEMPLATEID));
                        //Commands.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, "E2000017320082231027BD"));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledBarcode));
                        Commands.Add(new PosPrinterContentEntity(System.Environment.NewLine));
                        Commands.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

                        posPrinter1.Print(Commands, (obj, args) =>
                        {
                            if (args.isError == true)
                            {
                                this.Toast("Error: " + args.error);
                            }
                            else
                            {
                                this.Toast("打印成功");
                            }
                        });
                    }
                    catch (Exception ex)
                    {
                        Toast(ex.Message);
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                Toast(ex.Message);
            }
        }
Example #9
0
        private void btnPrinter_Press(object sender, EventArgs e)
        {
            Commands1.Clear();
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Center));
            Commands1.Add(new PosPrinterContentEntity("这是我的店"));
            Commands1.Add(new PosPrinterContentEntity("Tel:0123 456 7890"));
            Commands1.Add(new PosPrinterContentEntity("Web: www.smobiler.com"));
            Commands1.Add(new PosPrinterContentEntity("*****@*****.**"));
            Commands1.Add(new PosPrinterContentEntity("Print No.:6361183623024359309"));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Left));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledUnderline2));
            Commands1.Add(new PosPrinterContentEntity("_".PadRight(42, '_')));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledUnderline));
            Commands1.Add(new PosPrinterContentEntity("Tea                                  T1   1.30"));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledUnderline2));
            Commands1.Add(new PosPrinterContentEntity("______________________________________________"));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledUnderline));
            Commands1.Add(new PosPrinterContentEntity("                                 Total:   1.30"));
            Commands1.Add(new PosPrinterContentEntity("                                              "));
            Commands1.Add(new PosPrinterContentEntity("                             Paid Card:   1.30"));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Center));
            Commands1.Add(new PosPrinterContentEntity("Thank You For Your Support!"));
            Commands1.Add(new PosPrinterContentEntity("                                              "));
            Commands1.Add(new PosPrinterContentEntity(System.Environment.NewLine));
            Commands1.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

            posPrinter1.Print(Commands1, (obj, args) =>
            {
                if (args.isError == true)
                {
                    this.Toast("Error: " + args.error);
                }
                else
                {
                    this.Toast("打印成功");
                }
            }
                              );
        }
Example #10
0
        private void btnSamplelabel_Press(object sender, EventArgs e)
        {
            Commands4.Clear();
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Initial));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.LeftMargin));
            Commands4.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "62"));
            Commands4.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, "2102315687895200"));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.LeftMargin0));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Left));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Size2));
            Commands4.Add(new PosPrinterContentEntity("标准快递" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterContentEntity("2018-3-1 14:30:00" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Size1));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledUnderline2));
            Commands4.Add(new PosPrinterContentEntity("___________________________________________" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledUnderline));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Left));
            Commands4.Add(new PosPrinterContentEntity("寄件人:乐标                  邮编:201600" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterContentEntity("地址:上海市松江区茸北路" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterContentEntity("计费重量(KG):1          保价金额:500元" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledUnderline2));
            Commands4.Add(new PosPrinterContentEntity("___________________________________________" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledUnderline));
            Commands4.Add(new PosPrinterContentEntity("收件人:李四通                邮编:910000" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterContentEntity("收件人签名:     收件时间:  年  月  日  时" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.EnabledUnderline2));
            Commands4.Add(new PosPrinterContentEntity("___________________________________________" + System.Environment.NewLine));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledUnderline));
            Commands4.Add(new PosPrinterContentEntity("                                           " + System.Environment.NewLine));
            Commands4.Add(new PosPrinterContentEntity("订单ID:"));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.LeftMargin));
            Commands4.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "40"));
            Commands4.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, "911"));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.LeftMargin0));

            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.DisabledUnderline));
            Commands4.Add(new PosPrinterContentEntity("                                           " + System.Environment.NewLine));
            Commands4.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128Height, "120"));
            Commands4.Add(new PosPrinterBarcodeEntity(PosBarcodeType.CODE128, "2102315687895200"));
            Commands4.Add(new PosPrinterContentEntity(System.Environment.NewLine));
            Commands4.Add(new PosPrinterProtocolEntity(PosPrinterProtocol.Cut));

            posPrinter4.Print(Commands4, (obj, args) =>
            {
                if (args.isError == true)
                {
                    this.Toast("Error: " + args.error);
                }
                else
                {
                    this.Toast("打印成功");
                }
            }
                              );
        }