Example #1
0
        public string TestSMSSend(string phones, string context)
        {
            string[] cells      = phones.Split(',');
            string   smsContent = context;

            return(SMSAgent.CallRemoteService(cells, smsContent));
        }
Example #2
0
        private void Execute(object paremeter)
        {
            ThreadParameter p           = paremeter as ThreadParameter;
            String          DataIndex   = p.DataIndex;
            String          invalidItem = p.InvalidItem;

            string[] cells = GetSMSCells();
            if (cells.Length == 0)
            {
                logger.Error("获取短信收件人电话失败,未设置SMSCells");
                return;
            }
            string smsContent = GetSMSContent(DataIndex, invalidItem);


            if (String.IsNullOrEmpty(smsContent))
            {
                logger.Error("获取短信内容失败,错误报告ID为:" + DataIndex);
                return;
            }
            smsContent = smsContent + "  " + DateTime.Now;
            var errorMsg = "";

            errorMsg = SMSAgent.CallRemoteService(cells, smsContent);
            RecordSMSItem(DataIndex, cells, smsContent, errorMsg);

            string smsTower = smsContent.ToUpper();

            #region 给领导发
            if (smsTower.Contains("#VALUE") ||
                smsTower.Contains("TRUE") ||
                smsTower.Contains("FALSE") ||
                smsTower.Contains("#N/A") ||
                smsTower.Contains("#REF!") ||
                smsTower.Contains("#DIV/0!") ||
                smsTower.Contains("#NUM!") ||
                smsTower.Contains("#NAME?") ||
                smsTower.Contains("#NULL!") ||
                smsTower.Contains("第一根断后伸长率的实测值为-") ||
                smsTower.Contains("第二根断后伸长率的实测值为-") ||
                smsTower.Contains("第一根屈服点的实测值为0") ||
                smsTower.Contains("第二根屈服点的实测值为0")
                )
            {
                logger.Error("内含关键词,不发送短信,DataID=" + DataIndex);
            }
            else
            {
                string[] cellsleader = GetSMSCellsLeader(DataIndex);
                if (cellsleader.Length > 0)
                {
                    errorMsg = SMSAgent.CallRemoteService(cellsleader, smsContent);
                    RecordSMSItem(DataIndex, cellsleader, smsContent, errorMsg);
                }
            }
            #endregion
            //给App推送消息
            SendAppMessage(p.LineID, DataIndex, p.TestRoomCode, p.SegmentName, p.CompanyName, p.TestRoomName, p.LineName, 1, smsContent);
        }
Example #3
0
        public void Execute(IJobExecutionContext context)
        {
            if (StartSMS())
            {
                logger.Info("开始执行龄期短信提醒...");

                //  增加查询条件 Scdel=0  2013-10-17
                String sql = @"select NodeCode from sys_engs_Tree
                where Scdel=0 and NodeType = '@folder' and NodeCode = '0001000100010002'";

                DataTable TestRoomData = GetDataTable(sql);
                if (TestRoomData != null)
                {
                    string[] cells = GetStadiumSMSCells();
                    if (cells.Length == 0)
                    {
                        logger.Error("获取龄期短信收件人电话失败,未设置StadiumSMSCells");
                        return;
                    }

                    foreach (DataRow Row in TestRoomData.Rows)
                    {
                        String    code        = Row["NodeCode"].ToString();
                        DataTable stadiumData = labstadiumlistManager.GetLabStaidumSMSList(code);
                        if (stadiumData != null && stadiumData.Rows.Count > 0)
                        {
                            logger.Info("发现" + stadiumData.Rows.Count + "条试验龄期信息");

                            String        prevtestItem = "";
                            String        smsContent   = "试验提醒:";
                            List <String> Lines        = new List <String>();
                            foreach (DataRow stadiumRow in stadiumData.Rows)
                            {
                                string wtbh     = stadiumRow["委托编号"].ToString();
                                string testItem = stadiumRow["试验项目"].ToString();

                                if (wtbh.Trim() == "")
                                {
                                    continue;
                                }

                                string partwtbh = wtbh;
                                int    index    = wtbh.IndexOf(DateTime.Now.Year.ToString());
                                if (index != -1)
                                {
                                    partwtbh = "尾号" + wtbh.Substring(index);
                                }

                                if (testItem != prevtestItem)
                                {
                                    DataRow[] rows = stadiumData.Select("试验项目='" + testItem + "'");
                                    smsContent   = smsContent + "\r\n" + testItem.Trim() + "(" + rows.Length + ")";
                                    prevtestItem = testItem;
                                }

                                smsContent = smsContent + "\r\n" + partwtbh + ",";
                            }

                            smsContent = smsContent.Trim(',') + "\r\n" + DateTime.Now;

                            logger.Info(smsContent);

                            var    errorMsg   = "";
                            String subContent = smsContent;

                            int i = 1;
                            while (subContent.Length > 70)
                            {
                                string content = subContent.Substring(0, 70);
                                errorMsg  += SMSAgent.CallRemoteService(cells, content);
                                subContent = subContent.Replace(content, "");
                                i++;
                            }
                            if (subContent.Length > 0)
                            {
                                errorMsg += SMSAgent.CallRemoteService(cells, subContent);
                            }
                            RecordSMSItem(code, cells, smsContent, errorMsg);
                        }
                    }

                    logger.Info("发送龄期短信提醒完毕");
                }
                else
                {
                    logger.Info("获取试验室编码列表失败");
                }
            }
        }