| Item | Description |
|---|---|
| API Name (Chinese) | Create Outsourcing Receipt Data |
| CROSS API Code | outsourcing.purchase.stockin.create |
| MES taskName | outsourcingPurchaseStockinCreate |
| ESB Path | /outsourcingPurchaseStockinCreate |
| DSMS Reference | api-2062 / vid-4462 |
| Call Direction | MES → ERP |
| Trigger Condition | TRANSTYPE = "59" |
| Request Format | JSON (Content-Type: application/json) |
| Transport Method | HTTP POST via ESB |
| Sync/Async | Synchronous call |
TransOrderDataToJson.java:648SendFormSbyJson.transferFormToJson()SendFormElementbyJson.getTransferFormHead/Body()XmlToERP_handler.sendToErpByESB()Content-Type: application/json (HttpClient.java:25)
| Field | Type | Required | Description | MES Source |
|---|---|---|---|---|
| companyID | string | Y | Company ID | COMPANYID |
| userId | string | Y | Operator | CONFIRMER |
| doAction | string | Y | 2=Transfer | DOACTION |
| docase | string | Y | 1=Add | DOCASE |
| head | object | Y | Header data | - |
| line | array | Y | Line items | - |
| Field | Type | Required | Description | MES Source |
|---|---|---|---|---|
| transferType | string | Y | Transfer type (59=Outsourcing) → ERP: doc_type_no | TRANSTYPE |
| date | string | Y | Document date YYYY-MM-DD → ERP: receipt_date | TRANSDATE |
| moveOutType | string | Y | Move out type | OUTTYPE |
| moveOutCode | string | Y | Move out code → ERP: supplier_no | OUTDEPID |
| moveInType | string | Y | Move in type | INTYPE |
| moveInCode | string | Y | Move in code (warehouse) | INDEPID |
| factoryCode | string | Y | Factory code | FACTORYID |
| remark | string | N | Remark → ERP: remark | COMMENT |
| create | string | N | Operator → ERP: operator_no | CONFIRMER |
| eMESTransferType | string | Y | MES doc type | TRANSTYPE |
| eMESTransferCode | string | Y | MES doc number | TRANSNO |
| source_no | string | Y | Source number (MES type-number) | eMESTransferType + "-" + eMESTransferCode |
| Field | Type | Required | Description | MES Source |
|---|---|---|---|---|
| moType | string | Y | Work order type (combine to ERP: wo_no) | MOTYPE |
| moCode | string | Y | Work order number (combine to ERP: wo_no) | MONO |
| moveOutOpSeq | string | Y | Move out op sequence | OUTOPSEQ |
| moveOutOpId | string | Y | Move out operation → ERP: op_no (Head) | OUTOP |
| qty | decimal | Y | Quantity → ERP: qty | TRANSQTY |
| unit | string | Y | Unit → ERP: unit_no | UNIT |
| batchCode | string | Y | Batch number → ERP: lot_no | LOTNO |
| prodCode | string | Y | Item code → ERP: item_no | ITEMID |
| acceptanceQty | decimal | N | Acceptance qty → ERP: receipt_qty | TL002 |
| inspectionReturnQty | decimal | N | Rejection qty → ERP: return_qty | TL003 |
| scrapQty | decimal | N | Scrap qty → ERP: scrap_qty | SCRAPQTY |
| valuationQty | decimal | N | Valuation qty → ERP: valuation_qty | VALUATIONQTY |
| moveInLocation | string | N | Move in location → ERP: storage_spaces_no | INSTORAGESPACE |
| remark | string | N | Remark → ERP: body_remark | NOTE |
| outSourceType | string | N | Outsourcing order type | OUTORDERTYPE |
| outSourceCode | string | N | Outsourcing order number | OUTORDERNO |
| Field | Type | Description |
|---|---|---|
| code | int | 200=Success, others=Failure |
| msg | string | Processing result message |
| TB001 | string | ERP doc type → Write to TL011 |
| TB002 | string | ERP doc number → Write to TL012 |
| # | Check Item | Rule | Code Location |
|---|---|---|---|
| 1 | TRANSTYPE check | = "59" to use outsourcing API | TransOrderDataToJson.java:648 |
| 2 | TO013 check | = 1 to send to ERP | TransOrderDataToJson.java:612 |
| 3 | Line data exists | SFT_TRANSORDER_LINE_GRID cannot be empty | TransOrderDataToJson.java:609 |
| 4 | ERP connection | SFTConfig.isHasERP() = true | TransOrderDataToJson.java:646 |
| Code | Message | Description |
|---|---|---|
| E001 | Required field missing | Request missing required fields |
| E002 | Outsourcing work order not found | MOTYPE-MONO error |
| E003 | Outsourcing work order status not allowed | Work order closed or cancelled |
| E004 | Quantity must be greater than zero | qty ≤ 0 |
| E005 | Quantity exceeds remaining | Exceeds available outsourcing stock-in qty |
| E999 | System error | Timeout, connection exception |
{
"companyID": "COMP01",
"userId": "EMP001",
"doAction": "2",
"docase": "1",
"head": {
"transferType": "59", // → ERP: doc_type_no
"date": "2026-03-19", // → ERP: receipt_date
"moveOutType": "1",
"moveOutCode": "OS001", // → ERP: supplier_no
"moveInType": "2",
"moveInCode": "FG01",
"factoryCode": "P001",
"remark": "Outsourcing receipt", // → ERP: remark
"create": "EMP001", // → ERP: operator_no
"eMESTransferType": "59",
"eMESTransferCode": "T20260319001"
},
"line": [{
"moType": "5101",
"moCode": "20260319001",
"moveOutOpSeq": "0020",
"moveOutOpId": "OS-OP", // → ERP Head: op_no
"qty": 100, // → ERP: qty
"unit": "PCS", // → ERP: unit_no
"batchCode": "LOT20260319001", // → ERP: lot_no
"prodCode": "FG-A001-001", // → ERP: item_no
"acceptanceQty": 98, // → ERP: receipt_qty (acceptance qty)
"inspectionReturnQty": 1, // → ERP: return_qty (rejection qty)
"scrapQty": 1, // → ERP: scrap_qty (scrap qty)
"valuationQty": 98, // → ERP: valuation_qty (valuation qty)
"moveInLocation": "A-01-01", // → ERP: storage_spaces_no
"remark": "Good quality", // → ERP: body_remark
"outSourceType": "5902",
"outSourceCode": "20260319001"
}]
}
{
"code": 200,
"msg": "Outsourcing receipt created successfully",
"TB001": "5902",
"TB002": "20260319001"
}
{
"code": 500,
"msg": "Outsourcing work order not found 5101-20260319999"
}