public QualityAssurance_InputMasterDTO QueryDataFromPP(CheckPointInputConditionModel searchModel) { QualityAssurance_InputMasterDTO result = new QualityAssurance_InputMasterDTO(); try { var query = from QAinterface in DataContext.PPForQAInterface join flowchartdetail in DataContext.FlowChart_Detail on QAinterface.FlowChart_Detail_UID equals flowchartdetail.FlowChart_Detail_UID where flowchartdetail.FlowChart_Master_UID == searchModel.Flowchart_Master_UID && QAinterface.Color == searchModel.Color && QAinterface.Product_Date == searchModel.ProductDate && QAinterface.Time_Interval == searchModel.Time_interval && QAinterface.MaterielType == searchModel.MaterialType && QAinterface.QAUsedFlag == false && QAinterface.FlowChart_Detail_UID == searchModel.Flowchart_Detail_UID select new { QAinterface.NG_Qty, QAinterface.Input_Qty }; if (query.Count() > 0) { result.NG_Qty = query.ToArray()[0].NG_Qty; result.Input = query.ToArray()[0].Input_Qty; result.Product_Date = searchModel.ProductDate; result.Time_Interval = searchModel.Time_interval; } } catch (Exception ex) { log.Error(ex); } return(result); }
public ActionResult OQCMaster(string Flowchart_Master_UID, string Process_seq, string color, string MaterialType, string FlowChart_Detail_UID, string Process, string ProjectName, string IsQAProcess) { if (!string.IsNullOrEmpty(ProjectName) && !string.IsNullOrEmpty(MaterialType)) { CheckPointInputConditionModel condition = new CheckPointInputConditionModel(); condition.Color = color; condition.Flowchart_Master_UID = int.Parse(Flowchart_Master_UID); condition.Flowchart_Detail_UID = int.Parse(FlowChart_Detail_UID); condition.Process_seq = int.Parse(Process_seq); condition.MaterialType = MaterialType; condition.Process = Process; condition.Project_Name = ProjectName; var apiUrl = string.Format("EventReportManager/GetIntervalInfoAPI?opType={0}", "OP1"); var responseMessage = APIHelper.APIGetAsync(apiUrl); var result = responseMessage.Content.ReadAsStringAsync().Result; var time = JsonConvert.DeserializeObject <IntervalEnum>(result); condition.Time_interval = time.Time_Interval; condition.ProductDate = DateTime.Parse(time.NowDate); ViewBag.Flowchart_Master_UID = condition.Flowchart_Master_UID; ViewBag.MaterialType = condition.MaterialType; ViewBag.Color = condition.Color; ViewBag.Process_seq = condition.Process_seq; ViewBag.Process = condition.Process; ViewBag.Flowchart_Detail_UID = condition.Flowchart_Detail_UID; ViewBag.Project = condition.Project_Name; ViewBag.ProductDate = condition.ProductDate.ToString(FormatConstants.DateTimeFormatStringByDate); ViewBag.Time_interval = condition.Time_interval; ViewBag.IsAssembleProcess = IsQAProcess == "Inspect_Assemble" ? "" : "hidden"; } return(View()); }
public QualityAssurance_InputMasterDTO QueryAssuranceInputMaster(CheckPointInputConditionModel searchModel) { QualityAssurance_InputMasterDTO result = new QualityAssurance_InputMasterDTO(); try { bool searchHistory = false; TimeSpan tSpan = DateTime.Now.Date - searchModel.ProductDate; if (tSpan.Days >= 7) { searchHistory = true; } if (!searchHistory) { var query = from qAMaster in DataContext.QualityAssurance_InputMaster join flowChartDetail in DataContext.FlowChart_Detail on qAMaster.FlowChart_Detail_UID equals flowChartDetail.FlowChart_Detail_UID where qAMaster.FlowChart_Detail_UID == searchModel.Flowchart_Detail_UID && qAMaster.Product_Date == searchModel.ProductDate && qAMaster.MaterielType == searchModel.MaterialType && qAMaster.Time_Interval == searchModel.Time_interval && qAMaster.Color == searchModel.Color select new QualityAssurance_InputMasterDTO { NG_Qty = qAMaster.NG_Qty, Input = qAMaster.Input, Color = qAMaster.Color, FirstCheck_Qty = qAMaster.FirstCheck_Qty, FirstOK_Qty = qAMaster.FirstOK_Qty, FirstRejectionRate = qAMaster.FirstRejectionRate, FlowChart_Detail_UID = qAMaster.FlowChart_Detail_UID, MaterielType = qAMaster.MaterielType, Process = qAMaster.Process, Product_Date = qAMaster.Product_Date, Shipment_Qty = qAMaster.Shipment_Qty, SurfaceSA_Qty = qAMaster.SurfaceSA_Qty, SizeSA_Qty = qAMaster.SizeSA_Qty, RepairCheck_Qty = qAMaster.RepairCheck_Qty, RepairOK_Qty = qAMaster.RepairOK_Qty, WIPForCheck_Qty = qAMaster.WIPForCheck_Qty, Time_Interval = qAMaster.Time_Interval, QualityAssurance_InputMaster_UID = qAMaster.QualityAssurance_InputMaster_UID, NGFlag = qAMaster.NGFlag, FirstCheckFlag = qAMaster.FirstCheckFlag, Displace_Qty = qAMaster.Displace_Qty, DisplaceFlag = qAMaster.DisplaceFlag }; if (query.Count() != 0) { result = query.ToList()[0]; } } else { var query = from qAMaster in DataContext.QualityAssurance_InputMaster_History join flowChartDetail in DataContext.FlowChart_Detail on qAMaster.FlowChart_Detail_UID equals flowChartDetail.FlowChart_Detail_UID where qAMaster.FlowChart_Detail_UID == searchModel.Flowchart_Detail_UID && qAMaster.Product_Date == searchModel.ProductDate && qAMaster.MaterielType == searchModel.MaterialType && qAMaster.Time_Interval == searchModel.Time_interval && qAMaster.Color == searchModel.Color select new QualityAssurance_InputMasterDTO { NG_Qty = qAMaster.NG_Qty, Input = qAMaster.Input, Color = qAMaster.Color, FirstCheck_Qty = qAMaster.FirstCheck_Qty, FirstOK_Qty = qAMaster.FirstOK_Qty, FirstRejectionRate = qAMaster.FirstRejectionRate, FlowChart_Detail_UID = qAMaster.FlowChart_Detail_UID, MaterielType = qAMaster.MaterielType, Process = qAMaster.Process, Product_Date = qAMaster.Product_Date, Shipment_Qty = qAMaster.Shipment_Qty, SurfaceSA_Qty = qAMaster.SurfaceSA_Qty, SizeSA_Qty = qAMaster.SizeSA_Qty, RepairCheck_Qty = qAMaster.RepairCheck_Qty, RepairOK_Qty = qAMaster.RepairOK_Qty, WIPForCheck_Qty = qAMaster.WIPForCheck_Qty, Time_Interval = qAMaster.Time_Interval, QualityAssurance_InputMaster_UID = qAMaster.QualityAssurance_InputMaster_UID, NGFlag = qAMaster.NGFlag, FirstCheckFlag = qAMaster.FirstCheckFlag, Displace_Qty = qAMaster.Displace_Qty, DisplaceFlag = qAMaster.DisplaceFlag }; if (query.Count() != 0) { result = query.ToList()[0]; } } } catch (Exception ex) { log.Error(ex); } return(result); }