业务订单已发货后不能再修改服用天数
- 已发货判定:履约状态已发货/已签收/已完成,或已填快递单号,或药房回传已发货(洛阳 SHIPPED/COMPLETED、甘草 20/30) - 已发货后「修改服用参数」与订单编辑中的主方/辅方开立天数、订单服用天数不可修改(服务端拦截);次数、袋数仍可改; 订单未单独设置天数时以处方开立天数为准,不会误判为修改 - 订单详情返回 days_locked,详情抽屉、订单列表(含 H5)编辑时禁用天数输入并提示 - 重新构建管理后台 Co-Authored-By: Claude Opus 5 <[EMAIL]>
This commit is contained in:
co-authored by
Claude Opus 5
parent
b675822377
commit
18a0989c00
@@ -270,7 +270,7 @@ namespace {
|
||||
fulfillment_status INTEGER, delete_time INTEGER, diagnosis_id INTEGER, creator_id INTEGER,
|
||||
reissue_from_prescription_id INTEGER NOT NULL DEFAULT 0, order_no TEXT DEFAULT "", ship_mode TEXT DEFAULT "gancao",
|
||||
ej_pharmacy_order_no TEXT DEFAULT "", ej_pharmacy_status TEXT DEFAULT "", gancao_reciperl_order_no TEXT DEFAULT "",
|
||||
gancao_order_state INTEGER DEFAULT 0,
|
||||
gancao_order_state INTEGER DEFAULT 0, tracking_number TEXT DEFAULT "", medication_days INTEGER,
|
||||
create_time INTEGER, update_time INTEGER
|
||||
)');
|
||||
Db::execute('CREATE TABLE zyt_tcm_prescription_order_pay_order (id INTEGER PRIMARY KEY, prescription_order_id INTEGER, pay_order_id INTEGER)');
|
||||
@@ -1277,7 +1277,30 @@ namespace {
|
||||
&& Db::name('tcm_diagnosis')->where('id', 10)->value('id_card') === '110101200001011234'
|
||||
&& (int) Db::name('tcm_prescription')->where('id', $contactRx)->value('age') === (int) Db::name('tcm_diagnosis')->where('id', 10)->value('age'),
|
||||
'edit saves the phone on the prescription and the ID card and age on the diagnosis');
|
||||
$decimalRow = array_replace($sample, ['dosage_amount' => '10.0000', 'amount' => '20.00']);
|
||||
|
||||
// 业务订单已发货后不能再改服用天数(处方开立 / 订单天数),未发货前可改;次数等仍可改。
|
||||
Db::name("tcm_prescription_order")->insert(["id" => 4001, "prescription_id" => $contactRx, "diagnosis_id" => 10,
|
||||
"creator_id" => 1, "fulfillment_status" => 2, "medication_days" => 10]);
|
||||
$usage = static fn (array $fields): array => $fields + ["id" => 4001, "times_per_day" => 2, "usage_days" => 7, "medication_days" => 10];
|
||||
Db::name("tcm_prescription")->where("id", $contactRx)->update(["usage_days" => 7, "times_per_day" => 2]);
|
||||
$assert(PrescriptionOrderLogic::patchPrescriptionUsage($usage(["medication_days" => 14]), 1, $root)
|
||||
&& (int) Db::name("tcm_prescription_order")->where("id", 4001)->value("medication_days") === 14,
|
||||
"days can be changed before shipping: " . PrescriptionOrderLogic::getError());
|
||||
$assert(!PrescriptionOrderLogic::isOrderShipped(Db::name("tcm_prescription_order")->find(4001)), "an unshipped order reports unlocked days");
|
||||
foreach ([["fulfillment_status" => 5], ["tracking_number" => "SF123"], ["ej_pharmacy_status" => "SHIPPED"], ["gancao_order_state" => 20]] as $shipped) {
|
||||
Db::name("tcm_prescription_order")->where("id", 4001)->update($shipped + ["fulfillment_status" => 2, "tracking_number" => "",
|
||||
"ej_pharmacy_status" => "", "gancao_order_state" => 0]);
|
||||
$assert(!PrescriptionOrderLogic::patchPrescriptionUsage($usage(["medication_days" => 21]), 1, $root)
|
||||
&& PrescriptionOrderLogic::getError() === PrescriptionOrderLogic::SHIPPED_DAYS_LOCKED
|
||||
&& !PrescriptionOrderLogic::patchPrescriptionUsage($usage(["medication_days" => 14, "usage_days" => 9]), 1, $root)
|
||||
&& (int) Db::name("tcm_prescription_order")->where("id", 4001)->value("medication_days") === 14
|
||||
&& (int) Db::name("tcm_prescription")->where("id", $contactRx)->value("usage_days") === 7
|
||||
&& PrescriptionOrderLogic::isOrderShipped(Db::name("tcm_prescription_order")->find(4001)),
|
||||
"shipped orders refuse day changes: " . json_encode($shipped));
|
||||
}
|
||||
$assert(PrescriptionOrderLogic::patchPrescriptionUsage($usage(["medication_days" => 14, "times_per_day" => 3]), 1, $root)
|
||||
&& (int) Db::name("tcm_prescription")->where("id", $contactRx)->value("times_per_day") === 3,
|
||||
"other usage fields stay editable after shipping: " . PrescriptionOrderLogic::getError()); $decimalRow = array_replace($sample, ['dosage_amount' => '10.0000', 'amount' => '20.00']);
|
||||
$floatRow = array_replace($sample, ['dosage_amount' => 10.0, 'amount' => 20]);
|
||||
$assert(Policy::hash($decimalRow) === Policy::hash($floatRow), 'raw DECIMAL and ORM float hashes agree');
|
||||
$assert(Policy::hash(Policy::snapshot($decimalRow)) === Policy::hash($decimalRow), 'snapshot hashing is idempotent');
|
||||
|
||||
Reference in New Issue
Block a user