public IHttpActionResult UpdateBackToFunPlantInfoAPI(dynamic data) { var jsonData = data.ToString(); QABackToFunPlant qaMasterData = JsonConvert.DeserializeObject <QABackToFunPlant>(jsonData); var result = QualityService.UpdateBackToFunPlantInfo(qaMasterData); return(Ok(result)); }
public string UpdateBackToFunPlantInfo(QABackToFunPlant data) { string result = string.Empty; try { string sql = string.Format(@" UPDATE dbo.QualityAssurance_DistributeRate SET CNC_Rate={1},OQC_Rate={2},Anode_Rate={3},Assemble_Rate={4},Surface_Rate={5} WHERE QualityAssurance_DistributeRate_UID ='{0}'", data.QualityAssurance_DistributeRate_UID, data.CNC_Rate, data.OQC_Rate, data.Anode_Rate, data.Assemble_Rate, data.Surface_Rate); DataContext.Database.ExecuteSqlCommand(sql); result = "Success"; } catch (Exception ex) { result = "发生错误,请联系管理人员。"; log.Error(ex); } return(result); }
public QABackToFunPlant QueryQABTFInfoByUID(string QualityAssurance_DistributeRate_UID) { QABackToFunPlant result = new QABackToFunPlant(); try { string sql = string.Format(@" SELECT qa.FlowChart_Master_UID , FlowChart_Detail_UID , System_FunPlant_UID , qa.ExceptionType_UID , QualityAssurance_DistributeRate_UID , RejectionRate, Surface_Rate , CNC_Rate , OQC_Rate , Assemble_Rate, Anode_Rate , ProductDate , extype.TypeName AS ExceptionTypeName, Color FROM dbo.QualityAssurance_DistributeRate qa WITH ( NOLOCK ) INNER JOIN dbo.QualityAssurance_ExceptionType extype WITH(NOLOCK) ON extype.ExceptionType_UID = qa.ExceptionType_UID WHERE QualityAssurance_DistributeRate_UID=N'{0}'", QualityAssurance_DistributeRate_UID); var query = DataContext.Database.SqlQuery <QABackToFunPlant>(sql).ToList(); if (query.Count != 0) { result = query[0]; } } catch (Exception ex) { log.Error(ex); } return(result); }