vardc_base_stock_fba_share=_connection.QueryFirstOrDefault<dc_base_stock_fba_share>(" select * from dc_base_stock_fba_share where platform_sku=@platform_sku limit 1 ",new{platform_sku=m.platform_sku});
if(dc_base_stock_fba_share==null)
{
thrownewException(" 未找到与之对应的百伦sku数据 ");
}
varobj=_connection.QueryFirstOrDefault<Models.dc_base_stock_config_fba>("select * from dc_base_stock_config_fba where id="+m.id);
varoldData=_connection.QueryFirstOrDefault(" select * from dc_base_stock_config_fba where platform_sku=@platform_sku and id!=@id ",new{m.platform_sku,m.id});
if(oldData!=null)
{
return$" 平台sku:【{m.platform_sku}】 已经配置过了 ";
}
try
{
_connection.Execute(" delete from dc_base_stock_config_fba_lose where platform_sku=@platform_sku ",new{platform_sku=obj.platform_sku});
@@ -193,8 +193,8 @@ where t1.bailun_sku = t2.bailun_sku and quantity_final_advise=1 and quantity_ini
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
left join dc_base_sku as t6 on t1.bailun_sku = t6.bailun_sku
left join dc_mid_transit as t7 on t1.bailun_sku = t7.bailun_sku and t1.warehouse_code = t7.warehouse_code
where t6.buyer_name in ('赵美聪') and ( t5.`status`=0 or t5.`status` is null )
and t1.warehouse_code in ('GZBLWH','GZBLYS')
where ( t6.buyer_name in ('赵美聪') and t1.warehouse_code in ('GZBLWH','GZBLYS') )
and ( t5.`status`=0 or t5.`status` is null )
GROUP BY t1.bailun_sku
HAVING ( sum((case when t7.quantity_out_stock>0 then 0 else t1.quantity_inventory end )) + sum(t1.quantity_transfer) + sum(t1.quantity_purchase) < sum(t7.quantity_out_stock) )
...
...
@@ -314,7 +314,7 @@ where ( t5.`status`=0 or t5.`status` is null ) and t1.quantity_begin_advise>0 an
{
sql=@"
select
sum(t5.quantity_safe_inventory) as 'quantity_safe_inventory', -- 日均加权销量
sum(t5.quantity_safe_inventory) as 'quantity_safe_inventory', -- 安全库存
sum(t5.quantity_out_stock) as 'quantity_out_stock', -- 缺货
sum(t5.quantity_transfer) as 'quantity_transfer', -- 调拨在途
sum(t5.quantity_purchase) as 'quantity_purchase', -- 采购在途
@@ -749,6 +749,52 @@ left join china_warehouse_stock as t3 on t1.bailun_sku = t3.bailun_sku and t_db.
left join china_warehouse_unshipped as t4 on t1.bailun_sku = t4.bailun_sku and t_db.hq_type='国内仓'
where ( t_db.hq_type!='国内仓' or t2.buyer_name not in ('张莹霞','张莹霞1') ) and t_db.hq_type!='fba仓' and (case when t_db.hq_type='国内仓' then (ifnull(t4.sum_unshipped_quantity,0) - ifnull(t3.sum_usable_stock,0)) else t1.quantity_out_stock end )>0
) ");
_connection.Execute(@" -- 刷新在途
set session transaction isolation level read uncommitted;
start transaction;
-- 清空视图表的数据
Truncate table dc_auto_purchase_ontheway_temp;
INSERT into dc_auto_purchase_ontheway_temp(`bailun_sku`,`warehouse_code`,`purchase_id`,`estimated_arrival_time`,`count`) (
SELECT
tb1.bailun_sku AS bailun_sku,
tb1.warehouse_code AS warehouse_code,
tb1.purchase_id AS purchase_id,
tb1.estimated_arrival_time AS estimated_arrival_time,
LEFT JOIN ( SELECT bailun_sku, warehouse_code, parent_id, sum( count ) AS count FROM dc_base_purchase_inbound GROUP BY bailun_sku, parent_id ) tb2 ON tb1.bailun_sku = tb2.bailun_sku
AND tb1.parent_id = tb2.parent_id
GROUP BY
tb1.bailun_sku,
tb1.warehouse_code,
tb1.purchase_id
);
alter table dc_auto_purchase_ontheway rename dc_auto_purchase_onthewayTemp;
alter table dc_auto_purchase_ontheway_temp rename dc_auto_purchase_ontheway;
alter table dc_auto_purchase_onthewayTemp rename dc_auto_purchase_ontheway_temp;
return_connection.Query<dc_base_oms_order>(" select platform_type,transaction_id,origin_order_id,bailun_order_id from dc_base_oms_order where bailun_order_id in @bailun_order_ids ",new