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.
118 lines
5.6 KiB
C#
118 lines
5.6 KiB
C#
using System;
|
|
using System.Linq;
|
|
using System.Web.Mvc;
|
|
using DSWeb.MvcShipping.DAL.MsCwVouchersGlInvoiceDAL;
|
|
using DSWeb.MvcShipping.Models.MsCwVouchersGlInvoiceEntity;
|
|
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 MsCwVouchersGlInvoiceController : 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 = MsCwVouchersGlInvoiceDAL.GetDataList(condition, Convert.ToString(Session["COMPANYID"]), Convert.ToString(Session["USERID"]).Trim(), sort);
|
|
var list = dataList.Skip(start).Take(limit);
|
|
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = list.ToList() });
|
|
return new ContentResult() { Content = json };
|
|
}
|
|
|
|
//导出_按凭证合计
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetDataListSQL(string condition)
|
|
{
|
|
var dataListStr = MsCwVouchersGlInvoiceDAL.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 };
|
|
}
|
|
#endregion
|
|
|
|
#region 生成凭证
|
|
|
|
[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
|
|
public ContentResult GetCodeCurrencyList(string strGids)
|
|
{
|
|
var dataList = MsCwVouchersGlInvoiceDAL.GetCodeCurrencyList(strGids, 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)
|
|
{
|
|
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 = MsCwVouchersGlInvoiceDAL.onIsCwVouchers(strGids, Convert.ToString(Session["USERID"]));
|
|
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 dataDiv, string jsonBody)
|
|
{
|
|
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 = MsCwVouchersGlInvoiceDAL.onIsCwVouchers(strGids, Convert.ToString(Session["USERID"]));
|
|
if (!result.Success)
|
|
{
|
|
var jsonRespose2 = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" };
|
|
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 = MsCwVouchersGlInvoiceDAL.onAddCwVouchers(strGids, headData, bodyList, 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
|
|
//
|
|
}
|
|
}
|
|
|