Commit 8d05bd75 by guanzhenshan

导出增加sku分类搜索条件

parent f16ecd6d
......@@ -21,11 +21,27 @@ namespace Bailun.DC.Services
/// <param name="start"></param>
/// <param name="end"></param>
/// <returns></returns>
public List<mPurchasePutin> ListPurchasePutin(DateTime start,DateTime end,int companyid)
public List<mPurchasePutin> ListPurchasePutin(DateTime start,DateTime end,int companyid,string skucategoryids)
{
var sql = $@"select t1.warehouse_code,t1.warehouse_name,t1.bailun_sku,t1.count,t1.update_time,inbound_id as no,t1.purchase_id,t2.price from dc_base_purchase_inbound t1
join dc_base_purchase t2 on t1.purchase_id = t2.purchase_id and t1.bailun_sku = t2.bailun_sku and t2.has_transfer = 0 and t2.`status`> 0
where t1.`status`= 1 and t1.update_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.update_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}'";
";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
var arr = skucategoryids.Split('|').Where(a => !string.IsNullOrEmpty(a)).ToList();
if (arr.Count > 0)
{
sql += " join dc_base_sku t4 on t1.bailun_sku=t4.bailun_sku ";
var s = string.Join(",", arr);
if (!string.IsNullOrEmpty(s))
{
sql += " and t4.category_simple_id in (" + s + ") ";
}
}
}
sql += $@" where t1.`status`= 1 and t1.update_time >= '{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.update_time < '{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
......@@ -47,10 +63,26 @@ namespace Bailun.DC.Services
/// <param name="end">结束时间</param>
/// <param name="companyid">公司id</param>
/// <returns></returns>
public List<mAllotPutin> ListAllotPutin(DateTime start, DateTime end, int companyid)
public List<mAllotPutin> ListAllotPutin(DateTime start, DateTime end, int companyid,string skucategoryids)
{
var sql = $@"select t1.warehouse_code,t2.warehouse_name,t1.bailun_sku,t1.count,t1.transfer_order_id,t1.create_time from dc_base_transfer_inbound t1
left join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code where t1.deleted=0 and t1.count>0 and t1.create_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.create_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' -- and company_id={companyid}";
join dc_base_warehouse t2 on t1.warehouse_code=t2.warehouse_code ";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
var arr = skucategoryids.Split('|').Where(a => !string.IsNullOrEmpty(a)).ToList();
if (arr.Count > 0)
{
sql += " join dc_base_sku t4 on t1.bailun_sku=t4.bailun_sku ";
var s = string.Join(",", arr);
if (!string.IsNullOrEmpty(s))
{
sql += " and t4.category_simple_id in (" + s + ") ";
}
}
}
sql += $@" where t1.deleted=0 and t1.count>0 and t1.create_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.create_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}' -- and company_id={companyid}";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
......@@ -78,13 +110,28 @@ namespace Bailun.DC.Services
/// <param name="end"></param>
/// <param name="companyid"></param>
/// <returns></returns>
public List<mShipping> ListShipping(DateTime start, DateTime end, int companyid)
public List<mShipping> ListShipping(DateTime start, DateTime end, int companyid,string skucategoryids)
{
var sql = $@"select t1.origin_order_id,t1.pick_order_id,t1.logistics_order_id,t1.shipping_time,t1.warehouse_code,t1.warehouse_name,t1.bailun_sku,t1.quantity_shipped,(t1.quantity_shipped*t2.unit_price) amount from dc_base_oms_pick t1
left join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku
where t1.has_delete=0 and t1.shipping_status='TotalShipping' and t1.shipping_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}'
join dc_base_sku t2 on t1.bailun_sku=t2.bailun_sku
";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
var arr = skucategoryids.Split('|').Where(a => !string.IsNullOrEmpty(a)).ToList();
if (arr.Count > 0)
{
var s = string.Join(",", arr);
if (!string.IsNullOrEmpty(s))
{
sql += " and t2.category_simple_id in (" + s + ") ";
}
}
}
sql += $@" where t1.has_delete=0 and t1.shipping_status='TotalShipping' and t1.shipping_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.shipping_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
if (cn.State == System.Data.ConnectionState.Closed)
......@@ -110,13 +157,28 @@ namespace Bailun.DC.Services
/// <param name="end">创建结束时间</param>
/// <param name="companyid">公司id</param>
/// <returns></returns>
public List<mPurchase> ListPurchase(DateTime start, DateTime end, int companyid)
public List<mPurchase> ListPurchase(DateTime start, DateTime end, int companyid,string skucategoryids)
{
var sql = $@"select t1.warehouse_code,t3.warehouse_name,t1.bailun_sku,t1.count count,(t1.count*t1.price) amount,t1.price,t1.purchase_id,t1.create_time from dc_base_purchase t1
left join dc_base_warehouse t3 on t1.warehouse_code = t3.warehouse_code
where t1.has_delete=0 and t1.status!=-1 and t1.create_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.create_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}'
join dc_base_warehouse t3 on t1.warehouse_code = t3.warehouse_code
";
if (!string.IsNullOrWhiteSpace(skucategoryids))
{
var arr = skucategoryids.Split('|').Where(a => !string.IsNullOrEmpty(a)).ToList();
if (arr.Count > 0)
{
sql += " join dc_base_sku t4 on t1.bailun_sku=t4.bailun_sku ";
var s = string.Join(",", arr);
if (!string.IsNullOrEmpty(s))
{
sql += " and t4.category_simple_id in (" + s + ") ";
}
}
}
sql += $@" where t1.has_delete=0 and t1.status!=-1 and t1.create_time>='{start.ToString("yyyy-MM-dd HH:mm:ss")}' and t1.create_time<'{end.AddDays(1).ToString("yyyy-MM-dd HH:mm:ss")}'";
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString))
{
......
......@@ -24,11 +24,11 @@ namespace Bailun.DC.Web.Areas.ExportFile.Controllers
/// <param name="start">下单开始时间</param>
/// <param name="end">下单结束时间</param>
/// <returns></returns>
public ActionResult ExportPurchase(int companyid, DateTime start, DateTime end)
public ActionResult ExportPurchase(int companyid, DateTime start, DateTime end,string skucategoryids)
{
var _service = new Services.ExportServices();
var obj = _service.ListPurchase(start, end, companyid);
var obj = _service.ListPurchase(start, end, companyid,skucategoryids);
var colNames = new List<string> {"采购入库单号","Sku","仓库编码", "仓库名称", "下单数量",
"下单金额","采购价","下单时间" };
......
......@@ -30,7 +30,7 @@ namespace Bailun.DC.Web.Areas.ExportFile.Controllers
/// <param name="end">结束日期</param>
/// <param name="companyid">公司id</param>
/// <returns></returns>
public ActionResult ExportPurchasePutin(DateTime start, DateTime end,int companyid)
public ActionResult ExportPurchasePutin(DateTime start, DateTime end,int companyid,string skucategoryids)
{
if (start.AddDays(31) < end)
{
......@@ -39,7 +39,7 @@ namespace Bailun.DC.Web.Areas.ExportFile.Controllers
var _service = new Services.ExportServices();
var objPurchasePutin = _service.ListPurchasePutin(start, end, companyid);
var objPurchasePutin = _service.ListPurchasePutin(start, end, companyid,skucategoryids);
var colNames = new List<string> {"采购入库单号","Sku","仓库编码", "仓库名称", "入库数量",
"入库时间","采购单号","采购单价" };
......@@ -73,7 +73,7 @@ namespace Bailun.DC.Web.Areas.ExportFile.Controllers
/// <param name="end">结束日期</param>
/// <param name="companyid">公司id</param>
/// <returns></returns>
public ActionResult ExportAllotPutin(DateTime start, DateTime end, int companyid)
public ActionResult ExportAllotPutin(DateTime start, DateTime end, int companyid,string skucategoryids)
{
if (start.AddDays(31) < end)
{
......@@ -82,7 +82,7 @@ namespace Bailun.DC.Web.Areas.ExportFile.Controllers
var _service = new Services.ExportServices();
var obj = _service.ListAllotPutin(start, end, companyid);
var obj = _service.ListAllotPutin(start, end, companyid,skucategoryids);
var colNames = new List<string> {"调拨单号","Sku","仓库编码", "仓库名称", "入库数量",
"入库时间" };
......
......@@ -23,10 +23,10 @@ namespace Bailun.DC.Web.Areas.ExportFile.Controllers
/// <param name="end"></param>
/// <param name="companyid"></param>
/// <returns></returns>
public ActionResult ListShipping(DateTime start, DateTime end, int companyid)
public ActionResult ListShipping(DateTime start, DateTime end, int companyid,string skucategoryids)
{
var _service = new Services.ExportServices();
var obj = _service.ListShipping(start, end, companyid);
var obj = _service.ListShipping(start, end, companyid, skucategoryids);
var colNames = new List<string> {"平台单号","配货单号","运单号", "仓库编码", "仓库名称",
"Sku","发货数量","采购金额","发货时间" };
......
......@@ -531,7 +531,7 @@ namespace Bailun.DC.Web.Areas.Reports.Controllers
}
else
{
categoryid = "5|6|7|8|9|10|11";
categoryid = "5|6|7|8|9|10|11|12|13|14|15";
}
......
......@@ -245,20 +245,46 @@
function exportlistputin() {
if (confirm("确定要导出入库明细吗?")) {
window.open('@Url.Content("~/ExportFile/Putin/ExportPurchasePutin")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid, '_blank');
window.open('@Url.Content("~/ExportFile/Putin/ExportAllotPutin")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid, '_blank');
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
window.open('@Url.Content("~/ExportFile/Putin/ExportPurchasePutin")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid + '&skucategoryids=' + s, '_blank');
window.open('@Url.Content("~/ExportFile/Putin/ExportAllotPutin")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid + '&skucategoryids=' + s, '_blank');
}
}
function exportlistshipping() {
if (confirm("确定要导出发货明细吗?")) {
window.open('@Url.Content("~/ExportFile/Shipping/ListShipping")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid, '_blank');
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
window.open('@Url.Content("~/ExportFile/Shipping/ListShipping")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid+'&skucategoryids=' + s, '_blank');
}
}
function exportlistpurchase() {
if (confirm('确定要导出采购下单明细吗?')) {
window.open('@Url.Content("~/ExportFile/Purchase/ExportPurchase")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid, '_blank');
var s = '';
try {
s = getChkNode();
} catch (e) {
s = '';
}
window.open('@Url.Content("~/ExportFile/Purchase/ExportPurchase")' + '?' + $("#toolbar").serialize() + '&companyid=' + companyid + '&skucategoryids=' + s, '_blank');
}
}
......
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