52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using DataServer.api;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net;
|
|
using System.Net.Http;
|
|
using System.Text;
|
|
using System.Web.Http;
|
|
|
|
namespace JinanCementFactoryAPI.Controllers.api
|
|
{
|
|
/// <summary>
|
|
/// 刚性可调负荷
|
|
/// </summary>
|
|
public class GetRigidAdjustableLoadsController : ApiController
|
|
{
|
|
DataServer.BLL.adjustable_load bll = new DataServer.BLL.adjustable_load();
|
|
// GET api/<controller>
|
|
public HttpResponseMessage Get()
|
|
{
|
|
var res = new get_rigid_adjustable_loads();
|
|
try
|
|
{
|
|
var list = bll.GetModelList("");
|
|
var alist = new List<rigid_adjustable_loadsData>();
|
|
var model = new rigid_adjustable_loadsData();
|
|
foreach (var item in list)
|
|
{
|
|
model.QuantityFacility = list.Count();
|
|
if (item.StiffnessGrade == "三级")
|
|
{
|
|
model.Rigidity += Convert.ToInt32(item.NumericalValue);
|
|
}
|
|
model.GrossValue += Convert.ToInt32(item.NumericalValue);
|
|
|
|
}
|
|
alist.Add(model);
|
|
res.code = 200;
|
|
res.msg = "成功";
|
|
res.data = alist;
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
res.code = 500;
|
|
res.msg = ex.Message;
|
|
}
|
|
HttpResponseMessage result = new HttpResponseMessage { Content = new StringContent(JsonConvert.SerializeObject(res), Encoding.GetEncoding("UTF-8"), "application/json") };
|
|
return result;
|
|
}
|
|
}
|
|
} |