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", "--")))
|
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
|
from widgets.main_window import MainWindow
|
||||||
main_window = self.parent
|
main_window = self.parent
|
||||||
|
|||||||
@ -799,30 +799,30 @@ class MainWindow(MainWindowUI):
|
|||||||
item.setTextAlignment(Qt.AlignCenter)
|
item.setTextAlignment(Qt.AlignCenter)
|
||||||
|
|
||||||
# 如果有order_info数据,尝试匹配字段并设置值
|
# 如果有order_info数据,尝试匹配字段并设置值
|
||||||
if order_info:
|
# if order_info:
|
||||||
config_name = config.get('name')
|
# config_name = config.get('name')
|
||||||
# 检查order_info中是否有与config_name匹配的键
|
# # 检查order_info中是否有与config_name匹配的键
|
||||||
if config_name in order_info:
|
# if config_name in order_info:
|
||||||
value = str(order_info[config_name])
|
# value = str(order_info[config_name])
|
||||||
item = QTableWidgetItem(value)
|
# item = QTableWidgetItem(value)
|
||||||
item.setTextAlignment(Qt.AlignCenter)
|
# item.setTextAlignment(Qt.AlignCenter)
|
||||||
# 设置单元格背景为浅绿色,表示自动填充
|
# # 设置单元格背景为浅绿色,表示自动填充
|
||||||
item.setBackground(QBrush(QColor("#c8e6c9")))
|
# item.setBackground(QBrush(QColor("#c8e6c9")))
|
||||||
|
|
||||||
# 保存到数据库
|
# # 保存到数据库
|
||||||
from dao.inspection_dao import InspectionDAO
|
# from dao.inspection_dao import InspectionDAO
|
||||||
inspection_dao = InspectionDAO()
|
# inspection_dao = InspectionDAO()
|
||||||
tray_id = self.tray_edit.currentText()
|
# tray_id = self.tray_edit.currentText()
|
||||||
data = [{
|
# data = [{
|
||||||
'position': config.get('position'),
|
# 'position': config.get('position'),
|
||||||
'config_id': config.get('id'),
|
# 'config_id': config.get('id'),
|
||||||
'value': value,
|
# 'value': value,
|
||||||
'status': 'pass', # 默认设置为通过状态
|
# 'status': 'pass', # 默认设置为通过状态
|
||||||
'remark': '',
|
# 'remark': '',
|
||||||
'tray_id': tray_id
|
# 'tray_id': tray_id
|
||||||
}]
|
# }]
|
||||||
inspection_dao.save_inspection_data(self._current_order_code,gc_note, data)
|
# inspection_dao.save_inspection_data(self._current_order_code,gc_note, data)
|
||||||
logging.info(f"自动填充字段 {config_name} 值为 {value}")
|
# logging.info(f"自动填充字段 {config_name} 值为 {value}")
|
||||||
|
|
||||||
# 设置单元格属性以标识其关联的检验项
|
# 设置单元格属性以标识其关联的检验项
|
||||||
item.setData(Qt.UserRole, config.get('id'))
|
item.setData(Qt.UserRole, config.get('id'))
|
||||||
|
|||||||
@ -436,7 +436,7 @@ class OrderQueryDialog(OrderQueryDialogUI):
|
|||||||
def select_current_row(self, row):
|
def select_current_row(self, row):
|
||||||
"""选择当前行并返回数据
|
"""选择当前行并返回数据
|
||||||
|
|
||||||
将订单明细(mo)作为订单号传递给上层组件
|
将订单明细(mo)作为订单号传递给上层组件,并自动获取托盘号
|
||||||
"""
|
"""
|
||||||
if 0 <= row < self.result_table.rowCount():
|
if 0 <= row < self.result_table.rowCount():
|
||||||
# 获取存储在item中的原始数据
|
# 获取存储在item中的原始数据
|
||||||
@ -445,11 +445,16 @@ class OrderQueryDialog(OrderQueryDialogUI):
|
|||||||
order_data = item.data(Qt.UserRole)
|
order_data = item.data(Qt.UserRole)
|
||||||
if order_data:
|
if order_data:
|
||||||
# 修改订单数据,将mo字段作为note字段的值
|
# 修改订单数据,将mo字段作为note字段的值
|
||||||
# 这样上层组件接收到的订单号就是订单明细
|
|
||||||
mo_value = order_data.get("mo", "")
|
mo_value = order_data.get("mo", "")
|
||||||
if mo_value:
|
if mo_value:
|
||||||
order_data["note"] = 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.order_selected.emit(order_data)
|
||||||
self.accept()
|
self.accept()
|
||||||
Loading…
Reference in New Issue
Block a user