/// <summary> /// 打印预览 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrintView_Click(object sender, EventArgs e) { // 呐喊 491035839这个qq提出来不要重复打印一个单号,这样浪费纸,打印前检查单号有没有打印了,打印了就弹出提醒让用户确认 _list.Clear(); _list.Add(BuildPrintEntity()); if (_list == null || _list.Count == 0) { MessageUtil.ShowWarning("请认真填写好发件人和收件人的姓名、电话、省市区、地址"); return; } ZtoPrintBillManager printBillManager = new ZtoPrintBillManager(BillPrintHelper.BackupDbHelper); var tempResult = printBillManager.Exists(new KeyValuePair <string, object>(ZtoPrintBillEntity.FieldBillCode, txtBillCode.Text)); if (tempResult) { if (MessageUtil.ConfirmYesNo("当前单号已经打印过了,是否再次打印?")) { GreatReport(); _report.PrintPreview(false); } } else { GreatReport(); _report.PrintPreview(false); } }
/// <summary> /// 直接打印 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { if (CheckInput()) { _list.Clear(); _list.Add(BuildPrintEntity()); if (_list == null || _list.Count == 0) { MessageUtil.ShowWarning("请认真填写好发件人和收件人的姓名、电话、省市区、地址"); return; } ZtoPrintBillManager printBillManager = new ZtoPrintBillManager(BillPrintHelper.BackupDbHelper); var tempResult = printBillManager.Exists(new KeyValuePair <string, object>(ZtoPrintBillEntity.FieldBillCode, txtBillCode.Text)); if (tempResult) { if (MessageUtil.ConfirmYesNo("当前单号已经打印过了,是否再次打印?")) { GreatReport(); _report.PrintEx(GRPrintGenerateStyle.grpgsPreviewAll, false); } } else { GreatReport(); _report.PrintEx(GRPrintGenerateStyle.grpgsPreviewAll, false); } } }