Compare commits

..

No commits in common. "2da7dd1ae6f8634e4732bb19435fd52e2da037c2" and "721bae4a9fb7776a156354b729ffc19e82ea4c63" have entirely different histories.

8 changed files with 309 additions and 449 deletions

View File

@ -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,16 +180,7 @@ 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
}
}

View File

@ -693,33 +693,7 @@ 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
}
}

View File

@ -20,17 +20,26 @@ namespace CompetitionAPI.Controllers.api
}
/// <summary>
/// 根据企业id获取相机列表
///
/// </summary>
/// <param name="monotorId"></param>
/// <param name="action"></param>
/// <param name="monotorId">公司id</param>
/// <returns></returns>
[HttpGet]
public JsonResult GetList(string monotorId)
public JsonResult Index(string action,string monotorId)
{
if(action =="GetList")
{
//获取公司所有相机信息
var mysql = Configuration.GetConnectionString("MySQL").ToString();
var list = bll_camera.GetModelList(string.Format("MONITOR_ID = '{0}'", monotorId)).FindAll(a => Tool.IsFuZhouCustom(a.CUSTOMS_CODE));
var list = bll_camera.GetModelList("MONITOR_ID = " + monotorId).FindAll(a=>Tool.IsFuZhouCustom(monotorId));
return Json(Tool.GetJsonWithCode(APICode.Success, list));
}
else
{
return Json(Tool.GetJsonWithCode(APICode.Fail, "action填写错误"));
}
}
}
}

View File

@ -21,14 +21,19 @@ namespace CompetitionAPI.Controllers.api
}
/// <summary>
/// 获取福州海关所有监管企业总数
/// 企业
/// </summary>
/// <param name="req"></param>
/// <returns></returns>
[HttpGet]
public JsonResult GetNum()
public JsonResult Index(string action)
{
if (action == "getNum")
{
//获取监管企业总数接口
//读取配置文件示例
var mysql = Configuration.GetConnectionString("MySQL").ToString();
//查询企业表所有数据
var list = bll.GetModelList("");
//按海关区分组统计
@ -60,22 +65,15 @@ namespace CompetitionAPI.Controllers.api
puTian++;
}
});
var data = new { rongCheng = rongCheng, maWei = maWei, ningDe = ningDe, puTian = puTian };
return Json(Tool.GetJsonWithCode(APICode.Success, data));
}
/// <summary>
/// 根据企业id获取企业信息
/// </summary>
/// <param name="monitorId"></param>
/// <returns></returns>
[HttpGet]
public JsonResult GetInfo(string monitorId)
else
{
var mysql = Configuration.GetConnectionString("MySQL").ToString();
var tmp = bll.GetModel(monitorId);
return Json(Tool.GetJsonWithCode(APICode.Success, tmp));
return Json(Tool.GetJsonWithCode(APICode.Fail, "参数输入错误"));
}
}
}
}

View File

@ -25,15 +25,19 @@ namespace CompetitionAPI.Controllers.api
}
/// <summary>
/// //全年进出口商品种类
///
/// </summary>
/// <param name="action"></param>
/// <param name="year">年份</param>
/// <returns></returns>
[HttpGet]
public JsonResult GetGoodNumByYear(int year)
public JsonResult Index(string action,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));
@ -98,18 +102,17 @@ namespace CompetitionAPI.Controllers.api
int index = 1;
dic2.Keys.ToList().ForEach(a =>
{
object lastTmp;
if (index <= 3)
{
//商品名称,重量,单位,占比
lastTmp = new { goodCode=a ,goodName = list_good.Find(b => b.GOODS_CODE == a).STANDARD_NAME, wt = dic2[a], danWei = "kg", percent = dic2[a] / allWT };
var tmp = new { goodName = list_good.Find(b => b.GOODS_CODE == a).STANDARD_NAME, wt = dic2[a], danWei = "kg", percent = dic2[a] / allWT };
}
else
{
lastTmp = new { goodName = "其他", wt = dic2[a], danWei = "kg", percent = dic2[a] / allWT };
var tmp= new { goodName = "其他", wt = dic2[a], danWei = "kg", percent = dic2[a] / allWT };
}
showData.Add(lastTmp);
showData.Add(tmp);
index++;
});
@ -118,13 +121,7 @@ namespace CompetitionAPI.Controllers.api
return Json(Tool.GetJsonWithCode(APICode.Success, data));
}
/// <summary>
/// 在库总量
/// </summary>
/// <returns></returns>
[HttpGet]
public JsonResult GetLastNum()
else if(action=="getLastNum")
{
//在库总量
decimal num=0;
@ -139,14 +136,7 @@ namespace CompetitionAPI.Controllers.api
var data=new {num=num,dw="kg" };
return Json(Tool.GetJsonWithCode(APICode.Success, data));
}
/// <summary>
/// 全年累计进出口传播艘次
/// </summary>
/// <param name="year"></param>
/// <returns></returns>
[HttpGet]
public JsonResult GetBoCiByYear(int year)
else if(action=="getBoCiByYear")
{
//全年累计进出口传播艘次
var mysql = Configuration.GetConnectionString("MySQL").ToString();
@ -173,13 +163,7 @@ namespace CompetitionAPI.Controllers.api
return Json(Tool.GetJsonWithCode(APICode.Success, dic));
}
/// <summary>
/// 全年累计进口总量,按年度查询
/// </summary>
/// <returns></returns>
[HttpGet]
public JsonResult GetInNumByYear(int year)
else if(action=="getInNumByYear")
{
//全年累计进口总量,按年度查询
var mysql = Configuration.GetConnectionString("MySQL").ToString();
@ -206,13 +190,7 @@ namespace CompetitionAPI.Controllers.api
var data = new {dic };
return Json(Tool.GetJsonWithCode(APICode.Success, dic));
}
/// <summary>
/// 本年度和本季度进口总量
/// </summary>
/// <returns></returns>
[HttpGet]
public JsonResult GetInNumWithCurrent()
else if(action== "getInNumWithCurrent")
{
//本年度,本季度进口总量
var mysql = Configuration.GetConnectionString("MySQL").ToString();
@ -258,5 +236,11 @@ 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填写错误"));
}
}
}
}

View File

@ -1,8 +1,5 @@
using Competition.Common.Util;
using CompetitionAPI.api.version;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.IO.Pipelines;
namespace CompetitionAPI.Controllers.api
{
@ -11,7 +8,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>
@ -30,17 +27,15 @@ namespace CompetitionAPI.Controllers.api
Configuration = configuration;
}
/// <summary>
/// 根据皮带秤编码和企业id获取皮带秤信息
/// </summary>
/// <param name="pipeCode"></param>
/// <param name="customCode"></param>
/// <returns></returns>
[HttpGet]
public JsonResult GetInfo(string pipeCode,string monitorId)
public JsonResult Index(string action,string pipeCode,string customCode)
{
if (action == "GetInfo")
{
//获取皮带秤信息
var mysql = Configuration.GetConnectionString("MySQL").ToString();
var pipe = bll_elec_weighter.GetModel(pipeCode, monitorId);
//福州海关下的,本年度
var pipe = bll_elec_weighter.GetModel(pipeCode,customCode);
if (Tool.IsFuZhouCustom(pipe.CUSTOMS_CODE))
{
return Json(Tool.GetJsonWithCode(APICode.Success, pipe));
@ -50,62 +45,14 @@ namespace CompetitionAPI.Controllers.api
return Json(Tool.GetJsonWithCode(APICode.Fail, "不是福州海关数据"));
}
}
/// <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 if (action == "GetHistory")
//{
// //获取历史信息
//}
else
{
return Json(Tool.GetJsonWithCode(APICode.Fail, "请求参数不全"));
return Json(Tool.GetJsonWithCode(APICode.Fail, "action填写错误"));
}
}
}
/// <summary>
/// 获取历史数据
/// </summary>
public class RequestHistoryData
{
public string pipeCode;
public DateTime startTime;
public DateTime endTime;
}
}

View File

@ -1,6 +1,5 @@
using Competition.Common.Util;
using Microsoft.AspNetCore.Mvc;
using NPOI.POIFS.Crypt.Dsig;
namespace CompetitionAPI.Controllers.api
{
@ -9,22 +8,7 @@ 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; }
@ -34,18 +18,20 @@ namespace CompetitionAPI.Controllers.api
}
/// <summary>
/// 首页堆场
/// 首页堆场
/// </summary>
/// <param name="action"></param>
/// <param name="name"></param>
/// <returns></returns>
[HttpGet]
public JsonResult GetAllInfo()
public JsonResult Index(string action)
{
if(action=="getNum")
{
//堆场总数
int allNum = 0;
//堆场面积
decimal allArea = 0;
int allArea = 0;
//筒仓总数
int allSilo = 0;
//读取配置文件示例
@ -55,11 +41,7 @@ namespace CompetitionAPI.Controllers.api
list.ForEach(x =>
{
allNum += int.Parse(x.YARD_NUM);
//格式不标准不计算
if (decimal.TryParse(x.YARD_AREA.Replace("平方米", "").Replace("㎡", "").Replace("㎡", ""), out decimal area))
{
allArea += area;
}
allArea += int.Parse(x.YARD_AREA.Replace("平方米",""));
//不是所有企业都有筒仓
if (!string.IsNullOrEmpty(x.SILO_NUM))
{
@ -70,33 +52,12 @@ namespace CompetitionAPI.Controllers.api
var data = new { allNum = allNum, allArea = allArea, allSilo = allSilo };
return Json(Tool.GetJsonWithCode(APICode.Success, data));
}
/// <summary>
/// 根据企业id获取堆场信息
/// </summary>
/// <param name="monitorId">企业id</param>
/// <returns></returns>
[HttpGet]
public JsonResult GetYardList(string monitorId)
else
{
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));
return Json(Tool.GetJsonWithCode(APICode.Fail, "action填写错误"));
}
}
}
}

View File

@ -1,5 +1,4 @@
using Autofac.Extensions.DependencyInjection;
using CompetitionAPI.Controllers.api;
using Microsoft.AspNetCore.Hosting;
namespace CompetitionAPI
@ -8,9 +7,6 @@ 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();
}