using HH.AutoBom.Core;
using HH.WMS.Entitys.Basic;
using HH.WMS.WebUI.Controllers;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace HH.WMS.WebUI.Areas.Sys.Controllers
{
public class InterfaceDefController : BaseController
{
public ActionResult Index()
{
return View();
}
public ActionResult RequestLog()
{
return View();
}
public ActionResult EditParam(string intfCode,string paramGuid)
{
ViewData["IntfCode"] = intfCode;
ViewData["ParamGuid"] = paramGuid;
return View();
}
public ActionResult Edit(string intfCode)
{
ViewData["IntfCode"] = intfCode;
return View();
}
#region 根据业务号获取实体
///
/// 根据业务号获取实体
///
/// 托盘号
///
/// [Hanhe(DBS)] CREATED BY 2018-12-07
public string GetModel(string intfCode)
{
return HttpWMS_Get("Api/InterfaceDef/GetModel?intfCode=" + intfCode);
}
#endregion
#region 接口定义查询
///
/// 出入库业务查询
///
/// 分页索引
/// 分页大小
///
/// [Hanhe(DBS)] created by 2018/12/04
public string GetList(int pageIndex, int pageSize, string name)
{
var loginer = FormsAuth.GetUserData();
var searchModel = new
{
TokenId = loginer.Extend1,
pageIndex = pageIndex,
pageSize = pageSize,
SearchCondition = new
{
CN_S_INTF_NAME = name
}
};
return HttpWMS_Post("api/InterfaceDef/GetList", JsonConvert.SerializeObject(searchModel));
}
#endregion
#region 新增
///
/// 新增
///
///
///
/// [Hanhe(DBS)] created by 2018/12/04
[HttpPost]
public string Add(TN_WM_INTERFACE_DEFEntity model)
{
var loginer = FormsAuth.GetUserData();
model.TokenId = loginer.Extend1;
model.CN_S_CREATOR = model.CN_S_MODIFY = loginer.UserCode;
model.CN_S_CREATOR_BY = model.CN_S_MODIFY_BY = loginer.UserName;
model.CN_T_CREATE = model.CN_T_MODIFY = DateTime.Now;
return HttpWMS_Post("Api/InterfaceDef/Add", JsonConvert.SerializeObject(model));
}
#endregion
///
/// 新增
///
///
///
/// [Hanhe(DBS)] created by 2018/12/04
[HttpPost]
public string IntfParamAdd(TN_WM_INTERFACE_PARAMEntity model)
{
var loginer = FormsAuth.GetUserData();
model.TokenId = loginer.Extend1;
model.CN_S_CREATOR = model.CN_S_MODIFY = loginer.UserCode;
model.CN_S_CREATOR_BY = model.CN_S_MODIFY_BY = loginer.UserName;
model.CN_T_CREATE = model.CN_T_MODIFY = DateTime.Now;
return HttpWMS_Post("Api/InterfaceDef/IntfParamAdd", JsonConvert.SerializeObject(model));
}
///
/// 更新
///
///
///
/// [Hanhe(DBS)] created by 2018/12/04
[HttpPost]
public string IntfParamUpdate(TN_WM_INTERFACE_PARAMEntity model)
{
var loginer = FormsAuth.GetUserData();
model.TokenId = loginer.Extend1;
model.CN_S_MODIFY = loginer.UserCode;
model.CN_S_MODIFY_BY = loginer.UserName;
model.CN_T_MODIFY = DateTime.Now;
return HttpWMS_Post("Api/InterfaceDef/IntfParamUpdate", JsonConvert.SerializeObject(model));
}
#region 更新
///
/// 更新
///
///
///
/// [Hanhe(DBS)] created by 2018/12/04
[HttpPost]
public string Update(TN_WM_INTERFACE_DEFEntity model)
{
var loginer = FormsAuth.GetUserData();
model.TokenId = loginer.Extend1;
model.CN_S_MODIFY = loginer.UserCode;
model.CN_S_MODIFY_BY = loginer.UserName;
model.CN_T_MODIFY = DateTime.Now;
return HttpWMS_Post("Api/InterfaceDef/Update", JsonConvert.SerializeObject(model));
}
#endregion
#region 获取接口参数定义
///
/// 获取接口参数定义
///
///
///
/// [Hanhe(DBS)] created by 2018/12/04
public string GetParamsDef(string intfCode)
{
return HttpWMS_Get("Api/InterfaceDef/GetParamsDef?intfCode=" + intfCode);
}
#endregion
public string GetRequestLogList(int pageIndex, int pageSize, string intfCode,string key)
{
var loginer = FormsAuth.GetUserData();
var searchModel = new
{
TokenId = loginer.Extend1,
pageIndex = pageIndex,
pageSize = pageSize,
SearchCondition = new
{
CN_S_INTF_CODE = intfCode,
CN_S_REQUEST = key
}
};
return HttpWMS_Post("api/InterfaceDef/GetRequestLogList", JsonConvert.SerializeObject(searchModel));
}
#region 重新下发接口指令
public string ReSend(string guid)
{
return HttpWMS_Get("api/InterfaceDef/ReSend?guid=" + guid);
}
#endregion
}
}