mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
a订单导出
This commit is contained in:
parent
f946d6c65b
commit
46f32294b8
@ -77,22 +77,14 @@ class GoodsCombinationController extends Controller
|
|||||||
->where('is_combination', 1)
|
->where('is_combination', 1)
|
||||||
->filter();
|
->filter();
|
||||||
if ($sortField == "order_goods_num") {
|
if ($sortField == "order_goods_num") {
|
||||||
$builder = GoodsSku::query();
|
|
||||||
$goodsSkus = (clone $builder)->filter()
|
|
||||||
->where('is_combination', 1)
|
|
||||||
->orderByDesc('id')
|
|
||||||
->pluck('stock', 'id')
|
|
||||||
->toArray();
|
|
||||||
$finalIds = [];
|
$finalIds = [];
|
||||||
|
asort($ids);
|
||||||
foreach ($ids as $id => $number) {
|
foreach ($ids as $id => $number) {
|
||||||
if (isset($goodsSkus[$id])) {
|
|
||||||
$finalIds[] = $id;
|
$finalIds[] = $id;
|
||||||
unset($goodsSkus[$id]);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$finalIds = array_merge($finalIds, array_keys($goodsSkus));
|
|
||||||
$idField = implode(',', $finalIds);
|
$idField = implode(',', $finalIds);
|
||||||
$goodsSkusBuilder->orderByRaw("FIELD({$idField},id) {$sortValue}");
|
$goodsSkusBuilder->orderByRaw("FIELD(id,{$idField}) {$sortValue}");
|
||||||
} else {
|
} else {
|
||||||
$goodsSkusBuilder->orderBy($sortField, $sortValue);
|
$goodsSkusBuilder->orderBy($sortField, $sortValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,7 +96,7 @@ class GoodsSkusController extends Controller
|
|||||||
|
|
||||||
$externals[$id][] = $businessOrderItem;
|
$externals[$id][] = $businessOrderItem;
|
||||||
}
|
}
|
||||||
arsort($ids);
|
|
||||||
|
|
||||||
$builder = GoodsSku::query();
|
$builder = GoodsSku::query();
|
||||||
$this->preparQueryGoodsSkus($request, $builder);
|
$this->preparQueryGoodsSkus($request, $builder);
|
||||||
@ -114,21 +114,14 @@ class GoodsSkusController extends Controller
|
|||||||
}])
|
}])
|
||||||
->where('is_combination', 0);
|
->where('is_combination', 0);
|
||||||
if ($sortField == "order_goods_num") {
|
if ($sortField == "order_goods_num") {
|
||||||
$goodsSkus = (clone $builder)->filter()
|
|
||||||
->where('is_combination', 0)
|
|
||||||
->orderByDesc('id')
|
|
||||||
->pluck('stock', 'id')
|
|
||||||
->toArray();
|
|
||||||
$finalIds = [];
|
$finalIds = [];
|
||||||
|
asort($ids);
|
||||||
foreach ($ids as $id => $number) {
|
foreach ($ids as $id => $number) {
|
||||||
if (isset($goodsSkus[$id])) {
|
|
||||||
$finalIds[] = $id;
|
$finalIds[] = $id;
|
||||||
unset($goodsSkus[$id]);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
$finalIds = array_merge($finalIds, array_keys($goodsSkus));
|
|
||||||
$idField = implode(',', $finalIds);
|
$idField = implode(',', $finalIds);
|
||||||
$goodsSkusBuilder->orderByRaw("FIELD({$idField},id) {$sortValue}");
|
$goodsSkusBuilder->orderByRaw("FIELD(id,{$idField}) {$sortValue}");
|
||||||
} else {
|
} else {
|
||||||
$goodsSkusBuilder->orderBy($sortField, $sortValue);
|
$goodsSkusBuilder->orderBy($sortField, $sortValue);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user