예제 #1
0
        /// <summary>
        /// 加载节点数据
        /// </summary>
        private void FillTreeViewNodes()
        {
            var expressList = _expressManager.GetList <BaseExpressEntity>();

            if (!expressList.Any())
            {
                XtraMessageBox.Show(@"未加载到任何快递公司信息。", AppMessage.MSG0000, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            foreach (BaseExpressEntity baseExpressEntity in expressList)
            {
                TreeNode rootNode = treeView1.Nodes.Add(baseExpressEntity.Name);
                var      list     = _baseTemplateManager.GetList <BaseTemplateEntity>(new KeyValuePair <string, object>(BaseTemplateEntity.FieldExpressId, baseExpressEntity.Id));
                if (list.Any())
                {
                    foreach (BaseTemplateEntity baseTemplateEntity in list)
                    {
                        rootNode.Nodes.Add(baseTemplateEntity.Id.ToString(), baseTemplateEntity.Name);
                    }
                }
            }
            treeView1.ExpandAll();
            treeView1.SelectedNode = treeView1.Nodes[0].Nodes[0];
            treeView1_AfterSelect(this, null);
        }
예제 #2
0
        /// <summary>
        /// 打印任务结束
        /// </summary>
        void ReportPrintEnd()
        {
            var t = new Task(() =>
            {
                var frmExportBillImage = new FrmExportBillImage(_list);
                frmExportBillImage.BuildImage();
            });

            t.Start();
            // 还需要加入备份库(打印历史记录表中,重复的数据打印不要重复创建到历史记录中)
            var filePath         = BillPrintHelper.GetDefaultTemplatePath();
            var templateManager  = new BaseTemplateManager(BillPrintHelper.DbHelper);
            var templateList     = templateManager.GetList <BaseTemplateEntity>(new KeyValuePair <string, object>(BaseTemplateEntity.FieldFilePath, filePath));
            var printBillManager = new ZtoPrintBillManager(BillPrintHelper.BackupDbHelper);
            var resultCount      = printBillManager.AddHistory(_list, templateList.FirstOrDefault());

            if (resultCount > 0)
            {
                alertPrintInfo.Show(this.ParentForm, "提醒消息", string.Format("打印结束,可以在历史记录中查询打印数据,新增{0}条打印记录。", resultCount));
            }
            else
            {
                alertPrintInfo.Show(this.ParentForm, "提醒消息", string.Format("打印结束,新增{0}条打印记录,请检查单号是否都存在,否则不会新增到历史记录中。", resultCount));
            }
        }
예제 #3
0
        /// <summary>
        /// 绑定打印模板
        /// </summary>
        void BindTemplate()
        {
            var expressList = _expressManager.GetList <BaseExpressEntity>();

            if (!expressList.Any())
            {
                return;
            }
            foreach (BaseExpressEntity baseExpressEntity in expressList)
            {
                var list = _baseTemplateManager.GetList <BaseTemplateEntity>(new KeyValuePair <string, object>(BaseTemplateEntity.FieldExpressId, baseExpressEntity.Id));
                if (list.Any())
                {
                    foreach (BaseTemplateEntity baseTemplateEntity in list)
                    {
                        lsbTemplate.Items.Add(baseExpressEntity.Name + "-" + baseTemplateEntity.Name);
                    }
                }
            }
        }
예제 #4
0
        private void FrmSystemSetting_Load(object sender, EventArgs e)
        {
            BindTemplate();
            BindPrinter();
            var defaultPrinter = BillPrintHelper.GetDefaultPrinter();

            if (!string.IsNullOrEmpty(defaultPrinter))
            {
                lsbPrinter.SelectedValue = defaultPrinter;
                lblDefaultPrinter.Text   = @"默认打印机:" + defaultPrinter;
            }
            var defaultPrintTemplate = BillPrintHelper.GetDefaultTemplatePath();

            if (!string.IsNullOrEmpty(defaultPrintTemplate))
            {
                var templateEntity = _baseTemplateManager.GetList <BaseTemplateEntity>(new KeyValuePair <string, object>(BaseTemplateEntity.FieldFilePath, defaultPrintTemplate)).FirstOrDefault();
                if (templateEntity != null)
                {
                    var expressEntity = _expressManager.GetObject(templateEntity.ExpressId.ToString());
                    lsbTemplate.SelectedValue    = expressEntity.Name + "-" + templateEntity.Name;
                    lblDefaultPrintTemplate.Text = @"默认打印模板:" + expressEntity.Name + "-" + templateEntity.Name;
                }
            }
        }