Beispiel #1
0
        //单个打印
        public void OnePrint(MExpress mExpress)
        {
            if (string.IsNullOrEmpty(mExpress.ExpreeType))
            {
                throw new Exception("请先选择快递类型!");
            }
            //获取打印机配置
            FrmPrinterSetting myForm = new FrmPrinterSetting(mExpress.ExpreeType);

            myForm.ShowDialog();
            if (myForm.result != DialogResult.OK)
            {
                return;
            }
            m_MPrinter = myForm.m_Printer;
            Print(mExpress);
        }
Beispiel #2
0
        //批量打印
        public void MorePrint(List <MExpress> mExpressList)
        {
            string templateName = mExpressList[0].ExpreeType;
            var    mExpress     = mExpressList.FirstOrDefault(a => a.ExpreeType != templateName || string.IsNullOrEmpty(a.ExpreeType));

            if (mExpress != null)
            {
                throw new Exception("打印失败!所选记录中,存在不同类型的快递单。请重新选择!");
            }
            //获取打印机配置
            FrmPrinterSetting myForm = new FrmPrinterSetting(templateName);

            myForm.ShowDialog();
            if (myForm.result != DialogResult.OK)
            {
                return;
            }
            m_MPrinter = myForm.m_Printer;
            foreach (MExpress item in mExpressList)
            {
                Print(item);
            }
        }