码迷,mamicode.com
首页 > 其他好文 > 详细

0117-01

时间:2019-01-17 14:05:31      阅读:204      评论:0      收藏:0      [点我收藏+]

标签:bsp   rom   date   ids   rod   nbsp   Inventor   price   disabled   

/**这是将销售价异常的或者品牌为空的产品信息导出来 ---
未上架产品信息*/
select
i.priuserdefnvc4 as APP分类
,case when i.productInfo is null then ‘品牌为空‘ else ‘‘ end as 品牌
,case when p.invSCost1 < ‘1‘ or p.invSCost1 is null then ‘APP销售价异常‘ else ‘‘ end as APP售价
,i.code as 编号
,i.name as 存货名
,i.specification as 规格
-- ,i.name+‘(‘+u.name+‘)‘ as goods_info_name
,u.name as 单位
,u.changeRate as 转换率
,getdate() as 检查时间
from AA_InventoryPrice p right join dbo.AA_Inventory i on i.id = p.idinventory
left join [eap_userdefinearticledto_0001] appc on appc.name = i.priuserdefnvc4
left join dbo.AA_Unit u on p.idunit = u.id
left join (select idbaseunit,idinventory,sum(baseQuantity) baseQuantity from ST_CurrentStock where idwarehouse in (2,3) group by idbaseunit,idinventory) cs on i.id = cs.idinventory
left join (select sob.idinventory,sum(baseQuantity) as saleQuantity from SA_SaleOrder_b sob inner join SA_SaleOrder so on sob.idSaleOrderDTO = so.id left join [SA_SaleDelivery] sd on so.code = sd.SourceVoucherCode
where sd.code is null group by sob.idinventory) ss on ss.idinventory = i.id
left join eap_enumItem b on b.idEnum= N‘32‘ and i.productInfo = b.id
where -- i.disabled = 0 and p.invSCost1 is not null and
i.priuserdefnvc4 is not null and i.priuserdefnvc4 > ‘‘ -- APP分类已设置
and( p.invSCost1 <‘1‘ or p.invSCost1 is null -- 有APP销售价
or i.productInfo is null or i.productInfo =‘‘ ) -- 品牌不为空
and i.disabled = 0 -- 非停用商品
-- and i.code= ‘010406‘
-- and p.id = 281
-- and appc.code is null
order by i.code,u.name

 

select
i.priuserdefnvc4 as APP分类
,case when i.productInfo is null then ‘品牌为空‘ else ‘‘ end as 品牌
,case when p.invSCost1 < ‘1‘ or p.invSCost1 is null then ‘APP销售价异常‘ else ‘‘ end as APP售价
,i.code as 编号
,i.name as 存货名
,i.specification as 规格
-- ,i.name+‘(‘+u.name+‘)‘ as goods_info_name
,u.name as 单位
,u.changeRate as 转换率
,getdate() as 检查时间
from AA_InventoryPrice p right join dbo.AA_Inventory i on i.id = p.idinventory
left join [eap_userdefinearticledto_0001] appc on appc.name = i.priuserdefnvc4
left join dbo.AA_Unit u on p.idunit = u.id
left join (select idbaseunit,idinventory,sum(baseQuantity) baseQuantity from ST_CurrentStock where idwarehouse in (2,3) group by idbaseunit,idinventory) cs on i.id = cs.idinventory
left join (select sob.idinventory,sum(baseQuantity) as saleQuantity from SA_SaleOrder_b sob inner join SA_SaleOrder so on sob.idSaleOrderDTO = so.id left join [SA_SaleDelivery] sd on so.code = sd.SourceVoucherCode
where sd.code is null group by sob.idinventory) ss on ss.idinventory = i.id
left join eap_enumItem b on b.idEnum= N‘32‘ and i.productInfo = b.id
where -- i.disabled = 0 and p.invSCost1 is not null and
i.priuserdefnvc4 is not null and i.priuserdefnvc4 > ‘‘ -- APP分类已设置
and( p.invSCost1 <‘1‘ or p.invSCost1 is null -- 有APP销售价
or i.productInfo is null or i.productInfo =‘‘ ) -- 品牌不为空
and i.disabled = 0 -- 非停用商品
-- and i.code= ‘010406‘
-- and p.id = 281
-- and appc.code is null
order by i.code,u.name

--------------------------------------------------------------------------
alter table AA_Inventory add check (safeQuantity>lowQuantity and safeQuantity<topQuantity)

select

0117-01

标签:bsp   rom   date   ids   rod   nbsp   Inventor   price   disabled   

原文地址:https://www.cnblogs.com/danJuly/p/10281712.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!