public bool ShowTrigger(Model.PSTData objPSTData) { if (objPSTData == null) { return(false); } if (objErrorDaoService == null) { objErrorDaoService = new ErrorDaoImp(); } if (objErrorControllerService == null) { objErrorControllerService = new ErrorControllerImp(); } int error = objErrorControllerService.GetErrorCode(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_L2_ErrCode); if (error != 0) { return(false); } TriggerData objTriggerData = new TriggerData(); objTriggerData.MachineCode = objPSTData.machineCode; objTriggerData.category = TriggerData.triggerCategory.ERROR; objTriggerData.ErrorCode = error.ToString(); objTriggerData.TriggerEnabled = true; objErrorDaoService.UpdateTriggerActiveStatus(objTriggerData); return(true); }
public Model.PSTData GetPSTDetails(Model.PSTData objPSTData) { if (objPSTDaoService == null) { objPSTDaoService = new PSTDaoImp(); } return(objPSTDaoService.GetPSTDetails(objPSTData)); }
public List <Model.PSTData> GetPSTList() { List <Model.PSTData> lstPSTData = null; try { using (OracleConnection con = new DBConnection().getDBConnection()) { // if (con.State == System.Data.ConnectionState.Closed) con.Open(); using (OracleCommand command = con.CreateCommand()) { string sql = "SELECT PST_ID, PST_NAME,AISLE_NO,ROW_NO,QUANTITY,MACHINE_CODE,IS_BLOCKED,STATUS" + " ,MACHINE_CHANNEL,IS_SWITCH_OFF,PVL_ID" + " FROM L2_PST_MASTER"; command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { lstPSTData = new List <Model.PSTData>(); while (reader.Read()) { Model.PSTData objPSTData = new Model.PSTData(); objPSTData.pstPkId = Int32.Parse(reader["PST_ID"].ToString()); objPSTData.pstName = reader["PST_NAME"].ToString(); objPSTData.aisle = Int32.Parse(reader["AISLE_NO"].ToString()); objPSTData.row = Int32.Parse(reader["ROW_NO"].ToString()); objPSTData.quantity = Int32.Parse(reader["QUANTITY"].ToString()); objPSTData.machineCode = reader["MACHINE_CODE"].ToString(); objPSTData.isBlocked = Int32.Parse(reader["IS_BLOCKED"].ToString()) == 1; objPSTData.status = Int32.Parse(reader["STATUS"].ToString()); objPSTData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); objPSTData.isSwitchOff = Int32.Parse(reader["IS_SWITCH_OFF"].ToString()) == 1; objPSTData.pvlPkId = Int32.Parse(reader["PVL_ID"].ToString()); lstPSTData.Add(objPSTData); } } } } } } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } return(lstPSTData); }
public List <Model.PSTData> GetPSTList() { List <Model.PSTData> lstPSTData = null; try { using (OracleConnection con = new OracleConnection(Connection.connectionString)) { if (con.State == System.Data.ConnectionState.Closed) { con.Open(); } using (OracleCommand command = con.CreateCommand()) { string sql = "SELECT PST_ID, PST_NAME,AISLE_NO,ROW_NO,MACHINE_CODE,STATUS, MACHINE_CHANNEL" + " FROM L2_PST_MASTER"; command.CommandText = sql; using (OracleDataReader reader = command.ExecuteReader()) { if (reader.HasRows) { lstPSTData = new List <Model.PSTData>(); while (reader.Read()) { Model.PSTData objPSTData = new Model.PSTData(); objPSTData.pstPkId = Int32.Parse(reader["PST_ID"].ToString()); objPSTData.pstName = reader["PST_NAME"].ToString(); objPSTData.aisle = Int32.Parse(reader["AISLE_NO"].ToString()); objPSTData.row = Int32.Parse(reader["ROW_NO"].ToString()); objPSTData.machineCode = reader["MACHINE_CODE"].ToString(); objPSTData.status = Int32.Parse(reader["STATUS"].ToString()); objPSTData.machineChannel = reader["MACHINE_CHANNEL"].ToString(); lstPSTData.Add(objPSTData); } } } } } } catch (Exception errMsg) { Console.WriteLine(errMsg.Message); } return(lstPSTData); }
//public int GetCountOfPallet(Model.PSTData objPSTData) //{ // int palletCount = -1; // using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) // { // palletCount=opcd.ReadTag<Int32>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_Pallet_Count); // } // return palletCount; //} public int GetCountOfPallet(Model.PSTData objPSTData) { int palletCount = -1; bool isPalletOnPST = true; using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { palletCount = opcd.ReadTag <int>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_Pallet_Count); /* if (!objPSTData.machineCode.Contains("PST_FLR4_01")) * { * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_North_Pallet_Sensor_1); * isPalletOnPST = isPalletOnPST || opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_South_Pallet_Sensor_1); * palletCount = isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_North_Pallet_Sensor_2); * isPalletOnPST = isPalletOnPST || opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_South_Pallet_Sensor_2); * palletCount += isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_North_Pallet_Sensor_3); * isPalletOnPST = isPalletOnPST || opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_South_Pallet_Sensor_3); * palletCount += isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_North_Pallet_Sensor_4); * isPalletOnPST = isPalletOnPST || opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_South_Pallet_Sensor_4); * palletCount += isPalletOnPST == true ? 1 : 0; * } * else if (objPSTData.machineCode.Contains("PST_FLR4_01")) * { * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST100_Pallet_Sensor_1_Bottom); * palletCount = isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST100_Pallet_Sensor_2); * palletCount += isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST100_Pallet_Sensor_3); * palletCount += isPalletOnPST == true ? 1 : 0; * * isPalletOnPST = opcd.ReadTag<bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST100_Pallet_Sensor_4_Top); * palletCount += isPalletOnPST == true ? 1 : 0; * }*/ } return(palletCount); }
public bool CheckPSTHealthy(Model.PSTData objPSTData) { bool isHealthy = false; if (objPSTDaoService == null) { objPSTDaoService = new PSTDaoImp(); } using (OpcOperationsService opcd = new OpcOperationsImp(OpcConnection.GetOPCServerConnection())) { if (opcd.IsMachineHealthy(objPSTData.machineChannel + "." + objPSTData.machineCode + "." + OpcTags.PST_Auto_Ready)) { isHealthy = opcd.ReadTag <bool>(objPSTData.machineChannel, objPSTData.machineCode, OpcTags.PST_Auto_Ready); isHealthy = isHealthy && !objPSTDaoService.IsPSTDisabled(objPSTData.machineCode); isHealthy = isHealthy && !objPSTDaoService.IsPSTSwitchOff(objPSTData.machineCode); } } return(isHealthy); }