Пример #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));
        }
Пример #2
0
        public IHttpActionResult GetByOrderNum(string orderNum)
        {
            var inStor     = new InStorageDetailService();
            var detailList = inStor.GetAll().Where(item => item.OrderNum == orderNum);
            var listObj    = new List <Object>();

            detailList.ToList().ForEach(item => {
                var location     = new LocationService();
                var locationName = location.FindByLocalNum(item.LocalNum);
                var obj          = new
                {
                    ID          = item.ID,
                    ProductName = item.ProductName,
                    ProductNum  = item.ProductNum,
                    BarCode     = item.BarCode,
                    BatchNum    = item.BatchNum,
                    Num         = item.Num,
                    InPrice     = item.InPrice + ".00元",
                    Amount      = item.Amount + ".00元",
                    LocalName   = locationName.LocalName,
                    LocalNum    = locationName.LocalNum
                };
                listObj.Add(obj);
            });
            var result = new
            {
                list = listObj
            };

            return(Json(result));
        }
Пример #3
0
        public IHttpActionResult GetMaxSnNum()
        {
            var inStor   = new InStorageDetailService();
            var maxSnNum = inStor.GetAll().Select(item => item.SnNum).LastOrDefault();
            int i        = Int32.Parse(maxSnNum);

            i++;
            string s = i.ToString().PadLeft(6, '0');

            return(Json(s));
        }
Пример #4
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));
        }