xxx
This commit is contained in:
parent
a23762cccb
commit
d769bf9622
|
|
@ -170,9 +170,9 @@ namespace Competition.Mysql.BLL
|
|||
{
|
||||
return dal.GetListByPage( strWhere, orderby, startIndex, endIndex);
|
||||
}
|
||||
/// <summary>
|
||||
/// 分页获取数据列表
|
||||
/// </summary>
|
||||
///// <summary>
|
||||
///// 分页获取数据列表
|
||||
///// </summary>
|
||||
//public DataSet GetList(int PageSize,int PageIndex,string strWhere)
|
||||
//{
|
||||
//return dal.GetList(PageSize,PageIndex,strWhere);
|
||||
|
|
@ -180,7 +180,16 @@ namespace Competition.Mysql.BLL
|
|||
|
||||
#endregion BasicMethod
|
||||
#region ExtensionMethod
|
||||
|
||||
/// <summary>
|
||||
/// 获取堆场内库存记录
|
||||
/// </summary>
|
||||
/// <param name="siloCode"></param>
|
||||
/// <returns></returns>
|
||||
public List<Competition.Mysql.Model.T_STK_STORAGE> GetYardList(string siloCode)
|
||||
{
|
||||
DataSet ds = dal.GetYardStorage(siloCode);
|
||||
return DataTableToList(ds.Tables[0]);
|
||||
}
|
||||
#endregion ExtensionMethod
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -693,7 +693,33 @@ namespace Competition.Mysql.DAL
|
|||
|
||||
#endregion BasicMethod
|
||||
#region ExtensionMethod
|
||||
/// <summary>
|
||||
/// 获取堆场库存
|
||||
/// </summary>
|
||||
/// <param name="strWhere"></param>
|
||||
/// <returns></returns>
|
||||
public DataSet GetYardStorage(string silo_code)
|
||||
{
|
||||
//string sql=string.Format(
|
||||
// "select T1.* " +
|
||||
// "FROM T_STK_STORAGE T1 " +
|
||||
// "LEFT JOIN " +
|
||||
// "T_STK_STORAGE_SILO T2 " +
|
||||
// "ON T1.STORAGE_CODE = T2.STORAGE_CODE " +
|
||||
// "WHERE T2.SILO_CODE = '{0}'", silo_code);
|
||||
|
||||
string sql = string.Format(
|
||||
"select T1.* " +
|
||||
"FROM T_STK_STORAGE T1 " +
|
||||
"INNER JOIN " +
|
||||
"(select * FROM T_STK_STORAGE_SILO WHERE SILO_CODE='{0}') T2 " +
|
||||
"ON T1.STORAGE_CODE = T2.STORAGE_CODE", silo_code);
|
||||
|
||||
StringBuilder strSql = new StringBuilder();
|
||||
strSql.Append(sql);
|
||||
|
||||
return DbHelperSQL.Query(strSql.ToString());
|
||||
}
|
||||
#endregion ExtensionMethod
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,26 +20,17 @@ namespace CompetitionAPI.Controllers.api
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// 根据企业id获取相机列表
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="monotorId">公司id</param>
|
||||
/// <param name="monotorId"></param>
|
||||
/// <returns></returns>
|
||||
|
||||
[HttpGet]
|
||||
public JsonResult Index(string action,string monotorId)
|
||||
{
|
||||
if(action =="GetList")
|
||||
public JsonResult GetList(string monotorId)
|
||||
{
|
||||
//获取公司所有相机信息
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
var list = bll_camera.GetModelList("MONITOR_ID = " + monotorId).FindAll(a=>Tool.IsFuZhouCustom(monotorId));
|
||||
var list = bll_camera.GetModelList(string.Format("MONITOR_ID = '{0}'", monotorId)).FindAll(a => Tool.IsFuZhouCustom(a.CUSTOMS_CODE));
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, list));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(Tool.GetJsonWithCode(APICode.Fail, "action填写错误"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,19 +21,14 @@ namespace CompetitionAPI.Controllers.api
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 企业
|
||||
/// 获取福州海关所有监管企业总数
|
||||
/// </summary>
|
||||
/// <param name="req"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult Index(string action)
|
||||
public JsonResult GetNum()
|
||||
{
|
||||
if (action == "getNum")
|
||||
{
|
||||
//获取监管企业总数接口
|
||||
//读取配置文件示例
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
|
||||
//查询企业表所有数据
|
||||
var list = bll.GetModelList("");
|
||||
//按海关区分组统计
|
||||
|
|
@ -65,15 +60,22 @@ namespace CompetitionAPI.Controllers.api
|
|||
puTian++;
|
||||
}
|
||||
});
|
||||
|
||||
var data = new { rongCheng = rongCheng, maWei = maWei, ningDe = ningDe, puTian = puTian };
|
||||
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, data));
|
||||
}
|
||||
else
|
||||
|
||||
/// <summary>
|
||||
/// 根据企业id获取企业信息
|
||||
/// </summary>
|
||||
/// <param name="monitorId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult GetInfo(string monitorId)
|
||||
{
|
||||
return Json(Tool.GetJsonWithCode(APICode.Fail, "参数输入错误"));
|
||||
}
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
var tmp = bll.GetModel(monitorId);
|
||||
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, tmp));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,19 +25,15 @@ namespace CompetitionAPI.Controllers.api
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// //全年进出口商品种类
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="year">年份</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult Index(string action,int year)
|
||||
public JsonResult GetGoodNumByYear(int year)
|
||||
{
|
||||
if (action == "getGoodNumThisYear")
|
||||
{
|
||||
//进出口商品种类
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
|
||||
//福州海关下的,本年度,按货种分类
|
||||
var list_good = bll_good.GetModelList("");
|
||||
var list = bll_storage.GetModelList("YEAR(INSTRG_DATE) = YEAR(GETDATE())").FindAll(a=> Tool.IsFuZhouCustom(a.CUSTOMS_CODE));
|
||||
|
|
@ -102,17 +98,18 @@ namespace CompetitionAPI.Controllers.api
|
|||
int index = 1;
|
||||
dic2.Keys.ToList().ForEach(a =>
|
||||
{
|
||||
object lastTmp;
|
||||
if (index <= 3)
|
||||
{
|
||||
//商品名称,重量,单位,占比
|
||||
var tmp = new { goodName = list_good.Find(b => b.GOODS_CODE == a).STANDARD_NAME, wt = dic2[a], danWei = "kg", percent = dic2[a] / allWT };
|
||||
lastTmp = new { goodCode=a ,goodName = list_good.Find(b => b.GOODS_CODE == a).STANDARD_NAME, wt = dic2[a], danWei = "kg", percent = dic2[a] / allWT };
|
||||
}
|
||||
else
|
||||
{
|
||||
var tmp= new { goodName = "其他", wt = dic2[a], danWei = "kg", percent = dic2[a] / allWT };
|
||||
lastTmp = new { goodName = "其他", wt = dic2[a], danWei = "kg", percent = dic2[a] / allWT };
|
||||
}
|
||||
|
||||
showData.Add(tmp);
|
||||
showData.Add(lastTmp);
|
||||
index++;
|
||||
});
|
||||
|
||||
|
|
@ -121,7 +118,13 @@ namespace CompetitionAPI.Controllers.api
|
|||
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, data));
|
||||
}
|
||||
else if(action=="getLastNum")
|
||||
|
||||
/// <summary>
|
||||
/// 在库总量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult GetLastNum()
|
||||
{
|
||||
//在库总量
|
||||
decimal num = 0;
|
||||
|
|
@ -136,7 +139,14 @@ namespace CompetitionAPI.Controllers.api
|
|||
var data = new { num = num, dw = "kg" };
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, data));
|
||||
}
|
||||
else if(action=="getBoCiByYear")
|
||||
|
||||
/// <summary>
|
||||
/// 全年累计进出口传播艘次
|
||||
/// </summary>
|
||||
/// <param name="year"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult GetBoCiByYear(int year)
|
||||
{
|
||||
//全年累计进出口传播艘次
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
|
|
@ -163,7 +173,13 @@ namespace CompetitionAPI.Controllers.api
|
|||
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, dic));
|
||||
}
|
||||
else if(action=="getInNumByYear")
|
||||
|
||||
/// <summary>
|
||||
/// 全年累计进口总量,按年度查询
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult GetInNumByYear(int year)
|
||||
{
|
||||
//全年累计进口总量,按年度查询
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
|
|
@ -190,7 +206,13 @@ namespace CompetitionAPI.Controllers.api
|
|||
var data = new { dic };
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, dic));
|
||||
}
|
||||
else if(action== "getInNumWithCurrent")
|
||||
|
||||
/// <summary>
|
||||
/// 本年度和本季度进口总量
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult GetInNumWithCurrent()
|
||||
{
|
||||
//本年度,本季度进口总量
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
|
|
@ -236,11 +258,5 @@ namespace CompetitionAPI.Controllers.api
|
|||
var data = new { currentYearSum = sumYear, currentQuarterSum = sumQuarter, dw = "kg" };
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, data));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(Tool.GetJsonWithCode(APICode.Fail, "action填写错误"));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
using Competition.Common.Util;
|
||||
using CompetitionAPI.api.version;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System.Collections.Generic;
|
||||
using System.IO.Pipelines;
|
||||
|
||||
namespace CompetitionAPI.Controllers.api
|
||||
{
|
||||
|
|
@ -8,7 +11,7 @@ namespace CompetitionAPI.Controllers.api
|
|||
public class WeighterController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// 相机表
|
||||
/// 皮带秤表
|
||||
/// </summary>
|
||||
Competition.Mysql.BLL.T_BAS_ELEC_WEIGHTER bll_elec_weighter = new Competition.Mysql.BLL.T_BAS_ELEC_WEIGHTER();
|
||||
/// <summary>
|
||||
|
|
@ -27,15 +30,17 @@ namespace CompetitionAPI.Controllers.api
|
|||
Configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据皮带秤编码和企业id获取皮带秤信息
|
||||
/// </summary>
|
||||
/// <param name="pipeCode"></param>
|
||||
/// <param name="customCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult Index(string action,string pipeCode,string customCode)
|
||||
public JsonResult GetInfo(string pipeCode,string monitorId)
|
||||
{
|
||||
if (action == "GetInfo")
|
||||
{
|
||||
//获取皮带秤信息
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
//福州海关下的,本年度
|
||||
var pipe = bll_elec_weighter.GetModel(pipeCode,customCode);
|
||||
var pipe = bll_elec_weighter.GetModel(pipeCode, monitorId);
|
||||
if (Tool.IsFuZhouCustom(pipe.CUSTOMS_CODE))
|
||||
{
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, pipe));
|
||||
|
|
@ -45,14 +50,62 @@ namespace CompetitionAPI.Controllers.api
|
|||
return Json(Tool.GetJsonWithCode(APICode.Fail, "不是福州海关数据"));
|
||||
}
|
||||
}
|
||||
//else if (action == "GetHistory")
|
||||
//{
|
||||
// //获取历史信息
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 根据企业id,获取皮带秤列表
|
||||
/// </summary>
|
||||
/// <param name="monitorId"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult GetList(string monitorId)
|
||||
{
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
var list = bll_elec_weighter.GetModelList(string.Format("MONITOR_ID = '{0}'", monitorId)).FindAll(a=>Tool.IsFuZhouCustom(a.CUSTOMS_CODE));
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, list));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一个皮带秤实时数据
|
||||
/// </summary>
|
||||
/// <param name="pipeCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult GetRealTimeData(string pipeCode)
|
||||
{
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
var tmp=bll_pipeReal.GetModel(pipeCode);
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, tmp));
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取一个皮带秤历史数据列表(按时间倒序,间隔筛选出N条)
|
||||
/// </summary>
|
||||
/// <param name="pipeCode"></param>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
public JsonResult GetHistroyData([FromBody] RequestHistoryData req)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(req.pipeCode) && req.startTime != null && req.endTime != null && req.startTime<=req.endTime)
|
||||
{
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
var list = bll_pipeHistory.GetModelList(string.Format("PIPE_CODE = '{0}' AND (COLL_TIME BETWEEN '{1}' AND '{2}')", req.pipeCode,req.startTime,req.endTime)).OrderByDescending(a => a.COLL_TIME.Value).ToList();
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, list));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(Tool.GetJsonWithCode(APICode.Fail, "action填写错误"));
|
||||
return Json(Tool.GetJsonWithCode(APICode.Fail, "请求参数不全"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取历史数据
|
||||
/// </summary>
|
||||
public class RequestHistoryData
|
||||
{
|
||||
public string pipeCode;
|
||||
public DateTime startTime;
|
||||
public DateTime endTime;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using Competition.Common.Util;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using NPOI.POIFS.Crypt.Dsig;
|
||||
|
||||
namespace CompetitionAPI.Controllers.api
|
||||
{
|
||||
|
|
@ -8,7 +9,22 @@ namespace CompetitionAPI.Controllers.api
|
|||
[ApiController]
|
||||
public class YardController : Controller
|
||||
{
|
||||
/// <summary>
|
||||
/// 企业表
|
||||
/// </summary>
|
||||
Competition.Mysql.BLL.T_BAS_CORPORATION bll_corporation = new Competition.Mysql.BLL.T_BAS_CORPORATION();
|
||||
/// <summary>
|
||||
/// 堆场表
|
||||
/// </summary>
|
||||
Competition.Mysql.BLL.T_BAS_YARD bll_yard=new Competition.Mysql.BLL.T_BAS_YARD();
|
||||
/// <summary>
|
||||
/// 堆场表
|
||||
/// </summary>
|
||||
Competition.Mysql.BLL.T_STK_STORAGE bll_storage=new Competition.Mysql.BLL.T_STK_STORAGE();
|
||||
/// <summary>
|
||||
/// 库存存储地表
|
||||
/// </summary>
|
||||
Competition.Mysql.BLL.T_STK_STORAGE_SILO bll_storageSILO=new Competition.Mysql.BLL.T_STK_STORAGE_SILO();
|
||||
|
||||
public IConfiguration Configuration { get; }
|
||||
|
||||
|
|
@ -18,20 +34,18 @@ namespace CompetitionAPI.Controllers.api
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 首页堆场数据
|
||||
/// 首页堆场总数
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="name"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult Index(string action)
|
||||
{
|
||||
if(action=="getNum")
|
||||
public JsonResult GetAllInfo()
|
||||
{
|
||||
//堆场总数
|
||||
int allNum = 0;
|
||||
//堆场面积
|
||||
int allArea = 0;
|
||||
decimal allArea = 0;
|
||||
//筒仓总数
|
||||
int allSilo = 0;
|
||||
//读取配置文件示例
|
||||
|
|
@ -41,7 +55,11 @@ namespace CompetitionAPI.Controllers.api
|
|||
list.ForEach(x =>
|
||||
{
|
||||
allNum += int.Parse(x.YARD_NUM);
|
||||
allArea += int.Parse(x.YARD_AREA.Replace("平方米",""));
|
||||
//格式不标准不计算
|
||||
if (decimal.TryParse(x.YARD_AREA.Replace("平方米", "").Replace("㎡", "").Replace("㎡", ""), out decimal area))
|
||||
{
|
||||
allArea += area;
|
||||
}
|
||||
//不是所有企业都有筒仓
|
||||
if (!string.IsNullOrEmpty(x.SILO_NUM))
|
||||
{
|
||||
|
|
@ -52,12 +70,33 @@ namespace CompetitionAPI.Controllers.api
|
|||
var data = new { allNum = allNum, allArea = allArea, allSilo = allSilo };
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, data));
|
||||
}
|
||||
else
|
||||
|
||||
/// <summary>
|
||||
/// 根据企业id获取堆场信息
|
||||
/// </summary>
|
||||
/// <param name="monitorId">企业id</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult GetYardList(string monitorId)
|
||||
{
|
||||
return Json(Tool.GetJsonWithCode(APICode.Fail, "action填写错误"));
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
var list = bll_yard.GetModelList(string.Format("MONITOR_ID = '{0}'", monitorId)).FindAll(a=>Tool.IsFuZhouCustom(a.CUSTOMS_CODE));
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, list));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据堆场id获取堆场库存信息
|
||||
/// </summary>
|
||||
/// <param name="SILO_CODE"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult GetYardStorage(string SILO_CODE)
|
||||
{
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
var list = bll_storage.GetYardList(SILO_CODE).OrderByDescending(a=>a.INSTRG_DATE.Value).ToList();
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, list));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using Autofac.Extensions.DependencyInjection;
|
||||
using CompetitionAPI.Controllers.api;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
|
||||
namespace CompetitionAPI
|
||||
|
|
@ -7,6 +8,9 @@ namespace CompetitionAPI
|
|||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
|
||||
//string tmp = Newtonsoft.Json.JsonConvert.SerializeObject(new RequestHistoryData { pipeCode = "aaa", startTime = DateTime.UtcNow, endTime = DateTime.UtcNow });
|
||||
|
||||
//log4net.Config.XmlConfigurator.Configure();
|
||||
CreateHostBuilder(args).Build().Run();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue