/// <summary> /// 寫入Crane命令-站對站 /// </summary> private void funStnToStnEquPLCCmd() { string strSQL = string.Empty; string strEM = string.Empty; DataTable objDataTable = new DataTable(); Dictionary <string, clsCmdSno> dicCmdSno = new Dictionary <string, clsCmdSno>(); clsTraceLogEventArgs SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); try { strSQL = "SELECT * FROM CMD_MST WHERE Cmd_Sno<>'' and CMD_MODE = '4' AND CMD_STS ='1' AND TRACE ='" + clsTrace.cstrStoreOutTrace_ReleaseEquPLCCmd + "' ORDER BY CMD_SNO,LOC,PRTY,Crt_Date"; if (clsSystem.gobjDB.funGetDT(strSQL, ref objDataTable, ref strEM) == ErrDef.ProcSuccess) { #region 取得命令 for (int intCount = 0; intCount < objDataTable.Rows.Count; intCount++) { if (dicCmdSno.ContainsKey(objDataTable.Rows[intCount]["CMD_SNO"].ToString())) { string strCmdSno = objDataTable.Rows[intCount]["CMD_SNO"].ToString(); dicCmdSno[strCmdSno].CmdSno = objDataTable.Rows[intCount]["CMD_SNO"].ToString(); dicCmdSno[strCmdSno].Stn_No = objDataTable.Rows[intCount]["Stn_No"].ToString(); dicCmdSno[strCmdSno].NewLoc = objDataTable.Rows[intCount]["New_Loc"].ToString(); dicCmdSno[strCmdSno].CmdMode = 2; } else { clsCmdSno CmdSno = new clsCmdSno(); CmdSno.CmdSno = objDataTable.Rows[intCount]["CMD_SNO"].ToString(); CmdSno.Stn_No = objDataTable.Rows[intCount]["Stn_No"].ToString(); CmdSno.NewLoc = objDataTable.Rows[intCount]["New_Loc"].ToString(); CmdSno.Priority = int.Parse(objDataTable.Rows[intCount]["PRTY"].ToString()); CmdSno.CmdMode = 2; dicCmdSno.Add(CmdSno.CmdSno, CmdSno); } } #endregion 取得命令 foreach (clsCmdSno CmdSno in dicCmdSno.Values) { if (funStnNo2Crane(CmdSno.Stn_No) != funStnNo2Crane(CmdSno.NewLoc)) { continue; } SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); SystemTraceLog.LogMessage = "Find Transfer Cmd Success!"; SystemTraceLog.CmdSno = CmdSno.CmdSno; SystemTraceLog.StnNo = CmdSno.Stn_No; funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); int intBufferIndex, intBufferIndex_Out; #region 寫入PLC objDataTable = new DataTable(); strSQL = "SELECT * FROM StnDef WHERE StnNo IN ('" + CmdSno.Stn_No + "') ORDER BY STNNO"; if (clsSystem.gobjSystemDB.funGetDT(strSQL, ref objDataTable, ref strEM) == ErrDef.ProcSuccess) { intBufferIndex = clsTool.funConvertToInt(objDataTable.Rows[0]["BufferIndex"].ToString()); #region 註解 //if (objBufferData.PLC2PCBuffer[intBufferIndex].StnModeCode_Load && // objBufferData.PLC2PCBuffer[intBufferIndex].ReadNotice == (int)clsPLC2PCBuffer.enuReadNotice.Read && // objBufferData.PLC2PCBuffer[intBufferIndex].Ready == (int)clsPLC2PCBuffer.enuReady.InReady && // string.IsNullOrWhiteSpace(objBufferData.PLC2PCBuffer[intBufferIndex].LeftCmdSno) // ) //{ // #region 讀取BCR // objDataTable = new DataTable(); // strSQL = "SELECT * FROM IN_BUF WHERE BCR_NO IN"; // strSQL += " ('" + objBCRData[(intBufferIndex+1)/2, clsBCR.enuBCRLoc.Once].BCRNo + "')"; // if (clsSystem.gobjDB.funGetDT(strSQL, ref objDataTable, ref strEM) == ErrDef.ProcSuccess) // { // foreach (DataRow drTmp in objDataTable.Rows) // { // switch (drTmp["BCR_STS"].ToString()) // { // case clsBCRSts.cstrReadFinish: // if (drTmp["BCR_No"].ToString() == objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo) // { // if (objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID != drTmp["BCR_DATA"].ToString()) // { // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRSts = // clsTool.funGetEnumValue<clsBCR.enuBCRSts>(drTmp["BCR_STS"].ToString()); // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID = drTmp["BCR_DATA"].ToString(); // SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); // SystemTraceLog.LogMessage = "BCR Read Success!"; // SystemTraceLog.BCRNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo; // SystemTraceLog.BCRID = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID; // SystemTraceLog.StnNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].StnNo; // funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); // } // } // break; // case clsBCRSts.cstrNone: // #region 啟動BCR // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Begin); // if (funUpdateBCRSts(clsBCR.enuBCRSts.Reading, objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo, clsReBCRID.cstrBCRDataInit)) // { // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRSts = clsBCR.enuBCRSts.Reading; // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID = clsReBCRID.cstrBCRDataInit; // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Commit); // SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); // SystemTraceLog.LogMessage = "Update Both BCR Sts Success!"; // SystemTraceLog.BCRSts = ((int)clsBCR.enuBCRSts.Reading).ToString(); // SystemTraceLog.BCRNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo; // funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); // } // else // { // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); // SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); // SystemTraceLog.LogMessage = "Update Both BCR Sts Fail!"; // SystemTraceLog.BCRSts = clsBCR.enuBCRSts.Reading.ToString(); // SystemTraceLog.BCRNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo; // funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); // } // #endregion 啟動BCR // break; // default: // break; // } // } //} // #endregion 讀取BCR //#region 確認BCR讀取是否有誤 For 大立光 //if ((objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRSts == clsBCR.enuBCRSts.ReadFinish && // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID == clsReBCRID.cstrBCRError)) //{ // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Begin); // if (funUpdateBCRSts(clsBCR.enuBCRSts.None, objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo, clsReBCRID.cstrBCRDataInit)) // { // if (funWritePC2PLCSingel( // 1, // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BufferName, // clsPLC.enuAddressSection.ReadNotice, // clsReBCRSts.cstrNG)) // { // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRSts = clsBCR.enuBCRSts.None; // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID = clsReBCRID.cstrBCRDataInit; // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Commit); // SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); // SystemTraceLog.LogMessage = "BCR Read Fail!"; // SystemTraceLog.BCRSts = ((int)clsBCR.enuBCRSts.None).ToString(); // SystemTraceLog.BCRNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo; // funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); // } // else // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); // } // else // { // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); // SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); // SystemTraceLog.LogMessage = "Update BCR Sts Fail!"; // SystemTraceLog.BCRSts = ((int)clsBCR.enuBCRSts.None).ToString(); // SystemTraceLog.BCRNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo; // funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); // } //} //#endregion 確認讀取是否有誤 //#region Update Cmd Trace + 寫入PLC //clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Begin); //if (funUpdateCmdTrace(CmdSno.CmdSno, // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID, // clsCmdSts.cstrCmdSts_Start, // clsTrace.cstrStoreInTrace_ReleaseEquPLCCmd, // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo) && // funUpdateBCRSts(clsBCR.enuBCRSts.None, objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo, clsReBCRID.cstrBCRDataInit)) //{ // if (funWritePC2PLCSingel( // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BufferName, // CmdSno.CmdSno,//序號 // "1", //模式 // "0",//初始通知 // clsFunNotice1.CMD_OK, // clsFunNotice2.StnInMode, // clsFunNotice3.None // )) // { // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Commit); // SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); // SystemTraceLog.LogMessage = "Stock In Cmd Initiated!"; // SystemTraceLog.CmdSno = CmdSno.CmdSno; // SystemTraceLog.CmdSts = clsCmdSts.cstrCmdSts_Start; // SystemTraceLog.Trace = clsTrace.cstrStoreInTrace_ReleaseEquPLCCmd; // SystemTraceLog.StnNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].StnNo; // SystemTraceLog.LocID = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID; // funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRSts = clsBCR.enuBCRSts.None; // objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID = clsReBCRID.cstrBCRDataInit; // SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); // SystemTraceLog.LogMessage = "Update Both BCR Sts Success!"; // SystemTraceLog.BCRSts = ((int)clsBCR.enuBCRSts.None).ToString(); // SystemTraceLog.BCRNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo; // funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); // } // else // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); //} //else //{ // clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); // SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); // SystemTraceLog.LogMessage = "UpdateCmd Trace Fail!"; // SystemTraceLog.CmdSno = CmdSno.CmdSno_L; // SystemTraceLog.CmdSts = clsCmdSts.cstrCmdSts_Start; // SystemTraceLog.Trace = clsTrace.cstrStoreInTrace_ReleaseEquPLCCmd; // SystemTraceLog.StnNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].StnNo; // SystemTraceLog.LocID = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRID; // funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); // SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); // SystemTraceLog.LogMessage = "Update BCR Sts Fail!"; // SystemTraceLog.BCRSts = ((int)clsBCR.enuBCRSts.None).ToString(); // SystemTraceLog.BCRNo = objBCRData[(intBufferIndex + 1) / 2, clsBCR.enuBCRLoc.Once].BCRNo; // funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); //} //#endregion Update Cmd Trace //} #endregion 註解 #endregion 寫入PLC //if (funUpdateCmdTrace(CmdSno.CmdSno, clsCmdSts.cstrCmdSts_Start, clsTrace.cstrStoreOutTrace_ReleaseEquPLCCmd)) //{ // //if (funWritePC2PLCSingel( // // StnDef.Buffer, // // CmdSno.CmdSno, // // CmdSno.CmdMode.ToString(), // // CmdSno.IniNotice.ToString() // // )) //} //寫入出庫PLC objDataTable = new DataTable(); strSQL = "SELECT * FROM StnDef WHERE StnNo IN ('" + CmdSno.NewLoc + "') ORDER BY STNNO"; if (clsSystem.gobjSystemDB.funGetDT(strSQL, ref objDataTable, ref strEM) == ErrDef.ProcSuccess) { intBufferIndex_Out = clsTool.funConvertToInt(objDataTable.Rows[0]["BufferIndex"].ToString()); if (!objBufferData.PLC2PCBuffer[intBufferIndex_Out].StnModeCode_CargoLoad && objBufferData.PLC2PCBuffer[intBufferIndex_Out].Ready == (int)clsPLC2PCBuffer.enuReady.OutReady && string.IsNullOrWhiteSpace(objBufferData.PLC2PCBuffer[intBufferIndex_Out].LeftCmdSno) && objBufferData.PLC2PCBuffer[intBufferIndex_Out].StnMode == (int)clsPLC2PCBuffer.enuStnMode.None) { if (funUpdateCmdTrace(CmdSno.CmdSno, clsCmdSts.cstrCmdSts_Start, clsTrace.cstrStoreOutTrace_ReleaseEquPLCCmd)) { //if (funWritePC2PLCSingel( // objBCRData[(intBufferIndex_Out + 1) / 2, clsBCR.enuBCRLoc.Once].BufferName, // CmdSno.CmdSno,//序號 // "2", //模式 // "0",//初始通知 // clsFunNotice1.CMD_OK, // clsFunNotice2.StnOutMode, // clsFunNotice3.None // )) if (funWritePC2PLCSingel( objBCRData[(intBufferIndex_Out - 1) / 2, clsBCR.enuBCRLoc.Once].BufferName, CmdSno.CmdSno, CmdSno.CmdMode.ToString(), CmdSno.IniNotice.ToString() )) { clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Commit); SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); SystemTraceLog.LogMessage = "Both Stock Out Cmd Initiated!"; SystemTraceLog.LeftCmdSno = CmdSno.CmdSno_L; SystemTraceLog.CmdSts = clsCmdSts.cstrCmdSts_Start; SystemTraceLog.Trace = clsTrace.cstrStoreOutTrace_ReleaseEquPLCCmd; SystemTraceLog.StnNo = CmdSno.CmdSno; funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); } } else { clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); } } else { continue; } } if (clsSystem.intBegin == 0) { clsSystem.intBegin = 1; #region 更新Trace 、新增EQUCMD if (clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Begin) == ErrDef.ProcSuccess) { if (funUpdateCmdTrace(CmdSno.CmdSno, clsCmdSts.cstrCmdSts_Start, clsTrace.cstrStoreInTrace_ReleaseCraneCmd)) { int intCrane = funStnNo2Crane(CmdSno.Stn_No); //將站口編號轉成Loc //將命令寫入EQUCMD if (funInsertEquCmd(intCrane, CmdSno.CmdSno, "4", funStnNo2Loc(CmdSno.Stn_No), funStnNo2Loc(CmdSno.NewLoc), CmdSno.Priority.ToString())) { clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Commit); SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); SystemTraceLog.LogMessage = "Transfer Cmd Initiated!"; SystemTraceLog.CmdSno = CmdSno.CmdSno; SystemTraceLog.CmdSts = clsCmdSts.cstrCmdSts_Start; SystemTraceLog.Trace = clsTrace.cstrStoreInTrace_ReleaseCraneCmd; SystemTraceLog.CmdMode = clsEquCmdMode.cstrStnToStn; funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); } else { clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); SystemTraceLog.LogMessage = "Release Equ Cmd Fail!"; SystemTraceLog.CmdSno = CmdSno.CmdSno; SystemTraceLog.CmdSts = clsCmdSts.cstrCmdSts_Start; SystemTraceLog.CmdMode = clsEquCmdMode.cstrStnToStn; funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); } } else { clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); SystemTraceLog.LogMessage = "Update Transfer Cmd Trace Fail!"; SystemTraceLog.CmdSno = CmdSno.CmdSno; SystemTraceLog.CmdSts = clsCmdSts.cstrCmdSts_Start; SystemTraceLog.Trace = clsTrace.cstrStoreInTrace_ReleaseEquPLCCmd; funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); } } #endregion 更新Trace 、新增EQUCMD clsSystem.intBegin = 0; } } } } } catch (Exception ex) { clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); var varObject = MethodBase.GetCurrentMethod(); clsSystem.funWriteExceptionLog(varObject.DeclaringType.FullName, varObject.Name, ex.Message); } finally { if (objDataTable != null) { objDataTable.Clear(); objDataTable.Dispose(); objDataTable = null; } if (dicCmdSno != null) { dicCmdSno.Clear(); dicCmdSno = null; } } }
/// <summary> /// 庫對庫-寫入Crane命令 /// </summary> private void funLocToLoc_ReleaseCraneCmd() { string strSQL = string.Empty; string strEM = string.Empty; DataTable objDataTable = new DataTable(); Dictionary <string, clsCmdSno> dicCmdSno = new Dictionary <string, clsCmdSno>(); clsTraceLogEventArgs SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); try { //strSQL = "SELECT * FROM CMD_MST WHERE CMDMODE='5' AND CMDSTS='0' AND TRACE='0' ORDER BY CMDSNO, LOC, PRT, TRNDATE DESC"; strSQL = "SELECT * FROM CMD_MST WHERE Cmd_Sno<>'' and CMD_MODE ='5' AND CMD_STS = '0' AND TRACE ='0' ORDER BY CMD_SNO ,LOC,PRTY,Crt_Date DESC"; if (clsSystem.gobjDB.funGetDT(strSQL, ref objDataTable, ref strEM) == ErrDef.ProcSuccess) { #region 取得命令 for (int intCount = 0; intCount < objDataTable.Rows.Count; intCount++) { if (dicCmdSno.ContainsKey(objDataTable.Rows[intCount]["CMD_SNO"].ToString())) { string strCmdSno = objDataTable.Rows[intCount]["CMD_SNO"].ToString(); dicCmdSno[strCmdSno].CmdSno = objDataTable.Rows[intCount]["CMD_SNO"].ToString(); dicCmdSno[strCmdSno].Loc = objDataTable.Rows[intCount]["LOC"].ToString(); dicCmdSno[strCmdSno].NewLoc = objDataTable.Rows[intCount]["NEW_LOC"].ToString(); } else { clsCmdSno CmdSno = new clsCmdSno(); CmdSno.CmdSno = objDataTable.Rows[intCount]["CMD_SNO"].ToString(); CmdSno.Loc = objDataTable.Rows[intCount]["LOC"].ToString(); CmdSno.NewLoc = objDataTable.Rows[intCount]["NEW_LOC"].ToString(); CmdSno.Priority = int.Parse(objDataTable.Rows[intCount]["PRTY"].ToString()); dicCmdSno.Add(CmdSno.CmdSno, CmdSno); } } #endregion 取得命令 foreach (clsCmdSno CmdSno in dicCmdSno.Values) { #region 判斷是否為同Crane庫對庫命令 string strLoc_Row = CmdSno.Loc.Substring(0, 2); //Leon int intCrane = ((int.Parse(strLoc_Row) + 3) / 2); int intCrane = ((int.Parse(strLoc_Row) - 1) / 2 + 1); strLoc_Row = CmdSno.NewLoc.Substring(0, 2); //Leon int intNewCrane = ((int.Parse(strLoc_Row) + 3) / 4); int intNewCrane = ((int.Parse(strLoc_Row) - 1) / 2 + 1); string Source = string.Empty; string Destination = string.Empty; Source = CmdSno.Loc; Destination = CmdSno.NewLoc; SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); SystemTraceLog.LogMessage = "Find Transfer Cmd Success!"; SystemTraceLog.LeftCmdSno = CmdSno.CmdSno_L; SystemTraceLog.LocID = Source; SystemTraceLog.NewLocID = Destination; funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); if (clsSystem.intBegin == 0) { clsSystem.intBegin = 1; #region 更新Trace 和 EQUCMD clsSystem.funWriteExceptionLog("[funLocToLoc_ReleaseCraneCmd]", "更新Trace 和 EQUCMD [Begin-Start]", " CmdSno=" + CmdSno.CmdSno); if (clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Begin) == ErrDef.ProcSuccess) { if (funUpdateCmdTrace(CmdSno.CmdSno, clsCmdSts.cstrCmdSts_Start, clsTrace.cstrLocToLocTrace_ReleaseCraneCmd)) { //將命令寫入EQUCMD if (funInsertLocToLocEquCmd(intCrane, CmdSno.CmdSno, Source, Destination, CmdSno.Priority.ToString())) { clsSystem.funWriteExceptionLog("[funLocToLoc_ReleaseCraneCmd]", "更新Trace 和 EQUCMD [Commit-Start]", " CmdSno=" + CmdSno.CmdSno); clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Commit); SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); SystemTraceLog.LogMessage = "Transfer Cmd Initiated!"; SystemTraceLog.CmdSno = CmdSno.CmdSno; SystemTraceLog.CmdSts = clsCmdSts.cstrCmdSts_Start; SystemTraceLog.Trace = clsTrace.cstrLocToLocTrace_ReleaseCraneCmd; funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); } else { clsSystem.funWriteExceptionLog("[funLocToLoc_ReleaseCraneCmd]", "更新Trace 和 EQUCMD [Rollback-Start] Release Equ Cmd Fail!", " CmdSno=" + CmdSno.CmdSno); clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); SystemTraceLog.LogMessage = "Release Equ Cmd Fail!"; SystemTraceLog.CmdSno = CmdSno.CmdSno; SystemTraceLog.CmdSts = clsCmdSts.cstrCmdSts_Start; SystemTraceLog.CmdMode = clsEquCmdMode.cstrInMode; funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); } } else { clsSystem.funWriteExceptionLog("[funLocToLoc_ReleaseCraneCmd]", "更新Trace 和 EQUCMD [Rollback-Start] Update Transfer Cmd Trace Fail!", " CmdSno=" + CmdSno.CmdSno); clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); SystemTraceLog = new clsTraceLogEventArgs(enuTraceLog.System); SystemTraceLog.LogMessage = "Update Transfer Cmd Trace Fail!"; SystemTraceLog.CmdSno = CmdSno.CmdSno; SystemTraceLog.CmdSts = clsCmdSts.cstrCmdSts_Start; SystemTraceLog.Trace = clsTrace.cstrLocToLocTrace_ReleaseCraneCmd; funShowSystemTrace(lsbSystemTrace, SystemTraceLog, true); } } #endregion 更新Trace 和 EQUCMD clsSystem.intBegin = 0; } #endregion 判斷是否為同Crane庫對庫命令 } } } catch (Exception ex) { clsSystem.funWriteExceptionLog("[funLocToLoc_ReleaseCraneCmd]", "更新 Trace 和 EQUCMD Exception [Rollback-Start]", ""); clsSystem.gobjDB.funCommitCtrl(DB.enuTrnType.Rollback); var varObject = MethodBase.GetCurrentMethod(); clsSystem.funWriteExceptionLog(varObject.DeclaringType.FullName, varObject.Name, ex.Message); } finally { if (objDataTable != null) { objDataTable.Clear(); objDataTable.Dispose(); objDataTable = null; } if (dicCmdSno != null) { dicCmdSno.Clear(); dicCmdSno = null; } if (SystemTraceLog != null) { SystemTraceLog = null; } } }