Example #1
0
        public virtual bool UpdateRow(int Row, int Col)
        {
            SourceGrid.Cells.ICell cell = this[Row + FixedRows, Col + FixedColumns];
            string value = (string)cell.Value;
            string Value = string.Empty;

            switch (Fields[Row].ValueType)
            {
            case ValueTypeEnum.Number:

                float fv;
                if (!float.TryParse(value, out fv))
                {
                    cell.Value = "";
                    Value      = string.Empty;
                }
                else
                {
                    Value = fv.ToString("f" + Fields[Row].Precision);
                }
                break;

            case ValueTypeEnum.Logic:
            case ValueTypeEnum.Selection:
                Value = value;
                if (Value == null)
                {
                    Value = string.Empty;
                }
                break;
            }
            CheckData data = (CheckData)cell.Tag;

            if (data.DataValue != Value)
            {
                data.DataValue = Value;
                //data.State = DataState.Changed;
                ReturnValue rv = UpdateItem(data, Fields[Row].StandardStr);
                if (rv.Success)
                {
                    bool bFinished = false;
                    for (int index = 0; index < SampleCount; index++)
                    {
                        string str = (string)this[Row + FixedRows, index + HeaderCount].Value;
                        if (!string.IsNullOrWhiteSpace(str))
                        {
                            bFinished = true;
                            break;
                        }
                    }
                    //SampleItemOrder.SetFinishedCheckItem(Order, data.CheckItemID, bFinished);
                    SetCellColor(cell, data);
                }
            }
            return(true);
        }
Example #2
0
        public QualifyJudgeEnum QualifyJudge(int Row)
        {
            InputField field = Fields[Row];

            if (string.IsNullOrWhiteSpace(field.StandardStr))
            {
                return(QualifyJudgeEnum.UnJudge);
            }
            if (field.ValueType == ValueTypeEnum.Selection)
            {
                return(QualifyJudgeEnum.UnJudge);
            }
            // List<string> values = new List<string>();
            List <CheckData> datas     = new List <CheckData>();
            bool             bUnFinish = true;
            int passcount = 0;

            for (int index = 0; index < SampleCount; index++)
            {
                SourceGrid.Cells.ICell cell = this[Row + FixedRows, index + HeaderCount];
                //string value = (string)cell.Value;
                CheckData data = (CheckData)cell.Tag;
                if (!string.IsNullOrWhiteSpace(data.DataValue))
                {
                    bUnFinish = false;
                    //return QualifyJudgeEnum.UnFinish;
                    datas.Add(data);
                    bool isfalse = data.IsFalse;
                    data.SetPass(field.StandardStr);
                    if (isfalse != data.IsFalse)
                    {
                        data.State = DataState.Changed;
                        Encode.EncodeData.SaveDatas <CheckData>(new EncodeCollection <CheckData>(data));
                    }
                    SetCellColor(cell, data);
                    if (!data.IsFalse)
                    {
                        passcount++;
                    }
                    //values.Add(data);
                    // break;
                }
            }
            if (bUnFinish)
            {
                return(QualifyJudgeEnum.UnFinish);
            }
            //int passcount = 0;
            //if (!string.IsNullOrWhiteSpace(field.StandardStr))
            //{
            //    //SSIT.Expression.ECompileExpression ece = SSIT.Expression.ECompileExpression.GetInstance(field.StandardStr);
            //    foreach (CheckData data in datas)
            //    {
            //        data.SetPass(field.StandardStr);
            //        if (!data.IsFalse)
            //        {
            //            passcount++;
            //        }
            //        //switch (field.ValueType)
            //        //{
            //        //    case ValueTypeEnum.Number:
            //        //        if (ece.CheckValue(value) == Expression.ExpressionResult.TRUE)
            //        //            passcount++;
            //        //        break;
            //        //    case ValueTypeEnum.Logic:
            //        //        if(value == EncodeConst.RightMark)
            //        //        {
            //        //            passcount++;
            //        //        }
            //        //        break;
            //        //}
            //    }
            //}

            float rate = 100f * passcount / datas.Count;

            this[Row + FixedRows, SampleCount + HeaderCount].Value = rate.ToString("f2");
            if (rate >= field.QualifyRate)
            {
                return(QualifyJudgeEnum.Pass);
            }
            else
            {
                return(QualifyJudgeEnum.False);
            }
        }