/// <summary> /// 结束本次检测,需要先检查录入的数据是否满足要求,满足的了才能录入 /// 1.一点落在控制限以外 /// 2.连续9点落在中心线的同一侧 /// 3.连续6点递增或递减 /// 4.连续14点中相邻点交替上下 /// </summary> /// <param name="ProductCalID"></param> /// <returns></returns> public string EndThisTest(string ProductCalID, string PictureType) { CalResultBll CalBll = new CalResultBll(); MRCalResultBll MRBll = new MRCalResultBll(); string sqldatacount = string.Format(@"select case when (select groupnum from ProductCal where ProductCalID='{0}')= (select COUNT(1) from dbo.ProductCalData where InputValue is not null and ProductCalDID in ( select ProductCalDID from dbo.ProductCalDetail where State='进行中' and ProductCalID='{0}')) then 'success' else 'error' end ", ProductCalID); DataTable dtdatacount = ProductCalre.FindTableBySql(sqldatacount); if (dtdatacount.Rows[0][0].ToString() == "success") //表示成功,可以结束本次 { StringBuilder strsql = new StringBuilder(); strsql.AppendFormat(@" update dbo.ProductCalDetail set State='已完成',EndDate=GETDATE(),UpdateMan='{1}' where State='进行中' and ProductCalID='{0}' ", ProductCalID, ManageProvider.Provider.Current().UserName); ProductCalre.ExecuteBySql(strsql); //表示本次成功了.成功以后还需要做其他的分支判断,检测添加了本次以后是否有异常结果 //CalBll.CheckFault(ProductCalID); if (PictureType == "X-Bar") { return(CalBll.CheckFault(ProductCalID)); } else { return(MRBll.CheckFault(ProductCalID)); } } else { //表示录入的数据量还不够结束本次的 return("0"); } }
public string CalCPK(string ProductCalID, string StartDate, string EndDate, string PictureType) { if (PictureType == "X_Bar") { return(CalResultBll.CalCPK(ProductCalID, StartDate, EndDate, ProductCalre)); } else { return(MRCalResultBll.CalCPK(ProductCalID, StartDate, EndDate)); } }
public ActionResult GetMRTrend(string ProductCalID, string StartDate, string EndDate) { MRCalResultBll MrcalBll = new MRCalResultBll(); if (CommonHelper.IsEmpty(StartDate)) { StartDate = DateTime.Now.AddDays(-30).ToString(); } if (CommonHelper.IsEmpty(EndDate)) { EndDate = DateTime.Now.ToString(); } //decimal D1=2.114M; string sql = @" select CONVERT(varchar(100), b.StartDate, 120)+'~'+CONVERT(varchar(100), b.EndDate, 8) as riqi, CONVERT(varchar(100), b.StartDate, 120) as sdate, CONVERT(varchar(100), b.EndDate, 8) as edate, AVG(InputValue) as x, c.XLowLimit,c.XUpperLimit,c.XCenterLine, c.RLowLimit,c.RUpperLimit,c.RCenterLine, c.StandardLowLimit,c.StandardUpperLimit,c.StandardCenterLine from ProductCalData a left join ProductCalDetail b on a.ProductCalDID=b.ProductCalDID left join ProductCal c on b.ProductCalID=c.ProductCalID where a.ProductCalID='{0}' and cast(b.StartDate as date)>=cast('{1}' as date) and cast(b.StartDate as date)<=cast('{2}' as date) and b.State='已完成' group by a.ProductCalDID,b.StartDate,b.EndDate,c.XLowLimit,c.XUpperLimit,c.XCenterLine,c.RLowLimit,c.RUpperLimit,c.RCenterLine, c.StandardLowLimit,c.StandardUpperLimit,c.StandardCenterLine order by StartDate "; sql = string.Format(sql, ProductCalID, StartDate, EndDate); Repository <MRPictureDTO> re = new Repository <MRPictureDTO>(); List <MRPictureDTO> list = re.FindListBySql(sql); list = MrcalBll.GetMRList(list); if (list.Count > 0) { return(Content(list.ToJson())); } else { return(Content(new JsonMessage { Success = false, Code = "-1", Message = "该检测尚未录入数据,请先录入数据" }.ToString())); } }