完善生产异常维修与备件管理功能
This commit is contained in:
@@ -5,30 +5,39 @@ declare(strict_types=1);
|
||||
namespace plugin\produce\app\validate;
|
||||
|
||||
use core\base\BaseValidate;
|
||||
use Illuminate\Validation\Rule;
|
||||
use plugin\produce\app\model\RepairRecord;
|
||||
|
||||
class RepairRecordValidate extends BaseValidate
|
||||
{
|
||||
public function rules(): array
|
||||
{
|
||||
$id = request()->route?->param('id');
|
||||
|
||||
return [
|
||||
'repair_no' => ['required', 'max:100'],
|
||||
'order_no' => ['max:100'],
|
||||
'product_code' => ['max:100'],
|
||||
'product_name' => ['max:200'],
|
||||
'category_id' => ['integer'],
|
||||
'category_ids' => ['array'],
|
||||
'repair_no' => ['required', 'max:100', Rule::unique(RepairRecord::class, 'repair_no')->ignore($id, 'id')],
|
||||
'order_no' => ['nullable', 'max:100'],
|
||||
'product_code' => ['nullable', 'max:100'],
|
||||
'product_name' => ['nullable', 'max:200'],
|
||||
'category_id' => ['nullable', 'integer'],
|
||||
'category_ids' => ['nullable', 'array'],
|
||||
'category_ids.*' => ['integer'],
|
||||
'fault_description_id' => ['integer'],
|
||||
'repair_result' => ['max:50'],
|
||||
'operator' => ['max:100'],
|
||||
'repaired_at' => ['integer'],
|
||||
'remark' => ['max:1000'],
|
||||
'fault_description_id' => ['nullable', 'integer'],
|
||||
'repair_result' => ['nullable', 'max:50'],
|
||||
'parts' => ['nullable'],
|
||||
'images' => ['nullable'],
|
||||
'operation_fault_steps' => ['nullable'],
|
||||
'responsible_operators' => ['nullable'],
|
||||
'operator' => ['nullable', 'max:100'],
|
||||
'repaired_at' => ['nullable', 'integer'],
|
||||
'remark' => ['nullable', 'max:1000'],
|
||||
];
|
||||
}
|
||||
|
||||
protected array $message = [
|
||||
'repair_no.required' => '维修单号不能为空',
|
||||
'repair_no.max' => '维修单号不能超过100个字符',
|
||||
'repair_no.unique' => '维修单号已存在',
|
||||
'order_no.max' => '订单号不能超过100个字符',
|
||||
'product_code.max' => '商品编码不能超过100个字符',
|
||||
'product_name.max' => '商品名称不能超过200个字符',
|
||||
|
||||
Reference in New Issue
Block a user