Compare commits
No commits in common. "60d1b51e5fe64959726d9c4b795b63e273f57b66" and "a1f9a56781ef2cf60bf1e7cc6b4249418bbbcc32" have entirely different histories.
60d1b51e5f
...
a1f9a56781
5
.gitignore
vendored
5
.gitignore
vendored
@ -11,11 +11,6 @@ __pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# 确保所有层级的__pycache__目录都被忽略
|
||||
**/__pycache__/
|
||||
*/__pycache__/
|
||||
*/**/__pycache__/
|
||||
|
||||
# IDE相关
|
||||
.idea/
|
||||
.vscode/
|
||||
|
||||
BIN
camera/__pycache__/CamOperation_class.cpython-310.pyc
Normal file
BIN
camera/__pycache__/CamOperation_class.cpython-310.pyc
Normal file
Binary file not shown.
BIN
camera/__pycache__/CameraParams_const.cpython-310.pyc
Normal file
BIN
camera/__pycache__/CameraParams_const.cpython-310.pyc
Normal file
Binary file not shown.
BIN
camera/__pycache__/CameraParams_header.cpython-310.pyc
Normal file
BIN
camera/__pycache__/CameraParams_header.cpython-310.pyc
Normal file
Binary file not shown.
BIN
camera/__pycache__/MvCameraControl_class.cpython-310.pyc
Normal file
BIN
camera/__pycache__/MvCameraControl_class.cpython-310.pyc
Normal file
Binary file not shown.
BIN
camera/__pycache__/MvErrorDefine_const.cpython-310.pyc
Normal file
BIN
camera/__pycache__/MvErrorDefine_const.cpython-310.pyc
Normal file
Binary file not shown.
BIN
camera/__pycache__/PixelType_header.cpython-310.pyc
Normal file
BIN
camera/__pycache__/PixelType_header.cpython-310.pyc
Normal file
Binary file not shown.
BIN
db/jtDB.db
BIN
db/jtDB.db
Binary file not shown.
@ -3,11 +3,11 @@ from pymodbus.client import ModbusTcpClient
|
||||
client = ModbusTcpClient('localhost', port=5020)
|
||||
client.connect()
|
||||
# client.write_registers(address=11, values=[110])
|
||||
client.write_registers(address=6, values=[1])
|
||||
# client.write_registers(address=6, values=[1])
|
||||
# client.write_registers(address=5, values=[16])
|
||||
# client.write_registers(address=13, values=[1])
|
||||
client.write_registers(address=13, values=[1])
|
||||
|
||||
|
||||
result = client.read_holding_registers(address=6, count=1)
|
||||
result = client.read_holding_registers(address=13, count=1)
|
||||
print(result.registers[0],"123===")
|
||||
client.close()
|
||||
BIN
ui/__pycache__/login_ui.cpython-310.pyc
Normal file
BIN
ui/__pycache__/login_ui.cpython-310.pyc
Normal file
Binary file not shown.
BIN
utils/__pycache__/config_loader.cpython-310.pyc
Normal file
BIN
utils/__pycache__/config_loader.cpython-310.pyc
Normal file
Binary file not shown.
BIN
utils/__pycache__/menu_translator.cpython-310.pyc
Normal file
BIN
utils/__pycache__/menu_translator.cpython-310.pyc
Normal file
Binary file not shown.
BIN
utils/__pycache__/sql_utils.cpython-310.pyc
Normal file
BIN
utils/__pycache__/sql_utils.cpython-310.pyc
Normal file
Binary file not shown.
BIN
utils/__pycache__/version_manager.cpython-310.pyc
Normal file
BIN
utils/__pycache__/version_manager.cpython-310.pyc
Normal file
Binary file not shown.
BIN
widgets/__pycache__/camera_manager.cpython-310.pyc
Normal file
BIN
widgets/__pycache__/camera_manager.cpython-310.pyc
Normal file
Binary file not shown.
BIN
widgets/__pycache__/login_widget.cpython-310.pyc
Normal file
BIN
widgets/__pycache__/login_widget.cpython-310.pyc
Normal file
Binary file not shown.
@ -1621,7 +1621,7 @@ class MainWindow(MainWindowUI):
|
||||
label_col = 2 + len(enabled_configs)
|
||||
|
||||
# 生成贴标号(托盘号+序号)
|
||||
label_value = f"{self.init_seq[tray_id]}"
|
||||
label_value = f"{tray_id}-{self.init_seq[tray_id]}"
|
||||
|
||||
# 断开单元格变更信号,避免程序自动写入时触发
|
||||
try:
|
||||
@ -1816,9 +1816,8 @@ class MainWindow(MainWindowUI):
|
||||
|
||||
@Slot(int)
|
||||
def handle_ng(self, ng):
|
||||
"""处理NG信号, 将当前处理的数据添加到包装记录中,毛重和净重设为0"""
|
||||
"""处理NG信号, 删除当前在处理的数据(也就是第一条数据)"""
|
||||
if ng == 1:
|
||||
"""
|
||||
# 获取当前选中的行或第一个数据行,并删除
|
||||
try:
|
||||
order_id = self.process_table.item(2, 1).text().strip()
|
||||
@ -1832,82 +1831,6 @@ class MainWindow(MainWindowUI):
|
||||
# 触发重新查询,更新数据
|
||||
self.load_finished_inspection_data()
|
||||
logging.info(f"已删除当前在处理的数据: order_id: {order_id}, tray_id: {tray_id}")
|
||||
"""
|
||||
try:
|
||||
# 获取最后一条数据行
|
||||
total_rows = self.process_table.rowCount()
|
||||
if total_rows <= 2: # 只有表头行,没有数据行
|
||||
logging.warning("没有可用的数据行来处理NG信号")
|
||||
return
|
||||
|
||||
# 使用最后一条数据行
|
||||
data_row = total_rows - 1
|
||||
|
||||
# 获取工程号
|
||||
order_id_item = self.process_table.item(data_row, 1)
|
||||
if not order_id_item:
|
||||
logging.warning("无法获取工程号")
|
||||
return
|
||||
|
||||
order_id = order_id_item.text().strip()
|
||||
if not order_id:
|
||||
logging.warning("工程号为空")
|
||||
return
|
||||
|
||||
# 获取托盘号
|
||||
tray_id = self.tray_edit.currentText()
|
||||
|
||||
# 获取启用的检验配置
|
||||
enabled_configs = self.inspection_manager.get_enabled_configs()
|
||||
|
||||
# 计算贴标列索引
|
||||
label_col = 2 + len(enabled_configs)
|
||||
|
||||
# 获取贴标值
|
||||
label_item = self.process_table.item(data_row, label_col)
|
||||
label_value = label_item.text() if label_item else ""
|
||||
|
||||
# 如果贴标值为空,生成一个新的贴标值
|
||||
if not label_value:
|
||||
# 初始化托盘号对应的序号
|
||||
if tray_id not in self.init_seq:
|
||||
self.init_seq[tray_id] = 1
|
||||
|
||||
# 生成贴标号(仅使用序号)
|
||||
label_value = f"{self.init_seq[tray_id]}-NG"
|
||||
self.init_seq[tray_id] += 1
|
||||
|
||||
# 保存贴标数据到数据库
|
||||
self.save_inspection_data(order_id, tray_id, 11, 11, label_value, "pass")
|
||||
else:
|
||||
# 如果贴标值已存在但不包含NG标记,添加NG标记
|
||||
if "NG" not in label_value:
|
||||
label_value = f"{label_value}-NG"
|
||||
# 更新贴标数据
|
||||
self.save_inspection_data(order_id, tray_id, 11, 11, label_value, "pass")
|
||||
|
||||
# 设置毛重和净重为0
|
||||
self.save_inspection_data(order_id, tray_id, 12, 12, "0", "pass")
|
||||
self.save_inspection_data(order_id, tray_id, 13, 13, "0", "pass")
|
||||
|
||||
# 获取当前时间作为完成时间
|
||||
finish_time = datetime.now()
|
||||
|
||||
# 将数据写入到数据库表 inspection_pack_data
|
||||
from dao.inspection_dao import InspectionDAO
|
||||
inspection_dao = InspectionDAO()
|
||||
inspection_dao.save_package_record(order_id, tray_id, label_value, "0", "0", finish_time)
|
||||
|
||||
# 删除当前处理的行
|
||||
self.process_table.removeRow(data_row)
|
||||
|
||||
# 回显数据
|
||||
self.show_pack_item()
|
||||
|
||||
logging.info(f"NG信号处理完成: 工程号={order_id}, 托盘号={tray_id}, 贴标值={label_value}")
|
||||
except Exception as e:
|
||||
logging.error(f"处理NG信号时发生错误: {str(e)}")
|
||||
finally:
|
||||
# 复原NG信号
|
||||
modbus = ModbusUtils()
|
||||
client = modbus.get_client()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user