Exemplo n.º 1
0
        //public void Send(S1F5 msg)
        //{
        //}
        public void Send(S2F31 msg)
        {
            XElement primary = new XElement("Primary");
            var      time    = NewItem("Time", "", "ASCII");

            time.Add(new XElement("Value", msg.time));
            primary.Add(time);
            Wrapper.SendAsync("Line05-8MMAO05", "S2F31", primary);
        }
Exemplo n.º 2
0
        protected virtual void S2F31ReceiveDateTimeSetReq(object sender, SECSEventArgs e)
        {
            try
            {
                S2F31 s2f31 = ((S2F31)e.secsHandler.Parse <S2F31>(e));

                SCUtility.secsActionRecordMsg(scApp, true, s2f31);
                SCUtility.actionRecordMsg(scApp, s2f31.StreamFunction, line.Real_ID,
                                          "Receive Date Time Set Request From MES.", "");
                if (!isProcess(s2f31))
                {
                    return;
                }

                S2F32 s2f32 = new S2F32();
                s2f32.SECSAgentName = scApp.EAPSecsAgentName;
                s2f32.SystemByte    = s2f31.SystemByte;
                s2f32.TIACK         = SECSConst.TIACK_Accepted;

                string   timeStr     = s2f31.TIME;
                DateTime mesDateTime = DateTime.Now;
                try
                {
                    mesDateTime = DateTime.ParseExact(timeStr.Trim(), SCAppConstants.TimestampFormat_16, CultureInfo.CurrentCulture);
                }
                catch (Exception dtEx)
                {
                    s2f32.TIACK = SECSConst.TIACK_Error_not_done;
                }

                SCUtility.secsActionRecordMsg(scApp, false, s2f32);
                ISECSControl.replySECS(bcfApp, s2f32);

                if (!DebugParameter.DisableSyncTime)
                {
                    SCUtility.updateSystemTime(mesDateTime);
                }

                //TODO 與設備同步
            }
            catch (Exception ex)
            {
                logger.Error("MESDefaultMapAction has Error[Line Name:{0}],[Error method:{1}],[Error Message:{2}",
                             line.LINE_ID, "S2F31_Receive_Date_Time_Set_Req", ex.ToString());
            }
        }