36  
查询码:00001054
启盛sql
作者: 刘波 于 2025年02月13日 发布在分类 / 小精灵pro 下,并于 2025年02月13日 编辑
启盛sql

--使用工具导入数据后执行
--请先确认供应商经营方式完全正常
use qssoft
go
--按供应商经营方式修改商品档案商品经营方式
update a set a.item_sup_flag=b.sale_way from t_bd_item_info a,t_bd_supcust_info b
where a.main_supcust=b.supcust_no and a.item_sup_flag<>b.sale_way
--按供应商经营方式修改机构价格表商品经营方式
update a set a.sale_way=b.sale_way from t_pc_branch_price a,t_bd_supcust_info b
where a.supcust_no=b.supcust_no and a.sale_way<>b.sale_way
--机构价格表的备份表,如果影响行数不对直接无视
update a set a.sale_way=b.sale_way from t_pc_branch_price_back a,t_bd_supcust_info b
where a.supcust_no=b.supcust_no and a.sale_way<>b.sale_way
--按供应商经营方式修改商品与供应商关系表商品经营方式
update a set a.sale_way=b.sale_way from t_bd_supcust_item a,t_bd_supcust_info b
where a.supcust_no=b.supcust_no and a.sale_way<>b.sale_way
--修改联营、租赁商品不管理库存
update t_bd_item_info set item_stock ='1'where item_sup_flag in('C','D') and item_stock <>'1'
go
update  t_pc_branch_price set item_stock ='1'where sale_way in('C','D') and item_stock <>'1'
go
update  t_pc_branch_price_back set item_stock ='1'where sale_way in('C','D') and item_stock <>'1'
go
--修改捆绑商品不管了库存
update t_bd_item_info set item_stock='1' where combine_sta ='1'and item_stock<>'1'
go
update t_pc_branch_price set item_stock='1'where item_no in (select item_no from t_bd_item_info where combine_sta ='1')and item_stock<>'1'
go
update t_pc_branch_price_back set item_stock='1'where item_no in (select item_no from t_bd_item_info where combine_sta ='1')and item_stock<>'1'
go
--修改商品与供应商关系表以商品表主供应商为准(存在一品多商执行会报错)
update a set a.supcust_no=b.main_supcust,a.sale_way=b.item_sup_flag from t_bd_supcust_item a,t_bd_item_info b 
where a.item_no =b.item_no and a.branch_no='00'
go
--补全机构价格表商品信息
insert into t_pc_branch_price (branch_no,item_no,supcust_no,sale_way,price,sale_price,branch_sale,status,direct)
select '00',item_no,main_supcust,item_sup_flag,price,sale_price,'1','1','2'from t_bd_item_info where item_no not in (select item_no from  t_pc_branch_price)
go
--修改供应商状态为正常
update t_bd_supcust_info set status='0',settle_branch='00' where supcust_flag='S'
go
--修改商品门店经营且允许调价(连锁店已经交换过数据需总分店都执行)
update t_bd_item_info set branch_price ='1',branch_sale ='1'
update t_pc_branch_price set branch_price ='1',branch_sale ='1'
--商品勾选是否积分、门店变价、前台议价、前台打折、会员折扣(商品档案表)
update t_bd_item_info set change_price='1',vip_acc_flag='1',en_dis='1',branch_price='1',card_discount='1'
--完善商品类别上级类别列
update t_bd_item_cls set cls_parent =SUBSTRING(item_clsno,1,2)where LEN(item_clsno)=4
go
update t_bd_item_cls set cls_parent =SUBSTRING(item_clsno,1,4)where LEN(item_clsno)=6
go
update t_bd_item_cls set cls_parent =SUBSTRING(item_clsno,1,6)where LEN(item_clsno)=8
go
update t_bd_item_cls set cls_parent =SUBSTRING(item_clsno,1,8)where LEN(item_clsno)=10
go
update t_bd_item_cls set cls_parent =SUBSTRING(item_clsno,1,10)where LEN(item_clsno)=12
go



 推荐知识

 历史版本

修改日期 修改人 备注
2025-02-13 15:49:38[当前版本] 刘波 创建版本

联拓知识分享平台 -V 4.7.0 -wcp