← Back to API List

Supplier Master Data

GET ERP → MES
supplier.get

Synchronizes supplier master data from ERP to MES. Supplier data is stored in WORKSTATION table, identified by LOCATION='outSource'.

Basic Information

API Name
supplier.get
Method Name
upWorkStationCROSS_supplier
Target Table
WORKSTATION
JSON Node
supplier_data
Primary Key
ID (supplier_no)
Code Location
RegularESB.java:3628

Response Fields

ERP FieldMES FieldDescription
supplier_noIDSupplier number (Primary Key)
supplier_nameNAMESupplier name
modify_no-Modified by
tran_statusTRAN_STATUSTransaction status

Response Example

{
  "supplier_data": [
    {
      "supplier_no": "SUP001",
      "supplier_name": "Supplier A Company",
      "modify_no": "USER001",
      "tran_status": "AU"
    }
  ]
}

Special Processing

Supplier and Workstation Share the Same Table
Supplier data is stored in the WORKSTATION table, marked as outsourcing supplier with LOCATION = 'outSource'. When inserting, default values for WS002-WS013 are automatically set.

Database Update SQL

Check Insert or Update

SELECT COUNT(1) FROM WORKSTATION WHERE ID = N'{supplier_no}'
-- count > 0 → UPDATE, count = 0 → INSERT

INSERT (Add Supplier)

INSERT INTO WORKSTATION (
    ID, NAME, DESCRIPTION, LOCATION,
    LASTMAINTAINUSER, LASTMAINTAINDATETIME,
    WS002, WS003, WS004, WS005, WS006, WS007,
    WS008, WS009, WS010, WS011, WS012, WS013,
    BARCODEUSE, DISPATCHUSE
) VALUES (
    :ID,
    :NAME,
    '',
    'outSource',           -- Outsourcing flag
    :userid,
    N'{current_time}',
    'N', 'Y', 'N', 'N', 'N', 'Y',
    'N', 'N', 'N', 'N', 'N', 'N',
    2, 2
)

UPDATE (Modify Supplier)

UPDATE WORKSTATION SET
    NAME = :NAME,
    LASTMAINTAINUSER = :userid,
    LASTMAINTAINDATETIME = N'{current_time}'
WHERE ID = :ID AND LOCATION = 'outSource'