Beispiel #1
0
        public async Task <TData <string> > SaveForm(WishUserEntity entity)
        {
            TData <string> obj = new TData <string>();

            obj.SetDefault();
            if (entity.MobilePhone.IsEmpty() || entity.RealName.IsEmpty())
            {
                obj.Message = "手机号和姓名不能为空";
                return(obj);
            }

            WishUserEntity user = await wishUserService.GetEntityByPhone(entity.MobilePhone);

            if (user != null && user.Id > 0)
            {
                obj.Message = "您已经登记,不需要重复录入";
            }
            else
            {
                await wishUserService.SaveForm(entity);

                obj.Data = entity.Id.ParseToString();
                obj.Tag  = 1;
                obj.Refresh();
            }

            return(obj);
        }
Beispiel #2
0
        public async Task <TData <string> > BindTer([FromBody] TerBindParam entity)
        {
            OperatorInfo user = await Web.Code.Operator.Instance.Current(entity.ApiToken);

            TData <string> obj = new TData <string>();

            obj.SetDefault();
            try
            {
                if (user != null)
                {
                    obj = await terInforBLL.BindUser(user.UserId.ToString(), entity.Number, entity.FistLongitude, entity.FistLatitude, entity.Address);

                    //检测是否串货
                    obj.Refresh();
                }
                else
                {
                    obj.Message = "当前登录信息失效,请重新登录";
                }
            }
            catch (Exception ex)
            {
                obj.Message = ex.ToString();
            }

            return(obj);
        }
Beispiel #3
0
        /// <summary>
        /// 发送短信验证码
        /// </summary>
        /// <param name="phone">手机号</param>
        public async Task <TData <string> > SentSms(string phone)
        {
            TData <string> obj = new TData <string>();

            obj.SetDefault();
            #region 组装参数
            string PostUrl    = "http://sms.253.com/msg/send";
            string un         = "N3196661";
            string pw         = "1yj0IsLdQD5105";
            string code       = CoomHelper.CreateRandomWordOrNum(6, "0");
            string content    = "【普沃森】短信验证码是:" + code + ",2分钟内有效。全球清水净化洗涤开创者!";
            string postStrTpl = "un={0}&pw={1}&phone={2}&msg={3}&rd=1";


            UTF8Encoding encoding = new UTF8Encoding();
            byte[]       postData = encoding.GetBytes(string.Format(postStrTpl, un, pw, phone, content));

            HttpWebRequest myRequest = HttpWebRequest.Create(PostUrl) as HttpWebRequest;
            myRequest.KeepAlive     = false;
            myRequest.Method        = "POST";
            myRequest.ContentType   = "application/x-www-form-urlencoded";
            myRequest.ContentLength = postData.Length;
            myRequest.Timeout       = 5000;
            #endregion

            using (Stream newStream = myRequest.GetRequestStream())
            {
                await newStream.WriteAsync(postData, 0, postData.Length);
            }
            using (HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse())
            {
                if (myResponse.StatusCode == HttpStatusCode.OK)
                {
                    StreamReader reader  = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
                    string       res_msg = await reader.ReadToEndAsync();

                    LogHelper.Info("【SentSms】:" + res_msg);
                    bool isok = cache.SaveSmsCode(phone, code);
                    if (isok)
                    {
                        obj.Tag     = 1;
                        obj.Message = "发送成功";
                        obj.Refresh();
                    }
                    else
                    {
                        obj.Message = "发送失败";
                    }
                }
            }
            return(obj);
        }
Beispiel #4
0
        public async Task <TData <List <OrderSupplierEntity> > > GetList(OrderSupplierListParam param)
        {
            TData <List <OrderSupplierEntity> > obj  = new TData <List <OrderSupplierEntity> >();
            List <OrderSupplierEntity>          list = await orderSupplierService.GetList(param);

            obj.SetDefault();
            if (list.Count > 0)
            {
                obj.Data  = list;
                obj.Total = obj.Data.Count;
                obj.Tag   = 1;
                obj.Refresh();
            }
            return(obj);
        }
Beispiel #5
0
        /// <summary>
        /// 校验短信验证码
        /// </summary>
        /// <param name="phone">手机号</param>
        /// <param name="code">短信验证码</param>
        /// <returns></returns>
        public TData <string> CheckSms(string phone, string code)
        {
            TData <string> obj = new TData <string>();

            obj.SetDefault();
            string msg  = "";
            bool   isok = cache.CheckSmsCode(phone, code, ref msg);

            obj.Message = msg;
            if (isok)
            {
                obj.Tag = 1;
                obj.Refresh();
            }
            return(obj);
        }
Beispiel #6
0
        /// <summary>
        /// 获取角色代码获取用户列表
        /// </summary>
        /// <param name="roleCode">角色代码</param>
        /// <returns></returns>
        public async Task <TData <List <UserEntity> > > GetListByRoleCode(string roleCode)
        {
            TData <List <UserEntity> > obj = new TData <List <UserEntity> >();

            obj.SetDefault();
            List <UserEntity> list = await userService.GetListByRoleCode(roleCode);

            if (list.Count > 0)
            {
                obj.Data = list;
                obj.Tag  = 1;
                obj.Refresh();
            }
            else
            {
                obj.Message = "没有配置数据";
            }
            return(obj);
        }
        public async Task <TData <List <OrderMoneyReceiptEntity> > > GetPageListJson([FromBody] WebApi_OrderMoneyReceiptListParam listParam)
        {
            TData <List <OrderMoneyReceiptEntity> > obj = new TData <List <OrderMoneyReceiptEntity> >();

            obj.SetDefault();
            try
            {
                LogHelper.Info("【GetPageListJson】 listParam:" + JsonHelper.SerializeObject(listParam));
                OperatorInfo opuser = await Web.Code.Operator.Instance.Current(listParam.ApiToken);

                obj = await new OrderMoneyReceiptBLL().GetPageList(listParam.ListParam, listParam.Pagination, opuser);
                obj.Refresh();
            }
            catch (Exception ex)
            {
                LogHelper.Info("【GetPageListJson】 ex:" + ex.ToString());
            }
            return(obj);
        }
Beispiel #8
0
        /// <summary>
        /// 查询设备最编号
        /// </summary>
        /// <param name="id">设备id</param>
        /// <param name="busyLink">联系方式</param>
        /// <returns></returns>
        public async Task <TData <string> > GetMaxNumber()
        {
            TData <string> obj = new TData <string>();

            obj.SetDefault();
            TerInforEntity entity = await terInforService.GetMaxNumberEntity();

            if (entity != null)
            {
                obj.Data = entity.TerNumber;
            }
            else
            {
                obj.Data = "0";
            }
            obj.Tag = 1;
            obj.Refresh();
            return(obj);
        }
Beispiel #9
0
        public async Task <TData <List <OrderMaterielEntity> > > GetList(OrderMaterielListParam param)
        {
            TData <List <OrderMaterielEntity> > obj = new TData <List <OrderMaterielEntity> >();

            obj.SetDefault();
            List <OrderMaterielEntity> list = await orderMaterielService.GetList(param);

            if (list.Count > 0)
            {
                obj.Data  = list;
                obj.Total = obj.Data.Count;
                obj.Tag   = 1;
                obj.Refresh();
            }
            else
            {
                obj.Message = "没有数据";
            }
            return(obj);
        }
        public async Task <TData <string> > SaveForm([FromBody] OrderMoneyReceiptParam entity)
        {
            TData <string> obj = new TData <string>();

            obj.SetDefault();
            try
            {
                OperatorInfo opuser = await Web.Code.Operator.Instance.Current(entity.ApiToken);

                obj = await new OrderMoneyReceiptBLL().SaveForm(entity, opuser);
                //检测是否串货
                obj.Refresh();
            }
            catch (Exception ex)
            {
                obj.Message = ex.ToString();
            }

            return(obj);
        }
        public async Task <TData <string> > SaveForm([FromBody] OrderTerInputParam entity)
        {
            TData <string> obj = new TData <string>();

            obj.SetDefault();
            try
            {
                LogHelper.Info("SaveForm entity:" + JsonHelper.SerializeObject(entity));
                OperatorInfo opuser = await Web.Code.Operator.Instance.Current(entity.ApiToken);

                obj = await new OrderTerInputBLL().SaveForm(entity, opuser);
                //检测是否串货
                obj.Refresh();
            }
            catch (Exception ex)
            {
                obj.Message = ex.ToString();
            }

            return(obj);
        }
Beispiel #12
0
        /// <summary>
        /// 批量新增设备
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task <TData <string> > SaveForm(TerInforBateAddParam model)
        {
            TData <string> obj = new TData <string>();

            obj.SetDefault();
            List <TerInforBateAdd> models = new List <TerInforBateAdd>();
            int number = model.StartNumber;

            for (int i = 0; i < model.Count; i++)
            {
                TerInforBateAdd ter = new TerInforBateAdd();
                {
                    await ter.Create();
                }
                ter.TerNumber = (number) + "";
                ter.TerName   = model.TerName;
                ter.TerPartId = model.TerPartId;
                models.Add(ter);
            }
            List <string>         numbers = models.Select(p => p.TerNumber).ToList();
            List <TerInforEntity> list    = await terInforService.GetListByNumber(numbers);

            if (list.Count > 0)
            {
                string nubmess = string.Join(",", list.Select(p => p.TerNumber).ToList());
                obj.Message = string.Format("{0}编号已经存在", nubmess);
            }
            else
            {
                int count = await terInforService.SaveForm(models);

                if (count > 0)
                {
                    obj.Tag = 1;
                    obj.Refresh();
                }
            }

            return(obj);
        }
Beispiel #13
0
        public async Task <TData <string> > SaveForm(CustWorkSheetEntity entity, OperatorInfo opuser)
        {
            TData <string> obj = new TData <string>();

            obj.SetDefault();
            var result = await CheckWorkFLow(entity, opuser);

            LogHelper.Info("【SaveForm】result:" + JsonHelper.SerializeObject(result));
            if (result.IsSucess)
            {
                await custWorkSheetService.SaveForm(entity);

                obj.Data = entity.Id.ParseToString();
                obj.Tag  = 1;
                obj.Refresh();
            }
            else
            {
                obj.Message = result.Msg;
                obj.Tag     = 0;
            }
            return(obj);
        }
Beispiel #14
0
        /// <summary>
        /// 用户绑定设置
        /// </summary>
        ///  <param name="userId">用户登录id</param>
        /// <param name="number"></param>
        /// <param name="fistLongitude"></param>
        /// <param name="fistLatitude"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        public async Task <TData <string> > BindUser(string userId, string number, string fistLongitude, string fistLatitude, string position)
        {
            TData <string> obj = new TData <string>();

            TerInforEntity ter = await terInforService.GetEntityByNumber(number);

            obj.SetDefault();
            //设备一旦锁定,激活时间(FistOn),FistPosition,FistLongitude,FistLatitude 不再编号
            if (ter != null)
            {
                if (ter.ManageId <= 0)
                {
                    ter.FistLatitude  = fistLatitude;
                    ter.FistLongitude = fistLongitude;
                    ter.FistPosition  = position;

                    ter.Latitude  = fistLatitude;
                    ter.Longitude = fistLongitude;
                    ter.Position  = position;

                    ter.ManageId = long.Parse(userId);
                    ter.FistOn   = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                    obj          = await SaveForm(ter);

                    obj.Refresh();
                }
                else
                {
                    obj.Message = "已经绑定,您不能再绑定";
                }
            }
            else
            {
                obj.Message = "设备不存在";
            }
            return(obj);
        }