mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
feat: #10000 导出优化
This commit is contained in:
parent
b8297fdf3e
commit
431b350add
@ -40,7 +40,7 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
|
||||
];
|
||||
$map = [
|
||||
'cost' => ['成本', '更新前成本', '更新后成本'],
|
||||
'inventory' => ['库存', '盘点'],
|
||||
'inventory' => ['库存', '盘点', '更新前盘点'],
|
||||
];
|
||||
$headTitle = array_merge($headTitle, $map[$this->type]);
|
||||
$day = DateTimeUtils::getToday();
|
||||
@ -53,7 +53,7 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
|
||||
->orderBy('id', 'asc')
|
||||
->get();
|
||||
foreach ($logs as $log) {
|
||||
if ($log['before_update'] != $log['after_update']) {
|
||||
if ($log['before_update'] != $log['after_update'] || (int)$log['after_update']) {
|
||||
if (!isset($update[$log['target_id']])) {
|
||||
$update[$log['target_id']]['before_update'] = $log['before_update'];
|
||||
}
|
||||
@ -72,7 +72,6 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
|
||||
$query->with(['type:id,name', 'brand:id,name']);
|
||||
}]);
|
||||
if ('inventory' === $this->type) {
|
||||
$model->where('stock', '<>', 0);
|
||||
$model->with(['daily' => function ($query) use ($day) {
|
||||
$query->where('day', $day);
|
||||
}]);
|
||||
@ -90,13 +89,14 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
|
||||
$arr[4] = $item['sku_code'];
|
||||
$arr[5] = $item['title'];
|
||||
if ('cost' === $this->type) {
|
||||
$arr[6] = $item['cost'];
|
||||
$arr[7] = $update[$item['id']]['before_update'];
|
||||
$arr[8] = $update[$item['id']]['after_update'];
|
||||
$arr[6] = (string)$item['cost'];
|
||||
$arr[7] = (string)$update[$item['id']]['before_update'];
|
||||
$arr[8] = (string)$update[$item['id']]['after_update'];
|
||||
}
|
||||
if ('inventory' === $this->type) {
|
||||
$arr[6] = $item['stock'];
|
||||
$arr[7] = $item['daily']['inventory'];
|
||||
$arr[6] = (string)$item['stock'];
|
||||
$arr[7] = (string)$item['daily']['inventory'];
|
||||
$arr[8] = (string)$update[$item['id']]['before_update'];
|
||||
}
|
||||
$bodyData[] = $arr;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user