sql:='select id,compid,customerid,RShortName,custname,linkman,custphone1,custphone2,SShortName,';
sql:=sql+'SName,SLinkMan,Sphone,SAddress,TypeId,webornot,orderstatus,czoneid,SubCompid,place,';
sql:=sql+'input,sendmsg,collecter,remark,';
sql:=sql+'voice,';
sql:=sql+'CustomerType from viw_OrderInfo where subCompID='''+GLBTEAMID+'''';
//null as ifnew,Null as IfUpLoad,Null as UpLoad,null as IfNewOrder,Null as CustomerType
OpensqlComp(sql, cdsComp);
//更新下载状态
sql:='update Exp_CustomerOrder set ifDownLoad=''T'' ,DownLoadTime='''+DateTimeToStr(now)+'''';
sql:=sql+' where SubCompID ='''+GLBTEAMID+''' and ifDownLoad=''F''';
try
ExecSQLComp(sql,cdsTemp_Comp);
except
DataModule1.SocketConnection1.AppServer.trans(2);
DataModule1.scComp.AppServer.trans(2);
ifError:=true;
exit;
end;
cdsCustomerOrder.Close;
sql:='select id,compid,customerid,RShortName,custname,linkman,custphone1,custphone2,SShortName,';
sql:=sql+'SName,SLinkMan,Sphone,SAddress,TypeId,webornot,orderstatus,czoneid,SubCompid,place,';
sql:=sql+'input,sendmsg,collecter,remark,';
sql:=sql+'voice,';
sql:=sql+'CustomerType from exp_CustomerOrder where 1>2';
cdsCustomerOrder.CommandText:=sql;
cdsCustomerOrder.Open;
cdsCustomerOrder.Data:=cdsComp.Data;
cdsCustomerOrder.applyUpdates(0);