Sp_BtnEvent_NotifyMerge.md 1.96 KB

Sp_BtnEvent_NotifyMerge (procedure)

送货通知单合并

  • Type: PROCEDURE
  • Deterministic: NO
  • SQL data access: CONTAINS SQL

Parameters

# Mode Name Type
1 IN sProInParam varchar(10000)
2 IN sMakePerson varchar(100)
3 IN sUserId varchar(100)
4 IN sBrId varchar(100)
5 IN sSuId varchar(100)
6 OUT sReturn varchar(1000)
7 OUT sCode int

Body

Body is not pre-cached. To inspect: mysql --defaults-file=~/.my.cnf -e 'SHOW CREATE PROCEDURESpBtnEvent_NotifyMerge'._

Narrative

Business context: 销售 / 送货通知单 — button-click handler that merges several 送货通知单 (saldelivernotifymaster) into one by re-parenting all slave lines to the first selected master, so a single delivery covers multiple notify documents. Customer-uniqueness is enforced before merging.

What it does: Walks $.params[*].value[*].sId into a comma-CSV p_sAllId, keeping the first id as p_sParentId. Counts distinct saldelivernotifyslave.sCustomerId over sParentId IN p_sAllId; if more than one customer, aborts with sCode=-1 and the localised sDifferentCustomerCantHb ("不同的客户不能进行合并") message. Otherwise UPDATE saldelivernotifyslave SET sSrcParentId=sParentId, sParentId=p_sParentId for all matched slaves, attaching them to the surviving master. Default success message sShNoticeHb ("送货通知单合并成功") via Fun_Sis_GetConst.

Invocation: Dispatched dynamically by GenericProcedureCallServiceImpl.doGenericProcedureCall() (POST /procedureCall/doGenericProcedureCall) — 送货通知单 grid's 合并 toolbar button names Sp_BtnEvent_NotifyMerge as the action. No static caller, no gdsmodule hook.

Flag: LOCATE(A.sParentId, p_sAllId)>0 is a substring match, not a list match — a sParentId that is a prefix of another id (abc matching abcdef) would be merged in error.