Files
star-erp/app/Modules/Inventory/Exports/InstructionSheet.php
sky121113 906b094c18
All checks were successful
Koori-ERP-Deploy-System / deploy-demo (push) Has been skipped
Koori-ERP-Deploy-System / deploy-production (push) Successful in 1m7s
feat: [商品管理] 優化商品匯入邏輯,支援 13 碼條碼自動生成、Upsert 更新機制與 Excel 說明工作表
2026-02-06 09:26:50 +08:00

55 lines
2.0 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
namespace App\Modules\Inventory\Exports;
use Maatwebsite\Excel\Concerns\FromCollection;
use Maatwebsite\Excel\Concerns\WithHeadings;
use Maatwebsite\Excel\Concerns\WithTitle;
use Maatwebsite\Excel\Concerns\WithStyles;
use PhpOffice\PhpSpreadsheet\Worksheet\Worksheet;
class InstructionSheet implements FromCollection, WithHeadings, WithTitle, WithStyles
{
public function title(): string
{
return '填寫說明';
}
public function headings(): array
{
return [
'欄位名稱',
'是否必填',
'填寫說明',
];
}
public function collection()
{
return collect([
['商品代號', '選填', '2-8 碼,若未填寫系統將自動生成。若代號已存在,將更新該商品資料。'],
['條碼', '選填', '13 碼數字,若未填寫系統將自動生成。若條碼已存在(優先比對),將更新該商品資料。'],
['商品名稱', '必填', '請填寫完整商品名稱。'],
['類別名稱', '必填', '必須為系統中已存在的類別名稱(如:飲品)。'],
['品牌', '選填', '商品品牌名稱。'],
['規格', '選填', '商品規格描述25kg/袋)。'],
['基本單位', '必填', '必須為系統中已存在的單位名稱(如:瓶、個)。'],
['大單位', '選填', '若有大單位換算請填寫(如:箱)。'],
['換算率', '若有大單位則必填', '1 個大單位等於多少個基本單位。'],
['成本價', '選填', '數字,預設為 0。'],
['售價', '選填', '數字,預設為 0。'],
['會員價', '選填', '數字,預設為 0。'],
['批發價', '選填', '數字,預設為 0。'],
]);
}
public function styles(Worksheet $sheet)
{
return [
// 第一行標題粗體
1 => ['font' => ['bold' => true]],
// 欄位寬度自動
];
}
}