繁體中文 English Tiếng Việt ภาษาไทย
← Quay lai danh sach API

Du lieu co ban khuon

GET ERP → MES
mold.fixture.get

Dong bo du lieu co ban khuon/do ga tu ERP sang bang MoldInfo va MoldStatus cua MES.

Thong tin co ban

Ten API
mold.fixture.get
Ten phuong thuc
upMoldInfoCROSS
Bang du lieu dich
MoldInfo / MoldStatus
Node JSON
mold_fixture_data
Khoa chinh
moldId (mold_fixture_no)
Vi tri chuong trinh
RegularESB.java:3728

Truong phan hoi

Truong ERPTruong MESMo ta
mold_fixture_nomoldIdMa khuon (khoa chinh)
mold_fixture_namemoldNameTen khuon
remarkremarkGhi chu
belongings_nobelongingsMa thuoc ve
supplier_noproductionLineMa day chuyen san xuat
statusstatusTrang thai
tran_statusTRAN_STATUSTrang thai giao dich

Vi du phan hoi

{
  "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"
    }
  ]
}

Gia tri mac dinh MoldStatus

Khi them moi khuon se dong thoi tao ban ghi MoldStatus:

TruongGia tri mac dinhMo ta
fail2So lan that bai
produced0So luong da san xuat
moldState1Trang thai khuon

SQL cap nhat co so du lieu

Xac dinh them moi hoac cap nhat

SELECT COUNT(1) FROM MoldInfo WHERE moldId = N'{mold_fixture_no}'
-- count > 0 → UPDATE, count = 0 → INSERT

INSERT (Them moi khuon)

-- 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 (Cap nhat khuon)

UPDATE MoldInfo SET
    moldName = :moldName,
    remark = :remark,
    belongings = :belongings,
    productionLine = :productionLine,
    status = :status
WHERE moldId = :moldId