Esempio n. 1
0
        private void SendDeviceStatus(string ServiceName, string AlarmDesc)
        {
            string id       = Guid.NewGuid().ToString();
            string deviceNo = ServiceName.Substring(3, 4);

            string mode = ObjectUtil.GetObject(Context.ProcessDispatcher.WriteToService(ServiceName, "WorkMode")).ToString();

            object[] Status      = ObjectUtil.GetObjects(Context.ProcessDispatcher.WriteToService(ServiceName, "Status"));
            object[] OtherStatus = ObjectUtil.GetObjects(Context.ProcessDispatcher.WriteToService(ServiceName, "OtherStatus"));
            string   status      = OtherStatus[1].ToString();
            string   aisleNo     = OtherStatus[2].ToString();
            string   taskNo      = Util.ConvertStringChar.BytesToString(ObjectUtil.GetObjects(WriteToService(ServiceName, "ReadTaskNo")));
            string   fork        = Status[3].ToString();
            string   load        = Status[0].ToString();
            string   column      = Status[1].ToString();
            string   layer       = Status[2].ToString();
            string   alarmCode   = ObjectUtil.GetObject(Context.ProcessDispatcher.WriteToService(ServiceName, "AlarmCode")).ToString();
            string   field1      = AlarmDesc;
            string   sender1     = "admin";

            string Json = "[{\"id\":\"" + id + "\",\"deviceNo\":\"" + deviceNo + "\",\"mode\":\"" + mode + "\",\"status\":\"" + status + "\",\"taskNo\":\"" + taskNo + "\",\"fork\":\"" + fork + "\",\"load\":\"" + load + "\",\"aisleNo\":\"" + aisleNo + "\",\"column\":\"" + column + "\",\"layer\":\"" + layer + "\",\"alarmCode\":\"" + alarmCode + "\",\"sendDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"sender\":\"" + sender1 + "\",\"field1\":\"" + field1 + "\",\"field2\":\"\",\"field3\":\"\"" + "}]";

            Logger.Info("上报设备状态");
            string     message    = Program.send("transWCSDevice", Json);
            RtnMessage rtnMessage = JsonHelper.JSONToObject <RtnMessage>(message);

            Logger.Info("上报设备状态,收到反馈:" + rtnMessage.returnCode + ":" + rtnMessage.message);
        }
Esempio n. 2
0
        public void SendDeviceStatus2(Context context, string ServiceName, string carNo, string AlarmDesc)
        {
            string id = Guid.NewGuid().ToString();

            string aisleNo  = ServiceName.Substring(5, 2);
            string deviceNo = aisleNo + carNo;

            object[] Status    = ObjectUtil.GetObjects(context.ProcessDispatcher.WriteToService(ServiceName, "CarStatus" + carNo));
            string   mode      = Status[0].ToString();
            string   status    = Status[12].ToString();
            string   taskNo    = Util.ConvertStringChar.BytesToString(ObjectUtil.GetObjects(context.ProcessDispatcher.WriteToService(ServiceName, "CarTask" + carNo)));
            string   fork      = Status[11].ToString();
            string   load      = Status[10].ToString();
            string   column    = Status[2].ToString();
            string   layer     = Status[3].ToString();
            string   alarmCode = ObjectUtil.GetObject(context.ProcessDispatcher.WriteToService(ServiceName, "CarAlarm" + carNo)).ToString();
            string   field2    = AlarmDesc;
            string   sender1   = "ROBO_WCS";

            string Json = "[{\"id\":\"" + id + "\",\"deviceNo\":\"" + Program.WarehouseCode + deviceNo + "\",\"mode\":\"" + mode + "\",\"status\":\"" + status + "\",\"taskNo\":\"" + taskNo + "\",\"fork\":\"" + fork + "\",\"load\":\"" + load + "\",\"aisleNo\":\"" + aisleNo + "\",\"column\":\"" + column + "\",\"layer\":\"" + layer + "\",\"alarmCode\":\"" + alarmCode + "\",\"sendDate\":\"" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff") + "\",\"sender\":\"" + sender1 + "\",\"field1\":\"\",\"field2\":\"" + field2 + "\",\"field3\":\"\"" + "}]";

            Logger.Debug("开始上报设备编号[" + deviceNo + "]的状态");
            string     message    = Program.send("transWCSDevice", Json);
            RtnMessage rtnMessage = JsonHelper.JSONToObject <RtnMessage>(message);

            Logger.Debug("上报设备编号[" + deviceNo + "]状态,收到反馈:" + rtnMessage.returnCode + ":" + rtnMessage.message);
        }