fix:depot materialCategory
This commit is contained in:
@@ -66,4 +66,17 @@ class DepotController
|
|||||||
{
|
{
|
||||||
return (new DepotService)->delete();
|
return (new DepotService)->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购入库
|
||||||
|
* @param DepotRequest $request
|
||||||
|
* @return array
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
#[RequestMapping(path: "depot_purchase", methods: "POST")]
|
||||||
|
#[Scene(scene: "purchase")]
|
||||||
|
public function purchase(DepotRequest $request): array
|
||||||
|
{
|
||||||
|
return (new DepotService)->purchase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,8 @@ class DepotRequest extends FormRequest
|
|||||||
protected array $scenes = [
|
protected array $scenes = [
|
||||||
'depot_list' => ['limit','query_id','query_kitchen_id'],
|
'depot_list' => ['limit','query_id','query_kitchen_id'],
|
||||||
'depot_add' => ['name','city_id','kitchen_id'],
|
'depot_add' => ['name','city_id','kitchen_id'],
|
||||||
'depot_edit' => ['id','name','city_id','kitchen_id'],
|
'depot_edit' => ['id','name'],
|
||||||
'depot_delete' => ['id'],
|
'depot_delete' => ['id'],
|
||||||
|
'purchase' => ['depot_id','material_id','supplier_id','type','purchase_price','number','city_id','kitchen_id'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ class MaterialCategoryRequest extends FormRequest
|
|||||||
protected array $scenes = [
|
protected array $scenes = [
|
||||||
'material_category_info' => ['query_id'],
|
'material_category_info' => ['query_id'],
|
||||||
'add' => ['name', 'parent_id', 'city_id', 'kitchen_id'],
|
'add' => ['name', 'parent_id', 'city_id', 'kitchen_id'],
|
||||||
'edit' => ['id','name', 'parent_id', 'city_id', 'kitchen_id'],
|
'edit' => ['id','name', 'parent_id'],
|
||||||
'delete' => ['id'],
|
'delete' => ['id'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace App\Service\Admin\Depot;
|
|||||||
use App\Constants\Admin\DepotCode;
|
use App\Constants\Admin\DepotCode;
|
||||||
use App\Exception\ErrException;
|
use App\Exception\ErrException;
|
||||||
use App\Model\Depot;
|
use App\Model\Depot;
|
||||||
|
use App\Model\DepotPurchase;
|
||||||
use App\Service\Admin\BaseService;
|
use App\Service\Admin\BaseService;
|
||||||
use Hyperf\Di\Annotation\Inject;
|
use Hyperf\Di\Annotation\Inject;
|
||||||
|
|
||||||
@@ -18,6 +19,9 @@ class DepotService extends BaseService{
|
|||||||
#[Inject]
|
#[Inject]
|
||||||
protected Depot $DepotModel;
|
protected Depot $DepotModel;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
|
protected DepotPurchase $DepotPurchaseModel;
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -85,8 +89,6 @@ class DepotService extends BaseService{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$info->name = $depotName;
|
$info->name = $depotName;
|
||||||
$info->city_id = (int)$this->request->input('city_id');
|
|
||||||
$info->kitchen_id = $kitchen_id;
|
|
||||||
|
|
||||||
if (!$info->save()) throw new ErrException('仓库修改失败');
|
if (!$info->save()) throw new ErrException('仓库修改失败');
|
||||||
|
|
||||||
|
|||||||
@@ -67,9 +67,6 @@ class MaterialCategoryService extends BaseService{
|
|||||||
|
|
||||||
$info->parent_id = $pid;
|
$info->parent_id = $pid;
|
||||||
|
|
||||||
$info->city_id = (int)$this->request->input('city_id');
|
|
||||||
$info->kitchen_id = (int)$this->request->input('kitchen_id');
|
|
||||||
|
|
||||||
if (!$info->save()) throw new ErrException('修改失败');
|
if (!$info->save()) throw new ErrException('修改失败');
|
||||||
|
|
||||||
return $this->return->success();
|
return $this->return->success();
|
||||||
|
|||||||
Reference in New Issue
Block a user