Esempio n. 1
0
        public object PutInStorage(dynamic obj)
        {
            string id = (string)obj.styleId;

            if (id != "")
            {
                ISampleBaseInfo sample = new SampleBaseInfo();
                string          title, content;
                if (Config.GetSampleConfig().IsInputStrageNeedAlow)
                {
                    sample  = SampleOper.RequestPutInStorage(id);
                    title   = "已发送入库申请";
                    content = "请将样衣交给样衣管理员";
                }
                else
                {
                    sample  = SampleOper.PutInStorage(id);
                    title   = "入库成功";
                    content = "已入库成功";
                }
                //发钉钉消息
                if (sample != null)
                {
                    return(Ok(new { title, content, sample.State, StateText = sample.State.ToString() }));
                }
                else
                {
                    return(BadRequest("样衣ID不存在"));
                }
            }
            else
            {
                return(BadRequest("没有在请求中找到样衣ID"));
            }
        }
Esempio n. 2
0
        public object GetSampleList(SeachModel seachObj)
        {
            var exp = PredicateBuilder.True <ISampleBaseInfo>();

            exp = exp.And(p => !p.IsDelete && (int)p.State > 2);
            if (seachObj.State != SampleState.所有)
            {
                exp = exp.And(p => p.State == seachObj.State);
            }
            ;
            if (seachObj.DateValue.Count() > 1)
            {
                var d1 = seachObj.DateValue[0];
                var d2 = seachObj.DateValue[1].AddDays(1);
                exp = exp.And(p => p.CreateDate >= d1 & p.CreateDate < d2);
            }
            ;
            if (seachObj.KeyWord != "")
            {
                exp = exp.And(p => p.SeachStr.Contains(seachObj.KeyWord));
            }

            var re = SampleOper.GetSampleListOrderByDesc(exp.Compile(), t => t.State, seachObj.Current, seachObj.PageSize);

            return(Ok(re));
        }
Esempio n. 3
0
        public object GetInStorageSample(dynamic seachObj)
        {
            string ddid     = SessionManage.CurrentUser.DdId;
            string cstr     = (string)seachObj.current;;
            string cpage    = seachObj.pageSize;
            int    current  = cstr == "" ? 1 : int.Parse(cstr);
            int    pageSize = cpage == "" ? 20 : int.Parse(cpage);
            var    re       = SampleOper.GetSampleList(p => !p.IsDelete && p.DdId == ddid && (int)p.State >= 3, t => t.State, current, pageSize);

            return(Ok(re));
        }
Esempio n. 4
0
        public object AcceptInStorageList(List <string> obj)
        {
            List <string> slist = obj;

            if (slist.Count > 0)
            {
                slist.ForEach(p =>
                {
                    SampleOper.AcceptInStorage(p);
                });
            }
            ;
            return(Ok());
        }
Esempio n. 5
0
 public object GetSample([FromUri] string styleId)
 {
     if (styleId != "")
     {
         var obj = SampleOper.GetPrintSample(styleId);
         if (obj != null)
         {
             return(Ok(obj));
         }
         else
         {
             return(BadRequest("找到不指定ID的样衣信息"));
         }
     }
     return(NotFound());
 }
Esempio n. 6
0
        public object GetEditSample([FromUri] string styleId)
        {
            if (styleId != "")
            {
                var obj = SampleOper.GetSample(styleId);
                if (obj != null)
                {
                    SessionManage.CurrentSample = new SampleInfo(SessionManage.CurrentUser);
                    SessionManage.CurrentSample.LoadSampleById(styleId);

                    return(Ok(obj));
                }
                else
                {
                    return(BadRequest("找到不指定ID的样衣信息"));
                }
            }
            return(NotFound());
        }
Esempio n. 7
0
        public object DeleteSample(dynamic obj)
        {
            string id = (string)obj.styleId;

            if (id != "")
            {
                var sample = SampleOper.DeleteSample(id, SessionManage.CurrentUser.UserName);
                //发钉钉消息

                if (sample != null)
                {
                    return(Ok("ok"));
                }
                else
                {
                    return(BadRequest("样衣ID不存在"));
                }
            }
            return(BadRequest("没有在请求中找到样衣ID"));
        }
Esempio n. 8
0
        public object AcceptInStorage(dynamic obj)
        {
            string id = (string)obj.styleId;

            if (id != "")
            {
                var sample = SampleOper.AcceptInStorage(id);
                //发钉钉消息

                if (sample != null)
                {
                    return(Ok("ok"));
                }
                else
                {
                    return(BadRequest("样衣ID不存在"));
                }
            }
            else
            {
                return(BadRequest("没有在请求中找到样衣ID"));
            }
        }
Esempio n. 9
0
        public object GetInStorageList(SeachModel obj)
        {
            object re;

            if (obj.UserId.Count > 0)
            {
                var exp  = PredicateBuilder.False <ISampleBaseInfo>();
                var exp2 = PredicateBuilder.True <ISampleBaseInfo>();
                obj.UserId.ForEach(p =>
                {
                    exp = exp.Or(t => t.DdId == p);
                });
                exp2 = exp2.And(p => !p.IsDelete && p.State == SampleState.待入库).And(exp);

                re = SampleOper.GetSampleListOrderByDesc(exp2.Compile(), p => p.CreateDate, obj.Current, obj.PageSize);
            }
            else
            {
                re = SampleOper.GetSampleListOrderByDesc(p => !p.IsDelete && p.State == SampleState.待入库, p => p.CreateDate, obj.Current, obj.PageSize);
            }

            return(Ok(re));
        }