Commit d7b2ee85 by guanzhenshan

增加物流账单流水显示

parent eafdc0c5
...@@ -156,7 +156,6 @@ namespace Bailun.DC.LogicWareHouse ...@@ -156,7 +156,6 @@ namespace Bailun.DC.LogicWareHouse
} }
/// <summary> /// <summary>
/// 半成品 /// 半成品
/// </summary> /// </summary>
......
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.DataWareHouse
{
public class flowing_logistic
{
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
/// 物流商名称
/// </summary>
public string platformtype { get; set; }
/// <summary>
/// 帐号
/// </summary>
public string account { get; set; }
/// <summary>
/// 物流数据类型
/// </summary>
public int datatype { get; set; }
/// <summary>
///
/// </summary>
public string datatypename { get; set; }
/// <summary>
/// json数据
/// </summary>
public string jsondata { get; set; }
/// <summary>
/// 账单上的时间
/// </summary>
public DateTime? datatime { get; set; }
/// <summary>
/// 开始时间
/// </summary>
public DateTime? starttime { get; set; }
/// <summary>
/// 结束时间
/// </summary>
public DateTime? endtime { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime createtime { get; set; }
public string col_orderno { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
namespace Bailun.DC.Models.DataWareHouse
{
public class flowing_logistic_config
{
/// <summary>
///
/// </summary>
public int id { get; set; }
/// <summary>
///
/// </summary>
public string platform { get; set; }
/// <summary>
///
/// </summary>
public string col_datatime { get; set; }
/// <summary>
///
/// </summary>
public string col_orderno { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Text;
using MySql.Data.MySqlClient;
using Dapper;
using Bailun.DC.Models.DataWareHouse;
using System.Linq;
namespace Bailun.DC.Services.DataWareHouse
{
public class LogisticServices
{
/// <summary>
/// 获取物流流水的简单配置
/// </summary>
/// <returns></returns>
public List<flowing_logistic_config> ListLogisticConfig()
{
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_DW))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
return cn.Query<flowing_logistic_config>("select * from flowing_logistic_config").ToList();
}
}
/// <summary>
/// 获取物流账单流水 json数据
/// </summary>
/// <param name="page"></param>
/// <param name="pagesize"></param>
/// <param name="platform"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="total"></param>
/// <returns></returns>
public List<flowing_logistic> ListFlowingLogistic(int page,int pagesize,string platform,DateTime? start,DateTime? end,string orderno,ref int total)
{
var sql = "select * from flowing_logistic where 1=1";
var sqlparam = new DynamicParameters();
if(!string.IsNullOrEmpty(platform))
{
sql += " and platformtype=@platform";
sqlparam.Add("platform", platform);
}
if(start.HasValue)
{
sql += $" and datatime>='{start.Value.ToString("yyyy-MM-dd")}'";
}
if(end.HasValue)
{
sql += $" and datatime<'{end.Value.AddDays(1).ToString("yyyy-MM-dd")}'";
}
if(!string.IsNullOrEmpty(orderno))
{
sql += " and col_orderno=@no";
sqlparam.Add("no", orderno);
}
using (var cn = new MySqlConnection(Common.GlobalConfig.ConnectionString_DW))
{
if (cn.State == System.Data.ConnectionState.Closed)
{
cn.Open();
}
if (pagesize > 0)
{
var obj = cn.Page<flowing_logistic>(page, pagesize, sql, ref total, sqlparam).ToList();
return obj;
}
else
{
var obj = cn.Query<flowing_logistic>(sql).ToList();
total = obj.Count;
return obj;
}
}
}
}
}
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Bailun.DC.Web.Areas.DataWareHouse.Controllers
{
[Area("DataWareHouse")]
public class LogisticsController : Controller
{
public IActionResult List(string platform)
{
var listconfig = new Services.DataWareHouse.LogisticServices().ListLogisticConfig();
ViewBag.listconfig = listconfig;
ViewBag.platform = platform;
return View();
}
/// <summary>
/// 获取物流账单json数据
/// </summary>
/// <param name="page"></param>
/// <param name="platform"></param>
/// <param name="start"></param>
/// <param name="end"></param>
/// <param name="orderno"></param>
/// <param name="pagesize"></param>
/// <returns></returns>
[HttpPost]
public JsonResult ListFlowingJson(int page, string platform, DateTime? start, DateTime? end, string orderno, int pagesize = 25)
{
var total = 0;
if (page <= 0)
{
page = 1;
}
var obj = new Services.DataWareHouse.LogisticServices().ListFlowingLogistic(page, pagesize, platform, start, end,orderno, ref total);
;
var list = obj.Select(a => new {
a.createtime,
jsondata = Newtonsoft.Json.Linq.JRaw.Parse(a.jsondata),
datatime = a.datatime.HasValue ? a.datatime.Value.ToString("yyyy-MM-dd HH:mm:ss") : "",
});
return Json(new
{
success = true,
msg = "",
rows = list,
total = total,
page = page,
totalpage = total / pagesize + (total % pagesize > 0 ? 1 : 0),
});
}
}
}
...@@ -419,5 +419,6 @@ namespace Bailun.DC.Web.Controllers ...@@ -419,5 +419,6 @@ namespace Bailun.DC.Web.Controllers
return Content("OK"); return Content("OK");
} }
} }
} }
\ No newline at end of file
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