| Item | Description |
|---|---|
| API Name (Chinese) | Work Order Stock-In Data Create |
| API Name (English) | Work Order Stock-In Data Create |
| CROSS API Code | stockin.data.create |
| ESB Service | /sendTransForm (General) or /outsourcingPurchaseStockinCreate (TRANSTYPE=59) |
| Call Direction | MES → ERP |
| Trigger Timing | 1. When last station checkout completes 2. Batch stock-in operation 3. Manual stock-in trigger |
| Main Business Scenario | After manufacturing completion, stock finished goods into ERP designated warehouse, update ERP inventory quantity and work order status |
| Request Format | JSON (Content-Type: application/json) |
| Sync/Async | Synchronous call |
| Transaction Control | Required (MES and ERP must ensure data consistency) |
| Remark | Return TB001/TB002 is the document type/number generated by ERP, needs to be written back to TL011/TL012 |
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, 2=Modify, 3=Delete | DOCASE |
| head | object | Y | Header data | - |
| line | array | Y | Line items | - |
| Field | Type | Length | Required | Description | MES Source |
|---|---|---|---|---|---|
| transferType | string | 10 | Y | Transfer type | TRANSTYPE |
| transferCode | string | 30 | N | Transfer number (required for modify) | TO008 |
| date | string | 10 | Y | Document date YYYY-MM-DD | TRANSDATE |
| moveOutType | string | 2 | Y | Move out type (1=WS, 2=WH, 3=Dept) | OUTTYPE |
| moveOutCode | string | 20 | Y | Move out code | OUTDEPID |
| moveOutName | string | 50 | N | Move out name | OUTDEPNAME |
| moveInType | string | 2 | Y | Move in type | INTYPE |
| moveInCode | string | 20 | Y | Move in code (warehouse) | INDEPID |
| moveInName | string | 50 | N | Move in name | INDEPNAME |
| factoryCode | string | 10 | Y | Factory code | FACTORYID |
| confirmationCode | string | 20 | N | Confirmation code | CONFIRMCODE |
| remark | string | 255 | N | Remark | COMMENT |
| orderDate | string | 10 | N | Order date | DOCUMENTDATE |
| eMESTransferType | string | 10 | Y | MES doc type | TRANSTYPE |
| eMESTransferCode | string | 30 | Y | MES doc number | TRANSNO |
| source_no | string | 50 | Y | Source number (MES type-number) | eMESTransferType + "-" + eMESTransferCode |
| operator_no | string | 20 | N | Operator | create (CONFIRMER) |
| Field | Type | Required | Description | MES Source |
|---|---|---|---|---|
| moType | string | Y | Work order type | MOTYPE |
| moCode | string | Y | Work order number | MONO |
| moveOutOpSeq | string | Y | Move out op sequence | OUTOPSEQ |
| moveOutOpId | string | Y | Move out operation | OUTOP |
| moveInOpSeq | string | N | Move in op sequence | INOPSEQ |
| moveInOpId | string | N | Move in operation | INOP |
| qty | decimal | Y | Quantity | TRANSQTY |
| unit | string | Y | Unit | UNIT |
| batchCode | string | Y | Batch/Lot number | LOTNO |
| state | string | Y | State (PATTERN) | PATTERN |
| prodCode | string | Y | Item code | ITEMID |
| prodName | string | N | Item name | ITEMNAME |
| prodSpec | string | N | Item spec | ITEMDESCRIPTION |
| acceptanceQty | decimal | N | Acceptance qty | TL002 |
| scrapQty | decimal | N | Scrap qty | SCRAPQTY |
| inspectionReturnQty | decimal | N | Rejection qty | TL003 |
| moveInCode | string | N | Move in dept | INDEP |
| moveInLocation | string | N | Move in location | INSTORAGESPACE |
| useTime | decimal | N | Labor hours | LABORHOUR |
| useMachineTime | decimal | N | Machine hours | MACHINEHOUR |
| remark | string | N | Remark | NOTE |
| manufactureDualUnit | string | N | Dual unit | TWINUNIT |
| hasQty | string | N | Stock-in status | HASQTY |
| 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 |
| Field | Description |
|---|---|
| ISOK | true=Success, false=Failure |
| Msg | Processing message |
| TB001 | Write to TL011 |
| TB002 | Write to TL012 |
| # | Check Item | Rule | Code Location |
|---|---|---|---|
| 1 | Line data exists | SFT_TRANSORDER_LINE_GRID cannot be empty | TransOrderDataToJson.java:609 |
| 2 | TO013 check | = 1 to send generateTransferForm | TransOrderDataToJson.java:612 |
| 3 | ERP connection | SFTConfig.isHasERP() = true | TransOrderDataToJson.java:646 |
| 4 | TRANSTYPE decision | 59=Outsourcing, others=General transfer | TransOrderDataToJson.java:648 |
| 5 | WO completion check | canUpdateERP_TA_OP_Status100() = true | TransOrderDataToJson.java:637 |
| Code | Message | Description |
|---|---|---|
| E001 | Required field missing | Request missing required fields |
| E002 | Work order not found | MOTYPE-MONO error |
| E003 | 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 stock-in quantity |
| E006 | Warehouse not found | moveInCode invalid |
| E999 | System error | Timeout, connection exception |
| Return result parsing error! | Response parsing failed | XmlToERP_handler.java:117 |
{
"companyID": "COMP01",
"userId": "EMP001",
"doAction": "2", // 2=Transfer
"docase": "1", // 1=Add
"head": {
"transferType": "51",
"date": "2026-03-19",
"moveOutType": "1",
"moveOutCode": "WS001",
"moveOutName": "Assembly Station",
"moveInType": "2",
"moveInCode": "FG01",
"moveInName": "Finished Goods WH",
"factoryCode": "P001",
"remark": "Normal completion stock-in",
"create": "EMP001", // → ERP: operator_no
"eMESTransferType": "51",
"eMESTransferCode": "T20260319001"
},
"line": [{
"moType": "5101",
"moCode": "20260319001",
"moveOutOpSeq": "0030",
"moveOutOpId": "OP030",
"qty": 100,
"unit": "PCS",
"batchCode": "LOT20260319001",
"state": "1",
"prodCode": "FG-A001-001",
"prodName": "Finished Product A",
"moveInCode": "FG01",
"moveInLocation": "A-01-01",
"hasQty": "1", // → ERP: stock_in_status
"remark": ""
}]
}
{
"code": 200,
"msg": "Stock-in order created successfully",
"TB001": "5101",
"TB002": "20260319001"
}
{
"code": 500,
"msg": "Work order not found 5101-20260319999"
}