Exemplo n.º 1
0
 public override void Insert(SAFERUN.IMS.Web.Models.WorkProcessDetail entity)
 {
     if (entity.StartingDateTime.HasValue && entity.CompletedDateTime.HasValue)
     {
         entity.Status = 2;
     }
     if (entity.StartingDateTime.HasValue && !entity.CompletedDateTime.HasValue)
     {
         entity.Status = 1;
     }
     if (!entity.StartingDateTime.HasValue && !entity.CompletedDateTime.HasValue)
     {
         entity.Status = 0;
     }
     base.Insert(entity);
     //if (!this.Queryable().Where(x => x.Status != 2 && x.WorkProcessId == entity.WorkProcessId).Any())
     //{
     //    var workprocess = this._repository.GetRepository<WorkProcess>();
     //    var workitem = workprocess.Find(entity.WorkProcessId);
     //    workitem.Status = 3;
     //    workprocess.Update(workitem);
     //}
 }
 // GET: WorkProcessDetails/Create
 public ActionResult Create()
 {
     WorkProcessDetail workProcessDetail = new WorkProcessDetail();
     //set default value
     var processstepRepository = _unitOfWork.Repository<ProcessStep>();
     ViewBag.ProcessStepId = new SelectList(processstepRepository.Queryable(), "Id", "StepName");
     var skuRepository = _unitOfWork.Repository<SKU>();
     ViewBag.SKUId = new SelectList(skuRepository.Queryable(), "Id", "Sku");
     var stationRepository = _unitOfWork.Repository<Station>();
     ViewBag.StationId = new SelectList(stationRepository.Queryable(), "Id", "StationNo");
     var workprocessRepository = _unitOfWork.Repository<WorkProcess>();
     ViewBag.WorkProcessId = new SelectList(workprocessRepository.Queryable(), "Id", "WorkNo");
     return View(workProcessDetail);
 }