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/MsCwVouchersGlInvoiceHeXiao...

109 lines
5.3 KiB
C#

3 years ago
using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsCwVouchersGlInvoiceHeXiaoDAL;
using DSWeb.MvcShipping.Models.MsCwVouchersGlInvoiceHeXiaoEntity;
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;
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsCwVouchersGlInvoiceHeXiaoController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Edit()
{
return View();
}
#region 基本函数
//查询_按凭证合计
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
var dataList = MsCwVouchersGlInvoiceHeXiaoDAL.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 };
}
//导出_按凭证合计
public ContentResult GetDataListSQL(string condition)
{
var dataListStr = MsCwVouchersGlInvoiceHeXiaoDAL.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 生成凭证
public ContentResult GetCodeCurrencyList(string strBILLNOs)
{
var dataList = MsCwVouchersGlInvoiceHeXiaoDAL.GetCodeCurrencyList(strBILLNOs, 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 按费用_判断是否生成
public ContentResult onIsCwVouchers(string strBILLNOs)
{
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 = MsCwVouchersGlInvoiceHeXiaoDAL.onIsCwVouchers(strBILLNOs, 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 strBILLNOs, 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 = MsCwVouchersGlInvoiceHeXiaoDAL.onIsCwVouchers(strBILLNOs, 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 = MsCwVouchersGlInvoiceHeXiaoDAL.onAddCwVouchers(strBILLNOs, 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
//
}
}