332 lines
14 KiB
C#
332 lines
14 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web.Http;
|
|
using System.Web.Http.Description;
|
|
using ESCG = GSYWApi.GeneralMethod;
|
|
using ESCM = GSYWApi.Model;
|
|
|
|
namespace GSYWApi.Controllers
|
|
{
|
|
/// <summary>
|
|
/// 报表数据相关接口
|
|
/// </summary>
|
|
public class AnalysisController : BaseController
|
|
{
|
|
#region 获取日结数据列表
|
|
/// <summary>
|
|
/// 获取日结数据列表
|
|
/// </summary>
|
|
/// <param name="searchModel">查询条件对象</param>
|
|
/// <returns></returns>
|
|
[Route("Analysis/GetEndaccountList")]
|
|
[AcceptVerbs("POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.ENDACCOUNTModel>>))]
|
|
public IHttpActionResult GetEndaccountList(Models.SearchModel<ESCM.ENDACCOUNTModel> searchModel)
|
|
{
|
|
string Parameter = "入参信息:查询方式【" + searchModel.QueryType + "】,查询页码【" + searchModel.PageIndex + "】," +
|
|
"每页显示数量【" + searchModel.PageSize + "】,排序条件【" + searchModel.SortStr + "】";
|
|
try
|
|
{
|
|
int TotalCount = 0;
|
|
//获取日结数据列表
|
|
List<ESCM.ENDACCOUNTModel> ENDACCOUNTList = ESCG.ENDACCOUNTHelper.GetENDACCOUNTList(
|
|
transaction, ref TotalCount, searchModel);
|
|
|
|
//转化json形式
|
|
Models.JsonList<ESCM.ENDACCOUNTModel> jsonList = Models.JsonList<ESCM.ENDACCOUNTModel>.Success(
|
|
ENDACCOUNTList, TotalCount, searchModel.PageIndex, searchModel.PageSize);
|
|
|
|
return Ok(Models.JsonMsg<Models.JsonList<ESCM.ENDACCOUNTModel>>.Success(jsonList, 100, "查询成功"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
Helper.LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_GetEndaccountList");
|
|
return Ok(Helper.Common.ReturnJson(999, "查询失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取日结数据明细
|
|
/// <summary>
|
|
/// 获取日结数据明细
|
|
/// </summary>
|
|
/// <param name="EndaccountId">日结数据内码</param>
|
|
/// <returns></returns>
|
|
[Route("Analysis/GetEndaccountDetail")]
|
|
[AcceptVerbs("GET")]
|
|
[ResponseType(typeof(Models.JsonMsg<ESCM.ENDACCOUNTModel>))]
|
|
public IHttpActionResult GetEndaccountDetail(int EndaccountId)
|
|
{
|
|
string Parameter = "入参信息:日结数据内码【" + EndaccountId + "】";
|
|
try
|
|
{
|
|
//获取日结数据明细
|
|
ESCM.ENDACCOUNTModel endaccountModel = ESCG.ENDACCOUNTHelper.GetENDACCOUNTDetail(transaction, EndaccountId);
|
|
|
|
return Ok(Models.JsonMsg<ESCM.ENDACCOUNTModel>.Success(endaccountModel, 100, "查询成功"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
Helper.LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_GetEndaccountDetail");
|
|
return Ok(Helper.Common.ReturnJson(999, "查询失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 同步日结数据
|
|
/// <summary>
|
|
/// 同步日结数据
|
|
/// </summary>
|
|
/// <param name="endaccountModel"></param>
|
|
/// <returns></returns>
|
|
[Route("Analysis/SynchroEndaccount")]
|
|
[AcceptVerbs("POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<string>))]
|
|
public IHttpActionResult SynchroEndaccount(ESCM.ENDACCOUNTModel endaccountModel)
|
|
{
|
|
try
|
|
{
|
|
//新增日结数据
|
|
bool SynchroFlag = ESCG.ENDACCOUNTHelper.SynchroENDACCOUNT(transaction, endaccountModel);
|
|
|
|
if (SynchroFlag)
|
|
{
|
|
return Ok(Helper.Common.ReturnJson(100, "同步成功"));
|
|
}
|
|
else
|
|
{
|
|
return Ok(Helper.Common.ReturnJson(200, "更新失败,数据不存在!"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
Helper.LogUtil.WriteLog(null, "同步失败!失败原因:" + ex.Message,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_SynchroEndaccount");
|
|
return Ok(Helper.Common.ReturnJson(999, "同步失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 删除日结数据
|
|
/// <summary>
|
|
/// 删除日结数据
|
|
/// </summary>
|
|
/// <param name="EndaccountId">日结数据内码</param>
|
|
/// <returns></returns>
|
|
[Route("Analysis/DeleteEndaccount")]
|
|
[AcceptVerbs("GET", "POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<string>))]
|
|
public IHttpActionResult DeleteEndaccount(int EndaccountId)
|
|
{
|
|
string Parameter = "入参信息:日结数据内码【" + EndaccountId + "】";
|
|
try
|
|
{
|
|
//删除日结数据
|
|
bool DeleteFlag = ESCG.ENDACCOUNTHelper.DeleteENDACCOUNT(transaction, EndaccountId);
|
|
|
|
if (DeleteFlag)
|
|
{
|
|
return Ok(Helper.Common.ReturnJson(100, "删除成功"));
|
|
}
|
|
else
|
|
{
|
|
return Ok(Helper.Common.ReturnJson(200, "删除失败,数据不存在!"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
Helper.LogUtil.WriteLog(null, "删除失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_DeleteEndaccount");
|
|
return Ok(Helper.Common.ReturnJson(999, "删除失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取收银员报表列表
|
|
/// <summary>
|
|
/// 获取收银员报表列表
|
|
/// </summary>
|
|
/// <param name="searchModel">查询条件对象</param>
|
|
/// <returns></returns>
|
|
[Route("Analysis/GetPersonsellList")]
|
|
[AcceptVerbs("POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.PERSONSELLModel>>))]
|
|
public IHttpActionResult GetPersonsellList(Models.SearchModel<ESCM.PERSONSELLModel> searchModel)
|
|
{
|
|
string Parameter = "入参信息:查询方式【" + searchModel.QueryType + "】,查询页码【" + searchModel.PageIndex + "】," +
|
|
"每页显示数量【" + searchModel.PageSize + "】,排序条件【" + searchModel.SortStr + "】";
|
|
try
|
|
{
|
|
int TotalCount = 0;
|
|
//获取收银员报表列表
|
|
List<ESCM.PERSONSELLModel> PERSONSELLList = ESCG.PERSONSELLHelper.GetPERSONSELLList(
|
|
transaction, ref TotalCount, searchModel);
|
|
|
|
//转化json形式
|
|
Models.JsonList<ESCM.PERSONSELLModel> jsonList = Models.JsonList<ESCM.PERSONSELLModel>.Success(
|
|
PERSONSELLList, TotalCount, searchModel.PageIndex, searchModel.PageSize);
|
|
|
|
return Ok(Models.JsonMsg<Models.JsonList<ESCM.PERSONSELLModel>>.Success(jsonList, 100, "查询成功"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
Helper.LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_GetPersonsellList");
|
|
return Ok(Helper.Common.ReturnJson(999, "查询失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取收银员报表明细
|
|
/// <summary>
|
|
/// 获取收银员报表明细
|
|
/// </summary>
|
|
/// <param name="PersonsellId">收银员报表内码</param>
|
|
/// <returns></returns>
|
|
[Route("Analysis/GetPersonsellDetail")]
|
|
[AcceptVerbs("GET")]
|
|
[ResponseType(typeof(Models.JsonMsg<ESCM.PERSONSELLModel>))]
|
|
public IHttpActionResult GetPersonsellDetail(int PersonsellId)
|
|
{
|
|
string Parameter = "入参信息:收银员报表内码【" + PersonsellId + "】";
|
|
try
|
|
{
|
|
//获取收银员报表明细
|
|
ESCM.PERSONSELLModel personsellModel = ESCG.PERSONSELLHelper.GetPERSONSELLDetail(transaction, PersonsellId);
|
|
|
|
return Ok(Models.JsonMsg<ESCM.PERSONSELLModel>.Success(personsellModel, 100, "查询成功"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
Helper.LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_GetPersonsellDetail");
|
|
return Ok(Helper.Common.ReturnJson(999, "查询失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 同步收银员报表
|
|
/// <summary>
|
|
/// 同步收银员报表
|
|
/// </summary>
|
|
/// <param name="personsellModel"></param>
|
|
/// <returns></returns>
|
|
[Route("Analysis/SynchroPersonsell")]
|
|
[AcceptVerbs("POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<string>))]
|
|
public IHttpActionResult SynchroPersonsell(ESCM.PERSONSELLModel personsellModel)
|
|
{
|
|
try
|
|
{
|
|
//新增收银员报表
|
|
bool SynchroFlag = ESCG.PERSONSELLHelper.SynchroPERSONSELL(transaction, personsellModel);
|
|
|
|
if (SynchroFlag)
|
|
{
|
|
return Ok(Helper.Common.ReturnJson(100, "同步成功"));
|
|
}
|
|
else
|
|
{
|
|
return Ok(Helper.Common.ReturnJson(200, "更新失败,数据不存在!"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
Helper.LogUtil.WriteLog(null, "同步失败!失败原因:" + ex.Message,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_SynchroPersonsell");
|
|
return Ok(Helper.Common.ReturnJson(999, "同步失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 删除收银员报表
|
|
/// <summary>
|
|
/// 删除收银员报表
|
|
/// </summary>
|
|
/// <param name="PersonsellId">收银员报表内码</param>
|
|
/// <returns></returns>
|
|
[Route("Analysis/DeletePersonsell")]
|
|
[AcceptVerbs("GET", "POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<string>))]
|
|
public IHttpActionResult DeletePersonsell(int PersonsellId)
|
|
{
|
|
string Parameter = "入参信息:收银员报表内码【" + PersonsellId + "】";
|
|
try
|
|
{
|
|
//删除
|
|
bool DeleteFlag = ESCG.PERSONSELLHelper.DeletePERSONSELL(transaction, PersonsellId);
|
|
|
|
if (DeleteFlag)
|
|
{
|
|
return Ok(Helper.Common.ReturnJson(100, "删除成功"));
|
|
}
|
|
else
|
|
{
|
|
return Ok(Helper.Common.ReturnJson(200, "删除失败,数据不存在!"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
Helper.LogUtil.WriteLog(null, "删除失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_DeletePersonsell");
|
|
return Ok(Helper.Common.ReturnJson(999, "删除失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 获取单品数据列表
|
|
/// <summary>
|
|
/// 获取单品数据列表
|
|
/// </summary>
|
|
/// <param name="searchModel">查询条件对象</param>
|
|
/// <returns></returns>
|
|
[Route("Analysis/GetCommoditySaleList")]
|
|
[AcceptVerbs("POST")]
|
|
[ResponseType(typeof(Models.JsonMsg<Models.JsonList<ESCM.COMMODITYSALEModel>>))]
|
|
public IHttpActionResult GetCommoditySaleList(Models.SearchModel<ESCM.COMMODITYSALEModel> searchModel)
|
|
{
|
|
string Parameter = "入参信息:查询方式【" + searchModel.QueryType + "】,查询页码【" + searchModel.PageIndex + "】," +
|
|
"每页显示数量【" + searchModel.PageSize + "】,排序条件【" + searchModel.SortStr + "】";
|
|
try
|
|
{
|
|
int TotalCount = 0;
|
|
//获取单品数据列表
|
|
List<ESCM.COMMODITYSALEModel> COMMODITYSALEList = ESCG.COMMODITYSALEHelper.GetCOMMODITYSALEList(
|
|
transaction, ref TotalCount, searchModel);
|
|
|
|
//转化json形式
|
|
Models.JsonList<ESCM.COMMODITYSALEModel> jsonList = Models.JsonList<ESCM.COMMODITYSALEModel>.Success(
|
|
COMMODITYSALEList, TotalCount, searchModel.PageIndex, searchModel.PageSize);
|
|
|
|
return Ok(Models.JsonMsg<Models.JsonList<ESCM.COMMODITYSALEModel>>.Success(jsonList, 100, "查询成功"));
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
//事务回滚
|
|
transaction.Rollback();
|
|
Helper.LogUtil.WriteLog(null, "查询失败!失败原因:" + ex.Message + "\r\n" + Parameter,
|
|
DateTime.Now.ToString("yyyyMMdd") + "_GetCommoditySaleList");
|
|
return Ok(Helper.Common.ReturnJson(999, "查询失败" + ex.Message));
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |