debug
This commit is contained in:
@@ -343,6 +343,21 @@ class PrescriptionOrderLogic
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否允许在业务订单中选择发货药房(甘草 / 洛阳)。
|
||||
* 无此权限时沿用历史逻辑,订单固定走甘草药房。
|
||||
*/
|
||||
public static function canSelectShipMode(array $adminInfo): bool
|
||||
{
|
||||
if (!empty($adminInfo['root']) && (int) $adminInfo['root'] === 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$permissions = AuthLogic::getAuthByAdminId((int) ($adminInfo['admin_id'] ?? 0));
|
||||
|
||||
return in_array('tcm.prescriptionOrder/setShipMode', $permissions, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PrescriptionOrder $row
|
||||
*/
|
||||
@@ -1022,7 +1037,9 @@ class PrescriptionOrderLogic
|
||||
$order->service_package = (string) ($params['service_package'] ?? '');
|
||||
$order->tracking_number = (string) ($params['tracking_number'] ?? '');
|
||||
$order->express_company = self::normalizeExpressCompany($params['express_company'] ?? 'auto');
|
||||
$order->ship_mode = self::normalizeShipMode((string) ($params['ship_mode'] ?? 'gancao'));
|
||||
$order->ship_mode = self::canSelectShipMode($adminInfo)
|
||||
? self::normalizeShipMode((string) ($params['ship_mode'] ?? 'gancao'))
|
||||
: 'gancao';
|
||||
$order->fee_type = (int) $params['fee_type'];
|
||||
$order->amount = round((float) $params['amount'], 2);
|
||||
$order->internal_cost = $internalCost;
|
||||
@@ -5132,6 +5149,11 @@ class PrescriptionOrderLogic
|
||||
|
||||
return false;
|
||||
}
|
||||
if (!self::canSelectShipMode($adminInfo)) {
|
||||
self::$error = '无权限设置发货药房';
|
||||
|
||||
return false;
|
||||
}
|
||||
if (!self::assertRemoteSnapshotMutable($order)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -244,7 +244,7 @@ class EjPharmacyCallbackController extends BaseApiController
|
||||
// Keep the same readable production-flow format as Gancao:
|
||||
// flow name and pharmacy are the primary information.
|
||||
$summaryParts = [
|
||||
'洛阳药房回传:' . (EjPharmacyShipmentPolicy::isCompletedEvent($payload) ? '订单已完成' : '订单药房流转制作中'),
|
||||
'洛阳药房回传:订单药房流转制作中',
|
||||
'流程:' . $stepName,
|
||||
'药房:洛阳药房',
|
||||
];
|
||||
|
||||
@@ -13,12 +13,19 @@ final class EjPharmacyShipmentPolicy
|
||||
|| strtoupper(trim((string) ($payload['status'] ?? ''))) === 'SHIPPED';
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $payload */
|
||||
public static function isWorkflowStepEvent(array $payload): bool
|
||||
{
|
||||
return strtoupper(trim((string) ($payload['event_type'] ?? ''))) === 'WORKFLOW_STEP_COMPLETED';
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $payload */
|
||||
public static function isCompletedEvent(array $payload): bool
|
||||
{
|
||||
return strtoupper(trim((string) ($payload['status'] ?? ''))) === 'COMPLETED'
|
||||
|| (strtoupper(trim((string) ($payload['event_type'] ?? ''))) === 'WORKFLOW_STEP_COMPLETED'
|
||||
&& (bool) ($payload['final'] ?? false));
|
||||
// A workflow node (including the final “ship” node) is only a
|
||||
// pharmacy-process update. It must not close the ZYT business order.
|
||||
return !self::isWorkflowStepEvent($payload)
|
||||
&& strtoupper(trim((string) ($payload['status'] ?? ''))) === 'COMPLETED';
|
||||
}
|
||||
|
||||
/** @param array<string,mixed> $payload */
|
||||
@@ -47,6 +54,12 @@ final class EjPharmacyShipmentPolicy
|
||||
? $rollbackStatus
|
||||
: ($currentStatus === 9 ? 2 : $currentStatus);
|
||||
}
|
||||
if (self::isWorkflowStepEvent($payload)) {
|
||||
// EJ workflow callbacks are informational nodes. Keep the ZYT
|
||||
// fulfillment status unchanged; only explicit shipment/completion
|
||||
// events may advance it.
|
||||
return $currentStatus;
|
||||
}
|
||||
if (self::isShippedEvent($payload) && in_array($currentStatus, [1, 2], true)) {
|
||||
return 5;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user