feat: 修改Modbus写入值,更新SQL查询以处理空值,添加安全字符串转换函数
This commit is contained in:
parent
3246e8981f
commit
bc2ca6919e
@ -827,7 +827,7 @@ class InspectionDAO:
|
||||
try:
|
||||
sql = """
|
||||
SELECT DISTINCT data_corp, user_id, user_name, gzl_zl, mzl, ddmo, xpack, qd, spack_type, mxzs, jt, ddnote, code, type, lable, lib, gzl, maxsl, cz, size, cd, luno,
|
||||
qfqd, pono, xj, ysl, dycz, zx_code, edit_id, remarks, zx_name, bccd, tccd, zzyq, customer, customerexp, bz_bqd as bqd, bz_tqd as tqd, type_name, remarks_hb
|
||||
coalesce(qfqd,'') as qfqd, pono, xj, ysl, dycz, zx_code, edit_id, remarks, zx_name, bccd, tccd, zzyq, customer, customerexp, bz_bqd as bqd, bz_tqd as tqd, type_name, remarks_hb
|
||||
FROM wsbz_order_info WHERE ddmo = ?
|
||||
"""
|
||||
params = (order_id,)
|
||||
|
||||
BIN
db/jtDB.db
BIN
db/jtDB.db
Binary file not shown.
@ -2,7 +2,7 @@ from pymodbus.client import ModbusTcpClient
|
||||
import time
|
||||
client = ModbusTcpClient('localhost', port=5020)
|
||||
client.connect()
|
||||
client.write_registers(address=11, values=[14322])
|
||||
client.write_registers(address=11, values=[5962])
|
||||
# client.write_registers(address=3, values=[0])
|
||||
# time.sleep(2)
|
||||
# client.write_registers(address=0, values=[0])
|
||||
|
||||
@ -4738,4 +4738,7 @@ class MainWindow(MainWindowUI):
|
||||
except Exception as e:
|
||||
logging.error(f"处理炉号选择失败: {str(e)}")
|
||||
from PySide6.QtWidgets import QMessageBox
|
||||
QMessageBox.critical(self, "错误", f"处理炉号选择失败: {str(e)}")
|
||||
QMessageBox.critical(self, "错误", f"处理炉号选择失败: {str(e)}")
|
||||
|
||||
def safe_str(val):
|
||||
return "" if val is None else str(val)
|
||||
Loading…
Reference in New Issue
Block a user