commit
f1b7fb7feb
@ -40,7 +40,7 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
|
|||||||
];
|
];
|
||||||
$map = [
|
$map = [
|
||||||
'cost' => ['成本', '更新前成本', '更新后成本'],
|
'cost' => ['成本', '更新前成本', '更新后成本'],
|
||||||
'inventory' => ['库存', '盘点'],
|
'inventory' => ['库存', '盘点', '更新前盘点'],
|
||||||
];
|
];
|
||||||
$headTitle = array_merge($headTitle, $map[$this->type]);
|
$headTitle = array_merge($headTitle, $map[$this->type]);
|
||||||
$day = DateTimeUtils::getToday();
|
$day = DateTimeUtils::getToday();
|
||||||
@ -53,7 +53,7 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
|
|||||||
->orderBy('id', 'asc')
|
->orderBy('id', 'asc')
|
||||||
->get();
|
->get();
|
||||||
foreach ($logs as $log) {
|
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']])) {
|
if (!isset($update[$log['target_id']])) {
|
||||||
$update[$log['target_id']]['before_update'] = $log['before_update'];
|
$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']);
|
$query->with(['type:id,name', 'brand:id,name']);
|
||||||
}]);
|
}]);
|
||||||
if ('inventory' === $this->type) {
|
if ('inventory' === $this->type) {
|
||||||
$model->where('stock', '<>', 0);
|
|
||||||
$model->with(['daily' => function ($query) use ($day) {
|
$model->with(['daily' => function ($query) use ($day) {
|
||||||
$query->where('day', $day);
|
$query->where('day', $day);
|
||||||
}]);
|
}]);
|
||||||
@ -90,13 +89,14 @@ class GoodsSkusExport implements FromCollection, ShouldAutoSize
|
|||||||
$arr[4] = $item['sku_code'];
|
$arr[4] = $item['sku_code'];
|
||||||
$arr[5] = $item['title'];
|
$arr[5] = $item['title'];
|
||||||
if ('cost' === $this->type) {
|
if ('cost' === $this->type) {
|
||||||
$arr[6] = $item['cost'];
|
$arr[6] = (string)$item['cost'];
|
||||||
$arr[7] = $update[$item['id']]['before_update'];
|
$arr[7] = (string)$update[$item['id']]['before_update'];
|
||||||
$arr[8] = $update[$item['id']]['after_update'];
|
$arr[8] = (string)$update[$item['id']]['after_update'];
|
||||||
}
|
}
|
||||||
if ('inventory' === $this->type) {
|
if ('inventory' === $this->type) {
|
||||||
$arr[6] = $item['stock'];
|
$arr[6] = (string)$item['stock'];
|
||||||
$arr[7] = $item['daily']['inventory'];
|
$arr[7] = (string)$item['daily']['inventory'];
|
||||||
|
$arr[8] = (string)$update[$item['id']]['before_update'];
|
||||||
}
|
}
|
||||||
$bodyData[] = $arr;
|
$bodyData[] = $arr;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user