Example #1
0
        // GET: Manage
        public ActionResult GetModel(bool isTrue = false, bool isadd = false)
        {
            T_System        model   = new T_System();
            List <T_System> tsystem = funcsystem.GetModel();

            if (tsystem != null && tsystem.Count > 0)
            {
                model = tsystem[0];
            }
            string isSuccess = "";

            if (isadd)
            {
                if (isTrue)
                {
                    isSuccess = "true";
                }
                else
                {
                    isSuccess = "false";
                }
            }
            ViewData["isSuccess"] = isSuccess;
            return(View(model));
        }
Example #2
0
        public static T_System getSystem()
        {
            T_System_Func   funcsystem = new T_System_Func();
            T_System        model      = new T_System();
            List <T_System> tsystem    = funcsystem.GetModel();

            if (tsystem != null && tsystem.Count > 0)
            {
                model = tsystem[0];
            }
            return(model);
        }
Example #3
0
        public string UserLoginADF(string UserJson)
        {
            BaseMessage_Model <UserInfo> messageModel = new BaseMessage_Model <UserInfo>();

            try
            {
                UserInfo model;
                User_DB  _db = new User_DB();
                DateTime CurrentTime;

                LogNet.LogInfo("UserLoginADF---" + UserJson);
                UserInfo user = BILBasic.JSONUtil.JSONHelper.JsonToObject <UserInfo>(UserJson);
                //UserInfo user = JsonConvert.DeserializeObject<UserInfo>(UserJson);

                model = _db.GetModelBySql(user);

                if (model == null)
                {
                    int iSucc = _db.GetScalarBySql(user);
                    if (iSucc <= 0)
                    {
                        messageModel.Message      = "该用户不存在,请检查大小写是否输入正确!";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                    else
                    {
                        messageModel.Message      = "密码输入错误,忘记密码请联系管理员重置!";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                }

                CurrentTime = model.CurrentTime;

                if (user.WarehouseID != -100)
                {
                    if (!model.WarehouseCode.Contains(user.WarehouseID.ToString()))
                    {
                        messageModel.Message      = "登录账户与所选仓库不一致!";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                }


                if (model.UserStatus == 2)
                {
                    messageModel.Message      = string.Format("用户【{0}】已停用", model.UserName);
                    messageModel.HeaderStatus = "E";
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                }

                if (model.IsDel == 2)
                {
                    messageModel.Message      = string.Format("用户【{0}】已删除", model.UserName);
                    messageModel.HeaderStatus = "E";
                    return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                }

                model.WarehouseID = user.WarehouseID;
                user = model;

                T_UserGroup_Func       ugf      = new T_UserGroup_Func();
                List <T_UserGroupInfo> lstGroup = new List <T_UserGroupInfo>();

                if (ugf.GetModelListBySql(user, ref lstGroup))
                {
                    user.lstUserGroup = lstGroup;
                }

                //暂时屏蔽
                T_MENU_Func       tmfun   = new T_MENU_Func();
                List <T_MenuInfo> lstMenu = new List <T_MenuInfo>();

                if (tmfun.GetModelListBySql(user, ref lstMenu, false))
                {
                    user.lstMenu = lstMenu.Where(t => t.MenuType == 4).ToList();
                }

                //根据用户配置的仓库ID,获取对应的收货,发货库位
                T_Area_Func       tafun   = new T_Area_Func();
                List <T_AreaInfo> lstArea = new List <T_AreaInfo>();

                if (tafun.GetModelListBySql(user.WarehouseID, ref lstArea))
                {
                    T_AreaInfo areaInfo = new T_AreaInfo();
                    //查找收货待检库位
                    areaInfo = lstArea.Find(t => t.AreaType == 2);
                    if (areaInfo != null)
                    {
                        user.ReceiveHouseID       = areaInfo.HouseID;
                        user.ReceiveAreaID        = areaInfo.ID;
                        user.ReceiveAreaNo        = areaInfo.AreaNo;
                        user.ReceiveWareHouseNo   = areaInfo.WarehouseNo;
                        user.ReceiveHouseNo       = areaInfo.HouseNo;
                        user.ReceiveWareHouseName = areaInfo.WarehouseName;
                        user.QuanUserNo           = areaInfo.QuanUserNo;
                        user.QuanUserName         = areaInfo.QuanUserName;
                        //user.lstQuanUser = _db.GetQuanUser(user.QuanUserNo);
                    }

                    //查找拣货临时库位
                    areaInfo = lstArea.Find(t => t.AreaType == 3);
                    if (areaInfo != null)
                    {
                        user.PickHouseID       = areaInfo.HouseID;
                        user.PickAreaID        = areaInfo.ID;
                        user.PickWareHouseID   = areaInfo.WarehouseID;
                        user.PickAreaNo        = areaInfo.AreaNo;
                        user.PickWareHouseNo   = areaInfo.WarehouseNo;
                        user.PickHouseNo       = areaInfo.HouseNo;
                        user.PickWareHouseName = areaInfo.WarehouseName;
                    }

                    areaInfo = lstArea.Find(t => t.AreaType == 4);
                    if (areaInfo != null)
                    {
                        user.ToSampWareHouseNo = areaInfo.WarehouseNo;
                        user.ToSampAreaNo      = areaInfo.AreaNo;
                    }

                    //完工入库 入库到默认库位
                    T_Area_DB  TAreaDB = new T_Area_DB();
                    T_AreaInfo area    = TAreaDB.GetAreaModelForPro(user.ReceiveWareHouseNo);
                    if (area != null && area.ID != 0)
                    {
                        user.ProAreaID        = area.ID;
                        user.ProAreaNo        = area.AreaNo;
                        user.ProHouseID       = area.HouseID;
                        user.ProHouseNo       = area.HouseNo;
                        user.ProWareHouseNo   = area.WarehouseNo;
                        user.ProWareHouseName = area.WarehouseName;
                    }
                    else
                    {
                        messageModel.Message      = "登陆仓库对应的完工入库默认货位没有设置,请先去PC端设置";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }

                    T_AreaInfo Fixarea = TAreaDB.GetAreaModelForFix(user.ReceiveWareHouseNo);
                    if (Fixarea != null && Fixarea.ID != 0)
                    {
                        user.FixAreaID      = Fixarea.ID;
                        user.FixAreaNo      = Fixarea.AreaNo;
                        user.FixHouseID     = Fixarea.HouseID;
                        user.FixHouseNo     = Fixarea.HouseNo;
                        user.FixWareHouseNo = Fixarea.WarehouseNo;
                        user.FixWareHouseid = Fixarea.WarehouseID;
                    }
                    else
                    {
                        messageModel.Message      = "登陆仓库对应的维修货位没有设置,请先去PC端设置";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }


                    T_AreaInfo ZCarea = TAreaDB.GetAreaModelForZC(user.ReceiveWareHouseNo);
                    if (ZCarea != null && ZCarea.ID != 0)
                    {
                        user.ZCAreaID       = ZCarea.ID;
                        user.ZCAreaNo       = ZCarea.AreaNo;
                        user.ZCHouseID      = ZCarea.HouseID;
                        user.ZCHouseNo      = ZCarea.HouseNo;
                        user.ZCWareHouseNo  = ZCarea.WarehouseNo;
                        user.FixWareHouseid = ZCarea.WarehouseID;
                    }
                    else
                    {
                        messageModel.Message      = "登陆仓库对应的原始货位没有设置,请先去PC端设置";
                        messageModel.HeaderStatus = "E";
                        return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
                    }
                }

                //T_WareHouse_Func twfun = new T_WareHouse_Func();
                //List<T_WareHouseInfo> lstWarehouse = new List<T_WareHouseInfo>();
                //if (twfun.GetModelListBySql(user, ref lstWarehouse))
                //{
                //    user.lstWarehouse = lstWarehouse;
                //}
                //全局配置表
                T_System_Func funs   = new T_System_Func();
                T_System      System = funs.GetModel()[0];
                user.System = System;

                messageModel.Message      = "登录成功!";
                messageModel.HeaderStatus = "S";
                messageModel.ModelJson    = user;
                return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));


                //return JsonConvert.SerializeObject(messageModel);
            }
            catch (Exception ex)
            {
                messageModel.Message      = ex.Message;
                messageModel.HeaderStatus = "E";
                return(BILBasic.JSONUtil.JSONHelper.ObjectToJson <BaseMessage_Model <UserInfo> >(messageModel));
            }
        }