Exemplo n.º 1
0
        public IHttpActionResult GetMaxOrder()
        {
            var moveService = new MoveService();
            var maxOrderNum = moveService.GetAll().Select(item => item.OrderNum).LastOrDefault();
            int maxCode     = Int32.Parse(maxOrderNum);

            maxCode++;
            var max = maxCode.ToString().PadLeft(6, '0');

            return(Json(max));
        }
Exemplo n.º 2
0
        /// <summary>
        /// 查看移库主单信息以及详情信息
        /// </summary>
        /// <param name="orderNum"></param>
        /// <returns></returns>
        public IHttpActionResult GetByOrderNum(string orderNum)
        {
            var moveService       = new MoveService();
            var moveList          = moveService.GetAll().Where(item => item.OrderNum == orderNum);
            var moveDetailService = new MoveOrderDetailService();
            var moveDetailList    = moveDetailService.GetAll().Where(item => item.OrderNum == orderNum).OrderByDescending(item => item.CreateTime);
            var listObj           = new List <Object>();

            moveDetailList.ToList().ForEach(item =>
            {
                var locationService = new LocationService();
                var Fromlocation    = locationService.FindByLocalNum(item.FromLocalNum);
                var Tolocation      = locationService.FindByLocalNum(item.ToLocalNum);
                var obj             = new
                {
                    ID           = item.ID,
                    OrderNum     = item.OrderNum,
                    ProductName  = item.ProductName,
                    ProductNum   = item.ProductNum,
                    BarCode      = item.BarCode,
                    BatchNum     = item.BatchNum,
                    Num          = item.Num,
                    InPrice      = item.InPrice,
                    Amout        = item.Amout,
                    FromLocalNum = item.FromLocalNum,
                    LocalName    = Fromlocation.LocalName,
                    ToLocalNum   = item.ToLocalNum,
                    ToLocalName  = Tolocation.LocalName
                };
                listObj.Add(obj);
            });
            var result = new
            {
                MoveList       = moveList,
                MoveDetailList = listObj
            };

            return(Json(result));
        }