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.

2371 lines
80 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 DSWeb.Areas.Account.DAL.Chfee_Payapplication;
using DSWeb.Areas.CommMng.DAL;
using DSWeb.Areas.CommMng.Models;
using DSWeb.Areas.RptMng.Comm;
using DSWeb.Common.DB;
using DSWeb.Dispatch.DAL;
using DSWeb.EntityDA;
using DSWeb.MvcShipping.DAL.MsSysParamSet;
using DSWeb.SoftMng.BLL;
using DSWeb.SoftMng.Model;
using DSWeb.TruckMng.Comm.Cookie;
using DSWeb.TruckMng.Helper;
using HcUtility.Comm;
using HcUtility.Core;
using sun.security.util;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Text;
using System.Web;
using System.Web.Mvc;
using static iTextSharp.text.pdf.codec.TiffWriter;
using DSWeb.SoftMng.Filter;
namespace DSWeb.Areas.CommMng.Controllers
{
[JsonRequestBehavior]
public class BasicDataRefController : Controller
{
//
// GET: /CommMng/BasicDataRef/GetFeeTypeRefList
#region 费用名称 费用分组
public JsonResult GetFeeTypeRefList(string condition)
{
List<FeeTypeRefModel> evList = BasicDataRefDAL.GetFeeTypeRefList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetFeeGroupRefList(string condition)
{
List<FeeTypeRefModel> evList = BasicDataRefDAL.GetFeeGroupRefList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
//
// GET: /CommMng/BasicDataRef/GetUserRefList
public JsonResult GetUserRefList(string condition, string dbname = "")
{
List<UserRefModel> evList = BasicDataRefDAL.GetUserRefList(condition, dbname);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetUserActionRefListRm(string CODENAME,string MODULENAME, string condition = "")
{
if (CODENAME == "")
{
}
else
{
if (condition == "")
condition = " (UserCode like '" + CODENAME + "%' or UserName like '%" + CODENAME + "%') ";
else
condition = condition + " and (UserCode like '" + CODENAME + "%' or UserName like '%" + CODENAME + "%') ";
}
List<UserRefModel> evList = BasicDataRefDAL.GetActionUserRefList(condition, MODULENAME);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
/// <summary>
/// 根据国家代码获取企业代码类型
/// </summary>
/// <param name="code"></param>
/// <returns></returns>
public JsonResult GetEnterpriseCodetype(string code)
{
t_sys_country_codeBLL bll = new t_sys_country_codeBLL();
var list = bll.GetModelList("c_country_code='" + code + "'");
return Json(list);
}
#region 国家
public JsonResult GetCountryList(string condition)
{
var evList = BasicDataRefDAL.GetCountryList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
public JsonResult GetUser_0()
{
List<UserRefModel> evList = BasicDataRefDAL.GetUserRefList("", "");
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetUserLinkRefList(string condition)
{
List<UserLinkRefModel> evList = BasicDataRefDAL.GetUserLinkRefList(condition, Convert.ToString(Session["COMPANYID"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetUserLinkRefListRm(string CODENAME, string condition = "",string CUSTOMERNAME="")
{
if (CODENAME == "")
{
}
else
{
if (condition == "")
condition = " (u.CODENAME like '" + CODENAME + "%' or u.SHOWNAME like '%" + CODENAME + "%') ";
else
condition = condition + " and (u.CODENAME like '" + CODENAME + "%' or u.SHOWNAME like '%" + CODENAME + "%') ";
}
List<UserLinkRefModel> evList = BasicDataRefDAL.GetUserLinkRefList(condition, Convert.ToString(Session["COMPANYID"]), CUSTOMERNAME);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
//
// GET: /CommMng/BasicDataRef/GetUserRefList
public JsonResult GetPluRefList(string condition)
{
List<PluRefModel> evList = BasicDataRefDAL.GetPluRefList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
//[SqlKeyWordsFilter(Type = "Action")]//sql 防注入过滤器
public ContentResult GetCustomRefList(string condition)
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid,"0",LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListRm(string CODENAME, string isall = "0")
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
}
else
{
if (LAN == "en-us")
{
condition = " (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else condition = " (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid, isall, LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListController(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISCONTROLLER=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISCONTROLLER=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else condition = " ISSTOP=0 and ISCONTROLLER=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid,"0",LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListAgent(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISAGENT=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISAGENT=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else condition = " ISSTOP=0 and ISAGENT=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid, "0", LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListCARRIER(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISCARRIER=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISCARRIER=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else condition = " ISSTOP=0 and ISCARRIER=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid, "0", LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListYARD(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISYARD=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISYARD=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else condition = " ISSTOP=0 and ISYARD=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
//var userid = CookieConfig.GetCookie_UserId(Request);
//var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition,LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListFORWARDER(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISBOOKING=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISBOOKING=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else condition = " ISSTOP=0 and ISBOOKING=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid, "0", LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListTRUCK(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISTRUCK=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISTRUCK=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else condition = " ISSTOP=0 and ISTRUCK=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid, "0", LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListCUSTOM(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISCUSTOM=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISCUSTOM=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else condition = " ISSTOP=0 and ISCUSTOM=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid, "0", LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListSHIPAGENCY(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISSHIPAGENCY=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISSHIPAGENCY=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else condition = " ISSTOP=0 and ISSHIPAGENCY=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid, "0", LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListWAREHOUSE(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISWAREHOUSE=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISWAREHOUSE=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else
condition = " ISSTOP=0 and ISWAREHOUSE=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid, "0", LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomRefListEnterp(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = " ISENTERP=1 ";
}
else
{
if (LAN == "en-us")
{
condition = " ISSTOP=0 and ISENTERP=1 AND (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}else
condition = " ISSTOP=0 and ISENTERP=1 AND (CODENAME like '%" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomRefList(condition, ISENABLECUSTRANGE, userid, "0", LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public JsonResult GetCustom_SPPrice(string condition)
{
var evList = BasicDataRefDAL.GetCustom_SPPrice(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public ContentResult GetCustomYardRefList(string condition)
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomYardRefList(condition, ISENABLECUSTRANGE, userid);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomInvRefList(string condition)
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomInvRefList(condition, ISENABLECUSTRANGE, userid,LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public ContentResult GetCustomInvRefListRm(string CODENAME)
{
var condition = "";
string LAN = Convert.ToString(Session["LANGUAGES"]);
if (CODENAME == "")
{
condition = "";
}
else
{
if (LAN == "en-us") {
condition = " (CODENAME like '%" + CODENAME + "%' or ESHORTNAME like '%" + CODENAME + "%') ";
}
else
condition = " (CODENAME like '" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var userid = CookieConfig.GetCookie_UserId(Request);
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var evList = BasicDataRefDAL.GetCustomInvRefList(condition, ISENABLECUSTRANGE, userid,LAN);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public JsonResult GetCustomContact(string linkId)
{
var evList = BasicDataRefDAL.GetCustomContactRefList("LinkId='" + linkId + "'");
if (evList.Count == 0)
{
return Json(new { success = true, data = new CustomContactRefModel() });
}
else
{
return Json(new { success = true, data = evList[0] });
}
}
public JsonResult GetCustomContactList(string custCode)
{
var evList =
BasicDataRefDAL.GetCustomContactRefList("LINKID in (select gid from info_client where CODENAME='" +
custCode + "')");
return Json(new { success = true, data = evList.ToList() });
}
public ContentResult GetCustomACCOUNTList(string condition)
{
var evList = BasicDataRefDAL.GetMsClientAccount(condition);
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
public JsonResult GetAirLinesList(string condition)
{
var evList = BasicDataRefDAL.GetAirLinesList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetSource()
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var evList = BasicDataRefDAL.GetSourceList("1=1",LAN);
if (evList.Count == 0)
{
return Json(new { success = true, data = new SourceModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetDeptList(string condition)
{
if (!string.IsNullOrEmpty(condition))
{
condition += " and LinkId='" + Convert.ToString(Session["COMPANYID"]) + "'";
}
else
{
condition = "LinkId='" + Convert.ToString(Session["COMPANYID"]) + "'";
}
var evList = BasicDataRefDAL.GetDeptList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new DeptModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetDeptList_All(string condition)
{
if (string.IsNullOrWhiteSpace(Session["USERID"].ToString())) {
return Json(new { success = true, data = new DeptModel() });
}
var evList = BasicDataRefDAL.GetDeptList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new DeptModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetDeptListRm(string CODENAME)
{
var condition = "";
if (CODENAME == "")
{
condition = "";
}
else condition = " (DEPTNAME like '" + CODENAME + "%') ";
if (!string.IsNullOrEmpty(condition))
{
condition += " and LinkId='" + Convert.ToString(Session["COMPANYID"]) + "'";
}
else
{
condition = "LinkId='" + Convert.ToString(Session["COMPANYID"]) + "'";
}
var evList = BasicDataRefDAL.GetDeptList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new DeptModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetSourceDetail(string SourceId)
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var evList = BasicDataRefDAL.GetSourceDetailList("SOURCEID='" + SourceId + "'",LAN);
if (evList.Count == 0)
{
return Json(new { success = true, data = new SourceDetailModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetSourceDetail2(string condition)
{
string LANGUAGES = Convert.ToString(Session["LANGUAGES"]);
var evList = BasicDataRefDAL.GetSourceDetailList(condition, LANGUAGES);
if (evList.Count == 0)
{
return Json(new { success = true, data = new SourceDetailModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
//
// GET: /CommMng/BasicDataRef/GetVoyRefList
public JsonResult GetVoyRefList(string condition)
{
var evList = BasicDataRefDAL.GetVoyRefList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
//
// GET: /CommMng/BasicDataRef/GetVoyRefList
public JsonResult GetCtnRefList(string condition)
{
var evList = BasicDataRefDAL.GetCtnRefList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetCtnDispList(string condition)
{
var evList = BasicDataRefDAL.GetCtnDispList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetCountryRefList(string condition)
{
var evList = BasicDataRefDAL.GetCountryRefList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
// GET: /CommMng/BasicDataRef/GetCargoRefList
public JsonResult GetCargoRefList(string condition)
{
var evList = BasicDataRefDAL.GetCargoRefList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
/// <summary>
/// 根据条件 查询HS代码对应的税率
/// </summary>
/// <param name="condition"></param>
/// <returns></returns>
public JsonResult GetCargoTax(string condition)
{
var evList = BasicDataRefDAL.GetCargoTax(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetCargociqRefList(string condition)
{
var evList = BasicDataRefDAL.GetCargociqRefList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
// GET: /CommMng/BasicDataRef/GetCargoRefList
public JsonResult GetcompanyList(string condition)
{
var evList = BasicDataRefDAL.GetcompanyList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
// GET: /CommMng/BasicDataRef/GetCargoRefList
public JsonResult Getimportremind(string condition)
{
var evList = BasicDataRefDAL.GetRemindList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
// GET: /CommMng/BasicDataRef/GetcurrRefList
/// <summary>
/// 币别信息 和币别的默认汇率
/// </summary>
/// <param name="condition"></param>
/// <returns></returns>
public JsonResult GetcurrRefList(string condition)
{
var evList = BasicDataRefDAL.GetcurrRefList(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
// GET: /CommMng/BasicDataRef/GetTrader
public JsonResult GetTrader(string condition)
{
var evList = BasicDataRefDAL.GetTrader(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetTraderRm(string CODENAME)
{
var condition = "";
if (CODENAME == "")
{
condition = "";
}
else
{
condition = " (CODENAME like '" + CODENAME + "%' or SHORTNAME like '%" + CODENAME + "%') ";
}
var evList = BasicDataRefDAL.GetTrader(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetPCTrader(string condition)
{
var evList = BasicDataRefDAL.GetPCTrader(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
// GET: /CommMng/BasicDataRef/GetBank
public JsonResult GetBank(string condition)
{
var evList = BasicDataRefDAL.GetBank(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
// GET: /CommMng/BasicDataRef/GetAccitems
public JsonResult GetAccitems(string condition)
{
var evList = BasicDataRefDAL.GetAccitems(condition, Convert.ToString(Session["USERID"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetMngAccitems(string condition)
{
var evList = BasicDataRefDAL.GetMngAccitems(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
//获取权限范围
public ContentResult GetAuthorityRange(string modName, string USERID)
{
var evList = BasicDataRefDAL.GetAR(modName, USERID);
AuthorityRangemb head = null;
if (evList.Count > 0)
head = evList[0];
if (head == null)
{
head = new AuthorityRangemb();
}
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = head });
return new ContentResult() { Content = json };
}
#region 获取本部门领取且未支取的支票号
public JsonResult GetUnusedCHEQUENUM(string DEPTID, string BXGID)
{
var evList = BasicDataRefDAL.GetUnusedCHEQUENUM(DEPTID, BXGID);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 获取工作流typeno 用于在工作流管理界面选择typeno
public JsonResult GetTYPENO(string condition)
{
var evList = BasicDataRefDAL.GetTYPENO(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 通过工作流名称获取该用户提交的工作流step
public JsonResult GetWorkFlowStep(string WorkFlowName)
{ //workflow.gid workflow_step.gid,userid
//var OrgCode = Convert.ToString(CookieConfig.GetCookie_OrgCode(Request));
var UserID = Convert.ToString(CookieConfig.GetCookie_UserId(Request));
var evList = BasicDataRefDAL.GetWorkFlowStep(WorkFlowName, UserID);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 键值维护表 crm_key_code
public JsonResult GetCrmKeyCodeList(string condition)
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var evList = BasicDataRefDAL.GetCrmKeyCodeList(condition, LAN);
if (evList.Count == 0)
{
return Json(new { success = true, data = new CrmKeyCodeModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 品名
public JsonResult GetCodeGoodsList(string condition)
{
string LANGUAGES = Convert.ToString(Session["LANGUAGES"]);
var evList= new List<CodeGoodsModel>();
var OPGOODUSEMSDS = MsSysParamSetDAL.GetData("PARAMNAME='OPGOODUSEMSDS'");
if (OPGOODUSEMSDS.PARAMVALUE == "1")
{
evList = BasicDataRefDAL.GetCodeMsdsGoodsList(condition,LANGUAGES);
} else evList = BasicDataRefDAL.GetCodeGoodsList(condition,LANGUAGES);
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeGoodsModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetCodeGoodsListRm(string CODENAME)
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var condition = "";
if (CODENAME == "")
{
condition = " 1=1 ";
}
else condition = " (GOODCODE like '%" + CODENAME + "%' or GOODNAME like '%" + CODENAME + "%') ";
var evList = BasicDataRefDAL.GetCodeGoodsList(condition,LAN);
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeGoodsModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetCodeGoodsListWmsRm(string CODENAME)
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var condition = "";
var evList = new List<CodeGoodsModel>();
var WMSGOODNAMEIMPORTTRADE = MsSysParamSetDAL.GetData("PARAMNAME='WMSGOODNAMEIMPORTTRADE'");
if (WMSGOODNAMEIMPORTTRADE.PARAMVALUE == "1")
{
if (CODENAME == "")
{
condition = " 1=1 ";
}
else condition = " CNNAME like '%" + CODENAME + "%' ";
evList = BasicDataRefDAL.GetImportCodeGoodsList(condition,LAN);
}
else {
if (CODENAME == "")
{
condition = " 1=1 ";
}
else condition = " (GOODCODE like '%" + CODENAME + "%' or GOODNAME like '%" + CODENAME + "%') ";
evList = BasicDataRefDAL.GetCodeGoodsList(condition,LAN);
}
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeGoodsModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
public ContentResult GetInvTemplateList(string condition)
{
var evList = BasicDataRefDAL.Getsys_templateList();
if (evList.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
return new ContentResult() { Content = json };
}
}
#region 品名明细表
public JsonResult GetCodeGoodsDetailList(string condition)
{
var evList = BasicDataRefDAL.GetCodeGoodsDetailList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeGoodsDetailModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 新版键值维护表 tSysEnumValue
public JsonResult GetTSysEnumValueList(string condition)
{
var evList = BasicDataRefDAL.GetTSysEnumValueList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new TSysEnumValueDataModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 国际港口(进口装货港、出口卸货港)
public JsonResult GetCodeDisportList()
{
var evList = BasicDataRefDAL.GetCodeDisportList("");
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeDisportModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetCodeDisportListRm(string PORT)
{
if (PORT == "")
{
return Json(new { success = true, data = new CodeDisportModel() });
}
var evList = BasicDataRefDAL.GetCodeDisportList(" PORT LIKE '%" + PORT + "%' or CNAME like '%" + PORT + "%' OR EDICODE like '%" + PORT + "%'");
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeDisportModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 国内港口(出口装货港、进口卸货港)
public JsonResult GetCodeLoadportListRm(string PORT)
{
if (PORT == "")
{
return Json(new { success = true, data = new CodeLoadportModel() });
}
var evList = BasicDataRefDAL.GetCodeLoadportList(" PORT LIKE '%" + PORT + "%' or CNAME like '%" + PORT + "%'");
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeLoadportModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetCodeLoadportList()
{
var evList = BasicDataRefDAL.GetCodeLoadportList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeLoadportModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 铁路港口
public JsonResult GetCodeRailwayPortListRm(string PORT)
{
if (PORT == "")
{
return Json(new { success = true, data = new CodeDisportModel() });
}
var evList = BasicDataRefDAL.GetCodeRailwayPortList(" PORTENAME LIKE '%" + PORT + "%' or PORTCNAME like '%" + PORT + "%'");
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeDisportModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 品名类型
public JsonResult GetCodeGoodsTypeList()
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var evList = BasicDataRefDAL.GetCodeGoodsTypeList(LAN);
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeLoadportModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 箱型
public JsonResult GetCodeCtnList()
{
var evList = BasicDataRefDAL.GetCodeCtnList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeCtnModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 集装箱显示
public JsonResult GetCtnDisp()
{
var evList = BasicDataRefDAL.GetCtnDisp();
if (evList == null)
{
return Json(new { success = true, data = new CtnDispModel() });
}
else
{
return Json(new { success = true, data = evList });
}
}
#endregion
#region 航线
public JsonResult GetCodeLaneList()
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var evList = BasicDataRefDAL.GetCodeLaneList(LAN);
if (evList.Count == 0)
{
return Json(new { success = true, data = new LaneModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 付费方式
public JsonResult GetCodeFrtList()
{
var evList = BasicDataRefDAL.GetCodeFrtList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeFrtModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 签单方式
public JsonResult GetCodeBLTYPEList()
{
string LAN = Convert.ToString(Session["LANGUAGES"]);
var evList = BasicDataRefDAL.GetCodeBLTYPEList(LAN);
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeBLTYPEModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 运输条款
public JsonResult GetCodeSERVICEList()
{
var evList = BasicDataRefDAL.GetCodeSERVICEList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeSERVICEModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 提单模板
public JsonResult GetCodeTemplateList()
{
var evList = BasicDataRefDAL.GetCodeTemplateList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeTemplateModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 船名
public JsonResult GetVesselList(string condition)
{
var evList = BasicDataRefDAL.GetVesselList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new VesselModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
public JsonResult GetVoyNoList(string condition)
{
var evList = BasicDataRefDAL.GetVoyNoList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new VesselModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 件数包装
public JsonResult GetCodePackageList()
{
var evList = BasicDataRefDAL.GetCodePackageList();
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodePackageModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 币别
public JsonResult GetCodeCurrencyList(string condition)
{
var evList = BasicDataRefDAL.GetCodeCurrencyList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new CodeCurrencyModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 委托单位_联系人
public JsonResult GetInfoClientContactList(string condition)
{
var evList = BasicDataRefDAL.GetInfoClientContactList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new InfoClientContactModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
//委托单位 电话 邮箱 (含委托单位的)
public JsonResult GetInfoClientMailTel(string CUSTOMERNAME)
{
var evList = BasicDataRefDAL.GetInfoClientMailTel(CUSTOMERNAME);
if (evList.Count == 0)
{
return Json(new { success = true, data = new InfoClientContactModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 项目
public JsonResult GetCwItemList(string condition)
{
var evList = BasicDataRefDAL.GetCwItemList(condition, Convert.ToString(Session["USERID"]));
if (evList.Count == 0)
{
return Json(new { success = true, data = new CwItemModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 科目币别表
public ContentResult GetCwAccitemsCurrencyList(string condition)
{
var dataList = BasicDataRefDAL.GetCwAccitemsCurrencyList(condition, Convert.ToString(Session["USERID"]));
var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() });
return new ContentResult() { Content = json };
}
#endregion
#region 业务类型
public JsonResult GetOPLBList(string condition)
{
var evList = BasicDataRefDAL.GetOPLBList(condition);
if (evList.Count == 0)
{
return Json(new { success = true, data = new OPLBModel() });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 总账科目信息
public JsonResult GetCwAccitemsGl(string condition)
{
var evList = BasicDataRefDAL.GetCwAccitemsGl(condition, Convert.ToString(Session["USERID"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 总账科目信息(包含上级科目)
public JsonResult GetCwAccitemsGlAll(string condition)
{
var evList = BasicDataRefDAL.GetCwAccitemsGlAll(condition, Convert.ToString(Session["USERID"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 接口科目信息
public JsonResult GetCwAccitems(string condition)
{
var evList = BasicDataRefDAL.GetCwAccitems(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 获取指定表内,符合条件的行的数量,主要用于防止删除主表
public ContentResult GetExist(string tablename, string condition)
{
var _count = BasicDataRefDAL.GetExist(tablename, condition);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = _count });
return new ContentResult() { Content = json };
}
public ContentResult GetExist2(string tablename, string condition, string tablename2, string condition2)
{
var _count = BasicDataRefDAL.GetExist(tablename, condition);
_count = _count + BasicDataRefDAL.GetExist(tablename2, condition2);
var json = JsonConvert.Serialize(
new { Success = true, Message = "查询成功", data = _count });
return new ContentResult() { Content = json };
}
#endregion
#region 通用上传文件方法 20191008重构
#region 典型调用方法
/*
URLINFO = { KeyValue: record.data.GID}; //该列数据主键值
UrlType = _this.PicUploadType; //在FileUrlModel当中设定的某个类型
onUpLoadFileClick: function(URLINFO, UrlType)
{
me = this;
var imgform = new Ext.FormPanel({
region: 'center',
labelWidth: 40,
frame: true,
//bodyStyle: 'padding:5px 5px 0',
//autoScroll: true,
border: false,
fileUpload: true,
items: [
{
xtype: 'fileuploadfield',
id: 'LoadFile',
name: 'LoadFile',
emptyText: '请选择文件',
fieldLabel: '文件',
buttonText: '选择文件',
//20191008 对上传的文件扩展名暂时不做限制
//regex: /^.+\.(jpg|jpeg|png|pdf|gif|bmp|tiff)$/,
//regexText: "只能选择jpg|jpeg|png|pdf|gif|bmp|tiff格式的文件",
allowBlank: false,
buttonCfg: { iconCls: 'uploaddialog' },
anchor: '99%'
}],
buttons: [{
text: '上传',
type: 'submit',
handler: function() {
var UserFilePath = Ext.getCmp('LoadFile').getValue();
//if (!CheckFileExt(UserFilePath, /.frx/i)) {
// Ext.Msg.show({ title: '错误', msg: '请确认你上传的文件为frx文件!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
// return;
//}
if (!imgform.form.isValid()) { return; }
imgform.form.submit({
url: '/CommMng/BasicDataRef/FileUpload',
waitMsg: '正在上传',
method: 'POST',
submitEmptyText: false,
async: false,
params: {
URLINFO: Ext.JSON.encode(URLINFO),
UrlType: UrlType
},
success: function(form, action) {
win.close(this);
Ext.Msg.show({ title: '提示', msg: '上传成功!', icon: Ext.Msg.INFO, buttons: Ext.Msg.OK });
},
failure: function(form, action) {
form.reset();
win.close(this);
// if (action.failureType == Ext.form.Action.SERVER_INVALID) {
// Ext.MessageBox.alert('警告', action.result.errors.msg);
// }
}
});
}
}, {
text: '关闭',
type: 'submit',
handler: function() {
win.close(this);
}
}]
});
var win = new Ext.Window({
title: "上传文件",
width: 360,
height: 200,
modal: true,
resizable: false,
border: false,
items: imgform
});
win.show();
}*/
/*新的调用方式
* function UpLoadFile(URLINFO, UrlType, ResultAction, _this)
* 参数说明:
* URLINFO { KeyValue: 主表的主键值, INDATABASE: "false" };INDATABASE代表这个文件是否往数据库里直接存。如果是的话需要定义ImgName放置文件的字段名;
* UrlType一个字串 程序内固化其内容,一个字串会对应一组数据 包括TableName表名 KeyName表主键字段名 UrlName表中保存文件路径的字段名
//ResultAction调用此方法的js实体需实现这个函数以便执行保存操作后操作。
//该函数需要两个参数参数1为一个传回的str参数2为this作用域函数体内容为【在这个函数内利用str对this作用域的元素做xxx操作】
//_this:调用此方法的js实体的this作用域
*/
#endregion
[HttpPost]
public ContentResult FileUpload(string URLINFO, string UrlType = "")
{
if (Convert.ToString(Session["COMPANYID"]).ToString().Trim() == "" || Convert.ToString(Session["USERID"]).ToString().Trim() == "" || Convert.ToString(Session["CODENAME"]).ToString().Trim() == "" || Convert.ToString(Session["SHOWNAME"]).ToString().Trim() == "" || Convert.ToString(Session["DEPTNAME"]).ToString().Trim() == "")
{
var jsonRespose2 = new JsonResponse { Success = false, Message = "登录超时,请退出系统重新登录!" };
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose2) };
}
//UrlType形如 'CargoName' 用于在FileUrlModel当中标示某个表名与字段名的组合
//如果没有就必须在URLINFO中写清所有信息
// KeyValue在URLINFO中是必须的
var URLInfo = new FileUrlModel(URLINFO, UrlType);
jsonresponse result = new jsonresponse();
if (Request.Files.Count != 1)
{
result.success = false;
result.message = "请选择上传的文件";
return new ContentResult() { Content = JsonConvert.Serialize(result) };
}
//FilePath
var file = Request.Files["LoadFile"];
if (file == null)
{
result.success = false;
result.message = "上传文件发生未知错误,请重新上传";
return new ContentResult() { Content = JsonConvert.Serialize(result) };
}
var _r = URLInfo.SaveFile(file);
if (string.IsNullOrEmpty(_r))
{
result.success = false;
result.message = "没有正确上传文件";
return new ContentResult() { Content = JsonConvert.Serialize(result) };
}
else {
result.success = true;
result.message = "文件上传成功";
result.data = _r;
ContentResult r = new ContentResult();
r.Content = JsonConvert.Serialize(result);
return r;
}
}
#endregion
#region 获取指定表内,符合条件的第一行
public ContentResult GetField(string tablename, string condition)
{
var strSql = new StringBuilder();
strSql.Append("SELECT ");
strSql.Append(" top 1 * ");
strSql.Append(" from " + tablename + " ");
if (!string.IsNullOrEmpty(condition))
{
strSql.Append(" where " + condition);
}
var dbparams = new List<CustomDbParamter>();
var paramps_sSQL = new CustomDbParamter();
paramps_sSQL.ParameterName = "@sSQL";
paramps_sSQL.DbType = DbType.String;
paramps_sSQL.Direction = ParameterDirection.Input;
paramps_sSQL.Value = strSql.ToString();
dbparams.Add(paramps_sSQL);
var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("sMsExesqlQry", dbparams, "Result_Set");
var json = RptHelper.GetRptJsonResult(0, 1, dbRptResult, "Result_Set", true);
return new ContentResult() { Content = json };
}
#endregion
#region 出纳摘要信息
public JsonResult GetEXPLAN(string condition)
{
var evList = BasicDataRefDAL.GetEXPLAN(condition, Convert.ToString(Session["USERID"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 通用查询方法 参数是查询语句必须把GID和值as成GID和GValue
public JsonResult GeneralSelect(string condition)
{
var evList = BasicDataRefDAL.GeneralSelect(condition);
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region InfoClass管理分类表
public JsonResult GetMsInfoClass(string condition)
{
var evList = BasicDataRefDAL.GetMsInfoClass(condition, Convert.ToString(Session["USERID"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 客户子项目
public JsonResult GetMsInfoClientItem(string condition)
{
var evList = BasicDataRefDAL.GetMsInfoClientItem(condition, Convert.ToString(Session["USERID"]));
if (evList.Count == 0)
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = evList.ToList() });
}
}
#endregion
#region 获取系统参数
public JsonResult GetParamValue(string PARAMNAME)
{
if (string.IsNullOrWhiteSpace(Session["USERID"].ToString())) {
return Json(new { success = false });
}
var paramvalue = MsSysParamSetDAL.GetSysParamValue(PARAMNAME);
if (string.IsNullOrWhiteSpace(paramvalue))
{
return Json(new { success = false });
}
else
{
return Json(new { success = true, data = paramvalue });
}
}
#endregion
#region 获取首页加载的常用数据集
////更新状态表
//public ContentResult GetTableStatusList()
//{
// var evList = BasicDataRefDAL.GetTableStatusList();
// if (evList.Count == 0)
// {
// var json = JsonConvert.Serialize(new { success = false });
// //return Json(new { success = false });
// return new ContentResult() { Content = json };
// }
// else
// {
// var json = JsonConvert.Serialize(new { success = true, data = evList.ToList() });
// //return Json(new { success = true, data = evList.ToList() });
// return new ContentResult() { Content = json };
// }
//}
// 获取通用表方式的store
public ContentResult getPubStore(string STORENAME)
{
var userinfo = new USERINFO("EVERYONE");
try
{
//
if (STORENAME == "INFOCLIENT_ISCONTROLLER" || STORENAME == "OPSEAE_CUST_ISCONTROLLER" || STORENAME == "INFOCLIENT_INV" || STORENAME == "INFOCLIENT_ALL" || STORENAME == "INFOCLIENT_CARRIER")
{
var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
var BLSTATUSSTR = "";
try
{
var InfoClintBlstatus = MsSysParamSetDAL.GetData("PARAMNAME='InfoClintBlstatus'");
if (InfoClintBlstatus.PARAMVALUE != "")
{
if (InfoClintBlstatus.PARAMVALUE == "1")
{
BLSTATUSSTR = " BLSTATUS=0 ";
}
}
}
catch
{
}
userinfo = new USERINFO(Session["USERID"].ToString(), BLSTATUSSTR, ISENABLECUSTRANGE);
}
var storemb = StoreModifyStatusMb.getStore(STORENAME, userinfo);
var diclist = ModelObjectBill.getDicList(ModelObjectConvert<PubStoremb>.ToModelObjectList(storemb));
if (diclist.Count == 0)
{
var json = JsonConvert.Serialize(new { success = false });
return new ContentResult() { Content = json };
}
else
{
var json = JsonConvert.Serialize(new { success = true, data = diclist.ToList() });
return new ContentResult() { Content = json };
}
}
catch (Exception e)
{
var json = JsonConvert.Serialize(new { success = true });
return new ContentResult() { Content = json };
}
}
///// <summary>
/////
///// </summary>
///// <param name = "start" ></ param >
///// < param name="limit"></param>
///// <param name = "condition" ></ param >
///// < param name="sort"></param>
///// <returns></returns>
//public ContentResult getPubExtendStore(string STORENAME, string sort = "")
//{
// var userid = CookieConfig.GetCookie_UserId(Request);
// var SqlStr = "";
// var dataList = new List<PubStoremb>();
// if (STORENAME == "OPSEAE_CUST_ISCONTROLLER")
// {
// var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
// SqlStr = BasicDataRefDAL.GetCustomRefList_GetSqlStr(" ISCONTROLLER=1 ", ISENABLECUSTRANGE, userid).ToString();
// dataList = BasicDataRefDAL.getPubExtendStore(SqlStr);
// }
// if (STORENAME == "INFOCLIENT_CARRIER")
// {
// var ISENABLECUSTRANGE = CookieConfig.GetCookie_ISENABLECUSTRANGE(Request);
// SqlStr = BasicDataRefDAL.GetCustomRefList_GetSqlStr(" ISCARRIER=1 ", ISENABLECUSTRANGE, userid).ToString();
// dataList = BasicDataRefDAL.getPubExtendStore(SqlStr);
// }
// var diclist = ModelObjectBill.getDicList(ModelObjectConvert<PubStoremb>.ToModelObjectList(dataList));
// if (diclist.Count == 0)
// {
// var json = JsonConvert.Serialize(new { success = false });
// return new ContentResult() { Content = json };
// }
// else
// {
// var json = JsonConvert.Serialize(new { success = true, data = diclist.ToList() });
// return new ContentResult() { Content = json };
// }
//}
#endregion
#region 多种业务使用的业务信息查询
public ContentResult GetVOPBSList(int start, int limit,string OPLB, string sort, string condition)
{
var dataList = BasicDataRefDAL.getVOPBSStore(start, limit, OPLB, condition,sort);
var list = ModelObjectBill.getDicList(ModelObjectConvert<VOPBSmb>.ToModelObjectList(dataList));
//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 };
}
#endregion
#region 获取注册信息(用于在公司服务器接受注册查询请求)
public string GetSecCompnany(string GID)
{
DBResult result = new DBResult();
try
{
sys_secCompanyBLL cbll = new sys_secCompanyBLL();
sys_secCompany cmodel = cbll.GetModelList("GID='"+ GID + "'").FirstOrDefault();
result.setMessage(true, "");
result.Data = cmodel;
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
}
return JsonConvert.Serialize(result) ;
}
public string GetSecModel(string GID)
{
DBResult result = new DBResult();
try
{
sys_secModuleBLL ServerModel = new sys_secModuleBLL();
List<sys_secModule> ServerModelList = ServerModel.GetModelList("PID='" + GID + "'");
result.setMessage(true, "");
result.Data = ServerModelList.ToList();
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
}
return JsonConvert.Serialize(result);
}
#endregion
#region 查询指定userid是否具备指定权限范围能否看到某个模块/具备某个sys_module的权限在user_action中查找
public ContentResult CheckAuthority(string modname)
{
//前台方法在 mvcshipping/DsextjsEx.js内
//select * from * from user_action where USERID='2e10cf95-59e9-46c7-a4f1-90728fa242c9' and ACTIONID=(select gid from [action] where NAME='modSeaeExportManagement'
var _r = BasicDataRefDAL.CheckAuthority(Session["USERID"].ToString(), modname);
var json = JsonConvert.Serialize(new { Success = true, Message = "有操作权限" });
if (!_r)
{
json = JsonConvert.Serialize(new { Success = false, Message = "无操作权限" });
}
return new ContentResult() { Content = json };
}
#endregion
#region 合规校验调用
public ContentResult CheckRule(string OPLBNAME,string BSNO)
{
var _r = new DBResult();
_r.SetErrorInfo("没有处理这类业务("+OPLBNAME+")");
if (OPLBNAME=="opseae")
{
_r = BasicDataRefDAL.RulesManage_OPSEAE(BSNO);
}
return BasicDataRefDAL.GetContentResult(_r);
}
#endregion
#region 壹沓科技ocr识别
public string GetOcrUrl(string formname,string CUSTOMERNAME)
{
DBResult result = new DBResult();
try
{
var cdc = new CommonDataContext();
var cust = cdc.info_client.FirstOrDefault(x => x.SHORTNAME == CUSTOMERNAME || x.CODENAME == CUSTOMERNAME);
var url= PublicAPIDAL.Helper.GetUrl_front(cust.GID);
if (!string.IsNullOrWhiteSpace(url)) {
result = new DBResult(true, "获取成功", url);
}
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
}
return JsonConvert.Serialize(result);
}
public string GetOcrResult(string BSNO,string recordId, string OPLBNAME)
{
DBResult result = new DBResult();
try
{
//根据OPLBNAME调用不同业务的getdata
if (string.IsNullOrWhiteSpace(recordId)) {
return JsonConvert.Serialize(result.SetErrorInfo("未取得识别结果"));
}
var ocrresult = PublicAPIDAL.Helper.GetOcrResult(recordId);
if (OPLBNAME == "opseae") {
var record = DSWeb.MvcShipping.DAL.MsOpSeaeDAL.MsOpSeaeDAL.GetData(" B.BSNO='"+ BSNO + "'");
ocrresult.SetData(ref record);
result.setMessage(true, "", record);
return JsonConvert.Serialize(result);
}
}
catch (Exception e)
{
result.SetErrorInfo(e.Message);
}
return JsonConvert.Serialize(result);
}
#endregion
#region 泛微OA审批流程接口
//public string FanWeuOAAPI(string BSNO, string OPLBNAME = "付费申请") {
// DBResult result = new DBResult();
// if (OPLBNAME == "付费申请") {
// PublicAPIDAL.泛微OAHelper.GetSecret();
// }
// return JsonConvert.Serialize(result);
//}
#endregion
#region 前端读取服务器webconfig配置项内容
//public ContentResult GetWebconfigInfo(string FieldName)
//{
// var jsonRespose = new JsonResponse
// {
// Success = false,
// Message = "",
// Data = null
// };
// if (ConfigurationManager.AppSettings[FieldName] !=null)
// {
// jsonRespose.Success = true;
// jsonRespose.Message = ConfigurationManager.AppSettings[FieldName].ToString();
// }
// return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
//}
public ContentResult GetDSWMSLoginInfo()
{
var jsonRespose = new JsonResponse
{
Success = false,
Message = "",
Data = null
};
if (ConfigurationManager.AppSettings["DSWMSLOGIN"] != null)
{
//'?companycode=' + COMPANYCODE + '&codename=' + CODENAME + '&pwd=' + PASSWORD
jsonRespose.Success = true;
jsonRespose.Message = ConfigurationManager.AppSettings["DSWMSLOGIN"].ToString()+$"?companycode={Session["COMPANYCODE"]}&codename={Session["CODENAME"]}";
var cdc = new CommonDataContext();
var codename = Session["CODENAME"].ToString();
var _user = cdc.User.FirstOrDefault(x => x.CODENAME == codename);
jsonRespose.Data = _user.PASSWORD;
}
return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) };
}
#endregion
#region 查看指定客户的当前欠费
public ContentResult CustomerNODR(string condition)
{
var _r = BasicDataRefDAL.CustomerNODR(condition, Session);
return BasicDataRefDAL.GetDataListContentResult(_r);
}
#endregion
}
}