问题描述:在盘点单选择仓库 确认返回时 弹出提示窗口 “仓库结存数和货位结存数不一致,请重新选择仓库”
问题分析 : 此仓库启用了 货位功能 ,提示“系统库存结存与货位总账结存不一致” ;常规处理方法是通过系统中【现存量整理】工具处理就可了,但这次整理还是提示不一致。
经查证系统中 库存结存总量 与 货位总账总量是一致 是 ,判断应该明细对账有问题,需要通过数据追踪工具 查找问题,以下是SQL语句
select freeItem0,freeItem1,freeItem2,freeItem3,freeItem4,freeItem5, freeItem6,freeItem7,freeItem8,freeItem9,Batch,ProductionDate,expiryDate ,idWarehouse, idInventory from (
select freeItem0,freeItem1,freeItem2,freeItem3,freeItem4,freeItem5,freeItem6,freeItem7,freeItem8,freeItem9,Batch,ProductionDate,expiryDate ,idWarehouse, idInventory, sum( SUMbaseQuantity) SUMbaseQuantity ,sum(PositionedQuantity) PositionedQuantity from (SELECT isnull(freeItem0, N”) freeItem0,isnull(freeItem1, N”) freeItem1, isnull(freeItem2, N”) freeItem2,isnull(freeItem3, N”) freeItem3, isnull(freeItem4, N”) freeItem4,isnull(freeItem5, N”) freeItem5, isnull(freeItem6, N”) freeItem6,isnull(freeItem7, N”) freeItem7, isnull(freeItem8, N”) freeItem8,isnull(freeItem9, N”) freeItem9, isnull(Batch, N”) batch,isnull(ProductionDate, N”) ProductionDate,isnull(expiryDate, N”) expiryDate,baseQuantity SUMbaseQuantity,0 as PositionedQuantity , idWarehouse, idInventory FROM ST_currentstock union all SELECT isnull(freeItem0, N”) freeItem0,isnull(freeItem1, N”) freeItem1, isnull(freeItem2, N”) freeItem2,isnull(freeItem3, N”) freeItem3, isnull(freeItem4, N”) freeItem4,isnull(freeItem5, N”) freeItem5, isnull(freeItem6, N”) freeItem6,isnull(freeItem7, N”) freeItem7, isnull(freeItem8, N”) freeItem8,isnull(freeItem9, N”) freeItem9, isnull(Batch, N”) batch,isnull(ProductionDate, N”) ProductionDate,isnull(expiryDate, N”) expiryDate,0 SUMbaseQuantity, baseQuantity PositionedQuantity ,idWarehouse,idInventory FROM ST_locationAccount ) xxxx where idwarehouse= N’4’GROUP BY idWarehouse,idInventory,freeItem0,freeItem1,freeItem2,freeItem3,freeItem4,freeItem5,freeItem6,freeItem7, freeItem8,freeItem9, Batch,ProductionDate,expiryDate) yyyy where SUMbaseQuantity <> PositionedQuantity |
4 为仓库 ID号
通过查询对比发现 批号 有空格。
select * FROM AA_Warehouse — 查询仓库档案
select * FROM AA_Inventory WHERE id=4742 –查询存货档案 select * FROM ST_currentstock where Batch like ‘%T1AB-21070103-01%’ –库存表 select * FROM ST_locationAccount where Batch like ‘%T1AB-21070103-01%’ –库存货位表 |
问题处理:
通过修改语句 修改批号
UPDATE ST_locationAccount SET batch=’T1AB-21070103-01′ where Batch like ‘%T1AB-21070103-01%’ and id=40017 |