236 lines
10 KiB
C#
236 lines
10 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using SuperMap.RealEstate.ServiceModel;
|
|
using Business = SuperMap.RealEstate.SendRec.Storage.Business;
|
|
using HCC = HZQR.Common.Common;
|
|
using HZQR.Common;
|
|
|
|
namespace EShang.Common.GeneralMethod
|
|
{
|
|
/// <summary>
|
|
/// 餐饮成本核算相关方法
|
|
/// 2024/9/12 17:21:01自动生成
|
|
/// </summary>
|
|
public class SENDRECCOSTHelper
|
|
{
|
|
#region 获取餐饮成本核算列表
|
|
/// <summary>
|
|
/// 获取餐饮成本核算列表
|
|
/// </summary>
|
|
/// <param name="transaction">事务管理器</param>
|
|
/// <param name="TotalCount">查询结果总数</param>
|
|
/// <param name="searchModel">查询条件对象</param>
|
|
public static List<Model.SENDRECCOSTModel> GetSENDRECCOSTList(Transaction transaction,
|
|
ref int TotalCount, Model.SearchModel<Model.SENDRECCOSTModel> searchModel)
|
|
{
|
|
List<Model.SENDRECCOSTModel> SENDRECCOSTList = new List<Model.SENDRECCOSTModel>();
|
|
|
|
string WhereSQL = "", RowFilterSQL = "";
|
|
if (searchModel.SearchParameter != null)
|
|
{
|
|
WhereSQL = OperationDataHelper<Model.SENDRECCOSTModel>.GetWhereSQL(searchModel.SearchParameter, searchModel.QueryType);
|
|
if (WhereSQL != "")
|
|
{
|
|
WhereSQL = " WHERE " + WhereSQL;
|
|
}
|
|
}
|
|
|
|
DataTable dtSENDRECCOST = new Business.SENDRECPROINST(transaction).ExecuteDataTable(
|
|
"SELECT * FROM SENDREC_STORAGE.T_SENDRECCOST" + WhereSQL);
|
|
//增加组合查询条件
|
|
if (searchModel.keyWord != null && !string.IsNullOrWhiteSpace(searchModel.keyWord.Key))
|
|
{
|
|
foreach (string KeyName in searchModel.keyWord.Key.Split(','))
|
|
{
|
|
RowFilterSQL += (RowFilterSQL == "" ? "" : " or ") +
|
|
KeyName + " like '%" + searchModel.keyWord.Value + "%'";
|
|
}
|
|
}
|
|
if (RowFilterSQL != "")
|
|
{
|
|
dtSENDRECCOST.DefaultView.RowFilter = RowFilterSQL;
|
|
}
|
|
//排序:
|
|
dtSENDRECCOST.DefaultView.Sort = searchModel.SortStr;
|
|
dtSENDRECCOST = dtSENDRECCOST.DefaultView.ToTable();
|
|
//获取查询结果总记录条数
|
|
TotalCount = dtSENDRECCOST.Rows.Count;
|
|
//根据传入的页码和每页显示条数返回结果
|
|
dtSENDRECCOST = CommonHelper.GetDataTableWithPageSize(dtSENDRECCOST, searchModel.PageSize, searchModel.PageIndex);
|
|
|
|
foreach (DataRow drSENDRECCOST in dtSENDRECCOST.Rows)
|
|
{
|
|
Model.SENDRECCOSTModel sendreccostModel = new Model.SENDRECCOSTModel();
|
|
//绑定餐饮成本核算数据对象
|
|
BindDataRowToModel(drSENDRECCOST, sendreccostModel);
|
|
|
|
SENDRECCOSTList.Add(sendreccostModel);
|
|
}
|
|
|
|
return SENDRECCOSTList;
|
|
}
|
|
|
|
#region 绑定model
|
|
/// <summary>
|
|
/// 绑定model
|
|
/// </summary>
|
|
/// <param name="drSENDRECCOST">datarow数据源</param>
|
|
/// <param name="sendreccostModel">model对象</param>
|
|
public static void BindDataRowToModel(DataRow drSENDRECCOST, Model.SENDRECCOSTModel sendreccostModel)
|
|
{
|
|
if (drSENDRECCOST["SENDRECCOST_ID"].ToString() != "")
|
|
{
|
|
sendreccostModel.SENDRECCOST_ID = drSENDRECCOST["SENDRECCOST_ID"].TryParseToInt(); //内码
|
|
}
|
|
if (drSENDRECCOST["SERVERPART_ID"].ToString() != "")
|
|
{
|
|
sendreccostModel.SERVERPART_ID = drSENDRECCOST["SERVERPART_ID"].TryParseToInt(); //服务区内码
|
|
}
|
|
if (drSENDRECCOST["SERVERPARTSHOP_ID"].ToString() != "")
|
|
{
|
|
sendreccostModel.SERVERPARTSHOP_ID = drSENDRECCOST["SERVERPARTSHOP_ID"].TryParseToInt(); //门店内码
|
|
}
|
|
if (drSENDRECCOST["CHECKRAWMATERIAL_ID"].ToString() != "")
|
|
{
|
|
sendreccostModel.CHECKRAWMATERIAL_ID = drSENDRECCOST["CHECKRAWMATERIAL_ID"].TryParseToInt(); //餐饮盘点表内码
|
|
}
|
|
sendreccostModel.STATISTICS_MONTH = drSENDRECCOST["STATISTICS_MONTH"].ToString(); //结算月份
|
|
if (drSENDRECCOST["TAX_DEDUCTION"].ToString() != "")
|
|
{
|
|
sendreccostModel.TAX_DEDUCTION = drSENDRECCOST["TAX_DEDUCTION"].TryParseToDouble(); //抵扣税金
|
|
}
|
|
if (drSENDRECCOST["STAFFMEAL_STANDARD"].ToString() != "")
|
|
{
|
|
sendreccostModel.STAFFMEAL_STANDARD = drSENDRECCOST["STAFFMEAL_STANDARD"].TryParseToDouble(); //员工餐标准
|
|
}
|
|
if (drSENDRECCOST["ATTENDANCE_NUM"].ToString() != "")
|
|
{
|
|
sendreccostModel.ATTENDANCE_NUM = drSENDRECCOST["ATTENDANCE_NUM"].TryParseToDouble(); //考勤人数
|
|
}
|
|
if (drSENDRECCOST["STAFFMEAL_AMOUNT"].ToString() != "")
|
|
{
|
|
sendreccostModel.STAFFMEAL_AMOUNT = drSENDRECCOST["STAFFMEAL_AMOUNT"].TryParseToDouble(); //员工餐费
|
|
}
|
|
if (drSENDRECCOST["RECEPTIONMEAL_STANDARD"].ToString() != "")
|
|
{
|
|
sendreccostModel.RECEPTIONMEAL_STANDARD = drSENDRECCOST["RECEPTIONMEAL_STANDARD"].TryParseToDouble(); //接待餐标准
|
|
}
|
|
if (drSENDRECCOST["RECEPTION_NUM"].ToString() != "")
|
|
{
|
|
sendreccostModel.RECEPTION_NUM = drSENDRECCOST["RECEPTION_NUM"].TryParseToDouble(); //接待人数
|
|
}
|
|
if (drSENDRECCOST["RECEPTIONMEAL_AMOUNT"].ToString() != "")
|
|
{
|
|
sendreccostModel.RECEPTIONMEAL_AMOUNT = drSENDRECCOST["RECEPTIONMEAL_AMOUNT"].TryParseToDouble(); //接待餐费
|
|
}
|
|
if (drSENDRECCOST["STAFF_ID"].ToString() != "")
|
|
{
|
|
sendreccostModel.STAFF_ID = drSENDRECCOST["STAFF_ID"].TryParseToInt(); //操作人内码
|
|
}
|
|
sendreccostModel.STAFF_NAME = drSENDRECCOST["STAFF_NAME"].ToString(); //操作人员
|
|
if (drSENDRECCOST["OPERATE_DATE"].ToString() != "")
|
|
{
|
|
sendreccostModel.OPERATE_DATE = drSENDRECCOST["OPERATE_DATE"].TryParseToDateTime(); //操作时间
|
|
}
|
|
sendreccostModel.SENDRECCOST_DESC = drSENDRECCOST["SENDRECCOST_DESC"].ToString(); //备注说明
|
|
}
|
|
#endregion
|
|
|
|
#endregion
|
|
|
|
#region 获取餐饮成本核算明细
|
|
/// <summary>
|
|
/// 获取餐饮成本核算明细
|
|
/// </summary>
|
|
/// <param name="transaction">事务管理器</param>
|
|
/// <param name="SENDRECCOSTId">餐饮成本核算内码</param>
|
|
public static Model.SENDRECCOSTModel GetSENDRECCOSTDetail(Transaction transaction, int SENDRECCOSTId)
|
|
{
|
|
Model.SENDRECCOSTModel sendreccostModel = new Model.SENDRECCOSTModel();
|
|
|
|
string WhereSQL = "WHERE SENDRECCOST_ID = " + SENDRECCOSTId;
|
|
//查询明细数据
|
|
DataTable dtSENDRECCOST = new Business.SENDRECPROINST(transaction).ExecuteDataTable(
|
|
"SELECT * FROM SENDREC_STORAGE.T_SENDRECCOST " + WhereSQL);
|
|
if (dtSENDRECCOST.Rows.Count > 0)
|
|
{
|
|
//绑定餐饮成本核算数据对象
|
|
BindDataRowToModel(dtSENDRECCOST.Rows[0], sendreccostModel);
|
|
}
|
|
|
|
return sendreccostModel;
|
|
}
|
|
#endregion
|
|
|
|
#region 同步餐饮成本核算
|
|
/// <summary>
|
|
/// 赋值餐饮成本核算数据对象
|
|
/// </summary>
|
|
/// <param name="transaction">事务管理器</param>
|
|
/// <param name="sendreccostModel">餐饮成本核算数据对象</param>
|
|
public static bool SynchroSENDRECCOST(Transaction transaction, Model.SENDRECCOSTModel sendreccostModel)
|
|
{
|
|
bool SynchroFlag = true;
|
|
|
|
string SQLString;
|
|
List<string> excludeField = new List<string>();
|
|
Dictionary<string, string> dateFieldList = new Dictionary<string, string>();
|
|
string tableName = "SENDREC_STORAGE.T_SENDRECCOST", keyField = "SENDRECCOST_ID", seqName = "SEQ_SENDRECCOST";
|
|
Business.SENDRECPROINST _SENDRECPROINST = new Business.SENDRECPROINST(transaction);
|
|
|
|
#region 添加SQL语句中需要排除在外的字段
|
|
#endregion
|
|
|
|
#region 添加SQL语句中日期相关字段的执行语句
|
|
#endregion
|
|
|
|
if (sendreccostModel.SENDRECCOST_ID != null)
|
|
{
|
|
string WhereSQL = " WHERE SENDRECCOST_ID = " + sendreccostModel.SENDRECCOST_ID;
|
|
DataTable dtSENDRECCOST = _SENDRECPROINST.ExecuteDataTable(
|
|
"SELECT * FROM SENDREC_STORAGE.T_SENDRECCOST" + WhereSQL);
|
|
if (dtSENDRECCOST.Rows.Count > 0)
|
|
{
|
|
SQLString = OperationDataHelper<Model.SENDRECCOSTModel>.GetTableExcuteSQL(
|
|
sendreccostModel, 1, tableName, keyField, seqName, dateFieldList, excludeField, WhereSQL);
|
|
}
|
|
else
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
DataTable dtSENDRECCOST = _SENDRECPROINST.ExecuteDataTable(
|
|
"SELECT " + seqName + ".NEXTVAL FROM DUAL");
|
|
sendreccostModel.SENDRECCOST_ID = dtSENDRECCOST.Rows[0][0].TryParseToInt();
|
|
SQLString = OperationDataHelper<Model.SENDRECCOSTModel>.GetTableExcuteSQL(
|
|
sendreccostModel, 0, tableName, keyField, seqName, dateFieldList, excludeField);
|
|
}
|
|
_SENDRECPROINST.ExecuteNonQuery(SQLString, null);
|
|
|
|
return SynchroFlag;
|
|
}
|
|
#endregion
|
|
|
|
#region 删除餐饮成本核算
|
|
/// <summary>
|
|
/// 删除餐饮成本核算
|
|
/// </summary>
|
|
/// <param name="transaction">事务管理器</param>
|
|
/// <param name="SENDRECCOSTId">餐饮成本核算内码</param>
|
|
public static bool DeleteSENDRECCOST(Transaction transaction, int? SENDRECCOSTId)
|
|
{
|
|
bool DeleteFlag = false;
|
|
|
|
if (SENDRECCOSTId != null)
|
|
{
|
|
}
|
|
|
|
return DeleteFlag;
|
|
}
|
|
#endregion
|
|
}
|
|
}
|