public PrintReportStatus PrintReport(WMSBusinessObject entity, string reportCode, string printerCode = null, IEnumerable <OutputParam> paramExt = null) { decimal? mandantcode = GetMandantCode(entity); PrinterLogical printerLogical; var output = CreateOutput(entity, reportCode, mandantcode, printerCode, paramExt, out printerLogical); if (printerLogical == null) { throw new DeveloperException("Не настроен логический принтер"); } using (var outputManager = (IOutputManager)GetManager <Output>()) { var result = new PrintReportStatus { Printer = printerLogical.PhysicalPrinter_R }; try { var outTask = outputManager.PrintReport(output); result.Job = outTask.GetKey().ToString(); } catch (Exception ex) { result.Error = ex.Message; } return(result); } }
public PrintReportStatus PrintReport(decimal?mandantId, string reportCode, string printerCode = null, IEnumerable <OutputParam> paramExt = null) { PrinterLogical printerLogical; var output = CreateOutput(null, reportCode, mandantId, printerCode, paramExt, out printerLogical); using (var outputManager = (IOutputManager)GetManager <Output>()) { var result = new PrintReportStatus(); try { if (printerLogical == null) { throw new OperationException("Не удалось определить логический принтер"); } result.Printer = printerLogical.PhysicalPrinter_R; Output outTask = outputManager.PrintReport(output); result.Job = outTask.GetKey().ToString(); } catch (Exception ex) { result.Error = ex.Message; } return(result); } }
public PrintReportStatus PrintReportBatch(WMSBusinessObject[] entities, string reportCode, string printerCode = null, IDictionary <WMSBusinessObject, IEnumerable <OutputParam> > paramExt = null) { var outputs = new List <Output>(); var printers = new List <string>(); var result = new PrintReportStatus(); foreach (var entity in entities) { decimal? mandantcode = GetMandantCode(entity); PrinterLogical printerLogical; var output = CreateOutput(entity, reportCode, mandantcode, printerCode, paramExt.ContainsKey(entity) ? paramExt[entity] : null, out printerLogical); outputs.Add(output); if (!printers.Contains(printerLogical.PhysicalPrinter_R)) { printers.Add(printerLogical.PhysicalPrinter_R); } } using (var outputManager = (IOutputManager)GetManager <Output>()) { try { var batch = new OutputBatch { Batch = new WMSBusinessCollection <Output>(outputs) }; batch = outputManager.PrintReportBatch(batch); result.Printer = String.Join(", ", printers); result.Job = "-"; } catch (Exception ex) { result.Error = ex.Message; } } return(result); }