1. 【新增】售后单售后原因类型支持搜索

2. 【新增】手工创建订单折扣可输入正数

3. 【优化】盘点申请单确认

4. 【修复】采购退货单模拟出库失败问题

5. 【新增】订单金额客户实付与结算金额

6. 【优化】仓库发货统计报表物料名称显示

7. 【优化】自有仓储虚拟发货逻辑

8. 【修复】基础物料分类管理问题
This commit is contained in:
chenping
2026-04-01 11:59:17 +08:00
parent 9341122827
commit 61783b7d01
754 changed files with 46179 additions and 5700 deletions

View File

@@ -95,4 +95,50 @@ class ome_mdl_reship_items extends dbeav_model{
$result['return'] = $return[0]['c'];
$result['change'] = $change[0]['c'];
}
}
/**
* 根据基础物料编码获取退货单ID支持大数据量分批查询
* @param array $filter 筛选条件,包含 product_bn
* @return array 返回 reship_id 列表
*/
public function getReshipIdByFilterbnEq($filter)
{
$reshipObj = app::get('ome')->model('reship');
$product_bn = $filter['product_bn'];
$where = 1;
if (is_array($product_bn)) {
$where = 'in (\'' . implode('\',\'', $product_bn) . '\')';
} else {
$where = '= \'' . $product_bn . '\'';
}
unset($filter['product_bn']);
$reship_filter = $reshipObj->_filter($filter);
$reship_filter = str_replace('`sdb_ome_reship`', 'r', $reship_filter);
// 使用正则替换,排除已经带 r. 前缀的字段
$reship_filter = preg_replace('/(?<!r\.)reship_id/', 'r.reship_id', $reship_filter);
$reship_filter = preg_replace('/(?<!r\.)delivery_mode/', 'r.delivery_mode', $reship_filter);
$reship_filter = preg_replace('/(?<!r\.)return_type/', 'r.return_type', $reship_filter);
$sql = 'SELECT count(1) as _c FROM sdb_ome_reship_items as i LEFT JOIN sdb_ome_reship as r ON i.reship_id=r.reship_id WHERE i.bn ' . $where . ' AND ' . $reship_filter;
$count = $this->db->selectrow($sql);
if ($count['_c'] >= 10000) {
$offset = 0;
$limit = 9000;
$list = array();
$sql = 'SELECT i.reship_id FROM sdb_ome_reship_items as i LEFT JOIN sdb_ome_reship as r ON i.reship_id=r.reship_id WHERE i.bn ' . $where . ' AND ' . $reship_filter;
$total = floor($count['_c'] / $limit);
for ($i = $total; $i >= 0; $i--) {
$rows = $this->db->selectlimit($sql, $limit, $i * $limit);
if ($rows) {
$list = array_merge_recursive($list, $rows);
}
}
return $list;
}
$sql = 'SELECT i.reship_id FROM sdb_ome_reship_items as i LEFT JOIN sdb_ome_reship as r ON i.reship_id=r.reship_id WHERE i.bn ' . $where . ' AND ' . $reship_filter;
$rows = $this->db->select($sql);
return $rows;
}
}