Exemple #1
0
        public string GetLog()
        {
            //获取日志,返回数据
            Loglist list = new Loglist();

            return(PMPublicFuncs.DatatableToJson(list.Getlist()));
        }
        public string GetWorkPlanBars(string plan, string ViewName)
        {
            GetWorkplanBars PlanInfo = new GetWorkplanBars();
            DataTable       table    = PlanInfo.GetPlanBars(plan, ViewName);

            return(PMPublicFuncs.DatatableToJson(table));
        }
        public string StatisticalData()
        {
            //此方法是初始化图表中的x轴数据返回的是数组类型的数据
            OrderForm order = new OrderForm();

            return(PMPublicFuncs.ListToJson(order.LiDemandDay()));
        }
        /// <summary>
        /// 获取设备利用率
        /// </summary>
        /// <param name="resName">线体名称</param>
        /// <returns>Json</returns>
        public string GetResUsuage(string resName)
        {
            DataTable data = ResourceModels.GetResUsuage(resName);

            //useDate,dayAllWorkHour,dayPlanWorkHour,dayResRatio
            data.Columns["useDate"].ColumnName         = "日期";
            data.Columns["dayAllWorkHour"].ColumnName  = "当日总工时";
            data.Columns["dayPlanWorkHour"].ColumnName = "计划工时";
            data.Columns["dayResRatio"].ColumnName     = "稼动率";
            return(PMPublicFuncs.DatatableToJson(data));
        }
Exemple #5
0
        public int ForceLogout(string empID)
        {
            SqlCommand cmd = PMCommand.CtrlCmd();

            PMUser.UserName = GetempName(empID);
            cmd.CommandText = "delete from wapUserstate where empID = '" + empID + "'";
            int state = cmd.ExecuteNonQuery();

            PMPublicFuncs.WriteLogs(empID, PMUser.UserName, PMUser.UserIpAdress, "强制登出", DateTime.Now, "用户选择强制登出。", PMUser.UserWeb);
            return(state);
        }
        /// <summary>
        /// 从静态模型中获取辅助资源数据
        /// </summary>
        /// <returns>Json</returns>
        public string GetScndUsuageData()
        {
            DataTable data = ScndUsuageModels.GetScndUsuageData();

            //scndResName,scndResType,allQty,useQty,startDateTime,endDateTime
            data.Columns["scndResName"].ColumnName   = "辅助资源名";
            data.Columns["scndResType"].ColumnName   = "辅助资源类型";
            data.Columns["allQty"].ColumnName        = "可用总数";
            data.Columns["useQty"].ColumnName        = "使用数量";
            data.Columns["startDateTime"].ColumnName = "使用开始时间";
            data.Columns["endDateTime"].ColumnName   = "使用结束时间";
            return(PMPublicFuncs.DatatableToJson(data));
        }
        public string GetMaterials(int choose)
        {
            DataTable data = MaterialsModels.MaterialTable(choose);

            data.Columns["useDate"].ColumnName     = "使用日期";
            data.Columns["csmItemCode"].ColumnName = "物料编码";
            data.Columns["useQty"].ColumnName      = "使用数量";
            data.Columns["itemUnit"].ColumnName    = "单位";
            data.Columns["itemDesp"].ColumnName    = "物料描述";
            data.Columns["itemAttr1"].ColumnName   = "备注";
            data.Columns["buyDate"].ColumnName     = "物料需求日";
            if (choose == 0)
            {
                data.Columns["sysType"].ColumnName = "类型";
            }
            return(PMPublicFuncs.DatatableToJson(data));
        }
        public static string GetPmViewGroupTable(string value)
        {
            DataTable  table = new DataTable();
            SqlCommand cmd   = PMCommand.SchCmd();

            cmd.CommandText = "SELECT resName  FROM View_PmViewGroup where sysID ='" + PMStaticModels.UserModels.PMUser.UserSysID + "' and ViewName  = '" + value + "'";
            SqlDataAdapter da = new SqlDataAdapter(cmd);

            da.Fill(table);
            da.Dispose();
            cmd.Connection.Dispose();
            if (table.Rows.Count == 0)
            {
                return("视图中没有设备");
            }
            else
            {
                return(PMPublicFuncs.DatatableToJson(table));
            }
        }
        public string GetOpName()
        {
            DataTable temptable = StatisticalModels.GetProductOutPut(0, string.Empty);
            //获取工序名称

            List <string> op = new List <string>();

            foreach (DataRow item in temptable.Rows)
            {
                if (!op.Contains(item["opName"].ToString()))
                {
                    op.Add(item["opName"].ToString());
                }
                else
                {
                    continue;
                }
            }
            StatisticalModels.OpName = PMPublicFuncs.ListToJson(op);
            return(StatisticalModels.OpName);
        }
        public string ProductOutput(int isfinal, string opname)
        {
            //Finished参数判断是否是成品
            //获取每日产出数据
            DataTable temptable = StatisticalModels.GetProductOutPut(isfinal, opname);

            //获取工序名称
            //汉化
            temptable.Columns["itemname"].ColumnName   = "产品名称";
            temptable.Columns["outputqty"].ColumnName  = "产出数量";
            temptable.Columns["exportdate"].ColumnName = "产出日期";
            if (isfinal == 0)
            {
                temptable.Columns["opName"].ColumnName = "工序名称";
            }
            for (int i = 0; i < Convert.ToInt32(PMAppSettings.ItemAttrCount); i++)
            {
                string temp = "itemattr" + (i + 1);
                string item = "ItemAttr" + (i + 1);
                temptable.Columns[temp].ColumnName = PMAppSettings.ItemGroup.Rows[0][item].ToString();
            }
            temptable.Columns["desp"].ColumnName = "描述";
            return(PMPublicFuncs.DatatableToJson(temptable));
        }
        /// <summary>
        /// 获取导航栏的数据
        /// </summary>
        /// <returns></returns>
        public static string StrNavName()
        {
            List <string> groupList = new List <string>();
            SqlCommand    cmd       = PMCommand.SchCmd();

            cmd.CommandText = "SELECT distinct viewname FROM View_PmViewGroup where SYSID ='" + PMStaticModels.UserModels.PMUser.UserSysID + "' and vglobal = 'export'";
            SqlDataReader rd = cmd.ExecuteReader();

            while (rd.Read())
            {
                groupList.Add(rd[0].ToString());
            }
            rd.Close();
            if (groupList.Count == 0)
            {
                cmd.CommandText = "SELECT distinct viewname FROM View_PmViewGroup where SYSID ='" + PMStaticModels.UserModels.PMUser.UserSysID + "'";
                rd = cmd.ExecuteReader();
                while (rd.Read())
                {
                    groupList.Add(rd[0].ToString());
                }
                rd.Close();
                if (groupList.Count == 0)
                {
                    return("没有为设备创建视图");
                }
                else
                {
                    return(PMPublicFuncs.ListToJson(groupList));
                }
            }
            else
            {
                return(PMPublicFuncs.ListToJson(groupList));
            }
        }
Exemple #12
0
        public ActionResult <LoginMessage> Login(string empID, string pwd, string adminstate)
        {
            if (login == null)
            {
                login = new MLogin();
            }
            MD5 md5 = MD5.Create();

            //PMStaticModels.UserModels.PMUser.UserSysID
            pwd += empID;
            string userPass = "";

            byte[] s = md5.ComputeHash(Encoding.UTF8.GetBytes(pwd.Trim()));
            for (int i = 0; i < s.Length; i++)
            {
                // 将得到的字符串使用十六进制类型格式。格式后的字符是小写的字母,如果使用大写(X)则格式后的字符是大写字符
                userPass += s[i].ToString("X");
            }
            User user = new User();

            user.EmpID        = empID;
            user.UserPass     = userPass;
            user.UserIpAdress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
            user.UserWeb      = Request.Headers["User-Agent"];

            PMUser.EmpID        = empID;
            PMUser.UserPass     = userPass;
            PMUser.UserIpAdress = Request.HttpContext.Connection.RemoteIpAddress.ToString();
            PMUser.UserWeb      = Request.Headers["User-Agent"];
            LoginMessage userMsg = login.LoginMessage();

            if (userMsg.LoginState == "1")
            {
                List <string> userGroup = login.GetuserGroup(empID);
                if (userGroup.Count < 1)
                {
                    userMsg.LoginState = "0";
                    userMsg.Message    = "该员工没有分配用户组,请联系管理员分配。";
                }
                else
                {
                    user.UserGuid = userMsg.UserGuid;
                    user.UserName = login.GetempName(empID);

                    PMUser.UserGuid = userMsg.UserGuid;
                    PMUser.UserName = login.GetempName(empID);
                    Response.Cookies.Append("EmpID", user.EmpID);
                    //Response.Cookies.Append("EmpID", PMUser.EmpID);
                    Response.Cookies.Append("UserGuid", PMUser.UserGuid);
                }

                if (adminstate == "1")
                {
                    if (userGroup.Contains("ADMIN") == false)
                    {
                        userMsg.LoginState = "0";
                        userMsg.Message    = "请不要使用非管理员账户越权操作!";
                        PMPublicFuncs.WriteLogs(empID, login.GetempName(empID), PMUser.UserIpAdress, "越权登陆", DateTime.Now, "用户越权使用管理员登陆。", PMUser.UserWeb);
                    }
                    else
                    {
                        string md5Guid = Guid.NewGuid().ToString();
                        Response.Cookies.Append("MD5", PMPublicFuncs.GetMd5("ADMIN" + md5Guid));
                        //Response.Cookies.Append("MD5", PMPublicFuncs.GetMd5("ADMIN" + md5Guid), new CookieOptions() { IsEssential = true });
                        PMPublicFuncs.WriteLogs(empID, login.GetempName(empID), PMUser.UserIpAdress, "管理员登录", DateTime.Now, "管理员登陆成功。", PMUser.UserWeb);
                        //管理员登录成功
                    }
                }
                else
                {
                    //判断该用户具有的功能模块权限,如果只有一个权限,直接跳入页面,如果有多个权限,给出选择
                    if (PMUser.FunctionList == null)
                    {
                        PMUser.FunctionList = new List <string>();
                    }
                    PMUser.FunctionList.Clear();
                    foreach (string item in userGroup)
                    {
                        if (item == "ADMIN")
                        {
                            continue;
                        }
                        else if (item == "CFM")
                        {
                            PMUser.FunctionList.Add("systemsetting");
                        }
                        else if (item == "REP")
                        {
                            PMUser.FunctionList.Add("reportsystem");
                        }
                        else if (item == "VIEW")
                        {
                            PMUser.FunctionList.Add("datacenter");
                        }
                        else if (item == "BOARD")
                        {
                            PMUser.FunctionList.Add("planboard");
                        }
                    }
                    PMUser.UserMessage.Add(user);
                    //登录成功
                    PMPublicFuncs.WriteLogs(empID, login.GetempName(empID), PMUser.UserIpAdress, "用户登陆", DateTime.Now, "用户登陆成功。", PMUser.UserWeb);
                }
            }
            return(userMsg);
        }
 /// <summary>
 /// 获取设备名称列表
 /// </summary>
 /// <param name="resGroup">设备组名称</param>
 /// <returns>Json</returns>
 public string GetResNameList(string resGroup)
 {
     return(PMPublicFuncs.DatatableToJson(ResourceModels.GetResList(resGroup)));
 }
 /// <summary>
 /// 获取设备组
 /// </summary>
 /// <returns>Json</returns>
 public string GetResGroup()
 {
     return(PMPublicFuncs.DatatableToJson(ResourceModels.GetResGroup()));
 }
Exemple #15
0
 public string FunctionResult()
 {
     return(PMPublicFuncs.ListToJson(PMUser.FunctionList));
 }