Esempio n. 1
0
        public IHttpActionResult AddInStorageDetail(List <InStorDetail> inStorDetails)
        {
            var  inStor   = new InStorageDetailService();
            bool isResult = true;

            try
            {
                inStorDetails.ForEach(item => {
                    item.CreateTime = DateTime.Now;
                    item.IsPick     = 1;
                    var maxSnNum    = inStor.GetAll().Select(getNum => getNum.SnNum).LastOrDefault();
                    int maxCode     = Int32.Parse(maxSnNum);
                    maxCode++;
                    item.SnNum = maxCode.ToString().PadLeft(6, '0');
                    inStor.AddDetail(item);
                });
            }
            catch (Exception)
            {
                isResult = false;
                throw;
            }
            var result = new
            {
                Result = isResult,
                Msg    = isResult ? "添加成功" : "添加失败"
            };

            return(Json(result));
        }
Esempio n. 2
0
        public IHttpActionResult AddInStorDetail(InStorDetail inStorDetail)
        {
            var inStorService = new InStorageDetailService();

            inStorDetail.CreateTime = DateTime.Now;
            inStorDetail.IsPick     = 1;
            var maxSnNum = inStorService.GetAll().Select(getNum => getNum.SnNum).LastOrDefault();
            int maxCode  = Int32.Parse(maxSnNum);

            maxCode++;
            inStorDetail.SnNum = maxCode.ToString().PadLeft(6, '0');
            var addInStor = inStorService.AddDetail(inStorDetail);
            var result    = new
            {
                Count = addInStor ? "添加成功" : "添加失败"
            };

            return(Json(result));
        }