feat: 选择订单的时候同步生成托盘号
This commit is contained in:
parent
9fa3ed66f7
commit
63edb27353
BIN
db/jtDB.db
BIN
db/jtDB.db
Binary file not shown.
@ -121,6 +121,10 @@ class LoadingDialog(LoadingDialogUI):
|
||||
# 更新重量
|
||||
self.weight_value.setText(str(order_data.get("zx_zl", "--")))
|
||||
|
||||
# 自动填充托盘号
|
||||
if "xpack" in order_data:
|
||||
self.tray_input.setText(order_data["xpack"])
|
||||
|
||||
# 发送订单号到主窗口
|
||||
from widgets.main_window import MainWindow
|
||||
main_window = self.parent
|
||||
|
||||
@ -799,30 +799,30 @@ class MainWindow(MainWindowUI):
|
||||
item.setTextAlignment(Qt.AlignCenter)
|
||||
|
||||
# 如果有order_info数据,尝试匹配字段并设置值
|
||||
if order_info:
|
||||
config_name = config.get('name')
|
||||
# 检查order_info中是否有与config_name匹配的键
|
||||
if config_name in order_info:
|
||||
value = str(order_info[config_name])
|
||||
item = QTableWidgetItem(value)
|
||||
item.setTextAlignment(Qt.AlignCenter)
|
||||
# 设置单元格背景为浅绿色,表示自动填充
|
||||
item.setBackground(QBrush(QColor("#c8e6c9")))
|
||||
# if order_info:
|
||||
# config_name = config.get('name')
|
||||
# # 检查order_info中是否有与config_name匹配的键
|
||||
# if config_name in order_info:
|
||||
# value = str(order_info[config_name])
|
||||
# item = QTableWidgetItem(value)
|
||||
# item.setTextAlignment(Qt.AlignCenter)
|
||||
# # 设置单元格背景为浅绿色,表示自动填充
|
||||
# item.setBackground(QBrush(QColor("#c8e6c9")))
|
||||
|
||||
# 保存到数据库
|
||||
from dao.inspection_dao import InspectionDAO
|
||||
inspection_dao = InspectionDAO()
|
||||
tray_id = self.tray_edit.currentText()
|
||||
data = [{
|
||||
'position': config.get('position'),
|
||||
'config_id': config.get('id'),
|
||||
'value': value,
|
||||
'status': 'pass', # 默认设置为通过状态
|
||||
'remark': '',
|
||||
'tray_id': tray_id
|
||||
}]
|
||||
inspection_dao.save_inspection_data(self._current_order_code,gc_note, data)
|
||||
logging.info(f"自动填充字段 {config_name} 值为 {value}")
|
||||
# # 保存到数据库
|
||||
# from dao.inspection_dao import InspectionDAO
|
||||
# inspection_dao = InspectionDAO()
|
||||
# tray_id = self.tray_edit.currentText()
|
||||
# data = [{
|
||||
# 'position': config.get('position'),
|
||||
# 'config_id': config.get('id'),
|
||||
# 'value': value,
|
||||
# 'status': 'pass', # 默认设置为通过状态
|
||||
# 'remark': '',
|
||||
# 'tray_id': tray_id
|
||||
# }]
|
||||
# inspection_dao.save_inspection_data(self._current_order_code,gc_note, data)
|
||||
# logging.info(f"自动填充字段 {config_name} 值为 {value}")
|
||||
|
||||
# 设置单元格属性以标识其关联的检验项
|
||||
item.setData(Qt.UserRole, config.get('id'))
|
||||
|
||||
@ -436,7 +436,7 @@ class OrderQueryDialog(OrderQueryDialogUI):
|
||||
def select_current_row(self, row):
|
||||
"""选择当前行并返回数据
|
||||
|
||||
将订单明细(mo)作为订单号传递给上层组件
|
||||
将订单明细(mo)作为订单号传递给上层组件,并自动获取托盘号
|
||||
"""
|
||||
if 0 <= row < self.result_table.rowCount():
|
||||
# 获取存储在item中的原始数据
|
||||
@ -445,11 +445,16 @@ class OrderQueryDialog(OrderQueryDialogUI):
|
||||
order_data = item.data(Qt.UserRole)
|
||||
if order_data:
|
||||
# 修改订单数据,将mo字段作为note字段的值
|
||||
# 这样上层组件接收到的订单号就是订单明细
|
||||
mo_value = order_data.get("mo", "")
|
||||
if mo_value:
|
||||
order_data["note"] = mo_value
|
||||
|
||||
# 自动获取托盘号
|
||||
order_code = mo_value
|
||||
if order_code and self.corp_id:
|
||||
gc_api = GcApi()
|
||||
xpack_response = gc_api.get_xpack(order_code, self.corp_id)
|
||||
if xpack_response and xpack_response.get("status", False):
|
||||
order_data["xpack"] = xpack_response.get("xpack", "")
|
||||
# 发出信号
|
||||
self.order_selected.emit(order_data)
|
||||
self.accept()
|
||||
Loading…
Reference in New Issue
Block a user