Commit 43e3e0e8 by lizefeng

无库仓不出周转建议

parent be9645af
......@@ -27,7 +27,7 @@ namespace AutoTurnOver.DB
return _connection.Query<temp_sku_dto>(@"select t1.bailun_sku,t1.warehouse_code,t1.supplier_id from dc_base_purchase as t1
where t1.supplier_id>0 and buy_status=4
-- and EXISTS ( select * from dc_base_stock as t2 where t1.bailun_sku =t2.bailun_sku and t1.warehouse_code = t2.warehouse_code)
-- and t1.bailun_sku='262412401' and t1.warehouse_code='GZBLWH'
-- and t1.bailun_sku='366628401' and t1.warehouse_code='GZBLWH'
GROUP BY t1.bailun_sku,t1.warehouse_code,t1.supplier_id ");
//return _connection.Query<temp_sku_dto>("select t1.bailun_sku,t1.warehouse_code,t1.supplier_id from dc_base_purchase as t1 where t1.update_time>=@time group by t1.bailun_sku,t1.warehouse_code,t1.supplier_id ", parameters);
}
......
......@@ -293,12 +293,12 @@ left join dc_base_warehouse as dbw on dacp.warehouse_code = dbw.warehouse_code w
try
{
var sql = @"select dacp.* from dc_auto_config_delivery as dacp
left join dc_base_warehouse as dbw on dacp.variable_code = dbw.warehouse_code and type = 3
left join dc_base_warehouse as dbw on dacp.variable_code = dbw.warehouse_code and dacp.type = 3
where 1 = 1 ";
if (!string.IsNullOrWhiteSpace(m.warehousetype))
{
sql += " and dbw.hq_type=" + $"'{m.warehousetype}'";
sql += " and ( dbw.hq_type=" + $"'{m.warehousetype}' or ( dacp.type=4 and dacp.variable_code='"+ m.warehousetype + "' ) ) ";
}
if (m.warehousearea > 0)
{
......@@ -310,12 +310,12 @@ where 1 = 1 ";
}
if (!string.IsNullOrWhiteSpace(m.sku))
{
sql += " and ( type = 1 and dacp.variable_code like '%" + m.sku + "%' )" ;
sql += " and ( ( dacp.type = 1 or dacp.type=2 ) and dacp.bailun_sku like '%" + m.sku + "%' )" ;
}
if (!string.IsNullOrWhiteSpace(m.warehousecode))
{
sql += " and dbw.warehouse_code='" + m.warehousecode + "'";
sql += " and ( dbw.warehouse_code='" + m.warehousecode + "' or ( dacp.type=3 and dacp.variable_code='"+ m.warehousecode + "' ) ) ";
}
total = _connection.ExecuteScalar<int>("select count(0) from (" + sql + ") tb1");
......
......@@ -95,7 +95,7 @@ select
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 view_goods_moq as t7 on t6.product_inner_code = t7.product_inner_code and t1.warehouse_code = t7.warehouse_code and t6.suppliers_id = t7.suppliers_id
where (t1.history_fourteenday_sales>0 or t1.quantity_out_stock>0 ) and ( t5.`status`=0 or t5.`status` is null ) and t7.sum_quantity_init_advise>0 and ( t6.buyer_name not in ('赵美聪','张莹霞','张莹霞1','冯兆欣') or t1.warehouse_code not in ('GZBLWH','GZBLYS') )
where t1.warehouse_code!='BLGZ03' and (t1.history_fourteenday_sales>0 or t1.quantity_out_stock>0 ) and ( t5.`status`=0 or t5.`status` is null ) and t7.sum_quantity_init_advise>0 and ( t6.buyer_name not in ('赵美聪','张莹霞','张莹霞1','冯兆欣') or t1.warehouse_code not in ('GZBLWH','GZBLYS') )
) as t1 where t1.quantity_final_advise>0
)
......@@ -195,7 +195,7 @@ 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 ('赵美聪','张莹霞','张莹霞1') and t1.warehouse_code in ('GZBLWH','GZBLYS') )
where ( ( t6.buyer_name in ('赵美聪','张莹霞','张莹霞1') and t1.warehouse_code in ('GZBLWH','GZBLYS') ) or t1.warehouse_code='BLGZ03' )
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) )
......@@ -344,7 +344,7 @@ select
t1.*,t2.warehouse_name,t3.sku_title_cn as 'sku_name',t4.create_time,t3.buyer_name,
(t5.quantity_safe_inventory) as 'quantity_safe_inventory', -- 安全库存
(t5.daily_weighted_sales) as 'daily_weighted_sales', -- 日均加权
(t1.quantity_out_stock) as 'quantity_out_stock', -- 缺货
(t7.quantity_out_stock) as 'realtime_quantity_out_stock', -- 实时缺货
(t5.quantity_transfer) as 'quantity_transfer', -- 调拨在途
(t5.quantity_purchase) as 'quantity_purchase', -- 采购在途
......
......@@ -17,7 +17,7 @@ namespace AutoTurnOver.Models
public string variable_name { get; set; }
/// <summary>
/// 类型(1.SKU ,2.分类 3. 仓库计算)
/// 类型(1.仓库编码+SKU ,2.仓库类型+SKU 3. 仓库编码, 4 .仓库类型)
/// </summary>
public int type { get; set; }
......@@ -45,6 +45,8 @@ namespace AutoTurnOver.Models
/// </summary>
public decimal abroad_inbound { get; set; }
public string bailun_sku { get; set; }
}
public class dc_auto_config_delivery_dto : dc_auto_config_delivery
......@@ -54,10 +56,12 @@ namespace AutoTurnOver.Models
public enum type_enum
{
SKU = 1,
产品分类 = 2,
仓库 = 3
仓库编码_SKU = 1,
仓库类型_SKU = 2,
仓库 = 3,
仓库类型 = 4
}
}
......
......@@ -308,21 +308,8 @@ namespace AutoTurnOver.Services
}
m.variable_name = objWarehouse.warehouse_name;
}
else if (m.type == (int)dc_auto_config_delivery_dto.type_enum.产品分类)
{
if (string.IsNullOrWhiteSpace(m.variable_code))
{
return "请选择分类";
}
var cID = 0;
if (!int.TryParse(m.variable_code, out cID))
{
return "请选择分类";
}
var cModel = ApiServices.GetCategoryById(cID);
m.variable_name = cModel.C_CNAME;
}
else if (m.type == (int)dc_auto_config_delivery_dto.type_enum.SKU)
else if (m.type == (int)dc_auto_config_delivery_dto.type_enum.仓库编码_SKU)
{
if (string.IsNullOrWhiteSpace(m.variable_code))
{
......
......@@ -139,10 +139,10 @@ namespace AutoTurnOver.Controllers
#endregion
#region 供应链长度规则
#region 调拨天数配置
/// <summary>
/// 获取供应链长度列表
/// 获取调拨天数配置列表
/// </summary>
/// <param name="limit">每页记录数</param>
/// <param name="offset">偏移量</param>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment