// go through each page from a book, resursive, as long as consecutiveErrorCount is lower than 10, continue // when consecutiveErrorCount is larger than 10, it means that clicking next page no longer goes to next page protected void NavigateThrougOneBook(string pageUrl, IWebElement nextButton, int consecutiveErrorCount, ProcessHistory history, Func <string> getPageImagePathFunc) { if (consecutiveErrorCount > 10) { return; } try { System.Threading.Thread.Sleep(1000); nextButton.Click(); var newPageUrl = driver.Url; if (!newPageUrl.Equals(pageUrl)) { consecutiveErrorCount = 0; ProcessOnePage(getPageImagePathFunc); history.ProcessedTotalPage++; } else { consecutiveErrorCount++; } NavigateThrougOneBook(newPageUrl, nextButton, consecutiveErrorCount, history, getPageImagePathFunc); } catch (Exception e) { Logger.Error(e); throw e; } }
public void Create(TransferOrderModel model) { TransferOrder entity = model.MapTo <TransferOrder>(); entity.CreatedBy = model.EditBy; entity.CreatedByName = model.EditByName; entity.UpdatedBy = model.EditBy; entity.Code = _sequenceService.GenerateNewCode(BillIdentity.TransferOrder); // 明细 var items = JsonConvert.DeserializeObject <List <TransferOrderItem> >(model.ItemsJson); entity.Items = items; _db.Insert(entity); //跟踪记录 var reason = "创建调拨单"; var history = new ProcessHistory(model.EditBy, model.EditByName, (int)entity.Status, entity.Id, BillIdentity.TransferOrder.ToString(), reason); _db.Command.AddExecute(history.CreateSql(entity.GetType().Name, entity.Code), history); _db.SaveChange(); var modelEntity = _db.Table.Find <TransferOrder>(n => n.Code == entity.Code); model.Id = modelEntity.Id; model.Code = entity.Code; model.StatusName = entity.Status.Description(); entity.Id = modelEntity.Id; }
public Guid?PruebaInsertAndUpdate() { ProcessHistory updated = null; using (var scope = new TransactionScope()) { logger.LogInformation("PruebaInsertAndUpdate"); items.Add(a => false, "Pepe"); var r = items.GetAll(); var product1 = new ProductSpecification("Codigo 1"); var processHistory = new ProcessHistory(Guid.NewGuid(), DateTime.Now.AddMinutes(-20), product1); var inserted = repository.InsertAsync(processHistory).Result; var product2 = new ProductSpecification("Codigo 2"); inserted.SetProductSpecification(product2); inserted.FinishProcess(DateTime.Now); updated = repository.UpdateAsync(inserted).Result; scope.Complete(); } var r2 = items.GetAll(); return(updated?.Id); }
public Task DeleteAsync(ProcessHistory entity) { UnitOfWork.AddChangeTracker(entity); return(repository.DeleteAsync(new ProcessHistoryModel { Id = entity.Id })); }
public async Task <ProcessHistory> InsertAsync(ProcessHistory entity) { var item = mapper.Map <ProcessHistoryDto>(entity); // Chek or Insert ProductSpecification if (entity.ProductSpecification != null) { item.ProductSpecificationCode = item.ProductSpecification.Code; var productSpecification = GetProductSpecificationAsync(item.ProductSpecification.Code); if (productSpecification == null) { await InsertAsync(item.ProductSpecification); } } // Insert ProcessHistory await InsertAsync(item); // Insert InterruptionHistory if (entity.Interruption != null) { item.Interruption.ProcessHistoryId = item.Id; item.Interruption.Id = await InsertAsync(item.Interruption); } return(mapper.Map <ProcessHistory>(item)); }
public async Task <ProcessHistory> InsertAsync(ProcessHistory entity) { logger.LogInformation("InsertAsync ProcessHistory {@entity}", entity); UnitOfWork.AddChangeTracker(entity); var item = mapper.Map <ProcessHistoryModel>(entity); // Chek or Insert ProductSpecification if (item.ProductSpecification != null) { item.ProductSpecificationCode = item.ProductSpecification.Code; item.ProductSpecification = await GetOrAddProductSpecificationDtoAsync(item.ProductSpecification); } // Insert ProcessHistoryDto item = await repository.InsertAsync(item); // Insert InterruptionHistory if (item.Interruption != null) { item.Interruption.ProcessHistoryId = item.Id; item.Interruption = await repository.InsertAsync(item.Interruption); } return(mapper.Map <ProcessHistory>(item)); }
private ProcessHistory GetProcessHistory(int deviceID, string processName) { Database db = new Database(); ProcessHistory p = db.GetProcessHistory(deviceID, processName); return(p); }
void InsertAdviceProcessHistory(Processing newProcess, Advice advice) { ProcessHistory aph = new ProcessHistory(); if (newProcess != null) { aph.ObjectID = newProcess.ObjectID; if (string.IsNullOrEmpty(advice.ProcessState)) { aph.FromProcessState = "-1"; } else { aph.FromProcessState = advice.ProcessState; } aph.ToProcessState = newProcess.CurLayerNO; aph.ProcessDirection = newProcess.ProcessDirection; aph.ProcessAccountID = newProcess.ProcessAccountID; aph.TargetSites = newProcess.TargetSites; aph.Remark = newProcess.Remark; aph.CreateDate = DateTime.Now; aph.UpdateDate = DateTime.Now; aph.ItemNum = newProcess.ItemNum + 1; aph.ApproveName = newProcess.ApproveName; aph.ApproveTitle = newProcess.ApproveTitle; aph.ChannelID = advice.TypeID; aph.ChannelName = advice.TypeTitle; aph.SiteApiUrl = SiteConfigs.GetConfig().RootUrl; aph.SiteID = SiteConfigs.GetConfig().SiteID; aph.SiteName = SiteConfigs.GetConfig().SiteName; ProcessHistoryHelper.InsertAdviceProcessHistory(aph); } }
public void Create(CreateStorePurchaseOrder model) { var entity = new StorePurchaseOrder(); entity = model.MapTo <StorePurchaseOrder>(); entity.AddItems(model.ConvertJsonToItem()); var reason = "创建采购单"; var billIdentity = BillIdentity.StorePurchaseOrder; if (entity.OrderType == OrderType.Refund) { reason = "创建采购退单"; billIdentity = BillIdentity.StorePurchaseRefundOrder; } var entitys = _service.SplitOrderItem(entity); foreach (var order in entitys) { entity.Code = _sequenceService.GenerateNewCode(billIdentity); entity.SetItems(order.Items.ToList()); _db.Insert(entity); var history = new ProcessHistory(model.CreatedBy, model.CreatedByName, (int)entity.Status, entity.Id, billIdentity.ToString(), reason); _db.Command.AddExecute(history.CreateSql(entity.GetType().Name, entity.Code), history); _db.SaveChange(); } }
void InsertArticleProcessHistory(Processing newProcess, Article article) { ProcessHistory aph = new ProcessHistory(); if (newProcess != null) { aph.ObjectID = newProcess.ObjectID; aph.FromProcessState = article.ProcessState; aph.ToProcessState = newProcess.CurLayerNO; aph.ProcessDirection = newProcess.ProcessDirection; aph.ProcessAccountID = newProcess.ProcessAccountID; aph.TargetSites = newProcess.TargetSites; aph.Remark = newProcess.Remark; aph.CreateDate = DateTime.Now; aph.UpdateDate = DateTime.Now; aph.ItemNum = newProcess.ItemNum + 1; aph.ApproveName = newProcess.ApproveName; aph.ApproveTitle = newProcess.ApproveTitle; aph.ChannelID = article.OwnerID; aph.ChannelName = article.ChannelName; aph.SiteApiUrl = SiteConfigs.GetConfig().RootUrl; aph.SiteID = SiteConfigs.GetConfig().SiteID; aph.SiteName = SiteConfigs.GetConfig().SiteName; ProcessHistoryHelper.InsertArticleProcessHistory(aph, article); } }
public Task <ProcessHistory> InsertAsync(ProcessHistory entity) { var item = mapper.Map <ProcessHistoryDto>(entity); cache.Add(item); return(Task.FromResult(mapper.Map <ProcessHistory>(item))); }
public MessageMetadata(string messageId, string correlationId = null, string casuationId = null, ProcessHistory history = null) { MessageId = messageId; CasuationId = casuationId; CorrelationId = correlationId; History = history ?? new ProcessHistory(null); }
/// <summary> /// 保存文章审核信息 /// </summary> /// <param name="action"></param> /// <param name="article"></param> ProcessAction UpdateArticleProcessState(ProcessAction action, Article article) { ProcessAction myAction = action; string remark = DescriptionTextBox.Text; Processing p = ProcessingHelper.GetArticleProcess(article); p.Remark = remark; p.ApproveName = AccountHelper.GetAccount(AccountID, new string[] { "LastName" }).LastName; p.ApproveTitle = ApproveTitle.Text; p.ProcessAccountID = AccountID; p.ProcessState = ProcessHelper.GetNextProcessState(myAction, (Article)article); if (p.ProcessState == ProcessStates.EndAudit) { if (p.ProcessEndAction == ProcessEnding.SubmitSite) { p.ProcessState = ProcessStates.FirstAudit; myAction = ProcessAction.SubmitSite; p.TargetSites = TargetSites; p.TargetSiteID = TargetSiteID; } else if (p.ProcessEndAction == ProcessEnding.Start) { article.State = (int)ArticleStates.Started; } else { article.State = (int)ArticleStates.Stopped; } } if (p.FromOtherSite) { if (p.ProcessState == ProcessStates.Unaudit) { if (myAction == ProcessAction.Restart) //退回编辑 { p.TargetSiteID = p.SourceSiteID; p.TargetSites = p.SourceSiteName; } else //退回到上一站点的审核状态 { ProcessHistory ph = ProcessHistoryHelper.GetLastArticleProcess(article); p.CurLayerNO = ph.FromProcessState; p.TargetSiteID = ph.SiteID; p.TargetSites = ph.SiteName; } } } p.ProcessDirection = ((int)myAction).ToString(); ProcessingHelper.SaveFlowInfoToDB(article, p); return(myAction); }
/// <summary> /// 根据审核历史信息ID获取审核历史信息 /// </summary> /// <param name="adviceID"></param> /// <param name="historyID"></param> /// <returns></returns> public ProcessHistory GetAdviceProcessHistory(string adviceID, string historyID) { Advice a = AdviceHelper.GetAdvice(adviceID); List <ProcessHistory> list = StrToList(a.FlowXml); MyListHelper listHelper = new MyListHelper(); listHelper.HistoryID = historyID; ProcessHistory aph = list.Find(listHelper.MatchByID); return(aph); }
public bool MatchByID(ProcessHistory ph) { bool result = false; if (ph.ID == HistoryID) { result = true; } return(result); }
/// <summary> /// 根据创建时间获取审核历史信息 /// </summary> /// <param name="date"></param> /// <returns></returns> public ProcessHistory GetProcessHistory(string articleID, DateTime date) { Article article = ArticleHelper.GetArticle(articleID); List <ProcessHistory> list = StrToList(article.FlowXml); MyListHelper listHelper = new MyListHelper(); listHelper.date = date; ProcessHistory aph = list.Find(listHelper.MatchByDate); return(aph); }
public bool MatchByDate(ProcessHistory ph) { bool result = false; if (ph.CreateDate.Equals(date)) { result = true; } return(result); }
private void AddHistory(string processName, string processInstanceName, string taskName, string description, string user) { ProcessHistory history = new ProcessHistory(); history.ProcessName = processName; history.ProcessInstanceName = processInstanceName; history.TaskName = taskName; history.Description = description; history.User = user; hisStore.Create(history); }
/// <summary> /// 根据审核历史信息ID获取审核历史信息 /// </summary> /// <param name="id"></param> /// <returns></returns> public ProcessHistory GetArticleProcessHistory(string articleID, string historyID) { Article article = ArticleHelper.GetArticle(articleID); List <ProcessHistory> list = StrToList(article.FlowXml); MyListHelper listHelper = new MyListHelper(); listHelper.HistoryID = historyID; ProcessHistory aph = list.Find(listHelper.MatchByID); return(aph); }
public Task <ProcessHistory> UpdateAsync(ProcessHistory entity) { var item = cache.First(e => e.Id == entity.Id); var newItem = mapper.Map <ProcessHistoryDto>(entity); // replace item var idx = cache.IndexOf(item); cache.RemoveAt(idx); cache.Insert(idx, newItem); return(Task.FromResult(mapper.Map <ProcessHistory>(newItem))); }
/// <summary> /// 新增文章处理审核历史记录 /// </summary> /// <param name="aph"></param> /// <param name="article"></param> public void InsertArticleProcessHistory(ProcessHistory aph, Article article) { if (aph.ID == null) { aph.ID = We7Helper.CreateNewID(); } List <ProcessHistory> list = StrToList(article.FlowXml); aph.ItemNum = list.Count; list.Add(aph); article.FlowXml = ListToStr(list); ArticleHelper.UpdateArticle(article, new string[] { "FlowXml" }); }
public void InsertAdviceProcessHistory(ProcessHistory aph) { if (aph.ID == null) { aph.ID = We7Helper.CreateNewID(); } Advice a = AdviceHelper.GetAdvice(aph.ObjectID); List <ProcessHistory> list = StrToList(a.FlowXml); aph.ItemNum = list.Count; list.Add(aph); a.FlowXml = ListToStr(list); AdviceHelper.UpdateAdvice(a, new string[] { "FlowXml" }); }
void InsertArticleProcessHistory(string id) { Processing ap = ArticleProcessHelper.GetArticleProcess(id); ProcessHistory aph = new ProcessHistory(); //aph.ID = ap.ID; aph.ObjectID = ap.ObjectID; aph.ToProcessState = "-1"; aph.ProcessDirection = ap.ProcessDirection; aph.ProcessAccountID = ap.ProcessAccountID; aph.Remark = ap.Remark; aph.CreateDate = DateTime.Now; aph.UpdateDate = DateTime.Now; ArticleProcessHistoryHelper.InsertAdviceProcessHistory(aph); }
public void Create(AdjustStorePriceModel model) { var entity = new AdjustStorePrice(); entity = model.MapTo <AdjustStorePrice>(); entity.AddItems(model.ConvertJsonToItem()); entity.CreatedBy = model.UpdatedBy; entity.Code = _sequenceService.GenerateNewCode(BillIdentity.AdjustStorePrice); _db.Insert(entity); var reason = "创建门店调价单"; var history = new ProcessHistory(model.UpdatedBy, model.UpdatedByName, (int)entity.Status, entity.Id, BillIdentity.AdjustStorePrice.ToString(), reason); _db.Command.AddExecute(history.CreateSql(entity.GetType().Name, entity.Code), history); _db.SaveChange(); }
/// <summary> /// 跟踪处理历史记录 /// </summary> /// <param name="createdBy"></param> /// <param name="createdByName"></param> /// <param name="status"></param> /// <param name="formId"></param> /// <param name="formType"></param> public void Track(int createdBy, string createdByName, int status, int formId, string formType, string remark) { ProcessHistory model = new ProcessHistory() { CreatedBy = createdBy, CreatedByName = createdByName, CreatedOn = DateTime.Now, FormId = formId, FormType = formType, Status = status, Remark = remark }; this._db.Insert(model); }
void InsertArticleProcessHistory(string id) { Advice a = AdviceHelper.GetAdvice(id); Processing ap = ProcessHelper.GetAdviceProcess(a); ProcessHistory aph = new ProcessHistory(); aph.ObjectID = ap.ObjectID; aph.ToProcessState = ap.CurLayerNO; aph.ProcessDirection = ap.ProcessDirection; aph.ProcessAccountID = ap.ProcessAccountID; aph.Remark = ap.Remark; aph.CreateDate = DateTime.Now; aph.UpdateDate = DateTime.Now; ProcessHistoryHelper.InsertAdviceProcessHistory(aph); }
public void Create(OutInOrderModel model) { OutInOrder entity = model.MapTo <OutInOrder>(); entity.CreatedBy = model.EditBy; entity.CreatedByName = model.EditByName; entity.UpdatedBy = model.EditBy; entity.UpdatedByName = model.EditByName; // entity.Code = _sequenceService.GenerateNewCode(BillIdentity.OtherInOrder); // 明细 var items = JsonConvert.DeserializeObject <List <OutInOrderItem> >(model.ItemsJson); entity.SetItems(items); var orderType = _db.Table.Find <OutInOrderType>(entity.OutInOrderTypeId); if (orderType == null) { throw new FriendlyException("业务类别为空"); } var reason = "创建其他入库单"; var billIdentity = BillIdentity.OtherInOrder; if (orderType.OutInInventory == OutInInventoryType.Out) { reason = "创建其他出库单"; billIdentity = BillIdentity.OtherOutOrder; } var entitys = _service.SplitOrderItem(entity, orderType); foreach (var order in entitys) { entity.Code = _sequenceService.GenerateNewCode(billIdentity); entity.SetItems(order.Items.ToList()); _db.Insert(entity); var history = new ProcessHistory(entity.CreatedBy, entity.CreatedByName, (int)entity.Status, entity.Id, billIdentity.ToString(), reason); _db.Command.AddExecute(history.CreateSql(entity.GetType().Name, entity.Code), history); _db.SaveChange(); if (model.SaveAndSubmit) { var modelEntity = _db.Table.Find <OutInOrder>(n => n.Code == entity.Code); model.Id = modelEntity.Id; Submit(model.Id, model.EditBy, model.EditByName); } } }
public async Task <ProcessHistory> UpdateAsync(ProcessHistory entity) { logger.LogInformation("UpdateAsync ProcessHistory {@entity}", entity); UnitOfWork.AddChangeTracker(entity); var item = mapper.Map <ProcessHistoryModel>(entity); if (item.Interruption != null) { item.Interruption.ProcessHistoryId = item.Id; } // Chek or Insert ProductSpecification if (item.ProductSpecification != null) { item.ProductSpecificationCode = item.ProductSpecification.Code; item.ProductSpecification = await GetOrAddProductSpecificationDtoAsync(item.ProductSpecification); } // Update ProcessHistoryDto await repository.UpdateAsync(item); // Get current interruption var interruptionCurrent = await GetInterruptionDtoByProcessAsync(item.Id); // Insert interruption if (item.Interruption != null && interruptionCurrent == null) { item.Interruption = await repository.InsertAsync(item.Interruption); } // Disable/Delete interruption else if (interruptionCurrent != null && item.Interruption == null) { item.Interruption.Enable = false; await repository.UpdateAsync <InterruptionHistoryModel>(item.Interruption, new[] { "Enable" }); } // Update interruption else if (interruptionCurrent != null && item.Interruption != null) { await repository.UpdateAsync(item.Interruption); } return(mapper.Map <ProcessHistory>(item)); }
protected void saveHistoryProcess(string task, string calendarId) { var check = db.ProcessHistories.Where(p => p.ProcessId == task && p.CalendarId == calendarId).FirstOrDefault(); if (check == null) { // add quy trinh var historyProcess = new ProcessHistory() { Id = Guid.NewGuid().ToString(), CalendarId = calendarId, ProcessId = task, CreateTime = DateTime.Now }; db.ProcessHistories.Add(historyProcess); db.SaveChanges(); } }
private Guid PruebaInsertAndUpdate() { var product1 = new ProductSpecification("Codigo 1"); var processHistory = new ProcessHistory(Guid.NewGuid(), DateTime.Now.AddMinutes(-20), product1); var inserted = repository.InsertAsync(processHistory).Result; var product2 = new ProductSpecification("Codigo 2"); inserted.SetProductSpecification(product2); inserted.FinishProcess(DateTime.Now); var interruptionDisabled = inserted.Copy(); var updated = repository.UpdateAsync(inserted).Result; return(updated.Id); }