feat:depotPurchase
This commit is contained in:
@@ -68,7 +68,7 @@ class DepotController
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 采购入库
|
* 采购
|
||||||
* @param DepotRequest $request
|
* @param DepotRequest $request
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
@@ -79,4 +79,16 @@ class DepotController
|
|||||||
{
|
{
|
||||||
return (new DepotService)->purchase();
|
return (new DepotService)->purchase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 采购列表
|
||||||
|
* @param DepotRequest $request
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
#[RequestMapping(path: "purchase_list", methods: "GET")]
|
||||||
|
#[Scene(scene: "purchase_list")]
|
||||||
|
public function purchaseList(DepotRequest $request): array
|
||||||
|
{
|
||||||
|
return (new DepotService)->purchaseList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,5 +38,6 @@ class DepotRequest extends FormRequest
|
|||||||
'depot_edit' => ['id','name'],
|
'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'],
|
'purchase' => ['depot_id','material_id','supplier_id','type','purchase_price','number','city_id','kitchen_id'],
|
||||||
|
'purchase_list' => ['limit','query_id','query_kitchen_id'],
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ class DepotService extends BaseService{
|
|||||||
#[Inject]
|
#[Inject]
|
||||||
protected MaterialStock $MaterialStockModel;
|
protected MaterialStock $MaterialStockModel;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
|
protected DepotPurchase $DepotPurchaseModel;
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -189,4 +192,27 @@ class DepotService extends BaseService{
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function purchaseList():array
|
||||||
|
{
|
||||||
|
$limit = (int)$this->request->input('limit', 10);
|
||||||
|
$id = (int)$this->request->input('query_id');
|
||||||
|
$kitchenId = (int)$this->request->input('query_kitchen_id');
|
||||||
|
|
||||||
|
$list = $this->DepotPurchaseModel
|
||||||
|
->leftJoin('material','depot_purchase.material_id','=','material.id')
|
||||||
|
->leftJoin('supplier','depot_purchase.supplier_id','=','supplier.id')
|
||||||
|
->leftJoin('depot','depot_purchase.depot_id','=','depot.id')
|
||||||
|
->where('depot_purchase.is_del',DepotCode::IS_NO_DEL)
|
||||||
|
->when($id,function ($query) use ($id) {
|
||||||
|
$query->where('depot_purchase.id',$id);
|
||||||
|
})
|
||||||
|
->when($kitchenId,function ($query) use ($kitchenId) {
|
||||||
|
$query->where('depot_purchase.kitchen_id',$kitchenId);
|
||||||
|
})
|
||||||
|
->paginate($limit,['depot_purchase.*','material.name as material_name','supplier.name as supplier_name','depot.name as depot_name'])
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
return $this->return->success('success',$list);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -377,3 +377,8 @@ GET {{host}}/admin/supplier/delete?id=1
|
|||||||
Content-Type: application/x-www-form-urlencoded
|
Content-Type: application/x-www-form-urlencoded
|
||||||
Authorization: Bearer {{admin_token}}
|
Authorization: Bearer {{admin_token}}
|
||||||
|
|
||||||
|
### 采购列表
|
||||||
|
GET {{host}}/admin/depot/purchase_list?limit=10
|
||||||
|
content-type: application/json
|
||||||
|
Authorization: Bearer {{admin_token}}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user