Esempio n. 1
0
        public static List <LocationEntity> GetByUserID(string userid, string programcode)
        {
            List <ProductLineEntity> _plines = ProductLineFactory.GetByUserID(userid, programcode);
            List <string>            _ps     = (from s in _plines select s.RMES_ID).ToList <string>();

            return(new LocationDal().FindBySql <LocationEntity>("where pline_code in (@plines)", new { plines = _ps }));
        }
Esempio n. 2
0
        public static List <PlanEntity> GetAllByWorkShop(string workShopID)
        {
            List <ProductLineEntity> pls = ProductLineFactory.GetByWorkShopID(workShopID);

            string[] _p = new string[pls.Count];
            for (int i = 0; i < pls.Count; i++)
            {
                _p[i] = pls[i].RMES_ID;
            }
            return(new PlanDal().GetAllByProductLines(_p));
        }
Esempio n. 3
0
        public static List <TeamEntity> GetByWorkShopID(string workshopRmesID)
        {
            List <ProductLineEntity> plines   = ProductLineFactory.GetByWorkShopID(workshopRmesID);
            List <TeamEntity>        allteams = new List <TeamEntity>();

            foreach (ProductLineEntity pe in plines)
            {
                List <TeamEntity> _temp = GetByPlineCode(pe.RMES_ID);
                if (_temp != null && _temp.Count > 0)
                {
                    allteams.AddRange(_temp);
                }
            }
            return(allteams);
        }
Esempio n. 4
0
        public static List <PlanTempEntity> GetCurrentUnfinishedPlanByUserID(string userID, string programcode)
        {
            UserEntity user = UserFactory.GetByID(userID);
            List <ProductLineEntity> plines = ProductLineFactory.GetByUserID(userID, programcode);

            if (plines == null || plines.Count < 1)
            {
                return(null);
            }
            else
            {
                List <string> plineCodes = new List <string>();
                foreach (var p in plines)
                {
                    plineCodes.Add(p.RMES_ID);
                }
                return(new PlanTempDal().GetCurrentUnfinishedPlanByPlines(plineCodes.ToArray()));
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 用于工作站客户端登录,系统登录判断,根据登录时候的信息,判断登录是否有效,请根据实际需要修改登录逻辑
        /// </summary>
        /// <param name="ucode">用户代码</param>
        /// <param name="upass">用户密码(初期不加密)</param>
        /// <param name="companycode">公司代码</param>
        /// <param name="plinecode">生产线代码</param>
        /// <param name="stationcode">站点代码</param>
        /// <param name="shiftcode">班次代码</param>
        /// <param name="groupcode">班组代码</param>
        /// <param name="othercode">备用代码</param>
        /// <param name="ip">客户端IP</param>
        /// <param name="workdate">登录时间</param>
        /// <returns>返回登录是否成功,true为成功,false不成功</returns>
        public static bool GetByFormAuth(string ucode, string upass, string companycode, string workshopcode, string plinecode, string stationcode,
                                         string shiftcode, string teamcode, string othercode, string ip, string workdate)
        {
            if (string.IsNullOrWhiteSpace(ucode))
            {
                Rmes.Public.ErrorHandle.EH.LASTMSG = "用户名不能为空";
                return(false);
            }
            //if (string.IsNullOrWhiteSpace(upass))
            //{
            //    Rmes.Public.ErrorHandle.EH.LASTMSG = "密码不能为空";
            //    return false;
            //}
            if (string.IsNullOrWhiteSpace(companycode))
            {
                Rmes.Public.ErrorHandle.EH.LASTMSG = "公司不能为空";
                return(false);
            }
            //if (string.IsNullOrWhiteSpace(workshopcode))
            //{
            //    Rmes.Public.ErrorHandle.EH.LASTMSG = "工厂不能为空";
            //    return false;
            //}
            if (string.IsNullOrWhiteSpace(plinecode))
            {
                Rmes.Public.ErrorHandle.EH.LASTMSG = "生产线不能为空";
                return(false);
            }
            if (string.IsNullOrWhiteSpace(stationcode))
            {
                Rmes.Public.ErrorHandle.EH.LASTMSG = "站点不能为空";
                return(false);
            }
            if (string.IsNullOrWhiteSpace(shiftcode))
            {
                Rmes.Public.ErrorHandle.EH.LASTMSG = "班次不能为空";
                return(false);
            }
            if (string.IsNullOrWhiteSpace(teamcode))
            {
                Rmes.Public.ErrorHandle.EH.LASTMSG = "班组不能为空";
                return(false);
            }

            //List<UserEntity> users = new UserDal().FindByAuth(ucode, upass);
            List <UserEntity> users = new UserDal().FindByAuthUser(ucode);

            if (users.Count == 1)
            {
                LoginInfo.UserInfo        = users.First();
                LoginInfo.CompanyInfo     = CompanyFactory.GetByKey(companycode);
                LoginInfo.WorkShopInfo    = null;
                LoginInfo.ProductLineInfo = ProductLineFactory.GetByKey(plinecode);
                LoginInfo.StationInfo     = StationFactory.GetBySTATIONCODE(stationcode);
                LoginInfo.TeamInfo        = TeamFactory.GetByTeamCode(teamcode);
                LoginInfo.ShiftInfo       = ShiftFactory.GetBySCode(shiftcode);


                List <RELStationEntity> stat1 = ProductLineFactory.GetByUS(LoginInfo.StationInfo.RMES_ID);
                if (stat1.Count > 0)
                {
                    List <RELStationEntity> stat2 = ProductLineFactory.GetByUS1(LoginInfo.UserInfo.USER_ID, LoginInfo.StationInfo.RMES_ID);
                    if (stat2.Count == 0)
                    {
                        Rmes.Public.ErrorHandle.EH.LASTMSG = "您没有此站点的权限,请联系管理员!";
                        return(false);
                    }
                }

                //List<ProductLineEntity> plines = ProductLineFactory.GetByUserIDCS(LoginInfo.UserInfo.USER_ID,LoginInfo.StationInfo.RMES_ID);
                //ProductLineEntity p = LoginInfo.ProductLineInfo;
                //if (!plines.Contains(p))
                //{
                //    Rmes.Public.ErrorHandle.EH.LASTMSG = "您没有此产线的权限,请联系管理员!";
                //    return false;
                //}
                //if (!LoginInfo.TeamInfo.PLINE_CODE.Equals(LoginInfo.ProductLineInfo.PLINE_CODE))
                //{
                //    Rmes.Public.ErrorHandle.EH.LASTMSG = "班组和生产线不对应。";
                //    return false;
                //}
                //if (!LoginInfo.ShiftInfo.PLINE_CODE.Equals(LoginInfo.ProductLineInfo.PLINE_CODE))
                //{
                //    Rmes.Public.ErrorHandle.EH.LASTMSG = "班次和生产线不对应。";
                //    return false;
                //}
                if (!LoginInfo.StationInfo.PLINE_CODE.Equals(LoginInfo.ProductLineInfo.RMES_ID))
                {
                    Rmes.Public.ErrorHandle.EH.LASTMSG = "所选站点和生产线不对应。";
                    return(false);
                }
                if (DB.ReadConfigServer("LOGIN_CLIENT_VERIFY_TEAM_USER").Equals("TRUE"))
                {
                    var _s = (from t in TeamFactory.GetByUserID(LoginInfo.UserInfo.USER_ID)
                              select t.RMES_ID).ToList <string>();
                    if (!_s.Contains(LoginInfo.TeamInfo.RMES_ID))
                    {
                        Rmes.Public.ErrorHandle.EH.LASTMSG = "登录身份与班组不匹配。";
                        return(false);
                    }
                }

                LoginInfo.IP = ip;

                //LoginInfo.WorkDate = Convert.ToDateTime(workdate).ToString("yyyy-MM-dd");
                LoginInfo.WorkDate = ProductLineFactory.GetWorkdate(LoginInfo.CompanyInfo.COMPANY_CODE, LoginInfo.ProductLineInfo.PLINE_CODE, LoginInfo.ShiftInfo.SHIFT_CODE);
                return(true);
            }
            else
            {
                Rmes.Public.ErrorHandle.EH.LASTMSG = "您输入的用户名/密码不正确。";
            }
            return(false);
        }