204 lines
8.8 KiB
C#
204 lines
8.8 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 EShangApi.Controllers
|
||
{
|
||
/// <summary>
|
||
/// 业务办理日志表相关接口
|
||
/// </summary>
|
||
public class BusinessLogController : BaseController
|
||
{
|
||
#region 获取业务办理日志表列表
|
||
/// <summary>
|
||
/// 获取业务办理日志表列表
|
||
/// </summary>
|
||
/// <param name="ServerpartCode">服务区编码</param>
|
||
/// <param name="ShopCode">门店编码</param>
|
||
/// <param name="MachineCode">机器编码</param>
|
||
/// <param name="BusinessLogType">日志类型:<br/>
|
||
/// 0:文件解压<br/>
|
||
/// 1:银行到账差异<br/>
|
||
/// 205000:商超类单品销售<br/>
|
||
/// 507000:总仓异常库存<br/>
|
||
/// 705000:餐饮类单品销售</param>
|
||
/// <param name="CheckState">待处理标识:<br/>0【待处理】,1【无异常】</param>
|
||
/// <param name="ReloadData">是否查询需要重传数据的记录,true/false</param>
|
||
/// <param name="PageIndex">查询页码数</param>
|
||
/// <param name="PageSize">每页显示行数</param>
|
||
/// <param name="StartDate">记录发生开始日期</param>
|
||
/// <param name="EndDate">记录发生结束日期</param>
|
||
/// <param name="DataType">数据类型:<br/>1【正式数据】<br/>2【历史数据】</param>
|
||
/// <returns></returns>
|
||
[Route("BusinessLog/GetBusinessLogList")]
|
||
[AcceptVerbs("GET", "POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.BusinessLogModel>>))]
|
||
public IHttpActionResult GetBusinessLogList(string ServerpartCode = "", string ShopCode = "", string MachineCode = "",
|
||
string BusinessLogType = "", string CheckState = "", bool? ReloadData = null, int PageIndex = 1, int PageSize = 10,
|
||
decimal? StartDate = null, decimal? EndDate = null, int DataType = 1)
|
||
{
|
||
string Parameter = "入参信息:查询页码【" + PageIndex + "】,每页显示数量【" + PageSize + "】";
|
||
try
|
||
{
|
||
int TotalCount = 0;
|
||
//获取业务办理日志表列表
|
||
List<ESCM.BusinessLogModel> BusinessLogList = ESCG.BusinessLogHelper.GetBusinessLogList(transaction,
|
||
ServerpartCode, ShopCode, MachineCode, BusinessLogType, CheckState, ReloadData,
|
||
ref TotalCount, PageIndex, PageSize, StartDate, EndDate, DataType);
|
||
|
||
//转化json形式
|
||
Models.JsonList<ESCM.BusinessLogModel> jsonList = Models.JsonList<ESCM.BusinessLogModel>.Success(
|
||
BusinessLogList, TotalCount, PageIndex, PageSize);
|
||
|
||
return Ok(Models.JsonMsg<Models.JsonList<ESCM.BusinessLogModel>>.Success(jsonList, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBusinessLogList");
|
||
return Ok(Helper.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 获取业务办理日志表明细
|
||
/// <summary>
|
||
/// 获取业务办理日志表明细
|
||
/// </summary>
|
||
/// <param name="BusinessLogId">业务办理日志表内码</param>
|
||
/// <param name="DataType">数据类型:<br/>1【正式数据】<br/>2【历史数据】</param>
|
||
/// <returns></returns>
|
||
[Route("BusinessLog/GetBusinessLogDetail")]
|
||
[AcceptVerbs("GET", "POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<ESCM.BusinessLogModel>))]
|
||
public IHttpActionResult GetBusinessLogDetail(int BusinessLogId, int DataType = 1)
|
||
{
|
||
string Parameter = "入参信息:业务办理日志表内码【" + BusinessLogId + "】";
|
||
try
|
||
{
|
||
//获取业务办理日志表明细
|
||
ESCM.BusinessLogModel businesslogModel = ESCG.BusinessLogHelper.GetBusinessLogDetail(
|
||
transaction, BusinessLogId, DataType);
|
||
|
||
return Ok(Models.JsonMsg<ESCM.BusinessLogModel>.Success(businesslogModel, 100, "查询成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_GetBusinessLogDetail");
|
||
return Ok(Helper.Common.ReturnJson(999, "查询失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 同步业务办理日志表
|
||
/// <summary>
|
||
/// 同步业务办理日志表
|
||
/// </summary>
|
||
/// <param name="BusinessLogId">业务日志表内码</param>
|
||
/// <param name="BusinessLogContent">业务日志内容</param>
|
||
/// <returns></returns>
|
||
[Route("BusinessLog/SynchroBusinessLog")]
|
||
[AcceptVerbs("GET", "POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult SynchroBusinessLog(int BusinessLogId, string BusinessLogContent)
|
||
{
|
||
try
|
||
{
|
||
//新增现场稽核异常表
|
||
bool SynchroFlag = ESCG.BusinessLogHelper.SynchroBusinessLog(transaction, BusinessLogId, BusinessLogContent);
|
||
|
||
if (SynchroFlag)
|
||
{
|
||
return Ok(Helper.Common.ReturnJson(100, "同步成功"));
|
||
}
|
||
else
|
||
{
|
||
return Ok(Helper.Common.ReturnJson(200, "更新失败,数据不存在!"));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "同步失败!失败原因:" + ex.Message,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_SynchroBusinessLog");
|
||
return Ok(Helper.Common.ReturnJson(999, "同步失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 删除业务办理日志表
|
||
/// <summary>
|
||
/// 删除业务办理日志表
|
||
/// </summary>
|
||
/// <param name="BusinessLogId">业务办理日志表内码</param>
|
||
/// <returns></returns>
|
||
[Route("BusinessLog/DeleteBusinessLog")]
|
||
[AcceptVerbs("GET", "POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult DeleteBusinessLog(int BusinessLogId)
|
||
{
|
||
string Parameter = "入参信息:业务办理日志表内码【" + BusinessLogId + "】";
|
||
try
|
||
{
|
||
//删除业务办理日志表
|
||
bool DeleteFlag = ESCG.BusinessLogHelper.DeleteBusinessLog(transaction, BusinessLogId);
|
||
|
||
if (DeleteFlag)
|
||
{
|
||
return Ok(Helper.Common.ReturnJson(100, "删除成功"));
|
||
}
|
||
else
|
||
{
|
||
return Ok(Helper.Common.ReturnJson(200, "删除失败,数据不存在!"));
|
||
}
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "删除失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_DeleteBusinessLog");
|
||
return Ok(Helper.Common.ReturnJson(999, "删除失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 更新历史业务办理日志表数据
|
||
/// <summary>
|
||
/// 更新历史业务办理日志表数据
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
[Route("BusinessLog/ModifyData")]
|
||
[AcceptVerbs("GET", "POST")]
|
||
[ResponseType(typeof(Models.JsonMsg<string>))]
|
||
public IHttpActionResult ModifyData()
|
||
{
|
||
try
|
||
{
|
||
//删除业务办理日志表
|
||
ESCG.BusinessLogHelper.ModifyData(transaction);
|
||
|
||
return Ok(Helper.Common.ReturnJson(100, "更新成功"));
|
||
}
|
||
catch (Exception ex)
|
||
{
|
||
//事务回滚
|
||
transaction.Rollback();
|
||
LogUtil.WriteLog(null, "更新失败!失败原因:" + ex.Message,
|
||
DateTime.Now.ToString("yyyyMMdd") + "_ModifyData");
|
||
return Ok(Helper.Common.ReturnJson(999, "更新失败" + ex.Message));
|
||
}
|
||
}
|
||
#endregion
|
||
}
|
||
} |