157 lines
6.1 KiB
C#
157 lines
6.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web.Http;
|
|
using System.Web.Http.Description;
|
|
using ESCG = EShang.Common.GeneralMethod;
|
|
using ESCM = EShang.Common.Model;
|
|
using HZQR.Common;
|
|
|
|
namespace EShangApiMain.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 卡口流水表相关接口
|
|
/// </summary>
|
|
public class BAYONETController : BaseController
|
|
{
|
|
#region 获取卡口流水表列表
|
|
/// <summary>
|
|
/// 获取卡口流水表列表
|
|
/// </summary>
|
|
/// <param name="searchModel">查询条件对象</param>
|
|
/// <returns></returns>
|
|
[Route("BigData/GetBAYONETList")]
|
|
[AcceptVerbs("POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.BAYONETModel>>))]
|
|
public IHttpActionResult GetBAYONETList(ESCM.SearchModel<ESCM.BAYONETModel> searchModel)
|
|
{
|
|
string Parameter = "入参信息:查询方式【" + searchModel.QueryType + "】,查询页码【" + searchModel.PageIndex + "】," +
|
|
"每页显示数量【" + searchModel.PageSize + "】,排序条件【" + searchModel.SortStr + "】";
|
|
try
|
|
{
|
|
int TotalCount = 0;
|
|
//获取卡口流水表列表
|
|
List<ESCM.BAYONETModel> BAYONETList = ESCG.BAYONETHelper.GetBAYONETList(
|
|
transaction, ref TotalCount, searchModel);
|
|
|
|
//转化json形式
|
|
Models.JsonList<ESCM.BAYONETModel> jsonList = Models.JsonList<ESCM.BAYONETModel>.Success(
|
|
BAYONETList, TotalCount, searchModel.PageIndex, searchModel.PageSize);
|
|
|
|
return Ok(Models.JsonMsg<Models.JsonList<ESCM.BAYONETModel>>.Success(jsonList, 100, "查询成功"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_GetBAYONETList");
|
|
return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取卡口流水表明细
|
|
/// <summary>
|
|
/// 获取卡口流水表明细
|
|
/// </summary>
|
|
/// <param name="BAYONETId">卡口流水表内码</param>
|
|
/// <returns></returns>
|
|
[Route("BigData/GetBAYONETDetail")]
|
|
[AcceptVerbs("GET")]
|
|
[ResponseType(typeof(Models.JsonMsg<ESCM.BAYONETModel>))]
|
|
public IHttpActionResult GetBAYONETDetail(int BAYONETId)
|
|
{
|
|
string Parameter = "入参信息:卡口流水表内码【" + BAYONETId + "】";
|
|
try
|
|
{
|
|
//获取卡口流水表明细
|
|
ESCM.BAYONETModel bayonetModel = ESCG.BAYONETHelper.GetBAYONETDetail(transaction, BAYONETId);
|
|
|
|
return Ok(Models.JsonMsg<ESCM.BAYONETModel>.Success(bayonetModel, 100, "查询成功"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_GetBAYONETDetail");
|
|
return Ok(Method.Common.ReturnJson(999, "查询失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 同步卡口流水表
|
|
/// <summary>
|
|
/// 同步卡口流水表
|
|
/// </summary>
|
|
/// <param name="bayonetModel"></param>
|
|
/// <returns></returns>
|
|
[Route("BigData/SynchroBAYONET")]
|
|
[AcceptVerbs("POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<string>))]
|
|
public IHttpActionResult SynchroBAYONET(ESCM.BAYONETModel bayonetModel)
|
|
{
|
|
try
|
|
{
|
|
//新增卡口流水表
|
|
bool SynchroFlag = ESCG.BAYONETHelper.SynchroBAYONET(transaction, bayonetModel);
|
|
|
|
if (SynchroFlag)
|
|
{
|
|
return Ok(Method.Common.ReturnJson(100, "同步成功"));
|
|
}
|
|
else
|
|
{
|
|
return Ok(Method.Common.ReturnJson(200, "更新失败,数据不存在!"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
LogUtil.WriteLog(null, "同步失败!失败原因:" + ex.Message,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_SynchroBAYONET");
|
|
return Ok(Method.Common.ReturnJson(999, "同步失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 删除卡口流水表
|
|
/// <summary>
|
|
/// 删除卡口流水表
|
|
/// </summary>
|
|
/// <param name="BAYONETId">卡口流水表内码</param>
|
|
/// <returns></returns>
|
|
[Route("BigData/DeleteBAYONET")]
|
|
[AcceptVerbs("GET", "POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<string>))]
|
|
public IHttpActionResult DeleteBAYONET(int BAYONETId)
|
|
{
|
|
string Parameter = "入参信息:卡口流水表内码【" + BAYONETId + "】";
|
|
try
|
|
{
|
|
//删除卡口流水表
|
|
bool DeleteFlag = ESCG.BAYONETHelper.DeleteBAYONET(transaction, BAYONETId);
|
|
|
|
if (DeleteFlag)
|
|
{
|
|
return Ok(Method.Common.ReturnJson(100, "删除成功"));
|
|
}
|
|
else
|
|
{
|
|
return Ok(Method.Common.ReturnJson(200, "删除失败,数据不存在!"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
LogUtil.WriteLog(null, "删除失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_DeleteBAYONET");
|
|
return Ok(Method.Common.ReturnJson(999, "删除失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
}
|