procedure TForm1.AdjustGoodsOver(ISPackage:boolean;MinUserDateDiff: string;
UserDateDiff:MyIntArr;SiteID: MySmlIntArr);
var I, J: Integer;
RtnRecCount:integer;
RTabName,OTabname,RtabItemName,OtabItemName,TimeField:string;
RFeeItem,RDistance,RPayMethod:string;
OFeeItem,ODistance,OPayMethod:string;
MySql:string;
begin
//=================对SITE字段的修改================================
Try
SybaseCon.StartTransaction ;
for I := High(SiteID)do
wnto Low(SiteID)do
begin
Qry_AdjustGoods.SQL.Clear ;
MySql:=' Update '+OTabName+' Set Site='+ inttostr(SiteID);
MySql:=MySql+' where DateDiff(day, TrainTime, getdate()) >= ' + intToStr(UserDateDiff) ;
if I<high(SiteID) then
MySql:=MySql+' and DateDiff(day, TrainTime, getdate()) <' + intToStr(UserDateDiff[i+1]);
WriteToTxt(Mysql);
Qry_AdjustGoods.SQL.Add(MySql);
Qry_AdjustGoods.ExecSQL ;
ShowMessage(inttostr( Qry_AdjustGoods.RowsAffected ));//返还影响的记录数目
end;
sybasecon.Commit ;
except
on E:Exceptiondo
begin
sybasecon.Rollback ;
showmessage ('修改超期库位代码提交出错,回滚!:'+#13+#10+inttostr(e.HelpContext)+':'+e.Message);
end;
end;
end;
--------------------------------------------------------------
procedure TForm1.N1Click(Sender: TObject);
var A:MySmlIntArr;//array of smallint;//用户的时间间隔
B:MyIntArr;//array of integer;
//用户的超期间隔的Site库中的ID
Qry_Site:TSDQuery;
I,J,N:integer;
TmpStr:string;
begin
Qry_Site:=TSDQuery.Create (nil);
Qry_Site.DatabaseName:='lpmis';
Qry_Site.SQL.clear;
Qry_Site.Sql.add('select Id,Name from Site_O where Pr_id >0 order by Id');
Qry_Site.Open;
if Qry_Site.RecordCount >0 then
begin
Qry_Site.Last ;
Qry_Site.First ;
end;
J:= Qry_Site.RecordCount-1;
Setlength(A,0);
SetLength(B,0);
for I :=0 to Jdo
begin
setLength(A,I+1);
setLength(B,I+1);
TmpStr:=Qry_Site.FieldByName('Name').AsString;
N:=Qry_Site.FieldByName('Id').AsInteger ;
//加入Tmpstr筛选出数字的过程
A:=strtoint(TmpStr);
B:=N;
Qry_Site.Next ;
end;
AdjustGoodsOver(True,'90',A,B);
AdjustGoodsOver(False,'90',A,B);
A:=nil;B:=nil;
Qry_Site:=nil;
end;