Commit 390029d8 by 泽锋 李

重新计算提货单

parent 5713792f
using AutoTurnOver.Models;
using AutoTurnOver.Models.dc_base_purchase;
using Dapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AutoTurnOver.Utility;
namespace AutoTurnOver.DB
{
......@@ -45,7 +47,9 @@ namespace AutoTurnOver.DB
order_1688_time = new DateTime(1991, 1, 1),
pay_time = item.Max(s => s.pay_time),
pick_up_goods_time = dc_base_supplier_data.laster_pockup_time ?? "",
purchase_id = itemP.Key
purchase_id = itemP.Key,
warehouse_code = item.Max(v=>v.warehouse_code),
warehouse_name = item.Max(v=>v.warehouse_name)
};
// 查询是否已经存在
......@@ -87,5 +91,90 @@ namespace AutoTurnOver.DB
}
return val_str;
}
public static List<dc_auto_pick_up_goods_order_view_dto> SkuPage(dc_auto_return_goods_sku_search_dto m, int offset, int limit, ref int total)
{
var list = new List<dc_auto_pick_up_goods_order_view_dto>();
try
{
var sql = @"select
t1.*,
( case when t5.`status`=0 or t5.`status` is null then '监控中' else '停止监控' end ) as 'monitor_status_str'
from dc_auto_return_goods_sku as t1
left join dc_base_warehouse as t2 on t1.warehouse_code = t2.warehouse_code
left join dc_auto_config_sku_warehouse as t5 on t1.bailun_sku = t5.bailun_sku and t1.warehouse_code = t5.warehouse_code
where 1 = 1 ";
DynamicParameters parameters = new DynamicParameters();
if (m.monitor_status != null)
{
if (m.monitor_status == 1)
{
sql += " and t5.`status`=1 ";
}
else if (m.monitor_status == 2)
{
sql += " and ( t5.`status`=0 or t5.`status` is null ) ";
}
}
if (m.btime != null)
{
sql += " and t1.create_date>=@btime ";
parameters.Add("btime", m.btime.Value.ToDayHome());
}
if (m.etime != null)
{
sql += " and t1.create_date<=@etime ";
parameters.Add("etime", m.etime.Value.ToDayEnd());
}
if (!string.IsNullOrWhiteSpace(m.warehousetype))
{
sql += " and t2.hq_type=@warehousetype";
parameters.Add("warehousetype", m.warehousetype);
}
if (!string.IsNullOrWhiteSpace(m.sku))
{
sql += " and t1.bailun_sku=@bailun_sku";
parameters.Add("bailun_sku", m.sku);
}
if (m.warehousearea > 0)
{
sql += " and t2.area_id=" + m.warehousearea;
}
if (m.warehouse_code != null)
{
sql += $" and t1.warehouse_code=@warehouse_code ";
parameters.Add("warehouse_code", m.warehouse_code);
}
if (!string.IsNullOrWhiteSpace(m.supplier_name))
{
sql += " and t1.suppliers_name =@suppliers_name ";
parameters.Add("suppliers_name", m.supplier_name);
}
if (m.status != null)
{
sql += " and t1.status=" + m.status;
}
if (m.oms_out_status != null)
{
sql += " and t1.oms_out_status=" + m.oms_out_status;
}
if (m.no_library_sys_push_status > 0)
{
sql += " and t1.no_library_sys_push_status=" + m.no_library_sys_push_status;
}
total = _connection.ExecuteScalar<int>("select count(0) from (" + sql + ") tb1", parameters);
var obj = _connection.Query<dc_auto_pick_up_goods_order_view_dto>(sql + " limit " + offset + "," + limit, parameters);
return obj.AsList();
}
catch (Exception ex)
{
return list;
}
}
}
}
......@@ -13,6 +13,8 @@ namespace AutoTurnOver.Models
public DateTime? order_1688_time { get; set; }
public string pick_up_goods_time { get; set; }
public string purchase_id { get; set; }
public string warehouse_code { get; set; }
public string warehouse_name { get; set; }
}
public class dc_auto_pick_up_goods_order_sku
......@@ -28,4 +30,35 @@ namespace AutoTurnOver.Models
/// </summary>
public decimal amount { get; set; }
}
/// <summary>
/// 提货单
/// </summary>
public class dc_auto_pick_up_goods_order_view_dto
{
public int id { get; set; }
public string no { get; set; }
public DateTime date { get; set; }
public DateTime? pay_time { get; set; }
public DateTime? order_1688_time { get; set; }
public string pick_up_goods_time { get; set; }
public string purchase_id { get; set; }
public string bailun_sku { get; set; }
public decimal price { get; set; }
public int quantity { get; set; }
/// <summary>
/// 单价(总)
/// </summary>
public decimal amount { get; set; }
}
public class dc_auto_pick_up_goods_order_search_dto
{
public string warehouse_code { get; set; }
public string warehousetype { get; set; }
public int? warehousearea { get; set; }
}
}
......@@ -17,7 +17,7 @@ namespace ResetOutofstock
{
var now = DateTime.Now;
dc_auto_pick_up_goods_order_dao.GenerateOrder(DateTime.Now.AddDays(-3), DateTime.Now);
//dc_auto_pick_up_goods_order_dao.GenerateOrder(DateTime.Now.AddDays(-3), DateTime.Now);
//base_supplier_holiday_time_dao.SynchroData();
//report.ResetCashFlowData();
//report.StockWeekBackUp();
......
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