對應(yīng)連鎖企業(yè)來說,我們系統(tǒng)在總部來統(tǒng)一修改參數(shù),然后由系統(tǒng)自動下發(fā)到每一個門店,這樣提高了我們的工作效率,但是有時候不小心把一些相對獨立的參數(shù)也一起下發(fā)了,比如店代碼.
店代碼修改后影響的數(shù)據(jù):用戶進(jìn)入系統(tǒng)的權(quán)限,值單機(jī)構(gòu)等;流水方面需要修改非自營商品的扣率,銷售成本,店代碼等
流水方面涉及的表有:tb_o_sg, tb_o_sm,tb_o_sg_today,tb_cursale
參考語句:
select * into #tb_o_sg
from tb_o_sg
where c_store_id='1'
and datediff(day,c_datetime,getdate())=0
update #tb_o_sg
set c_deduct_rate=case when b.c_prom_deduct_rate<>0 then b.c_prom_deduct_rate else b.c_deduct_rate end,
c_pt_cost=round(#tb_o_sg.c_price_disc*(1-0.01*case when b.c_prom_deduct_rate<>0 then b.c_prom_deduct_rate else b.c_deduct_rate end),2)
from tb_gdsprovider b
where #tb_o_sg.c_gds_type like '自營%'
and #tb_o_sg.c_gcode=b.c_gcode
and b.c_status='主供應(yīng)商'
update tb_o_sg
set c_deduct_rate=b.c_deduct_rate,c_pt_cost=b.c_pt_cost,c_store_id=dbo.uf_store_id()
from #tb_o_sg b
where tb_o_sg.c_guid=b.c_guid
update tb_o_sg_today
set c_deduct_rate=b.c_deduct_rate,c_pt_cost=b.c_pt_cost,c_store_id=dbo.uf_store_id()
from #tb_o_sg b
where tb_o_sg.c_guid=b.c_guid
update tb_o_sm
set c_store_id=dbo.uf_store_id()
where c_store_id='1'
and datediff(day,c_datetime,getdate())=0
delete tb_cursale
where datediff(day,c_datetime,getdate())=0