Esempio n. 1
0
        /// <summary>
        /// 轮次进行切换的时候,初始化步骤,
        /// </summary>
        private void roundSwitch(int round)
        {
            List <Tb_taskResult> taskResult = TaskResultCache.getCache().Where(t => t.taskId == taskInfoId && t.taskRound == round).ToList();

            maxStep = 0;
            try
            {
                maxStep = taskResult.Max(x => x.taskStep);
            }
            catch (Exception ex)
            {
            }
            currentStep = 1;
            if (currentStep >= maxStep)
            {
                btn_next.Enabled = false;
            }
            else
            {
                btn_next.Enabled = true;
            }
            if (currentStep <= 1)
            {
                btn_previous.Enabled = false;
            }
            else
            {
                btn_previous.Enabled = true;
            }
            lbl_current.Text = 1 + "/" + maxStep;
        }
Esempio n. 2
0
        private void TaskExecuteForm_Shown(object sender, EventArgs e)
        {
            //maxTaskStep =
            List <Tb_taskResult> resultList = TaskResultCache.getCache().Where(t => t.taskId == taskInfoId && t.taskRound == currentRound).ToList();

            try
            {
                maxTaskStep = resultList.Max(x => x.taskStep);
            }
            catch (Exception ex)
            {
            }
            if (currentRound == 1)
            {
                btn_previous.Enabled = false;
            }
            else
            {
                btn_previous.Enabled = true;
            }
            if (currentRound == maxRound)
            {
                btn_next.Enabled = false;
            }
            else
            {
                btn_next.Enabled = true;
            }
        }
Esempio n. 3
0
        private void reportCreate_Click(object sender, EventArgs e)
        {
            //taskInfoId
            taskResultMapList = TaskResultCache.getCache().Where(t => t.taskId == taskInfoId && t.taskRound == 1).ToList();
            int maxResultStep = 0;

            try
            {
                maxResultStep = taskResultMapList.Max(x => x.taskStep);
            }
            catch (Exception ex)
            {
            }
            List <TaskResultModel> resultList = GetReportInfo(maxResultStep, 1);

            DialogSeleFile(resultList, taskInfoId.ToString());
        }
Esempio n. 4
0
        private void btn_moveToUnselected_Click(object sender, EventArgs e)
        {
            List <int[]> checkedIndicatorId = new List <int[]>();

            foreach (DataGridViewRow row in dgv_selected.Rows)
            {
                if (row.Cells[0].Value.ToString() == "True")
                {
                    int[] cellVal = new int[] { (int)row.Cells[4].Value, (int)row.Cells[6].Value };
                    checkedIndicatorId.Add(cellVal);
                }
            }
            if (checkedIndicatorId.Count == 0)
            {
                MessageBoxEx.Show("您没有选中任何指标", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
            }
            else
            {
                List <Tb_taskResult> currentIndicatorList = new List <Tb_taskResult>();
                bool flag = true;
                foreach (var item in checkedIndicatorId)//遍历选择的所有指标,判断其中是否存在未通过的指标,该指标无法移到待选指标
                {
                    currentIndicatorList = TaskResultCache.getCache().Where(r => r.indicatorId == item[1] && r.taskId == taskInfoId && r.modelId == item[0] && r.taskStep == maxTaskStep && r.taskRound == currentRound).ToList();
                    if (currentIndicatorList[0].taskResult == 1)
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    foreach (var checkItem in checkedIndicatorId)
                    {
                        moveIndicator(selectedIndicatorModelList, unselectedIndicatorModelList, checkItem[1], checkItem[0]);
                    }
                    chk_selected.Checked = false;
                    bindDgv();
                }
                else
                {
                    MessageBoxEx.Show("当前选择的指标中存在未通过的指标", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    //表示当前选择的指标中存在未通过的指标
                }
            }
        }
Esempio n. 5
0
 private void btn_save_Click(object sender, EventArgs e)
 {
     try
     {
         //List<int> selectedIndicatorIdList = selectedIndicatorModelList.Select(i => i.indicatorId).ToList();
         //IndicatorTemplateMapCache.addCache(templateId, selectedIndicatorIdList);
         List <Tb_taskResult> resultList = new List <Tb_taskResult>();
         int id = TaskResultCache.getCache().Count;
         if (selectedIndicatorModelList.Count == 0)
         {
             MessageBox.Show("保存失败,未选择任务指标", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         foreach (var item in selectedIndicatorModelList)
         {
             //Tb_taskIndicatorMap indicatorMap = new Tb_taskIndicatorMap();
             //indicatorMap.taskId = taskInfoId;
             //indicatorMap.indicatorId = item;
             //indicatorMap.taskRound = currentRound;
             //TaskIndicatorMapCache.addCacheOnly(indicatorMap);
             Tb_taskResult taskResult = new Tb_taskResult();
             taskResult.taskId       = taskInfoId;
             taskResult.taskStep     = 1;//新增轮次的步骤默认都是从1开始
             taskResult.taskExecutor = User.currentUser.name;
             taskResult.taskDateTime = DateTime.Now;
             taskResult.modelId      = item.modelId;
             taskResult.indicatorId  = item.indicatorId;
             taskResult.taskRecord   = "";
             taskResult.taskResult   = 0;
             taskResult.taskRemark   = "";
             taskResult.attachment   = "";
             taskResult.supplement   = "";
             taskResult.taskRound    = currentRound + 1;
             resultList.Add(taskResult);
         }
         TaskResultCache.addCache(resultList);
         MessageBoxEx.Show("保存成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.DialogResult = DialogResult.Yes;
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show("保存失败。" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
         this.DialogResult = DialogResult.No;
     }
 }
        /// <summary>
        /// 加载任务指标及测试结果
        /// </summary>
        /// <param name="taskInfoId"></param>
        public void init(int taskInfoId, bool readOnly = false, int taskRound = 1)
        {
            taskId            = taskInfoId;
            this.taskRound    = taskRound;
            taskResultMapList = TaskResultCache.getCache().Where(t => t.taskId == taskId && t.taskRound == taskRound).ToList();
            maxResultStep     = 0;
            try
            {
                maxResultStep     = taskResultMapList.Max(x => x.taskStep);
                currentResultStep = maxResultStep;
            }
            catch (Exception ex)
            {
            }

            dgv.DataSource          = null;
            dgv.DataSource          = getData(maxResultStep, this.taskRound);
            dgv.AutoGenerateColumns = false;
            setReadOnly(readOnly);
        }
Esempio n. 7
0
        private void swapIndicatro(DataGridViewX dgv, int indicatorId, int modelId)
        {
            if (dgv.Name == "dgv_selected")//已选-》待选
            {
                var currentRoundIndicatorList = TaskResultCache.getCache().Where(r => r.indicatorId == indicatorId && r.modelId == modelId && r.taskId == taskInfoId && r.taskStep == maxTaskStep && r.taskRound == currentRound).ToList();
                if (currentRoundIndicatorList[0].taskResult == 2) //表示已通过
                {
                    moveIndicator(selectedIndicatorModelList, unselectedIndicatorModelList, indicatorId, modelId);
                }
                else//1表示未通过,无法将该指标移到已选队列
                {
                    MessageBoxEx.Show("该指标未通过,无法移到待选", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
            }
            else//待选=》已选
            {
                moveIndicator(unselectedIndicatorModelList, selectedIndicatorModelList, indicatorId, modelId);
            }

            bindDgv();
        }
Esempio n. 8
0
        /// <summary>
        /// 绑定轮次显示
        /// </summary>
        private void bindTaskRound()
        {
            var orderRoundList = TaskResultCache.getCache().Where(r => r.taskId == taskInfoId).GroupBy(r => r.taskRound).OrderBy(r => r.Key).ToList();

            if (orderRoundList.Count == 0)
            {
                currentRound   = 1;
                maxRound       = 1;
                lbl_round.Text = string.Format("{0}/{1}", currentRound, maxRound);
                //ButtonItem btn_round = new ButtonItem();
                //btn_round.ShowSubItems = false;
                //btn_round.SubItemsExpandWidth = 14;
                //btn_round.Text = "1";
                //btn_round.Click += new System.EventHandler(btn_round_Click);
                //btn_round.Checked = true;
                //this.ribbonBar_taskRound.Items.Add(btn_round);
            }
            else
            {
                lbl_round.Text = string.Format("{0}/{1}", currentRound, orderRoundList.Count);
                //foreach (var tr in orderRoundList)
                //{
                //    int round = tr.Key;
                //    ButtonItem btn_round = new ButtonItem();
                //    btn_round.ShowSubItems = false;
                //    btn_round.SubItemsExpandWidth = 14;
                //    btn_round.Text = round.ToString();
                //    btn_round.Click += new System.EventHandler(btn_round_Click);
                //    if (round == currentRound)
                //    {
                //        btn_round.Checked = true;
                //    }
                //    this.ribbonBar_taskRound.Items.Add(btn_round);
                //}
                maxRound = orderRoundList.Count;
            }
        }
Esempio n. 9
0
 public void init(int taskStateId)
 {
     this._taskStateId = taskStateId;
     if (taskStateId == (int)TaskStateEnum.Created)//如果是新建任务,则显示通过、驳回
     {
         btn_done.Visible     = false;
         btn_save.Visible     = false;
         btn_close.Visible    = false;
         btn_newRound.Visible = false;
         trp.init(taskInfoId, true, currentRound); //此时只读
         showTaskRound_Panel.Visible = false;      //不显示轮次操作
     }
     else//如果是处理中的任务,显示保存、完成、关闭
     {
         btn_pass.Visible   = false;
         btn_reject.Visible = false;
         List <Tb_taskResult> resultList = TaskResultCache.getCache().Where(t => t.taskId == taskInfoId).ToList();
         try
         {
             maxRound = resultList.Max(x => x.taskRound);
         }
         catch (Exception ex)
         {
         }
         if (maxRound == currentRound)
         {
             trp.init(taskInfoId, false, currentRound);
         }
         else
         {
             trp.init(taskInfoId, true, currentRound);
         }
     }
     bindTaskRound();
     tdbip.init(taskInfoId);
     checkAndSignFirstOpen();
 }
Esempio n. 10
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            List <Tb_taskResult> resultList = new List <Db.Entity.Tb_taskResult>();

            //int oldRound = -1;
            if (currentRound != maxRound)
            {
                MessageBoxEx.Show("当前轮次不是最大轮次,无法保存", "操作提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            //foreach (DataGridViewRow dr in trp.dgv.Rows)
            //{
            //    if (dr.Cells["taskRecord"].Value == null)
            //    {
            //        dr.Cells["taskRecord"].Value = "";
            //    }
            //    if (dr.Cells["taskRemark"].Value == null)
            //    {
            //        dr.Cells["taskRemark"].Value = "";
            //    }
            //    if (dr.Cells["attachment"].Value == null)
            //    {
            //        dr.Cells["attachment"].Value = "";
            //    }
            //    //如果修改过测试结果,或是测试结果内有内容(无论是否本次输入),都保存
            //    if (dr.Cells["taskResult"].Style.BackColor == Color.LightSeaGreen
            //        || dr.Cells["taskRecord"].Style.BackColor == Color.LightSeaGreen
            //        || dr.Cells["taskRemark"].Style.BackColor == Color.LightSeaGreen
            //        || dr.Cells["attachmentCount"].Style.BackColor == Color.LightSeaGreen
            //        || dr.Cells["taskResult"].Value.ToString() != "0"
            //        || dr.Cells["taskRecord"].Value.ToString() != string.Empty
            //        || dr.Cells["taskRemark"].Value.ToString() != string.Empty
            //        || dr.Cells["attachment"].Value.ToString() != string.Empty)
            //    {
            //        Tb_taskResult result = new Tb_taskResult();
            //        result.indicatorId = (int)dr.Cells["indicatorId"].Value;
            //        result.modelId = (int)dr.Cells["modelId"].Value;
            //        result.taskDateTime = DateTime.Now;
            //        result.taskExecutor = User.currentUser.name;
            //        result.taskId = taskInfoId;
            //        result.taskRecord = dr.Cells["taskRecord"].Value == null ? "" : dr.Cells["taskRecord"].Value.ToString();
            //        result.taskRemark = dr.Cells["taskRemark"].Value.ToString();
            //        result.taskResult = (int)dr.Cells["taskResult"].Value;
            //        result.attachment = dr.Cells["attachment"].Value.ToString();
            //        result.supplement = dr.Cells["supplement"].Value == null ? "" : dr.Cells["supplement"].Value.ToString();
            //        result.taskStep = maxTaskStep + 1;
            //        result.taskRound = currentRound;
            //        //result.taskRound = int.Parse(labelItem2.Text);
            //        resultList.Add(result);

            //        //保存任务之时,判断当前项是否填写完整,如果填写完整,则修改该控件下的isFillFinish值
            //        if (result.taskResult != 0 && result.taskRecord != "")
            //        {
            //            dr.Cells["isFill"].Value = 1;
            //        }
            //    }
            //}
            foreach (var item in trp.allResultModelList)
            {
                if (item.isHaveModi == 1)
                {
                    Tb_taskResult result = new Tb_taskResult();
                    result.indicatorId = item.indicatorId;
                    result.modelId     = item.modelId;
                    DateTime taskDateTime;
                    result.taskDateTime = DateTime.TryParse(item.taskDateTime, out taskDateTime) ? taskDateTime : DateTime.Now;
                    //result.taskDateTime = DateTime.TryParse(dr.Cells["taskDateTime"].Value.ToString(), out taskDateTime) ? taskDateTime : DateTime.Now;//DateTime.Now;
                    result.taskExecutor = User.currentUser.name;
                    result.taskId       = taskInfoId;
                    result.taskRecord   = item.taskRecord;
                    result.taskRemark   = item.taskRemark;
                    result.taskResult   = item.taskResult;
                    result.attachment   = item.attachment;
                    result.supplement   = item.supplement;
                    result.taskStep     = maxTaskStep + 1;
                    result.taskRound    = currentRound;
                    //result.taskRound = int.Parse(labelItem2.Text);
                    resultList.Add(result);

                    if (result.taskResult != 0 && result.taskRecord != "")
                    {
                        item.isFillFinish = 1;
                    }
                }
            }
            if (resultList.Count > 0)
            {
                TaskResultCache.addCache(resultList);                         //添加测试记录
                var taskInfo            = TaskCache.getCacheById(taskInfoId); //更新任务进度字段
                var taskResultMainCount = trp.getAllResultModelCount();
                taskInfo.percent = resultList.Count * 100 / taskResultMainCount;
                TaskCache.addCache(taskInfo);
                //刷新单元格背景色为白色
                foreach (DataGridViewRow dr in trp.dgv.Rows)
                {
                    dr.Cells["taskResult"].Style.BackColor      = Color.White;
                    dr.Cells["taskRecord"].Style.BackColor      = Color.White;
                    dr.Cells["taskRemark"].Style.BackColor      = Color.White;
                    dr.Cells["attachmentCount"].Style.BackColor = Color.White;
                    dr.Cells["taskStep"].Value = int.Parse(dr.Cells["taskStep"].Value.ToString()) + 1;
                }
                MainFormAdapter.reloadTaskMainPanel();
                maxTaskStep++;//最大步骤编号,每次保存,都加1,如果切换轮次,需重新获取该轮次的最大步骤编号
                trp.maxResultStep     = maxTaskStep;
                trp.currentResultStep = maxTaskStep;
            }
        }
        public List <TaskResultModel> getData(int step, int round)
        {
            var taskIndicatorMapList = TaskIndicatorMapCache.getCache().Where(i => i.taskId == taskId).ToList();
            var indicatorList        = IndicatorCache.getCache();
            var brandList            = CodeCache.getBrand();
            var modelList            = CodeCache.getModel();
            var taskModelList        = TaskModelMapCache.getCache();

            taskResultMapList = TaskResultCache.getCache().Where(t => t.taskId == taskId && t.taskRound == taskRound).ToList();
            if (round == 1)
            {
                //todo ***************确定后将下列ToList都去掉******************
                var brand_model_list = (from brand in brandList
                                        from model in modelList
                                        where brand.id == model.parentId
                                        select new
                {
                    modelId = model.id,
                    modelName = model.codeName,
                    brandId = brand.id,
                    brandName = brand.codeName
                }).ToList();

                var task_model_indicator_list = (from taskIndicator in taskIndicatorMapList
                                                 from taskModel in taskModelList
                                                 from bm in brand_model_list
                                                 where taskIndicator.taskId == taskId && taskModel.taskId == taskId && taskModel.ModelId == bm.modelId
                                                 select new
                {
                    taskIndicator,
                    bm.brandId,
                    bm.brandName,
                    bm.modelId,
                    bm.modelName
                }).ToList();

                var list_indicator = (from indicator in task_model_indicator_list
                                      join result in taskResultMapList.Where(r => r.taskStep == step && r.taskRound == round)
                                      on new { indicator.taskIndicator.indicatorId, indicator.modelId }
                                      equals new { result.indicatorId, result.modelId } into temp
                                      from tt in temp.DefaultIfEmpty()
                                      select new
                {
                    indicator,
                    taskRecord = tt == null ? "" : tt.taskRecord,
                    taskResult = tt == null ? 0 : tt.taskResult,
                    taskRemark = tt == null ? "" : tt.taskRemark,
                    attachment = tt == null ? "" : tt.attachment,
                    taskExecutor = tt == null ? "" : tt.taskExecutor,
                    taskDateTime = tt == null ? "" : tt.taskDateTime.ToString(),
                    taskStep = tt == null ? 0 : tt.taskStep,
                    modelId = tt == null ? 0 : tt.modelId,
                    taskResultId = tt == null ? 0 : tt.id,
                    supplement = tt == null ? "" : tt.supplement
                }).ToList();

                allResultModelList = (from temp in list_indicator
                                      from indicator in indicatorList
                                      where temp.indicator.taskIndicator.indicatorId == indicator.id
                                      select new TaskResultModel
                {
                    indicatorId = indicator.id,
                    indicatorName = indicator.indicatorName,
                    indicatorDesc = indicator.indicatorDesc,
                    indicatorInstr = indicator.indicatorInstr,
                    taskDateTime = temp.taskDateTime,
                    taskStep = temp.taskStep,
                    taskExecutor = temp.taskExecutor,
                    taskRecord = temp.taskRecord,
                    taskRemark = temp.taskRemark,
                    attachment = temp.attachment,
                    attachmentCount = (temp.attachment == string.Empty ? "" : temp.attachment.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Count() + "个")
                                      + (temp.supplement == "" ? "" : "(补)"),
                    taskResult = temp.taskResult,
                    modelId = temp.indicator.modelId,
                    modelName = temp.indicator.modelName,
                    brandId = temp.indicator.brandId,
                    brandName = temp.indicator.brandName,
                    taskResultId = temp.taskResultId,
                    supplement = temp.supplement,
                    isFillFinish = (temp.taskResult == 0 && temp.taskRecord == "") ? 0 : 1,
                    isHaveModi = ((temp.taskResult != 0 || temp.taskRecord != "" || temp.taskRemark != "" || temp.attachment != "" || temp.supplement != "") ? 1:0)
                }).ToList();
            }
            else
            {
                var initStepList = TaskResultCache.getCache().Where(r => r.taskId == taskId && r.taskRound == taskRound && r.taskResult == 0 && r.taskStep == 1).ToList();
                var a            = (from initStep in initStepList
                                    join result in
                                    TaskResultCache.getCache().Where(r => r.taskId == taskId && r.taskRound == taskRound && r.taskStep == step).ToList()
                                    on new { initStep.modelId, initStep.indicatorId }
                                    equals new { result.modelId, result.indicatorId } into temp
                                    from tt in temp.DefaultIfEmpty()
                                    select new Tb_taskResult
                {
                    id = initStep.id,
                    taskRecord = (tt == null?"": tt.taskRecord),
                    attachment = (tt == null ?"":tt.attachment),
                    taskResult = (tt == null?0:tt.taskResult),
                    taskId = initStep.taskId,
                    taskStep = step,
                    taskRound = round,
                    taskExecutor = initStep.taskExecutor,
                    taskDateTime = tt == null? DateTime.Now: tt.taskDateTime,
                    modelId = initStep.modelId,
                    indicatorId = initStep.indicatorId,
                    taskRemark = (tt == null ? "" : tt.taskRemark),
                    supplement = (tt == null ? "" : tt.supplement),
                }).ToList();

                allResultModelList = (from resultList in a
                                      from indicator in indicatorList
                                      from brand in brandList
                                      from model in modelList
                                      where resultList.modelId == model.id &&
                                      model.parentId == brand.id &&
                                      resultList.indicatorId == indicator.id &&
                                      resultList.taskId == taskId &&
                                      resultList.taskRound == round &&
                                      resultList.taskStep == step
                                      select new TaskResultModel
                {
                    indicatorId = resultList.indicatorId,
                    indicatorName = indicator.indicatorName,
                    indicatorDesc = indicator.indicatorDesc,
                    indicatorInstr = indicator.indicatorInstr,
                    brandId = brand.id,
                    brandName = brand.codeName,
                    modelId = model.id,
                    modelName = model.codeName,
                    taskStep = resultList.taskStep,
                    taskExecutor = resultList.taskExecutor,
                    taskDateTime = resultList.taskDateTime.ToString(),
                    taskRecord = resultList.taskRecord,
                    taskResult = resultList.taskResult,
                    taskResultId = resultList.id,
                    taskRemark = resultList.taskRemark,
                    attachment = resultList.attachment,
                    attachmentCount = (resultList.attachment == string.Empty ? "" : resultList.attachment.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Count() + "个")
                                      + (resultList.supplement == "" ? "" : "(补)"),
                    supplement = resultList.supplement,
                    isFillFinish = (resultList.taskResult == 0 && resultList.taskRecord == "") ? 0 : 1,
                    isHaveModi = ((resultList.taskResult != 0 || resultList.taskRecord != "" || resultList.taskRemark != "" || resultList.attachment != "" || resultList.supplement != "") ? 1 : 0)
                }).ToList();
            }

            pagingPanel.setDetail(allResultModelList.Count);
            return(allResultModelList.Skip(pageSize * (pageNum - 1)).Take(pageSize).ToList());
        }
        public void maxRoundInit(int taskInfoId, bool readOnly = false, int taskRound = 1)
        {
            taskId            = taskInfoId;
            this.taskRound    = taskRound;
            taskResultMapList = TaskResultCache.getCache().Where(t => t.taskId == taskId && t.taskRound == taskRound && t.taskStep == 1).ToList();
            List <Tb_taskResult> allResult = TaskResultCache.getCache().Where(t => t.taskId == taskId && t.taskRound == taskRound).ToList();

            maxResultStep = 0;
            try
            {
                maxResultStep     = allResult.Max(x => x.taskStep);
                currentResultStep = maxResultStep;
            }
            catch (Exception ex)
            {
            }
            var result = (from resultList in taskResultMapList
                          join resultAll in TaskResultCache.getCache().Where(r => r.taskId == taskInfoId && r.taskStep == maxResultStep && r.taskRound == taskRound)
                          on new { resultList.indicatorId, resultList.modelId }
                          equals new { resultAll.indicatorId, resultAll.modelId } into temp
                          from tt in temp.DefaultIfEmpty()
                          select new
            {
                attachment = tt == null? resultList.attachment: tt.attachment,
                resultList.id,
                resultList.indicatorId,
                resultList.modelId,
                supplement = tt == null? resultList.supplement: tt.supplement,
                taskDateTime = tt == null? resultList.taskDateTime: tt.taskDateTime,
                resultList.taskExecutor,
                resultList.taskId,
                taskRecord = tt == null? resultList.taskRecord: tt.taskRecord,
                taskRemark = tt == null? resultList.taskRemark: tt.taskRemark,
                taskResult = tt == null? resultList.taskResult: tt.taskResult,
                taskRound = taskRound,
                taskStep = maxResultStep
                           //resultList.taskRecord = tt.taskRecord
            }).ToList();
            var indicatorList = IndicatorCache.getCache();
            var brandList     = CodeCache.getBrand();
            var modelList     = CodeCache.getModel();

            allResultModelList = (from resultList in result
                                  from indicator in indicatorList
                                  from brand in brandList
                                  from model in modelList
                                  where resultList.modelId == model.id &&
                                  model.parentId == brand.id &&
                                  resultList.indicatorId == indicator.id
                                  select new TaskResultModel
            {
                indicatorId = resultList.indicatorId,
                indicatorName = indicator.indicatorName,
                indicatorDesc = indicator.indicatorDesc,
                indicatorInstr = indicator.indicatorInstr,
                brandId = brand.id,
                brandName = brand.codeName,
                modelId = model.id,
                modelName = model.codeName,
                taskStep = resultList.taskStep,
                taskExecutor = resultList.taskExecutor,
                taskDateTime = resultList.taskDateTime.ToString(),
                taskRecord = resultList.taskRecord,
                taskResult = resultList.taskResult,
                taskResultId = resultList.id,
                taskRemark = resultList.taskRemark,
                attachment = resultList.attachment,
                attachmentCount = (resultList.attachment == string.Empty ? "" : resultList.attachment.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries).Count() + "个")
                                  + (resultList.supplement == "" ? "" : "(补)"),
                supplement = resultList.supplement,
                isFillFinish = (resultList.taskResult == 0 && resultList.taskRecord == "") ? 0 : 1,
                isHaveModi = ((resultList.taskResult != 0 || resultList.taskRecord != "" || resultList.taskRemark != "" || resultList.attachment != "" || resultList.supplement != "") ? 1 : 0)
            }).ToList();
            dgv.DataSource = null;
            pagingPanel.setDetail(allResultModelList.Count);
            //return allResultModelList.Skip(pageSize * (pageNum - 1)).Take(pageSize).ToList();
            dgv.DataSource = allResultModelList.Skip(pageSize * (pageNum - 1)).Take(pageSize).ToList();
            setReadOnly(readOnly);
        }
Esempio n. 13
0
        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;
        }
Esempio n. 14
0
        private void lbl_showHistory_Click(object sender, EventArgs e)
        {
            panel_history.Visible = true;
            //代码添加button按钮,查看页面布局
            List <Tb_taskResult> resultList = TaskResultCache.getCache().Where(t => t.taskId == taskInfoId).ToList();

            try
            {
                maxRound = resultList.Max(x => x.taskRound);
            }
            catch (Exception ex)
            {
            }
            currentRound = 1;
            currentStep  = 1;
            Point point = new Point();

            if (maxRound >= 10)
            {
                point.X = 158;
                point.Y = Btn_nextRound.Location.Y;
                Btn_nextRound.Location = point;
            }
            else
            {
                point.X = 148;
                point.Y = Btn_nextRound.Location.Y;
                Btn_nextRound.Location = point;
            }

            if (maxRound > 0)
            {
                lbl_roundText.Text = string.Format("{0}/{1}", currentRound, maxRound);
            }
            else
            {
                lbl_roundText.Text = string.Format("{0}/{1}", currentRound, 1);
            }
            if (currentRound == maxRound || maxRound == 0)
            {
                Btn_nextRound.Enabled = false;
            }
            else
            {
                Btn_nextRound.Enabled = true;
            }
            if (currentRound == 1)
            {
                Btn_lastRound.Enabled = false;
            }
            else
            {
                Btn_lastRound.Enabled = true;
            }
            //taskRound_BtnColl.AutoSize = true;
            //this.task
            maxStep = trp.getHistory();//显示第一轮,并返回总步骤
            if (maxStep > 0)
            {
                lbl_current.Text     = "1/" + maxStep;
                btn_previous.Enabled = false;
                if (maxStep > 1)
                {
                    btn_next.Enabled = true;
                }
                else
                {
                    btn_next.Enabled = false;
                }
            }
            else
            {
                lbl_current.Text     = "尚无步骤";
                btn_next.Enabled     = false;
                btn_previous.Enabled = false;
                point.X                   = 350;
                point.Y                   = btn_next.Location.Y;
                btn_next.Location         = point;
                point.X                   = 388;
                point.Y                   = ben_closeHistory.Location.Y;
                ben_closeHistory.Location = point;
            }
        }