feat:material
This commit is contained in:
@@ -40,6 +40,6 @@ class MaterialRequest extends FormRequest
|
||||
'material_add' => ['category_id', 'name', 'standard', 'unit', 'bar_code', 'city_id', 'kitchen_id'],
|
||||
'material_edit' => ['id','category_id', 'name', 'standard', 'unit', 'bar_code','status'],
|
||||
'material_delete' => ['id'],
|
||||
'materialStock_list' => ['limit','query_name','query_depotId','query_supplierId','query_kitchenId'],
|
||||
'materialStock_list' => ['limit','query_name','query_materialId','query_depotId','query_supplierId','query_kitchenId'],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -24,13 +24,15 @@ class MaterialRequest extends FormRequest
|
||||
return [
|
||||
'limit' => 'required|integer',
|
||||
'query_name' =>'sometimes|string',
|
||||
'city_id' => 'sometimes|integer|exists:system_city,id',
|
||||
'kitchen_id' => 'sometimes|integer|exists:kitchen,id',
|
||||
'query_kitchen_id' =>'sometimes|integer|exists:kitchen,id',
|
||||
'city_id' => 'required|integer|exists:system_city,id',
|
||||
'kitchen_id' => 'required|integer|exists:kitchen,id',
|
||||
'id' => 'required|integer|exists:material_application,id',
|
||||
];
|
||||
}
|
||||
|
||||
protected array $scenes = [
|
||||
'material_list' => ['limit','query_name'],
|
||||
'material_list' => ['limit','query_name','query_kitchen_id'],
|
||||
'material_application' => ['material_id','dish_id','number','processing','city_id','kitchen_id'],
|
||||
'application_edit' => ['id','number','processing'],
|
||||
'application_delete' => ['id'],
|
||||
|
||||
@@ -112,6 +112,7 @@ class MaterialService extends BaseService{
|
||||
{
|
||||
$limit = (int)$this->request->input('limit', 10);
|
||||
$name = $this->request->input('query_name');
|
||||
$materialId = $this->request->input('query_materialId');
|
||||
$depotId = (int)$this->request->input('query_depotId');
|
||||
$supplierId = (int)$this->request->input('query_supplierId');
|
||||
$kitchenId = (int)$this->request->input('query_kitchenId');
|
||||
@@ -123,6 +124,9 @@ class MaterialService extends BaseService{
|
||||
->when(!empty($name), function ($query) use ($name) {
|
||||
$query->where('material.name', 'like', "$name%");
|
||||
})
|
||||
->when(!empty($materialId), function ($query) use ($materialId) {
|
||||
$query->where('material_stock.material_id', $materialId);
|
||||
})
|
||||
->when(!empty($depotId), function ($query) use ($depotId) {
|
||||
$query->where('material_stock.depot_id', $depotId);
|
||||
})
|
||||
|
||||
@@ -31,6 +31,7 @@ class MaterialService extends BaseService{
|
||||
{
|
||||
$limit = (int)$this->request->input('limit', 10);
|
||||
$name = $this->request->input('query_name');
|
||||
$kitchenId = $this->request->input('query_kitchen_id');
|
||||
|
||||
$list = $this
|
||||
->MaterialModel
|
||||
@@ -39,6 +40,9 @@ class MaterialService extends BaseService{
|
||||
->when(!empty($name), function ($query) use ($name) {
|
||||
$query->where('name', 'like', "$name%");
|
||||
})
|
||||
->when(!empty($kitchenId), function ($query) use ($kitchenId) {
|
||||
$query->where('kitchen_id', $kitchenId);
|
||||
})
|
||||
->paginate($limit)->toArray();
|
||||
|
||||
return $this->return->success('success',$list);
|
||||
|
||||
Reference in New Issue
Block a user