예제 #1
0
        public IHttpActionResult GetMaxOrderNum()
        {
            var inStorage = new InStorageService();
            var maxCode   = inStorage.GetAll().Select(item => item.OrderNum).LastOrDefault();

            return(Json(maxCode));
        }
예제 #2
0
        public async Task <ActionResult> InStorageDelete(Guid id)
        {
            var inStorageService = new InStorageService();
            await inStorageService.RemoveInStorage(id);

            return(RedirectToAction(nameof(InStorageList)));
        }
예제 #3
0
        /// <summary>
        /// 单号查询
        /// </summary>
        /// <param name="OrderNum"></param>
        /// <returns></returns>
        public IHttpActionResult Get(string OrderNum)
        {
            var inStorage = new InStorageService();
            var list      = inStorage.GetAll().Where(item => item.OrderNum.IndexOf(OrderNum) != -1);

            return(Json(list));
        }
예제 #4
0
        public async Task <ActionResult> InStorageDetails(Guid?id)
        {
            var inStorageService = new InStorageService();

            if (id == null || !await inStorageService.ExistsInStorage(id.Value))
            {
                return(RedirectToAction(nameof(InStorageList)));
            }
            return(View(await inStorageService.GetOneInStorageById(id.Value)));
        }
예제 #5
0
        public IHttpActionResult GroupByPorduct()
        {
            var inStorage = new InStorageService();
            var list      = inStorage.GroupByPorduct();
            var result    = new
            {
                list = list
            };

            return(Json(result));
        }
예제 #6
0
        public IHttpActionResult EditCheckInStorage(InStorage storage)
        {
            var inStorageService = new InStorageService();
            var editCheckInStor  = inStorageService.EditCheckInStorage(storage);
            var result           = new
            {
                list = editCheckInStor?"修改成功":"修改失败"
            };

            return(Json(result));
        }
예제 #7
0
        public IHttpActionResult EditInStorage(InStorage storage)
        {
            var inStorageService = new InStorageService();
            var EditInStorage    = inStorageService.EditInStorage(storage);
            var result           = new
            {
                Count = EditInStorage?"编辑成功":"编辑失败"
            };

            return(Json(result));
        }
예제 #8
0
        public IHttpActionResult DeleteInStorage(int ID)
        {
            var inStorageService = new InStorageService();
            var delInStor        = inStorageService.DeleteInStorage(ID);
            var result           = new
            {
                Count = delInStor?"删除成功!":"删除失败"
            };

            return(Json(result));
        }
예제 #9
0
 public ActionResult CreateInStorage(InStorageCreateViewModel model)
 {
     if (ModelState.IsValid)
     {
         IInStorageService inStorageSvc = new InStorageService();
         inStorageSvc.CreateInStorage(model.Code, model.Name, model.Category, model.Describe);
         return(RedirectToAction(nameof(InStorageList)));
     }
     ModelState.AddModelError("", @"您录入的信息有误");
     return(View());
 }
예제 #10
0
        public async Task <ActionResult> InStorageEdit(Guid id)
        {
            var inStorageService = new InStorageService();
            var data             = await inStorageService.GetOneInStorageById(id);

            return(View(new InStorageEditViewModel()
            {
                Id = data.Id,
                Code = data.Code,
                Name = data.Name,
                Category = data.Category,
                Describe = data.Describe
            }));
        }
예제 #11
0
        public async Task <ActionResult> InStorageList(int pageIndex = 1, int pageSize = 20)
        {
            //总页码、当前页码、可显示总页码
            var inStorageSvc = new InStorageService();
            //当前第n页数据
            var articles = await inStorageSvc.GetAllInStorage(pageIndex, pageSize, false);

            //总个数
            var dataCount = await inStorageSvc.GetDataCount();

            //绑定分页
            var list = new PagedList <InStorageDto>(articles, pageIndex, pageSize, dataCount);

            return(View(list));
        }
예제 #12
0
        public async Task <ActionResult> InStorageEdit(Models.InStorageViewModels.InStorageEditViewModel model)
        {
            if (ModelState.IsValid)
            {
                var inStorageService = new InStorageService();
                await inStorageService.EditInStorage(model.Id, model.Code, model.Name, model.Category, model.Describe);

                return(RedirectToAction(nameof(InStorageList)));
            }
            else
            {
                await new InStorageService().CreateInStorage(model.Code, model.Name, model.Category, model.Describe);
                return(View(model));
            }
        }
예제 #13
0
        public IHttpActionResult InStoCount([FromUri] InStoCountDto inStoCountDto)
        {
            if (inStoCountDto.sky == 0)
            {
                inStoCountDto.StartTime = DateTime.Now.AddYears(-5);
                inStoCountDto.EndTime   = DateTime.Now.AddYears(1);
            }
            else if (inStoCountDto.sky == 1)
            {
                inStoCountDto.StartTime = DateTime.Now.AddDays(-60);
                inStoCountDto.EndTime   = DateTime.Now;
            }
            else if (inStoCountDto.sky == 2)
            {
                inStoCountDto.StartTime = DateTime.Now.AddDays(-30);
                inStoCountDto.EndTime   = DateTime.Now;
            }
            else if (inStoCountDto.sky == 3)
            {
                inStoCountDto.StartTime = DateTime.Now.AddDays(-10);
                inStoCountDto.EndTime   = DateTime.Now;
            }
            var InStoCountService = new InStorageCountService();
            var listSto           = InStoCountService.GetByTime(inStoCountDto.StartTime, inStoCountDto.EndTime);
            var inStorage         = new InStorageService();
            var InStolist         = inStorage.GetAll().Where(item => item.IsDelete != 1 && item.CreateTime >= inStoCountDto.StartTime && item.CreateTime <= inStoCountDto.EndTime).Select(item => new
            {
                OrderNum    = item.OrderNum,
                SupName     = item.SupName,
                ContactName = item.ContactName,
                Phone       = item.Phone,
                CreateTime  = item.CreateTime.ToString("yyyy-MM-dd"),
                Num         = item.Num,
                Amount      = item.Amount
            });
            var result = new
            {
                list   = listSto,
                InList = InStolist
            };

            return(Json(result));
        }
예제 #14
0
        public IHttpActionResult AddInStorage(InStorage inStorage)
        {
            var inStorageService = new InStorageService();

            inStorage.ProductType   = 2;
            inStorage.StorageNum    = "DSP_0000";
            inStorage.ContractType  = 0;
            inStorage.Status        = 1;
            inStorage.IsDelete      = 0;
            inStorage.NetWeight     = 0;
            inStorage.CreateTime    = DateTime.Now;
            inStorage.GrossWeight   = 0;
            inStorage.OperateType   = 1;
            inStorage.EquipmentNum  = "null";
            inStorage.EquipmentCode = "null";
            var addInStorage = inStorageService.Add(inStorage);
            var result       = new {
                Conut = addInStorage ? "添加成功!" : "添加失败!"
            };

            return(Json(result));
        }
예제 #15
0
        public IHttpActionResult GetByOrder(string OrderNum)
        {
            var inStorageService       = new InStorageService();
            var inStorageList          = inStorageService.GetAll().Where(item => item.OrderNum == OrderNum);
            var inStorageDetailService = new InStorageDetailService();
            var inStorageDetailList    = inStorageDetailService.GetAll().Where(item => item.OrderNum == OrderNum);
            var listObj = new List <Object>();

            inStorageDetailList.ToList().ForEach(item =>
            {
                var location     = new LocationService();
                var locationName = location.FindByLocalNum(item.LocalNum);
                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,
                    Amount      = item.Amount,
                    LocalName   = locationName.LocalName,
                    LocalNum    = locationName.LocalNum,
                };
                listObj.Add(obj);
            });
            var result = new
            {
                InStorageList       = inStorageList,
                InStorageDetailList = listObj
            };

            return(Json(result));
        }
예제 #16
0
        public IHttpActionResult DelArr(List <int> delArr)
        {
            var  inStorageService = new InStorageService();
            bool isResult         = true;

            try
            {
                delArr.ForEach(item =>
                {
                    inStorageService.DeleteInStorage(item);
                });
            }
            catch (Exception)
            {
                isResult = false;
                throw;
            }
            var result = new
            {
                Msg = isResult ? "删除成功" : "删除失败"
            };

            return(Json(result));
        }
예제 #17
0
        public IHttpActionResult GetInStorageList([FromUri] InStoageDto stoageDto)
        {
            var inStorage     = new InStorageService();
            var inStorageList = inStorage.GetInStorageList(stoageDto.Status, stoageDto.StartTime,
                                                           stoageDto.EndTime, stoageDto.supName, stoageDto.ContractNum, stoageDto.InType).OrderByDescending(item => item.CreateTime);
            var listResult  = new List <object>();
            var userService = new UserService();

            inStorageList.ToList().ForEach(item =>
            {
                var user = userService.FindByUserNum(item.CreateUser);
                string status, operate, inType = "";
                if (item.Status == 1)
                {
                    status = "等待审核";
                }
                else if (item.Status == 2)
                {
                    status = "审核通过";
                }
                else
                {
                    status = "审核失败";
                }
                if (item.OperateType == 1)
                {
                    operate = "电脑";
                }
                else
                {
                    operate = "其他";
                }
                if (item.InType == 1)
                {
                    inType = "采购收获入库";
                }
                else if (item.InType == 2)
                {
                    inType = "销售退货入库";
                }
                else if (item.InType == 3)
                {
                    inType = "生产产品入库";
                }
                else if (item.InType == 4)
                {
                    inType = "领用退还入库";
                }
                else if (item.InType == 5)
                {
                    inType = "借货入库";
                }
                else if (item.InType == 6)
                {
                    inType = "借出入库";
                }
                var obj = new
                {
                    ID            = item.ID,
                    ContractOrder = item.ContractOrder,
                    CreateTime    = item.CreateTime.ToString("yyyy-MM-dd HH:MM"),
                    OperateType   = operate,
                    Amount        = item.Amount + ".00元",
                    OrderNum      = item.OrderNum,
                    Phone         = item.Phone,
                    SupNum        = item.SupNum,
                    ContactName   = item.ContactName,
                    SupName       = item.SupName,
                    Num           = item.Num,
                    StatusName    = status,
                    Reason        = item.Reason,
                    Remark        = item.Remark,
                    Status        = item.Status,
                    InType        = inType,
                    User          = user,
                };
                listResult.Add(obj);
            });
            var result = new
            {
                list = listResult
            };

            return(Json(result));
        }
예제 #18
0
 public static int AddInStorage(InStorage ie)
 {
     return(InStorageService.AddInStorage(ie));
 }
예제 #19
0
 public static PageList GetQueryInStorage(int pageIndex, int pageSize, InStorage io)
 {
     return(InStorageService.GetQueryInStorage(pageIndex, pageSize, io));
 }
예제 #20
0
 public static int DelInStorage(InStorage pc, int id)
 {
     return(InStorageService.DelInStorage(pc, id));
 }