using System; using System.Data; using System.Linq; using System.Web.Mvc; using DSWeb.MvcShipping.DAL.MsBaseInfoDAL; using DSWeb.MvcShipping.Models.CustomRef; using DSWeb.MvcShipping.Models.UserBaseInfo; using DSWeb.MvcShipping.Models.CompanyGPS; using DSWeb.MvcShipping.Helper; using DSWeb.MvcShipping.Comm.Cookie; using System.Collections.Generic; using HcUtility.Comm; using HcUtility.Core; using DSWeb.MvcShipping.Models.UserQuerySetting; using DSWeb.Areas.CommMng.DAL; using DSWeb.Areas.RptMng.Comm; using DSWeb.SoftMng.DBUtility; using DSWeb.SoftMng.BLL; using DSWeb.SoftMng.Common; using DSWeb.SoftMng.Model; using DSWeb.SoftMng.Controllers; using System.Web.Script.Serialization; using System.Text; using DSWeb.SoftMng.Filter; using DSWeb.MvcShipping.DAL.MsSysParamSet; namespace DSWeb.MvcShipping.Controllers { [JsonRequestBehavior] public class MsBaseInfoController : Controller { // // GET: public ActionResult Index() { return View(); } // // GET: / public ActionResult Edit() { return View(); } // // GET: public ContentResult GetCustomerRefList(string condition) { var dataList = MsBaseInfoDAL.GetCustomerRefList(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetPortRefList(string condition) { var dataList = MsBaseInfoDAL.GetPortRefList(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetOurPortRefList(string condition) { var dataList = MsBaseInfoDAL.GetOurPortRefList(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetOpEdiLog(string condition) { var dataList = MsBaseInfoDAL.GetOpEdiLog(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetGoodsRefList(string condition) { var dataList = MsBaseInfoDAL.GetGoodsRefList(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetStlModeList(string condition) { string LAN = Convert.ToString(Session["LANGUAGES"]); var dataList = MsBaseInfoDAL.GetStlModeList(condition, LAN); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetBANKList(string condition, string companyid) { var companyidstr = companyid; if (companyidstr == "" || companyidstr == null) companyidstr = Convert.ToString(Session["COMPANYID"]); var dataList = MsBaseInfoDAL.GetBANKList(condition, companyidstr); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetAllBANKList(string condition) { var dataList = MsBaseInfoDAL.GetAllBANKList(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetFeeCustNoEnable(string bsno, string custno) { var CANEDITCUSTHAVEFEE = MsSysParamSetDAL.GetData("PARAMNAME='CANEDITCUSTHAVEFEE'").PARAMVALUE; if (CANEDITCUSTHAVEFEE == "1") { var json2 = JsonConvert.Serialize(new { Success =false, Message = "查询成功" }); return new ContentResult() { Content = json2 }; } var istrue = MsBaseInfoDAL.GetFeeCustNoEnable(bsno, custno); var json = JsonConvert.Serialize(new { Success = istrue, Message = "查询成功" }); return new ContentResult() { Content = json }; } public ContentResult GetModuTreeRefList(string PARENTID) { var condition = "PARENTID='" + PARENTID + "'"; if (PARENTID == "213F23DE-8D2D-4794-9AC0-DB994197E16D") { if (!MsBaseInfoDAL.GetFeeRangDAStr("op_Seae", Convert.ToString(Session["USERID"]))) condition = condition + " and DESCRIPTION<>'费用信息'"; } else if (PARENTID == "A619ED40-4F44-4330-9208-5114F173B934") { var istrue = MsBaseInfoDAL.GetUserModuleEnable("modSaleOrderNoOpFEE", Convert.ToString(Session["USERID"])); if (istrue) condition = condition + " and DESCRIPTION<>'费用信息'"; } else if (PARENTID == "FEDF4D2F-81E8-4C2C-9CAE-5B7A047C5483") { if (!MsBaseInfoDAL.GetFeeRangDAStr("op_Seai", Convert.ToString(Session["USERID"]))) condition = condition + " and DESCRIPTION<>'费用信息'"; } else if (PARENTID == "FEDF4D2F-81E8-4C2C-9CAE-5B7A047C5483") { if (!MsBaseInfoDAL.GetFeeRangDAStr("op_Seai", Convert.ToString(Session["USERID"]))) condition = condition + " and DESCRIPTION<>'费用信息'"; } else if (PARENTID == "5840B545-4012-4FCE-A2F4-A03911A2D1BE") { if (!MsBaseInfoDAL.GetFeeRangDAStr("op_Aire", Convert.ToString(Session["USERID"]))) condition = condition + " and DESCRIPTION<>'费用信息'"; } else if (PARENTID == "16E13948-D20D-452B-852F-6EC58173996C") { if (!MsBaseInfoDAL.GetFeeRangDAStr("op_Airi", Convert.ToString(Session["USERID"]))) condition = condition + " and DESCRIPTION<>'费用信息'"; } else if (PARENTID == "E44F0B49-6F61-40FB-AC28-E630591BE557") { if (!MsBaseInfoDAL.GetFeeRangDAStr("op_other", Convert.ToString(Session["USERID"]))) condition = condition + " and DESCRIPTION<>'费用信息'"; } else if (PARENTID == "5E301DAB-1DC4-4635-85FC-711F3FD94D39") { if (!MsBaseInfoDAL.GetFeeRangDAStr("op_Apply", Convert.ToString(Session["USERID"]))) condition = condition + " and DESCRIPTION<>'费用信息'"; } else if (PARENTID == "A44A8005-CC7D-4FC5-83DA-5DB7168E55FA") { if (!MsBaseInfoDAL.GetFeeRangDAStr("op_InternalTrade", Convert.ToString(Session["USERID"]))) condition = condition + " and DESCRIPTION<>'费用信息'"; } var dataList = MsBaseInfoDAL.GetModuTreeRefList(condition, Convert.ToString(Session["LANGUAGES"])); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetUserModuTreeList(string condition) { var dataList = MsBaseInfoDAL.GetUserModuTreeList(condition, Convert.ToString(Session["USERID"]), Convert.ToString(Session["LANGUAGES"])); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetUserModuleEnableList(string condition) { var dataList = MsBaseInfoDAL.GetUserModuleEnableList(condition, Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetUserModuleEnable(string modulename) { var istrue = MsBaseInfoDAL.GetUserModuleEnable(modulename, Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize(new { Success = istrue, Message = "查询成功" }); return new ContentResult() { Content = json }; } #region 新窗体 public ContentResult GetProModuTreeList(string condition) { var dbparams = new List(); var parampsOrgCode = new CustomDbParamter(); parampsOrgCode.ParameterName = "@oper"; parampsOrgCode.DbType = DbType.String; parampsOrgCode.Direction = ParameterDirection.Input; parampsOrgCode.Value = Convert.ToString(Session["USERID"]); dbparams.Add(parampsOrgCode); var parampsExpDateBgn = new CustomDbParamter(); parampsExpDateBgn.ParameterName = "@strCondition"; parampsExpDateBgn.DbType = DbType.String; parampsExpDateBgn.Direction = ParameterDirection.Input; parampsExpDateBgn.Value = " and PARENTID='0'"; dbparams.Add(parampsExpDateBgn); var strLANGUAGES = Convert.ToString(Session["LANGUAGES"]); var prcname = "P_userRight"; if (strLANGUAGES == "en-us") prcname = "P_userRight_Ename"; var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet(prcname, dbparams, "Result_Set"); //sys_secCompanyBLL cbll = new sys_secCompanyBLL(); //DataSet ds = dbRptResult.DataSet.Clone(); //var cModel = cbll.GetModelList("").FirstOrDefault(); //if (cModel != null) //{ // var control = new JavaScriptSerializer() // .Deserialize(DSWeb.SoftMng.Common.Common.string_Decrypt(cModel.CompanySecretKey, "Dw9pVb9r")).MenuControl; // if (control) //有菜单控制 // { // //公司使用模块限制 // sys_secModuleBLL mbll = new sys_secModuleBLL(); // actionBLL abll = new actionBLL(); // user_actionBLL ubll = new user_actionBLL(); // var json = new JavaScriptSerializer(); // DataRowCollection drs = dbRptResult.DataSet.Tables[0].Rows; // List list = new List(); // for (int i = 0; i < drs.Count; i++) // { // var id = drs[i]["id"].ToString(); // var model = mbll.GetModelList("IdenSecretkey='" + DSWeb.SoftMng.Common.Common.string_Encrypt(id, "2cP46Gox") + "'") // .FirstOrDefault(); // if (model != null) // { // SecrietStr smodel = // json.Deserialize(DSWeb.SoftMng.Common.Common.string_Decrypt(model.ModuleSecretkey, // "2cP46Gox")); //解密当前模块配置 // if (Convert.ToBoolean(smodel.Enabled)) // { // ds.Tables[0].ImportRow(drs[i]); // //判断人数是否超限 // //var amodel = abll.GetModelList("MODULEID='" + smodel.Id + "'").FirstOrDefault(); // //if (amodel != null) // //{ // // int times = ubll.GetRecordCount("ACTIONID='" + amodel.GID + "'"); // // if (times > smodel.Times) //已授权人数大于限制人数 // // { // // moduleClass model1 = new moduleClass // // { // // Name = smodel.Name, // // Code = amodel.NAME, // // aTimes = Convert.ToInt32(smodel.Times), // // yTimes = times // // }; // // list.Add(model1); // // } // // else // // ds.Tables[0].ImportRow(drs[i]); // //} // } // } // } // dbRptResult.Message = new JavaScriptSerializer().Serialize(list); // //未配置默认 // dbRptResult.DataSet = ds; // } //} //else//未配置公司密钥表(无菜单) // dbRptResult.DataSet = ds; var result = RptHelper.GetRptJsonResult(0, 100, dbRptResult, "Result_Set", false); return new ContentResult() { Content = result }; } public ContentResult GetProParentModuTreeList(string PARENTID) { var dbparams = new List(); var parampsOrgCode = new CustomDbParamter(); parampsOrgCode.ParameterName = "@oper"; parampsOrgCode.DbType = DbType.String; parampsOrgCode.Direction = ParameterDirection.Input; parampsOrgCode.Value = Convert.ToString(Session["USERID"]); dbparams.Add(parampsOrgCode); var parampsExpDateBgn = new CustomDbParamter(); parampsExpDateBgn.ParameterName = "@strCondition"; parampsExpDateBgn.DbType = DbType.String; parampsExpDateBgn.Direction = ParameterDirection.Input; parampsExpDateBgn.Value = " and PARENTID='" + PARENTID + "'"; dbparams.Add(parampsExpDateBgn); var strLANGUAGES = Convert.ToString(Session["LANGUAGES"]); var prcname = "P_userRight"; if (strLANGUAGES == "en-us") prcname = "P_userRight_Ename"; var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet(prcname, dbparams, "Result_Set"); ////判断是否有模块限制 //sys_secCompanyBLL cbll = new sys_secCompanyBLL(); //DataSet ds = dbRptResult.DataSet.Clone(); //var cModel = cbll.GetModelList("").FirstOrDefault(); //if (cModel != null) //{ // var control = new JavaScriptSerializer() // .Deserialize(DSWeb.SoftMng.Common.Common.string_Decrypt(cModel.CompanySecretKey, "Dw9pVb9r")).MenuControl; // if (control)//有菜单控制 // { // //公司使用模块限制 // sys_secModuleBLL mbll = new sys_secModuleBLL(); // actionBLL abll = new actionBLL(); // user_actionBLL ubll = new user_actionBLL(); // var json = new JavaScriptSerializer(); // DataRowCollection drs = dbRptResult.DataSet.Tables[0].Rows; // List list = new List(); // for (int i = 0; i < drs.Count; i++) // { // var id = drs[i]["id"].ToString(); // var model = mbll.GetModelList("IdenSecretkey='" + DSWeb.SoftMng.Common.Common.string_Encrypt(id, "2cP46Gox") + "'").FirstOrDefault(); // if (model != null) // { // SecrietStr smodel = json.Deserialize(DSWeb.SoftMng.Common.Common.string_Decrypt(model.ModuleSecretkey, "2cP46Gox"));//解密当前模块配置 // if (Convert.ToBoolean(smodel.Enabled)) // { // ds.Tables[0].ImportRow(drs[i]); // //判断人数是否超限 // //var amodel = abll.GetModelList("MODULEID='" + smodel.Id + "'").FirstOrDefault(); // //if (amodel != null) // //{ // // int times = ubll.GetRecordCount("ACTIONID='" + amodel.GID + "'"); // // if (times > smodel.Times) //已授权人数大于限制人数 // // { // // moduleClass model1 = new moduleClass // // { // // Name = smodel.Name, // // Code = amodel.NAME, // // aTimes =Convert.ToInt32(smodel.Times), // // yTimes = times // // }; // // list.Add(model1); // // } // // else // // ds.Tables[0].ImportRow(drs[i]); // //} // } // } // } // dbRptResult.Message = new JavaScriptSerializer().Serialize(list); // //未配置默认禁用 // dbRptResult.DataSet = ds; // } //} //else//未配置公司密钥表(无菜单) // dbRptResult.DataSet = ds; var result = RptHelper.GetRptJsonResult(0, 100, dbRptResult, "Result_Set", false); return new ContentResult() { Content = result }; } public ContentResult GetMessageStr() { var strmessage = MsBaseInfoDAL.GetMessageStr(Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = strmessage }); return new ContentResult() { Content = json }; } public ContentResult GetMessageList(string optype) { var dataList = MsBaseInfoDAL.GetMessageList(Convert.ToString(Session["USERID"])); MsBaseInfoDAL.MessageSend(dataList); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } #endregion public ContentResult GetOpRang(string optype) { var list = MsBaseInfoDAL.GetOpRang(optype, Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetOpRang_Limit(string optype) { var list = MsBaseInfoDAL.GetOpRang_Limit(optype, Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetOpIDRang(string optype) { var list = MsBaseInfoDAL.GetOpIDRang(optype, Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = list.ToList() }); return new ContentResult() { Content = json }; } /// /// 权限范围的“无”,不在默认为个人 /// /// 中文名称 /// public ContentResult GetOpRang4(string optype) { var list = MsBaseInfoDAL.GetOpRang4(optype, Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize( new { Success = true, Message = "查询成功", data = list.ToList() }); return new ContentResult() { Content = json }; } public ContentResult GetRuleEdit(string rulename, string ruletype) { var isEdit = MsBaseInfoDAL.GetRuleEdit(rulename, ruletype); var json = JsonConvert.Serialize( new { Success = isEdit, Message = "查询成功", data = "" }); return new ContentResult() { Content = json }; } public JsonResult GetUserBaseList() { var evList = MsBaseInfoDAL.GetUserBaseList("COMPANYNAME='" + Convert.ToString(Session["COMPANYNAME"]) + "'"); if (evList.Count == 0) { return Json(new { success = true, data = new UserBaseInfoModel() }); } else { return Json(new { success = true, data = evList.ToList() }); } } public ContentResult GetCodeRptFeeGroup(string condition) { var dataList = MsBaseInfoDAL.GetCodeRptFeeGroup(condition); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } public JsonResult GetCompanyGps(string condition) { var evList = MsBaseInfoDAL.GetCompanyGps("GID='" + Convert.ToString(Session["COMPANYID"]) + "'"); return Json(new { success = true, data = evList }); } public JsonResult GetOTCompanyEN(string condition) { var evList = MsBaseInfoDAL.GetOTCompanyEN(condition, Convert.ToString(Session["COMPANYID"])); return Json(new { success = true, data = evList.ToList() }); } public JsonResult GetCompanyEN(string condition) { var evList = MsBaseInfoDAL.GetCompanyEN(condition, Convert.ToString(Session["COMPANYID"])); return Json(new { success = true, data = evList.ToList() }); } #region 个人查询条件设置 public JsonResult GetUserQuerySetting(string formname) { var evList = MsBaseInfoDAL.GetUserQuerySetting(Convert.ToString(Session["USERID"]), formname); return Json(new { success = true, data = evList }); } //public JsonResult GetUserQueryDetail(string formname) //{ // var evList = MsBaseInfoDAL.GetUserQueryDetail(Convert.ToString(Session["USERID"]),formname); // return Json(new { success = true, data = evList.ToList() }); //} public ContentResult SaveUserQuerySetting(string formname, string isvisible, string issavevalue, string querydetail) { var result = new DBResult(); var modb = new ModelObjectDB(); result = MsBaseInfoDAL.SaveUserQuerySetting(isvisible, issavevalue, Convert.ToString(Session["USERID"]), formname, querydetail); var jsonRespose = new JsonResponse { Success = result.Success, Message = result.Message, Data = "" }; return new ContentResult() { Content = JsonConvert.Serialize(jsonRespose) }; } //高级查询设置 public JsonResult GetQueryFieldSetting(string formname) { var evList = MsBaseInfoDAL.GetQueryFieldSetting(formname); return Json(new { success = true, data = evList }); } #endregion #region 总账凭证号生成 public ContentResult GetCwVOUNO(string VKNO) { string strCwACCDATE = BasicDataRefDAL.GetCwACCDATE(Convert.ToString(Session["USERID"])); var strList = MsBaseInfoDAL.GetCwVOUNO(VKNO, strCwACCDATE, Convert.ToString(Session["USERID"])); if (strList.Trim() == "-1") { var json = JsonConvert.Serialize(new { Success = false, Message = "请先设置帐套信息!", data = "" }); return new ContentResult() { Content = json }; } else { var json = JsonConvert.Serialize(new { Success = true, Message = "操作成功!", data = strList }); return new ContentResult() { Content = json }; } } public ContentResult GetCwISRATESET() { var strList = MsBaseInfoDAL.GetCwISRATESET(Convert.ToString(Session["USERID"])); if (strList.Trim() == "-1") { var json = JsonConvert.Serialize(new { Success = false, Message = "请先设置帐套信息!", data = "-1" }); return new ContentResult() { Content = json }; } else { var json = JsonConvert.Serialize(new { Success = true, Message = "操作成功!", data = strList }); return new ContentResult() { Content = json }; } } #endregion #region 接口凭证号生成 public ContentResult GetVOUNO(string VKNO) { string strCwACCDATE = BasicDataRefDAL.GetCwACCDATE(Convert.ToString(Session["USERID"])); var strList = MsBaseInfoDAL.GetVOUNO(VKNO, strCwACCDATE); if (strList.Trim() == "-1") { var json = JsonConvert.Serialize(new { Success = false, Message = "请先设置帐套信息!", data = "" }); return new ContentResult() { Content = json }; } else { var json = JsonConvert.Serialize(new { Success = true, Message = "操作成功!", data = strList }); return new ContentResult() { Content = json }; } } #endregion #region 科目币别表 public ContentResult GetCwAccitemsCurrencyList(string condition) { var dataList = MsBaseInfoDAL.GetCwAccitemsCurrencyList(condition, Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", data = dataList.ToList() }); return new ContentResult() { Content = json }; } #endregion #region 根据条件从sys_module、user_action表中取数据 public ContentResult GetSysModuleList(string condition) { var dataList = MsBaseInfoDAL.GetSysModuleList(condition, Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } #endregion #region 高级查询下拉数据 public ContentResult GetQueryListValue(string type) { if (type == "CUST") { var dataList = MsBaseInfoDAL.GetQueryList(Convert.ToString(Session["USERID"])); var json = JsonConvert.Serialize(new { Success = true, Message = "查询成功", totalCount = dataList.Count, data = dataList.ToList() }); return new ContentResult() { Content = json }; } else { var dbparams = new List(); var parampsOrgCode = new CustomDbParamter(); parampsOrgCode.ParameterName = "@TYPE"; parampsOrgCode.DbType = DbType.String; parampsOrgCode.Direction = ParameterDirection.Input; parampsOrgCode.Value = type; dbparams.Add(parampsOrgCode); var dbRptResult = PubSysDAL.GetMsSqlPrcDataSet("P_GetList", dbparams, "Result_Set"); var json = RptHelper.GetRptJsonResult(0, 10000, dbRptResult, "Result_Set", false); return new ContentResult() { Content = json }; } } #endregion } public class moduleClass { public string Name { get; set; } public string Code { get; set; } public int aTimes { get; set; } public int yTimes { get; set; } } }