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

231 lines
9.3 KiB
C#

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using System;
using System.Linq;
using System.Web.Mvc;
using DSWeb.MvcShipping.DAL.MsCrmPriceCarrierListDAL;
using DSWeb.MvcShipping.Models.MsCrmPriceCarrier;
using DSWeb.MvcShipping.Helper;
using DSWeb.MvcShipping.Comm.Cookie;
using HcUtility.Comm;
using DSWeb.MvcShipping.Models.MsSeaeOrder;
using System.Collections.Generic;
//需求编号SR2017091200003
namespace DSWeb.MvcShipping.Controllers
{
[JsonRequestBehavior]
public class MsCrmPriceCarrierListController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult ImpIndex()
{
return View();
}
#region 查询
public ContentResult GetDataList(int start, int limit, string sort, string condition)
{
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 dataList = MsCrmPriceCarrierListDAL.GetDataList(condition, start, limit, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]), sort);
int count = MsCrmPriceCarrierListDAL.getTotalCount(condition, CookieConfig.GetCookie_UserId(Request), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = count, data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#endregion
#region 打印
public ContentResult GetDataListStr(string condition)
{
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 dataListStr = MsCrmPriceCarrierListDAL.GetDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
#endregion
#region 导出
public ContentResult GetDataListSQL(string condition)
{
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 dataListStr = MsCrmPriceCarrierListDAL.GetDataListStr(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["SHOWNAME"]), Convert.ToString(Session["COMPANYID"]));
//dataListStr = "select " + dataListStr + "";
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataListStr });
return new ContentResult() { Content = json };
}
#endregion
#region 引入费用
public ContentResult CreateOrderFeeBl(string data, string body,string price,string bstype)
{
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<MsSeaeOrder>(data);
var bodyList = JsonConvert.Deserialize<List<MsSeaeOrderCtn>>(body);
var pricedata = JsonConvert.Deserialize<MsCrmPriceCarrier>(price);
DBResult result = null;
if (bstype=="操作管理")
result = MsCrmPriceCarrierListDAL.CreateSeaeFee(headData, bodyList, pricedata, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
else
result = MsCrmPriceCarrierListDAL.CreateFeeBl(headData, bodyList, pricedata, Convert.ToString(Session["USERID"]), Convert.ToString(Session["COMPANYID"]));
var jsonRespose = new JsonResponse
{
Success = result.Success,
Message = result.Message
};
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 取其他费用权限_循环列
public JsonResult GetFeeName()
{
var evList = MsCrmPriceCarrierListDAL.GetFeeName(Convert.ToString(Session["SHOWNAME"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 取集装箱权限_循环列
public JsonResult GetCtn()
{
var evList = MsCrmPriceCarrierListDAL.GetCtn(Convert.ToString(Session["SHOWNAME"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 取报价权限_循环列
public JsonResult GetBaoJia()
{
var evList = MsCrmPriceCarrierListDAL.GetBaoJia(Convert.ToString(Session["SHOWNAME"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 启运港国内港口_下拉框
public JsonResult GetPODLOADList()
{
var evList = MsCrmPriceCarrierListDAL.GetPODLOADList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new XiaLaKuangModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 目的港国外港口_下拉框
public JsonResult GetPORTDISCHARGEList()
{
var evList = MsCrmPriceCarrierListDAL.GetPORTDISCHARGEList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new XiaLaKuangModel() });
}
else
{
var ss = Json(new { success = true, data = evList.ToList() });
return ss;
}
}
#endregion
#region 中转港国外港口_下拉框
public JsonResult GetVIAList()
{
var evList = MsCrmPriceCarrierListDAL.GetVIAList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new XiaLaKuangModel() });
}
else
{
var ss = Json(new { success = true, data = evList.ToList() });
return ss;
}
}
#endregion
#region 船公司_下拉框
public JsonResult GetCARRIERList()
{
var evList = MsCrmPriceCarrierListDAL.GetCARRIERList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new XiaLaKuangModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 航线_下拉框
public JsonResult GetLANEList()
{
var evList = MsCrmPriceCarrierListDAL.GetLANEList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new XiaLaKuangModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
}
}