Exemple #1
0
        public ActionResult GetMySubmitList(int page, int rows, string search, string sidx, string sord)
        {
            string filter    = Request["filters"] != null ? Request["filters"] : "";
            string filterSql = "";

            if (!string.IsNullOrEmpty(filter))
            {
                filterSql = filter.BuildSearch("Bse_FileModule");
                //filterSql = BulidJqGridSearch.BuildSearch(filter);
            }
            List <Bse_File> list    = new List <Bse_File>();
            string          orderby = Bll_Comm.GetOrderString(sidx, sord);

            if (string.IsNullOrEmpty(filterSql))
            {
                list = fInstance.GetMyFileList("1=1" + orderby);
            }
            else
            {
                list = fInstance.GetMyFileList(filterSql + orderby);
            }

            var model = list.AsQueryable <Bse_File>();
            //var result = model.ToJqGridData(page, rows, null, search, null);
            //return Json(result, JsonRequestBehavior.AllowGet);
            var jsonResult = JsonConvert.SerializeObject(model.ToJqGridData(page, rows, null, search, null), new JsonDateConverter("yyyy-MM-dd"));

            return(JavaScript(jsonResult));
        }
Exemple #2
0
        /// <summary>
        /// 获取草稿列表
        /// </summary>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <param name="search"></param>
        /// <param name="sidx"></param>
        /// <param name="sord"></param>
        /// <returns></returns>
        public ActionResult GetDraftList(int page, int rows, string search, string sidx, string sord)
        {
            string filter    = Request["filters"] != null ? Request["filters"] : "";
            string filterSql = "";

            if (!string.IsNullOrEmpty(filter))
            {
                filterSql = filter.BuildSearch("CList_DocInfo");
                //filterSql = BulidJqGridSearch.BuildSearch(filter);
            }
            List <Doc_Info> list = new List <Doc_Info>();

            string orderby = Bll_Comm.GetOrderString(sidx, sord);

            if (string.IsNullOrEmpty(filterSql))
            {
                list = diInstance.GetDraftDocList("1=1" + orderby);
            }
            else
            {
                list = diInstance.GetDraftDocList(filterSql + orderby);
            }

            var model  = list.AsQueryable <Doc_Info>();
            var result = model.ToJqGridData(page, rows, null, search, null);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Exemple #3
0
        public ActionResult InitGrid(int page, int rows, string search, string sidx, string sord)
        {
            string ModuleCode  = Request["ModuleCode"] == null ? "" : Request["ModuleCode"].ToString();
            string NameSpace   = Request["NameSpace"] == null ? "" : Request["NameSpace"].ToString();
            string LoginId     = Request["userid"] == null ? "" : Request["userid"].ToString(); // session
            string deptid      = Request["deptid"] == null ? "" : Request["deptid"].ToString(); // session
            string filters     = Request["filters"] == null ? "" : Request["filters"].ToString();
            string Inlinetype  = Request["itype"] == null ? "0" : Request["itype"].ToString();
            string GeneralType = Request["type"] == null ? "0" : Request["type"].ToString();
            string record      = Request["record"] == null ? "" : Request["record"];
            string filtersSql  = "1=1";

            if (!string.IsNullOrEmpty(filters))
            {
                filtersSql = filters.BuildSearch(ModuleCode);
                //filtersSql = BulidJqGridSearch.BuildSearch(filters);
                //动态查询入口更改,查询结果后进行筛选
                //filtersSql = "";
            }

            //临时赋值
            LoginId = SessionConfig.UserId();
            deptid  = SessionConfig.DeptId();

            //预留两个自定义参数

            Dictionary <String, String> param = new Dictionary <string, string>();

            param.Add("@Page", page.ToString());
            param.Add("@Rows", rows.ToString());
            param.Add("@Search", filtersSql);     //查询字段
            param.Add("@Sidx", sidx);             //排序字段
            param.Add("@Sord", sord);             //排序 ASC DESC
            param.Add("@ModuleCode", ModuleCode); //模块编码
            param.Add("@NameSpace", NameSpace);   //模块命名空间
            param.Add("@Userid", LoginId);
            param.Add("@Deptid", deptid);
            param.Add("@InlineType", Inlinetype);
            param.Add("@GeneralType", GeneralType);

            //获取所有的数据列
            var dt = instance.GetListPageAllRecords(ModuleCode, NameSpace, param);

            if (!string.IsNullOrEmpty(record))
            {
                dt = FilterDataTable(dt, "Record_ID='" + record + "'");
            }
            DataTable newDt = GetPagedTable(dt, page, rows, ModuleCode);


            //newDt.DefaultView.Sort = " CreateDate DESC ";
            //DataTable newDt = DataTablePage.GetPagedTable(dt, page, rows);

            //var json = DataTablePage.JsonForJqgrid(newDt, page, rows, dt.Rows.Count);
            var json = Bll_Comm.JsonForJqgrid(ModuleCode, newDt, page, rows, dt.Rows.Count);

            return(JavaScript(json));
        }
Exemple #4
0
        /// <summary>
        /// 根据客户获取对应图号的相关图纸
        /// </summary>
        /// <param name="id"></param>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <param name="search"></param>
        /// <param name="sidx"></param>
        /// <param name="sord"></param>
        /// <returns></returns>
        public ActionResult GetCompListByCust(string id, string parent, int page, int rows, string search, string sidx, string sord)
        {
            string filter    = Request["filters"] != null ? Request["filters"] : "";
            string filterSql = "";

            if (!string.IsNullOrEmpty(filter))
            {
                filterSql = filter.BuildSearch("Bse_ComponentsModule");
                //filterSql = BulidJqGridSearch.BuildSearch(filter);
            }

            List <Bse_Components> list = new List <Bse_Components>();

            string orderby = Bll_Comm.GetOrderString(sidx, sord);

            if (string.IsNullOrEmpty(orderby))
            {
                orderby = " order by Comp_Type";
            }


            //是否点击了节点
            if (!string.IsNullOrEmpty(id))
            {
                if (string.IsNullOrEmpty(filterSql))
                {
                    list = cInstance.GetAllCompList(id, parent, "1=1 " + orderby);
                }
                else
                {
                    list = cInstance.GetAllCompList(id, parent, filterSql + orderby);
                }
            }


            var model = list.AsQueryable <Bse_Components>();
            //var result = model.ToJqGridData(page, rows, null, search, null);
            //return Json(result, JsonRequestBehavior.AllowGet);
            var jsonResult = JsonConvert.SerializeObject(model.ToJqGridData(page, rows, null, search, null), new JsonDateConverter("yyyy-MM-dd"));

            return(JavaScript(jsonResult));
        }
Exemple #5
0
        //登陆
        public ActionResult LoginBtn()
        {
            //TODO:corporation
            string result   = "fail";
            string msg      = string.Empty;
            string company  = Request["company"];
            string userName = Request["userName"];
            string userPwd  = Request["pwd"];

            //string userRole = Request["role"];
            //string result = "";
            if (!Net.CheckConn())
            {
                return(Json(new { result = result, msg = "无法连接到服务器!请检查网络情况。" }));
            }

            try
            {
                if (userName == null || userPwd == null)
                {
                    result = "fail";
                    msg    = "用户名或密码不能为空";
                    //return Content("Null");
                }
                else
                {
                    Session.RemoveAll();
                    Session.Clear();
                    //TODO:1.4
                    //得到公司
                    // string pwd = Md5.MD5(userPwd.Replace('\'', '"'));
                    string pwd = userPwd;
                    //角色Stuff_LoginType and Stuff_LoginType='" + userRole + "'
                    HR_Stuff = instanceHR_Stuff.GetModel(" and Emp_LoginID='" + userName.Replace('\'', '"') + "' and Emp_LoginPwd='" + pwd + "'");


                    if (HR_Stuff == null)
                    {
                        result = "fail";
                        msg    = "用户名或密码不正确 ";
                    }
                    else
                    {
                        //用户名
                        this.SetSession <string>("UserName", HR_Stuff.Emp_Name);
                        //员工编码
                        this.SetSession <string>("UserId", HR_Stuff.Emp_Code);
                        //员工登录名
                        this.SetSession <string>("LoginName", HR_Stuff.Emp_LoginID);
                        //登录IP
                        this.SetSession <string>("IP", HttpContext.Request.UserHostAddress);

                        //部门信息
                        Bse_Department = instanceDepartment.GetModel(" and Dept_Code='" + HR_Stuff.Emp_Dept_Code + "'");
                        if (Bse_Department != null)
                        {
                            //部门id
                            this.SetSession <string>("DeptId", Bse_Department.Dept_Code.ToString());
                            //部门名称
                            this.SetSession <string>("DeptName", Bse_Department.Dept_Name);
                            //用户角色//hack
                            this.SetSession <string>("UserRole", "");
                            //DODO:hao


                            //Bse_Department fagTemp = instanceBse_Department.GetModel(" and Dept_Code='" + Bse_Department.Dept_PCode.ToString() + "'");
                            //while (!string.IsNullOrEmpty(fagTemp.Dept_PCode))
                            //{
                            //    fagTemp = instanceBse_Department.GetModel(" and Dept_Code='" + fagTemp.Dept_PCode + "'");
                            //}
                            //string companyUser = fagTemp.Dept_Name.ToString();
                            ////公司编码
                            //string companyCode = fagTemp.Dept_Code.ToString();
                            ////this.SetSession<string>("Company", company);
                            //this.SetSession<string>("CompanyCode", companyCode);
                            //部门编码
                            // this.SetSession<string>("DeptCode", Bse_Department.Dept_Code);

                            //TODO:得到公司问题
                            //companyCode=new BLL.Bll_Bse_Department().GetCompanyName("" + Bse_Department.Dept_Code + "");

                            //this.SetSession<string>("Company", companyUser);

                            result = "success";

                            msg = "";
                        }
                        else
                        {
                            result = "fail";
                            msg    = "用户信息配置错误";
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                result = "fail";
                // msg = "网络连接不通,请重试";
                msg = ex.Message;
                // PlateLog.Write("连接异常:", PlateLog.LogMessageType.Error,ex);
            }
            //QX.Log.PlateLog.WriteOp
            //写入登录日志
            Bll_Comm.LoginLog(userName, msg);

            return(Json(new { result = result, msg = msg }));
        }
Exemple #6
0
 /// <summary>
 /// 扩展系统操作日志
 /// </summary>
 /// <param name="controller">Controller</param>
 /// <param name="Module">模块编码</param>
 /// <param name="ModuleName">模块名称(格式:Add:物料管理,编码:xxxxxx)</param>
 /// <param name="Message">信息(格式:success:sql语句/异常信息)</param>
 public static void OpLog(this Controller controller, string Module, string ModuleName, string Message)
 {
     Bll_Comm.OpLog(Module, ModuleName, Message);
 }
        public ActionResult GetData(int page, int rows, string search, string sidx, string sord)
        {
            string Name       = Request["name"] == null ? "" : Request["name"].ToString();
            string filters    = Request["filters"] == null ? "" : Request["filters"].ToString();
            string filter     = Request["filter"] == null ? "" : Request["filter"].ToString();
            string ModuleName = Request["m"] == null ? "" : Request["m"].ToString();
            string NameSpace  = Request["n"] == null ? "" : Request["n"].ToString();


            string filtersSql   = string.Empty;
            string mapSqlFilter = string.Empty;

            if (!string.IsNullOrEmpty(filters))
            {
                filtersSql = BulidJqGridSearch.BuildSearch(filters);
            }
            BLL.Bll_Sys_Config_Refer       configRefer     = new QX.BLL.Bll_Sys_Config_Refer();
            BLL.Bll_Sys_Config_Field_Refer configReferList = new Bll_Sys_Config_Field_Refer();
            Sys_Config_Refer model = configRefer.GetListByCode(" AND  R_ModuleName='"
                                                               + ModuleName + "'")[0];
            var referList = configReferList.GetListByCode(" AND  D_ModuleName='" + ModuleName + "'").Where(o => !string.IsNullOrEmpty(o.D_DictKey));

            BLL.Bll_Bse_Dict DictInstance = new Bll_Bse_Dict();


            DataTable dt = new DataTable();

            if (!string.IsNullOrEmpty(model.R_SQL))
            {
                if (!string.IsNullOrEmpty(filter))
                {
                    model.R_SQL = model.R_SQL + filter;
                }
                if (!string.IsNullOrEmpty(filtersSql))
                {
                    model.R_SQL = model.R_SQL + " AND " + filtersSql;
                }
                dt = configRefer.ListBySql(model.R_SQL);
            }
            else
            {
                string _filtersql = !String.IsNullOrEmpty(model.R_FilterSql) ? model.R_FilterSql : "";
                _filtersql = _filtersql + filter;

                #region  特殊映射处理
                if (ModuleName == "HR_StuffModule")
                {
                    //读取映射配置表中公司配置
                    Bll_Comm comm      = new Bll_Comm();
                    string   mapFilter = "";
                    var      mapModel  = comm.CommMap(ModuleName, "Company");
                    if (mapModel != null)
                    {
                        var deptList = comm.GetChildListDeptNon(comm.CommMap(ModuleName, "Company").Map_Object);
                        if (deptList.Count() > 0)
                        {
                            foreach (var item in deptList)
                            {
                            }
                            for (int i = 0; i < deptList.Count; i++)
                            {
                                if (i == (deptList.Count - 1))
                                {
                                    mapFilter += "'" + deptList[i].Dept_Code + "'";
                                }
                                else
                                {
                                    mapFilter += "'" + deptList[i].Dept_Code + "',";
                                }
                            }
                            mapFilter.TrimEnd(',');
                        }
                        mapSqlFilter = " Stuff_DepCode in(" + mapFilter + ")";
                    }
                }
                #endregion

                //为空时不初始化
                //if (!string.IsNullOrEmpty(filter))
                //{
                //    dt = configRefer.ListDataByCode(Name, _filtersql, filtersSql + mapSqlFilter);
                //}
                dt = configRefer.ListDataByCode(Name, _filtersql, filtersSql + mapSqlFilter);
            }

            DataTable newdt = DataTablePage.GetPagedTable(dt, page, rows);

            #region 字典进行转换
            //对字典进行转换

            for (int i = 0; i < newdt.Rows.Count; i++)
            {
                foreach (var item in referList.ToList())
                {
                    var value      = newdt.Rows[i][item.D_Index] != null ? newdt.Rows[i][item.D_Index].ToString() : "";
                    var DictResult = DictInstance.GetListByCode(" AND Dict_Code='" + value
                                                                + "' AND Dict_Key='" + item.D_DictKey + "' ");
                    if (DictResult.Count > 0)
                    {
                        newdt.Rows[i][item.D_Index] = DictResult.FirstOrDefault().Dict_Name;
                    }
                }
            }

            #endregion

            var json = DataTablePage.JsonForJqgrid(newdt, page, rows, dt.Rows.Count);
            return(JavaScript(json));
        }
        /// <summary>
        /// 获取依赖映射配置
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="code"></param>
        /// <returns></returns>
        public static ViewDataDictionary GetRefdenped(this Controller controller, bool IsPU)
        {
            ViewDataDictionary dict = new ViewDataDictionary();

            //To Do 预留各种单据默认配置
            string itype  = "";
            string type   = "";
            string view   = "";
            string MRTOPO = "";
            string IsHideMaterialSearch = "";

            string defaultPU_SPec_DetailModule = "Spec_PUDetailModule";
            string defaultIA_Spec_DetailModule = "nOSpec_IOItemModule";
            string defaultPU_DetailModule      = "PU_PUDetailModule";
            string defaultIA_DetailModule      = "PU_IOItemModule";

            string PU_DetailModule = "";
            string IA_DetailModule = "";


            view = HttpContext.Current.Request["view"] != null ? "style='display:none'" : "";

            //PU配置
            if (IsPU)
            {
                itype  = controller.RouteData.Values["rtype"] != null ? controller.RouteData.Values["rtype"].ToString() : "";
                itype  = itype.Replace("#", " ").Trim();
                type   = controller.RouteData.Values["code"] != null ? controller.RouteData.Values["code"].ToString() : "";
                MRTOPO = HttpContext.Current.Request["MRTOPO"] != null ? HttpContext.Current.Request["MRTOPO"] : "";
                //Create edit
                string id = controller.RouteData.Values["id"] != null ? controller.RouteData.Values["id"].ToString() : "";
                if (!string.IsNullOrEmpty(id))
                {
                    itype = id;
                }
                dict.Add("RType", itype);
                dict.Add("RRType", type);
            }
            else
            {
                itype = HttpContext.Current.Request["itype"] != null?HttpContext.Current.Request["itype"]:"";
                type  = HttpContext.Current.Request["type"] != null ? HttpContext.Current.Request["type"] : "";
                dict.Add("itype", itype);
                dict.Add("type", type);
            }

            var model = Bll_Comm.CommRefDepend(itype);

            if (model == null)
            {
                return(null);
            }

            if (itype.Contains("MET") || itype.Contains("MEP") || itype.Contains("CTP") || itype.Contains("WOI") || itype.Contains("baseSER"))
            {
                PU_DetailModule = defaultPU_SPec_DetailModule;
                IA_DetailModule = defaultIA_Spec_DetailModule;

                if (model.RefDepend_Type == "PU")
                {
                    var ChildModuleName = string.IsNullOrEmpty(model.RefDepend_UDEF10) ? PU_DetailModule : model.RefDepend_UDEF10;
                    dict.Add("ChildModuleName", ChildModuleName);
                }
                else if (model.RefDepend_Type == "IA")
                {
                    var ChildModuleName = string.IsNullOrEmpty(model.RefDepend_UDEF10) ? IA_DetailModule : model.RefDepend_UDEF10;
                    dict.Add("ChildModuleName", ChildModuleName);
                }
                else if (model.RefDepend_Type == "MA")
                {
                    var ChildModuleName = string.IsNullOrEmpty(model.RefDepend_UDEF10) ? defaultPU_SPec_DetailModule : model.RefDepend_UDEF10;
                    dict.Add("ChildModuleName", ChildModuleName);
                }
            }
            else
            {
                PU_DetailModule = defaultPU_DetailModule;
                IA_DetailModule = defaultIA_DetailModule;

                if (model.RefDepend_Type == "PU")
                {
                    var ChildModuleName = string.IsNullOrEmpty(model.RefDepend_UDEF10) ? PU_DetailModule : model.RefDepend_UDEF10;
                    dict.Add("ChildModuleName", ChildModuleName);
                }
                else if (model.RefDepend_Type == "IA")
                {
                    var ChildModuleName = string.IsNullOrEmpty(model.RefDepend_UDEF10) ? IA_DetailModule : model.RefDepend_UDEF10;
                    dict.Add("ChildModuleName", ChildModuleName);
                }
            }

            var MainName   = model.RefDepend_ObjectName;
            var FormName   = model.RefDepend_ShowName;
            var ModuleName = model.RefDepend_UDEF1;

            var AuditName = model.RefDepend_UDEF2;

            IsHideMaterialSearch = model.RefDepend_UDEF18;

            var StorageCheck = "";

            if (!string.IsNullOrEmpty(model.RefDepend_UDEF14))
            {
                StorageCheck = "Check";
            }


            if (string.IsNullOrEmpty(AuditName))
            {
                AuditName = "";
            }

            string backUrl = model.RefDepend_UDEF9;

            if (string.IsNullOrEmpty(backUrl))
            {
                backUrl = "";
            }
            dict.Add("BackUrl", backUrl);

            var ShowMain  = model.RefDepend_ShowMain;
            var ShowOther = model.RefDepend_ShowOther;

            dict.Add("MainName", MainName);
            dict.Add("FormName", FormName);
            dict.Add("ModuleName", ModuleName);
            dict.Add("AuditName", AuditName);
            dict.Add("Main", ShowMain);
            dict.Add("Other", ShowOther);
            dict.Add("StorageCheck", StorageCheck);         //库存检查
            dict.Add("MRTOPO", MRTOPO);                     //汇总生成订单
            dict.Add("IsHideMaterialSearch", IsHideMaterialSearch);
            dict.Add("TOPOModule", model.RefDepend_UDEF20); //采购汇总生成订单模块

            if (!string.IsNullOrEmpty(model.RefDepend_UDEF3))
            {
                dict.Add("HouseType", model.RefDepend_UDEF3);//获取仓库类型
            }
            dict.Add("view", view);

            //if (!string.IsNullOrEmpty(itype))
            //{
            //    //设置单据表单,模块,审核
            //    var model = Bll_Comm.CommRefDepend(itype);


            //}

            return(dict);
        }