Example #1
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 #2
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 #3
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 #4
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 #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:         //资产新增
                    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 #6
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);
            }
        }