예제 #1
0
        public async Task <ActionResult> Delete(string key)
        {
            MethodReturnResult result = new MethodReturnResult();

            using (CalibrationPlateServiceClient client = new CalibrationPlateServiceClient())
            {
                result = await client.DeleteAsync(key);

                if (result.Code == 0)
                {
                    result.Message = string.Format(FMMResources.StringResource.CalibrationPlate_Delete_Success
                                                   , key);
                }
                return(Json(result));
            }
        }
예제 #2
0
        //
        // GET: /FMM/CalibrationPlate/Modify
        public async Task <ActionResult> Modify(string CalibrationPlateID)
        {
            CalibrationPlateViewModel viewModel = new CalibrationPlateViewModel();

            using (CalibrationPlateServiceClient client = new CalibrationPlateServiceClient())
            {
                MethodReturnResult <CalibrationPlate> result = await client.GetAsync(CalibrationPlateID);

                if (result.Code == 0)
                {
                    viewModel = new CalibrationPlateViewModel()
                    {
                        CalibrationPlateID   = result.Data.Key,
                        CalibrationPlateType = result.Data.CalibrationPlateType,
                        CalibrationPlateName = result.Data.CalibrationPlateName,
                        PM         = result.Data.PM,
                        ISC        = result.Data.ISC,
                        VOC        = result.Data.VOC,
                        MaxPM      = result.Data.MaxPM,
                        MinPM      = result.Data.MinPM,
                        MaxISC     = result.Data.MaxISC,
                        MinISC     = result.Data.MinISC,
                        MaxVOC     = result.Data.MaxVOC,
                        MinVOC     = result.Data.MinVOC,
                        StdIsc1    = result.Data.StdIsc1, //标准电流1
                        StdIsc2    = result.Data.StdIsc2, //标准电流2
                        Stdsun1    = result.Data.Stdsun1, //标准光强1
                        Stdsun2    = result.Data.Stdsun2, //标准光强2
                        Explain    = result.Data.Explain,
                        Creator    = result.Data.Creator,
                        CreateTime = result.Data.CreateTime,
                        Editor     = result.Data.Editor,
                        EditTime   = result.Data.EditTime
                    };
                    return(PartialView("_ModifyPartial", viewModel));
                }
                else
                {
                    ModelState.AddModelError("", result.Message);
                }
            }
            return(PartialView("_ModifyPartial"));
        }
예제 #3
0
        public async Task <ActionResult> SaveModify(CalibrationPlateViewModel model)
        {
            using (CalibrationPlateServiceClient client = new CalibrationPlateServiceClient())
            {
                MethodReturnResult <CalibrationPlate> result = await client.GetAsync(model.CalibrationPlateID);

                if (result.Code == 0)
                {
                    result.Data.CalibrationPlateType = model.CalibrationPlateType;
                    result.Data.CalibrationPlateName = model.CalibrationPlateName;
                    result.Data.PM       = model.PM;
                    result.Data.ISC      = model.ISC;
                    result.Data.VOC      = model.VOC;
                    result.Data.MaxPM    = model.MaxPM;
                    result.Data.MinPM    = model.MinPM;
                    result.Data.MaxISC   = model.MaxISC;
                    result.Data.MinISC   = model.MinISC;
                    result.Data.MaxVOC   = model.MaxVOC;
                    result.Data.MinVOC   = model.MinVOC;
                    result.Data.StdIsc1  = model.StdIsc1;
                    result.Data.StdIsc2  = model.StdIsc2;
                    result.Data.Stdsun1  = model.Stdsun1;
                    result.Data.Stdsun2  = model.Stdsun2;
                    result.Data.Explain  = model.Explain;
                    result.Data.Editor   = User.Identity.Name;
                    result.Data.EditTime = DateTime.Now;
                    MethodReturnResult rst = await client.ModifyAsync(result.Data);

                    if (rst.Code == 0)
                    {
                        rst.Message = string.Format(FMMResources.StringResource.CalibrationPlate_SaveModify_Success
                                                    , result.Data.Key);
                    }
                    return(Json(rst));
                }
                return(Json(result));
            }
        }
예제 #4
0
        public async Task <ActionResult> Save(CalibrationPlateViewModel model)
        {
            using (CalibrationPlateServiceClient client = new CalibrationPlateServiceClient())
            {
                CalibrationPlate obj = new CalibrationPlate()
                {
                    Key = model.CalibrationPlateID,
                    CalibrationPlateType = model.CalibrationPlateType,
                    CalibrationPlateName = model.CalibrationPlateName,
                    PM         = model.PM,
                    ISC        = model.ISC,
                    VOC        = model.VOC,
                    MaxPM      = model.MaxPM,
                    MinPM      = model.MinPM,
                    MaxISC     = model.MaxISC,
                    MinISC     = model.MinISC,
                    MaxVOC     = model.MaxVOC,
                    MinVOC     = model.MinVOC,
                    StdIsc1    = model.StdIsc1,
                    StdIsc2    = model.StdIsc2,
                    Stdsun1    = model.Stdsun1,
                    Stdsun2    = model.Stdsun2,
                    Explain    = model.Explain,
                    Creator    = User.Identity.Name,
                    CreateTime = DateTime.Now,
                    Editor     = User.Identity.Name,
                    EditTime   = DateTime.Now,
                };
                MethodReturnResult rst = await client.AddAsync(obj);

                if (rst.Code == 0)
                {
                    rst.Message = string.Format(FMMResources.StringResource.CalibrationPlate_Save_Success
                                                , obj.Key);
                }
                return(Json(rst));
            }
        }
예제 #5
0
        /// <summary> 获取校准板列表 </summary>
        /// <returns></returns>
        public IEnumerable <SelectListItem> GetCalibrationPlateIDList()
        {
            IList <CalibrationPlate> lst = new List <CalibrationPlate>();
            PagingConfig             cfg = new PagingConfig()
            {
                IsPaging = false,
            };

            using (CalibrationPlateServiceClient client = new CalibrationPlateServiceClient())
            {
                MethodReturnResult <IList <CalibrationPlate> > result = client.Get(ref cfg);
                if (result.Code <= 0 && result.Data != null)
                {
                    lst = result.Data;
                }
            }
            return(from item in lst
                   select new SelectListItem()
            {
                Text = item.Key,
                Value = item.Key
            });
        }
예제 #6
0
        public SortedList <string, string> AssembleSpline(DataTable dtIVTESTDataForSpline, WIPIVTestGetParameter parameter)
        {
            SPCJobParam jobParam = null;

            using (SPCJobServiceClient client = new SPCJobServiceClient())
            {
                MethodReturnResult <IList <SPCJobParam> > retJobParams = client.GetJobParams("1");
                if (retJobParams.Code == 0 && retJobParams.Data != null && retJobParams.Data.Count > 0)
                {
                    foreach (SPCJobParam job in retJobParams.Data)
                    {
                        jobParam = job;
                    }
                }
            }

            string strup = string.Empty, strlow = string.Empty;
            string strUb = string.Empty, strUs = string.Empty;
            string strLc = string.Empty, strLs = string.Empty, strLb = string.Empty;
            string strLmax = string.Empty, strLmin = string.Empty, strLYinterval = string.Empty;
            string strTg = string.Empty;

            // string[] arrEqpCode = parameter.EquipmentCode.Replace("'", "").Split(',');
            string[] arrEqpCode = dtIVTESTDataForSpline.Rows[0]["EQUIPMENT_CODE"].ToString().Replace("'", "").Split(',');

            List <string> list = new List <string>();

            System.Collections.Hashtable hsDrawLinesY = new System.Collections.Hashtable();
            StringBuilder strBuilderX = new StringBuilder();
            StringBuilder strBuildera = new StringBuilder();

            System.Collections.Hashtable hsDrawLinesX = new System.Collections.Hashtable();
            StringBuilder strBuilderY = new StringBuilder();

            if (arrEqpCode.Length > 0)
            {
                foreach (var data in arrEqpCode)
                {
                    if (!string.IsNullOrEmpty(parameter.Attr_1))
                    {
                        list.Add(data + parameter.Attr_1);
                    }
                    else
                    {
                        list.Add(data);
                    }
                }
            }

            foreach (string botaId in list)
            {
                strBuilderY = new StringBuilder();
                hsDrawLinesY.Add(botaId, strBuilderY);
            }
            var query = from t in dtIVTESTDataForSpline.AsEnumerable()
                        group t by new { t1 = t.Field <DateTime>("TEST_TIME") } into m
                select new
            {
                TEST_TIME = m.First().Field <DateTime>("TEST_TIME")
            };
            int j = 0;

            foreach (var data in query)
            {
                hsDrawLinesX.Add(data.TEST_TIME.ToString(), j);
                strBuilderX.Append("'" + data.TEST_TIME.ToString() + "',");//X
                j = j + 1;
            }
            int       indexOfX    = 0;
            Hashtable hsDrawPoint = new Hashtable();

            for (int i = 0; i < dtIVTESTDataForSpline.Rows.Count; i++)
            {
                string dbKey = "";
                if (!string.IsNullOrEmpty(parameter.Attr_1))
                {
                    dbKey = dtIVTESTDataForSpline.Rows[i]["EQUIPMENT_CODE"].ToString() + dtIVTESTDataForSpline.Rows[i]["ATTR_1"].ToString();
                }
                else
                {
                    dbKey = dtIVTESTDataForSpline.Rows[i]["EQUIPMENT_CODE"].ToString();
                }

                foreach (object key in hsDrawLinesY.Keys)
                {
                    strBuilderY = (StringBuilder)hsDrawLinesY[key];
                    string valueOfY = "";

                    string strPointOfX = "";
                    string strKey      = (string)key;
                    if (string.Compare(strKey, dbKey, true) == 0)
                    {
                        if (String.IsNullOrEmpty(dtIVTESTDataForSpline.Rows[i]["PM"].ToString()))
                        {
                            valueOfY = "null";
                        }
                        else
                        {
                            valueOfY = dtIVTESTDataForSpline.Rows[i]["PM"].ToString();
                        }

                        if (hsDrawLinesX.ContainsKey(dtIVTESTDataForSpline.Rows[i]["TEST_TIME"].ToString()))
                        {
                            indexOfX = (int)hsDrawLinesX[dtIVTESTDataForSpline.Rows[i]["TEST_TIME"].ToString()];
                        }
                        strPointOfX = strKey + indexOfX.ToString();

                        if (hsDrawPoint.ContainsKey(strPointOfX))
                        {
                            if (valueOfY != "null")
                            {
                                hsDrawPoint[strPointOfX] = valueOfY;
                            }
                        }
                        else
                        {
                            hsDrawPoint.Add(strPointOfX, valueOfY);
                        }
                    }
                }
            }
            ArrayList XKey = new ArrayList(hsDrawLinesX.Values);

            XKey.Sort();
            int nMaxOfXPoint   = hsDrawLinesX.Count;
            int nMinOfXPoint   = 1;
            int nIndexOfXPoint = 1;

            foreach (object val in XKey)
            {
                foreach (object key in hsDrawLinesY.Keys)
                {
                    strBuilderY = (StringBuilder)hsDrawLinesY[key];
                    string strKey = key.ToString() + val.ToString();
                    if (hsDrawPoint.ContainsKey(strKey))
                    {
                        strBuilderY.Append("[" + val + "," + (string)hsDrawPoint[strKey] + "],");
                    }
                    else
                    {
                        strBuilderY.Append("[" + val + ",null],");
                    }
                }
                if (jobParam != null && (nIndexOfXPoint == nMinOfXPoint || nIndexOfXPoint == nMaxOfXPoint))
                {
                    if (parameter.CalibrationId != null && parameter.CalibrationId != "")
                    {
                        using (CalibrationPlateServiceClient client = new CalibrationPlateServiceClient())
                        {
                            MethodReturnResult <CalibrationPlate> result = client.Get(parameter.CalibrationId);
                            if (result.Code == 0)
                            {
                                //5条控制线
                                //strUs = strUs + jobParam.UpperSpecification.ToString() + ",";
                                //strup = strup + jobParam.UpperControl.ToString() + ",";
                                //strTg = strTg + jobParam.Target.ToString() + ",";
                                //strlow = strlow + jobParam.LowerControl.ToString() + ",";
                                //strLs = strLs + jobParam.LowerSpecification.ToString() + ",";
                                strUs  = strUs + result.Data.MaxPM + ",";;
                                strup  = strup + result.Data.MaxPM + ",";
                                strTg  = strTg + jobParam.Target.ToString() + ",";
                                strlow = strlow + result.Data.MinPM + ",";
                                strLs  = strLs + result.Data.MinPM + ",";
                            }
                        }
                    }

                    else
                    {
                        strUs  = strUs + jobParam.UpperSpecification.ToString() + ",";
                        strup  = strup + jobParam.UpperControl.ToString() + ",";
                        strTg  = strTg + jobParam.Target.ToString() + ",";
                        strlow = strlow + jobParam.LowerControl.ToString() + ",";
                        strLs  = strLs + jobParam.LowerSpecification.ToString() + ",";
                    }

                    //y轴最大最小值以及间距
                    strLmax       = jobParam.LineUpper.ToString();
                    strLmin       = jobParam.LineLower.ToString();
                    strLYinterval = jobParam.LineYinterval.ToString();
                }
                else
                {
                    strup  = strup + "null,";
                    strlow = strlow + "null,";
                    strUb  = strUb + "null,";
                    strUs  = strUs + "null,";
                    strTg  = strTg + "null,";
                    strLb  = strLb + "null,";
                    strLs  = strLs + "null,";
                }
                nIndexOfXPoint = nIndexOfXPoint + 1;
            }

            var    strx      = @"[" + strBuilderX.ToString().Trim(',') + "]";
            string stryLevel = strLmax + "|" + strLmin + "|" + strLYinterval;
            var    stry      = "";

            stry = @"[";
            stry = stry + "{ name: 'USL=" + strUs.Substring(0, strUs.IndexOf(',')) + "',type:'spline', data: [" + strUs.Trim(',') + "]},";
            stry = stry + "{ name: 'UCL=" + strup.Substring(0, strup.IndexOf(',')) + "',type:'spline', data: [" + strup.Trim(',') + "]},";
            stry = stry + "{ name: 'Target=" + strTg.Substring(0, strTg.IndexOf(',')) + "',type:'spline', data: [" + strTg.Trim(',') + "]},";
            stry = stry + "{ name: 'LCL=" + strlow.Substring(0, strlow.IndexOf(',')) + "',type:'spline', data: [" + strlow.Trim(',') + "]},";
            stry = stry + "{ name: 'LSL=" + strLs.Substring(0, strLs.IndexOf(',')) + "',type:'spline', data: [" + strLs.Trim(',') + "]},";
            foreach (DictionaryEntry line in hsDrawLinesY)
            {
                stry = stry + "{ name: '" + line.Key + "',type:'spline', data: [" + line.Value.ToString().Trim(',') + "]},";
            }
            stry = stry.ToString().Trim(',');
            stry = stry + "]";

            sl.Add("mAxis", strx);
            sl.Add("level", stryLevel);
            sl.Add("nAxis", stry);
            return(sl);
        }
예제 #7
0
        public ActionResult Query(CalibrationPlateQueryViewModel model)
        {
            string keyList = null;

            if (model.LineCode != null || model.LocationName != null)
            {
                using (CalibrationPlateLineServiceClient client = new CalibrationPlateLineServiceClient())
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        Where    = GetQueryCondition(model)
                    };
                    MethodReturnResult <IList <CalibrationPlateLine> > result = client.Get(ref cfg);
                    if (result.Code == 0 && result.Data.Count > 0)
                    {
                        StringBuilder strb = new StringBuilder();
                        foreach (var item in result.Data)
                        {
                            strb.Append("'" + item.Key.CalibrationPlateID + "',");
                        }
                        keyList = strb.ToString().Substring(0, strb.Length - 1);
                    }
                    else
                    {
                        return(PartialView("_ListPartial"));
                    }
                }
            }



            if (keyList != null)
            {
                using (CalibrationPlateServiceClient client = new CalibrationPlateServiceClient())
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        Where    = string.Format(" Key in ({0})"
                                                 , keyList)
                    };
                    MethodReturnResult <IList <CalibrationPlate> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.List = result.Data;
                    }
                }
            }
            else
            {
                using (CalibrationPlateServiceClient client = new CalibrationPlateServiceClient())
                {
                    PagingConfig cfg = new PagingConfig()
                    {
                        IsPaging = false,
                        OrderBy  = "Key"
                    };
                    MethodReturnResult <IList <CalibrationPlate> > result = client.Get(ref cfg);

                    if (result.Code == 0)
                    {
                        ViewBag.List = result.Data;
                    }
                }
            }
            return(PartialView("_ListPartial"));
        }