public PosTransferRecord(string key, TransferNotice notice, Pipe pipe, DateTime dateCreated) : base(key) { this.TransferNotice = notice; this.Pipe = pipe; this.DateCreated = dateCreated; }
public ActionResult Create(string Key, String PositionId, int PipeTypeId, int SentCount) { Account onlineAccount = UserSession.OnlineAccount; IPipeRepository pipeRepository = RepositoryFactory.GetRepository<IPipeRepository, PDCPMS.Model.Common.Pipe>(unitOfWork); IPipeTypeRepository ptRepository = RepositoryFactory.GetRepository<IPipeTypeRepository, PipeType>(unitOfWork); if (PositionId == null) { TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = string.Format("找不到目标垛位,垛位调度任务单({0})添加失败!", Key), DisappearDelay = 5000, Type = HintMessageType.Error }; } PipePosition Position = RepositoryFactory.GetRepository<IPipePositionRepository, PipePosition>().FindBy(PositionId); if (PipeTypeId <1) { TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = string.Format("找不到应该调度的管材型号,垛位调度任务单({0})添加失败!", Key), DisappearDelay = 5000, Type = HintMessageType.Error }; } PipeType pt = ptRepository.FindBy(PipeTypeId); Key = onlineAccount.DetectionCompany.Code + Key; TransferNotice notice = new TransferNotice(Key, onlineAccount.DetectionCompany, pt, Position,onlineAccount, DateTime.Now); notice.SentCount = SentCount; notice.State = TransferNoticeState.Created; if (repository.FindByNotCache(Key) != null) { TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = string.Format("垛位调度任务单号{0}已存在,请尝试使用其他编号", Key) }; TempData["InvalidModel"] = notice; } else { repository.Add(notice); unitOfWork.Commit(); TempData["HintMessage"] = new PDCPMS.Application.HintMessage { Content = string.Format("垛位调度任务单({0})添加成功", Key), DisappearDelay = 5000 }; } return RedirectToAction("Add"); }