When TOTAL_SCRAP_PRICE changes and is > 0, the trigger maintains ABSD_SALE through a three-branch decision tree:
spCreateNewSaleWithPrice(@LRNO, @TOTAL_SCRAP_PRICE) to create a new sale record; then inserts a row into tblFSWSalesPage with status 'X' and flag 1 (replacing any existing row)ABSD_SALE.SALE_PRICE_USD in place (same-day correction)spMakeSALEHistoricalWithPrice(@LRNO, @TOTAL_SCRAP_PRICE) to archive the current record and create a new current record; then refreshes tblFSWSalesPageABSD_CALA.EDITOR and ABSD_CALA.EDIT_DATE for the matching LRNO+INNOSHORT_NAME_PCASE changes on a record where OUT_TYPE ≠ 'S': writes ABSD_CBCOROOT.OUT_SHORT_NAME = UPPER(SHORT_NAME_PCASE)SHORT_NAME_PCASE = dbo.proper(OUT_SHORT_NAME)) — together they maintain both the upper-case canonical and the proper-case display formsOUT_TYPE='T' (tender/sub-builder) only: if the builder code exists in ABSD_SHIP_SEARCH, also updates ABSD_SHIP_SEARCH.SHIPBUILDER = SHORT_NAME_PCASEABSD_CBCY: updates all 30+ marker/date/reference fields (FDATE, TDATE, PRNT, POSN, MK01–MK20, TROC, RBS1/2, GNST, PSS1/2, DELT)TODATE = GETDATE() on the most recent open sanctions row for this KEY (the row with the latest FROMDATE and no TODATE)tblSanctionedCountry row with FROMDATE = GETDATE()ISNULL(TODATE,'') = '' identifies open (current) sanction recordstblSanctionedCountry rows (TODATE IS NULL) for the deleted country keysD22_MANBOW_LEN via spValidateManbow_Len stored procedure; if @Errcode=0 (failure), raises the returned error message and rolls backABSD_FUDI1.D22_MANBOW_LEN for the matching LRNOD22_MANBOW_LEN field on SUPPLEMENTAL_ABSD_FUDI1TANK_HEAT_EX change: writes annotation to tblAnnotationLogGeneral for grouping SUPPLEMENTAL_ABSD_FUGE / Tank_Heat_ExJ06_LNCHTIME (hours, minutes, seconds — more precise than the usual date-only audit)D11_TEU_CAP > 99999: writes 0 to ABSD_FUUN1.D11_TEU_CAP (the ABSD_ base field cannot hold 6-digit values; the supplemental table holds the full value)D11_TEU_CAP ≤ 99999: writes actual value to ABSD_FUUN1.D11_TEU_CAPABSD_SHIP_SEARCH.TEU for the search indexD11_TEU_CAP change: annotation grouping for SUPPLEMENTAL_ABSD_FUUN1 / D11_TEU_CapTEU_14 change (14-tonne TEU): annotation grouping for SUPPLEMENTAL_ABSD_FUUN1 / TEU_14>9999 as the threshold; current trigger uses >99999H02_Cor grouping on SUPPLEMENTAL_ABSD_HIMAJ06_LNCHTIMEdeleted pseudo-table (not inserted) for LRNO lookupLDT (Light Displacement Tonnes) changes and there is a CADI record with a non-NULL AMNT (scrap price per LDT, in hundredths):SUPPLEMENTAL_ABSD_CADI.TOTAL_SCRAP_PRICE = LDT × (AMNT / 100)ABSD_SHIP_SEARCH.LDT from the inserted valueSUPPLEMENTAL_ABSD_HITL / CGT (Compensated Gross Tonnage) on every LRNO processedTRIGGER_DISABLE and TRIGGER_DISABLE_SUPPOVGE must be empty for the trigger body to execute. Either guard table having a row prevents all processing.MMSI is supplied, calls spValidateMMSI(@lrno, ..., @mmsi, @Errcode OUTPUT, @Errmess OUTPUT)@Errcode=0: raises the error message and rolls backMMSI_EFD via valStandard4_new (4-digit year format); prefixes error message with "MMSI EFD "FISHNO20 changes: writes LEFT(LTRIM(RTRIM(FISHNO20)), 10) to ABSD_OVGE.B10_FISHNOABSD_SHIP_SEARCH.MMSI from the new valueSUPPLEMENTAL_ABSD_HIFL.MMSI for SEQNO='00' — keeps the flag history table's MMSI in sync (MW November 2017: Callsign and MMSI History task)spGetEnglishFieldName to get the human-readable field labeldeleted): OldValue = NULLdeleted pseudo-tableSUPPLEMENTAL_ABSD_OVGE_UPDATES staging tableSTAT5CODE must exist in tblMasterShipTypeXref (case-insensitive: COLLATE Latin1_General_CI_AI)HULL_SHAPE must exist in ABSD_CBUB1 with FLDI='11' (hull shape codebook bucket)A36A2PT (passenger), A37B2PS (RoPax), A37A2PC (cruise), A36A2PR (river), A36B2PL (launch), A32A2GF (ferry)tblStatCode5.Level5Decode for the new STAT5CODELEFT(Level5Decode, 50) to ABSD_SHIP_SEARCH.STATDECODEdeletedC05_NO_DECKS must have LEN ≥ 1 (cannot be empty/NULL)C05_NO_DECKS > 9: writes 0 to ABSD_STDE.C05_NO_DECKS (the base table field is a single digit; values above 9 overflow it)C05_NO_DECKS ≤ 9: writes actual value to ABSD_STDE.C05_NO_DECKSYARD_NO20 or SEQNO changes: writes RIGHT(LTRIM(RTRIM(YARD_NO20)), 12) to ABSD_STSE.C01_YRDNO for the matching LRNO+SEQNOSUPPLEMENTAL_ABSD_OVGE.YARD_NO20 for the same LRNO (trimmed)STANDARDDESIGN changes: updates ABSD_SHIP_SEARCH.STANDARDDESIGN for the matching LRNOTablename='ABSD_HIPP' and Fieldname='Related_LRNO' — this appears to be a copy-paste error; the annotation grouping points to a different table. The annotation fires but may write under the wrong grouping.deleted pseudo-table for LRNO lookupvalStandard9new (9-digit date format YYYYMMDD); error prefixed with "Completion Date "COMP_DATE changes and SEQNO='00'ABSD_STSE without a SEQNO filter (updates the current SEQNO='00' structural record)ABSD_STSE where SEQNO='01' only (construction record)C01_EFD = LEFT(COMP_DATE, 6) (YYYYMM) and C01_COMP_DT = COMP_DATE (YYYYMMDD)| Trigger | Event | Guard | Key Business Rule | Key Downstream |
|---|---|---|---|---|
SuppCADIUpdate | U/I | Standard | TOTAL_SCRAP_PRICE → ABSD_SALE (create/update/history); CALA audit | ABSD_SALE, tblFSWSalesPage, ABSD_CALA |
UpdateShortName | U | None | SHORT_NAME_PCASE → ABSD_CBCOROOT.OUT_SHORT_NAME; Type T → SHIP_SEARCH.SHIPBUILDER | ABSD_CBCOROOT, ABSD_SHIP_SEARCH |
SUPP_ABSD_CBCY_UPD | U/I | Standard | Sync SUPPLEMENTAL→ABSD_CBCY+Fairplay; MK01='C' sanctions management | ABSD_CBCY, tblFairplayCountryUniqueIMO, tblSanctionedCountry |
SUPP_ABSD_CBCY_DEL | D | None | Delete open tblSanctionedCountry rows | tblSanctionedCountry |
SUPP_FUDI_UPDATE | U/I | Standard | spValidateManbow_Len; cascade D22_MANBOW_LEN to ABSD_FUDI1 | ABSD_FUDI1, J06, annotation |
SUPPLEMENTAL_ABSD_FUDI2_All | U/I/D | Standard | J06 audit only | ABSD_OVGE J06 |
supp_fuge_update | U/I | Standard | Annotation on TANK_HEAT_EX; J06 with LNCHTIME | tblAnnotationLogGeneral, J06 |
FUUN1_Supp_Upd | U/I | Standard | D11_TEU_CAP cascade (0 if >99999); SHIP_SEARCH.TEU; annotation D11_TEU_CAP/TEU_14 | ABSD_FUUN1, ABSD_SHIP_SEARCH, J06 |
SUPPLEMENTAL_ABSD_HIFC1_All | U/I/D | Standard | J06 audit only | ABSD_OVGE J06 |
SUPPLEMENTAL_ABSD_HIFL_All | U/I/D | Standard | J06 audit only | ABSD_OVGE J06 |
supp_hima_update | U/I | Standard | Annotation H02_Cor; J06 with LNCHTIME | tblAnnotationLogGeneral, J06 |
SUPPLEMENTAL_ABSD_HIMA_DELETE | D | None | J06 audit on delete | ABSD_OVGE J06 |
SuppHITLUpdate | U/I | None | LDT → SUPP_CADI scrap price recalc; SHIP_SEARCH.LDT; annotation CGT | SUPPLEMENTAL_ABSD_CADI, ABSD_SHIP_SEARCH, J06 |
SuppNCONUPdate | U/I | Standard | J06 audit only | ABSD_OVGE J06 |
SuppOVGEUpdate | U/I | TRIGGER_DISABLE + TRIGGER_DISABLE_SUPPOVGE | spValidateMMSI; valStandard4_new; FISHNO20→B10_FISHNO; MMSI→SHIP_SEARCH+HIFL; tblChanges MMSI/YARD_NO | ABSD_OVGE, ABSD_SHIP_SEARCH, SUPPLEMENTAL_ABSD_HIFL, SUPP_OVGE_UPDATES, tblChanges |
SUPP_ABSD_OVTY_Update | U/I | Standard | STAT5CODE FK; HULL_SHAPE FK; passenger DECKED/BERTHED consistency; STAT5CODE→SHIP_SEARCH.STATDECODE; tblChanges historical-aware | ABSD_SHIP_SEARCH, tblChanges, J06 |
SUPP_STDE_UPDATE | U/I | Standard | NO_DECKS required; >9 → cascade 0; else cascade actual | ABSD_STDE.C05_NO_DECKS |
SuppSTSEUpdate | U/I | Standard | YARD_NO20→ABSD_STSE (12-char); SEQNO='01' YARD_NO→SUPP_OVGE; STANDARDDESIGN→SHIP_SEARCH | ABSD_STSE, SUPPLEMENTAL_ABSD_OVGE, ABSD_SHIP_SEARCH |
SUPPLEMENTAL_ABSD_STSE_DELETE | D | None | J06 audit on delete | ABSD_OVGE J06 |
SUPP_ABSD_STSE_COMPDATE_Update | U/I | Standard | valStandard9new; COMP_DATE→ABSD_STSE C01_EFD+C01_COMP_DT (active vs construction branch) | ABSD_STSE |