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); return dal.GetListByPage( strWhere, orderby, startIndex, endIndex);
} }
///// <summary> /// <summary>
///// 分页获取数据列表 /// 分页获取数据列表
///// </summary> /// </summary>
//public DataSet GetList(int PageSize,int PageIndex,string strWhere) //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
//{ //{
//return dal.GetList(PageSize,PageIndex,strWhere); //return dal.GetList(PageSize,PageIndex,strWhere);
@ -180,16 +180,7 @@ namespace Competition.Mysql.BLL
#endregion BasicMethod #endregion BasicMethod
#region ExtensionMethod #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 #endregion ExtensionMethod
} }
} }

View File

@ -693,33 +693,7 @@ namespace Competition.Mysql.DAL
#endregion BasicMethod #endregion BasicMethod
#region ExtensionMethod #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 #endregion ExtensionMethod
} }
} }

View File

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

View File

@ -25,15 +25,19 @@ namespace CompetitionAPI.Controllers.api
} }
/// <summary> /// <summary>
/// //全年进出口商品种类 ///
/// </summary> /// </summary>
/// <param name="action"></param> /// <param name="action"></param>
/// <param name="year">年份</param> /// <param name="year">年份</param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public JsonResult GetGoodNumByYear(int year) public JsonResult Index(string action,int year)
{ {
if (action == "getGoodNumThisYear")
{
//进出口商品种类
var mysql = Configuration.GetConnectionString("MySQL").ToString(); var mysql = Configuration.GetConnectionString("MySQL").ToString();
//福州海关下的,本年度,按货种分类 //福州海关下的,本年度,按货种分类
var list_good = bll_good.GetModelList(""); var list_good = bll_good.GetModelList("");
var list = bll_storage.GetModelList("YEAR(INSTRG_DATE) = YEAR(GETDATE())").FindAll(a=> Tool.IsFuZhouCustom(a.CUSTOMS_CODE)); 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; int index = 1;
dic2.Keys.ToList().ForEach(a => dic2.Keys.ToList().ForEach(a =>
{ {
object lastTmp;
if (index <= 3) 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 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++; index++;
}); });
@ -118,13 +121,7 @@ namespace CompetitionAPI.Controllers.api
return Json(Tool.GetJsonWithCode(APICode.Success, data)); return Json(Tool.GetJsonWithCode(APICode.Success, data));
} }
else if(action=="getLastNum")
/// <summary>
/// 在库总量
/// </summary>
/// <returns></returns>
[HttpGet]
public JsonResult GetLastNum()
{ {
//在库总量 //在库总量
decimal num=0; decimal num=0;
@ -139,14 +136,7 @@ namespace CompetitionAPI.Controllers.api
var data=new {num=num,dw="kg" }; var data=new {num=num,dw="kg" };
return Json(Tool.GetJsonWithCode(APICode.Success, data)); 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(); var mysql = Configuration.GetConnectionString("MySQL").ToString();
@ -173,13 +163,7 @@ namespace CompetitionAPI.Controllers.api
return Json(Tool.GetJsonWithCode(APICode.Success, dic)); 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(); var mysql = Configuration.GetConnectionString("MySQL").ToString();
@ -206,13 +190,7 @@ namespace CompetitionAPI.Controllers.api
var data = new {dic }; var data = new {dic };
return Json(Tool.GetJsonWithCode(APICode.Success, 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(); var mysql = Configuration.GetConnectionString("MySQL").ToString();
@ -258,5 +236,11 @@ namespace CompetitionAPI.Controllers.api
var data = new { currentYearSum= sumYear, currentQuarterSum= sumQuarter,dw="kg" }; var data = new { currentYearSum= sumYear, currentQuarterSum= sumQuarter,dw="kg" };
return Json(Tool.GetJsonWithCode(APICode.Success, data)); 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 Competition.Common.Util;
using CompetitionAPI.api.version;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.IO.Pipelines;
namespace CompetitionAPI.Controllers.api namespace CompetitionAPI.Controllers.api
{ {
@ -11,7 +8,7 @@ namespace CompetitionAPI.Controllers.api
public class WeighterController : Controller public class WeighterController : Controller
{ {
/// <summary> /// <summary>
/// 皮带秤 /// 相机
/// </summary> /// </summary>
Competition.Mysql.BLL.T_BAS_ELEC_WEIGHTER bll_elec_weighter = new Competition.Mysql.BLL.T_BAS_ELEC_WEIGHTER(); Competition.Mysql.BLL.T_BAS_ELEC_WEIGHTER bll_elec_weighter = new Competition.Mysql.BLL.T_BAS_ELEC_WEIGHTER();
/// <summary> /// <summary>
@ -30,17 +27,15 @@ namespace CompetitionAPI.Controllers.api
Configuration = configuration; Configuration = configuration;
} }
/// <summary>
/// 根据皮带秤编码和企业id获取皮带秤信息
/// </summary>
/// <param name="pipeCode"></param>
/// <param name="customCode"></param>
/// <returns></returns>
[HttpGet] [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 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)) if (Tool.IsFuZhouCustom(pipe.CUSTOMS_CODE))
{ {
return Json(Tool.GetJsonWithCode(APICode.Success, pipe)); return Json(Tool.GetJsonWithCode(APICode.Success, pipe));
@ -50,62 +45,14 @@ namespace CompetitionAPI.Controllers.api
return Json(Tool.GetJsonWithCode(APICode.Fail, "不是福州海关数据")); 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 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 Competition.Common.Util;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using NPOI.POIFS.Crypt.Dsig;
namespace CompetitionAPI.Controllers.api namespace CompetitionAPI.Controllers.api
{ {
@ -9,22 +8,7 @@ namespace CompetitionAPI.Controllers.api
[ApiController] [ApiController]
public class YardController : Controller public class YardController : Controller
{ {
/// <summary>
/// 企业表
/// </summary>
Competition.Mysql.BLL.T_BAS_CORPORATION bll_corporation = new Competition.Mysql.BLL.T_BAS_CORPORATION(); 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; } public IConfiguration Configuration { get; }
@ -34,18 +18,20 @@ namespace CompetitionAPI.Controllers.api
} }
/// <summary> /// <summary>
/// 首页堆场 /// 首页堆场
/// </summary> /// </summary>
/// <param name="action"></param> /// <param name="action"></param>
/// <param name="name"></param> /// <param name="name"></param>
/// <returns></returns> /// <returns></returns>
[HttpGet] [HttpGet]
public JsonResult GetAllInfo() public JsonResult Index(string action)
{
if(action=="getNum")
{ {
//堆场总数 //堆场总数
int allNum = 0; int allNum = 0;
//堆场面积 //堆场面积
decimal allArea = 0; int allArea = 0;
//筒仓总数 //筒仓总数
int allSilo = 0; int allSilo = 0;
//读取配置文件示例 //读取配置文件示例
@ -55,11 +41,7 @@ namespace CompetitionAPI.Controllers.api
list.ForEach(x => list.ForEach(x =>
{ {
allNum += int.Parse(x.YARD_NUM); 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)) if (!string.IsNullOrEmpty(x.SILO_NUM))
{ {
@ -70,33 +52,12 @@ namespace CompetitionAPI.Controllers.api
var data = new { allNum = allNum, allArea = allArea, allSilo = allSilo }; var data = new { allNum = allNum, allArea = allArea, allSilo = allSilo };
return Json(Tool.GetJsonWithCode(APICode.Success, data)); return Json(Tool.GetJsonWithCode(APICode.Success, data));
} }
else
/// <summary>
/// 根据企业id获取堆场信息
/// </summary>
/// <param name="monitorId">企业id</param>
/// <returns></returns>
[HttpGet]
public JsonResult GetYardList(string monitorId)
{ {
var mysql = Configuration.GetConnectionString("MySQL").ToString(); return Json(Tool.GetJsonWithCode(APICode.Fail, "action填写错误"));
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));
} }
} }
}
} }

View File

@ -1,5 +1,4 @@
using Autofac.Extensions.DependencyInjection; using Autofac.Extensions.DependencyInjection;
using CompetitionAPI.Controllers.api;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
namespace CompetitionAPI namespace CompetitionAPI
@ -8,9 +7,6 @@ namespace CompetitionAPI
{ {
public static void Main(string[] args) 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(); //log4net.Config.XmlConfigurator.Configure();
CreateHostBuilder(args).Build().Run(); CreateHostBuilder(args).Build().Run();
} }