Esempio n. 1
0
        public JsonResult Delete(LimsTmcOutView model)
        {
            //if (ModelState.IsValid)
            //{
            string msg = string.Empty;

            try
            {
                OrderTmcRepository repository = new OrderTmcRepository();
                if (model.StateType == TmcOut.TmcOutStatuses.Repealed ||
                    model.StateType == TmcOut.TmcOutStatuses.Rejected ||
                    model.StateType == TmcOut.TmcOutStatuses.New)
                {
                    repository.Delete(model.TmcOutId);
                    repository.TocDelete(model.Id);
                }
                repository.Save();
            }
            catch (Exception e)
            {
                msg = e.ToString();
            }
            //}

            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 2
0
        public JsonResult Update(LimsTmcOutView model)
        {
            // if (ModelState.IsValid)
            // {
            OrderTmcRepository repository = new OrderTmcRepository();

            TmcOut m = repository.GetById(model.TmcOutId);

            m.Note            = model.Note;
            m.OutTypeDicId    = model.OutTypeDicId;
            m.OwnerEmployeeId = model.OwnerEmployeeId;
            repository.Update(m);

            TmcOutCount mcount = repository.TmcOutCountGetAsQuarable(toc => toc.Id == model.Id).FirstOrDefault();

            if (mcount != null)
            {
                mcount.Count = model.Count;
                repository.Update(m);
            }

            repository.Save();
            // }

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Esempio n. 3
0
        // GET: DeliveryTmc
        public PartialViewResult DeliveryTmcList()
        {
            OrderTmcListViewModel viewModel = new OrderTmcListViewModel()
            {
                Id = Guid.NewGuid()
            };

            ViewBag.StatusTypes = new List <Item>()
            {
                new Item()
                {
                    Id   = TmcOut.TmcOutStatuses.Issued.ToString(),
                    Name = LimsTmcOutView.StateTypeValueStatic(TmcOut.TmcOutStatuses.Issued)
                },
                new Item()
                {
                    Id   = TmcOut.TmcOutStatuses.Ordered.ToString(),
                    Name = LimsTmcOutView.StateTypeValueStatic(TmcOut.TmcOutStatuses.Ordered)
                },
                new Item()
                {
                    Id   = TmcOut.TmcOutStatuses.Rejected.ToString(),
                    Name = LimsTmcOutView.StateTypeValueStatic(TmcOut.TmcOutStatuses.Rejected)
                }
            };

            //  repo.GetAsQuarable(o => o.Type == Dictionary.Dic && o.ExpireDate == null)
            //      .ToList().OrderBy(o => o.Name)
            //      .Select(o => new Item() { Id = o.Id.ToString(), Name = o.Name }).ToList();

            return(PartialView(viewModel));
        }
Esempio n. 4
0
        /// <summary>
        /// Выдать ТМЦ
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public JsonResult IssueOrder(LimsTmcOutView model)
        {
            string msg = string.Empty;

            try
            {
                OrderTmcRepository repository = new OrderTmcRepository();
                var tmcOut = repository.GetById(model.TmcOutId);
                tmcOut.StateType = TmcOut.TmcOutStatuses.Issued;
                repository.Update(tmcOut);

                var tmcOutCount = repository.TmcOutCountGetAsQuarable(toc => toc.Id == model.Id).FirstOrDefault();
                if (tmcOutCount != null)
                {
                    tmcOutCount.StateType = TmcOut.TmcOutStatuses.Issued;
                    tmcOutCount.CountFact = model.CountFact;
                    repository.TocUpdate(tmcOutCount);
                }

                if (EmployeePermissionHelper.IsFrpCenterTmc)
                {
                    UpdateTmcResidue(model.TmcId, model.CountFact);
                }

                repository.Save();
            }
            catch (Exception e)
            {
                msg = e.ToString();
            }
            return(Json(msg, JsonRequestBehavior.AllowGet));
        }
Esempio n. 5
0
        // GET: OrderTmc
        public PartialViewResult OrderTmcView(Guid tmcId, Guid?id = null, string note = "", bool isEdit = false)
        {
            TmcRepository  tmcRepository = new TmcRepository(false);
            LimsTmcOutView toc           = new LimsTmcOutView()
            {
                Id       = tmcId,
                TmcId    = tmcId,
                TmcOutId = id ?? Guid.Empty
            };

            if (id == null)
            {
                var tmcOrdering = tmcRepository.GetAsQuarable(tmc => tmc.Id == tmcId).FirstOrDefault();
                if (tmcOrdering != null)
                {
                    toc.Name                    = tmcOrdering.Name;
                    toc.Count                   = tmcOrdering.CountActual;
                    toc.OwnerEmployeeId         = tmcOrdering.OwnerEmployeeId;
                    toc.MeasureTypeConvertDicId = tmcOrdering.MeasureTypeConvertDicId;
                }

                DictionaryRepository dicRep = new DictionaryRepository(false);
                var outTypeId = dicRep.GetAsQuarable(d => d.Type == Dictionary.OutTypes.DicCode && d.ExpireDate == null)
                                .Select(d => d.Id)
                                .FirstOrDefault();
                toc.OutTypeDicId = outTypeId;
                toc.Note         = note;
            }
            else
            {
                OrderTmcRepository otRepo = new OrderTmcRepository(false);
                toc = otRepo.LimsTmcOutViewGetAsQuarable(lto => lto.TmcId == tmcId && lto.TmcOutId == id).FirstOrDefault();

                var tmcOrdering = tmcRepository.GetAsQuarable(tmc => tmc.Id == tmcId).FirstOrDefault();
                if (tmcOrdering != null && toc != null)
                {
                    toc.MeasureTypeConvertDicId = tmcOrdering.MeasureTypeConvertDicId;
                }
            }
            if (toc != null)
            {
                toc.IsEdit = isEdit;
            }
            return(PartialView(toc));
        }
Esempio n. 6
0
        public JsonResult ConfirmOrderTmc(LimsTmcOutView outCount)
        {
            OrderTmcRepository repository = new OrderTmcRepository(false);

            // берем у ТМЦ
            var ownerId = outCount.OwnerEmployeeId;

            if (outCount.OwnerEmployeeId == null)
            {
                var tmcRepo = new TmcRepository(false);
                ownerId = tmcRepo.GetAsQuarable(t => t.Id == outCount.TmcId).Select(t => t.OwnerEmployeeId).FirstOrDefault();
            }


            TmcOut tmcOut = new TmcOut()
            {
                Id                = Guid.NewGuid(),
                Note              = outCount.Note,
                CreatedDate       = DateTime.Now,
                CreatedEmployeeId = UserHelper.GetCurrentEmployee().Id,
                StateType         = TmcOut.TmcOutStatuses.Ordered,
                OwnerEmployeeId   = ownerId,
                OutTypeDicId      = outCount.OutTypeDicId
            };

            repository.Insert(tmcOut);

            TmcOutCount tmcOutCount = new TmcOutCount()
            {
                Id       = Guid.NewGuid(),
                TmcId    = outCount.TmcId,
                Count    = outCount.Count,
                Note     = outCount.Note,
                TmcOutId = tmcOut.Id
            };

            repository.TocInsert(tmcOutCount);

            repository.Save();
            return(Json(outCount.TmcId, JsonRequestBehavior.AllowGet));
        }