|
|
@@ -14,6 +14,65 @@ export async function getInventoryTotalAPI(data) {
|
|
|
return Promise.reject(new Error(res.data.message));
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * 生成库存统计查询键;传入字符串时保持旧格式原样透传。
|
|
|
+ */
|
|
|
+export function buildInventoryTotalQueryKey(value, batchNo, systemBatchNo) {
|
|
|
+ if (typeof value === 'string') {
|
|
|
+ return value;
|
|
|
+ }
|
|
|
+ const item = value || {};
|
|
|
+ const code = item.productCode || item.code || '';
|
|
|
+ const resolvedBatchNo = batchNo !== undefined ? batchNo : item.batchNo;
|
|
|
+ const resolvedSystemBatchNo =
|
|
|
+ systemBatchNo !== undefined ? systemBatchNo : item.systemBatchNo;
|
|
|
+ if (!code) {
|
|
|
+ return '';
|
|
|
+ }
|
|
|
+ const keyParts = [code];
|
|
|
+ if (
|
|
|
+ resolvedBatchNo !== undefined &&
|
|
|
+ resolvedBatchNo !== null &&
|
|
|
+ resolvedBatchNo !== ''
|
|
|
+ ) {
|
|
|
+ keyParts.push(resolvedBatchNo);
|
|
|
+ if (
|
|
|
+ resolvedSystemBatchNo !== undefined &&
|
|
|
+ resolvedSystemBatchNo !== null &&
|
|
|
+ resolvedSystemBatchNo !== ''
|
|
|
+ ) {
|
|
|
+ keyParts.push(resolvedSystemBatchNo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return keyParts.join(',');
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 按物品编码、业务批次和系统批次匹配库存统计结果。
|
|
|
+ */
|
|
|
+export function matchInventoryTotal(item, result) {
|
|
|
+ if (!item || !result) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const code = item.productCode || item.code;
|
|
|
+ if (!code || String(result.code) !== String(code)) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const itemBatchNo = item.batchNo == null ? '' : String(item.batchNo);
|
|
|
+ const resultBatchNo = result.batchNo == null ? '' : String(result.batchNo);
|
|
|
+ if (resultBatchNo !== itemBatchNo) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ const itemSystemBatchNo =
|
|
|
+ item.systemBatchNo == null ? '' : String(item.systemBatchNo);
|
|
|
+ const resultSystemBatchNo =
|
|
|
+ result.systemBatchNo == null ? '' : String(result.systemBatchNo);
|
|
|
+ if (resultSystemBatchNo !== itemSystemBatchNo) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+}
|
|
|
+
|
|
|
export async function getSubPage(data) {
|
|
|
const res = await request.get('/main/categoryLevel/getSubPage', {
|
|
|
params: data
|
|
|
@@ -278,4 +337,4 @@ export async function getCategoryPackageDisposition (data){
|
|
|
return res.data.data;
|
|
|
}
|
|
|
return Promise.reject(new Error(res.data.message));
|
|
|
- }
|
|
|
+ }
|