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; namespace DSWeb.MvcShipping.Controllers { [JsonRequestBehavior] public class MsCwVouchersGlChFeeController : 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 = 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 }; } //查询_按业务 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 }; } //导出_按费用 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 }; } //导出_按业务 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 生成凭证 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 按费用_判断是否生成 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(dataDiv); List bodyList = new List(); if (jsonBody != null) { bodyList = JsonConvert.Deserialize>(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 // } }