2.3 SubmitInvoice提交发货单
2.3.1 Situation情景
Company employees must fill out a purchase request if they want new supplies of pencils, paper,
and toner. A purchase request total under $10 should be approved automatically, otherwise
someone from the accounting department must also approve. Pencils cost $0.50 each, paper costs
$0.07 each, and toner costs $5.99 each.
当公司雇员需要提供新的铅笔,纸张和夹子时,他们必须填写一个购买请求。低于10
美元的购买请求将自动批准,否则财务部门的某人必须批准。铅笔每支0.5美元,纸张每
张0.07美元,夹子每个5.99美元。
Accounting can change the quantities of purchase requests costing $10 or more.
财务部门可以更改花费10美元及以上购买请求的购买数量.
2.3.2 Preparation准备
2.3.2.1 Overview 概览
1) If the PowerFolder Server has not been started, start it now.
如果PowerFolder服务器还没有启动,那么启动它。
2) Log into the PowerFolder Console
登录进入PowerFolder控制台
3) Undeploy all scripts and web pages
卸载所有的脚本和页面
4) Deploy the following script and web pages.
发布下面的脚本和页面。
Script:
脚本
- SubmitInvoice
Web Pages:
页面
- AdjustInvoice
- ApproveInvoice
- EnterInvoice
- SubmitInvoice
- ViewInvoices
2.3.2.2 How-To 怎样做
- Starting the PowerFolder Server. If you configured environment variable 'JAVA_HOME'
during installation, just double-click 'run_with_tomcat.bat' in Windows Explorer. Otherwise,
open a command console and make sure the environment variable 'JAVA_HOME' is set to base
directory of the Java installation. Start the PowerFolder server by going to the directory then go
to the 'jboss' subdirectory then again go to the 'bin' subdirectory. Run program
'run_with_tomcat.bat'.
启动PowerFolder服务器。如果你在安装时配置了环境变量JAVA_HOME,只要在资源
管理中双击run_with_tomcat.bat。否则的话,打开一个命令控制台,设计环境变量
JAVA_HOME到Java安装的根目录。要启动PowerFolder服务器,移动到安装目录,到
jboss子目录,到bin 子目录,运行程序run_with_tomcat.bat。
- Logging into the PowerFolder Console. Open a web browser and go to the address
'http://localhost:8080/powerfolder/login'. Enter 'admin' for the user name and password, then
press 'Login'.
登录进入PowerFolder控制台:打开一个浏览器,到地址
'http://localhost:8080/powerfolder/login',输入admin作为用户名和口令,按下
Login按钮。
- Undeploying scripts and web pages. To undeploy scripts, from the PowerFolder Console open
'Administer' then open 'Scripts'. Check the boxes next to the scripts you want to undeploy under
the section 'Deployed Scripts' then click 'Remove Checked Scripts'. To undeploy web pages,
from the PowerFolder Console open 'Administer' then open 'Web Pages'. Check the boxes next
to the web pages you want to undeploy under the section 'Deployed Web Pages' then click
'Remove Checked Web Pages'.
卸载所有脚本和页面。为了卸载脚本,从PowerFolder控制台打开Administer,然后
打开Scripts.在'Deployed Scripts'部分,选中你想卸载的脚本前面的选择框,然后单
击'Remove Checked Scripts'。为了卸载页面,从PowerFolder控制台打开
Administer,接着打开Web Pages。在Deployed Web Pages部分选中你要卸在的页面,
然后单击'Remove Checked Web Pages'。
- Deploying scripts and web pages. To deploy scripts, from the PowerFolder Console open
'Administer' then open 'Scripts'. Check the boxes next to the scripts you want to deploy under the
section 'Available Scripts' then click 'Deploy Checked Scripts'.
- To deploy web pages, from the PowerFolder Console open 'Administer' then open 'Web Pages'.
Check the boxes next to the web pages you want to deploy under the section 'Available Web
Pages' then click 'Deploy Checked Web Pages'.
发布脚本和页面。为了发布脚本,从PowerFolder控制台打开Administer,接着打开
Scripts.在Available Scripts部分选中你想发布的脚本,接着单击'Deploy Checked
Scripts'。为了发布Web页面,从Administer,接着打开Web Pages。从Available Web
Pages部分选中要发布的页面,接着单击'Deploy Checked Web Pages'。
2.3.3 Technical Overview技术概览
2.3.3.1 Diagram流程图
2.3.3.2 Workflow Steps工作流步骤
1) SubmitInvoice - this is where the process starts. If the purchase request is over $10, go to
'NotifyAccounting'. Otherwise, go to 'AutoApprove'.
SubmitInvoice-这是流程启动的地方。如果购买请求超过10美元,移动到
'NotifyAccounting',负责,移动到'AutoApprove'。
2) NotifyAccounting - tell Accounting that is has a specification change to approve.
NotifyAccounting-告诉财务部门有一个规格变化待批准。
3) ApproveInvoice - wait here until Manufacturing approves. Once this wait has been externally
released (via web page), print a message to indicate that the purchase request has been approved.
ApproveInvoice-在财务部门批准之前等待。一旦这个等待被从外部释放(通过Web
页面),打印一个消息来说明请求已经被批准。
4) AutoApprove - print a message to indicate that the purchase request has been approved
without Accounting's input.
AutoApprove - 打印一个消息指出购买请求已经在没有财务部门的输入情况下被批
准。
5) End - this is where the process ends.
End -这是流程结束的地方。
2.3.3.3 User Interface 用户界面
1) AdjustInvoice - allows the accounting department to change the quantities of a purchase
request before approving.
AdjustInvoice -允许财务部门在批准之前改变购买请求的数量。
2) ApproveInvoice - approve the revised purchase order.
ApproveInvoice - 批准修改后的购买订单。
3) EnterInvoice - allow the user to submit a purchase request for new quantities of pencils, paper,
and toner.
EnterInvoice - 允许用来提交购买铅笔,纸张和夹子的请求。
4) SubmitInvoice - response page that appears when a user submits a purchase request. This is
the page the starts the process.
SubmitInvoice - 当用户提交一个购买请求以后的响应页面。这是启动流程的页面
5) ViewInvoices - display all purchase requests that require Accounting's approval ($10 or more).
From here, an accountant can choose one and optionally change its quantities before approving.
ViewInvoices – 显示所有需要财务部门批准的购买请求(10美元或更多)。从这
里一个财务人员可以选择一个请求在批准之前更改它的数量。
2.3.4 Usage使用
1) Open a browser (preferably different than the on with PowerFolder Console) and go to
'http://localhost:8080/ViewInvoices.jsp'. Note the '.jsp' - all web pages in PowerFolder end with
'.jsp' when deployed. You should not see any purchase orders in Accounting's inbox.
打开一个浏览器(与PowerFolder控制台分别打开比较好),到
'http://localhost:8080/StartPrint10Times.jsp'.页面,注意".jsp",在PowerFolder
中,所有的Web页面在发布以后都以jsp来结尾。
2) From the web browser, go to 'http://localhost:8080/EnterInvoice.jsp'. Enter 2, 2, and 1 next to
the boxes 'Pencils', 'Paper', and 'Toner', respectively. Then click 'Submit Invoice'. The total for
this purchase order is under $10.
从web浏览器,到http://localhost:8080/EnterInvoice.jsp,在'Pencils',
'Paper', 和 'Toner'旁边的文本框中分别输入2,2,1。单击Submit Invoice。这个购买
订单的总价低于10美元。
3) Go look at the command console running 'run_with_tomcat.bat'. You should see that this
purchase order was automatically approved.
观察运行run_with_tomcat.bat的命令行控制台。你将看到这个购买订单已经被自动
批准了。
4) From the web browser, go to 'http://localhost:8080/ViewInvoices.jsp'. You should still not see
any purchase orders in Accounting's inbox.
从web浏览器,到http://localhost:8080/ViewInvoices.jsp,你在财务部的收件箱
中,看不到任何的购买订单。
5) From the web browser, go to 'http://localhost:8080/EnterInvoice.jsp'. Enter 3, 1, and 2 next to
the boxes 'Pencils', 'Paper', and 'Toner', respectively. Then click 'Submit Invoice'. The total for
this purchase order is over $10.
从web浏览器,到http://localhost:8080/EnterInvoice.jsp,在'Pencils',
'Paper', 和 'Toner'旁边的文本框中分别输入3,1,2。接着单击Submit Invoice'。这个
购买订单的总价超过了10美元。
6) Go look at the command console running 'run_with_tomcat.bat'. You should see that
Accounting was notified.
观察运行run_with_tomcat.bat的命令行控制台。你可以看到财务部已被通知。
7) From the web browser, go to 'http://localhost:8080/ViewInvoices.jsp'. You should see the
newly entered purchase order. Click the button (ignore the strange ID) next to it.
从web浏览器,到http://localhost:8080/ViewInvoices.jsp。你可以看到新输入的
购买订单。单击它旁边的按钮(忽略那个奇怪的ID号).
8) Change the quantity of 'Pencils' from 3 to 5. Then click 'Approve'.
将Pencils的数量从3改到5,单击Approve
9) Go look at the command console running 'run_with_tomcat.bat'. You should see that
Accounting has approved this purchase order and its total has changed to reflect the new
quantities.
观察运行run_with_tomcat.bat的命令行控制台。你可以看到财务部门已经批准了这
个购买订单而且他的总数反映了新的数量修改。
2.3.5 Results 结果
Go to the PowerFolder console and open 'Administer'. Under the 'Existing Workflows' section
click the 'Find Workflows' button.
移动到PowerFolder控制台,打开'Administer'.在'Existing Workflows'部分下,
单击'Find Workflows'按钮.
Now that you are at the 'PowerFolder Query Workflows' web page, change the contents of
'Query' to '*APP* = 'SubmitInvoice'' (note that you should surround SubmitInvoice with single
quotes) and 'Output' to '*ID*,*APP*,*STATUS*' (pay attention to letter case and don't use any
spaces!), then click 'Submit'.
现在你处于 PowerFolder工作流查询页面,更改'Query'的内容为'*APP* =
'SubmitInvoice''(注意你应当用单引号来环绕SubmitInvoice)而且'Output'的内容为
'*ID*,*APP*,*STATUS*',注意字符的大小写而且不要使用任何空格,然后单击
'Submit'(提交).
You should see two listings - the workflow that was 'AutoApprove'd and the one that required
accounting's approval. The listing should contain a unique id (each workflow gets its own),
'Submit' for the script name, and 'DONE' for its status.
你将看到两个列表-自动批准的工作流和需要财务批准的工作流。列表应该包括一个
唯一的ID(每个工作流有自己的ID), SubmitInvoice 是脚本名称,DONE是它的状态。
Now click the 'Snapshot' button. This will open a new window which will allow you to get much
more detail about the current state of this workflow.
现在单击' Snapshot '(快照)按钮。这将打开一个新的窗口,它将使你得到关于这个
工作流当前状态的更多细节信息
Click 'Attributes' to see all system and script-specific attributes and their current values. For the
purchase request which required accounting's approval, note the updated values for 'Pencils',
'Paper', 'Toner', and 'Total'. Under 'Script' click 'View Graph' and 'View Summary' to get a nice
pictorial and written summary of the script. Click 'Trigger' to see the data (XML) that actually
started the process. The XML has much more information - quantities for pencils, paper, and
toner. Finally, click 'History' and you should see just one trace (no 'branches'). Comparing the
traces of each workflow will show a different path taken.
单击"Attributes"来观察所有的系统和脚本特定属性和他们的当前值。对于需要财
务部门批准的购买请求,注意更改的值'Pencils', 'Paper', 'Toner'和'Total'。在
'Script'下单击'View Graph' 和 'View Summary' 来得到各图形化和书写的关于脚本的
总结。单击"Trigger"来观察XML格式的实际启动流程的数据。XML具有很多信息-铅笔,
纸张和夹子的数量。最后,单击'History',你将会看到仅仅一个路径(没有分支)。展开
每个公共流将显示一个不同的路径。