mirror of
https://gitee.com/ShopeX/OMS
synced 2026-04-19 03:35:28 +08:00
1. 【新增】售后单售后原因类型支持搜索
2. 【新增】手工创建订单折扣可输入正数 3. 【优化】盘点申请单确认 4. 【修复】采购退货单模拟出库失败问题 5. 【新增】订单金额客户实付与结算金额 6. 【优化】仓库发货统计报表物料名称显示 7. 【优化】自有仓储虚拟发货逻辑 8. 【修复】基础物料分类管理问题
This commit is contained in:
@@ -161,30 +161,87 @@ class omeauto_auto_group {
|
||||
*/
|
||||
public function process($inletClass) {
|
||||
|
||||
// 如果没有订单项,直接返回空结果
|
||||
if (empty($this->items)) {
|
||||
return array('total' => 0, 'succ' => 0, 'fail' => 0);
|
||||
}
|
||||
|
||||
$confirmRoles = $this->getRoles();
|
||||
$confirmRoles['inlet_class'] = $inletClass;
|
||||
$plugins = $this->getPluginNames($inletClass);
|
||||
|
||||
// 获取第一个订单号用于记录
|
||||
$originalBn = '';
|
||||
if (!empty($this->items)) {
|
||||
$orders = $this->items[0]->getOrders();
|
||||
$firstOrder = current($orders);
|
||||
$originalBn = $firstOrder['order_bn'] ?? '';
|
||||
}
|
||||
|
||||
// 开始性能监控
|
||||
ome_api_log::record_start('订单审核', $originalBn, 'omeauto_auto_group');
|
||||
|
||||
$pluginTimings = array();
|
||||
|
||||
foreach ($plugins as $plugName) {
|
||||
|
||||
$plugObj = $this->initPlugin($plugName);
|
||||
if (is_object($plugObj)) {
|
||||
foreach ((array) $this->items as $key => $item) {
|
||||
|
||||
$plugObj->process($this->items[$key], $confirmRoles);
|
||||
// 记录单个插件执行开始时间
|
||||
$pluginStartTime = microtime(true);
|
||||
|
||||
$pluginResult = $plugObj->process($this->items[$key], $confirmRoles);
|
||||
|
||||
// 如果插件返回了性能数据,记录到性能日志
|
||||
if (is_array($pluginResult) && isset($pluginResult['execution_time'])) {
|
||||
ome_api_log::add_message('plugin', $plugName, $pluginResult['execution_time'], $pluginResult);
|
||||
$pluginExecutionTime = $pluginResult['execution_time'];
|
||||
} else {
|
||||
// 否则使用外层计算的时间
|
||||
$pluginExecutionTime = microtime(true) - $pluginStartTime;
|
||||
ome_api_log::add_message('plugin', $plugName, $pluginExecutionTime, array('total_orders' => count($this->items)));
|
||||
}
|
||||
|
||||
// 累加插件执行时间
|
||||
if (!isset($pluginTimings[$plugName])) {
|
||||
$pluginTimings[$plugName] = 0;
|
||||
}
|
||||
$pluginTimings[$plugName] += $pluginExecutionTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$result = array('total' => 0, 'succ' => 0, 'fail' => 0);
|
||||
|
||||
// 记录订单组处理开始时间
|
||||
$groupProcessStart = microtime(true);
|
||||
|
||||
foreach ((array) $this->items as $key => $group) {
|
||||
$result['total'] += $group->orderNums;
|
||||
if ($group->process($confirmRoles)) {
|
||||
|
||||
$groupResult = $group->process($confirmRoles);
|
||||
|
||||
if ($groupResult) {
|
||||
$result['succ'] += $group->orderNums;
|
||||
} else {
|
||||
$result['fail'] += $group->orderNums;
|
||||
}
|
||||
}
|
||||
|
||||
// 计算订单组处理时间
|
||||
$groupProcessTime = microtime(true) - $groupProcessStart;
|
||||
|
||||
// 记录订单组性能数据
|
||||
ome_api_log::add_message('group', 'order_group', $groupProcessTime, array(
|
||||
'total_orders' => $result['total'],
|
||||
'success_orders' => $result['succ'],
|
||||
'failed_orders' => $result['fail']
|
||||
));
|
||||
|
||||
// 结束性能监控
|
||||
ome_api_log::record_end();
|
||||
|
||||
return $result;
|
||||
}
|
||||
@@ -211,6 +268,7 @@ class omeauto_auto_group {
|
||||
return self::$_plugObjects[$fix];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $inletClass 入口类区分
|
||||
* @return Array
|
||||
@@ -377,4 +435,5 @@ class omeauto_auto_group {
|
||||
$this->filter = array();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user