已使用商品数量

This commit is contained in:
2024-04-17 11:46:59 +08:00
parent f83580508a
commit df935b6c82
3 changed files with 30 additions and 26 deletions
+21 -23
View File
@@ -2887,30 +2887,28 @@ class PatientOrderService extends BaseService
$result['order_product'] = $order_products->toArray();
}
// 已使用商品数量
$used_quantity = 0;
foreach ($order_products as $order_product){
// 获取详情item
$params = array();
$params['order_product_id'] = $order_product['order_product_id'];
$order_product_items = OrderProductItem::getList($params);
if (empty($order_product_items)){
return fail(HttpEnumCode::SERVER_ERROR);
}
foreach ($order_product_items as $order_product_item){
$used_quantity = $order_product_item["amount"];
}
}
if ($used_quantity > 30){
$used_quantity = 30;
}
$result['order_service_package_product']['used_quantity'] = $used_quantity;
// // 已使用商品数量
// $used_quantity = 0;
// foreach ($order_products as $order_product){
// // 获取详情item
// $params = array();
// $params['order_product_id'] = $order_product['order_product_id'];
// $order_product_items = OrderProductItem::getList($params);
// if (empty($order_product_items)){
// return fail(HttpEnumCode::SERVER_ERROR);
// }
//
// foreach ($order_product_items as $order_product_item){
// $used_quantity = $order_product_item["amount"];
// }
// }
//
// if ($used_quantity > 30){
// $used_quantity = 30;
// }
//
// $result['order_service_package_product'][0]['remaining_quantity'] = $used_quantity;
}
// 获取药品剩余数量
}
return success($result);