This commit is contained in:
parent
94d80533c9
commit
893df65bf2
|
@ -24,6 +24,12 @@ namespace CompetitionAPI.Controllers.api
|
|||
Configuration = configuration;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="action"></param>
|
||||
/// <param name="year">年份</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
public JsonResult Index(string action,int year)
|
||||
{
|
||||
|
@ -159,7 +165,7 @@ namespace CompetitionAPI.Controllers.api
|
|||
}
|
||||
else if(action=="getInNumByYear")
|
||||
{
|
||||
//全年累计进口总量
|
||||
//全年累计进口总量,按年度查询
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
//按年度,福州海关下的,进口,BILL_GROSS_WT提单毛重即入库数量
|
||||
var list = bll_storage.GetModelList("I_E_FLAG = 'I' AND YEAR(INSTRG_DATE) = " + year).FindAll(a => Tool.IsFuZhouCustom(a.CUSTOMS_CODE));
|
||||
|
@ -184,6 +190,52 @@ namespace CompetitionAPI.Controllers.api
|
|||
var data = new {dic };
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, dic));
|
||||
}
|
||||
else if(action== "getInNumWithCurrent")
|
||||
{
|
||||
//本年度,本季度进口总量
|
||||
var mysql = Configuration.GetConnectionString("MySQL").ToString();
|
||||
//本年度,福州海关下的,进口,BILL_GROSS_WT提单毛重即入库数量
|
||||
var list = bll_storage.GetModelList("I_E_FLAG = 'I' AND YEAR(INSTRG_DATE) = YEAR(GETDATE())").FindAll(a => Tool.IsFuZhouCustom(a.CUSTOMS_CODE));
|
||||
Dictionary<int, decimal> dic = new Dictionary<int, decimal>();
|
||||
dic.Add(1, 0);
|
||||
dic.Add(2, 0);
|
||||
dic.Add(3, 0);
|
||||
dic.Add(4, 0);
|
||||
dic.Add(5, 0);
|
||||
dic.Add(6, 0);
|
||||
dic.Add(7, 0);
|
||||
dic.Add(8, 0);
|
||||
dic.Add(9, 0);
|
||||
dic.Add(10, 0);
|
||||
dic.Add(11, 0);
|
||||
dic.Add(12, 0);
|
||||
list.ForEach(a =>
|
||||
{
|
||||
dic[a.INSTRG_DATE.Value.Month] += a.BILL_GROSS_WT.Value;
|
||||
});
|
||||
//计算总和
|
||||
decimal sumYear = dic.Sum(a => a.Value);
|
||||
decimal sumQuarter = 0;
|
||||
if (new int[] { 1, 2, 3 }.Contains(DateTime.Now.Month))
|
||||
{
|
||||
sumQuarter = dic[1] + dic[2] + dic[3];
|
||||
}
|
||||
else if(new int[] { 4, 5, 6 }.Contains(DateTime.Now.Month))
|
||||
{
|
||||
sumQuarter = dic[4] + dic[5] + dic[6];
|
||||
}
|
||||
else if (new int[] { 7, 8, 9 }.Contains(DateTime.Now.Month))
|
||||
{
|
||||
sumQuarter = dic[7] + dic[8] + dic[9];
|
||||
}
|
||||
else
|
||||
{
|
||||
sumQuarter = dic[10] + dic[11] + dic[12];
|
||||
}
|
||||
|
||||
var data = new { currentYearSum= sumYear, currentQuarterSum= sumQuarter,dw="kg" };
|
||||
return Json(Tool.GetJsonWithCode(APICode.Success, data));
|
||||
}
|
||||
else
|
||||
{
|
||||
return Json(Tool.GetJsonWithCode(APICode.Fail, "action填写错误"));
|
||||
|
|
Loading…
Reference in New Issue