Goods Stock Adjust Detail Query (T160)
Retrieve detailed information for a specific stock adjustment record, including header information and all adjusted goods items. This endpoint provides complete visibility into stock adjustment transactions including branch information, adjustment types, quantities, and amounts. Request and response are encrypted.
Endpoint Overviewβ
| Property | Value |
|---|---|
| Interface Code | T160 |
| Request Encrypted | β Yes |
| Response Encrypted | β Yes |
| Request Body | { "id": "..." } |
| Response Format | JSON Object |
Flow Descriptionβ
- Client submits a stock adjustment record
idobtained from T149 query results. - Server validates the record ID exists and belongs to the authenticated taxpayer.
- Server returns complete stock adjustment details including:
- Adjustment header information (
goodsStockAdjustobject) - All adjusted goods items (
goodsStocAdjustGoodsarray)
- Adjustment header information (
- Client uses response for detailed audit, reconciliation, or display purposes.
π‘ Tip: Use T160 after T149 to get full details of a specific stock adjustment record. The
idfield from T149 response is required for T160 requests.
- PHP
- JavaScript / TypeScript
- Python
try {
// Call T160: Goods Stock Adjust Detail Query
$recordId = '425502528294126235'; // From T149 response
$response = $client->queryStockAdjustDetail($recordId);
$content = $response['data']['content'] ?? $response;
if (isset($content['goodsStockAdjust'])) {
$header = $content['goodsStockAdjust'];
echo "β
Stock Adjustment Details\n";
echo " Branch: {$header['branchName']}\n";
echo " Adjust Date: {$header['adjustDate']}\n";
echo " Adjust Type: {$header['adjustType']}\n";
echo " Total Amount: {$header['adjustAmount']}\n";
echo " Remarks: {$header['remarks']}\n";
if (!empty($content['goodsStocAdjustGoods'])) {
echo "\n Adjusted Items (" . count($content['goodsStocAdjustGoods']) . "):\n";
foreach ($content['goodsStocAdjustGoods'] as $item) {
echo " β’ {$item['goodsName']} ({$item['goodsCode']})\n";
echo " Stock Before: {$item['stock']}\n";
echo " Adjusted Qty: {$item['adjustQuantity']}\n";
echo " Current Qty: {$item['currentQuantity']}\n";
echo " Unit Price: {$item['unitPrice']}\n";
echo " Adjust Amount: {$item['adjustAmount']}\n";
}
}
} else {
echo "β οΈ Stock adjustment record not found\n";
}
} catch (\UraEfrisSdk\Exceptions\APIException $e) {
echo "β Query failed: " . $e->getMessage() . "\n";
echo " Return Code: " . $e->getReturnCode() . "\n";
}
try {
// Call T160: Goods Stock Adjust Detail Query
const recordId = '425502528294126235'; // From T149 response
const response = await client.queryStockAdjustDetail(recordId);
const content = response?.data?.content ?? response;
if (content?.goodsStockAdjust) {
const header = content.goodsStockAdjust;
console.log('β
Stock Adjustment Details');
console.log(' Branch:', header.branchName);
console.log(' Adjust Date:', header.adjustDate);
console.log(' Adjust Type:', header.adjustType);
console.log(' Total Amount:', header.adjustAmount);
console.log(' Remarks:', header.remarks);
if (content.goodsStocAdjustGoods?.length) {
console.log(`\n Adjusted Items (${content.goodsStocAdjustGoods.length}):`);
for (const item of content.goodsStocAdjustGoods) {
console.log(` β’ ${item.goodsName} (${item.goodsCode})`);
console.log(` Stock Before: ${item.stock}`);
console.log(` Adjusted Qty: ${item.adjustQuantity}`);
console.log(` Current Qty: ${item.currentQuantity}`);
console.log(` Unit Price: ${item.unitPrice}`);
console.log(` Adjust Amount: ${item.adjustAmount}`);
}
}
return content;
} else {
console.warn('β οΈ Stock adjustment record not found');
return null;
}
} catch (error: any) {
console.error(`β Query failed: ${error.message}`);
if (error.returnCode) {
console.error(` Return Code: ${error.returnCode}`);
}
throw error;
}
try:
# Call T160: Goods Stock Adjust Detail Query
record_id = '425502528294126235' # From T149 response
response = client.query_stock_adjust_detail(record_id)
content = response.get("data", {}).get("content", response)
if content.get("goodsStockAdjust"):
header = content["goodsStockAdjust"]
print("β
Stock Adjustment Details")
print(f" Branch: {header['branchName']}")
print(f" Adjust Date: {header['adjustDate']}")
print(f" Adjust Type: {header['adjustType']}")
print(f" Total Amount: {header['adjustAmount']}")
print(f" Remarks: {header['remarks']}")
if content.get("goodsStocAdjustGoods"):
print(f"\n Adjusted Items ({len(content['goodsStocAdjustGoods'])}):")
for item in content["goodsStocAdjustGoods"]:
print(f" β’ {item['goodsName']} ({item['goodsCode']})")
print(f" Stock Before: {item['stock']}")
print(f" Adjusted Qty: {item['adjustQuantity']}")
print(f" Current Qty: {item['currentQuantity']}")
print(f" Unit Price: {item['unitPrice']}")
print(f" Adjust Amount: {item['adjustAmount']}")
else:
print("β οΈ Stock adjustment record not found")
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": "T160",
"appId": "AP04",
"version": "1.1.20191201",
"tin": "1000029771",
"deviceNo": "TCS9e0df01728335239",
"taxpayerID": "1"
}
}
Request Fields (Encrypted Payload)β
| Field | Required | Type | Length | Description |
|---|---|---|---|---|
id | β Yes | String | β€50 | Stock adjustment record identifier obtained from T149 query response |
π‘ Tip: The
idvalue must be obtained from a prior T149 query. This ID uniquely identifies the stock adjustment record in the system.
Response Structureβ
{
"data": {
"content": {
"goodsStockAdjust": {
"branchId": "2020090132456",
"branchName": "PARAMOUR COSMETICS LIMITED",
"adjustDate": "2025-02-19",
"adjustType": "101",
"remarks": "Increase inventory",
"adjustAmount": "69999"
},
"goodsStocAdjustGoods": [
{
"commodityGoodsId": "287700992426868373",
"goodsCode": "287700992426",
"goodsName": "test",
"measureUnit": "101",
"unitPrice": "6999",
"stock": "100",
"adjustQuantity": "10",
"currentQuantity": "90",
"adjustAmount": "69990.00",
"remarks": "remarks"
}
]
}
},
"globalInfo": {
"interfaceCode": "T160",
"returnStateInfo": {
"returnCode": "00",
"returnMessage": "SUCCESS"
}
}
}
Response Fieldsβ
goodsStockAdjust Object (Header Information)β
| Field | Required | Type | Length | Description |
|---|---|---|---|---|
branchId | β Yes | String | β€18 | Branch identifier where adjustment occurred |
branchName | β Yes | String | β€500 | Branch name |
adjustDate | β Yes | Date | - | Adjustment date (yyyy-MM-dd) |
adjustType | β Yes | 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) |
goodsStocAdjustGoods Array (Item Details)β
| Field | Required | Type | Length | Description |
|---|---|---|---|---|
commodityGoodsId | β No | String | β€18 | Goods identifier from T130; required if goodsCode is empty |
goodsCode | β No | String | β€50 | Goods code from T130; required if commodityGoodsId is empty |
goodsName | β No | String | β€600 | Goods/product name |
measureUnit | β No | String (3) | 3 | Unit of measure code from T115 rateUnit |
unitPrice | β No | Number | - | Commodity purchase price per unit (integer β€12 digits, decimal β€8 digits) |
stock | β No | Number | - | Stock quantity before adjustment (integer β€12 digits, decimal β€8 digits) |
adjustQuantity | β No | Number | - | Quantity adjusted (integer β€12 digits, decimal β€8 digits) |
currentQuantity | β No | Number | - | Stock quantity after adjustment (integer β€12 digits, decimal β€8 digits) |
adjustAmount | β No | Number | - | Total adjustment amount for this item (integer β€12 digits, decimal β€8 digits) |
remarks | β No | String | β€1024 | Item-level adjustment remarks |
π‘ Tip: Either
commodityGoodsIdORgoodsCodemust be populated per itemβnever both empty. ThecurrentQuantityshould equalstock-adjustQuantityfor reductions, orstock+adjustQuantityfor increases.
Return Codesβ
| Code | Message | Description |
|---|---|---|
00 | SUCCESS | Stock adjustment details 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 |
2881 | id:cannot be empty! | Missing record ID in request |
2882 | id:Byte length cannot be greater than 18! | Record ID exceeds maximum length |
2883 | Record does not exist! | Stock adjustment record ID not found in system |
2884 | Record does not belong to current taxpayer! | Stock adjustment record belongs to different TIN |
π‘ Tip: Error
2883indicates the record ID is invalid or has been deleted. Error2884indicates the record belongs to a different taxpayerβensure you're querying records for the authenticated TIN.
Common Use Casesβ
-
Stock Adjustment Audit Verification
Retrieve complete details of a specific stock adjustment record for audit trail verification and compliance reporting. -
Adjustment Type Analysis
Review all goods adjusted for a specific adjustment type (expired, damaged, personal uses, raw materials, others). -
Branch Stock Adjustment Review
Analyze stock adjustments for specific branches usingbranchIdandbranchNamefrom record details. -
Per-Item Quantity Verification
Verify exact quantities before/after adjustment for each goods item in a stock adjustment transaction. -
Financial Reconciliation
Match adjustment amounts to accounting entries usingadjustAmountvalues from record details. -
Inventory Discrepancy Investigation
Investigate stock discrepancies by examiningstock,adjustQuantity, andcurrentQuantityvalues.
Integration Checklistβ
β
Obtain valid record id from T149 query before calling T160
β
Validate record ID format (β€50 characters) before submitting
β
Handle empty goodsStocAdjustGoods array gracefully (record exists but no items)
β
Verify adjustType matches expected value for the adjustment type
β
Validate commodityGoodsId or goodsCode exists in local goods database
β
Check currentQuantity calculation matches stock Β± adjustQuantity
β
Cache record details to reduce repeated API calls for same record
β
Log record detail queries for audit trail compliance
β
Verify total adjustAmount matches sum of all item adjustAmount values
β
Cross-reference branchId with T138 branch list for validation