feat: 新增通过托盘号获取订单信息的接口及相关逻辑,优化托盘号查询功能
This commit is contained in:
parent
382062239f
commit
e75761bc39
@ -331,4 +331,28 @@ class GcApi:
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"获取炉号列表失败: {str(e)}")
|
logging.error(f"获取炉号列表失败: {str(e)}")
|
||||||
return {"status": False, "message": f"获取炉号列表失败: {str(e)}"}
|
return {"status": False, "message": f"获取炉号列表失败: {str(e)}"}
|
||||||
|
|
||||||
|
def get_order_info_by_xpack(self, xpack, corp_id):
|
||||||
|
"""
|
||||||
|
通过托盘号获取订单信息
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
# API 配置中的键名
|
||||||
|
api_key = "get_order_info_by_xpack"
|
||||||
|
order_dict = {
|
||||||
|
"xpack": xpack,
|
||||||
|
"data_corp": corp_id
|
||||||
|
}
|
||||||
|
data = {
|
||||||
|
"parms": json.dumps(order_dict),
|
||||||
|
"pageIndex": 0,
|
||||||
|
"pageSize": 10,
|
||||||
|
"sortField": "",
|
||||||
|
"sortOrder": ""
|
||||||
|
}
|
||||||
|
response = self.api_utils.post(api_key, data=data)
|
||||||
|
return response
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"通过托盘号获取订单信息失败: {str(e)}")
|
||||||
|
return None
|
||||||
@ -19,7 +19,8 @@
|
|||||||
"get_xpack": "/jsjt/xcsc/tprk/getXpackToWsbz.do",
|
"get_xpack": "/jsjt/xcsc/tprk/getXpackToWsbz.do",
|
||||||
"ismt_option": "/jsjt/xcsc/tprk/ismtOptioTonWsbz.do",
|
"ismt_option": "/jsjt/xcsc/tprk/ismtOptioTonWsbz.do",
|
||||||
"get_params": "/select/getcombcodeWsbz.do",
|
"get_params": "/select/getcombcodeWsbz.do",
|
||||||
"get_luno": "/common/luno/getLunoListWsbz.do"
|
"get_luno": "/common/luno/getLunoListWsbz.do",
|
||||||
|
"get_order_info_by_xpack": "/jsjt/xcsc/tprk/getXsddBzrkGridListByXpackToWsbz.do"
|
||||||
},
|
},
|
||||||
"database": {
|
"database": {
|
||||||
"default": "sqlite",
|
"default": "sqlite",
|
||||||
|
|||||||
BIN
db/jtDB.db
BIN
db/jtDB.db
Binary file not shown.
@ -234,14 +234,35 @@ class LoadingDialog(LoadingDialogUI):
|
|||||||
logging.error(f"查询订单信息失败: {e}")
|
logging.error(f"查询订单信息失败: {e}")
|
||||||
QMessageBox.critical(self, "错误", f"查询订单信息失败: {str(e)}")
|
QMessageBox.critical(self, "错误", f"查询订单信息失败: {str(e)}")
|
||||||
|
|
||||||
|
def on_xpack_query(self, tray_id):
|
||||||
|
"""通过托盘号查询订单信息,并回显到页面(完全仿照on_order_query)"""
|
||||||
|
try:
|
||||||
|
query_params = {
|
||||||
|
"xpack": tray_id,
|
||||||
|
"corp_id": self.corp_id
|
||||||
|
}
|
||||||
|
dialog = OrderQueryDialog(self)
|
||||||
|
results = dialog.query_orders_xpack(query_params)
|
||||||
|
if results:
|
||||||
|
if len(results) == 1:
|
||||||
|
self.on_order_selected(results[0])
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
dialog.update_result_table(results)
|
||||||
|
dialog.order_selected.connect(self.on_order_selected)
|
||||||
|
dialog.exec()
|
||||||
|
return
|
||||||
|
QMessageBox.warning(self, "提示", "未找到该托盘号对应的订单信息")
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"托盘号查订单接口异常: {e}")
|
||||||
|
QMessageBox.warning(self, "错误", f"托盘号查订单接口异常: {str(e)}")
|
||||||
|
|
||||||
def on_tray_entered(self):
|
def on_tray_entered(self):
|
||||||
"""处理托盘号输入框回车事件"""
|
|
||||||
tray_id = self.tray_input.text().strip()
|
tray_id = self.tray_input.text().strip()
|
||||||
if not tray_id:
|
if not tray_id:
|
||||||
QMessageBox.warning(self, "提示", "请输入托盘号")
|
QMessageBox.warning(self, "提示", "请输入托盘号")
|
||||||
return
|
return
|
||||||
|
self.on_xpack_query(tray_id)
|
||||||
# 设置焦点到托盘料输入框
|
|
||||||
self.pallet_tier_value.setFocus()
|
self.pallet_tier_value.setFocus()
|
||||||
|
|
||||||
def keyPressEvent(self, event):
|
def keyPressEvent(self, event):
|
||||||
|
|||||||
@ -321,6 +321,24 @@ class OrderQueryDialog(OrderQueryDialogUI):
|
|||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
def query_orders_xpack(self, params):
|
||||||
|
"""通过托盘号查订单数据,返回列表"""
|
||||||
|
try:
|
||||||
|
gc_api = GcApi()
|
||||||
|
response = gc_api.get_order_info_by_xpack(params.get("xpack"), params.get("corp_id"))
|
||||||
|
if response and response.get("status", False):
|
||||||
|
orders_data = response.get("data", [])
|
||||||
|
results = []
|
||||||
|
for order_data in orders_data:
|
||||||
|
results.append(order_data)
|
||||||
|
self.query_results = results
|
||||||
|
return results
|
||||||
|
else:
|
||||||
|
return []
|
||||||
|
except Exception as e:
|
||||||
|
logging.error(f"通过托盘号查订单数据失败: {e}")
|
||||||
|
return []
|
||||||
|
|
||||||
def update_result_table(self, results):
|
def update_result_table(self, results):
|
||||||
"""更新结果表格
|
"""更新结果表格
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user