Commit 87daf67f by 泽锋 李

fba库存,总库存计算fix

parent 5063d0e3
...@@ -669,8 +669,8 @@ t3.buyer_name,t3.unit_price,t3.weight, ...@@ -669,8 +669,8 @@ t3.buyer_name,t3.unit_price,t3.weight,
t6.quantity_purchase,t6.quantity_transfer,t6.quantity_transfer_order,t6.quantity_transfer_temp_schedule,t6.quantity_transfer_temporary_storage,(t6.quantity_purchase+t6.quantity_transfer) as 'sum_mid', t6.quantity_purchase,t6.quantity_transfer,t6.quantity_transfer_order,t6.quantity_transfer_temp_schedule,t6.quantity_transfer_temporary_storage,(t6.quantity_purchase+t6.quantity_transfer) as 'sum_mid',
ts1.usable_stock as 'usable_stock_01',ts2.usable_stock as 'usable_stock_02', t2.usable_stock, ts1.usable_stock as 'usable_stock_01',ts2.usable_stock as 'usable_stock_02', t2.usable_stock,
((t6.quantity_purchase+t6.quantity_transfer)*t3.unit_price) as 'sum_mid_amount',( t2.usable_stock*t3.unit_price) as 'usable_stock_amount', ((t6.quantity_purchase+t6.quantity_transfer)*t3.unit_price) as 'sum_mid_amount',( t2.usable_stock*t3.unit_price) as 'usable_stock_amount',
((t6.quantity_purchase+t6.quantity_transfer+t2.usable_stock)*t3.unit_price) as 'sum_amount', ((ifnull(t6.quantity_purchase,0)+ifnull(t6.quantity_transfer,0)+t2.usable_stock)*t3.unit_price) as 'sum_amount',
((t6.quantity_purchase+t6.quantity_transfer+t2.usable_stock)) as 'sum_stock' ((ifnull(t6.quantity_purchase,0)+ifnull(t6.quantity_transfer,0)+t2.usable_stock)) as 'sum_stock'
from dc_config_fba_extend as t1 from dc_config_fba_extend as t1
left JOIN dc_base_stock as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code left JOIN dc_base_stock as t2 on t1.bailun_sku = t2.bailun_sku and t1.warehouse_code = t2.warehouse_code
left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku left join dc_base_sku as t3 on t1.bailun_sku = t3.bailun_sku
......
using AutoTurnOver.Models;
using Dapper;
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.DB
{
/// <summary>
/// 转仓
/// </summary>
public class dc_aims_transfer_warehouse_dao : connectionHelper
{
public static List<dc_aims_transfer_warehouse_log_dto> LogList(string platform, string bailun_sku, int offset, int limit, ref int total, DateTime? start_date, DateTime? end_date, string warehousecode, string warehousetype, int? warehousearea)
{
var sql = @"select t1.*
from dc_aims_transfer_warehouse_log as t1
left join dc_base_warehouse as t3 on t1.warehouse_code = t3.warehouse_code
where 1=1 ";
var countSql = " select count(1) from dc_auto_shortage_push as t1 left join dc_base_warehouse as t3 on t1.warehouse_code = t3.warehouse_code where 1=1 ";
DynamicParameters parameters = new DynamicParameters();
if (!string.IsNullOrWhiteSpace(warehousecode))
{
sql += " and t1.warehouse_code=@warehouse_code ";
countSql += " and t1.warehouse_code=@warehouse_code ";
parameters.Add("warehouse_code", warehousecode);
}
if (!string.IsNullOrWhiteSpace(warehousetype))
{
sql += " and t3.hq_type = @hq_type ";
countSql += " and t3.hq_type = @hq_type ";
parameters.Add("hq_type", warehousetype);
}
if (warehousearea > 0)
{
sql += " and t3.area_id = @area_id ";
countSql += " and t3.area_id = @area_id ";
parameters.Add("area_id", warehousearea);
}
if (start_date != null)
{
sql += " and t1.push_date>=@btime ";
countSql += " and t1.push_date>=@btime ";
parameters.Add("btime", start_date);
}
if (end_date != null)
{
sql += " and t1.push_date<=@etime ";
countSql += " and t1.push_date<=@etime ";
parameters.Add("etime", end_date);
}
if (!string.IsNullOrWhiteSpace(platform))
{
sql += " and t1.platform=@platform ";
countSql += " and t1.platform=@platform ";
parameters.Add("platform", platform);
}
if (!string.IsNullOrWhiteSpace(bailun_sku))
{
sql += " and t1.bailun_sku in @bailun_sku ";
countSql += " and t1.bailun_sku in @bailun_sku ";
parameters.Add("bailun_sku", bailun_sku.Split(','));
}
sql += " order by t1.id desc ";
total = _connection.QueryFirst<int>(countSql, parameters, commandTimeout: 0);
sql += " limit " + offset + "," + limit;
var obj = _connection.Query<dc_aims_transfer_warehouse_log_dto>(sql, parameters, buffered: false, commandTimeout: 0);
return obj.AsList();
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models
{
/// <summary>
/// 转仓记录
/// </summary>
public class dc_aims_transfer_warehouse_log
{
public int id { get; set; }
public string bailun_sku { get; set; }
public string from_warehouse_code { get; set; }
public string from_warehouse_name { get; set; }
public string to_warehouse_name { get; set; }
public string create_user { get; set; }
public DateTime create_date { get; set; }
}
public class dc_aims_transfer_warehouse_log_dto: dc_aims_transfer_warehouse_log
{
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace AutoTurnOver.Models
{
/// <summary>
/// 转仓销量统计
/// </summary>
public class dc_aims_transfer_warehouse_sales
{
public int id { get; set; }
public string bailun_sku { get; set; }
public string warehouse_code { get; set; }
public string bailun_sku_warehouse_code { get; set; }
public DateTime date { get; set; }
public string date_str { get; set; }
public decimal sales { get; set; }
}
}
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