-- 作者:czg1981
-- 發(fā)布時間:2010/7/19 18:44:53
-- 前臺銷售傳不到后臺怎么處理?
系統(tǒng)中有前臺服務(wù)器和后臺服務(wù)器,前臺的銷售數(shù)據(jù)是直接傳到前臺服務(wù)器的,而后臺是通過作業(yè)定時從前臺獲取銷售記錄的。分析原因:
1 后臺定時執(zhí)行沒有執(zhí)行,由于數(shù)據(jù)庫的代理服務(wù)沒有啟動或者人為的將作業(yè)停了,導(dǎo)致后臺定時執(zhí)行沒有執(zhí)行;處理辦法,啟動作業(yè),開啟數(shù)據(jù)庫代理的服務(wù)
2 銷售拆分問題:銷售數(shù)據(jù)傳到后臺后,系統(tǒng)會進(jìn)行拆分,拆分完成后,才會在相關(guān)報表中體現(xiàn),才會真正算銷售。銷售拆分出錯是絕大多少銷售沒有傳到后臺的原因。導(dǎo)致這樣的情況一般有下面幾個情況 1、有人修改tb_trans_status,導(dǎo)致記錄已拆分記錄錯誤 處理辦法:修改 tb_trans_status中銷售拆分的id,可以找最大tb_o_sg.c_identity;2、前臺硬件故障,銷售重復(fù)傳送,特征:tb_o_sale.c_guid重復(fù)處理辦法:刪除重復(fù)的c_guid;3、商品后臺不存在,這個一般由于后臺刪除商品后,沒有及時傳到前臺,前臺正好做了銷售,處理辦法:刪除改流水,用正確的商品編碼銷售;4、商品在一個門店存在2個部門,銷售拆分時不知道是哪個部門算哪個部門的銷售,處理辦法:刪除錯誤的部門。
輔助查詢語句:
/*tb_o_sale.c_guid重復(fù)*/
select * from tb_o_sale where c_identity>(select isnull(c_id,0) from tb_trans_status where c_proc=\'銷售分拆\') and exists (select * from tb_o_sg (nolock) where tb_o_sale.c_guid=tb_o_sg.c_guid)
/*一個商品在一個門店存在2個部門*/
select c_store_id,c_gcode,COUNT(*) as c_count from( select tb_o_sale.c_gcode,tb_gdsstore.c_store_id,tb_gdsstore.c_adno from tb_o_sale(nolock),tb_gdsstore(nolock) where c_identity>(select isnull(c_id,0) from tb_trans_status where c_proc=\'銷售分拆\') and tb_o_sale.c_gcode=tb_gdsstore.c_gcode group by tb_o_sale.c_gcode,tb_gdsstore.c_store_id,tb_gdsstore.c_adno )a group by c_store_id,c_gcode having COUNT(*)>1
/*商品編碼后臺不存在*/
select * from tb_o_sale where c_identity>(select isnull(c_id,0) from tb_trans_status where c_proc=\'銷售分拆\') and not exists (select * from tb_gds (nolock) where tb_o_sale.c_gcode=tb_gds.c_gcode)
and c_flag=\'G\'
[此貼子已經(jīng)被作者于2010-12-12 21:10:19編輯過]
|
-- 作者:czg1981
-- 發(fā)布時間:2014/6/25 11:58:59
--
如果不想讓錯誤數(shù)據(jù)影響當(dāng)天銷售,可以建立作業(yè),將錯誤數(shù)據(jù)做好備份,讓剩余數(shù)據(jù)正常拆分,建議一天晚上執(zhí)行一次
if not exists(select * from sysobjects where name=\'tb_o_sale_err\') begin CREATE TABLE [dbo].[tb_o_sale_err]( [c_guid] [varchar](36) NULL, [c_identity] [int] NOT NULL, [c_pos_identity] [int] NULL, [c_id] [int] NOT NULL, [c_computer_id] [int] NOT NULL, [c_datetime] [datetime] NOT NULL, [c_cashier] [varchar](10) NOT NULL, [c_flag] [char](1) NULL, [c_cardno] [varchar](20) NULL, [c_adno] [varchar](10) NULL, [c_gcode] [varchar](13) NOT NULL, [c_subcode] [varchar](10) NOT NULL, [c_pt_cost] [money] NULL, [c_price] [money] NULL, [c_price_pro] [money] NULL, [c_price_disc] [money] NULL, [c_qtty] [decimal](12, 3) NULL, [c_amount] [money] NULL, [c_score] [money] NULL, [c_gds_type] [varchar](20) NULL, [c_pro_status] [varchar](20) NULL, [c_present_name] [varchar](40) NULL, [c_type] [varchar](20) NULL, [c_seller] [varchar](10) NULL, [c_charger] [varchar](10) NULL, [c_in_code] [varchar](20) NULL, [c_note] [varchar](100) NULL, [c_store_id] [varchar](20) NULL ) ON [PRIMARY]
end if exists (select * from tempdb.dbo.sysobjects where id=object_id(\'tempdb..#tb_o_sale\')) BEGIN drop table #tb_o_sale END
select c_guid,MIN(c_identity) as c_identity into #tb_o_sale from tb_o_sale where c_identity>(select isnull(c_id,0) from tb_trans_status where c_proc=\'銷售分拆\') group by c_guid having count(*)>1
insert into tb_o_sale_err( c_guid,c_identity,c_pos_identity,c_id,c_computer_id,c_datetime,c_cashier,c_flag, c_cardno,c_adno,c_gcode,c_subcode,c_pt_cost,c_price,c_price_pro,c_price_disc,c_qtty, c_amount,c_score,c_gds_type,c_pro_status,c_present_name,c_type,c_seller,c_charger, c_in_code,c_note,c_store_id ) select c_guid,c_identity,c_pos_identity,c_id,c_computer_id,c_datetime,c_cashier,c_flag, c_cardno,c_adno,c_gcode,c_subcode,c_pt_cost,c_price,c_price_pro,c_price_disc,c_qtty, c_amount,c_score,c_gds_type,c_pro_status,c_present_name,c_type,c_seller,c_charger, c_in_code,c_note,c_store_id from tb_o_sale(nolock) where c_identity>(select isnull(c_id,0) from tb_trans_status where c_proc=\'銷售分拆\') and (exists (select * from tb_o_sg (nolock) where tb_o_sale.c_guid=tb_o_sg.c_guid) or exists (select c_guid from #tb_o_sale b where tb_o_sale.c_guid=b.c_guid and tb_o_sale.c_identity<>b.c_identity))
delete from tb_o_sale where c_identity>(select isnull(c_id,0) from tb_trans_status where c_proc=\'銷售分拆\') and (exists (select * from tb_o_sg (nolock) where tb_o_sale.c_guid=tb_o_sg.c_guid) or exists (select c_guid from #tb_o_sale b where tb_o_sale.c_guid=b.c_guid and tb_o_sale.c_identity<>b.c_identity))
go
|