业务背景:资产盘点模块是客户二开模块;盘点任务0047下达后,各科室资产管理员安排人员进行扫码盘点。1月3号下达年终盘点任务后,计划1月19号盘点完成,但截至到1月19号,只有13个科室盘点单审核完成,还有18个科室的盘点是保存或提交状态。1月19号财务下达抽盘任务0052后,导致未审核的盘点单被覆盖,正值春节假期,人员大多已休假回家,无法配合再重新盘点。
处理步骤:
1、与财务沟通,盘点单的内容必须与之前一致,否则数据会失真
2、与IT沟通,确认每天凌晨2点自动备份,可以申请恢复1月19号凌晨2点的数据库到测试环境
3、金蝶测试环境重新进行数据中心注册,登录金蝶系统查找备份数据
4、通过测试环境的盘点单数据恢复正式环境盘点单的数据,步骤如下
5、首先将正式系统1月0047盘点任务号的盘点单与测试环境1月0047任务号的盘点单导出到Excel进行匹配,管理科室匹配不到的,则表示需要重新生成盘点单;
--根据管理科室未匹配到的,查找盘点任务单错误的单据
SELECT * FROM CT_DJ_InventoryNgBill where CFPDRWH='PDRWD-0055'and CFGLKSID in ('jf8AAAAAE5jM567U', 'jf8AAAAAE9TM567U', 'jf8AAAAAE7PM567U', 'jf8AAAAAE7TM567U', 'jf8AAAAAE7XM567U', 'jf8AAAAAE83M567U', 'jf8AAAAAE53M567U', 'jf8AAAAAE8zM567U', 'jf8AAAKZBXHM567U', 'jf8AAAAAE9nM567U', 'jf8AAAAAE7fM567U', 'jf8AAAAAE6vM567U', 'jf8AAAFZ2yrM567U', 'jf8AAAAA9uPM567U', 'jf8AAAAAE8fM567U', 'jf8AAAAAE7rM567U', 'jf8AAAAAE9XM567U', 'jf8AAAAAE5TM567U' )
6、将正式系统0052盘点任务生成的盘点单删除,盘点任务反审核,删除;
7、复制0047盘点任务单,生成0054任务的盘点单,根据测试账套的管理科室,更新盘点单的盘点任务号,盘点单编号
--更新盘点任务单号
UPDATE CT_DJ_InventoryNgBill SET CFPDRWH='PDRWD-0047' WHERE CFPDRWH='PDRWD-0055'and CFGLKSID in ('jf8AAAAAE5jM567U', 'jf8AAAAAE9TM567U', 'jf8AAAAAE7PM567U', 'jf8AAAAAE7TM567U', 'jf8AAAAAE7XM567U', 'jf8AAAAAE83M567U', 'jf8AAAAAE53M567U', 'jf8AAAAAE8zM567U', 'jf8AAAKZBXHM567U', 'jf8AAAAAE9nM567U', 'jf8AAAAAE7fM567U', 'jf8AAAAAE6vM567U', 'jf8AAAFZ2yrM567U', 'jf8AAAAA9uPM567U', 'jf8AAAAAE8fM567U', 'jf8AAAAAE7rM567U', 'jf8AAAAAE9XM567U', 'jf8AAAAAE5TM567U' )
--更新单据编号
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0475' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE5jM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0476' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE9TM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0477' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE7PM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0479' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE7TM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0480' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE7XM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0481' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE83M567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0484' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE53M567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0485' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE8zM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0489' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAKZBXHM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0491' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE9nM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0492' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE7fM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0493' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE6vM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0497' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAFZ2yrM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0498' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAA9uPM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0499' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE8fM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0500' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE7rM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0502' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE9XM567U'
UPDATE CT_DJ_InventoryNgBill SET FNUMBER='PDD-0503' WHERE CFPDRWH='PDRWD-0047'and CFGLKSID ='jf8AAAAAE5TM567U'
8、导出测试账套相同盘点单的盘点分录信息,根据盘点单编号,更新盘点单分录的实盘数量、盘点人、盘点状态(共18张盘点单需要更新)
--在测试账套查找需要更新盘点单分录
SELECT * FROM CT_DJ_InventoryNgBillEntry where fparentid=(SELECT fid FROM CT_DJ_InventoryNgBill where fnumber='PDD-0475')
--导出数据进行语句更新
UPDATE CT_DJ_InventoryNgBillEntry SET CFSPSL='1', CFPDR2='凌梦宇',CFZCPDZT='10' WHERE fparentid='jf8AAAbXhWlxeQbm' and CFZCBM='DQ-03305453'
9、由于需要重新下达盘点任务单,因此需要将0047盘点任务的盘点单状态改为审核状态。修改之前先进行备份处理。盘点单虽然单据编号相同,但无法和以前的盘点单流程关联,与客户沟通,建议资产管理员后续重新提交单据,重新进入审批流程。待后续抽盘结束,再改回原状态走审批流程。
--查找盘点任务单为0047的盘点单
SELECT * FROM CT_DJ_InventoryNgBill where CFPDRWH='PDRWD-0047'
--备份盘点任务单为0047的盘点单
SELECT * into CT_DJ_InventoryNgBill0120 FROM CT_DJ_InventoryNgBill where CFPDRWH='PDRWD-0047'
--查找备份数据
SELECT * FROM CT_DJ_InventoryNgBill0120
--更新0047的盘点单为审核状态
--update CT_DJ_InventoryNgBill set CFDJZT='40' where CFPDRWH='PDRWD-0047'
推荐阅读