Sp_Quotation_CopyToQuotationData.md 1.88 KB

Sp_Quotation_CopyToQuotationData (procedure)

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

Parameters

# Mode Name Type
1 IN sGuid varchar(100)
2 IN sConfigId varchar(100)
3 IN sControlName varchar(100)
4 IN sLoginId varchar(100)
5 IN sBrId varchar(100)
6 IN sSuId varchar(100)

Body

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

Narrative

Business context: 销售管理 → 销售单据 → 报价单 — "copy product technology/process card data into the quotation" helper. When the user picks a customer+product pair on a quote line, this proc finds the latest matching mftproduct 工艺卡 (process card) and copies its material/process/control hierarchy into the quote's QuoQuotationslave_tmp staging tree so the cost calculator can run against it.

What it does: For each row in QuoQuotationslave_tmp (filtered by sParentId=sGuid, sMakePerson=sLoginId, sBrandsId, sSubsidiaryId), runs windowed prepared SQL over viw_mftproduct (bCheck=1) to pick the most recent process card per (sCustomerId, sProductId), and writes its sId into QuoQuotationslave_tmp.sProductTechnologyId. Then iterates mftproductmaterials for those cards and inserts/copies materials, parts, processes, and controls into the corresponding QuoQuotation{Materials,Process,Control}_Tmp rows.

Invocation: Java caller: BusinessBaseServiceImpl builds the call Sp_Quotation_CopyToQuotationData(sGuid, sConfigId, sControlName, sMakePerson, sBrandsId, sSubsidiaryId) SQL string when the quote form's CopyTo (复制) action fires — a generic-dispatch entry tied to the form's sControlName. Install: script/标版/30100101/Sp_Quotation_CopyToQuotationData.sql.