1、三个视图:注意视图的日期
dbo.VIEW_Inventory_end
dbo.VIEW_Inventory_InOut
dbo.VIEW_Inventory_Invent
2、检查视图dbo.VIEW_Inventory_Invent是否与库存量查询中的一致。
3、--临时表
UPDATE [dbo].[TBL_StockInventoryTemp]
SET PeriodStartAmount = [VIEW_Inventory_end].PeriodEndAmount,[InAmount]=[InCome], [OutAmount]=[OutCome] ,PeriodEndAmount = EndCome
from [VIEW_Inventory_end]
WHERE [TBL_StockInventoryTemp].[MaterialNo] = [VIEW_Inventory_end].[MaterailNo]
And [TBL_StockInventoryTemp].[BranchNo]= 'zc'