/// <summary> /// 从缓存层获取指标 /// </summary> private void getIndicator() { indicatorList = IndicatorCache.getCache(); classList = CodeCache.getClass(); detectionList = CodeCache.getDetection(); subDetectionList = CodeCache.getSubDetection(); indicatorModels = (from indicator in indicatorList from classType in classList from detection in detectionList from subDetection in subDetectionList where indicator.classId == classType.id && indicator.detectionId == detection.id && indicator.subDetectionId == subDetection.id select new IndicatorModel() { indicatorId = indicator.id, classId = indicator.classId, className = classType.codeName, detectionId = indicator.detectionId, detectionName = detection.codeName, subDetectionId = indicator.subDetectionId, subDetectionName = subDetection.codeName, indicatorName = indicator.indicatorName, indicatorDesc = indicator.indicatorDesc, indicatorInstr = indicator.indicatorInstr, isObsolete = indicator.isObsolete == 1 ? "已废弃" : "生效中" }).ToList(); pagingPanel.setDetail(indicatorModels.Count); dgv_indicator.DataSource = indicatorModels.Skip(pageSize * (pageNum - 1)).Take(pageSize).ToList(); }
private void getAllList() { indicatorList = IndicatorCache.getCache(); classList = CodeCache.getClass(); detectionList = CodeCache.getDetection(); subDetectionList = CodeCache.getSubDetection(); }
private void bindCbb() { List <Tb_code> classes = CodeCache.getClass(); cbb_class.DataSource = classes; cbb_class.DisplayMember = "codeName"; cbb_class.ValueMember = "id"; }
private void loadClass() { var classList = CodeCache.getClass().OrderBy(c => c.id); ip_class.Items.Clear(); foreach (var classItem in classList) { ip_class.Items.Add(classItem.codeName); } }
private Tb_code getSelectedClass() { if (ip_class.SelectedItem != null) { return(CodeCache.getClass().FirstOrDefault(c => c.codeName == ip_class.SelectedItem.ToString())); } else { return(null); } }
private void bindTaskInfo() { lbl_taskName.Text = taskInfo.taskName; lbl_taskExecutor.Text = taskInfo.taskExecutor; lbl_taskClass.Text = CodeCache.getClass().FirstOrDefault(c => c.id == taskInfo.taskClass).codeName; lbl_taskCode.Text = taskInfo.taskCode; lbl_taskType.Text = CodeCache.getType().FirstOrDefault(c => c.id == taskInfo.taskType).codeName; lbl_brandModel.Text = string.Join(Environment.NewLine, from brandCode in CodeCache.getBrand() from modelCode in CodeCache.getModel() from taskModelMap in TaskModelMapCache.getCache() where taskModelMap.taskId == taskInfo.id && taskModelMap.brandId == brandCode.id && taskModelMap.ModelId == modelCode.id select brandCode.codeName + " " + modelCode.codeName); }
private void btn_save_Click(object sender, EventArgs e) { if (txt_value.Text.Trim() == string.Empty) { MessageBoxEx.Show("名称不能为空,请输入一个名称", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); } else { switch (codeType) { case CodeTypeEnum.Brand: if (brandCode == null) { brandCode = new Tb_code(); brandCode.id = CodeCache.getBrand().Count == 0 ? 1000 : CodeCache.getBrand().Max(c => c.id) + 1;//品牌默认从1000开始 brandCode.codeType = (int)CodeTypeEnum.Brand; brandCode.parentId = classCode.id; } brandCode.codeName = txt_value.Text.Trim(); CodeCache.addCache(brandCode); break; case CodeTypeEnum.Model: if (modelCode == null) { modelCode = new Tb_code(); modelCode.id = CodeCache.getModel().Count == 0 ? 2000 : CodeCache.getModel().Max(c => c.id) + 1;//型号从2000开始 modelCode.codeType = (int)CodeTypeEnum.Model; modelCode.parentId = brandCode.id; } modelCode.codeName = txt_value.Text.Trim(); CodeCache.addCache(modelCode); break; case CodeTypeEnum.Class: if (classCode == null) { classCode = new Db.Entity.Tb_code(); classCode.id = CodeCache.getClass().Count == 0 ? 3000 : CodeCache.getClass().Max(c => c.id) + 1;//分类默认从3000开始 classCode.codeType = (int)CodeTypeEnum.Class; } classCode.codeName = txt_value.Text.Trim(); CodeCache.addCache(classCode); break; default: break; } this.Close(); } }
public void init() { its.init(); cbb_taskClass.SelectedValueChanged -= cbb_taskClass_SelectedValueChanged; cbb_taskClass.DisplayMember = "codeName"; cbb_taskClass.ValueMember = "id"; cbb_taskClass.DataSource = CodeCache.getClass(); cbb_taskClass.SelectedValueChanged += cbb_taskClass_SelectedValueChanged; foreach (User user in User.list) { ccb_taskExecutor.Items.Add(user); } ccb_taskExecutor.ValueMember = "id"; ccb_taskExecutor.DisplayMember = "name"; }
public void init(int[] taskStateArray, TaskGridShownStyle style) { this._taskStateArray = taskStateArray; this._style = style; var classList = CodeCache.getClass(); var brandList = CodeCache.getBrand(); var modelList = CodeCache.getModel(); var taskList = TaskCache.getCache(); var tasklifecycleList = TaskLifecycleCache.getCache(); var taskModelMapList = TaskModelMapCache.getCache(); taskModelAllList = (from task in taskList from classCode in classList from tasklifecycle in tasklifecycleList //from brandCode in brandList //from taskModelMap in taskModelMapList //where (taskStateArray == (int)TaskStateEnum.Completed ? // (task.taskState == taskStateArray || task.taskState == (int)TaskStateEnum.Rejected || task.taskState == (int)TaskStateEnum.Closed) // : (task.taskState == taskStateArray))//如果是展示已完成任务,则需要附带已关闭、已驳回的任务 where taskStateArray.Contains(task.taskState) && task.taskClass == classCode.id //&& taskModelMap.taskId == task.id && taskModelMap.brandId == brandCode.id //todo 跟当前用户相关 && task.id == tasklifecycle.taskId && tasklifecycle.taskState == 5001 && (task.taskExecutor.Contains(User.currentUser.name) || tasklifecycle.taskStateChangeExecutor == User.currentUser.name) //当前用户创建或测试人包含当前用户 orderby task.createTime descending select new TaskModel { taskId = task.id, taskName = task.taskName, taskStateId = task.taskState, taskStateName = taskStateDic[task.taskState], taskBrandModelName = string.Join(Environment.NewLine, from brandCode in brandList from modelCode in modelList from taskModelMap in taskModelMapList where taskModelMap.taskId == task.id && taskModelMap.brandId == brandCode.id && taskModelMap.ModelId == modelCode.id select brandCode.codeName + " " + modelCode.codeName), taskClassName = classCode.codeName, taskStartTime = task.createTime, taskCode = task.taskCode, percent = task.percent, taskRound = task.taskRound }).ToList(); doQuery(new TaskQueryItem()); showStyle(style); }
private void bindCheckBox() { var classList = CodeCache.getClass(); //foreach (var classItem in classList) //{ // CheckBox chk = new CheckBox(); // chk.Name = classItem.codeName; // chk.Text = classItem.codeName; // chk.Tag = classItem.id; // chk.Checked = true; // chk.CheckedChanged += chk_valueChange; // tlp.Controls.Add(chk); //} cbb_class.ValueMember = "id"; cbb_class.DisplayMember = "codeName"; cbb_class.DataSource = classList; cbb_Obsolete.SelectedIndex = 0; }
private void buildTree() { var classList = CodeCache.getClass(); var detectionList = CodeCache.getDetection(); var subDetectionList = CodeCache.getSubDetection(); foreach (Tb_code classItem in classList) { var classNode = addNode(rootNode, classItem); foreach (Tb_code detectionItem in detectionList.Where(c => c.parentId == classItem.id)) { var detectionNode = addNode(classNode, detectionItem); foreach (Tb_code subDetectionItem in subDetectionList.Where(c => c.parentId == detectionItem.id)) { addNode(detectionNode, subDetectionItem); } } } }
private async Task getData(IProgress <string> progress) { var taskInfo = TaskCache.getCacheById(taskInfoId); var classInfo = CodeCache.getClass().FirstOrDefault(c => c.id == taskInfo.taskClass); var brandList = CodeCache.getBrand(); //全部品牌 var modelList = CodeCache.getModel(); //全部型号 //获取某任务下某轮次的所有指标测试结果 var currentRoundIndicatorList = TaskResultCache.getCache().Where(r => r.taskId == taskInfoId && r.taskRound == currentRound && r.taskStep == maxTaskStep).ToList(); progress.Report("获取前序轮次全部指标"); await Task.Factory.StartNew(() => { Stopwatch sw = new Stopwatch(); sw.Start(); var childOne = Task.Factory.StartNew(() => { //所有未通过的测试结果 var currentUnIndicatList = currentRoundIndicatorList.Where(r => r.taskResult == 1).ToList(); selectedIndicatorModelList = (from unIndicat in currentUnIndicatList from brand in brandList from model in modelList from indicator in indicatorList from detection in detectionList from subDetection in subDetectionList where unIndicat.modelId == model.id && model.parentId == brand.id && unIndicat.indicatorId == indicator.id && indicator.detectionId == detection.id && indicator.subDetectionId == subDetection.id select new RoundIndicatorModel { classId = indicator.classId, className = (classInfo == null ? "" : classInfo.codeName), //classType.codeName, detectionId = detection.id, detectionName = detection.codeName, indicatorDesc = indicator.indicatorDesc, indicatorInstr = indicator.indicatorInstr, indicatorId = indicator.id, indicatorName = indicator.indicatorName, isObsolete = indicator.isObsolete == 1 ? "已废弃" : "生效中", isSelected = false, subDetectionId = subDetection.id, subDetectionName = subDetection.codeName, modelId = model.id, modelName = model.codeName, brandId = brand.id, brandName = brand.codeName, taskStep = unIndicat.taskStep }).ToList(); progress.Report("指标计算中……"); Debug.WriteLine("one"); }, TaskCreationOptions.AttachedToParent); var childTwo = Task.Factory.StartNew(() => { var currentUnIndicatList = currentRoundIndicatorList.Where(r => r.taskResult == 2).ToList(); unselectedIndicatorModelList = (from unIndicat in currentUnIndicatList from brand in brandList from model in modelList from indicator in indicatorList from detection in detectionList from subDetection in subDetectionList where unIndicat.modelId == model.id && model.parentId == brand.id && unIndicat.indicatorId == indicator.id && indicator.detectionId == detection.id && indicator.subDetectionId == subDetection.id select new RoundIndicatorModel { classId = indicator.classId, className = (classInfo == null ? "" : classInfo.codeName), //classType.codeName, detectionId = detection.id, detectionName = detection.codeName, indicatorDesc = indicator.indicatorDesc, indicatorInstr = indicator.indicatorInstr, indicatorId = indicator.id, indicatorName = indicator.indicatorName, isObsolete = indicator.isObsolete == 1 ? "已废弃" : "生效中", isSelected = false, subDetectionId = subDetection.id, subDetectionName = subDetection.codeName, modelId = model.id, modelName = model.codeName, brandId = brand.id, brandName = brand.codeName }).ToList(); progress.Report("指标计算中……"); Debug.WriteLine("two"); }, TaskCreationOptions.AttachedToParent); sw.Stop(); Debug.WriteLine(sw.ElapsedMilliseconds); progress.Report("指标获取中……"); }); bindDgv(); progressBar.Visible = false; }