This commit is contained in:
wucongxing8150 2024-04-30 11:47:34 +08:00
parent bf94959b06
commit ad389c4fca

View File

@ -45,20 +45,20 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
try { try {
// 获取可查询商品订单 // 获取可查询商品订单
$order_product_ids = $this->getSearchableProductOrder(); $order_products = $this->getSearchableProductOrder();
if (empty($order_product_ids)){ if (empty($order_products)){
$this->line("结束:无可执行的商品订单"); $this->line("结束:无可执行的商品订单");
return; return;
} }
foreach ($order_product_ids as $item) { foreach ($order_products as $order_product) {
Db::beginTransaction(); Db::beginTransaction();
$this->line("本次请求订单号:" . $item['order_product_id']); $this->line("本次请求订单号:" . $order_product['order_product_id']);
// 获取药品订单处方数据 // 获取药品订单处方数据
$params = array(); $params = array();
$params['order_prescription_id'] = $item['order_prescription_id']; $params['order_prescription_id'] = $order_product['order_prescription_id'];
$order_prescription = OrderPrescription::getOne($params); $order_prescription = OrderPrescription::getOne($params);
if (empty($order_prescription)){ if (empty($order_prescription)){
Db::rollBack(); Db::rollBack();
@ -68,7 +68,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
try { try {
$Prescription = new Prescription(); $Prescription = new Prescription();
$result = $Prescription->getPrescription($item['order_product_no'],$order_prescription['prescription_code']); $result = $Prescription->getPrescription($order_product['order_product_no'],$order_prescription['prescription_code']);
$this->line("处方平台数据:" . json_encode($result,JSON_UNESCAPED_UNICODE)); $this->line("处方平台数据:" . json_encode($result,JSON_UNESCAPED_UNICODE));
@ -88,7 +88,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
if ($result['status'] == "CFD03" || $result['status'] == "CFD04" || $result['status'] == "CFD06" || $result['status'] == "CFD07"){ if ($result['status'] == "CFD03" || $result['status'] == "CFD04" || $result['status'] == "CFD06" || $result['status'] == "CFD07"){
// 药师审核未通过/库存不足/已取消/申请退款 // 药师审核未通过/库存不足/已取消/申请退款
// 检测药品订单数据 // 检测药品订单数据
$res = $this->checkPreFailedOrderStatus($item); $res = $this->checkPreFailedOrderStatus($order_product);
if (!$res){ if (!$res){
Db::rollBack(); Db::rollBack();
continue; continue;
@ -96,22 +96,22 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
// 修改失败时药品订单数据 // 修改失败时药品订单数据
if ($result['status'] == "CFD03"){ if ($result['status'] == "CFD03"){
$this->savePreFailedOrderStatus($item,"复核失败"); $this->savePreFailedOrderStatus($order_product,"复核失败");
}elseif($result['status'] == "CFD04"){ }elseif($result['status'] == "CFD04"){
$this->savePreFailedOrderStatus($item,"库存不足"); $this->savePreFailedOrderStatus($order_product,"库存不足");
}else{ }else{
$this->savePreFailedOrderStatus($item,"订单取消"); $this->savePreFailedOrderStatus($order_product,"订单取消");
} }
// 执行退款 // 执行退款
$OrderService = new OrderService(); $OrderService = new OrderService();
$OrderService->orderRefund($item['order_product_no'],"订单退款"); $OrderService->orderRefund($order_product['order_product_no'],"订单退款");
} }
if ($result['status'] == "CFD05"){ if ($result['status'] == "CFD05"){
// 已发货/已取货 // 已发货/已取货
// 检测成功时药品订单数据 // 检测成功时药品订单数据
$res = $this->checkPreSuccessOrderStatus($item); $res = $this->checkPreSuccessOrderStatus($order_product);
if (!$res){ if (!$res){
Db::rollBack(); Db::rollBack();
continue; continue;
@ -198,17 +198,7 @@ class getPrescriptionOrderStatusCommand extends HyperfCommand
$order_product_status = [2,3];// 订单状态1:待支付 2:待发货 3:已发货 4:已签收 5:已取消) $order_product_status = [2,3];// 订单状态1:待支付 2:待发货 3:已发货 4:已签收 5:已取消)
$fields = [ $order_product = OrderProduct::getStatusList($params,$order_product_status);
'order_product_id',
'order_product_no',
'order_prescription_id',
'patient_id',
'order_product_status',
'consignee_tel',
'logistics_no',
];
$order_product = OrderProduct::getStatusList($params,$order_product_status,$fields);
if (empty($order_product)){ if (empty($order_product)){
return []; return [];
} }