Exemplo n.º 1
0
        public ActionResult Update(CheckerDto dto)
        {
            OperationResult ope  = new OperationResult(OperationResultType.Error);
            var             chec = _checkerContract.Checkers.Where(c => c.CheckGuid == dto.CheckGuid).FirstOrDefault();

            if (chec != null)
            {
                chec.CheckerName = dto.CheckerName;
                chec.Notes       = dto.Notes;
                CheckerDto cheDto = AutoMapper.Mapper.Map <CheckerDto>(chec);
                ope = _checkerContract.Update(cheDto);
            }
            return(Json(ope, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 2
0
        public ActionResult UpdateState()
        {
            var             num  = Request["num"];
            var             stat = Request["stat"]; //1:成功 2:中断
            OperationResult res  = new OperationResult(OperationResultType.Error);

            if (stat != null && num != null)
            {
                var che = _checkerContract.Checkers.Where(c => c.CheckGuid == num).FirstOrDefault();
                if (che != null)
                {
                    Checker checker = _checkerContract.Checkers.Where(x => x.IsEnabled == true && x.IsDeleted == false)
                                      .OrderByDescending(x => x.CreatedTime)
                                      .FirstOrDefault(x => x.StorageId == che.StorageId && x.StoreId == che.StoreId);
                    if (checker != null && che.CheckGuid != checker.CheckGuid)
                    {
                        res.Message = "校验过的数据无法更改";
                        return(Json(res));
                    }


                    if (stat == "1")
                    {
                        che.CheckerState = CheckerFlag.Checked;
                        var ord = _storageContract.Storages.Where(c => c.Id == che.StorageId && c.IsDeleted == false && c.IsEnabled == true).FirstOrDefault();
                        if (ord != null)
                        {
                            ord.CheckLock = false;
                            StorageDto dto = AutoMapper.Mapper.Map <StorageDto>(ord);
                            _storageContract.Update(dto);
                        }
                    }
                    else if (stat == "2")
                    {
                        che.CheckerState = CheckerFlag.Interrupt;
                    }
                    else
                    {
                        che.CheckerState = CheckerFlag.Other;
                    }
                }
                if (che.CheckerState != CheckerFlag.Other)
                {
                    CheckerDto dto = AutoMapper.Mapper.Map <CheckerDto>(che);
                    res = _checkerContract.Update(dto);
                }
            }
            return(Json(res));
        }
Exemplo n.º 3
0
        public ActionResult Create(CheckerDto dto)
        {
            var result = _checkerContract.Insert(dto);

            return(Json(result, JsonRequestBehavior.AllowGet));
        }