Exemple #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"));
            }
        }
Exemple #2
0
 /// <summary>
 /// 执行借出申请
 /// </summary>
 /// <param name="_lendOutNo"></param>
 /// <returns></returns>
 public static bool ApplyLendOut(int LendId, User _user)
 {
     using (SunginDataContext sc = new SunginDataContext())
     {
         var            lr = sc.LendRecords.SingleOrDefault(p => p.Id == LendId);
         SampleBaseInfo sb = sc.SampleBaseInfos.SingleOrDefault(s => s.StyleId == lr.StyleId);
         if (sb != null && sb.State == SampleState.在库)
         {
             lr.State           = LendRecordStats.借出审批;
             sb.State           = SampleState.待借出;
             lr.LendOutNo       = "";
             sc.Entry(lr).State = System.Data.Entity.EntityState.Modified;
             sc.Entry(sb).State = System.Data.Entity.EntityState.Modified;
             //ishavelend = true;
         }
         //else sc.Entry(lr).State = System.Data.Entity.EntityState.Deleted;  //不在库中从借出审批中删除
         sc.SaveChanges();
     }
     return(true);
 }