问题现象:821版一月份存货结账时提示“结账失败”,17仓库1月份取消期末处理时提示错误。
解决方案:取消期末处理问题: 存货核算存货明细帐中存在非法记录,仓库17中部分记录中收入金额和发出金额皆为空, SELECT+ *, iAInPrice AS Expr1, iAOutPrice AS Expr2 FROM IA_Subsidiary WHERE iAInPrice IS NULL AND iAOutPrice IS NULL ,查询收发存主子表rdrecord/rdrecords,该些存货收发记录信息, select * from rdrecord a join rdrecords b on a.id=b.id and b.autoid in SELECT+ distinct id FROM IA_Subsidiary WHERE iAInPrice IS NULL AND iAOutPrice IS NULL ,部分出库单存在单价、金额都为空的表体行2000100008/6591、2000100015/6605、2000100044/6676、2000100077/6775、2000100078/6780,对应出入库单号/子表记录AutoId。 首先调整收发存子表中空记录, update rdrecords set iunitcost=0,iprice=0 where autoid in SELECT+ distinct id AS Expr2 FROM IA_Subsidiary WHERE iAInPrice IS NULL AND iAOutPrice IS NULL ,再调整存货核算存货明细帐中收入金额和发出金额都为NULL记录, update IA_Subsidiary set iAInPrice=0, iAOutPrice=0 WHERE iAInPrice IS NULL AND iAOutPrice IS NULL ,对仓库17执行取消期末处理,修改库存系统中错误的出/入库单具体单据号见上,即填写上正确的单价、金额,重新在存货模块中单据记账,再对仓库17进行期末处理; 月末结账问题: 执行月末结账存储过程时, Exec IA_Close 1,‘2003-02-01‘,1,4,2,‘demo‘,0,1,0 提示错误信息如下{ 服务器: 消息 547,级别 16,状态 1,行 1 INSERT+ 语句与 COLUMN FOREIGN KEY 约束 ‘FK__IA_Summar__cInvC__6B3AC472‘ 冲突。该冲突发生于数据库 ‘UFDAT+A_006_2003‘,表 ‘Inventory‘, column ‘cInvCode‘。 语句已终止。} 跟踪查询发现存货档案表Inventory中丢失存货记录,存货编码为“100-S52A-0025-DSN”,在数据表Ia_summary、Ia_subsidiary、rdrecords中均存在该存货信息。 在存货档案中恢复丢失存货记录,且存货编码必须为100-S52A-0025-DSN,执行月末结账即可。 查询存货档案表中丢失存货记录的Sql语句如下, 根据存货总帐查询select distinct cinvcode from ia_summary where cinvcode not in select cinvcode from inventory 根据存货核算存货明细帐查询select distinct cinvcode from ia_subsidiary where cinvcode not in select cinvcode from inventory 根据库存收发存子表查询select distinct cinvcode from rdrecords where cinvcode not in select cinvcode from inventory