0510

DECLARE @fitemid int
declare @fdcstockid int
declare @fqty decimal(18,10)
declare @fbatchno varchar(50)
DECLARE #point_cursor CURSOR
FOR
select fitemid,FDCStockID,fqty,fbatchno from ICStockBillEntry where finterid = 18605
OPEN #point_cursor
FETCH NEXT FROM #point_cursor INTO @fitemid,@fdcstockid,@fqty,@fbatchno
while @@fetch_status = 0
BEGIN
select fitemid,fstockid,fqty,fbatchno,* from ICInventory where FStockID=@fdcstockid and fbatchno=@fbatchno and fitemid=@fitemid
update ICInventory set fqty=fqty+@fqty where FStockID=@fdcstockid and fbatchno=@fbatchno and fitemid=@fitemid
select fitemid,fstockid,fqty,fbatchno,* from ICInventory where FStockID=@fdcstockid and fbatchno=@fbatchno and fitemid=@fitemid

FETCH NEXT FROM #point_cursor INTO @fitemid,@fdcstockid,@fqty,@fbatchno
END
CLOSE #point_cursor
DEALLOCATE #point_cursor

posted @ 2017-05-10 16:32  许佳挺  阅读(317)  评论(0编辑  收藏  举报