# Opening Stock

# Fetch Opening Stock List

# 一、Description

​ Usage: Fetch Opening Stock List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes os
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=os&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "os",
    "size": 36,
    "stSearchDisplay": "Opening Stock",
    "values": [
        {
            "mainos.locId.loc.code": "SZO",
            "tDate": "2021-12-13",
            "mainos.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "code": "ITOS21121301",
            "st_code": "ITOS21121301",
            "st_desc": "ITOS21121301",
            "mainos.locId.loc.locTypeId.loctype.desc": "合格",
            "iRev": 4,
            "st_id": 2128,
            "mainos.locId.loc.locTypeId.loctype.code": "PHY",
            "id": 2128,
            "mainos.locId.loc.desc": "深圳仓",
            "lastModifyDate": "2022-01-19 17:32:22"
        }
  	]
}

# Load Opening Stock

# 一、Description

​ Usage: Load 【Opening Stock】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/os
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes os
id long(Query) Yes Opening Stock ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/os";
			String param = "&menuCode=os&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "ost": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "bDesc_zh-TW": "",
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "lotnoLot": "A",
                "id": 12584,
                "dDesc_haha1": "",
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "i18nField": "{\"dDesc_en\": \"<p>Ivan Testing Product(繁体)<br></p>\", \"bDesc_zh-CN\": \"Ivan Testing Product\", \"dDesc_zh-CN\": \"<p>Ivan Testing Product(简体)<br></p>\", \"dDesc_zh-TW\": \"<p>Ivan Testing Product(繁体)<br></p>\"}",
                "sourceType": "pro",
                "costAmt": 0,
                "iRev": 1,
                "bDesc_ctw": "",
                "ce01Module": "os",
                "lot": "B",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": 1257004800000,
                "lotnoDateAttr1": -2245737600000,
                "lotnoDateAttr2": -2561356800000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 24,
                "lotnoDateAttr9": -2209017600000,
                "locId": 7,
                "bDesc_en": "",
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "test",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "bDesc_zh-CN": "Ivan Testing Product",
                "sourceId": 0,
                "dualQty": 0.34,
                "itemNo": "     1",
                "beId": 11,
                "bDesc": "Ivan Testing Product",
                "up": 0,
                "hId": 2129,
                "lotnoNumAttr1": 1,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 3,
                "lotnoNumAttr4": 4,
                "lotnoExpDate": 1902240000000,
                "dDesc": "<p>Ivan Testing Product(简体)<br></p>",
                "footerKey": "     2",
                "qty": 3,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 5136,
                "lotnoTextAttr16": "",
                "dDesc_ctw": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "udfAmt": 0,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "amt": 0,
                "dDesc_zh-CN": "<p>Ivan Testing Product(简体)<br></p>",
                "lotnoTextAttr19": "",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "<p>Ivan Testing Product(繁体)<br></p>",
                "domAmt": 0,
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "dDesc_en": "<p>Ivan Testing Product(繁体)<br></p>",
                "dualUnitId": 6,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "sourceLot": "",
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "ITST21121302",
                "lotnoLookupAttr9": 0,
                "proId": 18,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 35,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 14,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 3,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "mainos": [
            {
                "tDate": 1639324800000,
                "lastModifyUid": 11,
                "code": "ITOS21121302",
                "cnDeptId": 29,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "iRev": 1,
                "sysJson": "",
                "upOrigin": "GRN",
                "viewCode": "os",
                "ce01Module": "os",
                "stlotId": 112,
                "beId": 11,
                "curId": 1,
                "expired": false,
                "rate": 1,
                "printCount": 0,
                "useAccessBl": false,
                "id": 2129,
                "doctypeId": 0,
                "statusModifyDate": 1639370571000,
                "locked": false,
                "lastModifyDate": 1639370571000,
                "createUid": 11,
                "locId": 7,
                "createDate": 1639370571000,
                "rev": "2",
                "lastApproveUid": 11,
                "stId": 0,
                "expiredUid": 0,
                "useAccessWl": false,
                "descOrigin": "GRN",
                "iniDate": 1639324800000,
                "flowTypeId": 1397,
                "useAccessAutoCalc": false,
                "staffId": 723,
                "status": "Y"
            }
        ],
        "remos": [
            {
                "hId": 2129,
                "i18nField": "{\"remarks_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 1,
                "id": 2129,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "stlot"
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Opening Stock

# 一、Description

​ Usage: create or update 【Opening Stock】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/os
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes os
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/os";
		String param = "&menuCode=os";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Entity data as JSON format:

{
    "mainos": {
        "values": [
            {
                "beId": 11,
                "code": "ITOS220324A",
                "tDate": "2022-03-04",
                "locId": 108,
                "curId": 1,
                "rate": 1,
                "flowTypeId": 1397,
                "staffId": 723
            }
        ]
    },
    "ost": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 18,
                "unitId": 24,
                "locId": 108,
                "qty": 10,
                "up": 5
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 2157,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Opening Stock (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Opening Stock】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/os
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/os";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "ost": [
        {
            "proCode": "ITPRO001",
            "unitCode": "个",
            "locCode": "SZO",
            "qty": 1,
            "up": 10
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 2158,
  "tranCode": "OS0220269",
  "message": "",
  "status": true
}

# Delete Opening Stock

# 一、Description

​ Usage: Delete Opening Stock

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/os
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes os
id long(Query) Yes Opening Stock ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/os";
		String param = "&menuCode=os&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Stock Adjustment

# Fetch Stock Adjustment List

# 一、Description

​ Usage: Fetch Stock Adjustment List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes k
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=k&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "k",
    "size": 11,
    "stSearchDisplay": "Stock Adjustment",
    "values": [
        {
            "tDate": "2022-01-01",
            "maink.locId.loc.desc": "深圳仓",
            "code": "ITK20220101A",
            "st_code": "ITK20220101A",
            "maink.locId.loc.code": "SZO",
            "maink.locId.loc.locTypeId.loctype.desc": "合格",
            "st_desc": "ITK20220101A",
            "iRev": 1,
            "maink.locId.loc.locTypeId.loctype.code": "PHY",
            "maink.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "st_id": 178,
            "id": 178,
            "lastModifyDate": "2022-01-07 12:49:33"
        }
  	]
}

# Load Stock Adjustment

# 一、Description

​ Usage: Load 【Stock Adjustment】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/k
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes k
id long(Query) Yes Stock Adjustment ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/k";
			String param = "&menuCode=k&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "remk": [
            {
                "hId": 178,
                "i18nField": "{\"remarks_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 1,
                "id": 178,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "st"
            }
        ],
        "kt": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "bDesc_zh-TW": "",
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "lotnoLot": "A",
                "id": 394,
                "dDesc_haha1": "",
                "sourceItemNo": "",
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "i18nField": "{\"bDesc_zh-CN\": \"auto assign\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "pro",
                "costAmt": 0,
                "iRev": 1,
                "bDesc_ctw": "",
                "ce01Module": "k",
                "lot": "A",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": -2209017600000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 76,
                "lotnoDateAttr9": -2209017600000,
                "locId": 7,
                "bDesc_en": "",
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "bDesc_zh-CN": "auto assign",
                "sourceId": 0,
                "dualQty": 87,
                "itemNo": "     1",
                "beId": 11,
                "bDesc": "auto assign",
                "up": 0,
                "hId": 178,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253402271999000,
                "dDesc": "",
                "footerKey": "     1",
                "qty": -93,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 2281,
                "lotnoTextAttr16": "",
                "dDesc_ctw": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "amt": 0,
                "dDesc_zh-CN": "",
                "lotnoTextAttr19": "",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "domAmt": 0,
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "dDesc_en": "",
                "dualUnitId": 51,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "sourceLot": "",
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "ITOS18110001",
                "lotnoLookupAttr9": 0,
                "proId": 62,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "maink": [
            {
                "tDate": 1640966400000,
                "lastModifyUid": 11,
                "code": "ITK20220101A",
                "cnDeptId": 29,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "iRev": 1,
                "sysJson": "",
                "upOrigin": "GRN",
                "viewCode": "k",
                "ce01Module": "k",
                "stlotId": 0,
                "beId": 11,
                "curId": 1,
                "expired": false,
                "rate": 1,
                "printCount": 0,
                "useAccessBl": false,
                "id": 178,
                "doctypeId": 0,
                "statusModifyDate": 1641530973000,
                "locked": false,
                "lastModifyDate": 1641530973000,
                "createUid": 11,
                "locId": 7,
                "createDate": 1641530973000,
                "moveToId": 0,
                "rev": "2",
                "lastApproveUid": 11,
                "stId": 44,
                "expiredUid": 0,
                "useAccessWl": false,
                "descOrigin": "GRN",
                "moveFoId": 0,
                "flowTypeId": 1397,
                "useAccessAutoCalc": false,
                "staffId": 723,
                "status": "N"
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Stock Adjustment

# 一、Description

​ Usage: create or update 【Stock Adjustment】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/k
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes k
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/k";
		String param = "&menuCode=k";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Entity data as JSON format:

{
    "maink": {
        "values": [
            {
                "beId": 11,
                "code": "ITK220324A",
                "tDate": "2022-03-24",
                "curId": 1,
                "rate": 1,
                "flowTypeId": 1397,
                "staffId": 723
            }
        ]
    },
    "kt": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 18,
                "unitId": 24,
                "qty": -1,
                "locId": 7,
                "newLotno": 0
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 184,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Stock Adjustment (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Stock Adjustment】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/k
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/k";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "kt": [
        {
            "proCode": "ITPRO001",
            "unitCode": "个",
            "qty": -1,
            "locCode": "SZO",
            "newLotno": 0
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 185,
  "tranCode": "K00220053",
  "message": "",
  "status": true
}

# Delete Stock Adjustment

# 一、Description

​ Usage: Delete Stock Adjustment

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/k
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes k
id long(Query) Yes Stock Adjustment ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/k";
		String param = "&menuCode=k&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Internal Transfer

# Fetch Internal Transfer List

# 一、Description

​ Usage: Fetch Internal Transfer List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes move
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=move&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "move",
    "size": 7,
    "stSearchDisplay": "Internal Transfer",
    "values": [
        {
            "mainmove.locId.loc.locTypeId.loctype.code": "PHY",
            "tDate": "2021-09-27",
            "mainmove.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "code": "MOV210052",
            "st_code": "MOV210052",
            "st_desc": "MOV210052",
            "iRev": 4,
            "mainmove.locId.loc.code": "SZO",
            "st_id": 90,
            "mainmove.locId.loc.desc": "深圳仓",
            "id": 90,
            "mainmove.locId.loc.locTypeId.loctype.desc": "合格",
            "lastModifyDate": "2021-09-27 10:15:22"
        }
  	]
}

# Load Internal Transfer

# 一、Description

​ Usage: Load 【Internal Transfer】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/move
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes move
id long(Query) Yes Internal Transfer ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/move";
			String param = "&menuCode=move&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "mainmove": [
            {
                "tDate": 1632672000000,
                "lastModifyUid": 11,
                "code": "MOV210052",
                "cnDeptId": 29,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "iRev": 4,
                "sysJson": "{\"autoGenCode\":{\"snId\":453,\"sn\":\"52\"}}",
                "upOrigin": "",
                "viewCode": "move",
                "poscoreShopTranNoteId": 0,
                "ce01Module": "move",
                "beId": 11,
                "kStatus": "transit",
                "alocId": 122,
                "expired": false,
                "printCount": 0,
                "useAccessBl": false,
                "id": 90,
                "doctypeId": 0,
                "statusModifyDate": 1632708485000,
                "locked": false,
                "lastModifyDate": 1632708922000,
                "createUid": 11,
                "locId": 7,
                "createDate": 1632708485000,
                "rev": "4",
                "lastApproveUid": 0,
                "expiredUid": 0,
                "useAccessWl": false,
                "descOrigin": "PI",
                "flowTypeId": 1397,
                "kDate": 1632672000000,
                "deliveryRequire": false,
                "useAccessAutoCalc": false,
                "staffId": 723,
                "status": "N"
            }
        ],
        "movet": [
            {
                "sourceId": 0,
                "dDesc_ctw": "",
                "dualQty": 1,
                "costAmt": 0,
                "iRev": 4,
                "itemNo": "     1",
                "dDesc_zh-CN": "<p>Ivan Testing Product(繁体)<br></p>",
                "bDesc_ctw": "",
                "ce01Module": "move",
                "beId": 11,
                "lot": "A",
                "alocId": 128,
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "bDesc": "Ivan Testing Product",
                "bDesc_ccn": "",
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "unitId": 38757,
                "dDesc_ccn": "",
                "id": 132,
                "locId": 7,
                "dDesc_haha1": "",
                "hId": 90,
                "bDesc_en": "",
                "dDesc_en": "",
                "dualUnitId": 6,
                "sourceLot": "",
                "dDesc": "<p>Ivan Testing Product(繁体)<br></p>",
                "footerKey": "     1",
                "i18nField": "{\"bDesc_zh-CN\": \"Ivan Testing Product\", \"dDesc_zh-CN\": \"<p>Ivan Testing Product(繁体)<br></p>\"}",
                "sourceType": "pro",
                "proId": 18,
                "qty": 1,
                "deliveryRequire": false,
                "lotNoId": 0,
                "bDesc_zh-CN": "Ivan Testing Product"
            }
        ],
        "remmove": [
            {
                "hId": 90,
                "i18nField": "{}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 4,
                "id": 78,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "move"
            }
        ],
        "movetlot": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "alocId": 128,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "lotnoLot": "A",
                "id": 19,
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "iRev": 4,
                "ce01Module": "move",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": -2209017600000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 38757,
                "lotnoDateAttr9": -2209017600000,
                "locId": 7,
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "dualQty": 1,
                "itemNo": "     1",
                "hId": 90,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253402271999000,
                "footerKey": "     1",
                "qty": 1,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 642,
                "lotnoTextAttr16": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "lotnoTextAttr19": "",
                "lotnoTextAttr10": "",
                "dualUnitId": 6,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "ITGRN17020001A",
                "lotnoLookupAttr9": 0,
                "proId": 18,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Internal Transfer

# 一、Description

​ Usage: create or update 【Internal Transfer】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/move
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes move
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/move";
		String param = "&menuCode=move";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

{
    "mainmove": {
        "values": [
            {
                "beId": 11,
                "code": "ITMOVE220324A",
                "tDate": "2022-03-24",
                "locId": 7,
                "alocId": 122,
                "flowTypeId": 1397,
                "staffId": 723
            }
        ]
    },
    "movet": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 18,
                "unitId": 24,
                "qty": 1,
                "locId": 7,
                "alocId": 122
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 91,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Internal Transfer (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Internal Transfer】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ b. If field staff has no value specified, the default staff in the User Options will be used automatically

​ c. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ d. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/move
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/move";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "movet": [
        {
            "proCode": "ITPRO001",
            "unitCode": "个",
            "qty": 1,
            "locCode": "SZO",
            "alocCode": "961"
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 92,
  "tranCode": "MOV220053",
  "message": "",
  "status": true
}

# Delete Internal Transfer

# 一、Description

​ Usage: Delete Internal Transfer

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/move
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes move
id long(Query) Yes Internal Transfer ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/move";
		String param = "&menuCode=move&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Defective Stock Register

# Fetch Defective Stock Register List

# 一、Description

​ Usage: Fetch Defective Stock Register List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes defstkreg
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=defstkreg&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "defstkreg",
    "size": 5,
    "stSearchDisplay": "Defective Stock Register",
    "values": [
        {
            "code": "ITDSR001",
            "tDate": "2018-01-10",
            "maindefstkreg.flowTypeId.flowtype.code": "EXSTK-QC",
            "maindefstkreg.flowTypeId.flowtype.desc": "EXSTK -> QC",
            "iRev": 7,
            "lastModifyDate": "2018-01-12 12:52:53",
            "maindefstkreg.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 2,
            "st_desc": "ITDSR001",
            "st_id": 2,
            "st_code": "ITDSR001"
        }
  	]
}

# Load Defective Stock Register

# 一、Description

​ Usage: Load 【Defective Stock Register】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/defstkreg
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes defstkreg
id long(Query) Yes Defective Stock Register ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/defstkreg";
			String param = "&menuCode=defstkreg&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "maindefstkreg": [
            {
                "tDate": 1515513600000,
                "lastModifyUid": 11,
                "code": "ITDSR001",
                "cnDeptId": 29,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "iRev": 7,
                "sysJson": "",
                "upOrigin": "",
                "viewCode": "defstkreg",
                "ce01Module": "defstkreg",
                "beId": 11,
                "alocId": 2,
                "expired": false,
                "printCount": 0,
                "useAccessBl": false,
                "id": 2,
                "doctypeId": 0,
                "statusModifyDate": 1515570951000,
                "locked": false,
                "lastModifyDate": 1515732773000,
                "createUid": 11,
                "locId": 15,
                "createDate": 1515570951000,
                "rev": "5",
                "lastApproveUid": 0,
                "expiredUid": 0,
                "useAccessWl": false,
                "descOrigin": "",
                "flowTypeId": 15459,
                "useAccessAutoCalc": false,
                "staffId": 723,
                "status": "Y"
            }
        ],
        "defstkregt": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "alocId": 2,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "bDesc_zh-TW": "",
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "lotnoLot": "A",
                "id": 2,
                "dDesc_haha1": "",
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "i18nField": "{\"bDesc_en\": \"Ivan Testing Product\", \"dDesc_en\": \"\"}",
                "sourceType": "qc",
                "costAmt": 0,
                "iRev": 5,
                "bDesc_ctw": "",
                "ce01Module": "defstkreg",
                "lot": "A",
                "lotnoDateAttr3": 1475164800000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": 1474300800000,
                "lotnoDateAttr2": 1475078400000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 38757,
                "lotnoDateAttr9": -2209017600000,
                "locId": 7,
                "bDesc_en": "Ivan Testing Product",
                "lotnoTextAttr1": "INC",
                "lotnoTextAttr2": "TT",
                "lotnoTextAttr3": "BB",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "bDesc_zh-CN": "",
                "sourceId": 3,
                "dualQty": 0,
                "itemNo": "     1",
                "beId": 11,
                "bDesc": "Ivan Testing Product",
                "hId": 2,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 1546185600000,
                "dDesc": "",
                "footerKey": "",
                "qty": 0.1,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 282,
                "lotnoTextAttr16": "",
                "dDesc_ctw": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "dDesc_zh-CN": "",
                "lotnoTextAttr19": "",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "dDesc_en": "",
                "dualUnitId": 6,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "sourceLot": "01",
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "OS0160040-01INC20160930",
                "lotnoLookupAttr9": 0,
                "proId": 18,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "remdefstkreg": [
            {
                "hId": 2,
                "i18nField": "",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 7,
                "id": 6,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "defstkreg"
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Defective Stock Register

# 一、Description

​ Usage: create or update 【Defective Stock Register】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/defstkreg
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes defstkreg
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/defstkreg";
		String param = "&menuCode=defstkreg";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

{
    "maindefstkreg": {
        "values": [
            {
                "beId": 11,
                "code": "ITDSR220325A",
                "tDate": "2022-03-25",
                "flowTypeId": 1397,
                "staffId": 723
            }
        ]
    },
    "defstkregt": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 18,
                "locId": 7,
                "alocId": 2,
                "unitId": 24,
                "qty": 1
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 15,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Defective Stock Register (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Defective Stock Register】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ b. If field staff has no value specified, the default staff in the User Options will be used automatically

​ c. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ d. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/defstkreg
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/defstkreg";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "defstkregt": [
        {
            "proCode": "ITPRO001",
            "unitCode": "个",
            "qty": 1,
            "locCode": "SZO",
            "alocCode": "BAD"
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 16,
  "tranCode": "DEF220001",
  "message": "",
  "status": true
}

# Delete Defective Stock Register

# 一、Description

​ Usage: Delete Defective Stock Register

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/defstkreg
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes defstkreg
id long(Query) Yes Defective Stock Register ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/defstkreg";
		String param = "&menuCode=defstkreg&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Defective Stock Register Report

# 一、Description

​ Usage: Run EBI[Defective Stock Register Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 8,
    "rows": [
        {
            "FTABLE_A_locId_code": "SZO",
            "MAIN_outQty": "0.00000000",
            "MAIN_ruQty": "0.00000000",
            "FTABLE_A_bDesc": "Ivan Testing Product",
            "M18ReservedCol_dataIndex": 1,
            "FTABLE_A_proId": "18",
            "FTABLE_A_unitId_code": "0.3兩",
            "FTABLE_A_qty": "0.10000000",
            "MTABLE_A_tDate": "2018.01.10",
            "MTABLE_A_code": "ITDSR001",
            "MTABLE_A_id": "2",
            "FTABLE_A_alocId_code": "BAD",
            "MAIN_dstnQty": "0.10000000",
            "FTABLE_A_alocId": "2",
            "FTABLE_A_locId": "7",
            "FTABLE_A_proId_code": "ITPRO001"
        }
    ]
}

ebi1

# Defect Stock Write Off

# Fetch Defect Stock Write Off List

# 一、Description

​ Usage: Fetch Defect Stock Write Off List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes dstn
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=dstn&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "dstn",
    "size": 3,
    "stSearchDisplay": "Defective Stock Write Off",
    "values": [
        {
            "code": "ITDSTN001",
            "tDate": "2018-01-11",
            "maindstn.flowTypeId.flowtype.code": "EXSTK-QC",
            "maindstn.flowTypeId.flowtype.desc": "EXSTK -> QC",
            "iRev": 3,
            "lastModifyDate": "2020-11-10 12:30:36",
            "maindstn.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 1,
            "st_desc": "ITDSTN001",
            "st_id": 1,
            "st_code": "ITDSTN001"
        }
  	]
}

# Load Defect Stock Write Off

# 一、Description

​ Usage: Load 【Defect Stock Write Off】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/dstn
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes dstn
id long(Query) Yes Defect Stock Write Off ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/dstn";
			String param = "&menuCode=dstn&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "maindstn": [
            {
                "tDate": 1515600000000,
                "lastModifyUid": 11,
                "code": "ITDSTN001",
                "cnDeptId": 29,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "iRev": 3,
                "sysJson": "",
                "upOrigin": "PRO",
                "viewCode": "dstn",
                "ce01Module": "dstn",
                "beId": 11,
                "expired": false,
                "printCount": 0,
                "useAccessBl": false,
                "id": 1,
                "doctypeId": 0,
                "statusModifyDate": 1515662355000,
                "locked": false,
                "lastModifyDate": 1604982636000,
                "createUid": 11,
                "locId": 2,
                "createDate": 1515662355000,
                "rev": "3",
                "lastApproveUid": 0,
                "expiredUid": 0,
                "useAccessWl": false,
                "descOrigin": "PRO",
                "flowTypeId": 15459,
                "useAccessAutoCalc": false,
                "staffId": 723,
                "status": "Y"
            }
        ],
        "dstnt": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "bDesc_zh-TW": "",
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "lotnoLot": "A",
                "id": 1,
                "dDesc_haha1": "",
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "i18nField": "{\"bDesc_en\": \"Ivan Testing Product\", \"dDesc_en\": \"\"}",
                "sourceType": "defstkreg",
                "costAmt": 0,
                "iRev": 3,
                "bDesc_ctw": "",
                "ce01Module": "dstn",
                "lot": "A",
                "lotnoDateAttr3": 1475164800000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": 1474300800000,
                "lotnoDateAttr2": 1475078400000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 38757,
                "lotnoDateAttr9": -2209017600000,
                "locId": 2,
                "bDesc_en": "Ivan Testing Product",
                "lotnoTextAttr1": "INC",
                "lotnoTextAttr2": "TT",
                "lotnoTextAttr3": "BB",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "bDesc_zh-CN": "",
                "sourceId": 2,
                "dualQty": 0,
                "itemNo": "     1",
                "beId": 11,
                "bDesc": "Ivan Testing Product",
                "hId": 1,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 1546185600000,
                "dDesc": "",
                "footerKey": "",
                "qty": 0.1,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 282,
                "lotnoTextAttr16": "",
                "dDesc_ctw": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "dDesc_zh-CN": "",
                "lotnoTextAttr19": "",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "dDesc_en": "",
                "dualUnitId": 6,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "sourceLot": "A",
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "OS0160040-01INC20160930",
                "lotnoLookupAttr9": 0,
                "proId": 18,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "remdstn": [
            {
                "hId": 1,
                "i18nField": "{\"remarks_en\": \"<p>test la</p>\"}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "<p>test la</p>",
                "remarks_haha1": "",
                "iRev": 3,
                "id": 7,
                "remarks_zh-TW": "",
                "remarks": "<p>test la</p>",
                "remarks_ctw": "",
                "ce01Module": "dstn"
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Defect Stock Write Off

# 一、Description

​ Usage: create or update 【Defect Stock Write Off】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/dstn
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes dstn
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/dstn";
		String param = "&menuCode=dstn";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

 {
    "maindstn": {
        "values": [
            {
                "beId": 11,
                "code": "ITDSTN220325A",
                "tDate": "2022-03-25",
                "flowTypeId": 1397,
                "staffId": 723
            }
        ]
    },
    "dstnt": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 18,
                "locId": 2,
                "unitId": 24,
                "qty": 1
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 10,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Defect Stock Write Off (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Defect Stock Write Off】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ b. If field staff has no value specified, the default staff in the User Options will be used automatically

​ c. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ d. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/dstn
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/dstn";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "dstnt": [
        {
            "proCode": "ITPRO001",
            "unitCode": "个",
            "locCode": "BAD",
            "qty": 1
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 11,
  "tranCode": "DST220001",
  "message": "",
  "status": true
}

# Delete Defect Stock Write Off

# 一、Description

​ Usage: Delete Defect Stock Write Off

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/dstn
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes dstn
id long(Query) Yes Defect Stock Write Off ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/dstn";
		String param = "&menuCode=dstn&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Defect Stock Write Off Report

# 一、Description

​ Usage: Run EBI[Defect Stock Write Off Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 5,
    "rows": [
        {
            "FTABLE_A_locId_code": "BAD",
            "M18ReservedCol_dataIndex": 1,
            "FTABLE_A_proId": "18",
            "FTABLE_A_unitId_code": "0.3兩",
            "MAIN_sourceId": "2",
            "MAIN_sourceCode": "ITDSR001",
            "FTABLE_A_qty": "0.10000000",
            "MTABLE_A_tDate": "2018.01.11",
            "LOTNO_A_lotno": "OS0160040-01INC20160930",
            "MAIN_sourceType": "defstkreg",
            "MTABLE_A_code": "ITDSTN001",
            "MTABLE_A_id": "1",
            "MAIN_lotQty": "0.10000000",
            "FTABLE_A_sourceType": "Defective Stock Register",
            "FTABLE_A_locId": "2",
            "FTABLE_A_proId_code": "ITPRO001"
        }
    ]
}

ebi1

# Defect Stock Recover

# Fetch Defect Stock Recover List

# 一、Description

​ Usage: Fetch Defect Stock Recover List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes ru
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=ru&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "ru",
    "size": 2,
    "stSearchDisplay": "Defective Stock Recover",
    "values": [
        {
            "code": "ITRU001",
            "tDate": "2018-01-12",
            "mainru.flowTypeId.flowtype.code": "QC-ALL",
            "mainru.flowTypeId.flowtype.desc": "QC-ALL",
            "iRev": 5,
            "lastModifyDate": "2019-01-14 15:48:28",
            "mainru.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 1,
            "st_desc": "ITRU001",
            "st_id": 1,
            "st_code": "ITRU001"
        }
  	]
}

# Load Defect Stock Recover

# 一、Description

​ Usage: Load 【Defect Stock Recover】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/ru
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes ru
id long(Query) Yes Defect Stock Recover ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/ru";
			String param = "&menuCode=ru&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "rut": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "alocId": 7,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "bDesc_zh-TW": "",
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "lotnoLot": "A",
                "id": 17,
                "dDesc_haha1": "",
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "i18nField": "{\"bDesc_en\": \"Ivan Testing Product\", \"dDesc_en\": \"<p>Ivan Testing Product(繁体)<br></p>\"}",
                "sourceType": "defstkreg",
                "costAmt": 0,
                "iRev": 1,
                "bDesc_ctw": "",
                "ce01Module": "ru",
                "lot": "A",
                "lotnoDateAttr3": 1475164800000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": 1474300800000,
                "lotnoDateAttr2": 1475078400000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 24,
                "lotnoDateAttr9": -2209017600000,
                "locId": 2,
                "bDesc_en": "Ivan Testing Product",
                "lotnoTextAttr1": "INC",
                "lotnoTextAttr2": "TT",
                "lotnoTextAttr3": "BB",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "bDesc_zh-CN": "",
                "sourceId": 14,
                "dualQty": 0.33,
                "itemNo": "     1",
                "beId": 11,
                "bDesc": "Ivan Testing Product",
                "hId": 14,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 1546185600000,
                "dDesc": "<p>Ivan Testing Product(繁体)<br></p>",
                "footerKey": "     1",
                "qty": 1,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 282,
                "lotnoTextAttr16": "",
                "dDesc_ctw": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "dDesc_zh-CN": "",
                "lotnoTextAttr19": "",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "dDesc_en": "<p>Ivan Testing Product(繁体)<br></p>",
                "dualUnitId": 6,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "sourceLot": "A",
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "OS0160040-01INC20160930",
                "lotnoLookupAttr9": 0,
                "proId": 18,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "mainru": [
            {
                "tDate": 1603296000000,
                "lastModifyUid": 11,
                "code": "ITRU002",
                "cnDeptId": 29,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "iRev": 1,
                "sysJson": "",
                "upOrigin": "PRO",
                "viewCode": "ru",
                "ce01Module": "ru",
                "beId": 11,
                "alocId": 7,
                "expired": false,
                "printCount": 0,
                "useAccessBl": false,
                "id": 14,
                "doctypeId": 0,
                "statusModifyDate": 1603334218000,
                "locked": false,
                "lastModifyDate": 1603334218000,
                "createUid": 11,
                "locId": 2,
                "createDate": 1603334218000,
                "rev": "1",
                "lastApproveUid": 11,
                "expiredUid": 0,
                "useAccessWl": false,
                "descOrigin": "PRO",
                "flowTypeId": 15458,
                "useAccessAutoCalc": false,
                "staffId": 723,
                "status": "Y"
            }
        ],
        "remru": [
            {
                "hId": 14,
                "i18nField": "{\"remarks_en\": \"\"}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 1,
                "id": 2,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "ru"
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Defect Stock Recover

# 一、Description

​ Usage: create or update 【Defect Stock Recover】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/ru
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes ru
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/ru";
		String param = "&menuCode=ru";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

{
    "mainru": {
        "values": [
            {
                "beId": 11,
                "code": "ITRU220328A",
                "tDate": "2022-03-28",
                "flowTypeId": 15458,
                "staffId": 723
            }
        ]
    },
    "rut": {
        "values": [
            {
                "sourceType": "defstkreg",
                "sourceId": 14,
                "sourceLot": "A",
                "proId": 26,
                "unitId": 40,
                "qty": 1,
                "locId": 2,
                "alocId": 7
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 15,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Defect Stock Recover (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Defect Stock Recover】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ b. If field staff has no value specified, the default staff in the User Options will be used automatically

​ c. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ d. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/pi
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/ru";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "rut": [
        {
            "sourceType": "defstkreg",
            "sourceCode": "ITDSR005",
            "sourceLot": "A",
            "locCode": "BAD",
            "alocCode": "SZO",
            "proCode": "ITPRO001",
            "unitCode": "个",
            "qty": 1
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 16,
  "tranCode": "RU0220001",
  "message": "",
  "status": true
}

# Delete Defect Stock Recover

# 一、Description

​ Usage: Delete Defect Stock Recover

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/ru
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes ru
id long(Query) Yes Defect Stock Recover ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/ru";
		String param = "&menuCode=ru&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Defect Stock Recover Report

# 一、Description

​ Usage: Run EBI[Defect Stock Recover Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 5,
    "rows": [
        {
            "FTABLE_A_locId_code": "BAD",
            "M18ReservedCol_dataIndex": 1,
            "FTABLE_A_unitId_code": "0.3兩",
            "MAIN_sourceId": "3",
            "MAIN_sourceCode": "ITDSR002",
            "FTABLE_A_qty": "0.20000000",
            "MTABLE_A_tDate": "2018.01.12",
            "PRO_A_id": "18",
            "MAIN_sourceType": "defstkreg",
            "MTABLE_A_code": "ITRU001",
            "MTABLE_A_id": "1",
            "FTABLE_A_alocId_code": "ACLL",
            "FTABLE_A_alocId": "15",
            "FTABLE_A_sourceType": "Defective Stock Register",
            "FTABLE_A_locId": "2",
            "PRO_A_code": "ITPRO001"
        }
    ]
}

ebi1

# Stock Take (w/o Lot No.)

# Fetch Stock Take (w/o Lot No.) List

# 一、Description

​ Usage: Fetch Stock Take (w/o Lot No.) List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes st
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=st&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "st",
    "size": 3,
    "stSearchDisplay": "Stock Take (w/o Lot No.)",
    "values": [
        {
            "code": "ITST20220101A",
            "tDate": "2022-01-01",
            "mainst.locId.loc.code": "SZO",
            "mainst.locId.loc.desc": "深圳仓",
            "mainst.locId.loc.locTypeId.loctype.code": "PHY",
            "mainst.locId.loc.locTypeId.loctype.desc": "合格",
            "iRev": 1,
            "lastModifyDate": "2022-01-07 12:27:30",
            "mainst.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 44,
            "st_desc": "ITST20220101A",
            "st_id": 44,
            "st_code": "ITST20220101A"
        }
  	]
}

# Load Stock Take (w/o Lot No.)

# 一、Description

​ Usage: Load 【Stock Take (w/o Lot No.)】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/st
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes st
id long(Query) Yes Stock Take (w/o Lot No.) ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/st";
			String param = "&menuCode=st&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "mainst": [
            {
                "tDate": 1640966400000,
                "lastModifyUid": 11,
                "code": "ITST20220101A",
                "cnDeptId": 29,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "iRev": 1,
                "sysJson": "",
                "upOrigin": "GRN",
                "viewCode": "st",
                "ce01Module": "st",
                "beId": 11,
                "curId": 1,
                "expired": false,
                "rate": 1,
                "printCount": 0,
                "useAccessBl": false,
                "id": 44,
                "doctypeId": 0,
                "statusModifyDate": 1641529650000,
                "locked": false,
                "lastModifyDate": 1641529650000,
                "createUid": 11,
                "locId": 7,
                "createDate": 1641529650000,
                "rev": "1",
                "lastApproveUid": 11,
                "expiredUid": 0,
                "useAccessWl": false,
                "descOrigin": "GRN",
                "flowTypeId": 1397,
                "useAccessAutoCalc": false,
                "staffId": 723,
                "status": "Y"
            }
        ],
        "stt": [
            {
                "sourceId": 0,
                "dDesc_ctw": "",
                "qtyPhy": 193,
                "dualQty": -93,
                "costAmt": 0,
                "iRev": 1,
                "stkUnitQty": -93,
                "itemNo": "     1",
                "dDesc_zh-CN": "",
                "bDesc_ctw": "",
                "ce01Module": "st",
                "beId": 11,
                "lot": "A",
                "stkUnitPhy": 193,
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "bDesc": "auto assign",
                "bDesc_ccn": "",
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "dualQtyCount": -93,
                "unitId": 76,
                "dDesc_ccn": "",
                "id": 48,
                "up": 0,
                "genType": "K",
                "qtyCountBasic": 100,
                "locId": 7,
                "dDesc_haha1": "",
                "hId": 44,
                "bDesc_en": "",
                "unitCount": 76,
                "dDesc_en": "",
                "dualUnitId": 51,
                "qtyCount": 100,
                "sourceLot": "",
                "dDesc": "",
                "footerKey": "     1",
                "i18nField": "{\"bDesc_zh-CN\": \"auto assign\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "pro",
                "proId": 62,
                "qty": -93,
                "dualPhy": 0,
                "lotNoId": 0,
                "bDesc_zh-CN": "auto assign"
            }
        ],
        "remst": [
            {
                "hId": 44,
                "i18nField": "{\"remarks_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 1,
                "id": 40,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "st"
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Stock Take (w/o Lot No.)

# 一、Description

​ Usage: create or update 【Stock Take (w/o Lot No.)】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/st
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes st
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/st";
		String param = "&menuCode=st";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Entity data as JSON format:

{
    "mainst": {
        "values": [
            {
                "beId": 11,
                "code": "ITST220324A",
                "tDate": "2022-03-24",
                "curId": 1,
                "rate": 1,
                "flowTypeId": 1397,
                "staffId": 723
            }
        ]
    },
    "stt": {
        "values": [
            {
                "sourceType": "pro",
                "locId": 7,
                "proId": 26,
                "unitId": 40,
                "qty": 50,
                "qtyPhy": 4900,
                "qtyCountBasic": 4950,
                "unitCount": 40,
                "stkUnitQty": 50,
                "stkUnitPhy": 4900,
                "qtyCount": 4950
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 48,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Stock Take (w/o Lot No.) (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Stock Take (w/o Lot No.)】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/st
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/st";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "pot": [
        {
            "proCode": "ITPRO002",
            "unitCode": "PCS",
            "unitCount": 40,
            "locCode": "SZO",
            "qty": 50,
            "qtyPhy": 4900,
            "qtyCountBasic": 4950,
            "stkUnitQty": 50,
            "stkUnitPhy": 4900,
            "qtyCount": 4950
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 51,
  "tranCode": "ST0220008",
  "message": "",
  "status": true
}

# Delete Stock Take (w/o Lot No.)

# 一、Description

​ Usage: Delete Stock Take (w/o Lot No.)

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/st
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes st
id long(Query) Yes Stock Take (w/o Lot No.) ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/st";
		String param = "&menuCode=st&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Stock Take (w/o Lot No.) Report

# 一、Description

​ Usage: Run EBI[Stock Take (w/o Lot No.) Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 5,
    "rows": [
        {
            "MAIN_kCode": "ITK21121304",
            "F_A_qtyCount": "2.00000000",
            "M_A_code": "ITST21070001",
            "M18ReservedCol_dataIndex": 1,
            "F_A_qtyPhy": "9.00000000",
            "MAIN_osCode": "",
            "M_A_tDate": "2021.07.15",
            "MAIN_sourceTypeMess": "Product / Material",
            "PRO_A_id": "40",
            "F_A_qty": "-7.00000000",
            "MAIN_osId": "0",
            "M_A_id": "41",
            "F_A_unitId_code": "PCS",
            "MAIN_kId": "174",
            "PRO_A_code": "ITPRO003"
        }
    ]
}

ebi1

# Stock Take

# Fetch Stock Take List

# 一、Description

​ Usage: Fetch Stock Take List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes stlot
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=stlot&beId=11";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "stlot",
    "size": 13,
    "stSearchDisplay": "Stock Take",
    "values": [
        {
            "code": "ITSTLOT008",
            "tDate": "2022-01-01",
            "mainstlot.locId.loc.code": "SZO",
            "mainstlot.locId.loc.desc": "深圳仓",
            "mainstlot.locId.loc.locTypeId.loctype.code": "PHY",
            "mainstlot.locId.loc.locTypeId.loctype.desc": "合格",
            "iRev": 1,
            "lastModifyDate": "2022-01-07 12:22:44",
            "mainstlot.lastModifyUid.simpleUser.desc__lang": "Ivan Tan",
            "id": 114,
            "st_desc": "ITSTLOT008",
            "st_id": 114,
            "st_code": "ITSTLOT008"
        }
  	]
}

# Load Stock Take

# 一、Description

​ Usage: Load 【Stock Take】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/stlot
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes stlot
id long(Query) Yes Stock Take ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/stlot";
			String param = "&menuCode=stlot&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "remstlot": [
            {
                "hId": 114,
                "i18nField": "{\"remarks_zh-CN\": \"\"}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 1,
                "id": 114,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "stlot"
            }
        ],
        "mainstlot": [
            {
                "tDate": 1640966400000,
                "lastModifyUid": 11,
                "code": "ITSTLOT008",
                "cnDeptId": 29,
                "useAccess": false,
                "virDeptId": 0,
                "expiredDate": -2209017600000,
                "iRev": 1,
                "sysJson": "",
                "upOrigin": "GRN",
                "viewCode": "stlot",
                "ce01Module": "stlot",
                "beId": 11,
                "curId": 1,
                "expired": false,
                "rate": 1,
                "printCount": 0,
                "useAccessBl": false,
                "id": 114,
                "doctypeId": 0,
                "statusModifyDate": 1641529364000,
                "locked": false,
                "lastModifyDate": 1641529364000,
                "createUid": 11,
                "locId": 7,
                "createDate": 1641529364000,
                "rev": "1",
                "lastApproveUid": 11,
                "expiredUid": 0,
                "useAccessWl": false,
                "descOrigin": "GRN",
                "flowTypeId": 1397,
                "useAccessAutoCalc": false,
                "staffId": 723,
                "status": "Y"
            }
        ],
        "stlott": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "lotnoLookupAttr19": 0,
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "dualQtyCount": -20,
                "lotnoLot": "A",
                "id": 180,
                "dDesc_haha1": "",
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "qtyScan": 0,
                "i18nField": "{\"bDesc_zh-CN\": \"auto assign\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "pro",
                "costAmt": 0,
                "iRev": 1,
                "stkUnitQty": -20,
                "bDesc_ctw": "",
                "ce01Module": "stlot",
                "lot": "A",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": -2209017600000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "lotnoDateAttr5": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr6": -2209017600000,
                "unitId": 76,
                "lotnoDateAttr9": -2209017600000,
                "qtyCountBasic": 80,
                "locId": 7,
                "bDesc_en": "",
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "dualPhy": 0,
                "bDesc_zh-CN": "auto assign",
                "sourceId": 0,
                "qtyPhy": 100,
                "dualQty": -20,
                "itemNo": "     1",
                "beId": 11,
                "stkUnitPhy": 100,
                "bDesc": "auto assign",
                "up": 0,
                "genType": "K",
                "hId": 114,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "unitCount": 76,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253402271999000,
                "dDesc": "",
                "footerKey": "     1",
                "qty": -20,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 2281,
                "lotnoTextAttr16": "",
                "lotnoTextAttr15": "",
                "dDesc_ctw": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "dDesc_zh-CN": "",
                "lotnoTextAttr19": "",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "dDesc_en": "",
                "dualUnitId": 51,
                "qtyCount": 80,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "sourceLot": "",
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotno": "ITOS18110001",
                "lotnoLookupAttr9": 0,
                "proId": 62,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoDateAttr11": -2209017600000,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr15": -2209017600000,
                "lotnoLookupAttr4": 0
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Stock Take

# 一、Description

​ Usage: create or update 【Stock Take】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/stlot
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes stlot
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/stlot";
		String param = "&menuCode=stlot";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Entity data as JSON format:

{
    "mainstlot": {
        "values": [
            {
                "beId": 11,
                "code": "ITSTLOT220324A",
                "tDate": "2022-03-24",
                "curId": 1,
                "rate": 1,
                "flowTypeId": 1397,
                "staffId": 723
            }
        ]
    },
    "stlott": {
        "values": [
            {
                "sourceType": "pro",
                "locId": 7,
                "proId": 26,
                "lotNoId": 1087,
                "unitId": 40,
                "qty": -1,
                "qtyPhy": 10,
                "qtyCountBasic": 9,
                "unitCount": 40,
                "stkUnitQty": -1,
                "stkUnitPhy": 10,
                "qtyCount": 9
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 116,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Stock Take (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Stock Take】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/stlot
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/stlot";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "stlott": [
        {
            "proCode": "ITPRO002",
            "unitCode": "PCS",
            "unitCount": 40,
            "locCode": "SZO",
            "lotno": "ITAN17050002-0001",
            "qty": -1,
            "qtyPhy": 10,
            "qtyCountBasic": 9,
            "stkUnitQty": -1,
            "stkUnitPhy": 10,
            "qtyCount": 9
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 117,
  "tranCode": "STL220016",
  "message": "",
  "status": true
}

# Delete Stock Take

# 一、Description

​ Usage: Delete Stock Take

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/stlot
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes stlot
id long(Query) Yes Stock Take ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/stlot";
		String param = "&menuCode=stlot&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Stock Take Report

# 一、Description

​ Usage: Run EBI[Stock Take Report],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
  "size": 23,
    "rows": [
        {
            "F_A_qtyCount": "9.00000000",
            "M_A_code": "STL220016",
            "M18ReservedCol_dataIndex": 1,
            "F_A_locId_code": "SZO",
            "F_A_stkUnitPhy": "10.00000000",
            "M_A_tDate": "2022.04.07",
            "PRO_A_id": "26",
            "LOTNO_A_lotno": "ITAN17050002-0001",
            "M_A_id": "117",
            "F_A_locId": "7",
            "F_A_unitCount_code": "PCS",
            "PRO_A_code": "ITPRO002",
            "F_A_stkUnitQty": "-1.00000000"
        }
  	]
}

ebi1

# Product Assembly

# Fetch Product Assembly List

# 一、Description

​ Usage: Fetch Product Assembly List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes asb
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=asb&beId=133";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "asb",
    "size": 2,
    "stSearchDisplay": "Product Assembly",
    "values": [
        {
            "code": "ASB20200023",
            "tDate": "2020-06-16",
            "mainasb.locId.loc.code": "961",
            "mainasb.locId.loc.desc": "961之倉",
            "mainasb.locId.loc.locTypeId.loctype.code": "loctype-reg961",
            "mainasb.locId.loc.locTypeId.loctype.desc": "961型",
            "iRev": 24,
            "lastModifyDate": "2020-06-18 12:15:32",
            "mainasb.lastModifyUid.simpleUser.desc__lang": "Milk",
            "id": 96,
            "st_desc": "ASB20200023",
            "st_id": 96,
            "st_code": "ASB20200023"
        }
  	]
}

# Load Product Assembly

# 一、Description

​ Usage: Load 【Product Assembly】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/asb
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes asb
id long(Query) Yes Product Assembly ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/asb";
			String param = "&menuCode=asb&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "asbbompt": [
            {
                "sourceId": 0,
                "hId": 84,
                "pproId": 7,
                "iRev": 1,
                "processDesc": "倒膜",
                "itemNo": "     1",
                "uc": 22,
                "ce01Module": "asb",
                "sourceLot": "",
                "pc": 0,
                "footerKey": "     1",
                "hour": 0,
                "pLot": "A",
                "processId": 2,
                "sourceType": "pro",
                "ndFooterKey": "     1",
                "id": 122,
                "timeUnit": "hh",
                "costUnitPer": "cu"
            }
        ],
        "asbbomt": [
            {
                "sourceId": 0,
                "dDesc_ctw": "",
                "dualQty": 0,
                "pproId": 7,
                "iRev": 1,
                "itemNo": "     1",
                "dDesc_zh-CN": "",
                "qtyNeed": 1,
                "uc": 0,
                "bDesc_ctw": "",
                "ce01Module": "asb",
                "lot": "A",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "fdFooterKey": "     1",
                "processId": 2,
                "bDesc": "准确成本法测试",
                "bDesc_ccn": "",
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "rdFooterKey": "",
                "unitId": 39616,
                "refdest": "",
                "dDesc_ccn": "",
                "id": 205,
                "matcatId": 0,
                "locId": 1,
                "dDesc_haha1": "",
                "hId": 84,
                "bDesc_en": "",
                "matUc": 0,
                "dDesc_en": "",
                "dualUnitId": 4403,
                "sourceLot": "",
                "footerKey": "     1",
                "dDesc": "",
                "i18nField": "",
                "pLot": "A",
                "sourceType": "pro",
                "proId": 4547,
                "ndFooterKey": "     1",
                "remarks": "",
                "lotNoId": 0,
                "bDesc_zh-CN": "准确成本法测试"
            }
        ],
        "asbtlot": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "lotnoLookupAttr19": 0,
                "newLotno": 1,
                "lotnoLot": "A",
                "id": 105,
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "iRev": 1,
                "ce01Module": "asb",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": -2209017600000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 39,
                "lotnoDateAttr9": -2209017600000,
                "locId": 1,
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "dualQty": 0,
                "itemNo": "",
                "hId": 84,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253402271999000,
                "footerKey": "     1",
                "qty": 1,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 3614,
                "lotnoTextAttr16": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "lotnoTextAttr19": "",
                "lotnoTextAttr10": "",
                "dualUnitId": 16,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "ASB20190010001",
                "lotnoLookupAttr9": 0,
                "proId": 7,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "asbt": [
            {
                "sourceId": 0,
                "dDesc_ctw": "",
                "dualQty": 0,
                "costAmt": 0,
                "iRev": 1,
                "itemNo": "     1",
                "dDesc_zh-CN": "",
                "uc": 0,
                "bDesc_ctw": "",
                "ce01Module": "asb",
                "beId": 133,
                "lot": "A",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "bDesc": "Product Brief Description(Monthly)",
                "bDesc_ccn": "",
                "bDesc_zh-TW": "",
                "newLotno": 0,
                "unitId": 39,
                "dDesc_ccn": "",
                "id": 95,
                "locId": 1,
                "dDesc_haha1": "",
                "hId": 84,
                "bDesc_en": "Product Brief Description(Monthly)",
                "matUc": 0,
                "dDesc_en": "Product Detailed Description",
                "dualUnitId": 16,
                "sourceLot": "",
                "pc": 0,
                "dDesc": "Product Detailed Description",
                "footerKey": "     1",
                "i18nField": "{\"bDesc_en\": \"Product Brief Description(Monthly)\", \"dDesc_en\": \"Product Detailed Description\", \"bDesc_zh-CN\": \"Product Brief Description(Monthly)\"}",
                "sourceType": "pro",
                "proId": 7,
                "qty": 1,
                "cuspono": "",
                "lotNoId": 0,
                "bDesc_zh-CN": "Product Brief Description(Monthly)"
            }
        ],
        "asbbomtlot": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "lotnoLot": "A",
                "id": 276,
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "iRev": 1,
                "ce01Module": "asb",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": -2209017600000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 39616,
                "lotnoDateAttr9": -2209017600000,
                "locId": 1,
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "dualQty": 0,
                "itemNo": "     1",
                "hId": 84,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253402271999000,
                "footerKey": "     1",
                "qty": 1,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 3612,
                "lotnoTextAttr16": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "lotnoTextAttr19": "",
                "lotnoTextAttr10": "",
                "dualUnitId": 4403,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "OS0190073*0001",
                "lotnoLookupAttr9": 0,
                "proId": 4547,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "remasb": [
            {
                "hId": 84,
                "i18nField": "{\"remarks_en\": \"\"}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 1,
                "id": 82,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "asb"
            }
        ],
        "mainasb": [
            {
                "sourceId": 0,
                "tDate": 1556553600000,
                "lastModifyUid": 20,
                "code": "ASB20190011",
                "useAccess": false,
                "virDeptId": 1,
                "expiredDate": -2209017600000,
                "iRev": 1,
                "sysJson": "{\"autoGenCode\":{\"snId\":534,\"sn\":\"11\"}}",
                "upOrigin": "PRO",
                "viewCode": "asb",
                "ce01Module": "asb",
                "beId": 133,
                "curId": 2,
                "expired": false,
                "rate": 0.88,
                "printCount": 0,
                "useAccessBl": false,
                "id": 84,
                "doctypeId": 0,
                "statusModifyDate": 1556612193000,
                "locked": false,
                "lastModifyDate": 1556612193000,
                "createUid": 20,
                "locId": 1,
                "createDate": 1556612193000,
                "rev": "1",
                "lastApproveUid": 0,
                "expiredUid": 0,
                "mLocId": 1,
                "useAccessWl": false,
                "descOrigin": "PRO",
                "sourceType": "bom",
                "sourceModule": "",
                "flowTypeId": 6694,
                "useAccessAutoCalc": false,
                "staffId": 21,
                "status": "Y"
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Product Assembly

# 一、Description

​ Usage: create or update 【Product Assembly】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/asb
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes asb
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/asb";
		String param = "&menuCode=asb";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

{
    "mainasb": {
        "values": [
            {
                "beId": 133,
                "code": "ASB220328A",
                "virDeptId": 1,
                "curId": 1,
                "rate": 1,
                "flowTypeId": 6694,
                "staffId": 723
            }
        ]
    },
    "asbt": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 7,
                "unitId": 39,
                "qty": 1,
              	"footerKey": "     1",
                "locId": 1
            }
        ]
    },
    "asbbompt": {
        "values": [
            {
              	"footerKey": "     1",
                "pproId": 7,
                "uc": 22,
                "hour": 0,
                "pLot": "A",
                "processId": 2,
                "sourceType": "pro",
                "ndFooterKey": "     1",
                "timeUnit": "hh",
                "costUnitPer": "cu"
            }
        ]
    },
    "asbbomt": {
        "values": [
            {
                "pproId": 7,
                "qtyNeed": 1,
                "lot": "A",
                "fdFooterKey": "     1",
                "processId": 2,
                "unitId": 39616,
                "locId": 1,
                "footerKey": "     1",
                "pLot": "A",
                "sourceType": "pro",
                "proId": 4547,
                "ndFooterKey": "     1"
            }
        ]
    },
    "asbbomtlot": {
        "values": [
            {
                "proId": 4547,
                "newLotno": 0,
                "lotNoId": 3612,
                "locId": 1,
                "footerKey": "     1",
                "unitId": 39616,
                "qty": 1
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 85,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Product Assembly (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Product Assembly】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/asb
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/asb";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "MX",
    "asbt": [
        {
            "sourceType": "pro",
            "proCode": "PRO002",
            "unitCode": "PCS",
            "qty": 1,
            "footerKey": "     1",
            "locCode": "PHY"
        }
    ],
    "asbbompt": [
        {
            "footerKey": "     1",
            "pproCode": "PRO002",
            "uc": 22,
            "hour": 0,
            "pLot": "A",
            "processCode": "001",
            "sourceType": "pro",
            "ndFooterKey": "     1",
            "timeUnit": "hh",
            "costUnitPer": "cu"
        }
    ],
    "asbbomt": [
        {
            "pproCode": "PRO002",
            "qtyNeed": 1,
            "lot": "A",
            "fdFooterKey": "     1",
            "processCode": "001",
            "unitCode": "PCS",
            "locCode": "PHY",
            "footerKey": "     1",
            "pLot": "A",
            "sourceType": "pro",
            "proCode": "MXLOTNO",
            "ndFooterKey": "     1"
        }
    ],
    "asbbomtlot": [
        {
            "proCode": "MXLOTNO",
            "newLotno": 0,
            "lotNoCode": "OS0190073*0001",
            "locCode": "PHY",
            "footerKey": "     1",
            "unitCode": "PCS",
            "qty": 1
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 86,
  "tranCode": "ASB220006",
  "message": "",
  "status": true
}

# Delete Product Assembly

# 一、Description

​ Usage: Delete Product Assembly

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/asb
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes asb
id long(Query) Yes Product Assembly ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/asb";
		String param = "&menuCode=asb&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Product Assembly Material Consumption

# 一、Description

​ Usage: Run EBI[Product Assembly Material Consumption],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 4,
    "rows": [
        {
            "ASBBOMPT_A_pc": "50.00000000",
            "ASB_A_id": "52",
            "MAIN_matLotQty": "60.00000000",
            "M18ReservedCol_dataIndex": 1,
            "ASBBOMT_A_pproId": "4229",
            "ASBT_A_locId_code": "ACLL",
            "ASBT_A_locId": "15",
            "ASBBOMPT_A_pproId_code": "PRO2018",
            "ASBT_A_proId": "4229",
            "ASBBOMPT_A_processId": "4",
            "ASBBOMT_A_proId_code": "PRO201801",
            "ASBT_A_proId_code": "PRO2018",
            "ASBBOMT_A_qtyNeed": "100.00000000",
            "ASBBOMPT_A_processId_code": "003",
            "ASBBOMT_A_pproId_code": "PRO2018",
            "ASBBOMPT_A_pproId": "4229",
            "ASB_A_tDate": "2018.01.08",
            "ASB_A_code": "ASB20180091",
            "ASBBOMT_A_proId": "4227"
        }
    ]
}

ebi1

# Product Disassembly

# Fetch Product Disassembly List

# 一、Description

​ Usage: Fetch Product Disassembly List.

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/search/search
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
stSearch String(Query) Yes dsb
beId long(Query) Yes Business Entity ID
formatId long(Query) No Lookup Query ID, If not specified, the default format is used.
startRow int(Query) No Resultset offset : start index
endRow int(Query) No Resultset offset : end index
quickSearchStr String(Query) No Quick search keyword

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/search/search";
		String param = "&stSearch=dsb&beId=142";

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));
		}
		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
  	"stSearch": "dsb",
    "size": 3,
    "stSearchDisplay": "Product Disassembly",
    "values": [
        {
            "code": "DASB21090015",
            "tDate": "2021-09-16",
            "maindsb.locId.loc.code": "ACLL",
            "maindsb.locId.loc.desc": "Asia Cool Logistics Ltd",
            "maindsb.locId.loc.locTypeId.loctype.code": "PASS",
            "maindsb.locId.loc.locTypeId.loctype.desc": "PASS",
            "iRev": 5,
            "lastModifyDate": "2021-10-25 17:02:53",
            "maindsb.lastModifyUid.simpleUser.desc__lang": "Milk",
            "id": 19,
            "st_desc": "DASB21090015",
            "st_id": 19,
            "st_code": "DASB21090015"
        }
  	]
}

# Load Product Disassembly

# 一、Description

​ Usage: Load 【Product Disassembly】Record

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/read/dsb
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes dsb
id long(Query) Yes Product Disassembly ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

		CloseableHttpClient client = HttpClientBuilder.create().build();
		CloseableHttpResponse res = null;
		try {

			String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/read/dsb";
			String param = "&menuCode=dsb&id=" + id;

			HttpGet get = new HttpGet(url + "?" + param);
			get.addHeader("authorization", access_token);
			get.addHeader("client_id", ClientID);
			res = client.execute(get);
			if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
				JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

				System.out.println(json);
			}

			get.releaseConnection();
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (res != null) {
					res.close();
				}
				if (client != null) {
					client.close();
				}
			} catch (Exception ex) {
				ex.printStackTrace();
			}
		}

​ 4、Response Sample

{
    "data": {
        "maindsb": [
            {
                "sourceId": 202,
                "tDate": 1631721600000,
                "lastModifyUid": 20,
                "code": "DASB21090015",
                "useAccess": false,
                "virDeptId": 7,
                "expiredDate": -2209017600000,
                "iRev": 5,
                "sysJson": "{\"autoGenCode\":{\"snId\":726,\"sn\":\"10\"}}",
                "upOrigin": "SOLAST",
                "viewCode": "sret",
                "ce01Module": "dsb",
                "beId": 142,
                "curId": 2,
                "expired": false,
                "rate": 1,
                "printCount": 0,
                "useAccessBl": false,
                "id": 19,
                "doctypeId": 0,
                "statusModifyDate": 1631785100000,
                "locked": false,
                "lastModifyDate": 1635152573000,
                "createUid": 20,
                "locId": 15,
                "createDate": 1631785100000,
                "rev": "6",
                "lastApproveUid": 20,
                "expiredUid": 0,
                "mLocId": 0,
                "useAccessWl": false,
                "descOrigin": "SOLAST",
                "sourceType": "",
                "sourceModule": "sret",
                "flowTypeId": 7866,
                "useAccessAutoCalc": false,
                "staffId": 21,
                "status": "Y"
            }
        ],
        "remdsb": [
            {
                "hId": 19,
                "i18nField": "{\"shipAd1_en\": \"广东\", \"shipAd2_en\": \"深圳\", \"shipAd3_en\": \"南山\", \"shipAd4_en\": \"海德\", \"heading_zh-CN\": \"\", \"shipAd1_zh-CN\": \"广东\", \"shipAd1_zh-TW\": \"广东\", \"shipAd2_zh-CN\": \"深圳\", \"shipAd2_zh-TW\": \"深圳\", \"shipAd3_zh-CN\": \"南山\", \"shipAd3_zh-TW\": \"南山\", \"shipAd4_zh-CN\": \"海德\", \"shipAd4_zh-TW\": \"海德\", \"recipient_zh-CN\": \"刘\"}",
                "remarks_zh-CN": "",
                "remarks_ccn": "",
                "remarks_en": "",
                "remarks_haha1": "",
                "iRev": 5,
                "id": 19,
                "remarks_zh-TW": "",
                "remarks": "",
                "remarks_ctw": "",
                "ce01Module": "dsb"
            }
        ],
        "dsbbompt": [
            {
                "sourceId": 202,
                "hId": 19,
                "pproId": 6004,
                "iRev": 5,
                "processDesc": "组合",
                "itemNo": "     1",
                "uc": 2,
                "ce01Module": "dsb",
                "pc": 200,
                "footerKey": "     1",
                "hour": 0,
                "pLot": "A",
                "processId": 4,
                "sourceType": "sret",
                "ndFooterKey": "     1",
                "id": 66,
                "timeUnit": "",
                "costUnitPer": "unit"
            }
        ],
        "dsbbomt": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "qtyNeed": 100,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "fdFooterKey": "     1",
                "lotnoLookupAttr18": 0,
                "bDesc_zh-TW": "",
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "refdest": "",
                "lotnoLot": "A",
                "id": 124,
                "dDesc_haha1": "",
                "matUc": 1000,
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "i18nField": "{\"bDesc_zh-CN\": \"组合物件1\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "sret",
                "pproId": 6004,
                "iRev": 5,
                "bDesc_ctw": "",
                "ce01Module": "dsb",
                "lot": "A",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": -2209017600000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "processId": 4,
                "lotnoDateAttr8": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 41135,
                "lotnoDateAttr9": -2209017600000,
                "locId": 15,
                "bDesc_en": "",
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "ndFooterKey": "     1",
                "lotnoTextAttr9": "",
                "bDesc_zh-CN": "组合物件1",
                "sourceId": 202,
                "dualQty": 0,
                "itemNo": "     1",
                "uc": 10,
                "bDesc": "组合物件1",
                "matcatId": 0,
                "hId": 19,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253402271999000,
                "footerKey": "     1",
                "dDesc": "",
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 5073,
                "lotnoTextAttr16": "",
                "dDesc_ctw": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "dDesc_zh-CN": "",
                "lotnoTextAttr19": "",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "rdFooterKey": "     1",
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "dDesc_en": "",
                "dualUnitId": 8212,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "25DASB2109001500000000",
                "lotnoLookupAttr9": 0,
                "pLot": "A",
                "proId": 6005,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "remarks": "",
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            },
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "qtyNeed": 200,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "fdFooterKey": "     1",
                "lotnoLookupAttr18": 0,
                "bDesc_zh-TW": "",
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "refdest": "",
                "lotnoLot": "A",
                "id": 125,
                "dDesc_haha1": "",
                "matUc": 2000,
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "i18nField": "{\"bDesc_zh-CN\": \"组合物件2\", \"dDesc_zh-CN\": \"\"}",
                "sourceType": "sret",
                "pproId": 6004,
                "iRev": 5,
                "bDesc_ctw": "",
                "ce01Module": "dsb",
                "lot": "A",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": -2209017600000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "processId": 4,
                "lotnoDateAttr8": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 41313,
                "lotnoDateAttr9": -2209017600000,
                "locId": 15,
                "bDesc_en": "",
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "ndFooterKey": "     1",
                "lotnoTextAttr9": "",
                "bDesc_zh-CN": "组合物件2",
                "sourceId": 202,
                "dualQty": 0,
                "itemNo": "     2",
                "uc": 10,
                "bDesc": "组合物件2",
                "matcatId": 0,
                "hId": 19,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253402271999000,
                "footerKey": "     2",
                "dDesc": "",
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 5074,
                "lotnoTextAttr16": "",
                "dDesc_ctw": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "dDesc_zh-CN": "",
                "lotnoTextAttr19": "",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "rdFooterKey": "     2",
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "dDesc_en": "",
                "dualUnitId": 8384,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "25DASB2109001500000000",
                "lotnoLookupAttr9": 0,
                "pLot": "A",
                "proId": 6135,
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "remarks": "",
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ],
        "dsbt": [
            {
                "lotnoNumAttr17": 0,
                "lotnoNumAttr16": 0,
                "lotnoNumAttr15": 0,
                "lotnoNumAttr14": 0,
                "lotnoNumAttr19": 0,
                "lotnoNumAttr18": 0,
                "lotnoLookupAttr20": 0,
                "lotnoNumAttr13": 0,
                "lotnoNumAttr12": 0,
                "lotnoNumAttr11": 0,
                "lotnoNumAttr10": 0,
                "lotnoLookupAttr16": 0,
                "lotnoLookupAttr17": 0,
                "lotnoLookupAttr14": 0,
                "lotnoLookupAttr15": 0,
                "lotnoLookupAttr18": 0,
                "bDesc_zh-TW": "组合产品",
                "lotnoLookupAttr19": 0,
                "newLotno": 0,
                "lotnoLot": "A",
                "id": 61,
                "dDesc_haha1": "",
                "lotnoNumAttr20": 0,
                "lotnoLookupAttr12": 0,
                "lotnoLookupAttr13": 0,
                "lotnoLookupAttr10": 0,
                "lotnoLookupAttr11": 0,
                "i18nField": "{\"bDesc_en\": \"组合产品\", \"bDesc_zh-CN\": \"组合产品\", \"bDesc_zh-TW\": \"组合产品\"}",
                "sourceType": "pro",
                "costAmt": 3112.095687,
                "iRev": 5,
                "bDesc_ctw": "",
                "ce01Module": "dsb",
                "lot": "A",
                "lotnoDateAttr3": -2209017600000,
                "lotnoDateAttr4": -2209017600000,
                "lotnoDateAttr1": 253402271999000,
                "lotnoDateAttr2": -2209017600000,
                "lotnoDateAttr7": -2209017600000,
                "lotnoDateAttr8": -2209017600000,
                "bDesc_ccn": "",
                "lotnoDateAttr5": -2209017600000,
                "lotnoDateAttr6": -2209017600000,
                "unitId": 41134,
                "lotnoDateAttr9": -2209017600000,
                "locId": 15,
                "bDesc_en": "组合产品",
                "lotnoTextAttr1": "",
                "lotnoTextAttr2": "",
                "lotnoTextAttr3": "",
                "lotnoTextAttr4": "",
                "lotnoTextAttr5": "",
                "lotnoTextAttr6": "",
                "lotnoTextAttr7": "",
                "lotnoTextAttr8": "",
                "lotnoTextAttr9": "",
                "bDesc_zh-CN": "组合产品",
                "sourceId": 0,
                "dualQty": 100,
                "itemNo": "     1",
                "beId": 142,
                "bDesc": "组合产品",
                "hId": 19,
                "lotnoNumAttr1": 0,
                "lotnoNumAttr2": 0,
                "lotnoNumAttr3": 0,
                "lotnoNumAttr4": 0,
                "lotnoExpDate": 253402271999000,
                "dDesc": "",
                "footerKey": "     1",
                "qty": 100,
                "lotnoNumAttr5": 0,
                "lotnoNumAttr6": 0,
                "lotnoNumAttr7": 0,
                "lotnoNumAttr8": 0,
                "lotnoNumAttr9": 0,
                "lotNoId": 4982,
                "lotnoTextAttr16": "",
                "dDesc_ctw": "",
                "lotnoTextAttr15": "",
                "lotnoTextAttr18": "",
                "lotnoTextAttr17": "",
                "lotnoTextAttr12": "",
                "lotnoTextAttr11": "",
                "lotnoDateAttr20": -2209017600000,
                "lotnoTextAttr14": "",
                "lotnoTextAttr13": "",
                "dDesc_zh-CN": "",
                "lotnoTextAttr19": "",
                "bDesc_haha1": "",
                "dDesc_zh-TW": "",
                "dDesc_ccn": "",
                "lotnoTextAttr10": "",
                "dDesc_en": "",
                "dualUnitId": 8211,
                "lotnoLookupAttr5": 0,
                "lotnoLookupAttr6": 0,
                "sourceLot": "",
                "lotnoLookupAttr7": 0,
                "lotnoDateAttr18": -2209017600000,
                "lotnoLookupAttr8": 0,
                "lotnoDateAttr19": -2209017600000,
                "lotno": "1ASB20210050000000000",
                "lotnoLookupAttr9": 0,
                "proId": 6004,
                "cuspono": "",
                "lotnoDateAttr12": -2209017600000,
                "lotnoDateAttr13": -2209017600000,
                "lotnoDateAttr10": -2209017600000,
                "lotnoDateAttr11": -2209017600000,
                "lotnoTextAttr20": "",
                "lotnoLookupAttr1": 0,
                "lotnoDateAttr16": -2209017600000,
                "lotnoLookupAttr2": 0,
                "lotnoDateAttr17": -2209017600000,
                "lotnoLookupAttr3": 0,
                "lotnoDateAttr14": -2209017600000,
                "lotnoLookupAttr4": 0,
                "lotnoDateAttr15": -2209017600000
            }
        ]
    },
    "messages": [],
    "status": true
}

# Create Product Disassembly

# 一、Description

​ Usage: create or update 【Product Disassembly】

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/save/dsb
HTTP Method PUT
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes dsb
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/save/dsb";
		String param = "&menuCode=dsb";

		HttpPut put = new HttpPut(url + "?" + param);
		put.addHeader("authorization", access_token);
		put.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		put.setEntity(entity);

		res = client.execute(put);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("recordId");
			}

			System.out.println(json);
		}

		put.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

Entity data as JSON format:

{
    "maindsb": {
        "values": [
            {
                "beId": 142,
                "code": "DSB220328A",
                "virDeptId": 1,
                "curId": 1,
                "rate": 1,
                "flowTypeId": 7866,
                "staffId": 723
            }
        ]
    },
    "dsbt": {
        "values": [
            {
                "sourceType": "pro",
                "proId": 6004,
                "newLotno": 0,
                "lotNoId": 4982,
                "lot": "A",
                "unitId": 41134,
                "locId": 15,
                "footerKey": "     1",
                "qty": 100
            }
        ]
    },
    "dsbbompt": {
        "values": [
            {
                "pproId": 6004,
                "sourceType": "sret",
                "sourceId": 202,
                "uc": 2,
                "pc": 200,
                "footerKey": "     1",
                "hour": 0,
                "pLot": "A",
                "processId": 4,
                "ndFooterKey": "     1",
                "costUnitPer": "unit"
            }
        ]
    },
    "dsbbomt": {
        "values": [
            {
                "proId": 6005,
                "pLot": "A",
                "qtyNeed": 100,
                "fdFooterKey": "     1",
                "newLotno": 0,
                "matUc": 1000,
                "sourceType": "sret",
                "pproId": 6004,
                "lot": "A",
                "processId": 4,
                "unitId": 41135,
                "locId": 15,
                "ndFooterKey": "     1",
                "sourceId": 202,
                "uc": 10,
                "footerKey": "     1",
                "lotNoId": 5073,
                "rdFooterKey": "     1"
            }
        ]
    }
}

​ 4、Response Sample

{
	"recordId": 20,
	"messages": [],
	"status": true
}
{
    "recordId": 0,
    "messages": [
        {
            "msgDetail": "Required field is empty",
            "msgCode": "core_101905"
        }
    ],
    "status": false
}

# Create Product Disassembly (Auto Completion)

# 一、Description

​ 1. Usage: Create 【Product Disassembly】

​ 2. This API has the following characteristics:

​ ​ a. Support using code instead of id field

​ ​ b. If field currency has no value specified, the Entity Currency will be used automatically

​ ​ c. If field staff has no value specified, the default staff in the User Options will be used automatically

​ ​ d. If field document date has no value specified, the value is obtained according to the date option in the [Preference Setup (Trade)]

​ ​ e. If field business process has no value specified, according to the default value set in [Business Process Setup (Trade)]

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/erp/bsFlow/save/dsb
HTTP Method POST
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/erp/bsFlow/save/dsb";

		HttpPost post = new HttpPost(url);
		post.addHeader("authorization", access_token);
		post.addHeader("client_id", ClientID);

		StringEntity entity = new StringEntity(data.toJSONString(), ContentType.APPLICATION_JSON);
		entity.setContentEncoding("UTF-8");
		post.setEntity(entity);

		res = client.execute(post);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			if (json != null) {
				recordId = json.getLongValue("tranId");
			}
			System.out.println(json);
		}

		post.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

Sample data

{
    "beCode": "IT",
    "dsbt": [
        {
            "sourceType": "pro",
            "proCode": "MXASB",
            "unitCode": "PCS",
            "qty": 100,
            "locCode": "ACLL",
            "lotno": "1ASB20210050000000000",
            "footerKey": "     1"
        }
    ],
    "dsbbompt": [
        {
            "pproCode": "MXASB",
            "sourceType": "sret",
            "sourceCode": "SRE220010",
            "uc": 2,
            "pc": 200,
            "footerKey": "     1",
            "hour": 0,
            "pLot": "A",
            "processCode": "003",
            "ndFooterKey": "     1",
            "costUnitPer": "unit"
        }
    ],
    "dsbbomt": [
        {
            "proCode": "MXASBMATA",
            "pLot": "A",
            "qtyNeed": 100,
            "fdFooterKey": "     1",
            "newLotno": 0,
            "matUc": 1000,
            "sourceType": "sret",
            "pproCode": "MXASB",
            "lot": "A",
            "processCode": "003",
            "unitCode": "PCS",
            "locCode": "ACLL",
            "ndFooterKey": "     1",
            "sourceCode": "SRE220010",
            "uc": 10,
            "footerKey": "     1",
            "lotno": "25DASB2109001500000000",
            "rdFooterKey": "     1"
        }
    ]
}

​ 4、Response Sample

{
  "tranId": 21,
  "tranCode": "DSB220328B",
  "message": "",
  "status": true
}

# Delete Product Disassembly

# 一、Description

​ Usage: Delete Product Disassembly

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/root/api/delete/dsb
HTTP Method DELETE
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
menuCode String(Query) Yes dsb
id long(Query) Yes Product Disassembly ID
param String(Query) No Extra Pamameters: in JSON format

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/root/api/delete/dsb";
		String param = "&menuCode=dsb&id=" + id;

		HttpDelete delete = new HttpDelete(url + "?" + param);
		delete.addHeader("authorization", access_token);
		delete.addHeader("client_id", ClientID);

		res = client.execute(delete);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		delete.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

​ 4、Response Sample

{
	"messages": [],
	"status": true
}
{
    "messages": [
        {
            "msgDetail": "Record has been deleted",
            "msgCode": "core_101017"
        }
    ],
    "status": false
}

# Load EBI data:Product Disassembly Material Consumption

# 一、Description

​ Usage: Run EBI[Product Disassembly Material Consumption],return EBI data

# 二、API Detail

​ 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

​ 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

​ 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

​ 4、Response Sample

{
    "size": 4,
    "rows": [
        {
            "DSBBOMT_A_locId_desc__lang": "Asia Cool Logistics Ltd",
            "M18ReservedCol_dataIndex": 1,
            "DSBT_A_locId_code": "ACLL",
            "DSBBOMT_A_matUc": "21.06000000",
            "DSB_A_id": "9",
            "DSBT_A_proId_code": "PRO2018",
            "DSBBOMPT_A_processId_code": "003",
            "DSB_A_tDate": "2018.02.01",
            "DSBBOMT_A_proId_code": "PRO201801",
            "DSBBOMPT_A_processId": "4",
            "DSBT_A_qty": "10.00000000",
            "DSB_A_code": "DIS201802001",
            "DSBBOMT_A_qtyNeed": "10.00000000",
            "DSBT_A_proId": "4229",
            "DSBBOMT_A_proId": "4227",
            "DSBBOMPT_A_pc": "5.00000000",
            "DSBT_A_locId": "15"
        }
    ]
}

ebi1

# EBI (Stock)

# 一、Description

​ Usage: Run EBI,return EBI data

# 二、API Detail

# 1、Request URL

URL http://[server]/jsf/rfws/ebiWidget/loadReport
HTTP Method GET
Encode UTF-8

# 2、URL Parameters

Parameter Type Required Remarks
authorization String(Header) Yes Access Token obtained via Oauth2
client_id String(Header) Yes Client ID from [OAuth Applications], generated by the M18
formatId long(Query) Yes Format ID fetched from another API
beId long(Query) No Business Entity ID,If not specified, query all authorized Business Entity data.
offset int(Query) No Resultset offset : start index
rows int(Query) No Resultset offset : end index

# 3、Request Sample

	CloseableHttpClient client = HttpClientBuilder.create().build();
	CloseableHttpResponse res = null;
	try {

		String url = "http://" + HostIP + ":" + HostPort + "/jsf/rfws/ebiWidget/loadReport";
		String param = "&formatId=" + formatId;

		HttpGet get = new HttpGet(url + "?" + param);
		get.addHeader("authorization", access_token);
		get.addHeader("client_id", ClientID);
		res = client.execute(get);
		if (res.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
			JSONObject json = JSON.parseObject(EntityUtils.toString(res.getEntity()));

			System.out.println(json);
		}

		get.releaseConnection();
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		try {
			if (res != null) {
				res.close();
			}
			if (client != null) {
				client.close();
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}				

# 4、Response Sample

# a. Location Stock Level Report
{
    "size": 124,
    "rows": [
        {
            "MAIN_phy": "2.00000000",
            "M18ReservedCol_dataIndex": 1,
            "LOC_A_id": "1",
            "PRO_A_id": "5",
            "LOTNO_A_lotno": "**********IT",
            "MAIN_stockQty": "2.00000000",
            "STKUNIT_A_code": "个",
            "LOC_A_desc": "合格仓",
            "LOC_A_code": "PHY",
            "UNIT_A_id": "1",
            "STKUNIT_A_id": "1",
            "UNIT_A_code": "个",
            "PRO_A_code": "COMPUTER_02",
            "LOTNO_A_lotnoLot": "A"
        }
    ]
}

ebi1

# b. Location Stock Level and Value Report
{
    "size": 7,
    "rows": [
        {
            "MAIN_tranType": "an",
            "MAIN_avgUc_rep": "<span style='color: red;'>1.66666667</span>",
            "MAIN_phy": "1.00000000",
            "MAIN_notUpdate": "1",
            "M18ReservedCol_dataIndex": 1,
            "MAIN_amt_rep": "<span style='color: red;'>1.67</span>",
            "MAIN_tranId": "22",
            "LOC_A_id": "1",
            "PRO_A_id": "18",
            "MAIN_tDate": "2016.09.19",
            "LOTNO_A_lotno": "AN0120160919-ITPROC",
            "MAIN_stockQty": "0.33333333",
            "LOC_A_code": "PHY",
            "PRO_A_code": "ITPRO001",
            "MAIN_tranTypeMess": "Goods Receipt Note",
            "MAIN_tranCode": "AN0160006"
        }
    ]
}

ebi2

# c. Stock Movement Report
{
    "size": 224,
    "rows": [
        {
            "MAIN_tranType": "consignCdn",
            "MAIN_inQty": "0.00000000",
            "MAIN_outQty": "10.00000000",
            "M18ReservedCol_dataIndex": 1,
            "MAIN_tranId": "35",
            "MAIN_qty": "10.00000000",
            "LOC_A_id": "15",
            "PRO_A_id": "18",
            "LOC_A_code": "ACLL",
            "MAIN_tranDate": "2021.11.25",
            "MAIN_tranTypeMess": "Consignment Delivery",
            "MAIN_tranCode": "ITCO20070001-1",
            "PRO_A_code": "ITPRO001"
        }
    ]
}

ebi3

# d. Location Stock Ledger Report
{
    "size": 492,
    "rows": [
        {
            "MAIN_tranType": "",
            "MAIN_uc": "0.00000000",
            "MAIN_notUpdate": "0",
            "BUNIT_A_code": "TON",
            "M18ReservedCol_dataIndex": 1,
            "MAIN_tranId": "0",
            "MAIN_qty": "0.00000000",
            "BUNIT_A_id": "76",
            "LOC_A_id": "7",
            "MAIN_balDesc": "Opening Balance",
            "MAIN_basicQty": "0.00000000",
            "PRO_A_id": "4197",
            "LOTNO_A_lotno": "",
            "MAIN_periodBal": "0.00000000",
            "LOC_A_code": "SZO",
            "UNIT_A_id": "76",
            "MAIN_amt": "0.00",
            "MAIN_tranDate": "",
            "UNIT_A_code": "TON",
            "PRO_A_code": "00001",
            "MAIN_tranTypeMess": "",
            "MAIN_tranCode": "",
            "MAIN_bal": "0.00000000"
        }
    ]
}

ebi4

# e. Stock Turnover Report
{
    "size": 18,
    "rows": [
        {
            "MAIN_opening": "844.70000000",
            "M18ReservedCol_dataIndex": 1,
            "MAIN_otherIn": "94.80000000",
            "MAIN_netPurQty": "806.88654781",
            "PRO_A_id": "18",
            "MAIN_closing": "1,597.38654781",
            "MAIN_stkIn": "1,657.57309562",
            "MAIN_otherOut": "100.00000000",
            "UNIT_A_id": "1",
            "MAIN_stkOut": "904.88654781",
            "MAIN_netSalesQty": "61.00000000",
            "UNIT_A_code": "个",
            "PRO_A_code": "ITPRO001"
        }
    ]
}

ebi5

# f. Stock Aging (Quantity and Value) Analysis Report in Day and Location
{
    "size": 58,
    "rows": [
        {
            "MAIN_uc": "<span style='color: red;'>0.00000000</span>",
            "MAIN_phy": "27.00000000",
            "MAIN_notUpdate": "1",
            "M18ReservedCol_dataIndex": 1,
            "LOC_A_id": "1",
            "PRO_A_id": "3",
            "MAIN_qty2": "0.00000000",
            "MAIN_qty3": "0.00000000",
            "MAIN_qty1": "0.00000000",
            "LOC_A_code": "PHY",
            "MAIN_qty4": "0.00000000",
            "MAIN_qty5": "27.00000000",
            "PRO_A_code": "COMPUTER_01",
            "MAIN_domAmt": "<span style='color: red;'>0.00</span>"
        }
    ]
}

ebi6

# g. Stock Aging (Quantity and Value) Analysis Report in Month and Location
{
    "size": 31,
    "rows": [
        {
            "MAIN_uc": "<span style='color: red;'>1.66666667</span>",
            "MAIN_phy": "54.00000000",
            "MAIN_notUpdate": "1",
            "M18ReservedCol_dataIndex": 1,
            "LOC_A_id": "1",
            "PRO_A_id": "18",
            "MAIN_qty2": "0.00000000",
            "MAIN_qty3": "0.00000000",
            "MAIN_qty1": "0.00000000",
            "LOC_A_code": "PHY",
            "MAIN_qty4": "0.00000000",
            "MAIN_qty5": "54.00000000",
            "PRO_A_code": "ITPRO001",
            "MAIN_domAmt": "<span style='color: red;'>90.00</span>"
        }
    ]
}

ebi7

# h. Stock Aging Report in Day (Lot No.)
{
    "size": 88,
    "rows": [
        {
            "MAIN_locId": "1",
            "MAIN_unitId": "1",
            "MAIN_phy": "<span style='color: red;'>1.00000000</span>",
            "MAIN_notUpdate": "1",
            "M18ReservedCol_dataIndex": 1,
            "MAIN_proCode": "ITPRO001",
            "MAIN_proId": "18",
            "LOTNO_A_lotno": "AN0120160919-ITPROC",
            "MAIN_unitCode": "个",
            "MAIN_qty2": "<span style='color: red;'>0.00000000</span>",
            "MAIN_qty3": "<span style='color: red;'>0.00000000</span>",
            "MAIN_qty1": "<span style='color: red;'>0.00000000</span>",
            "MAIN_qty4": "<span style='color: red;'>0.00000000</span>",
            "MAIN_qty5": "<span style='color: red;'>1.00000000</span>",
            "MAIN_noLotno": "0",
            "MAIN_locCode": "PHY"
        }
    ]
}

ebi8

# i. ABC Stock Classification Report
{
    "size": 9,
    "rows": [
        {
            "MAIN_phy": "-80.00000000",
            "M18ReservedCol_dataIndex": 1,
            "MAIN_class": "A",
            "MAIN_qtyRatio": "41.77",
            "MAIN_usage_qty": "190.00000000",
            "MAIN_cumRatio": "42",
            "PRO_A_code": "ITPRO005",
            "PRO_A_id": "62",
            "MAIN_unit": "个"
        }
    ]
}

ebi9