简体   繁体   English

需要应用设计建议

[英]Need an application design advice

I'm developing a web application which processes invoices(the functionality is not limited to invoices, but it doesn't matter). 我正在开发一个处理发票的Web应用程序(功能不限于发票,但没关系)。 One of the parts of the workflow is to print invoice after it was published. 工作流的一部分是在发票发布后打印发票。 This means that the website user is able to select 10-20(and more) invoices and print it at once. 这意味着该网站用户可以选择10-20张(及更多)发票并立即打印。 Also there may be several invoice templates which may be customizable(this is one of the key requirements). 另外,可能有几个可自定义的发票模板(这是关键要求之一)。

I should also mention that we decide to generate PDFs from the html code and then print it. 我还应该提到,我们决定从html代码生成PDF,然后打印出来。 So as the PDF creation process may take some time to complete we decided to use a windows service for invoices printing. 因此,由于PDF创建过程可能需要一些时间才能完成,因此我们决定使用Windows服务进行发票打印。

So, summarizing we have the following requirements: 因此,总结一下,我们有以下要求:

  1. There should be customizable invoice templates; 应该有可定制的发票模板;
  2. The website user should be able to specify which template he want to use with the invoice item specified; 网站用户应该能够指定要与指定的发票项目一起使用的模板;
  3. There should be a possibility to print one or several selected invoices in one click. 一键打印应该可以打印一张或几张选定的发票。

Our first idea was to use user controls as invoice templates. 我们的第一个想法是使用用户控件作为发票模板。 The user control will be responsible for invoice layout. 用户控件将负责发票布局。 This also means there will be a base class for these user controls through which we will be able to define a data source for the controls. 这也意味着将为这些用户控件提供一个基类,通过它我们可以为控件定义数据源。 In this case we may even allow users to modify ascx file (or something similar) to edit basic captions if necessary. 在这种情况下,如果需要,我们甚至可以允许用户修改ascx文件(或类似内容)以编辑基本字幕。

The problem begins in the windows service where we are unable to generate output for user controls. 问题始于Windows服务,我们无法为用户控件生成输出。 So the other solution is to use http handler or web service to generate user controls output and transfer this to the windows service. 因此,另一个解决方案是使用http处理程序或Web服务生成用户控件输出,并将其传输到Windows服务。 But this complicates the solution (eg we need to use authentication for this and similar problems). 但这会使解决方案复杂化(例如,对于此问题和类似问题,我们需要使用身份验证)。

Maybe there is a much more simpler way to do it? 也许有更简单的方法来做到这一点?

Thanks in advance. 提前致谢。

In response to your comment, I suggest you have the website generate the HTML and save it into a 'GeneratedInvoice' field in your DB, which the service then processes (ie converts to PDF however your pdf conversion software does it). 为了回应您的评论,我建议您让网站生成HTML并将其保存到DB中的“ GeneratedInvoice”字段中,然后由服务进行处理(即,转换为PDF,但您的pdf转换软件可以处理)。 It's appropriate because you have a 'saved' copy of the generated invoice; 这是适当的,因为您具有已生成发票的“已保存”副本; ie if your invoice processing routine changes (different styles, etc) your old invoices aren't affected, and yet you can regenerate a given bunch in a possibly 'new' format if required. 例如,如果您的发票处理例程发生更改(样式不同),则您的旧发票不会受到影响,但是您可以根据需要以“新”格式重新生成给定的一堆。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM