public async Task SendAsync(WorkOrderAdapterModel workOrderAdapterModel) { if (workOrderAdapterModel.Status == MagicHelper.WorkOrderStatus完工) { var flowMasterAdapterModel = await FlowMasterService.GetSourceCodeAsync(workOrderAdapterModel.Code); if (flowMasterAdapterModel != null) { await Task.Yield(); var checkTask = ConfirmMessageBox.ShowAsync("400px", "200px", "確認", "這筆工單已經有送審過了,是否還要繼續送審", ConfirmMessageBox.HiddenAsync); thisView.NeedRefresh(); var checkAgain = await checkTask; if (checkAgain == false) { return; } } CurrentRecord = workOrderAdapterModel; OnWorkOrderSendingDialog(); } else { MessageBox.Show("400px", "200px", "警告", "派工單狀態必須是在完工狀態才可以送審", MessageBox.HiddenAsync); await Task.Yield(); thisView.NeedRefresh(); } }
public async Task OnContextMenuClick(ContextMenuClickEventArgs <WorkOrderAdapterModel> args) { CurrentRecord = args.RowInfo.RowData; if (args.Item.Id == "查看送審記錄") { var flowMasterAdapterModel = await FlowMasterService.GetSourceCodeAsync(CurrentRecord.Code); if (flowMasterAdapterModel != null) { CurrentFlowMasterAdapterModel = flowMasterAdapterModel; ShowReviewFlowDialog = true; } } else if (args.Item.Id == "送審") { await SendAsync(CurrentRecord); } }
public async Task OnWorkOrderSendingDialogCompletion(ApproveOpinionModel e) { if (e != null) { #region 產生一筆稽核送審記錄 var user = await CurrentUserHelper.GetCurrentUserAsync(); var code = UniqueStringHelper.GetCode(); FlowMasterAdapterModel flowMasterAdapterModel = new FlowMasterAdapterModel() { Code = code, MyUserId = user.Id, PolicyHeaderId = e.PolicyHeaderAdapterModel.Id, CreateDate = DateTime.Now, ProcessLevel = 0, Title = $"工單完工 - {CurrentRecord.Description}", Content = "", Status = 0, SourceType = FlowSourceTypeEnum.WorkOrder, SourceJson = JsonConvert.SerializeObject(CurrentRecord), SourceCode = CurrentRecord.Code, }; flowMasterAdapterModel.UpdateAt = DateTime.Now; await FlowMasterService.AddAsync(flowMasterAdapterModel); flowMasterAdapterModel = await FlowMasterService.GetAsync(code); await FlowMasterService.SendAsync(flowMasterAdapterModel, e); CurrentRecord.Status = MagicHelper.WorkOrderStatus送審; await CurrentService.UpdateAsync(CurrentRecord); this.dataGrid.RefreshGrid(); #endregion } ShowWorkOrderSendingDialog = false; }