6665694 - 2005-11-21 12:45:00
我们的一个客户采用的一个存储过程来进行会员卡卡的xfje(消费金额)、总积分、领取积分、剩余积分的计算,其中jxc_dj_1_pos(前台的零售单大概)内有kh_kmdm_hyk(会员卡),jxc_dj_2_pos中有具体的零售商品的明细,如果spbm='jf',则领取积分=‘jf‘的数量,但是很多情况,明明客户没有领取积分(就是说他没有消费‘jf'商品),但是其领取积分(jf_use)显示领取过,我如何查出到底是什么问题导致的。
这个问题困扰我几个月了,如果您是编程高手,希望能帮帮我!必有重谢!
问题补充:注意:后台SQL server2000数据库(加的sp3a补丁),前台采用的宽带连接,每隔几秒钟就自动上传前台零售单到后台!存储过程上面不全,希望大家给我好的检测方法或者如何修改?程序本身是一个品牌软件,我做过程序的这个存储过程的部分修改!现在偶尔出现的不正常的情况是:比如001会员消费正常的商品,后台会员卡资料中的jf_use却增加了数量。如果001不消费,他的jf_use是不会变化的。似乎是我的程序取数的问题!
万分感谢了!我的qq:33221674
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
/*
零售单批量记数量帐
Written By wjh 2003-05-08
Last Modify: 2003-05-08
*/
ALTER PROCEDURE pos_set_jxc_zb_sp_sl_pro_sum
(@bs integer, --1=实时上传,2=自动或手工上传,3=远程上传,4=所有未记帐单据
@bh varchar(25),
@bm_gsjg varchar(16),
@machine_id varchar(20),
@sError varchar(500) output,
@iResult integer output
)
AS
declare @sfje decimal(14, 2),@max_xh_pos int,@machine_id_pos int, @sql_str varchar(500)
declare @yyyy_jxc varchar(4), @yyyymm_jxc varchar(6),@yyyymm_jxc_dj varchar(6), @mm_jxc varchar(2), @is_find int
declare @kh_kmdm_hyk varchar(20), @kh_kmdm_hyk_xfje decimal(14, 2)
declare @kh_kmdm_hyk_zkjfje decimal(14,2), @kh_kmdm_hyk_zkje decimal(6, 4), @kh_kmdm_hyk_xfze decimal(14,2), @kh_kmdm_hyk_fs int
declare @sp_kmdm varchar(30), @sl_xl decimal(18, 7), @max_bs int, @max_xh int, @is_cx int , @read_bh varchar(25)
declare @l_find integer
---------xyb
declare @jf_je decimal(18, 2) , @jf_je_parm decimal(18, 2), @jf_use decimal(18,2) , @my_use int
----------xyb
set @iResult = -1
--锁
update jxc_sys_lock set datetime_lock = getdate() where bm = 'jz_kcsp_sl'
if @@error < 0 return
select @l_find = count(*) from jxc_dj_1_pos where bh + bm_gsjg in (select bh + bm_gsjg from jxc_dj_1_pos_bk)
if @@error < 0 return
if @l_find 0
begin
set @sError = "零售单据和零售备份单据有相同记录,请与开发商联系!"
return
end
---读取公司机构
select @bm_gsjg = bm from jxc_bm_gsjg where is_default = 1
if @@error < 0 return
---读取系统进销存期间
select @yyyy_jxc = yyyy, @mm_jxc = mm from jxc_yyyymm
if @@error < 0 return
set @yyyymm_jxc = @yyyy_jxc + @mm_jxc
----1=实时上传
if @bs = 1
begin
-- 写前台机器号的最大单号写入后台jxc_dj_max_xh_pos
set @yyyymm_jxc_dj = ''
select @yyyymm_jxc_dj = yyyymm_jxc from jxc_dj_1_pos where bh = @bh and bm_gsjg = @bm_gsjg
if @@error < 0 return
set @max_xh_pos = cast(right(@bh, 6) as int)
set @machine_id_pos = cast(substring(@bh, 2, 2) as int)
select @is_find = count(*) from jxc_dj_max_xh_pos where machine_id = @machine_id_pos
and yyyy = left(@yyyymm_jxc_dj, 4) and mm = right(@yyyymm_jxc_dj, 2) and bm_gsjg = @bm_gsjg
if @@error < 0 return
if @is_find = 0
begin
insert into jxc_dj_max_xh_pos(yyyy, mm,bm_gsjg, machine_id, max_xh)
values(left(@yyyymm_jxc_dj, 4), right(@yyyymm_jxc_dj, 2), @bm_gsjg, @machine_id_pos, @max_xh_pos)
if @@error < 0 return
end
else
begin
update jxc_dj_max_xh_pos set max_xh = @max_xh_pos
where yyyy = left(@yyyymm_jxc_dj, 4) and mm = right(@yyyymm_jxc_dj, 2) and machine_id = @machine_id_pos and bm_gsjg = @bm_gsjg
if @@error < 0 return
end
---写会员卡消费金额
set @kh_kmdm_hyk = ''
set @kh_kmdm_hyk_xfje = 0
select @kh_kmdm_hyk = kh_kmdm_hyk, @kh_kmdm_hyk_xfje = ysje from jxc_dj_1_pos where bh = @bh and bm_gsjg = @bm_gsjg and kh_kmdm_hyk ''
if @@error < 0 return
begin
------------------xyb
select @jf_je = isnull(sum(je),0) from jxc_dj_2_pos join jxc_spbm on (jxc_dj_2_pos.sp_kmdm = jxc_spbm.kmdm )
where bh = @bh and bm_gsjg = @bm_gsjg and sp_kmdm 'jf'
select @jf_use = isnull(sum(sl),0) from jxc_dj_2_pos where bh = @bh and bm_gsjg = @bm_gsjg and sp_kmdm = 'jf' group by sp_kmdm
update jxc_khbm_hyk set xfje = isnull(xfje,0) + @kh_kmdm_hyk_xfje,
jf_sum = isnull(jf_sum,0) + isnull(@jf_je,0)/10,
jf=@bh,
jf_use = isnull(jf_use,0) + isnull(@jf_use,0)
where kmdm = @kh_kmdm_hyk
end
---if @@error < 0 return
© 2000 - 2024 Rising Corp. Ltd.