ZHJA_HJGL/HJGL_ZH/WebAPI/Controllers/WeldController.cs

104 lines
2.2 KiB
C#

using BLL.API;
using Model;
using Model.APIItem;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Http;
namespace WebAPI.Controllers
{
public class WeldController: ApiController
{
[HttpGet]
public Model.ResponeData usingPlanList(string weldName, string needConfirm, string userId, string useState, int page, int pageSize)
{
Model.ResponeData respone = new ResponeData();
try
{
if (string.IsNullOrEmpty(weldName) || weldName == "null")
{
weldName = "";
}
if (string.IsNullOrEmpty(needConfirm) || needConfirm == "null")
{
needConfirm = "";
}
if (string.IsNullOrEmpty(userId) || userId == "null")
{
userId = "";
}
if (string.IsNullOrEmpty(useState) || useState == "null")
{
useState = "";
}
return APIWeldServices.usingPlanList(weldName, needConfirm, userId, useState, page, pageSize);
}
catch (Exception e)
{
respone.code = 0;
respone.message = e.Message;
}
return respone;
}
[HttpGet]
public Model.ResponeData getUsingPlanById(string usingPlanId)
{
Model.ResponeData respone = new ResponeData();
try
{
return APIWeldServices.getUsingPlanById(usingPlanId);
}
catch (Exception e)
{
respone.code = 0;
respone.message = e.Message;
}
return respone;
}
[HttpGet]
public Model.ResponeData welderQueIsPass(string welderId, string steelType, bool isSteelStru )
{
Model.ResponeData respone = new ResponeData();
try
{
if (string.IsNullOrEmpty(welderId) || welderId == "null")
{
welderId = "";
}
if (string.IsNullOrEmpty(steelType) || steelType == "null")
{
steelType = "";
}
return APIWeldServices.welderQueIsPass( welderId, steelType, isSteelStru);
}
catch (Exception e)
{
respone.code = 0;
respone.message = e.Message;
}
return respone;
}
[HttpPost]
public Model.ResponeData addUsingPlan([FromBody] UsingPlanItem usingPlan)
{
Model.ResponeData respone = new ResponeData();
try
{
return APIWeldServices.addUsingPlan(usingPlan);
}
catch (Exception e)
{
respone.code = 0;
respone.message = e.Message;
}
return respone;
}
}
}