public IEnumerable <string> GetProductionLines(string plantName) { List <string> productionLines = new List <string>(); try { string storedProcedureName = "uspWip_GetProductionLines"; List <Parameter> inputParams = new List <Parameter>(); inputParams.Add(new Parameter("@plantName", new CrudItem(1, plantName))); var spResult = DBmanager.ExecuteProcedure(storedProcedureName, inputParams); if (spResult != null) { for (var i = 0; i < spResult.FirstTable.Rows.Count; i++) { productionLines.Add(spResult.FirstTable.Rows[i]["S95Id"].ToString()); } } } catch (Exception ex) { this.ServiceDirManager.ILog.Error("Error at GetProductionLines: \n" + ex.Message); } return(productionLines); }
/// <summary> /// ExecuteProcedure spLocal_CJLR_LogAction /// </summary> /// <param name="statement"></param> /// <param name="inputParameters"></param> /// <returns></returns> public string LogAction(string cFunction, string cDescription, DateTime dDate) { var result = ""; List <Parameter> parInputs = new List <Parameter>() { new Parameter() { Name = "@cFunction", Value = new CrudItem(0, cFunction) }, new Parameter() { Name = "@cDescription", Value = new CrudItem(0, cDescription) }, new Parameter() { Name = "@dDate", Value = new CrudItem(0, dDate) } }; try { DBmanager.ExecuteProcedure("spLocal_CJLR_LogAction", parInputs); } catch (Exception ex) { return(ex.Message); } return(result); }
/// <summary> /// 根据生产线查找生产线的上/下料口 /// </summary> /// <param name="line">生产线号</param> /// <param name="orificeFlag">料口类型(1上料口 2下料口)</param> /// <returns>生产线的上/下料口</returns> public string GetEcmOrificeByLine(string line, string orificeFlag) { List <string> workCellList = new List <string>(); try { string storedProcedureName = "uspWip_GetLineListByProdLine"; List <Parameter> inputParams = new List <Parameter>(); inputParams.Add(new Parameter("@prodlineName", new CrudItem(1, line))); var spResult = DBmanager.ExecuteProcedure(storedProcedureName, inputParams); if (spResult != null) { for (var i = 0; i < spResult.FirstTable.Rows.Count; i++) { workCellList.Add(spResult.FirstTable.Rows[i]["S95Id"].ToString()); } } if (workCellList.Count > 0) { DirectoryResource dir; IDictionary <string, PropertyDetails> dict; foreach (var item in workCellList) { //查找是否是 生产线的料口 dir = EQManager.GetWorkCell(item); dict = this.ServiceDirManager.IEquipment.GetPropertyDetails(dir, true); if (dict != null && dict.Count > 0 && dict.ContainsKey("EquipmentType")) {//EquipmentType(设备类型 1上料口 2下料口) if (dict["EquipmentType"] != null && dict["EquipmentType"].Value != null && dict["EquipmentType"].Value.ToString() == orificeFlag) { return(item); } } } } } catch (Exception ex) { this.ServiceDirManager.ILog.Error("Error at GetLoadOrificeByProdLineForECM: \n" + ex.Message); throw; } return(string.Empty); }
private bool CheckIfDocumentExist(string fileName) { try { bool documentFound = false; string storedProcedureName = "spLocal_CheckIfDocumentExists"; List <Parameter> inputParams = new List <Parameter>(); inputParams.Add(new Parameter("@DocumentName", new CrudItem(1, fileName))); var result = DBmanager.ExecuteProcedure(storedProcedureName, inputParams); int dbRows = result.FirstTable.Rows.Count; documentFound = dbRows > 0 ? true : false; return(documentFound); } catch (Exception exception) { this.ServiceDirManager.ILog.Error(exception.Message); this.ServiceDirManager.ILog.Error(exception.StackTrace); throw exception; } }