Esempio n. 1
0
        public static bool ChkCrnOutStnForOnlyOne(int nCrn, int nDes, string sStn, StnInfo stnInfo)
        {
            bool      bStnCanUse = true;
            DataTable dtEquCmd   = new DataTable();

            try
            {
                if (stnInfo.bAuto && stnInfo.bLoad == false && stnInfo.nCmdSno > 0 && stnInfo.nCmdMode > 0)
                {
                    string strSql = string.Format(@"select * from EquCmd where EquNo='{0}'  and CmdSts <= '1'", nCrn);
                    dbConn.ExecGetTable(strSql, ref dtEquCmd);

                    if (dtEquCmd.Rows.Count > 0)
                    {
                        sRunInfo = string.Format("站口:{0} 等待主机执行命令:{1}", sStn, dtEquCmd.Rows[0]["CmdSno"].ToString());
                        Log.WriteLog(cLog.RunLog, sRunInfo);
                        bStnCanUse = false;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriteLog(ex);
            }
            return(bStnCanUse);
        }
Esempio n. 2
0
        public static void SetStnLoad(string strArea, Hashtable hTvStns)
        {
            DataTable dtStn    = new DataTable();
            string    sStnName = string.Empty;

            try
            {
                string strSql = string.Format("select Station_Name from Wcs_Information where Area_No in ({0})", strArea);
                dbConn.ExecGetTable(strSql, ref dtStn);

                foreach (DataRow dr in dtStn.Rows)
                {
                    sStnName = dr["Station_Name"].ToString();
                    if (hTvStns.Contains(sStnName))
                    {
                        StnInfo stnInf = (StnInfo)hTvStns[sStnName];
                        strSql = string.Format("update Wcs_Information set BLoad ='{0}' where Station_Name ='{1}'", stnInf.bLoad ? "1" : "0", sStnName);
                        dbConn.ExecSql(strSql);
                    }
                }
            }
            catch (Exception ex)
            {
                Log.WriteLog(cLog.Exception, "setStnLoad\n\r" + dbConn.ErrorInfo);
                Log.WriteLog(ex);
            }
        }