Dong bo du lieu co ban khuon/do ga tu ERP sang bang MoldInfo va MoldStatus cua MES.
| Truong ERP | Truong MES | Mo ta |
|---|---|---|
mold_fixture_no | moldId | Ma khuon (khoa chinh) |
mold_fixture_name | moldName | Ten khuon |
remark | remark | Ghi chu |
belongings_no | belongings | Ma thuoc ve |
supplier_no | productionLine | Ma day chuyen san xuat |
status | status | Trang thai |
tran_status | TRAN_STATUS | Trang thai giao dich |
{
"mold_fixture_data": [
{
"mold_fixture_no": "MOLD001",
"mold_fixture_name": "Khuon ep A",
"remark": "Su dung cho linh kien nhua chinh xac",
"belongings_no": "BELONG01",
"supplier_no": "WS001",
"status": "1",
"modify_no": "USER001",
"tran_status": "AU"
}
]
}
Khi them moi khuon se dong thoi tao ban ghi MoldStatus:
| Truong | Gia tri mac dinh | Mo ta |
|---|---|---|
| fail | 2 | So lan that bai |
| produced | 0 | So luong da san xuat |
| moldState | 1 | Trang thai khuon |
SELECT COUNT(1) FROM MoldInfo WHERE moldId = N'{mold_fixture_no}'
-- count > 0 → UPDATE, count = 0 → INSERT
-- Bang MoldInfo
INSERT INTO MoldInfo (
moldId, moldName, remark, belongings, productionLine, status
) VALUES (
:moldId,
:moldName,
:remark,
:belongings,
:productionLine,
:status
)
-- Bang MoldStatus (tao lien dong)
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