feat(inventory): 強化調撥單功能,支援販賣機貨道欄位、開放商品重複加入及優化過帳庫存檢核
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Inventory\Exports;
|
||||
|
||||
use Maatwebsite\Excel\Concerns\Exportable;
|
||||
use Maatwebsite\Excel\Concerns\WithMultipleSheets;
|
||||
use Maatwebsite\Excel\Concerns\WithTitle;
|
||||
use Maatwebsite\Excel\Concerns\FromCollection;
|
||||
use Maatwebsite\Excel\Concerns\WithHeadings;
|
||||
use Maatwebsite\Excel\Concerns\WithStyles;
|
||||
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
|
||||
|
||||
class InventoryTransferTemplateExport implements WithMultipleSheets
|
||||
{
|
||||
use Exportable;
|
||||
|
||||
public function sheets(): array
|
||||
{
|
||||
return [
|
||||
new class implements FromCollection, WithHeadings, WithTitle, WithStyles {
|
||||
public function collection()
|
||||
{
|
||||
return collect([
|
||||
['P001', 'BATCH-2024001', '10', 'A1', '範例:請刪除此列後填寫'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return ['商品代碼', '批號', '數量', '貨道/儲位', '備註'];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return '明細匯入';
|
||||
}
|
||||
|
||||
public function styles(Worksheet $sheet)
|
||||
{
|
||||
return [
|
||||
1 => ['font' => ['bold' => true]],
|
||||
];
|
||||
}
|
||||
},
|
||||
new class implements FromCollection, WithHeadings, WithTitle, WithStyles {
|
||||
public function collection()
|
||||
{
|
||||
return collect([
|
||||
['商品代碼', '必填', '請填寫系統中已存在的商品代號'],
|
||||
['數量', '必填', '必須為大於 0 的數字'],
|
||||
['批號', '選填', '若不填寫將自動對應「NO-BATCH」庫存'],
|
||||
['貨道/儲位', '選填', '主要用於目的倉庫為「販賣機」時指定貨道'],
|
||||
['備註', '選填', '可填寫該筆明細的備註說明'],
|
||||
['', '', ''],
|
||||
['提示', '附加模式', '匯入的明細將附加至現有單據,不會覆蓋原有資料'],
|
||||
]);
|
||||
}
|
||||
|
||||
public function headings(): array
|
||||
{
|
||||
return ['欄位名稱', '必要性', '說明'];
|
||||
}
|
||||
|
||||
public function title(): string
|
||||
{
|
||||
return '匯入規則說明';
|
||||
}
|
||||
|
||||
public function styles(Worksheet $sheet)
|
||||
{
|
||||
$sheet->getColumnDimension('A')->setWidth(15);
|
||||
$sheet->getColumnDimension('B')->setWidth(15);
|
||||
$sheet->getColumnDimension('C')->setWidth(50);
|
||||
return [
|
||||
1 => ['font' => ['bold' => true]],
|
||||
];
|
||||
}
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user