|
楼主 |
发表于 2007-8-13 17:18:33
|
显示全部楼层
procedure TLBPFFXX.InitFFAddNewWorkTypeLBP
{??????????这个过程于下面的过程操作同一张表,方法相同,却能正常运行}
(shiyongqixian:integer;LaoBaoPinGUID,WorkType:string);
var ZhigongDataSet:TSQLDataSet;
begin
{1:根据WorkType 在职工数据集中查询工种=WorkType的职工GUID
2:循环上一步的数据集每一行
2.1:对每个职工都在发放表中插入一条"计划"记录 顺便将 LaoBaoPinGUID
作为字段插入
3:end
}
//DataSetLBPFFSJJ.Create(nil);
//DataSetLBPFFSJJ.SQL.Text:='SELECT * FROM LBPFFB';
DataSetLBPFFSJJ.Close;
DataSetLBPFFSJJ.SQLFilter:='1=0';
DataSetLBPFFSJJ.Filtered:=true;
DataSetLBPFFSJJ.Open;
ZhigongDataSet:=TSQLDataSet.Create(self);
ZhigongDataSet.Database.URL:='Biz:\LBPFF\AQSJK.Database';
with ZhigongDataSet do
begin
SQL.Text:='SELECT * FROM YGXXB where GZ='''+WorkType+'''';
Open;
try
while not Eof do
begin
DataSetLBPFFSJJ.Append;
// DataSetLBPFFSJJ.FieldByName('GUID').AsString := JSCommon.CreateGUIDStr;//没有这句正常运行
DataSetLBPFFSJJ.FieldByName('ZG').AsString:=FieldByName('GUID').AsString;
DataSetLBPFFSJJ.FieldByName('LBP').AsString:=LaoBaoPinGUID;
。。。。
Next;
end;//while
DataSetLBPFFSJJ.ApplyUpdates;
finally
DataSetLBPFFSJJ.Free;
ZhigongDataSet.Free;
end;
end;
end;
{ 新增员工初始化}
static procedure TLBPFFXX.InitFFAddNewEmp(EmployeeID,WorkType:string);
var WorkTypeLaobaoQuery,DataSetLBPFFSJJ:TQuery;
lbp:string;
yxsyqx:integer;
begin
{
1,根据员工的工作种类 ,查找工种老保品所有劳保品的guid ,以及使用期限
2,循环GUID,在发放表中用EmployeeID,和guid填充,并设置状态信息.
}
WorkTypeLaobaoQuery:=TQuery.Create(nil);
DataSetLBPFFSJJ:=TQuery.Create(nil);
with WorkTypeLaobaoQuery do
begin
try
ConnectionString:='DATABASEURL=Biz:\LBPFF\AQSJK.Database';
CommandText:='select * from BMLBPGL where BM='''+WorkType+'''';
Open;
with DataSetLBPFFSJJ do
begin
ConnectionString:='DATABASEURL=Biz:\LBPFF\AQSJK.Database';
CommandText:='select * from LBPFFB where 1=0';
Open;
end;
while not Eof do
begin
lbp:= FieldByName('LBP').AsString;
yxsyqx:= FieldByName('YXSYQX').AsInteger;
with DataSetLBPFFSJJ do
begin
DataSetLBPFFSJJ.Append;
// DataSetLBPFFSJJ.FieldByName('GUID').AsString := JSCommon.CreateGUIDStr;//现在没有这句就出错,与上面操作的是同一个表,同一字段
DataSetLBPFFSJJ.FieldByName('ZG').AsString:=EmployeeID;
。。。
Next;
end; //while
DataSetLBPFFSJJ.ApplyUpdates;
finally
Free;
DataSetLBPFFSJJ.Free;
end; //Try |
|