130 lines
5.3 KiB
C#
130 lines
5.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using WX.CRM.IBLL.QH;
|
|
using WX.CRM.IBLL.Util;
|
|
using WX.CRM.Model.Entity;
|
|
using WX.CRM.WebHelper;
|
|
|
|
namespace WX.CRM.WEB.Controllers.QH
|
|
{
|
|
public class ProductTranCountController : BaseController
|
|
{
|
|
|
|
private IQH_PRODUCTTRANCOUNT_Q _ProductTranCountQ;
|
|
private readonly ICACHE_Q _cacheQ;
|
|
|
|
public ProductTranCountController(IQH_PRODUCTTRANCOUNT_Q ProductTranCountQ, ICACHE_Q cacheQ)
|
|
{
|
|
|
|
this._ProductTranCountQ = ProductTranCountQ;
|
|
this._cacheQ = cacheQ;
|
|
}
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_期货商品交易统计查询)]
|
|
public ActionResult Index()
|
|
{
|
|
string tableId = "tablist";
|
|
Table tab = new Table(tableId);
|
|
tab.AddHeadCol("", 1, "");
|
|
tab.AddHeadCol("", 3, "买进建仓");
|
|
tab.AddHeadCol("", 3, "卖出平仓");
|
|
tab.AddHeadCol("", 3, "卖出建仓");
|
|
tab.AddHeadCol("", 3, "买进平仓");
|
|
tab.AddHeadRow();
|
|
tab.AddHeadCol("PRODUCTCODE", "", "商品代码");
|
|
tab.AddHeadCol("companyName", "", "买进建仓");
|
|
tab.AddHeadCol("NUMQTY", "", "数量(手)");
|
|
tab.AddHeadCol("companyCode", "", "平均价");
|
|
tab.AddHeadCol("isOuterAgent", "", "卖出平仓");
|
|
tab.AddHeadCol("parentId", "", "数量(手)");
|
|
tab.AddHeadCol("businessValue", "", "平均价");
|
|
tab.AddHeadCol("comments", "", "卖出建仓");
|
|
tab.AddHeadCol("comments", "", "数量(手)");
|
|
tab.AddHeadCol("comments", "", "平均价");
|
|
tab.AddHeadCol("comments", "", "买进平仓");
|
|
tab.AddHeadCol("comments", "", "数量(手)");
|
|
tab.AddHeadCol("comments", "", "平均价");
|
|
tab.AddHeadRow();
|
|
ViewBag.gridTable = tab.GetHead();
|
|
|
|
var QHProductList = new List<SelectListItem>() { new SelectListItem() { Text = "【所有】", Value = "" } };
|
|
var productList = _cacheQ.GetList_QH_Product().Select(item => new SelectListItem() { Text = item.PRODUCTCODE + "【" + item.PRODUCTNAME + "】", Value = item.PRODUCTCODE });
|
|
QHProductList.AddRange(productList);
|
|
ViewBag.QHProductList = QHProductList;
|
|
|
|
return View();
|
|
|
|
}
|
|
|
|
|
|
#region 列表
|
|
[HttpPost]
|
|
/// <summary>
|
|
/// 按照条件获取数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
[AuthorizeRedirect(Roles = InitRights.CONST_期货商品交易统计查询)]
|
|
public JsonResult GetHtmlList(string columns, string productCode, string stime, string etime)
|
|
{
|
|
DateTime? _stime, _etime;
|
|
_stime = stime.GetDateTime();
|
|
_etime = etime.GetDateTime();
|
|
|
|
List<QH_PRODUCTTRANCOUNT> list = _ProductTranCountQ.GetList_QH_ProductTranCount(productCode, _stime, _etime);
|
|
Table table = new Table(columns, true);
|
|
foreach (QH_PRODUCTTRANCOUNT model in list)
|
|
{
|
|
table.AddCol(model.PRODUCTCODE);
|
|
table.AddCol("买进建仓");
|
|
table.AddCol(model.MJDL_TRADEQTY);
|
|
if (model.MJDL_TRADEQTY == 0 || model.NUMQTY == 0)
|
|
table.AddCol("--");
|
|
else
|
|
table.AddCol(string.Format("{0:N2} ", model.MJDL_TRADEPRICE / (model.MJDL_TRADEQTY * model.NUMQTY)));
|
|
table.AddCol("卖出平仓");
|
|
table.AddCol(model.MJZR_TRADEQTY);
|
|
if (model.MJZR_TRADEQTY == 0 || model.NUMQTY == 0)
|
|
table.AddCol("--");
|
|
else
|
|
table.AddCol(string.Format("{0:N2} ", model.MJZR_TRADEPRICE / (model.MJZR_TRADEQTY * model.NUMQTY)));
|
|
table.AddCol("卖出建仓");
|
|
table.AddCol(model.MCDL_TRADEQTY);
|
|
if (model.MCDL_TRADEQTY == 0 || model.NUMQTY == 0)
|
|
table.AddCol("--");
|
|
else
|
|
table.AddCol(string.Format("{0:N2} ", model.MCDL_TRADEPRICE / (model.MCDL_TRADEQTY * model.NUMQTY)));
|
|
table.AddCol("买进平仓");
|
|
table.AddCol(model.MJZR_TRADEQTY);
|
|
if (model.MJZR_TRADEQTY == 0 || model.NUMQTY == 0)
|
|
table.AddCol("--");
|
|
else
|
|
table.AddCol(string.Format("{0:N2} ", model.MJZR_TRADEPRICE / (model.MJZR_TRADEQTY * model.NUMQTY)));
|
|
table.AddRow();
|
|
}
|
|
table.AddCol("");
|
|
table.AddCol("合计");
|
|
table.AddCol(list.Sum(m => m.MJDL_TRADEQTY.Value).ToString());
|
|
table.AddCol("");
|
|
table.AddCol("");
|
|
table.AddCol(list.Sum(m => m.MCZR_TRADEQTY.Value).ToString());
|
|
table.AddCol("");
|
|
table.AddCol("");
|
|
table.AddCol(list.Sum(m => m.MCDL_TRADEQTY.Value).ToString());
|
|
table.AddCol("");
|
|
table.AddCol("");
|
|
table.AddCol(list.Sum(m => m.MJZR_TRADEQTY.Value).ToString());
|
|
table.AddCol("");
|
|
table.AddRow();
|
|
|
|
var json = new
|
|
{
|
|
rowsList = table.GetRows()
|
|
};
|
|
return Json(json, JsonRequestBehavior.AllowGet);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
}
|