【问题描述】
根据仓库的实际业务,需要修改库存更新控制方式。
【解决方案】
以下举例为现库存更新控制方式为“单据保存后立即更新”,修改为“单据审核后立即更新”的处理步骤,反之步骤相同。
1、审核所有库存单据,暂停业务;
2、执行以下语句更新库存更新控制方式。
if not exists
(select 1 from POStockBill where FStatus=0 and FCancellation = 0 union all
select 1 from ICSTJGBill where FStatus=0 and FCancellation = 0 union all
select 1 from POInStock where FStatus=0 and FCancellation = 0 union all
select 1 from ICStockBill where FStatus=0 and FCancellation = 0 union all
select 1 from ZPStockBill where FStatus=0 and FCancellation = 0 union all
select 1 from ICVMIInStock where FStatus=0)
begin
--更改系统参数表
update t_SystemProfile set fvalue = 0 --0为审核更新,1为保存更新
WHERE fcategory='ic' and fkey='UPSTOCKWHENSAVE'
--更改库存单据表POStockBill、ICSTJGBill、POInStock、ICStockBill、ZPStockBill、ICVMIInStock中字段 fUPSTOCKWHENSAVE 的值,与系统参数表中的值相同
update POStockBill set FUpStockWhenSave = 0
update ICSTJGBill set FUpStockWhenSave = 0
update POInStock set FUpStockWhenSave = 0
update ICStockBill set FUpStockWhenSave = 0
update ZPStockBill set FUpStockWhenSave = 0
update ICVMIInStock set FUpStockWhenSave = 0
--校对即时库存
exec CheckInventory
print('库存更新控制方式变更成功')
end
else
begin
print('账套中还有库存单据未审核,请审核后再执行!')
end
3、执行完成后再继续进行业务。
【注意事项】
变更库存更新控制方式时,切记需将全部库存单据审核完成后再进行变更。