You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
DS7/DSWeb/Areas/MvcShipping/Controllers/MsCwVouchersGlChFeeControll...

134 lines
7.2 KiB
C#

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsCwVouchersGlChFeeDAL;
using DSWeb.MvcShipping.Models.MsCwVouchersGlChFeeEntity;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using DSWeb.Areas.CommMng.Models;
using HcUtility.Comm;
using HcUtility.Core;
using System.Collections.Generic;
using DSWeb.MvcShipping.DAL.MsBaseInfoDAL;
using DSWeb.EntityDA;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.Account.Models.MsCwVouchersGl3;
using DSWeb.SoftMng.Filter;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsCwVouchersGlChFeeController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
#region 基本函数
//查询_按费用
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = MsCwVouchersGlChFeeDAL.GetDataList(start, limit,condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), sort);
int count = MsCwVouchersGlChFeeDAL.getTotalCount(condition, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
//查询_按业务
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataListBS(int start, int limit, string sort, string condition)
{
string strCwSTARTGID = BasicDataRefDAL.GetCwSTARTGID(Convert.ToString(Session["USERID"]));
var dataList = MsCwVouchersGlChFeeDAL.GetDataListBS(start, limit, condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), strCwSTARTGID, sort);
int count = MsCwVouchersGlChFeeDAL.getBSTotalCount(condition, strCwSTARTGID, Convert.ToString(Session["USERID"]), CookieConfig.GetCookie_UserCode(Request), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
//导出_按费用
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataListSQL(string condition)
{
var dataListStr = MsCwVouchersGlChFeeDAL.GetDataListSQL(condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
//导出_按业务
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetDataListSQLBS(string condition)
{
var dataListStr = MsCwVouchersGlChFeeDAL.GetDataListSQLBS(condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
#endregion
#region 生成凭证
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetCodeCurrencyList(string sAndGids)
{
var dataList = MsCwVouchersGlChFeeDAL.GetCodeCurrencyList(sAndGids, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#region 按费用_判断是否生成
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult onIsCwVouchers(string strGids, string strCondition)
{
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
DBResult result = MsCwVouchersGlChFeeDAL.onIsCwVouchers(strGids, strCondition, Convert.ToString(Session["USERID"]).Trim());
var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
public ContentResult onAddCwVouchers(string strGids, string sBSNO, string sGidC, string dataDiv, string jsonBody, string sType, string strCondition, string strConditionCw, int iBSNO)
{
if (Convert.ToString(Session["COMPANYID"]).Trim() == "" || Convert.ToString(Session["USERID"]).Trim() == "" || Convert.ToString(Session["CODENAME"]).Trim() == "" || Convert.ToString(Session["SHOWNAME"]).Trim() == "" || Convert.ToString(Session["DEPTNAME"]).Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//
var headData = JsonConvert.Deserialize<MsCwVouchersGl3>(dataDiv);
List<MsCwVouchersGl4> bodyList = new List<MsCwVouchersGl4>();
if (jsonBody != null)
{
bodyList = JsonConvert.Deserialize<List<MsCwVouchersGl4>>(jsonBody);
}
if (bodyList == null && headData.ISRATE == false)
{
headData.ISRATE = true;
}
//DBResult result2 = MsCwVouchersGlChFeeDAL.onAddCwVouchers(strGids, sBSNO, sGidC, headData, bodyList, sType, strCondition, strConditionCw, iBSNO, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
//
DBResult result2 = MsCwVouchersGlChFeeDAL.onAddCwVouchers2(strGids, sBSNO, sGidC, headData, bodyList, sType, strCondition, strConditionCw, iBSNO, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
//
var jsonRespose = new JsonResponse { Success = result2.Success, Message = result2.Message, Data = "" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
//
}
}