2,497
社区成员
发帖
与我相关
我的任务
分享
if (self.cdsHead.Active=false) or (self.cdsList.Active=false) then
begin
showmessage('数据集没有开启不能提交更新。');
exit;
end;
try
if self.cdsHead.ApplyUpdates(0)=0 then
if self.cdsList.ApplyUpdates(0)=0 then
if self.cdsPurchase.ApplyUpdates(0)=0 then
begin
application.MessageBox('提交服务器更新成功。','提示');
end;
except
on E: exception do
showmessage('提交服务器更新出错。'+E.Message);
end;
//更新完成后重新读取数据
cdspurchase.Active:=false;
cdspurchase.CommandText:='UPDATE tbpurchaselist b, tborderlist a '
+'SET b.`autoNumber`=a.`AutoNumber` WHERE '
+'(b.`orderNo`=a.orderno) AND (b.`autono`=a.`AutoNo`)';
cdspurchase.Execute;
self.cdsList.Close;
self.cdsList.CommandText:=
'SELECT a.`AutoNumber`,a.`AutoNo`,a.`GroupMemo`,a.`itemno`,a.`PartNumber`,'
+'a.`CDes`,a.`CQuantity`,a.`CUnit`,a.`Price`,a.`Amount`,a.`CRemark`,'
+'b.`MyCode`,b.`MyDesEN`,b.`MyDesCHN`,b.`MyUnit`,b.`MyQty` ,'
+'b.`autoNumber`,b.`supplycode`,b.`supplyname`,b.`costprice`,'
+'b.`costCurrency`,b.`discount`,b.`costSum`,b.`sremark`,b.`orderno`,'
+'a.`machinetype`,b.`PONo`,b.`Purchased`,b.`Recieved` ,b.`itemno` '
+'FROM tborderlist a LEFT JOIN tbpurchaselist b'
+' ON a.`AutoNumber`=b.`autoNumber` '
+'where a.Orderno="'+ getOrderno + '" order by autono';
self.cdsList.Active := true;
//self.cdslist.indexfieldnames:='autono';
//showmessage('重新读取的记录行数:'+inttostr(self.cdslist.recordcount));
clearrows(sgList);
readDataset(self.cdsList); // 把数据库的记录读取到表格中