fix:material

This commit is contained in:
LAPTOP-7SGDREK0\shiweijun
2025-02-20 15:16:19 +08:00
parent 327101514a
commit b717bdbd9f
2 changed files with 9 additions and 3 deletions

View File

@@ -38,12 +38,13 @@ class MaterialService extends BaseService{
->where('is_del',MaterialCode::IS_NO_DEL)
->where('status',MaterialCode::ENABLE)
->when(!empty($name), function ($query) use ($name) {
$query->where('name', 'like', "$name%");
$query->where('name', 'like', "%$name%");
})
->when(!empty($kitchenId), function ($query) use ($kitchenId) {
$query->where('kitchen_id', $kitchenId);
})
->paginate($limit)->toArray();
->paginate($limit,['name','unit','standard'])
->toArray();
return $this->return->success('success',$list);
}
@@ -106,7 +107,7 @@ class MaterialService extends BaseService{
$info = $this->MaterialApplication->getInfoById($id);
$info->is_del = 2;
if ($info->status == MaterialCode::ALL_OUT || $info->status == MaterialCode::PART_OUT) throw new ErrException("已进行出库");
if (!$info->save()) throw new ErrException('申请删除失败');
if (!$info->save()) throw new ErrException('材料有出库,申请删除失败');
return $this->return->success();
}

View File

@@ -428,6 +428,11 @@ GET {{host}}/api/dish/list?limit=10
content-type: application/json
Authorization: Bearer {{admin_token}}
###厨师查看材料列表
GET {{host}}/api/material/list?limit=10
content-type: application/json
Authorization: Bearer {{admin_token}}
### 厨师申请材料
POST {{host}}/api/material/application
Content-Type: application/x-www-form-urlencoded