Synchronizes mold/fixture master data from ERP to MES MoldInfo and MoldStatus tables.
| ERP Field | MES Field | Description |
|---|---|---|
mold_fixture_no | moldId | Mold number (Primary Key) |
mold_fixture_name | moldName | Mold name |
remark | remark | Remark |
belongings_no | belongings | Belongings number |
supplier_no | productionLine | Production line number |
status | status | Status |
tran_status | TRAN_STATUS | Transaction status |
{
"mold_fixture_data": [
{
"mold_fixture_no": "MOLD001",
"mold_fixture_name": "Injection Mold A",
"remark": "For precision plastic parts",
"belongings_no": "BELONG01",
"supplier_no": "WS001",
"status": "1",
"modify_no": "USER001",
"tran_status": "AU"
}
]
}
When adding a mold, a MoldStatus record is created simultaneously:
| Field | Default Value | Description |
|---|---|---|
| fail | 2 | Failure count |
| produced | 0 | Produced quantity |
| moldState | 1 | Mold state |
SELECT COUNT(1) FROM MoldInfo WHERE moldId = N'{mold_fixture_no}'
-- count > 0 → UPDATE, count = 0 → INSERT
-- MoldInfo table
INSERT INTO MoldInfo (
moldId, moldName, remark, belongings, productionLine, status
) VALUES (
:moldId,
:moldName,
:remark,
:belongings,
:productionLine,
:status
)
-- MoldStatus table (linked creation)
INSERT INTO MoldStatus (moldId, fail, produced, moldState)
VALUES (:moldId, 2, 0, 1)
UPDATE MoldInfo SET
moldName = :moldName,
remark = :remark,
belongings = :belongings,
productionLine = :productionLine,
status = :status
WHERE moldId = :moldId