Goods Stock Adjust Records Query (T149)
Query historical stock adjustment records with pagination support. This endpoint returns stock adjustment records including adjustment types, dates, amounts, and branch information for audit and compliance purposes. Request and response are encrypted.
Endpoint Overview
| Property | Value |
|---|---|
| Interface Code | T149 |
| Request Encrypted | ✅ Yes |
| Response Encrypted | ✅ Yes |
| Request Body | { "referenceNo": "...", "startDate": "...", "endDate": "...", "pageNo": 1, "pageSize": 10 } |
| Response Format | JSON with pagination |
Flow Description
- Client submits query with optional filters (
referenceNo,startDate,endDate) and pagination parameters. - Server validates the request parameters and date range.
- Server queries stock adjustment records matching the criteria across all branches.
- Server returns paginated results with adjustment details including type, date, amount, and remarks.
- Client displays records or uses data for audit/compliance reporting.
💡 Tip: Use T149 to query stock adjustment records (different from T145/T147 which query stock-in records). Use the
idfrom response to call T160 for detailed item-level information.
- PHP
- JavaScript / TypeScript
- Python
try {
// Call T149: Goods Stock Adjust Records Query
$filters = [
'referenceNo' => '425502528294126235', // Optional: reference number
'startDate' => '2025-02-19', // Optional: Start date
'endDate' => '2025-02-20', // Optional: End date
'pageNo' => 1,
'pageSize' => 10
];
$response = $client->queryStockAdjustRecords($filters);
$content = $response['data']['content'] ?? $response;
$records = $content['records'] ?? [];
$page = $content['page'] ?? [];
if (!empty($records)) {
echo "✅ Retrieved " . count($records) . " adjustment record(s)\n";
echo " Page: {$page['pageNo']}/{$page['pageCount']} (Total: {$page['totalSize']})\n";
foreach ($records as $record) {
echo " • Branch: {$record['branchName']}\n";
echo " Adjust Date: {$record['adjustDate']}\n";
echo " Adjust Type: {$record['adjustType']}\n";
echo " Amount: {$record['adjustAmount']}\n";
echo " Reference: {$record['referenceNo']}\n";
echo " Remarks: {$record['remarks']}\n";
echo " ID: {$record['id']}\n";
echo "\n";
}
} else {
echo "⚠️ No stock adjustment records found for provided criteria\n";
}
} catch (\UraEfrisSdk\Exceptions\APIException $e) {
echo "❌ Query failed: " . $e->getMessage() . "\n";
echo " Return Code: " . $e->getReturnCode() . "\n";
}
try {
// Call T149: Goods Stock Adjust Records Query
const filters = {
referenceNo: '425502528294126235', // Optional: reference number
startDate: '2025-02-19', // Optional: Start date
endDate: '2025-02-20', // Optional: End date
pageNo: 1,
pageSize: 10
};
const response = await client.queryStockAdjustRecords(filters);
const content = response?.data?.content ?? response;
const records = content?.records ?? [];
const page = content?.page ?? {};
if (records.length > 0) {
console.log(`✅ Retrieved ${records.length} adjustment record(s)`);
console.log(` Page: ${page.pageNo}/${page.pageCount} (Total: ${page.totalSize})`);
for (const record of records) {
console.log(` • Branch: ${record.branchName}`);
console.log(` Adjust Date: ${record.adjustDate}`);
console.log(` Adjust Type: ${record.adjustType}`);
console.log(` Amount: ${record.adjustAmount}`);
console.log(` Reference: ${record.referenceNo}`);
console.log(` Remarks: ${record.remarks}`);
console.log(` ID: ${record.id}`);
console.log('');
}
return content;
} else {
console.warn('⚠️ No stock adjustment records found for provided criteria');
return { records: [], page };
}
} catch (error: any) {
console.error(`❌ Query failed: ${error.message}`);
if (error.returnCode) {
console.error(` Return Code: ${error.returnCode}`);
}
throw error;
}
try:
# Call T149: Goods Stock Adjust Records Query
filters = {
"referenceNo": "425502528294126235", # Optional: reference number
"startDate": "2025-02-19", # Optional: Start date
"endDate": "2025-02-20", # Optional: End date
"pageNo": 1,
"pageSize": 10
}
response = client.query_stock_adjust_records(filters)
content = response.get("data", {}).get("content", response)
records = content.get("records", [])
page = content.get("page", {})
if records:
print(f"✅ Retrieved {len(records)} adjustment record(s)")
print(f" Page: {page.get('pageNo')}/{page.get('pageCount')} (Total: {page.get('totalSize')})")
for record in records:
print(f" • Branch: {record['branchName']}")
print(f" Adjust Date: {record['adjustDate']}")
print(f" Adjust Type: {record['adjustType']}")
print(f" Amount: {record['adjustAmount']}")
print(f" Reference: {record['referenceNo']}")
print(f" Remarks: {record['remarks']}")
print(f" ID: {record['id']}")
print()
else:
print("⚠️ No stock adjustment records found for provided criteria")
except Exception as e:
print(f"❌ Query failed: {e}")
if hasattr(e, "return_code"):
print(f" Return Code: {e.return_code}")
raise
Request Structure
{
"data": {
"content": "BASE64_ENCRYPTED_PAYLOAD",
"signature": "JKQWJK34K32JJEK2JQWJ5678",
"dataDescription": {
"codeType": "1",
"encryptCode": "2",
"zipCode": "0"
}
},
"globalInfo": {
"interfaceCode": "T149",
"appId": "AP04",
"version": "1.1.20191201",
"tin": "1000029771",
"deviceNo": "TCS9e0df01728335239",
"taxpayerID": "1"
}
}
Request Fields (Encrypted Payload)
| Field | Required | Type | Length | Description |
|---|---|---|---|---|
referenceNo | ❌ No | String | ≤50 | Reference number for filtering adjustment records |
startDate | ❌ No | Date | - | Start date for filtering (yyyy-MM-dd) |
endDate | ❌ No | Date | - | End date for filtering (yyyy-MM-dd) |
pageNo | ✅ Yes | Number | ≤10 | Current page number (starts from 1) |
pageSize | ✅ Yes | Number | ≤3 | Records per page; cannot exceed 100 |
💡 Tip: All filter fields (
referenceNo,startDate,endDate) are optional. If omitted, the query returns all adjustment records within pagination limits.
Response Structure
{
"data": {
"content": {
"page": {
"pageNo": "1",
"pageSize": "10",
"totalSize": "50",
"pageCount": "5"
},
"records": [
{
"id": "208178192251887451",
"referenceNo": "425502528294126235",
"branchName": "PARAMOUR COSMETICS LIMITED",
"adjustDate": "2025-02-19",
"adjustType": "101",
"remarks": "Increase inventory",
"adjustAmount": "500.00"
}
]
}
},
"globalInfo": {
"interfaceCode": "T149",
"returnStateInfo": {
"returnCode": "00",
"returnMessage": "SUCCESS"
}
}
}
Response Fields
Pagination Object
| Field | Required | Type | Description |
|---|---|---|---|
pageNo | ✅ Yes | Number | Current page number |
pageSize | ✅ Yes | Number | Records per page |
totalSize | ✅ Yes | Number | Total number of matching records |
pageCount | ✅ Yes | Number | Total number of pages |
Stock Adjust Records Array Items
| Field | Required | Type | Length | Description |
|---|---|---|---|---|
id | ✅ Yes | String | ≤18 | Unique adjustment record identifier (use for T160 detail query) |
referenceNo | ❌ No | String | ≤50 | Reference number associated with the adjustment |
branchName | ❌ No | String | ≤500 | Branch name where adjustment occurred |
adjustDate | ❌ No | Date | - | Adjustment date (yyyy-MM-dd) |
adjustType | ❌ No | String (3) | 3 | 101=Expired Goods, 102=Damaged Goods, 103=Personal Uses, 104=Others, 105=Raw Material(s) |
remarks | ❌ No | String | ≤1024 | Adjustment remarks/notes |
adjustAmount | ❌ No | Number | - | Total adjustment amount (integer ≤12 digits, decimal ≤8 digits) |
💡 Tip: Use the
idfield from the response to call T160 (Goods Stock Adjust Detail Query) for item-level details of a specific adjustment record.
Return Codes
| Code | Message | Description |
|---|---|---|
00 | SUCCESS | Stock adjustment records retrieved successfully |
99 | Unknown error | Generic server error |
400 | Device does not exist | deviceNo not registered for this TIN |
402 | Device key expired | Device credentials expired; re-run T102 |
403 | Device status is abnormal | Device blocked or suspended |
1521 | pageNo:cannot be empty! | Missing page number in request |
1522 | pageNo:The byte length cannot be less than 0 and cannot be greater than 20! | Page number format error |
1523 | pageNo:Cannot be greater than -1! | Page number must be positive |
1524 | pageSize:cannot be empty! | Missing page size in request |
1525 | pageSize:The byte length cannot be less than 0 and cannot be greater than 3! | Page size format error |
1526 | pageSize:Cannot be greater than 100! | Page size exceeds maximum (100) |
2879 | combineKeywords: cannot be empty! | Keyword search required in some contexts |
2880 | combineKeywords: Byte length cannot be greater than 50! | Keyword exceeds length limit |
💡 Tip: Error codes
1521-1526are the most common pagination-related errors. EnsurepageNo≥ 1 andpageSize≤ 100.
Common Use Cases
-
Stock Adjustment Auditing
Query historical stock adjustment records for compliance audits and financial reconciliation. -
Adjustment Type Analysis
Filter records byadjustTypeto analyze patterns (expired goods, damaged goods, personal uses, etc.). -
Date-Range Reporting
Generate stock adjustment reports for specific periods (e.g., monthly, quarterly) usingstartDateandendDate. -
Reference Number Lookup
Locate adjustment records using reference numbers for transaction tracking and verification. -
Branch-Specific Analysis
Analyze adjustment patterns across branches usingbranchNamefrom record details. -
Record Detail Lookup
Retrieve theidfrom T149 results to fetch full item-level details via T160.
Integration Checklist
✅ Ensure pageNo ≥ 1 and pageSize ≤ 100 before submitting request
✅ Handle empty records array gracefully (no matching records found)
✅ Implement pagination logic using pageCount and totalSize from response
✅ Validate date format is yyyy-MM-dd for startDate and endDate
✅ Use T149 for adjustment records; use T145/T147 for stock-in records
✅ Cache frequently-queried adjustment records to reduce API calls
✅ Log query parameters for audit trail compliance
✅ Use response id field to call T160 for detailed item information
✅ Validate adjustType values against T115 dictionary for display purposes
✅ Handle potential 2879 error if keyword validation is enforced