Sp_System_BatchNPriceMoney (procedure)
@author: qmj @date: 20210707 封存 @describe: 价格批量更新,按产品金额,目前仅订单可使用
- Type: PROCEDURE
- Deterministic: NO
- SQL data access: CONTAINS SQL
Parameters
| # | Mode | Name | Type |
|---|---|---|---|
| 1 | IN | sFormGuid |
varchar(100) |
| 2 | IN | sSrcGuid |
varchar(100) |
| 3 | IN | dPrice |
decimal(18,6) |
| 4 | IN | dMoney |
decimal(18,6) |
| 5 | IN | dQty |
decimal(18,6) |
| 6 | IN | oldQty |
decimal(18,6) |
| 7 | IN | tDeliverDate |
datetime |
| 8 | IN | sLoginId |
varchar(100) |
| 9 | IN | sBrId |
varchar(100) |
| 10 | IN | sSuId |
varchar(100) |
| 11 | IN | sChangePriceMemo |
longtext |
| 12 | OUT | sCode |
int |
| 13 | OUT | sReturn |
varchar(4000) |
Body
Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpSystem_BatchNPriceMoney'._
Narrative
Business context: 销售管理 → 销售订单 / 改价 — batch price update by 产品金额 for a sales-order line. Header comment marks it 封存 (qmj, 2021-07-07) — "目前仅订单可使用". When the user re-prices a 销售订单从表 row, this proc recomputes the line money/tax/foreign-currency fields from the new price and propagates the change to any linked 印刷工单 (MftWorkOrderSlave) and 送货通知/送货单 not yet confirmed, so downstream documents stay in sync with the new agreed price.
What it does: Reads NetMoney/NetPrice decimal settings and the CbxDeliverGoods/CbxDeliverGoodsNotify system flags from SysSystemSettings. Resolves the parent SalSalesOrderMaster for the slave id sSrcGuid and the order's tCreateDate. Checks sysaccountperiod — if the order's period is bFrozen=1, aborts with sNoCanCheckByAccountPeriod. Otherwise updates SalSalesOrderSlave with the new dProductPrice/dProductMoney/dForeignPrice/dForeignMoney/dTax*, joining sistax for the tax rate; replicates the change to MftWorkOrderSlave (when the slave is order-driven) and any in-flight 送货通知/送货单 rows controlled by the system settings.
Invocation: Dispatched dynamically by GenericProcedureCallServiceImpl.doGenericProcedureCall() from the 销售订单 改价 button. Java BusinessBaseServiceImpl.updatePriceBatch recognises the name (equalsIgnoreCase("Sp_System_BatchNPriceMoney")) and, after a successful run, pushes the updated dProductMoney to RocketMQ via rocketMQService.pushERPOrderAmount(dict) so a 印工厂B2B partner / cloud order (sWebOrderId) sees the new amount. Also called by Sp_Calc_sQtt_hm (报价单 audit) and the variant Sp_System_BatchNPriceMoney_quo. Companion: Sp_System_BatchPriceMoney (external-currency variant). Install: script/标版/30100101/Sp_System_BatchNPriceMoney.sql.