public bool GetDataTable(string sQL, ref DataTable dtData, ref string errMsg) { try { dtData = new DataTable(); dtData.Clear(); lock (objLock) { SqlDataAdapter sdaDataAdapter = new SqlDataAdapter(sQL, scnDBConnection); sdaDataAdapter.SelectCommand.Transaction = stnTransaction; sdaDataAdapter.Fill(dtData); if (dtData.Rows.Count > 0) { errMsg = string.Empty; return(true); } else { errMsg = "No Data Selected"; return(false); } } } catch (Exception ex) { errMsg = ex.Message; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + errMsg); return(false); } }
private bool funUpdateCommand(string commandID, string setCommandState, string setTrace) { string strSQL = string.Empty; string strEM = string.Empty; try { if (string.IsNullOrWhiteSpace(commandID) || string.IsNullOrWhiteSpace(setCommandState) || string.IsNullOrWhiteSpace(setTrace)) { return(false); } strSQL = "UPDATE CMD_MST SET"; strSQL += " Cmd_Sts='" + setCommandState + "',"; strSQL += " Exp_Dte='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',"; strSQL += " End_Dte='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',"; strSQL += " TRACE='" + setTrace + "'"; strSQL += " WHERE Cmd_Sno='" + commandID + "'"; strSQL += " AND CMD_STS<='1'"; return(InitSys._DB.ExecuteSQL(strSQL, ref strEM)); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
public bool funReadMPLC(string address, int length, ref int[] retData) { string strData = string.Empty; try { if (aeiPLC.ReadDeviceBlock(address, length, out retData[0]) == 0) { for (int intLength = 0; intLength < retData.Length; intLength++) { if (string.IsNullOrWhiteSpace(strData)) { strData = retData[intLength].ToString(); } else { strData += "," + retData[intLength].ToString(); } } InitSys.funWriteLog("MPLCR_" + intStationNumber + "_" + DateTime.Now.ToString("yyyyMMddHH"), strData); return(bolIsConnection = true); } else { InitSys.funWriteLog("MPLC_" + intStationNumber + "_Trace", address + "|" + length + "|ReadDeviceBlock Fail!"); return(bolIsConnection = false); } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(bolIsConnection = false); } }
private bool funCreateStoreInCommand(string commandID, string commandStatus, string commandIoType, string location, string palletNo, string Stn_No, string ActualWeight, string Loc_Size, string Newlocation, string Trace) { string strSQL = string.Empty; string strEM = string.Empty; string strMsg = string.Empty; try { strSQL = "INSERT INTO CMD_MST(CMD_DTE,Cmd_Sno, Cmd_Mode, Cmd_Sts, Io_Type, Plt_No,"; strSQL += " Stn_No, Loc, Prty, Prog_Id, User_Id, TRACE, Crt_Dte,Actual_Weight,LOC_SIZE,New_LOC) Values ("; strSQL += "'" + DateTime.Now.ToString("yyMMddHH") + "',"; strSQL += "'" + commandID + "', "; strSQL += "'" + commandStatus + "', "; strSQL += "'" + CommandState.Inital + "', "; strSQL += "'" + commandIoType + "', "; strSQL += "'" + palletNo + "', "; strSQL += "'" + Stn_No + "', "; strSQL += "'" + location + "', "; strSQL += "'5', "; strSQL += "'WCS', "; strSQL += "'WCS', "; strSQL += "'" + Trace + "', "; strSQL += "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "',"; strSQL += "'" + ActualWeight + "', "; strSQL += "'" + Loc_Size + "', "; strSQL += "'" + Newlocation + "') "; return(InitSys._DB.ExecuteSQL(strSQL, ref strEM)); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
public bool ExecuteSQL(string sQL, ref string errMsg) { try { lock (objLock) { SqlCommand scdCommand = new SqlCommand(sQL, scnDBConnection, stnTransaction); if (scdCommand.ExecuteNonQuery() > 0) { errMsg = string.Empty; return(true); } else { errMsg = "No Data Execute"; return(false); } } } catch (Exception ex) { errMsg = ex.Message; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + errMsg); return(false); } }
/// <summary> /// 下达入库指令时判断是否存在 相同料号 状态0,1的命令存在 /// </summary> /// <param name="palletNo">料号:ITEM_NO</param> /// <returns></returns> private bool funChekAGVStoreInCommand(string palletNo) { DataTable dtProduce = new DataTable(); string strSQL = string.Empty; string strEM = string.Empty; try { strSQL = "SELECT * FROM CMD_MST where PLT_NO='" + palletNo + "' and cmd_STS in ('0','1') and cmd_Mode='1' "; if (InitSys._DB.GetDataTable(strSQL, ref dtProduce, ref strEM)) { return(true); } else { return(false); } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } finally { if (dtProduce != null) { dtProduce.Clear(); dtProduce.Dispose(); dtProduce = null; } } }
private bool funRef() { string strSQL = string.Empty; string strEM = string.Empty; try { strSQL = string.Format("update CtrlHs set Hs='0' where EquNo='{0}'", "A1"); if (InitSys._DB.ExecuteSQL(strSQL, ref strEM)) { return(true); } else { return(false); } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
private bool funUpdateCommandLoc(string commandID, string setStn_No, string setLoc) { string strSQL = string.Empty; string strEM = string.Empty; try { if (string.IsNullOrWhiteSpace(commandID) || string.IsNullOrWhiteSpace(setStn_No) || string.IsNullOrWhiteSpace(setLoc)) { return(false); } strSQL = "UPDATE CMD_MST SET"; strSQL += " STN_NO='" + setStn_No + "',"; strSQL += " LOC='" + setLoc + "',"; strSQL += " TRACE='" + Trace.StoreIn_GetStoreInCommandAndWritePLC + "'"; strSQL += " WHERE Cmd_Sno='" + commandID + "'"; strSQL += " AND CMD_STS<'1'"; return(InitSys._DB.ExecuteSQL(strSQL, ref strEM)); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
private bool funClearKanbanInfo(string stationNo) { string strSQL = string.Empty; string strEM = string.Empty; try { string sHtml = "<!DOCTYPE html><html><head><meta http-equiv=\"Content - Type\" content=\"text / html; charset = utf - 8\" /> <title></title> <meta charset=\"utf - 8\" http-equiv=\"refresh\" content=\"1\" /> <style> * { font-family:微软雅黑; margin: 0; padding: 0; background-color:#ffffff; color:#000000; } html { max-width: 100%; min-width: 100%; height: 100%; display: table; } body { max-width: 100%; min-width: 100%; display: table-cell; height: 100%; } td { border: 1px solid #808080; } body #frmMain { width: 100%; height: 100%; } body #frmMain #top_Main { width: 100%-2px; height: 100%; margin: 0 auto; } body #frmMain #top_Main #td_Left_tr2_tab { width: 100%; height: 100%; border: 1px solid #808080; } body #frmMain #top_Main #td_Left_tr2_tab .td_Left_tr2_tab_td2{ width: 50%; height: 4%; border: 1px solid #808080; font-size:2.5ex; } </style></head><body> <form id=\"frmMain\"> <div id=\"top_Main\"> "; sHtml += " <table id=\"td_Left_tr2_tab\"><tr id=\"td_Left_tr1\">"; sHtml += "<td colspan=\"3\" style=\"background-color:#4800ff;width:100%;height:3%;text-align:center;\">长塑ASRS站口:" + stationNo + "</td></tr><tr><td class=\"td_Left_tr2_tab_td1\" rowspan=\"3\" style=\"text-align:center;color:#000000;background-color:#b6ff00;width:25%;height:8%;font-size:7.5ex\">"; sHtml += "长塑</td><td class=\"td_Left_tr2_tab_td2\"> </td>"; sHtml += "<td class=\"td_Left_tr2_tab_td1\" rowspan=\"3\" style=\"text-align:center;color:#000000;background-color:#ffffff;width:25%;height:8%;font-size:7.5ex\"></td>"; sHtml += "</tr><tr><td class=\"td_Left_tr2_tab_td2\"> </td></tr><tr><td class=\"td_Left_tr2_tab_td2\"> </td></tr>"; sHtml += "<tr><td colspan=\"3\" valign=\"top\" style=\"text-left:center;width:100%;height:60%;font-size:2.5ex;\">"; sHtml += " <table style=\"width:100%;\"><tr><td style=\"width:5%;\">序号</td><td style=\"width:30%;\">物料名称</td><td style=\"width:15%;\">辅组属性</td><td style=\"width:20%;\">分拣客户</td><td style=\"width:30%;\">备注</td></tr></table>"; sHtml += " </td > </tr ></table ></div ></form ></body ></html > "; InitSys.funWriteHtml(stationNo, sHtml); return(true); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
private bool funGetEquMst(string EquNo) { DataTable dtCode = new DataTable(); string strSQL = string.Empty; string strEM = string.Empty; try { strSQL = "SELECT * FROM EQUSTATUS WHERE EQU_NO='" + EquNo + "' AND CAN_USE='Y' AND EQUMODE in ('0','1') "; return(InitSys._DB.GetDataTable(strSQL, ref dtCode, ref strEM)); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } finally { if (dtCode != null) { dtCode.Clear(); dtCode.Dispose(); dtCode = null; } } }
private bool funUpdateProdecu(string commandID, string status) { string strSQL = string.Empty; string strEM = string.Empty; int comsno = int.Parse(commandID); try { strSQL = "UPDATE PRODUCE "; strSQL += " SET STATUS='" + status + "'"; strSQL += " WHERE Cmd_Sno='" + comsno.ToString("00000") + "'"; if (InitSys._DB.ExecuteSQL(strSQL, ref strEM)) { return(true); } else { return(false); } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
public bool funCommitCtrl(TransactionType transaction) { try { switch (transaction) { case TransactionType.Begin: stnTransaction = scnDBConnection.BeginTransaction(); break; case TransactionType.Commit: stnTransaction.Commit(); stnTransaction.Dispose(); stnTransaction = null; break; case TransactionType.Rollback: stnTransaction.Rollback(); stnTransaction.Dispose(); stnTransaction = null; break; } return(true); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
/// <summary> /// 条码读取线程,关闭条码机,获取读到条码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void timBCRReadTimeOut_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { timBCRReadTimeOut.Stop(); if (DateTime.Now > dtBCRReadTime.AddMilliseconds(intBCRReadTimeOut)) { serialPort.Write(bytarTriggerOff, 0, bytarTriggerOff.Length); strResultID = serialPort.ReadExisting().Replace("\n", ""); switch (enuBCRSts) { case BCRSts.Reading: strResultID = serialPort.ReadExisting().Replace("\n", ""); if (!string.IsNullOrWhiteSpace(strResultID)) { enuBCRSts = BCRSts.ReadFinish; serialPort.Write(bytarTriggerOff, 0, bytarTriggerOff.Length); InitSys.funWriteLog("BCR_Trace", strBCRName + "|TimeOut1|" + strResultID + "|" + enuBCRSts); } else { strResultID = strError; enuBCRSts = BCRSts.ReadFinish; serialPort.Write(bytarTriggerOff, 0, bytarTriggerOff.Length); InitSys.funWriteLog("BCR_Trace", strBCRName + "|TimeOut2|" + strResultID + "|" + enuBCRSts); } break; default: break; } } else { timBCRReadTimeOut.Start(); } }
private bool funQueryEquCmdCount(string craneMode) { string strSQL = string.Empty; string strEM = string.Empty; DataTable dtEquCmd = new DataTable(); try { strSQL = "SELECT COUNT (*) AS ICOUNT FROM EQUCMD"; strSQL += " WHERE CMDMODE='" + craneMode + "'"; if (InitSys._DB.GetDataTable(strSQL, ref dtEquCmd, ref strEM)) { return(int.Parse(dtEquCmd.Rows[0]["ICOUNT"].ToString()) == 0); } else { return(false); } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } finally { if (dtEquCmd != null) { dtEquCmd.Clear(); dtEquCmd.Dispose(); dtEquCmd = null; } } }
public bool funOpenSPLC(ref string errMsg) { try { sPLC = new Plc(cpu, strIPAddress, intRack, intSolt); ErrorCode error = sPLC.Open(); if (error == ErrorCode.NoError) { InitSys.funWriteLog("SPLC_Trace", strIPAddress + "|Open Success!"); return(bolIsConnection = true); } else { InitSys.funWriteLog("SPLC_Trace", strIPAddress + "|Open Fail!" + errMsg); return(bolIsConnection = false); } } catch (Exception ex) { errMsg = ex.Message; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(bolIsConnection = false); } }
/// <summary> /// 获取读到条码 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void serialPort_DataReceived(object sender, SerialDataReceivedEventArgs e) { try { timBCRReadTimeOut.Stop(); switch (enuBCRSts) { case BCRSts.Reading: strResultID = serialPort.ReadExisting().Replace("\n", ""); if (!string.IsNullOrWhiteSpace(strResultID)) { enuBCRSts = BCRSts.ReadFinish; serialPort.Write(bytarTriggerOff, 0, bytarTriggerOff.Length); InitSys.funWriteLog("BCR_Trace", strBCRName + "|DataReceived1|" + strResultID + "|" + enuBCRSts); } else { strResultID = strError; enuBCRSts = BCRSts.ReadFinish; serialPort.Write(bytarTriggerOff, 0, bytarTriggerOff.Length); InitSys.funWriteLog("BCR_Trace", strBCRName + "|DataReceived2|" + strResultID + "|" + enuBCRSts); } break; default: break; } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); } }
public bool funWriteSPLC(Tag tag) { try { object value = tag._ItemValue; if (tag._ItemValue is double) { var bytes = S7.Net.Types.Double.ToByteArray((double)tag._ItemValue); value = S7.Net.Types.DWord.FromByteArray(bytes); } else if (tag._ItemValue is bool) { value = (bool)tag._ItemValue ? 1 : 0; } var result = sPLC.Write(tag._ItemName, value); if (result is ErrorCode && (ErrorCode)result == ErrorCode.NoError) { InitSys.funWriteLog("SPLC_Trace", tag._ItemName + "|" + tag._ItemValue + "|WriteDeviceBlock Success!"); return(bolIsConnection = true); } else { InitSys.funWriteLog("SPLC_Trace", tag._ItemName + "|" + tag._ItemValue + "|WriteDeviceBlock Fail!"); return(bolIsConnection = false); } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(bolIsConnection = false); } }
public bool funOpenMPLC(ref string errMsg) { try { aeiPLC = new ActEasyIF(); aeiPLC.ActLogicalStationNumber = intStationNumber; if (aeiPLC.Open() == 0) { InitSys.funWriteLog("MPLC_" + intStationNumber + "_Trace", "Open Success!"); return(bolIsConnection = true); } else { InitSys.funWriteLog("MPLC_" + intStationNumber + "_Trace", "Open Fail!|" + errMsg); return(bolIsConnection = false); } } catch (Exception ex) { errMsg = ex.Message; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(bolIsConnection = false); } }
private bool funUpdateItemMaster(string palletNo, string setState, string setNewLocation, bool clearPStation, string Item_Type) { string strSQL = string.Empty; string strEM = string.Empty; string strMsg = string.Empty; try { strSQL = "UPDATE ITEM_MST"; strSQL += " SET Status='" + setState + "',"; strSQL += " Loc='" + setNewLocation + "',"; if (clearPStation) { strSQL += " PStn_No='0',"; } strSQL += " Trn_Dte='" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "'"; strSQL += " WHERE Plt_No='" + palletNo + "'"; strSQL += " and Item_Type='" + Item_Type + "'"; return(InitSys._DB.ExecuteSQL(strSQL, ref strEM)); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
public bool Close() { bool RetCode = false; _ExceptMsg = null; try { if (!(_dbConn_Oracle == null)) { _dbConn_Oracle.Close(); } RetCode = true; } catch (OracleException ex) { _ExceptMsg = ex; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception:" + methodBase.DeclaringType.FullName + "|" + methodBase.Name, "|Code:" + ex.ErrorCode + "|Message:" + ex.Message); } catch (Exception ex) { _ExceptMsg = ex; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog(methodBase.DeclaringType.FullName, ex.Message); } return(RetCode); }
private bool funCreateAGVStoreOutCommand(string commandID, string location, string palletNo, string Stn_No) { string strSQL = string.Empty; string strEM = string.Empty; string strMsg = string.Empty; try { strSQL = "INSERT INTO CMD_MST(Cmd_Sno, Cmd_Mode, Cmd_Sts, Io_Type, Plt_No,"; strSQL += " Stn_No, Loc, Prty, Prog_Id, User_Id, TRACE, Crt_Dte) Values ("; strSQL += "'" + commandID + "', "; strSQL += "'2', "; strSQL += "'0', "; strSQL += "'12', "; strSQL += "'" + palletNo + "', "; strSQL += "'" + Stn_No + "', "; strSQL += "'" + location + "', "; strSQL += "'5', "; strSQL += "'WCS', "; strSQL += "'WCS', "; strSQL += "'0', "; strSQL += "'" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "')"; return(InitSys._DB.ExecuteSQL(strSQL, ref strEM)); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
private void funKanbanInfo() { string strMsg = string.Empty; string strSQL = string.Empty; string strEM = string.Empty; DataTable dtkanbaninfo = new DataTable(); DataTable dtCmdSno = new DataTable(); try { foreach (StationInfo stnDef in lstClearKanbanInfo) { int intBufferIndex = stnDef.BufferIndex; string strBufferName = stnDef.BufferName; if (string.IsNullOrWhiteSpace(bufferData[intBufferIndex]._CommandID) && string.IsNullOrWhiteSpace(bufferData[intBufferIndex]._Destination) && bufferData[intBufferIndex]._EQUStatus.Load == Buffer.Signal.Off) { string[] strValues = new string[] { "0" }; if (bufferData[intBufferIndex]._Clearnotice) { funClearKanbanInfo(strBufferName); strMsg = bufferData[intBufferIndex]._BufferName + "|"; strMsg += "Clear Kanbaninfo Success!"; strValues = new string[] { "0" }; InitSys._MPLC.funWriteMPLC(bufferData[intBufferIndex]._W_Clearnotice, strValues); } if (!string.IsNullOrWhiteSpace(bufferData[intBufferIndex]._PalletNo)) { strValues = new string[] { "0" }; InitSys._MPLC.funWriteMPLC(bufferData[intBufferIndex]._W_PalletNo, strValues); } } } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); } finally { if (dtkanbaninfo != null) { dtkanbaninfo.Clear(); dtkanbaninfo.Dispose(); dtkanbaninfo = null; } if (dtCmdSno != null) { dtCmdSno.Clear(); dtCmdSno.Dispose(); dtCmdSno = null; } } }
public bool GetDataTable(string SQL, ref DataTable dataBase, ref string errorMsg) { bool RetCode = false; errorMsg = "Initial Fail"; _ExceptMsg = null; dataBase = (dataBase == null) ? new DataTable() : dataBase; try { lock (_Lock) { OracleDataAdapter dbDataAdapter_Oracle = new OracleDataAdapter(); dbDataAdapter_Oracle.SelectCommand = new OracleCommand(SQL, _dbConn_Oracle); dbDataAdapter_Oracle.SelectCommand.CommandTimeout = _DBConfig.CommandTimeOut; dbDataAdapter_Oracle.SelectCommand.Transaction = _dbTran_Oracle; DataSet dtDataSet = new DataSet(); dbDataAdapter_Oracle.Fill(dtDataSet, "Data"); dataBase = dtDataSet.Tables["Data"]; if (dataBase.Rows.Count > 0) { RetCode = true; errorMsg = string.Empty; } else { RetCode = false; errorMsg = "No Data Selected"; } } } catch (OracleException ex) { _ExceptMsg = ex; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception:" + methodBase.DeclaringType.FullName + "|" + methodBase.Name, "|Code:" + ex.ErrorCode + "|Message:" + ex.Message); } catch (Exception ex) { _ExceptMsg = ex; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog(methodBase.DeclaringType.FullName, ex.Message); if (_DisconnectExMsg.Contains(ex.Message)) { if (Reconnect() == true) { RetCode = GetDataTable(SQL, ref dataBase, ref errorMsg); } } } return(RetCode); }
public bool CommitCtrl(TransactionType objType, ref string errorMsg) { bool RetCode = false; errorMsg = "Initial Fail"; _ExceptMsg = null; try { switch (objType) { case TransactionType.Begin: _dbTran_Oracle = _dbConn_Oracle.BeginTransaction(); break; case TransactionType.Commit: _dbTran_Oracle.Commit(); _dbTran_Oracle.Dispose(); _dbTran_Oracle = null; break; case TransactionType.Rollback: _dbTran_Oracle.Rollback(); _dbTran_Oracle.Dispose(); _dbTran_Oracle = null; break; } RetCode = true; errorMsg = string.Empty; } catch (OracleException ex) { errorMsg = ex.Message; _ExceptMsg = ex; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception:" + methodBase.DeclaringType.FullName + "|" + methodBase.Name, "|Code:" + ex.ErrorCode + "|Message:" + ex.Message); } catch (Exception ex) { errorMsg = ex.Message; _ExceptMsg = ex; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog(methodBase.DeclaringType.FullName, ex.Message); if (_DisconnectExMsg.Contains(ex.Message)) { if (Reconnect() == true) { RetCode = CommitCtrl(objType, ref errorMsg); } } } return(RetCode); }
public bool ExecuteSQL(string SQL, ref string errorMsg) { bool RetCode = false; _ExceptMsg = null; try { lock (_Lock) { OracleCommand dbCommand_Oracle = new OracleCommand(SQL, _dbConn_Oracle); dbCommand_Oracle.Transaction = _dbTran_Oracle; dbCommand_Oracle.CommandTimeout = _DBConfig.CommandTimeOut; int executeCount = dbCommand_Oracle.ExecuteNonQuery(); if (executeCount <= 0) { RetCode = false; errorMsg = "No Data Update"; } else { RetCode = true; errorMsg = ""; } dbCommand_Oracle.Dispose(); dbCommand_Oracle = null; } } catch (OracleException ex) { errorMsg = ex.Message; _ExceptMsg = ex; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception:" + methodBase.DeclaringType.FullName + "|" + methodBase.Name, "|Code:" + ex.ErrorCode + "|Message:" + ex.Message); } catch (Exception ex) { errorMsg = ex.Message; _ExceptMsg = ex; MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog(methodBase.DeclaringType.FullName, ex.Message); if (_DisconnectExMsg.Contains(ex.Message)) { if (Reconnect() == true) { RetCode = ExecuteSQL(SQL, ref errorMsg); } } } return(RetCode); }
public bool funReadSPLC(object sourceClass, int startAddress) { try { sPLC.ReadClass(sourceClass, intDb, startAddress); return(true); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(bolIsConnection = false); } }
/// <summary> /// 站口分配 /// </summary> /// <returns></returns> private bool funGetCraneNo(ref string strCrnNo, ref string strStnNo) { string strSQL = string.Empty; string strEM = string.Empty; string strMsg = string.Empty; try { if (inStoreInStnNoIndex <= 0) { inStoreInStnNoIndex = 5; } foreach (StationInfo stnDef in lstAllotCrane) { int intBufferIndex = stnDef.BufferIndex; int intStnIndex = stnDef.StationIndex; string strBufferName = stnDef.BufferName; string strStnName = stnDef.StationName; if (string.IsNullOrWhiteSpace(bufferData[intBufferIndex]._CommandID) && string.IsNullOrWhiteSpace(bufferData[intBufferIndex]._Destination) && bufferData[intBufferIndex]._EQUStatus.Load == Buffer.Signal.Off && bufferData[intBufferIndex]._EQUStatus.AutoMode == Buffer.Signal.On && intStnIndex == inStoreInStnNoIndex) { if (funGetEquMst(intStnIndex.ToString())) { strCrnNo = intStnIndex.ToString(); strStnNo = strStnName; //if (strStnNo == "A06") strStnNo = STN_NO.StoreInA113; //if (strStnNo == "A14") strStnNo = STN_NO.StoreInA108; //if (strStnNo == "A22") strStnNo = STN_NO.StoreInA103; //if (strStnNo == "A30") strStnNo = STN_NO.StoreInA98; //if (strStnNo == "A38") strStnNo = STN_NO.StoreInA93; inStoreInStnNoIndex -= 1; return(true); } } } inStoreInStnNoIndex -= 1; return(false); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(false); } }
private bool funGetItemNoLocation(string palletNo, string Item_Type, ref string location) { string strSQL = string.Empty; string strEM = string.Empty; DataTable dtLoc = new DataTable(); try { strSQL = "SELECT A.*,B.* "; strSQL += " FROM LOC_MST AS A, ITEM_MST AS B"; strSQL += " WHERE A.Plt_No=B.Plt_No"; strSQL += " AND A.LOC=B.loc"; strSQL += " AND B.Item_Type='" + Item_Type.Trim() + "'"; strSQL += " AND A.Plt_No='" + palletNo + "'"; if (InitSys._DB.GetDataTable(strSQL, ref dtLoc, ref strEM)) { if (dtLoc.Rows.Count == 1) { location = dtLoc.Rows[0]["Loc"].ToString(); return(true); } else { location = dtLoc.Rows[0]["Loc"].ToString(); return(false); } } else { location = string.Empty; return(false); } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); location = string.Empty; return(false); } finally { if (dtLoc != null) { dtLoc.Clear(); dtLoc.Dispose(); dtLoc = null; } } }
private void funSetKanbanInfoERROR2(string sKanbanModel, string sStnNo, string Message) { try { string strMsg = string.Empty; string sHtml = "<!DOCTYPE html><html><head><meta http - equiv = \"Content - Type\" content = \"text / html; charset = utf - 8\" /><title></title><meta charset = \"utf - 8\" http-equiv = \"refresh\" content = \"1\" /> <style> * {font-family:微软雅黑;margin:0;padding:0;background-color:#000000;}html{max-width:100%;min-width:100%;height:100%;display:table;}body{max-width:100%;min-width:100%;display:table-cell;height:100%;}body #frmMain{width:100%;height:100%;}</style></head>"; sHtml += "<body><form id=\"frmMain\"><table style=\"width:100%; height:100%;\"><tr><td style=\"width:100%; height:100%; border:1px solid #000000;text-align:center;font-size:6em;background-color:black;color:#ff6a00;\">" + Message + "</td></tr></table></form></body></html>"; InitSys.funWriteHtml(sStnNo, sHtml); } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); } }
private int funCheckExistsAGVStoreInCommand(string palletNo, ref string commandID, ref string loaction) { DataTable dtCommand = new DataTable(); string strSQL = string.Empty; string strEM = string.Empty; try { strSQL = "SELECT * FROM CMD_MST C join LOC_MST L on c.Loc=l.Loc"; strSQL += " WHERE C.Loc!='' and L.Loc_Type='P' and C.Plt_No='" + palletNo + "'"; strSQL += " AND Cmd_Sts in ('0','1')"; strSQL += " AND l.LOC_STS in ('I')"; strSQL += " AND Cmd_Mode='1'"; strSQL += " AND Io_Type='12'"; if (InitSys._DB.GetDataTable(strSQL, ref dtCommand, ref strEM)) { if (dtCommand.Rows.Count == 1) { commandID = dtCommand.Rows[0]["Cmd_Sno"].ToString(); loaction = dtCommand.Rows[0]["Loc"].ToString(); return(1); } else { return(dtCommand.Rows.Count); } } else { return(0); } } catch (Exception ex) { MethodBase methodBase = MethodBase.GetCurrentMethod(); InitSys.funWriteLog("Exception", methodBase.DeclaringType.FullName + "|" + methodBase.Name + "|" + ex.Message); return(0); } finally { if (dtCommand != null) { dtCommand.Clear(); dtCommand.Dispose(); dtCommand = null; } } }