/// <summary> /// 办结任务 /// </summary> /// <param name="task">当前任务Dto</param> /// <returns>业务操作结果</returns> protected OperationResult ExecuteCompleted(FlowExecuteDto task) { OperationResult re = new OperationResult(OperationResultType.NoChanged, "办结未做处理!"); var currentTask = FlowTaskRepository.Entities.SingleOrDefault(c => c.Id == task.TaskId); if (currentTask != null) { var currentItem = FlowItemRepository.Entities.Single(c => c.Id == currentTask.FlowItemId); currentItem.Status = 1; currentItem.CompletedTime = DateTime.Now; currentTask.Comment = task.Comment; currentTask.TaskNote = task.Note; currentTask.Status = 10; currentTask.CompletedTime = DateTime.Now; FlowTaskRepository.UnitOfWork.TransactionEnabled = true; //事务处理 if (currentTask.IsArchive) { FlowArchiveRepository.Insert(new WorkFlowArchive() { Id = CombHelper.NewComb(), FlowItemId = currentTask.FlowItemId, CreatorUserName = task.SenderName }); } FlowTaskRepository.Update(currentTask); FlowItemRepository.Update(currentItem); FlowTaskRepository.UnitOfWork.SaveChanges(); re = new OperationResult(OperationResultType.Success, "成功办结!"); } return(re); }
protected EntityBase() { if (typeof(TKey) == typeof(Guid)) { Key = CombHelper.NewComb().CastTo <TKey>(); } }
/// <summary> /// 执行确认命令函数 /// </summary> private void OnExecuteConfirmCommand() { ProManufacturingBillInfo.Id = CombHelper.NewComb(); ProManufacturingBillInfo.Product_Id = this.ProductionRuleInfo.Product_Id; ProManufacturingBillInfo.ProductionRule_Id = this.ProductionRuleInfo.Id; ProManufacturingBillInfo.LastUpdatedTime = DateTime.Now; ProManufacturingBillInfo.CreatedTime = DateTime.Now; var result = Utility.Http.HttpClientHelper.PostResponse <OperationResult>(GlobalData.ServerRootUri + "ProManufacturingBillInfo/Add", Utility.JsonHelper.ToJson(new List <ProManufacturingBillInfoModel> { ProManufacturingBillInfo })); if (!Equals(result, null) && result.Successed) { Application.Current.Resources["UiMessage"] = result?.Message; LogHelper.Info(Application.Current.Resources["UiMessage"].ToString()); Messenger.Default.Send <ProManufacturingBillInfoModel>(ProManufacturingBillInfo, MessengerToken.DataChanged); Messenger.Default.Send <bool>(true, MessengerToken.ClosePopup); } else { //操作失败,显示错误信息 //EnterpriseInfoList = new ObservableCollection<ProManufacturingBillInfoModel>(); Application.Current.Resources["UiMessage"] = result?.Message ?? "操作失败,请联系管理员!"; LogHelper.Info(Application.Current.Resources["UiMessage"].ToString()); } }
public ActionResult Create(INFOR_MASTERModel model) { if (ModelState.IsValid) { //this.CreateBaseData<INFOR_MASTERModel>(model); model.ID = CombHelper.NewComb().ToString("N"); model.CreateDate = DateTime.Now; model.Creator = base.GetCurrentUser().Userid; OperationResult result = INFOR_MASTERService.Insert(model); if (result.ResultType == OperationResultType.Success) { return(Json(result)); } else { InitCategoup(model); return(PartialView(model)); } } else { InitCategoup(model); return(PartialView(model)); } }
/// <summary> /// 根据指定流程 选择的流转步骤创建任务 /// </summary> /// <param name="task">当前任务Dto</param> /// <param name="stepId">当前步骤Id</param> protected void CreatedNextTask(FlowExecuteDto task, short stepId) { foreach (var step in task.Steps) { //流转的下个步骤 var nextStep = FlowStepRepository.Entities.Single(p => p.StepId == step.Key && p.FlowDesignId == task.FlowId); foreach (var user in step.Value) { var uid = user.Key; var uname = user.Value; GetReceiver(task.FlowId, ref uid, ref uname); WorkFlowTask taskModel = new WorkFlowTask() { Id = CombHelper.NewComb(), PrevId = task.TaskId, FlowItemId = task.ItemId, PrevStepId = stepId, StepId = nextStep.StepId, StepName = nextStep.StepName, SenderId = task.SenderId, SenderName = task.SenderName, ReceiverId = uid, ReceiverName = uname, IsComment = nextStep.CountersignType == 0 ? false : true, IsSeal = nextStep.CountersignType == 2 ? true : false, IsArchive = nextStep.IsArchives, StepDay = nextStep.SpecifiedDay, Status = 1 }; FlowTaskRepository.Insert(taskModel); } } }
public JsonResult AddOrderFilter(int OrderID) { if (Request.Files.Count > 0) { string ImageName = CombHelper.GenerateOrderNumber() + ".png"; //传过来的图片 var file = Request.Files[0]; string fPath = "/File/" + OrderID.ToString() + "/Filter/";//+"/" + ImageName //保存到本地或服务器 if (!Directory.Exists(System.Web.HttpContext.Current.Server.MapPath(fPath))) { FileHelper.CreateDirectory(System.Web.HttpContext.Current.Server.MapPath(fPath)); } var uploadsPath = Path.Combine(fPath, CombHelper.GenerateNumber()); string extraName = file.FileName.Substring(file.FileName.LastIndexOf(".") + 1); string fName = file.FileName; string filepath = uploadsPath + "." + extraName; file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(filepath)); return(Json(new { R = true }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { R = false, ID = 0 }, JsonRequestBehavior.AllowGet)); } }
/// <summary> /// 添加 流程步骤 /// </summary> /// <param name="doc"></param> /// <param name="dto"></param> /// <param name="flow"></param> private void AddSteps(XmlDocument doc, FlowDesignerDto dto, ref WorkFlowDesign flow) { XmlNodeList steps = doc.DocumentElement.GetElementsByTagName("WorkFlowStep"); flow.Steps.Clear(); for (int i = 0; i < steps.Count; i++) { XmlElement step = (XmlElement)steps.Item(i); WorkFlowStep flowStep = new WorkFlowStep(); var id = step.GetAttribute("Id"); if (string.IsNullOrWhiteSpace(id)) { step.SetAttribute("Id", CombHelper.NewComb().ToString()); } flowStep.Id = Guid.Parse(step.GetAttribute("Id")); flowStep.FlowDesignId = dto.Id; flowStep.StepId = Int16.Parse(step.GetAttribute("id")); flowStep.StepName = step.GetAttribute("StepName"); flowStep.StepType = Int16.Parse(step.GetAttribute("StepType")); flowStep.CountersignType = step.GetAttribute("CountersignType") != "" ? Int16.Parse(step.GetAttribute("CountersignType")) : Int16.Parse("0"); flowStep.CountersignStrategy = step.GetAttribute("CountersignStrategy") != "" ? Int16.Parse(step.GetAttribute("CountersignStrategy")) : Int16.Parse("0"); flowStep.CountersignPer = step.GetAttribute("CountersignPer") != "" ? Int16.Parse(step.GetAttribute("CountersignPer")) : Int16.Parse("100"); flowStep.BackType = step.GetAttribute("BackType") != "" ? Int16.Parse(step.GetAttribute("BackType")) : Int16.Parse("0"); flowStep.SpecifiedBackStep = step.GetAttribute("SpecifiedBackStep"); flowStep.SpecifiedDay = step.GetAttribute("SpecifiedDay") != "" ? Int16.Parse(step.GetAttribute("SpecifiedDay")) : Int16.Parse("0"); flowStep.IsArchives = step.GetAttribute("IsArchives") != "" ? int.Parse(step.GetAttribute("IsArchives")) == 1 : false; flowStep.StepDescription = step.GetAttribute("StepDescription"); flow.Steps.Add(flowStep); } }
/// <summary> /// 初始化一个<see cref="OperatingLog"/>类型的新实例 /// </summary> public OperatingLog() { Id = CombHelper.NewComb(); Operator = OSharpContext.Current.Operator; OperateDate = DateTime.Now; LogItems = new List <OperatingLogItem>(); }
/// <summary> /// 初始化一个<see cref="DataLog"/>类型的新实例 /// </summary> public DataLog() { Id = CombHelper.NewComb(); Operator = MesContext.Current.Operator; OperateDate = DateTime.Now; LogItems = new List <DataLogItem>(); }
public static Dictionary <Workbench, List <WorkbenchTimestamp> > Simulate(IEnumerable <Detail> details, out int minTime, out int maxTime) { var plans = details.Select(detail => new DetailWorkplan(detail)).ToList(); var maxWorkbecnhCount = plans.Max(plan => plan.Detail.OrdersDictionary.Count); var priorities = Enumerable.Range(1, maxWorkbecnhCount) .Select(_ => Enumerable.Range(1, plans.Count).ToList()).ToList(); minTime = int.MaxValue; maxTime = int.MinValue; Dictionary <Workbench, List <WorkbenchTimestamp> > timeStamps = null; do { var planTime = SimulatePlan(plans, priorities, out var t); if (planTime < minTime) { minTime = planTime; timeStamps = t; } if (maxTime < planTime) { maxTime = planTime; } } while (CombHelper.NextMultyPermutation(priorities)); return(timeStamps); }
/// <summary> /// 初始化一个<see cref="EntityBase{TKey}"/>类型的新实例 /// </summary> protected EntityBase() { if (typeof(TKey) == typeof(Guid) || typeof(TKey) == typeof(string)) { Id = CombHelper.NewComb().CastTo <TKey>(); } LastModifiedTime = DateTime.Now; }
//public new int Id { get { var intId = 0; int.TryParse(base.Id, out intId); return intId; } set { } } public User() { //Roles = new HashSet<Role>(); BlogInfos = new HashSet <BlogInfo>(); Comments = new HashSet <Comment>(); Id = CombHelper.NewComb().ToString(); LastModifiedTime = DateTime.Now; }
public ActionResult Save(FlowDesignerDto dto) { if (dto.Id == Guid.Empty) { dto.Id = CombHelper.NewComb(); dto.CreatorUserName = Operator.UserName; } return(Json(FlowContract.Save(dto))); }
/// <summary> /// 数据实体基类 /// </summary> protected EntityBase() { //创建默认Guid if (typeof(TKey) == typeof(Guid)) { Id = CombHelper.NewComb().CastTo <TKey>(); } IsDeleted = false; }
/// <summary> /// 添加Opc Ua 业务数据 /// </summary> /// <param name="inputDtos">要添加的Opc Ua 业务数据DTO信息</param> /// <returns>业务操作结果</returns> public async Task <OperationResult> AddCommOpcUaBusinesss(params CommOpcUaBusinessInputDto[] inputDtos) { inputDtos.CheckNotNull("inputDtos"); foreach (var dtoData in inputDtos) { if (CommOpcUaBusinessRepository.CheckExists(x => x.BusinessName.Equals(dtoData.BusinessName))) { return(new OperationResult(OperationResultType.Error, $"业务名称为{dtoData.BusinessName}的信息已存在,数据不合法,改组数据不被存储")); } } CommOpcUaBusinessRepository.UnitOfWork.BeginTransaction(); CommOpcUaBusinessNodeMapInputDto commOpcUaBusinessNodeMapInputDto = new CommOpcUaBusinessNodeMapInputDto(); foreach (var dtoData in inputDtos) { DeviceNode commOpcUaNode = CommOpcUaNodeRepository.TrackEntities.Where(x => x.Id.Equals(dtoData.NodeId)).FirstOrDefault(); if (commOpcUaNode != null) { //var result = await CommOpcUaBusinessContract.AddCommOpcUaBusinesss(dtoData); var result = await CommOpcUaBusinessRepository.InsertAsync(dtoData.MapTo <CommOpcUaBusiness>()); if (result > 0) { CommOpcUaBusiness commOpcUaBusiness = CommOpcUaBusinessRepository.TrackEntities.Where(x => x.BusinessName.Equals(dtoData.BusinessName)).FirstOrDefault(); commOpcUaBusinessNodeMapInputDto.OpcUaNode = commOpcUaNode; commOpcUaBusinessNodeMapInputDto.OpcUaBusiness = commOpcUaBusiness; commOpcUaBusinessNodeMapInputDto.Id = CombHelper.NewComb(); commOpcUaBusinessNodeMapInputDto.CreatorUserId = dtoData.CreatorUserId; commOpcUaBusinessNodeMapInputDto.CreatedTime = DateTime.Now; commOpcUaBusinessNodeMapInputDto.LastUpdatedTime = commOpcUaBusinessNodeMapInputDto.CreatedTime; commOpcUaBusinessNodeMapInputDto.LastUpdatorUserId = commOpcUaBusinessNodeMapInputDto.CreatorUserId; var saveResult = await CommOpcUaBusinessNodeMapContract.AddCommOpcUaBusinessNodeMaps(commOpcUaBusinessNodeMapInputDto); if (saveResult.ResultType == OperationResultType.Error) { return(new OperationResult(OperationResultType.Error, $"存储通讯业务点表与通讯点表关联数据失败,取消数据点\"{dtoData.BusinessName}\"存储!")); } } else { return(new OperationResult(OperationResultType.Error, "存储通讯业务点表数据失败!")); } } else { return(new OperationResult(OperationResultType.Error, "查询通讯点表数据失败!")); } } CommOpcUaBusinessRepository.UnitOfWork.Commit(); return(new OperationResult(OperationResultType.Success, "存储业务点数据成功!")); }
public void NewCombTest() { DateTime now = DateTime.Now; Smock.Run(context => { context.Setup(() => DateTime.Now).Returns(now); Guid id = CombHelper.NewComb(); DateTime time = CombHelper.GetDateFromComb(id); Assert.True(time.Subtract(now).TotalSeconds < 1); }); }
public ActionResult Add(FlowFormDto[] dtos) { dtos.CheckNotNull("dtos"); foreach (var item in dtos) { item.Id = CombHelper.NewComb(); item.CreatorUserName = Operator.UserName; } OperationResult result = FlowContract.AddFlowForm(dtos); return(Json(result.ToAjaxResult())); }
public int ModificationCart(SALES_EBASKETModel model) { var entity = SALES_EBASKETList.ToList().Where(t => t.CustomerID == model.CustomerID && t.ContactID == model.ContactID && t.ProductNo == model.ProductNo && t.Status == 0).FirstOrDefault(); if (entity == null) { entity = new SALES_EBASKET { ID = CombHelper.NewComb().ToString(), CustomerID = model.CustomerID, ContactID = model.ContactID, ProductNo = model.ProductNo, Quantity = model.Quantity, UnitPrice = model.UnitPrice, Unit = model.Unit, Creator = model.Creator, Modifier = model.Modifier, CreateDate = model.CreateDate, ModiDate = model.ModiDate, MakeOrderID = model.MakeOrderID, //RowID = model.RowID, Status = model.Status, UnitPType = model.UnitPType, }; return(SALES_EBASKETRepository.Insert(entity)); } else { //entity.ID = model.ID; //entity.CustomerID = model.CustomerID; //entity.ContactID = model.ContactID; //entity.ProductNo = model.ProductNo; entity.Quantity += model.Quantity; //entity.UnitPrice = model.UnitPrice; //entity.Unit = model.Unit; //entity.Creator = model.Creator; entity.Modifier = model.Modifier; //entity.CreateDate = model.CreateDate; entity.ModiDate = model.ModiDate; //entity.MakeOrderID = model.MakeOrderID; //entity.RowID = model.RowID; //entity.Status = model.Status; //entity.UnitPType = model.UnitPType; return(SALES_EBASKETRepository.Update(entity)); //这个是可以成功; 注意entity是通过entities集成读取 //return SALES_EBASKETRepository.Update(e => new { e.Quantity }, entity); //这个局部更新 } }
/// <summary> /// Gets the name of the local file which will be combined with the root path to /// create an absolute file name where the contents of the current MIME body part /// will be stored. /// </summary> /// <param name="headers">The headers for the current MIME body part.</param> /// <returns>A relative filename with no path component.</returns> public override string GetLocalFileName(HttpContentHeaders headers) { string filePath = headers.ContentDisposition.FileName; // Multipart requests with the file name seem to always include quotes. if (filePath.StartsWith(@"""") && filePath.EndsWith(@"""")) { filePath = filePath.Substring(1, filePath.Length - 2); } var extension = Path.GetExtension(filePath); return(CombHelper.NewComb() + extension); }
public async Task <IHttpActionResult> Setting(params CommOpcUaBusinessManageInputDto[] inputDto) { inputDto?.ToList().ForEach((a) => { a.Id = CombHelper.NewComb(); a.CreatorUserId = User.Identity.Name; a.CreatedTime = DateTime.Now; a.LastUpdatedTime = a.CreatedTime; a.LastUpdatorUserId = a.CreatorUserId; }); var result = await CommOpcUaBusinessNodeMapContract.Setting(inputDto); return(Json(result)); }
public async Task <IHttpActionResult> Setting(params DisStepActionProcessMapManageInputDto[] inputDtos) { inputDtos?.ToList().ForEach((a) => { a.Id = CombHelper.NewComb(); a.CreatorUserId = User.Identity.Name; a.CreatedTime = DateTime.Now; a.LastUpdatedTime = a.CreatedTime; a.LastUpdatorUserId = a.CreatorUserId; }); var result = await DisStepActionProcessMapInfoContract.Setting(inputDtos); return(Json(result)); }
public ActionResult Add(FlowDelegateDto[] dtos) { foreach (var dto in dtos) { if (dto.Id == Guid.Empty) { dto.Id = CombHelper.NewComb(); } dto.CreatorUserName = Operator.UserName; } OperationResult result = FlowContract.AddDelegation(dtos); return(Json(result.ToAjaxResult())); }
public async Task <IHttpActionResult> Add(params EnterpriseInfoInputDto[] dto) { //创建和修改的人员、时间 dto?.ToList().ForEach((a) => { a.Id = CombHelper.NewComb(); a.CreatorUserId = User.Identity.Name; a.CreatedTime = DateTime.Now; a.LastUpdatedTime = a.CreatedTime; a.LastUpdatorUserId = a.CreatorUserId; }); var result = await EnterpriseInfoContract.AddEnterprises(dto); return(Json(result)); }
public async Task <IHttpActionResult> Add(params SocketServerInputDto[] inpuDto) { //创建和修改的人员、时间 inpuDto?.ToList().ForEach((a) => { a.Id = CombHelper.NewComb(); a.CreatorUserId = User.Identity.Name; a.CreatedTime = DateTime.Now; a.LastUpdatedTime = a.CreatedTime; a.LastUpdatorUserId = a.CreatorUserId; }); var result = await SocketServerContract.AddSocketServers(inpuDto); return(Json(result)); }
public async Task <IHttpActionResult> Add(params CommOpcUaServerInputDto[] commOpcUaServer) { //创建和修改的人员、时间 commOpcUaServer?.ToList().ForEach((a) => { a.Id = CombHelper.NewComb(); a.CreatorUserId = User.Identity.Name; a.CreatedTime = DateTime.Now; a.LastUpdatedTime = a.CreatedTime; a.LastUpdatorUserId = a.CreatorUserId; }); var result = await CommOpcUaServerConract.AddCommOpcUaServers(commOpcUaServer); return(Json(result)); }
public async Task <IHttpActionResult> Add(params DisTaskDispatchInfoInputDto[] inputDtos) { //创建和修改的人员、时间 inputDtos?.ToList().ForEach((a) => { a.Id = CombHelper.NewComb(); a.CreatorUserId = User.Identity.Name; a.CreatedTime = DateTime.Now; a.LastUpdatedTime = a.CreatedTime; a.LastUpdatorUserId = a.CreatorUserId; }); // var result = await DisTaskDispatchInfoContract.Add(inputDtos); return(Json(result)); }
public LogInfo() { Id = CombHelper.NewComb(); if (HttpContext.Current == null) { return; } Operator = HttpContext.Current.User.Identity.Name; if (string.IsNullOrEmpty(Operator)) { Operator = "系统"; } IpAddress = HttpContext.Current.Request.UserHostAddress; LogType = LogType.System; ResultType = OperationResultType.NoChanged; }
public ActionResult Create(PROD_GROUP_INDEXModel model) { if (ModelState.IsValid) { string fileName = string.Empty; HttpPostedFileBase upload = Request.Files["Picture"]; if (upload != null && upload.ContentLength > 0) { string pathForSaving = Server.MapPath("~/Uploads"); Quick.Framework.Common.FileHelper.DirFile.CreateDirectory(pathForSaving); try { fileName = Quick.Framework.Common.FileHelper.FileUpload.CreateDateTimeForFileName(upload.FileName); upload.SaveAs(System.IO.Path.Combine(pathForSaving, fileName)); model.Picture = fileName; //isUploaded = true; //message = "File uploaded successfully!"; } catch (Exception ex) { fileName = string.Empty; //message = string.Format("File upload failed: {0}", ex.Message); } } model.ID = CombHelper.NewComb().ToString("N"); model.CreateDate = DateTime.Now; model.Creator = base.GetCurrentUser().Userid; model.Modidate = DateTime.Now; model.Modifier = base.GetCurrentUser().Userid; model.Picture = fileName; //this.CreateBaseData<PROD_GROUP_INDEXModel>(model); OperationResult result = PROD_GROUP_INDEXService.Insert(model); if (result.ResultType == OperationResultType.Success) { return(Json(result)); } else { return(PartialView(model)); } } else { return(PartialView(model)); } }
public ActionResult SaveLeave(LeaveDto dtos) { OperationResult result; if (dtos.Id == Guid.Empty) { dtos.Id = CombHelper.NewComb(); result = FormContract.AddLeave(dtos); result.Data = new { EntityId = dtos.Id }; } else { result = FormContract.EditLeave(dtos); result.Data = new { EntityId = dtos.Id }; } return(Json(result.ToAjaxResult(), JsonRequestBehavior.AllowGet)); }
public void CombTest() { const int iteration = 50; var result = CodeTimer.Time("Guid", iteration, () => { var guid = Guid.NewGuid(); Console.WriteLine(guid); }); Console.WriteLine(result.ToString()); result = CodeTimer.Time("CombHelper", iteration, () => { var guid = CombHelper.NewComb(); Console.WriteLine(guid); }); Console.WriteLine(result.ToString()); }