コード例 #1
0
ファイル: AndonEqmCtrl.cs プロジェクト: radtek/Danfoss
        /// <summary>
        /// 更新历史安灯记录
        /// </summary>
        /// <param name="openSftwTime">首次打开软件的时间</param>
        /// <param name="playerIndex">播放器序列号</param>
        /// <returns>受影响记录条数</returns>
        public int UpdateHistroyAdn(DateTime openSftwTime, int playerIndex)
        {
            string where = string.Format(" call_time<='{0}' and SUBSTRING(play_record,{1},1)='1' order by call_time desc", openSftwTime.ToString("yyyy-MM-dd HH:mm:ss.fff"), playerIndex);
            DAO.SqlServerHelper         dbEngine = DAO.SqlServerHelper.CreateInstance(SqlConStr);
            List <Model.TableModel.Adn> listAnd  = dbEngine.QueryList <Model.TableModel.Adn>(where);

            foreach (Model.TableModel.Adn item in listAnd)
            {
                string newPlayRecord = CaclNewPlayRecord(item.play_record, playerIndex);
                item.play_record = newPlayRecord;
            }
            return(dbEngine.QueryInt <Model.TableModel.Adn>("Update", listAnd));
        }
コード例 #2
0
ファイル: AndonPlayer.cs プロジェクト: radtek/Danfoss
        /// <summary>
        /// 播放安灯呼叫
        /// </summary>
        /// <param name="dtOpenSftwDateTime">初次打开软件的事件</param>
        /// <param name="andonEqmIndex">安灯播放器编号</param>
        internal void Play(DateTime dtOpenSftwDateTime, int andonEqmIndex)
        {
            AndonPlayerIsRun = false;
            DAO.SqlServerHelper dbEngine = DAO.SqlServerHelper.CreateInstance(SqlConStr);
            string where = string.Format(" call_time>'{0}' and SUBSTRING(play_record,{1},1)='1' and is_finished='false' and andon_type_no in ({2}) order by call_time desc", dtOpenSftwDateTime.ToString("yyyy-MM-dd HH:mm:ss.fff"), andonEqmIndex, AndonType);
            List <Model.TableModel.Adn> listAdn = dbEngine.QueryList <Model.TableModel.Adn>(where);

            if (listAdn.Count <= 0)
            {
                return;
            }
            string musicName = listAdn[0].andon_music_no;

            _mp3.Play(AndonFilePath + "\\" + musicName, 5);
            int tim = _mp3.GetTimeLong();
            List <Model.TableModel.Adn> newListAdn = new List <Model.TableModel.Adn>();
            string newPlayRecord = CaclNewPlayRecord(listAdn[0].play_record, andonEqmIndex);

            listAdn[0].play_record = newPlayRecord;
            newListAdn.Add(listAdn[0]);
            dbEngine.QueryInt <Model.TableModel.Adn>("Update", newListAdn);
        }