我正在尝试创建一个包含TMS工作流程的网站。在尝试执行工作流程时,我坚持使用EOSError 1400问题。单击按钮启动工作流程,然后转到WorkflowStudio1TaskCreated过程并继续到WorkflowStudio1SendMail。然后它崩溃了上面提到的错误。我做错了什么?
单位代码:
unit Unit1;
interface
uses
Classes, SysUtils, IWAppForm, IWApplication, IWColor, IWTypes,
Data.DBXFirebird, FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error,
FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool,
FireDAC.Stan.Async, FireDAC.Phys, FireDAC.Phys.FB, FireDAC.Phys.FBDef,
FireDAC.VCLUI.Wait, FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf,
FireDAC.DApt, Vcl.Controls, IWVCLBaseControl, IWBaseControl,
IWBaseHTMLControl, IWControl, IWCompButton, Data.DB, FireDAC.Comp.DataSet,
FireDAC.Comp.Client, Data.SqlExpr, wsDB, wsDbx, wsClasses, wsMain;
type
TIWForm1 = class(TIWAppForm)
WorkflowStudio1: TWorkflowStudio;
WorkflowDBXDB1: TWorkflowDBXDB;
SQLConnection1: TSQLConnection;
FDConnectionTMS: TFDConnection;
FDQueryGET: TFDQuery;
FDQueryUPDADTE: TFDQuery;
FDConnectionMedusa: TFDConnection;
FDQueryGetUsers: TFDQuery;
FDQueryUsers: TFDQuery;
FDConnectionUPRO: TFDConnection;
FDQueryGetUser: TFDQuery;
qryInsertObject: TFDQuery;
qryGetZapoUsers: TFDQuery;
qryGetMedusaUsers: TFDQuery;
qryGetEmail: TFDQuery;
IWButton1: TIWButton;
procedure IWButton1Click(Sender: TObject);
procedure WorkflowStudio1TaskCreated(Sender: TObject;
ATaskIns: TTaskInstance);
procedure WorkflowStudio1SendMail(Sender: TObject; TaskIns: TTaskInstance;
AUser: TWorkflowUser; AEmailInfo: TEmailInformation; var Sent: Boolean);
public
end;
implementation
{$R *.dfm}
procedure TIWForm1.IWButton1Click(Sender: TObject);
var
Wrkins : TWorkflowInstance;
t : TTaskInstance;
begin
WorkflowStudio1.UserManager.Users.Add('1', 'Someone', 'temp@tempo.si');
Wrkins := WorkflowStudio1.WorkflowManager.CreateWorkflowInstanceByName('Temp');
Wrkins.Diagram.Variables.FindByName('User').Value := WorkflowStudio1.UserManager.Users.FindById('1').UserName;
WorkflowStudio1.WorkflowEngine.RunWorkflow(Wrkins);
end;
procedure TIWForm1.WorkflowStudio1SendMail(Sender: TObject;
TaskIns: TTaskInstance; AUser: TWorkflowUser; AEmailInfo: TEmailInformation;
var Sent: Boolean);
begin
WebApplication.ShowMessage('send mail');
Sent := True;
end;
procedure TIWForm1.WorkflowStudio1TaskCreated(Sender: TObject;
ATaskIns: TTaskInstance);
begin
WebApplication.ShowMessage('Task ' + ATaskIns.Key + ' created');
end;
initialization
TIWForm1.SetAsMainForm;
end.
ServerControl:
unit ServerController;
interface
uses
SysUtils, Classes, IWServerControllerBase, IWBaseForm, HTTPApp,
// For OnNewSession Event
UserSessionUnit, IWApplication, IWAppForm, IW.Browser.Browser;
type
TIWServerController = class(TIWServerControllerBase)
procedure IWServerControllerBaseNewSession(ASession: TIWApplication);
private
public
end;
function UserSession: TIWUserSession;
function IWServerController: TIWServerController;
implementation
{$R *.dfm}
uses
IWInit, IWGlobal;
function IWServerController: TIWServerController;
begin
Result := TIWServerController(GServerController);
end;
function UserSession: TIWUserSession;
begin
Result := TIWUserSession(WebApplication.Data);
end;
procedure TIWServerController.IWServerControllerBaseNewSession(
ASession: TIWApplication);
begin
ASession.Data := TIWUserSession.Create(nil, ASession);
end;
initialization
TIWServerController.SetServerControllerClass;
end.
在UserSessionUnit中没有添加任何内容
答案 0 :(得分:1)
只是不要试图将所有内容都放入Web应用程序中。相反,您可以创建一个承载TMS工作流组件的单线程/单用户VCL或控制台应用程序,并通过某些进程间通信(IPC)接口与Intraweb进程通信。
这是复杂Web应用程序的常见方法,它也使用异步处理,而不是在HTTP请求的上下文中执行所有操作。
阅读例如:Dopplr: - It's made of messages(slideshare presentation)