private void startReturnOrderProcess(DataModels.Warehouse.ProductReturn dataModel, IDAL dal) { int processDefinitionId = _parameterReader.ReadPublicParameter <int>("UrunIadeSureci", 2009); var store = dal.Read <Store>(dataModel.Store); var product = dal.Read <Product>(dataModel.Product); var branch = dal.Read <Branch>(store.OrganizationBranch); GroupOperations gop = new GroupOperations(dal); Group g = gop.FindGroup("Ürün İade Kullanıcıları"); Group g2 = gop.FindGroup("Depo Sorumlusu"); IProcessInstance processInstance = new ProcessInstance(processDefinitionId, OTApplication.Context.User.Id); //Set Process Variables processInstance.AddProcessVariable("user", OTApplication.Context.User.Id); processInstance.AddProcessVariable("screenReference", "Warehouse#ProductReturnListComponent#" + dataModel.ProductReturnId); processInstance.AddProcessVariable("branch", store.OrganizationBranch); processInstance.AddProcessVariable("region", branch.Parent); processInstance.AddProcessVariable("requestId", dataModel.ProductReturnId); processInstance.AddProcessVariable("accountingGroup", g.GroupId); processInstance.AddProcessVariable("acceptanceGroup", g2.GroupId); //Set Action Varibles processInstance.AddActionVariable("user", OTApplication.Context.User.Id); processInstance.AddActionVariable("description", $"{store.Name} - {product.Name}"); //Start Process var processId = processInstance.Start(dataModel.ProductReturnId.ToString()); dataModel.ProcessInstance = processId; dataModel.StatusCode = 2; dal.Update(dataModel); }
public void TakeAction([FromBody] ViewModels.Warehouse.ProductReturn viewModel) { if (ModelState.IsValid) { try { var mapperConfig = MapperConfig.Init(); mapperConfig.CreateMap <DataModels.Warehouse.ProductReturn, ViewModels.Warehouse.ProductReturn>(); DataModels.Warehouse.ProductReturn dataModel = viewModel.Map <DataModels.Warehouse.ProductReturn, ViewModels.Warehouse.ProductReturn>(mapperConfig); _dataService.TakeAction(dataModel, viewModel.action, viewModel.actionChoice, viewModel.actionComment); } catch (Exception ex) { _logger.Error(PrepareExceptionMessage(MethodBase.GetCurrentMethod().Name), ex); throw CreateUserException(ex); } } else { var errors = ModelState.Values.SelectMany(value => value.Errors).Select(error => error.ErrorMessage); throw CreateUserException(new OTException(OTErrors.ModelStateInvalid, true, null, errors)); } }
public void TakeAction(DataModels.Warehouse.ProductReturn dataObject, long actionId, string choice, string comment) { using (IDAL dal = this.DAL) { dal.BeginTransaction(); try { // var originalObject = dal.Read<DataModels.Warehouse.ProductReturn>(dataObject.ProductReturnId); IActionOperations actionOperations = new Overtech.API.BPM.ActionOperations(OTApplication.Context.User.Id); var actionInfo = actionOperations.GetActionInfo(actionId); IAction action = new Overtech.API.BPM.Action(actionId, OTApplication.Context.User.Id); if (choice != "İptal") { switch (actionInfo.ActivityName) { case "Şube Adımı": dataObject.StatusCode = 3; break; case "Merkez Adımı": dataObject.StatusCode = 4; break; //case "Merkez Statu Belirleme Adımı": originalObject.StatusCode = 5; break; } } else { dataObject.StatusCode = 7; } dal.Update(dataObject); createMikroWaybill(dataObject.ProductReturnId, dal); action.Commit(choice, comment); dal.CommitTransaction(); } catch { dal.RollbackTransaction(); throw; } } }
public long SaveProductReturn(ViewModels.Warehouse.ProductReturn rec) { DataModels.Warehouse.ProductReturn dmrec = rec.Map <DataModels.Warehouse.ProductReturn, ViewModels.Warehouse.ProductReturn>(mapperConfig); return(_dataService.SaveProductReturn(dmrec)); }
public void ApproveProductReturn(ViewModels.Warehouse.ProductReturn rec) { DataModels.Warehouse.ProductReturn dmrec = rec.Map <DataModels.Warehouse.ProductReturn, ViewModels.Warehouse.ProductReturn>(mapperConfig); _dataService.ApproveProductReturn(dmrec); }