Commit 9bc985b8 by lizefeng

aims 周转,安全库存不用考虑供应商逾期因素

parent ea8c49c3
...@@ -52,7 +52,7 @@ where 1=1 "; ...@@ -52,7 +52,7 @@ where 1=1 ";
sql = @"select dat.*,t2.oneday_sales,t2.forecast_oneday_sales as 'forecast_oneday_sales2', sql = @"select dat.*,t2.oneday_sales,t2.forecast_oneday_sales as 'forecast_oneday_sales2',
t4.bailun_category_name, t4.bailun_category_name,
( case when t5.`status`=0 or t5.`status` is null then 0 else 1 end ) as 'monitor_status', ( case when t5.`status`=0 or t5.`status` is null then 0 else 1 end ) as 'monitor_status',
(t4.supplier_delivery - t6.virtual_delivery_days) as 'delivery_days_error',t4.weight,t4.unit_price,t7.usable_stock (t4.supplier_delivery - t6.virtual_delivery_days) as 'delivery_days_error',t4.weight,t4.unit_price,t7.usable_stock,t7.shipped_stock
from dc_auto_turnover as dat from dc_auto_turnover as dat
left join dc_auto_sales as t2 on t2.bailun_sku=dat.bailun_sku and dat.warehouse_code = t2.warehouse_code left join dc_auto_sales as t2 on t2.bailun_sku=dat.bailun_sku and dat.warehouse_code = t2.warehouse_code
left join dc_base_warehouse as t3 on dat.warehouse_code = t3.warehouse_code left join dc_base_warehouse as t3 on dat.warehouse_code = t3.warehouse_code
...@@ -66,8 +66,12 @@ where 1=1 "; ...@@ -66,8 +66,12 @@ where 1=1 ";
string sqlCount = @"select count(1) string sqlCount = @"select count(1)
from dc_auto_turnover as dat from dc_auto_turnover as dat
left join dc_base_warehouse as t3 on dat.warehouse_code = t3.warehouse_code left join dc_base_warehouse as t3 on dat.warehouse_code = t3.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on dat.bailun_sku = t5.bailun_sku and dat.warehouse_code = t5.warehouse_code ";
where 1=1 "; if(m.monitor_status != null)
{
sqlCount += " left join dc_auto_config_sku_warehouse as t5 on dat.bailun_sku = t5.bailun_sku and dat.warehouse_code = t5.warehouse_code ";
}
sqlCount += " where 1=1 ";
if (m.categoryModels != null) if (m.categoryModels != null)
......
...@@ -122,7 +122,7 @@ where t1.quantity_out_stock>0 and ( t3.buyer_name in ('张莹霞','张莹霞1',' ...@@ -122,7 +122,7 @@ where t1.quantity_out_stock>0 and ( t3.buyer_name in ('张莹霞','张莹霞1','
} }
/// <summary> /// <summary>
/// 获取采购建议明细列表 /// 获取缺货明细列表
/// </summary> /// </summary>
/// <param name="m"></param> /// <param name="m"></param>
/// <param name="offset"></param> /// <param name="offset"></param>
......
...@@ -47,9 +47,9 @@ namespace AutoTurnOver.Models ...@@ -47,9 +47,9 @@ namespace AutoTurnOver.Models
/// <summary> /// <summary>
/// 手动指定安全库存 /// 手动指定安全库存 ( type 为3时,此处为倍数 )
/// </summary> /// </summary>
public int param { get; set; } public decimal param { get; set; }
/// <summary> /// <summary>
/// 类型 /// 类型
...@@ -72,6 +72,7 @@ namespace AutoTurnOver.Models ...@@ -72,6 +72,7 @@ namespace AutoTurnOver.Models
{ {
仓库_SKU_定值 = 1, 仓库_SKU_定值 = 1,
仓库_分类_定值 = 2, 仓库_分类_定值 = 2,
仓库_按历史计算 = 3,
仓库_SKU_按历史计算 = 11, 仓库_SKU_按历史计算 = 11,
仓库_SKU_按预测计算 = 12 仓库_SKU_按预测计算 = 12
} }
......
...@@ -390,6 +390,9 @@ namespace AutoTurnOver.Models ...@@ -390,6 +390,9 @@ namespace AutoTurnOver.Models
/// </summary> /// </summary>
public decimal? usable_stock { get; set; } public decimal? usable_stock { get; set; }
/// <summary>
/// 已发货数
/// </summary>
public decimal? shipped_stock { get; set; }
} }
} }
...@@ -156,6 +156,11 @@ namespace AutoTurnOver.Models ...@@ -156,6 +156,11 @@ namespace AutoTurnOver.Models
/// 数据中心创建时间 /// 数据中心创建时间
/// </summary> /// </summary>
public DateTime gmt_create { get; set; } public DateTime gmt_create { get; set; }
/// <summary>
/// 已发货数
/// </summary>
public decimal shipped_stock { get; set; }
} }
public class dc_base_stock_dto : dc_base_stock public class dc_base_stock_dto : dc_base_stock
......
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models
{
/// <summary>
/// 无库仓
/// </summary>
public class dc_not_stock
{
public int source { get; set; }
public string bailun_sku { get; set; }
public string product_inner_code { get; set; }
public string sku_title { get; set; }
public string suppliers_link { get; set; }
public string suppliers_name { get; set; }
/// <summary>
/// 昨日销量
/// </summary>
public decimal oneday_sales { get; set; }
/// <summary>
/// 历史7日 日均
/// </summary>
public decimal history_sevenday_sales { get; set; }
/// <summary>
/// 缺货数
/// </summary>
public decimal quantity_out_stock { get; set; }
/// <summary>
/// 可配库存
/// </summary>
public decimal usable_stock { get; set; }
/// <summary>
/// 采购在途
/// </summary>
public decimal quantity_purchase { get; set; }
/// <summary>
/// 最小采购量
/// </summary>
public int moq { get; set; }
/// <summary>
/// 是否成功
/// </summary>
public bool is_success
{
get
{
return history_sevenday_sales >= 1;
}
}
}
public enum source_enum
{
线上 = 1,
线下 = 2,
线下美甲 = 3,
线下供应商 = 4,
登宇分销 = 5,
线上供应商 = 6,
服装产品中心 = 7,
万邑通分销 = 9,
托尼斯分销 = 10
}
}
...@@ -64,19 +64,15 @@ namespace AutoTurnOver.Services ...@@ -64,19 +64,15 @@ namespace AutoTurnOver.Services
return "安全库存必填"; return "安全库存必填";
} }
var cID = 0; var cID = 0;
if(!int.TryParse(m.variable_code,out cID)) if (!int.TryParse(m.variable_code, out cID))
{ {
return "请选择分类"; return "请选择分类";
} }
var cModel = ApiServices.GetCategoryById(cID); var cModel = ApiServices.GetCategoryById(cID);
m.variable_name = cModel.C_CNAME; m.variable_name = cModel.C_CNAME;
} }
else if (m.type==(int)Safe_inventoryType.仓库_SKU_按历史计算 || m.type == (int)Safe_inventoryType.仓库_SKU_按预测计算) else if (m.type == (int)Safe_inventoryType.仓库_SKU_按历史计算 || m.type == (int)Safe_inventoryType.仓库_SKU_按预测计算 || m.type == (int)Safe_inventoryType.仓库_按历史计算)
{
if (string.IsNullOrWhiteSpace(m.variable_code))
{ {
return "Sku不能为空!";
}
if (m.weighting_coefficient_seven <= 0) if (m.weighting_coefficient_seven <= 0)
{ {
return "请填写7天权重"; return "请填写7天权重";
...@@ -95,11 +91,23 @@ namespace AutoTurnOver.Services ...@@ -95,11 +91,23 @@ namespace AutoTurnOver.Services
} }
} }
if (m.type == (int)Safe_inventoryType.仓库_按历史计算)
{
if (m.param <= 0)
{
return "倍数必填";
}
m.variable_code = "";
m.variable_name = "";
}
if (m.type == (int)Safe_inventoryType.仓库_SKU_定值 || m.type == (int)Safe_inventoryType.仓库_SKU_按历史计算 || m.type == (int)Safe_inventoryType.仓库_SKU_按预测计算)
if (m.type == 1 || m.type == 11 || m.type == 12)
{ {
if (string.IsNullOrWhiteSpace(m.variable_code))
{
return "Sku不能为空!";
}
var objProduct = DB.common.GetPrductBySku(m.variable_code); var objProduct = DB.common.GetPrductBySku(m.variable_code);
if (objProduct == null) if (objProduct == null)
{ {
...@@ -408,12 +416,12 @@ namespace AutoTurnOver.Services ...@@ -408,12 +416,12 @@ namespace AutoTurnOver.Services
/// </summary> /// </summary>
/// <param name="id"></param> /// <param name="id"></param>
/// <returns></returns> /// <returns></returns>
public string MonitorStatus(string bailun_sku, string warehouse_code, int monitor_status,UserData user) public string MonitorStatus(string bailun_sku, string warehouse_code, int monitor_status, UserData user)
{ {
return DB.db_config.MonitorStatus(bailun_sku, warehouse_code, monitor_status, user); return DB.db_config.MonitorStatus(bailun_sku, warehouse_code, monitor_status, user);
} }
public string BatchMonitorStatus(string ids,int monitor_status, UserData user) public string BatchMonitorStatus(string ids, int monitor_status, UserData user)
{ {
return DB.db_config.BatchMonitorStatus(ids, monitor_status, user); return DB.db_config.BatchMonitorStatus(ids, monitor_status, user);
} }
......
...@@ -125,7 +125,7 @@ namespace AutoTurnOver.Controllers ...@@ -125,7 +125,7 @@ namespace AutoTurnOver.Controllers
string[] cols = new string[] { "Sku", "采购名称", "中文名", "英文名称","内部编码", "仓库编码", "仓库名称", "货主编码","实时采购在途","实时调拨在途" string[] cols = new string[] { "Sku", "采购名称", "中文名", "英文名称","内部编码", "仓库编码", "仓库名称", "货主编码","实时采购在途","实时调拨在途"
,"订货数量","运输在途","中转仓库存","冻结库存","供应商库存","预售库存","不良品库存","在途库存","收货待检" ,"订货数量","运输在途","中转仓库存","冻结库存","供应商库存","预售库存","不良品库存","在途库存","收货待检"
,"待上架","可配库存","销售可用库存(聚合)","销售可用库存(私有)","销售可用库存(共享)","在仓库存(共享)","在仓库存(私有)","在仓库存(聚合)","仓库占用(共享)" ,"待上架","可配库存","销售可用库存(聚合)","销售可用库存(私有)","销售可用库存(共享)","在仓库存(共享)","在仓库存(私有)","在仓库存(聚合)","仓库占用(共享)"
,"仓库占用(私有)","仓库占用(聚合)","活动占用","单占用(私有)","订单占用(共享)","订单占用(聚合)","环球更新时间","供应商","采购员","重量","单价" ,"仓库占用(私有)","仓库占用(聚合)","活动占用","单占用(私有)","订单占用(共享)","订单占用(聚合)","环球更新时间","供应商","采购员","重量","单价","已发货库存"
}; };
foreach (var item in cols) foreach (var item in cols)
{ {
...@@ -176,7 +176,7 @@ namespace AutoTurnOver.Controllers ...@@ -176,7 +176,7 @@ namespace AutoTurnOver.Controllers
row["采购员"] = itemData.buyer_name; row["采购员"] = itemData.buyer_name;
row["重量"] = itemData.weight; row["重量"] = itemData.weight;
row["单价"] = itemData.unit_price; row["单价"] = itemData.unit_price;
row["已发货库存"] = itemData.shipped_stock;
table.Rows.Add(row); table.Rows.Add(row);
} }
......
...@@ -85,7 +85,8 @@ namespace AutoTurnOver.Controllers ...@@ -85,7 +85,8 @@ namespace AutoTurnOver.Controllers
p.suppliers_name, p.suppliers_name,
p.history_sevenday_sales_ebay, p.history_sevenday_sales_ebay,
p.history_fourteenday_sales_ebay, p.history_fourteenday_sales_ebay,
p.history_thirtyday_sales_ebay p.history_thirtyday_sales_ebay,
p.shipped_stock
}); });
...@@ -189,14 +190,15 @@ namespace AutoTurnOver.Controllers ...@@ -189,14 +190,15 @@ namespace AutoTurnOver.Controllers
p.suppliers_name, p.suppliers_name,
p.history_sevenday_sales_ebay, p.history_sevenday_sales_ebay,
p.history_fourteenday_sales_ebay, p.history_fourteenday_sales_ebay,
p.history_thirtyday_sales_ebay p.history_thirtyday_sales_ebay,
p.shipped_stock
}); });
DataTable table = new DataTable(); DataTable table = new DataTable();
string[] cols = new string[] { "Sku","商品编码", "内部编码", "sku标题", "仓库编码", "仓库名称", "MOQ", string[] cols = new string[] { "Sku","商品编码", "内部编码", "sku标题", "仓库编码", "仓库名称", "MOQ",
"采购在途", "调拨在途", "昨日销量", "明日销量", "未来7天日均", "未来14天日均", "建议采购数", "活动促销数量", "采购在途", "调拨在途", "昨日销量", "明日销量", "未来7天日均", "未来14天日均", "建议采购数", "活动促销数量",
"实际库存", "安全库存", "周转天数", "供应商交期", "质检入库天数", "调拨头程天数", "预测是否断货", "缺货数量","监控状态","供应商","采购员","交期异常", "实际库存", "安全库存", "周转天数", "供应商交期", "质检入库天数", "调拨头程天数", "预测是否断货", "缺货数量","监控状态","供应商","采购员","交期异常",
"过去7天日均","过去14天日均","过去30天日均","重量","单价","实时库存","ebay最近7天日均销量","ebay最近14天日均销量","ebay最近30天日均销量" "过去7天日均","过去14天日均","过去30天日均","重量","单价","实时库存","ebay最近7天日均销量","ebay最近14天日均销量","ebay最近30天日均销量","已发货库存"
}; };
foreach (var item in cols) foreach (var item in cols)
{ {
...@@ -243,6 +245,7 @@ namespace AutoTurnOver.Controllers ...@@ -243,6 +245,7 @@ namespace AutoTurnOver.Controllers
row["ebay最近7天日均销量"] = itemData.history_sevenday_sales_ebay; row["ebay最近7天日均销量"] = itemData.history_sevenday_sales_ebay;
row["ebay最近14天日均销量"] = itemData.history_fourteenday_sales_ebay; row["ebay最近14天日均销量"] = itemData.history_fourteenday_sales_ebay;
row["ebay最近30天日均销量"] = itemData.history_thirtyday_sales_ebay; row["ebay最近30天日均销量"] = itemData.history_thirtyday_sales_ebay;
row["已发货库存"] = itemData.shipped_stock;
table.Rows.Add(row); table.Rows.Add(row);
} }
......
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