diff --git a/main_cy.py b/main_cy.py index 33de91e..5267277 100644 --- a/main_cy.py +++ b/main_cy.py @@ -15,55 +15,96 @@ def on_send_connect(client, userdata, flags, rc, p): def on_receive_connect(client, userdata, flags, rc, p): if rc == 'Success': print("mqtt:接收客户端连接成功") - # 主线体-plc - client.subscribe('linuoruite/220202020240301008/XT/up/system') - # 边框上料-机器人 - client.subscribe('linuoruite/220202020240301008/BKSLroboot/up/system') - # 边框上料-边框上料工站 - client.subscribe('linuoruite/220202020240301008/BKSLstation/up/system') - # 边框上料-标签粘贴打印机 - client.subscribe('linuoruite/220202020240301008/BKSLprinter/up/system') - # 板芯安装-板芯安装机器人 - client.subscribe('linuoruite/220202020240301008/BXAZroboot/up/system') - # 板芯安装-板芯红环检测,此板块不进行任何对接 - # 板芯安装-撕膜机 - client.subscribe('linuoruite/220202020240301008/BXAZsmj/up/system') - # 板芯安装-板芯安装工站 - client.subscribe('linuoruite/220202020240301008/BXAZstation/up/system') - # 护丝帽安装-护丝帽工站 - client.subscribe('linuoruite/220202020240301008/MFQAZstation/up/system') - # 护丝帽安装-护丝帽安装机器人 - client.subscribe('linuoruite/220202020240301008/MFQAZroboot/up/system') - # 卡子安装-卡子工站 - client.subscribe('linuoruite/220202020240301008/KZAZstation/up/system') - # 卡子安装-卡子安装机器人 - client.subscribe('linuoruite/220202020240301008/KZAZroboot/up/system') - # 自动涂胶-涂胶机 - client.subscribe('linuoruite/220202020240301008/TJtjj/up/system') - # 自动涂胶-自动涂胶机器人 - client.subscribe('linuoruite/220202020240301008/TJrobot/up/system') - # 玻璃安装-玻璃安装机器人 - client.subscribe('linuoruite/220202020240301008/BLAZrobot/up/system') - # 玻璃安装-玻璃安装工站 - client.subscribe('linuoruite/220202020240301008/BLAZstation/up/system') - # 压条安装-压条专机 - client.subscribe('linuoruite/220202020240301008/YTAZstation/up/system') - # LOGO喷印工站-LOGO喷印机 - client.subscribe('linuoruite/220202020240301008/PYTMstation/up/system') - # AI外观检测-相机 - client.subscribe('linuoruite/220202020240301008/WGJCstation/up/system') - # 自动贴膜-自动贴膜工站 - client.subscribe('linuoruite/220202020240301008/ZDTMstation/up/system') - # 自动包装-包装机 - client.subscribe('linuoruite/220202020240301008/ZDBZpacking/up/system') - # 自动包装-打包机 - client.subscribe('linuoruite/220202020240301008/ZDBZbundler/up/system') - # 码垛入库-机器人 - client.subscribe('linuoruite/220202020240301008/MDRKrobot/up/system') - # 码垛入库-码垛入库工站 - client.subscribe('linuoruite/220202020240301008/MDRKstation/up/system') - # 码垛入库-打印机 - client.subscribe('linuoruite/220202020240301008/MDRKprinter/up/system') + # 总控-主控制柜、主线体-plc + client.subscribe('linuoruite/20250709/XT/up/system') + # 打口踏平工站-专机 + client.subscribe('linuoruite/20250709/CY04/up/system') + # 上端盖安装工站-工站 + client.subscribe('linuoruite/20250709/CY06Station/up/system') + # 上端盖安装工站-上端盖安装机器人 + client.subscribe('linuoruite/20250709/CY06Robot/up/system') + # 外桶转序工站-工站 + client.subscribe('linuoruite/20250709/CY07Station/up/system') + # 外桶转序工站-放外桶机器人 + client.subscribe('linuoruite/20250709/CY07Robot/up/system') + # 热泵水箱装配工站-工站 + client.subscribe('linuoruite/20250709/CY08Station/up/system') + # 热泵水箱装配工站-热泵装配机器人 + client.subscribe('linuoruite/20250709/CY08Robot/up/system') + # 承压水箱装配工站-工站 + client.subscribe('linuoruite/20250709/CY09Station/up/system') + # 承压水箱装配工站-取内胆机器人 + client.subscribe('linuoruite/20250709/CY09ndRobot/up/system') + # 承压水箱装配工站-装配内胆机器人 + client.subscribe('linuoruite/20250709/CY09zpRobot/up/system') + # 挂架安装靠块安装-自动打钉机器人 + client.subscribe('linuoruite/20250709/CY10nailRobot/up/system') + # 挂架安装靠块安装-靠块上料机器人 + client.subscribe('linuoruite/20250709/CY10rapidRobot/up/system') + # 挂架安装靠块安装-挂架上料机器人 + client.subscribe('linuoruite/20250709/CY10rackRobot/up/system') + # 挂架安装靠块安装-工站 + client.subscribe('linuoruite/20250709/CY10Station/up/system') + # 内胆泡沫装配工站-工站 + client.subscribe('linuoruite/20250709/CY11Station/up/system') + # 内胆泡沫装配工站-内胆泡沫装配机器人 + client.subscribe('linuoruite/20250709/CY11Robot/up/system') + # 下端盖安装工站-工站 + client.subscribe('linuoruite/20250709/CY13Station/up/system') + # 下端盖安装工站-下端盖装配机器人 + client.subscribe('linuoruite/20250709/CY13Robot/up/system') + # 发泡注料工站-工站 + client.subscribe('linuoruite/20250709/CY14Station/up/system') + # 发泡注料工站-注胶机器人 + client.subscribe('linuoruite/20250709/CY14Robot/up/system') + # 发泡注料工站-发泡机 + client.subscribe('linuoruite/20250709/CY14FM/up/system') + # 注料口扣盖工站-工站 + client.subscribe('linuoruite/20250709/CY15Station/up/system') + # 注料口扣盖工站-扣盖机器人 + client.subscribe('linuoruite/20250709/CY15Robot/up/system') + # 水箱贴标工站-工站 + client.subscribe('linuoruite/20250709/CY16Station/up/system') + # 水箱贴标工站-贴标机器人 + client.subscribe('linuoruite/20250709/CY16Robot/up/system') + # 水箱贴标工站-铭牌打印机 + client.subscribe('linuoruite/20250709/CY16plaquePrinter/up/system') + # 水箱贴标工站-能效打印机 + client.subscribe('linuoruite/20250709/CY16efficientPrint/up/system') + # 维修盖安装-工站 + client.subscribe('linuoruite/20250709/CY17Station/up/system') + # 维修盖安装-维修盖排列专机 + client.subscribe('linuoruite/20250709/CY17special/up/system') + # 维修盖安装-维修盖标签打印机 + client.subscribe('linuoruite/20250709/CY17print/up/system') + # 维修盖安装-维修盖装配机器人 + client.subscribe('linuoruite/20250709/CY17robot/up/system') + # 安全性能检测-安检仪 + client.subscribe('linuoruite/20250709/CY18Station/up/system') + # 外观视觉检测-工站 + client.subscribe('linuoruite/20250709/CY19Station/up/system') + # 自动套袋工站-专机 + client.subscribe('linuoruite/20250709/CY20Station/up/system') + # 自动套箱工站-工站 + client.subscribe('linuoruite/20250709/CY21Station/up/system') + # 自动套箱工站-套箱机器人 + client.subscribe('linuoruite/20250709/CY21robot/up/system') + # 预遮盖+泡沫装配工站-工站 + client.subscribe('linuoruite/20250709/CY22Station/up/system') + # 预遮盖+泡沫装配工站-泡沫装配机器人 + client.subscribe('linuoruite/20250709/CY22robot/up/system') + # 自动封箱工站-专机 + client.subscribe('linuoruite/20250709/CY23Station/up/system') + # 包装箱贴标工站-工站 + client.subscribe('linuoruite/20250709/CY24Station/up/system') + # 包装箱贴标工站-外包装打印机 + client.subscribe('linuoruite/20250709/CY24print/up/system') + # 自动打包工站-专机 + client.subscribe('linuoruite/20250709/CY25Station/up/system') + # 码垛入库工站-工站 + client.subscribe('linuoruite/20250709/CY26Station/up/system') + # 码垛入库工站-套箱机器人 + client.subscribe('linuoruite/20250709/CY26robot/up/system') print("mqtt:接收客户端订阅成功") @@ -90,308 +131,456 @@ def on_receive_message(client, userdata, msg): send_data = json.loads(data_str) send_data['timeStamp'] = timestamp p_status = '3' - if topic == 'linuoruite/220202020240301008/XT/up/system': - if receive_data[0]['XT_breakdown'] == 1: + if topic == 'linuoruite/20250709/XT/up/system': + if receive_data[3]['XT_breakdown'] == 1: p_status = '4' - elif receive_data[1]['XT_pause'] == 1: + elif receive_data[2]['XT_pause'] == 1: p_status = '5' - elif receive_data[2]['XT_run'] == 1: + elif receive_data[1]['XT_run'] == 1: p_status = '3' send_data['state']['reported']['pStatus'] = p_status - XT_upph = receive_data[3]['XT_upph'] - send_data['state']['reported']['XT_upph'] = XT_upph - XT_xiaohao = receive_data[4]['XT_xiaohao'] + XT_xiaohao = receive_data[0]['XT_xiaohao'] send_data['state']['reported']['XT_xiaohao'] = XT_xiaohao - elif topic == 'linuoruite/220202020240301008/BKSLroboot/up/system': - if receive_data[0]['BKSL_robot_breakdown'] == 1: - p_status = '4' - elif receive_data[1]['BKSL_robot_pause'] == 1: - p_status = '5' - elif receive_data[2]['BKSL_robot_run'] == 1: + XT_upph = receive_data[4]['XT_upph'] + send_data['state']['reported']['XT_upph'] = XT_upph + XT_sl = receive_data[5]['XT_sl'] + send_data['state']['reported']['XT_sl'] = XT_sl + XT_xiaxian = receive_data[6]['XT_xiaxian'] + send_data['state']['reported']['XT_xiaxian'] = XT_xiaxian + XT_buliang = receive_data[7]['XT_buliang'] + send_data['state']['reported']['XT_buliang'] = XT_buliang + elif topic == 'linuoruite/20250709/CY04/up/system': + if receive_data[0]['CY04_run'] == 1: p_status = '3' - send_data['state']['reported']['pStatus'] = p_status - elif topic == 'linuoruite/220202020240301008/BKSLstation/up/system': - if receive_data[3]['BKSL_station_breakdown'] == 1: - p_status = '4' - elif receive_data[4]['BKSL_station_pause'] == 1: + elif receive_data[1]['CY04_pause'] == 1: p_status = '5' - elif receive_data[5]['BKSL_station_run'] == 1: - p_status = '3' - send_data['state']['reported']['pStatus'] = p_status - BKSL_beat = receive_data[0]['BKSL_beat'] - send_data['state']['reported']['BKSL_beat'] = BKSL_beat - BKSL_count = receive_data[1]['BKSL_count'] - send_data['state']['reported']['BKSL_count'] = BKSL_count - BKSL_encoding = receive_data[2]['BKSL_encoding'] - send_data['state']['reported']['BKSL_encoding'] = BKSL_encoding - elif topic == 'linuoruite/220202020240301008/BKSLprinter/up/system': - if receive_data[0]['BKSL_printer_breakdown'] == 1: + elif receive_data[2]['CY04_breakdown'] == 1: p_status = '4' - elif receive_data[1]['BKSL_printer_pause'] == 1: - p_status = '5' - elif receive_data[3]['BKSL_printer_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - BKSL_printer_qlyj = receive_data[2]['BKSL_printer_qlyj'] - send_data['state']['reported']['BKSL_printer_qlyj'] = BKSL_printer_qlyj - elif topic == 'linuoruite/220202020240301008/BXAZroboot/up/system': - if receive_data[1]['BXAZ_robot_breakdown'] == 1: + CY04_beat = receive_data[3]['CY04_beat'] + send_data['state']['reported']['CY04_beat'] = CY04_beat + elif topic == 'linuoruite/20250709/CY06Station/up/system': + if receive_data[0]['CY06_run'] == 1: + p_status = '3' + elif receive_data[1]['CY06_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY06_breakdown'] == 1: p_status = '4' - elif receive_data[2]['BXAZ_robot_pause'] == 1: - p_status = '5' - elif receive_data[3]['BXAZ_robot_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - BXAZ_robot_beat = receive_data[0]['BXAZ_robot_beat'] - send_data['state']['reported']['BXAZ_robot_beat'] = BXAZ_robot_beat - BXAZ_time = receive_data[4]['BXAZ_time'] - send_data['state']['reported']['BXAZ_time'] = BXAZ_time - elif topic == 'linuoruite/220202020240301008/BXAZsmj/up/system': - if receive_data[1]['BXAZ_smj_breakdown'] == 1: + CY06_beat = receive_data[3]['CY06_beat'] + send_data['state']['reported']['CY06_beat'] = CY06_beat + elif topic == 'linuoruite/20250709/CY06Robot/up/system': + if receive_data[0]['CY06_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY06_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY06_robot_breakdown'] == 1: p_status = '4' - elif receive_data[2]['BXAZ_smj_pause'] == 1: - p_status = '5' - elif receive_data[4]['BXAZ_smj_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - BXAZ_smj_beat = receive_data[0]['BXAZ_smj_beat'] - send_data['state']['reported']['BXAZ_smj_beat'] = BXAZ_smj_beat - BXAZ_smj_result = receive_data[3]['BXAZ_smj_result'] - send_data['state']['reported']['BXAZ_smj_result'] = BXAZ_smj_result - elif topic == 'linuoruite/220202020240301008/BXAZstation/up/system': - if receive_data[1]['BXAZ_station_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY07Station/up/system': + if receive_data[0]['CY07_run'] == 1: + p_status = '3' + elif receive_data[1]['CY07_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY07_breakdown'] == 1: p_status = '4' - elif receive_data[2]['BXAZ_station_pause'] == 1: - p_status = '5' - elif receive_data[3]['BXAZ_station_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - BXAZ_beat = receive_data[0]['BXAZ_beat'] - send_data['state']['reported']['BXAZ_beat'] = BXAZ_beat - elif topic == 'linuoruite/220202020240301008/MFQAZstation/up/system': - if receive_data[1]['MFQAN_station_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY07Robot/up/system': + if receive_data[0]['CY07_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY07_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY07_robot_breakdown'] == 1: p_status = '4' - elif receive_data[2]['MFQAN_station_pause'] == 1: - p_status = '5' - elif receive_data[3]['MFQAN_station_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - MFQAN_beat = receive_data[0]['MFQAN_beat'] - send_data['state']['reported']['MFQAN_beat'] = MFQAN_beat - MFQAN_time = receive_data[4]['MFQAN_time'] - send_data['state']['reported']['MFQAN_time'] = MFQAN_time - elif topic == 'linuoruite/220202020240301008/MFQAZroboot/up/system': - if receive_data[0]['MFQAN_robot_breakdown'] == 1: + CY07_beat = receive_data[3]['CY07_beat'] + send_data['state']['reported']['CY07_beat'] = CY07_beat + elif topic == 'linuoruite/20250709/CY08Station/up/system': + if receive_data[0]['CY08_run'] == 1: + p_status = '3' + elif receive_data[1]['CY08_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY08_breakdown'] == 1: p_status = '4' - elif receive_data[1]['MFQAN_robot_pause'] == 1: - p_status = '5' - elif receive_data[2]['MFQAZ_robot_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - elif topic == 'linuoruite/220202020240301008/KZAZstation/up/system': - if receive_data[1]['KZAZ_station_breakdown'] == 1: + CY08_beat = receive_data[3]['CY08_beat'] + send_data['state']['reported']['CY08_beat'] = CY08_beat + elif topic == 'linuoruite/20250709/CY08Robot/up/system': + if receive_data[0]['CY08_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY08_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY08_robot_breakdown'] == 1: p_status = '4' - elif receive_data[2]['KZAZ_station_pause'] == 1: - p_status = '5' - elif receive_data[3]['KZAZ_station_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - KZAZ_station_beat = receive_data[0]['KZAZ_station_beat'] - send_data['state']['reported']['KZAZ_station_beat'] = KZAZ_station_beat - KZAZ_station_time = receive_data[4]['KZAZ_station_time'] - send_data['state']['reported']['KZAZ_station_time'] = KZAZ_station_time - elif topic == 'linuoruite/220202020240301008/KZAZroboot/up/system': - if receive_data[0]['KZAZ_robot_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY09Station/up/system': + if receive_data[0]['CY09_run'] == 1: + p_status = '3' + elif receive_data[1]['CY09_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY09_breakdown'] == 1: p_status = '4' - elif receive_data[1]['KZAZ_robot_pause'] == 1: - p_status = '5' - elif receive_data[2]['KZAZ_robot_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - elif topic == 'linuoruite/220202020240301008/TJtjj/up/system': - if receive_data[1]['TJ_tjj_breakdown'] == 1: + CY09_beat = receive_data[3]['CY09_beat'] + send_data['state']['reported']['CY09_beat'] = CY09_beat + elif topic == 'linuoruite/20250709/CY09ndRobot/up/system': + if receive_data[0]['CY09_ndRobot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY09_ndRobot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY09_ndRobot_breakdown'] == 1: p_status = '4' - elif receive_data[3]['TJ_tjj_pause'] == 1: - p_status = '5' - elif receive_data[7]['TJ_tjj_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - TJ_tjj_beat = receive_data[0]['TJ_tjj_beat'] - send_data['state']['reported']['TJ_tjj_beat'] = TJ_tjj_beat - TJ_tjj_glue = receive_data[2]['TJ_tjj_glue'] - send_data['state']['reported']['TJ_tjj_glue'] = TJ_tjj_glue - TJ_tjj_product = receive_data[4]['TJ_tjj_product'] - send_data['state']['reported']['TJ_tjj_product'] = TJ_tjj_product - TJ_tjj_refill = receive_data[5]['TJ_tjj_refill'] - send_data['state']['reported']['TJ_tjj_refill'] = TJ_tjj_refill - TJ_tjj_remain = receive_data[6]['TJ_tjj_remain'] - send_data['state']['reported']['TJ_tjj_remain'] = TJ_tjj_remain - TJ_tjj_stress = receive_data[8]['TJ_tjj_stress'] - send_data['state']['reported']['TJ_tjj_stress'] = TJ_tjj_stress - elif topic == 'linuoruite/220202020240301008/TJrobot/up/system': - if receive_data[1]['TJ_robot_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY09zpRobot/up/system': + if receive_data[0]['CY09_zpRobot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY09_zpRobot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY09_zpRobot_breakdown'] == 1: p_status = '4' - elif receive_data[2]['TJ_robot_pause'] == 1: - p_status = '5' - elif receive_data[3]['TJ_robot_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - TJ_beat = receive_data[0]['TJ_beat'] - send_data['state']['reported']['TJ_beat'] = TJ_beat - TJ_time = receive_data[4]['TJ_time'] - send_data['state']['reported']['TJ_time'] = TJ_time - elif topic == 'linuoruite/220202020240301008/BLAZrobot/up/system': - if receive_data[0]['BLAZ_robot_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY10nailRobot/up/system': + if receive_data[2]['CY10_nailRobot_run'] == 1: + p_status = '3' + elif receive_data[3]['CY10_nailRobot_pause'] == 1: + p_status = '5' + elif receive_data[4]['CY10_nailRobot_breakdown'] == 1: p_status = '4' - elif receive_data[1]['BLAZ_robot_pause'] == 1: - p_status = '5' - elif receive_data[2]['BLAZ_robot_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - elif topic == 'linuoruite/220202020240301008/BLAZstation/up/system': - if receive_data[2]['BLAZ_station_breakdown'] == 1: + CY10_nailRobot_angle = receive_data[0]['CY10_nailRobot_angle'] + send_data['state']['reported']['CY10_nailRobot_angle'] = CY10_nailRobot_angle + CY10_nailRobot_torque = receive_data[1]['CY10_nailRobot_torque'] + send_data['state']['reported']['CY10_nailRobot_torque'] = CY10_nailRobot_torque + elif topic == 'linuoruite/20250709/CY10rapidRobot/up/system': + if receive_data[0]['CY10_rapidRobot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY10_rapidRobot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY10_rapidRobot_breakdown'] == 1: p_status = '4' - elif receive_data[3]['BLAZ_station_pause'] == 1: - p_status = '5' - elif receive_data[4]['BLAZ_station_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - BLAZ_quantity = receive_data[0]['BLAZ_quantity'] - send_data['state']['reported']['BLAZ_quantity'] = BLAZ_quantity - BLAZ_station_beat = receive_data[1]['BLAZ_station_beat'] - send_data['state']['reported']['BLAZ_station_beat'] = BLAZ_station_beat - BLAZ_time = receive_data[5]['BLAZ_time'] - send_data['state']['reported']['BLAZ_time'] = BLAZ_time - elif topic == 'linuoruite/220202020240301008/YTAZstation/up/system': - if receive_data[1]['YTAZ_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY10rackRobot/up/system': + if receive_data[0]['CY10_rackRobot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY10_rackRobot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY10_rackRobot_breakdown'] == 1: p_status = '4' - elif receive_data[2]['YTAZ_pause'] == 1: - p_status = '5' - elif receive_data[4]['YTAZ_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - YTAZ_beat = receive_data[0]['YTAZ_beat'] - send_data['state']['reported']['YTAZ_beat'] = YTAZ_beat - YTAZ_quantity = receive_data[3]['YTAZ_quantity'] - send_data['state']['reported']['YTAZ_quantity'] = YTAZ_quantity - YTAZ_time = receive_data[5]['YTAZ_time'] - send_data['state']['reported']['YTAZ_time'] = YTAZ_time - YTAZ_yj = receive_data[6]['YTAZ_yj'] - send_data['state']['reported']['YTAZ_yj'] = YTAZ_yj - elif topic == 'linuoruite/220202020240301008/PYTMstation/up/system': - if receive_data[0]['PYTM_inkjet_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY10Station/up/system': + if receive_data[0]['CY10_run'] == 1: + p_status = '3' + elif receive_data[1]['CY10_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY10_breakdown'] == 1: p_status = '4' - elif receive_data[2]['PYTM_inkjet_pause'] == 1: - p_status = '5' - elif receive_data[3]['PYTM_inkjet_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - PYTM_inkjet_qlyj = receive_data[1]['PYTM_inkjet_qlyj'] - send_data['state']['reported']['PYTM_inkjet_qlyj'] = PYTM_inkjet_qlyj - PYTM_beat = receive_data[4]['PYTM_beat'] - send_data['state']['reported']['PYTM_beat'] = PYTM_beat - elif topic == 'linuoruite/220202020240301008/WGJCstation/up/system': - if receive_data[4]['WGJC_breakdown'] == 1: + CY10_beat = receive_data[3]['CY10_beat'] + send_data['state']['reported']['CY10_beat'] = CY10_beat + elif topic == 'linuoruite/20250709/CY11Station/up/system': + if receive_data[0]['CY11_run'] == 1: + p_status = '3' + elif receive_data[1]['CY11_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY11_berakdown'] == 1: p_status = '4' - elif receive_data[8]['WGJC_pause'] == 1: - p_status = '5' - elif receive_data[11]['WGJC_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - WGJC_beat = receive_data[0]['WGJC_beat'] - send_data['state']['reported']['WGJC_beat'] = WGJC_beat - WGJC_bkhh = receive_data[1]['WGJC_bkhh'] - send_data['state']['reported']['WGJC_bkhh'] = WGJC_bkhh - WGJC_blhh = receive_data[2]['WGJC_blhh'] - send_data['state']['reported']['WGJC_blhh'] = WGJC_blhh - WGJC_bq = receive_data[3]['WGJC_bq'] - send_data['state']['reported']['WGJC_bq'] = WGJC_bq - WGJC_cpm = receive_data[5]['WGJC_cpm'] - send_data['state']['reported']['WGJC_cpm'] = WGJC_cpm - WGJC_jcjg = receive_data[6]['WGJC_jcjg'] - send_data['state']['reported']['WGJC_jcjg'] = WGJC_jcjg - WGJC_jcqx = receive_data[7]['WGJC_jcqx'] - send_data['state']['reported']['WGJC_jcqx'] = WGJC_jcqx - WGJC_peijian = receive_data[9]['WGJC_peijian'] - send_data['state']['reported']['WGJC_peijian'] = WGJC_peijian - WGJC_pycs = receive_data[10]['WGJC_pycs'] - send_data['state']['reported']['WGJC_pycs'] = WGJC_pycs - WGJC_yj = receive_data[12]['WGJC_yj'] - send_data['state']['reported']['WGJC_yj'] = WGJC_yj - WGJC_ytfx = receive_data[13]['WGJC_ytfx'] - send_data['state']['reported']['WGJC_ytfx'] = WGJC_ytfx - elif topic == 'linuoruite/220202020240301008/ZDTMstation/up/system': - if receive_data[1]['ZDTM_breakdown'] == 1: + CY11_beat = receive_data[3]['CY11_beat'] + send_data['state']['reported']['CY11_beat'] = CY11_beat + elif topic == 'linuoruite/20250709/CY11Robot/up/system': + if receive_data[0]['CY11_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY11_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY11_robot_breakdown'] == 1: p_status = '4' - elif receive_data[2]['ZDTM_pause'] == 1: - p_status = '5' - elif receive_data[3]['ZDTM_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - ZDTM_beat = receive_data[0]['ZDTM_beat'] - send_data['state']['reported']['ZDTM_beat'] = ZDTM_beat - elif topic == 'linuoruite/220202020240301008/ZDBZpacking/up/system': - if receive_data[1]['ZDBZ_packing_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY13Station/up/system': + if receive_data[0]['CY13_run'] == 1: + p_status = '3' + elif receive_data[1]['CY13_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY06_breakdown'] == 1: p_status = '4' - elif receive_data[2]['ZDBZ_packing_pause'] == 1: - p_status = '5' - elif receive_data[4]['ZDBZ_packing_run'] == 1: + send_data['state']['CY13_breakdown']['pStatus'] = p_status + CY13_beat = receive_data[3]['CY13_beat'] + send_data['state']['reported']['CY13_beat'] = CY13_beat + elif topic == 'linuoruite/20250709/CY13Robot/up/system': + if receive_data[0]['CY13_robot_run'] == 1: p_status = '3' - send_data['state']['reported']['pStatus'] = p_status - ZDBZ_packing_beat = receive_data[0]['ZDBZ_packing_beat'] - send_data['state']['reported']['ZDBZ_packing_beat'] = ZDBZ_packing_beat - ZDBZ_packing_qlyj = receive_data[3]['ZDBZ_packing_qlyj'] - send_data['state']['reported']['ZDBZ_packing_qlyj'] = ZDBZ_packing_qlyj - elif topic == 'linuoruite/220202020240301008/ZDBZbundler/up/system': - if receive_data[1]['ZDBZ_bundler_breakdown'] == 1: + elif receive_data[1]['CY13_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY13_robot_breakdown'] == 1: p_status = '4' - elif receive_data[2]['ZDBZ_bundler_pause'] == 1: - p_status = '5' - elif receive_data[4]['ZDBZ_bundler_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - ZDBZ_bundler_beat = receive_data[0]['ZDBZ_bundler_beat'] - send_data['state']['reported']['ZDBZ_bundler_beat'] = ZDBZ_bundler_beat - ZDBZ_bundler_qlyj = receive_data[3]['ZDBZ_bundler_qlyj'] - send_data['state']['reported']['ZDBZ_bundler_qlyj'] = ZDBZ_bundler_qlyj - elif topic == 'linuoruite/220202020240301008/MDRKrobot/up/system': - if receive_data[0]['MDRK_robot_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY14Station/up/system': + if receive_data[0]['CY14_run'] == 1: + p_status = '3' + elif receive_data[1]['CY14_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY14_breakdown'] == 1: p_status = '4' - elif receive_data[1]['MDRK_robot_puase'] == 1: - p_status = '5' - elif receive_data[2]['MDRK_robot_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - elif topic == 'linuoruite/220202020240301008/MDRKstation/up/system': - if receive_data[4]['MDRK_station_breatdown'] == 1: + CY14_beat = receive_data[3]['CY14_beat'] + send_data['state']['reported']['CY14_beat'] = CY14_beat + elif topic == 'linuoruite/20250709/CY14Robot/up/system': + if receive_data[0]['CY14_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY14_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY14_robot_breakdown'] == 1: p_status = '4' - elif receive_data[5]['MDRK_station_puase'] == 1: - p_status = '5' - elif receive_data[6]['MDRK_station_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - MDRK_beat = receive_data[0]['MDRK_beat'] - send_data['state']['reported']['MDRK_beat'] = MDRK_beat - MDRK_cpm = receive_data[1]['MDRK_cpm'] - send_data['state']['reported']['MDRK_cpm'] = MDRK_cpm - MDRK_quantity = receive_data[2]['MDRK_quantity'] - send_data['state']['reported']['MDRK_quantity'] = MDRK_quantity - MDRK_signal = receive_data[3]['MDRK_signal'] - send_data['state']['reported']['MDRK_signal'] = MDRK_signal - MDRK_tpm = receive_data[7]['MDRK_tpm'] - send_data['state']['reported']['MDRK_tpm'] = MDRK_tpm - elif topic == 'linuoruite/220202020240301008/MDRKprinter/up/system': - if receive_data[1]['ZDBZ_printer_breakdown'] == 1: + elif topic == 'linuoruite/20250709/CY14FM/up/system': + if receive_data[0]['CY14_FM_run'] == 1: + p_status = '3' + elif receive_data[1]['CY14_FM_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY14_FM_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY14_FM_beat = receive_data[3]['CY14_FM_beat'] + send_data['state']['reported']['CY14_FM_beat'] = CY14_FM_beat + CY14_FM_MMQ = receive_data[4]['CY14_FM_MMQ'] + send_data['state']['reported']['CY14_FM_MMQ'] = CY14_FM_MMQ + CY14_FM_IT = receive_data[5]['CY14_FM_IT'] + send_data['state']['reported']['CY14_FM_IT'] = CY14_FM_IT + CY14_FM_MT = receive_data[6]['CY14_FM_MT'] + send_data['state']['reported']['CY14_FM_MT'] = CY14_FM_MT + CY14_FM_HP = receive_data[7]['CY14_FM_HP'] + send_data['state']['reported']['CY14_FM_HP'] = CY14_FM_HP + CY14_FM_LP = receive_data[8]['CY14_FM_LP'] + send_data['state']['reported']['CY14_FM_LP'] = CY14_FM_LP + CY14_FM_FR = receive_data[9]['CY14_FM_FR'] + send_data['state']['reported']['CY14_FM_FR'] = CY14_FM_FR + elif topic == 'linuoruite/20250709/CY15Station/up/system': + if receive_data[0]['CY15_run'] == 1: + p_status = '3' + elif receive_data[1]['CY15_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY15_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY15_beat = receive_data[3]['CY15_beat'] + send_data['state']['reported']['CY15_beat'] = CY15_beat + elif topic == 'linuoruite/20250709/CY15Robot/up/system': + if receive_data[0]['CY15_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY15_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY15_robot_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + elif topic == 'linuoruite/20250709/CY16Station/up/system': + if receive_data[0]['CY16_run'] == 1: + p_status = '3' + elif receive_data[1]['CY16_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY16_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY16_beat = receive_data[3]['CY16_beat'] + send_data['state']['reported']['CY16_beat'] = CY16_beat + elif topic == 'linuoruite/20250709/CY16Robot/up/system': + if receive_data[0]['CY16_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY16_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY16_robot_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + elif topic == 'linuoruite/20250709/CY16plaquePrinter/up/system': + if receive_data[0]['CY16_plaquePrinter_run'] == 1: + p_status = '3' + elif receive_data[1]['CY16_plaquePrinter_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY16_plaquePrinter_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + elif topic == 'linuoruite/20250709/CY16efficientPrint/up/system': + if receive_data[0]['CY16_efficientPrint_run'] == 1: + p_status = '3' + elif receive_data[1]['CY16_efficientPrint_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY16_efficientPrint_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + elif topic == 'linuoruite/20250709/CY17Station/up/system': + if receive_data[0]['CY17_run'] == 1: + p_status = '3' + elif receive_data[1]['CY17_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY17_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY17_beat = receive_data[3]['CY17_beat'] + send_data['state']['reported']['CY17_beat'] = CY17_beat + elif topic == 'linuoruite/20250709/CY17special/up/system': + if receive_data[0]['CY17_special_run'] == 1: + p_status = '3' + elif receive_data[1]['CY17_special_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY17_special_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + elif topic == 'linuoruite/20250709/CY17print/up/system': + if receive_data[0]['CY17_print_run'] == 1: + p_status = '3' + elif receive_data[1]['CY17_print_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY17_print_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + elif topic == 'linuoruite/20250709/CY17robot/up/system': + if receive_data[2]['CY17_Robot_run'] == 1: + p_status = '3' + elif receive_data[3]['CY17_Robot_pause'] == 1: + p_status = '5' + elif receive_data[4]['CY17_Robot_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY17_Robot_angle = receive_data[0]['CY17_Robot_angle'] + send_data['state']['reported']['CY17_Robot_angle'] = CY17_Robot_angle + CY17_Robot_beat = receive_data[1]['CY17_Robot_beat'] + send_data['state']['reported']['CY17_Robot_beat'] = CY17_Robot_beat + CY17_Robot_torque1 = receive_data[5]['CY17_Robot_torque1'] + send_data['state']['reported']['CY17_Robot_torque1'] = CY17_Robot_torque1 + CY17_Robot_torque2 = receive_data[6]['CY17_Robot_torque2'] + send_data['state']['reported']['CY17_Robot_torque2'] = CY17_Robot_torque2 + CY17_Robot_torque3 = receive_data[7]['CY17_Robot_torque3'] + send_data['state']['reported']['CY17_Robot_torque3'] = CY17_Robot_torque3 + elif topic == 'linuoruite/20250709/CY18Station/up/system': + if receive_data[0]['CY18_run'] == 1: + p_status = '3' + elif receive_data[1]['CY18_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY18_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY18_beat = receive_data[3]['CY18_beat'] + send_data['state']['reported']['CY18_beat'] = CY18_beat + CY18_IR = receive_data[4]['CY18_IR'] + send_data['state']['reported']['CY18_IR'] = CY18_IR + CY18_VW = receive_data[5]['CY18_VW'] + send_data['state']['reported']['CY18_VW'] = CY18_VW + CY18_GR = receive_data[6]['CY18_GR'] + send_data['state']['reported']['CY18_GR'] = CY18_GR + CY18_EHP = receive_data[7]['CY18_EHP'] + send_data['state']['reported']['CY18_EHP'] = CY18_EHP + CY18_ncCount = receive_data[8]['CY18_ncCount'] + send_data['state']['reported']['CY18_ncCount'] = CY18_ncCount + elif topic == 'linuoruite/20250709/CY19Station/up/system': + if receive_data[0]['CY19_run'] == 1: + p_status = '3' + elif receive_data[1]['CY19_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY19_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY19_beat = receive_data[3]['CY19_beat'] + send_data['state']['reported']['CY19_beat'] = CY19_beat + elif topic == 'linuoruite/20250709/CY20Station/up/system': + if receive_data[0]['CY20_run'] == 1: + p_status = '3' + elif receive_data[1]['CY20_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY20_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY20_beat = receive_data[3]['CY20_beat'] + send_data['state']['reported']['CY20_beat'] = CY20_beat + elif topic == 'linuoruite/20250709/CY21Station/up/system': + if receive_data[0]['CY21_run'] == 1: + p_status = '3' + elif receive_data[1]['CY21_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY21_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY21_beat = receive_data[3]['CY21_beat'] + send_data['state']['reported']['CY21_beat'] = CY21_beat + elif topic == 'linuoruite/20250709/CY21robot/up/system': + if receive_data[0]['CY21_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY21_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY21_robot_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + elif topic == 'linuoruite/20250709/CY22Station/up/system': + if receive_data[0]['CY22_run'] == 1: + p_status = '3' + elif receive_data[1]['CY22_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY22_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY22_beat = receive_data[3]['CY22_beat'] + send_data['state']['reported']['CY22_beat'] = CY22_beat + elif topic == 'linuoruite/20250709/CY22robot/up/system': + if receive_data[0]['CY22_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY22_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY22_robot_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + elif topic == 'linuoruite/20250709/CY23Station/up/system': + if receive_data[0]['CY23_run'] == 1: + p_status = '3' + elif receive_data[1]['CY23_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY23_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY23_beat = receive_data[3]['CY23_beat'] + send_data['state']['reported']['CY23_beat'] = CY23_beat + elif topic == 'linuoruite/20250709/CY24Station/up/system': + if receive_data[0]['CY24_run'] == 1: + p_status = '3' + elif receive_data[1]['CY24_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY24_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY24_beat = receive_data[3]['CY24_beat'] + send_data['state']['reported']['CY24_beat'] = CY24_beat + elif topic == 'linuoruite/20250709/CY24print/up/system': + if receive_data[0]['CY24_print_run'] == 1: + p_status = '3' + elif receive_data[1]['CY24_print_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY24_print_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + elif topic == 'linuoruite/20250709/CY25Station/up/system': + if receive_data[0]['CY25_run'] == 1: + p_status = '3' + elif receive_data[1]['CY25_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY25_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY25_beat = receive_data[3]['CY25_beat'] + send_data['state']['reported']['CY25_beat'] = CY25_beat + elif topic == 'linuoruite/20250709/CY26Station/up/system': + if receive_data[0]['CY26_run'] == 1: + p_status = '3' + elif receive_data[1]['CY26_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY26_breakdown'] == 1: + p_status = '4' + send_data['state']['reported']['pStatus'] = p_status + CY26_beat = receive_data[3]['CY26_beat'] + send_data['state']['reported']['CY26_beat'] = CY26_beat + elif topic == 'linuoruite/20250709/CY26robot/up/system': + if receive_data[0]['CY26_robot_run'] == 1: + p_status = '3' + elif receive_data[1]['CY26_robot_pause'] == 1: + p_status = '5' + elif receive_data[2]['CY26_robot_breakdown'] == 1: p_status = '4' - elif receive_data[2]['ZDBZ_printer_pause'] == 1: - p_status = '5' - elif receive_data[4]['ZDBZ_printer_run'] == 1: - p_status = '3' send_data['state']['reported']['pStatus'] = p_status - ZDBZ_printer_beat = receive_data[0]['ZDBZ_printer_beat'] - send_data['state']['reported']['ZDBZ_printer_beat'] = ZDBZ_printer_beat - ZDBZ_printer_qlyj = receive_data[3]['ZDBZ_printer_qlyj'] - send_data['state']['reported']['ZDBZ_printer_qlyj'] = ZDBZ_printer_qlyj send_client.publish(topic=topic, payload=json.dumps(send_data)) @@ -401,7 +590,7 @@ def run_client_loop(client): # 获取mqtt的配置连接 current_dir = os.path.dirname(os.path.abspath(__file__)) -config_path = os.path.join(current_dir, 'config_pb.ini') +config_path = os.path.join(current_dir, 'config_cy.ini') config = ConfigParser() config.read(config_path) @@ -457,5 +646,5 @@ def start_loop(): if __name__ == '__main__': - # pyinstaller main_pb.py --add-data config_pb.ini:. + # pyinstaller main_cy.py --add-data config_cy.ini:. start_loop()