Files
SupplierSystem/miniprogram/utils/request.js
T
Ubuntu 63a268c0f6
CI / server typecheck + tests (push) Canceled after 0s
CI / web typecheck + tests + miniprogram syntax (push) Canceled after 0s
CI / eslint (观察项,C7 骨架) (push) Canceled after 0s
CI / npm audit (critical 硬拦) (push) Canceled after 0s
feat(加工): 小程序 BOM/分配对齐与人工追价入口
小程序领料 BOM/成品预览;移动端加工完成支持人工分配;订单完结后人工发起主系统 price-qty 申请。
2026-11-04 13:03:56 +08:00

1632 lines
51 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const config = require('../config');
const { getSession, clearSession } = require('./auth');
const { goLogin } = require('./nav');
let redirectingToLogin = false;
function redirectToLoginOnUnauthorized() {
if (redirectingToLogin) return;
redirectingToLogin = true;
try {
clearSession();
} catch (_) {
/* ignore */
}
try {
goLogin();
} catch (_) {
wx.reLaunch({ url: '/pages/login/login' });
}
setTimeout(() => {
redirectingToLogin = false;
}, 1500);
}
function readErrorMessage(body, statusCode) {
if (!body || typeof body !== 'object') return `请求失败(${statusCode})`;
if (body.error_description) return body.error_description;
if (typeof body.message === 'string' && body.message) return body.message;
if (typeof body.error === 'string' && body.error) return body.error;
if (body.error && typeof body.error === 'object' && body.error.message) {
return body.error.message;
}
return `请求失败(${statusCode})`;
}
function isSessionRevokedError(code) {
const key = String(code || '').trim();
return key === 'invalid_token' || key === 'pwdv_mismatch' || key === 'token_missing_pwdv';
}
function maybeRedirectOnUnauthorized(auth, skipAuthRedirect, errorCode) {
if (auth && !skipAuthRedirect && isSessionRevokedError(errorCode)) {
redirectToLoginOnUnauthorized();
}
}
function readErrorCode(body) {
if (!body || typeof body !== 'object') return '';
if (typeof body.error === 'string') return body.error;
if (body.error && typeof body.error === 'object' && body.error.code) {
return String(body.error.code);
}
return '';
}
function request(path, options = {}) {
const { method = 'GET', data = {}, auth = true, skipAuthRedirect = false, timeout } = options;
const session = getSession();
const header = {
'Content-Type': 'application/json',
};
if (auth && session?.access_token) {
header.Authorization = `Bearer ${session.access_token}`;
}
const upperMethod = String(method).toUpperCase();
const requestData =
upperMethod === 'GET' ? data : typeof data === 'string' ? data : JSON.stringify(data);
return new Promise((resolve, reject) => {
const reqOpts = {
url: `${config.apiBase}${path}`,
method: upperMethod,
data: requestData,
header,
success(res) {
const body = res.data || {};
if (res.statusCode >= 200 && res.statusCode < 300) {
resolve(body);
return;
}
if (res.statusCode === 401) {
const code = readErrorCode(body) || 'invalid_token';
const message =
body.error_description ||
body.message ||
'登录无效,请稍后重新登录';
maybeRedirectOnUnauthorized(auth, skipAuthRedirect, code);
reject(
Object.assign(new Error(message), {
statusCode: res.statusCode,
code,
body,
})
);
return;
}
reject(
Object.assign(new Error(readErrorMessage(body, res.statusCode)), {
statusCode: res.statusCode,
code: readErrorCode(body),
body,
})
);
},
fail(err) {
reject(new Error(err.errMsg || '网络错误,请检查 API 地址与后端服务'));
},
};
if (Number(timeout) > 0) reqOpts.timeout = Number(timeout);
wx.request(reqOpts);
});
}
function login(username, password, roleType) {
const data = { username, password };
if (roleType) data.role_type = roleType;
return request('/mobile/login', {
method: 'POST',
data,
auth: false,
skipAuthRedirect: true,
});
}
/** 微信小程序 getPhoneNumber 快速登录 */
function loginByPhone(phoneCode, roleType) {
const data = { phone_code: phoneCode };
if (roleType) data.role_type = roleType;
return request('/mobile/login/phone', {
method: 'POST',
data,
auth: false,
skipAuthRedirect: true,
});
}
function loginChooseBranch(ticket, branchCode, roleType) {
const data = { ticket, branch_code: branchCode };
if (roleType) data.role_type = roleType;
return request('/mobile/login/choose-branch', {
method: 'POST',
data,
auth: false,
skipAuthRedirect: true,
});
}
function fetchMe() {
return request('/mobile/me');
}
function fetchMobileRoles() {
return request('/mobile/roles');
}
/** 首页模块角标聚合:modules 传模块 id,后端按账号能力重算后返回各 badgeKey 数量 */
function fetchMobileBadges(modules = []) {
const list = Array.isArray(modules) ? modules : [modules];
const ids = list.map((item) => String(item || '').trim()).filter(Boolean);
const qs = ids.length ? `?modules=${encodeURIComponent(ids.join(','))}` : '';
return request(`/mobile/badges${qs}`);
}
function switchMobileRole(roleType) {
return request('/mobile/switch-role', {
method: 'POST',
data: { role_type: roleType },
});
}
function fetchDeliveryTasks(params = {}) {
const parts = [];
if (params.delivery_date) parts.push(`delivery_date=${encodeURIComponent(params.delivery_date)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/delivery/tasks${qs}`);
}
function fetchDeliveryLoading(taskCode) {
return request(`/mobile/delivery/loading/${encodeURIComponent(taskCode)}`);
}
function uploadDeliveryLoadingPhoto(payload) {
return request('/mobile/delivery/loading/photo', {
method: 'POST',
data: payload,
});
}
function confirmDeliveryLoadingItem(payload) {
return request('/mobile/delivery/loading/confirm-item', {
method: 'POST',
data: payload,
});
}
function unconfirmDeliveryLoadingItem(payload) {
return request('/mobile/delivery/loading/unconfirm-item', {
method: 'POST',
data: payload,
});
}
function scanDeliveryLoading(payload) {
return request('/mobile/delivery/loading/scan', {
method: 'POST',
data: payload,
});
}
function startDelivery(payload) {
return request('/mobile/delivery/start', {
method: 'POST',
data: payload,
});
}
function startDeliveryBatch(taskCodes, extra) {
const data =
Array.isArray(taskCodes) && taskCodes.length ? { task_codes: taskCodes } : {};
if (extra && extra.lat != null && extra.lng != null) {
data.lat = extra.lat;
data.lng = extra.lng;
}
return request('/mobile/delivery/start-batch', {
method: 'POST',
data,
});
}
function fetchDeliveryPresence() {
return request('/mobile/delivery/presence', { method: 'GET' });
}
function setDeliveryOnline() {
return request('/mobile/delivery/online', { method: 'POST', data: {} });
}
function setDeliveryOffline() {
return request('/mobile/delivery/offline', { method: 'POST', data: {} });
}
/**
* 结束配送。
* position:可选的最后一次已知定位({lat,lng,accuracy}),随请求带上,
* 服务端据此补一次进圈判定 —— 避免途中上报断档时进圈时刻永远为空。
* 见 docs/design/20260918-delivery-geofence-report-gap.md。
*/
function stopDelivery(taskCode, position) {
const data = { task_code: taskCode || '' };
if (position && Number.isFinite(Number(position.lat)) && Number.isFinite(Number(position.lng))) {
data.lat = Number(position.lat);
data.lng = Number(position.lng);
if (position.accuracy != null) data.accuracy = Number(position.accuracy);
}
return request('/mobile/delivery/stop', {
method: 'POST',
data,
});
}
function reportDeliveryLocation(payload) {
return request('/mobile/delivery/location', {
method: 'POST',
data: payload || {},
});
}
function uploadDeliverySignPhoto(payload) {
return request('/mobile/delivery/sign-photo', {
method: 'POST',
data: payload,
});
}
function fetchSupplierPreparations(params = {}) {
const parts = [];
if (params.view) parts.push(`view=${encodeURIComponent(params.view)}`);
if (params.date) parts.push(`date=${encodeURIComponent(params.date)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
if (params.delivery_date) parts.push(`delivery_date=${encodeURIComponent(params.delivery_date)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/supplier/preparations${qs}`);
}
function fetchSupplierBids() {
return request('/mobile/supplier/bids');
}
function fetchSupplierBidDetail(id) {
return request(`/mobile/supplier/bids/${encodeURIComponent(id)}`);
}
function submitSupplierBidQuotes(id, payload) {
return request(`/mobile/supplier/bids/${encodeURIComponent(id)}/quotes`, {
method: 'POST',
data: payload || {},
});
}
function fetchAdminPreparations(params = {}) {
const parts = [];
if (params.delivery_date) parts.push(`delivery_date=${encodeURIComponent(params.delivery_date)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
if (params.date_field) parts.push(`date_field=${encodeURIComponent(params.date_field)}`);
if (params.status != null && params.status !== '') parts.push(`status=${encodeURIComponent(params.status)}`);
if (params.stockout) parts.push(`stockout=${encodeURIComponent(params.stockout)}`);
if (params.q) parts.push(`q=${encodeURIComponent(params.q)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/admin/preparations${qs}`);
}
function updateAdminPreparationStatus(payload) {
return request('/mobile/admin/preparations/status', {
method: 'POST',
data: payload,
});
}
function updateAdminPreparationPurchasePrice(payload) {
return request('/mobile/admin/preparations/purchase-price', {
method: 'POST',
data: payload,
});
}
function transferAdminPreparationStockout(payload) {
return request('/mobile/admin/preparations/stockout-transfer', {
method: 'POST',
data: payload,
});
}
function updateSupplierPreparationStatus(payload) {
return request('/mobile/supplier/preparations/status', {
method: 'POST',
data: payload,
});
}
function amendSupplierPreparationPrice(payload) {
return request('/mobile/supplier/preparations/amend-price', {
method: 'POST',
data: payload,
});
}
function uploadSupplierQualityReport(payload) {
return request('/mobile/supplier/quality-reports', {
method: 'POST',
data: payload,
timeout: 120000,
});
}
function confirmSupplierQualityReportHits(id, prepIds) {
return request(`/mobile/supplier/quality-reports/${encodeURIComponent(id)}/confirm-hits`, {
method: 'POST',
data: { prep_ids: prepIds || [] },
});
}
function discardSupplierQualityReport(id) {
return request(`/mobile/supplier/quality-reports/${encodeURIComponent(id)}/discard`, {
method: 'POST',
data: {},
});
}
/** 检验报告文件:multer 通道(单文件 10MB),返回 quality-reports 桶内对象路径。不要带 application/json。 */
function uploadQualityReportStorageFile(filePath, fileName) {
const session = getSession();
const rawName = String(fileName || '').trim() || String(filePath || '').split('/').pop() || 'quality-report.jpg';
const name = /\.(pdf|jpe?g|png|webp)$/i.test(rawName) ? rawName : `${rawName}.jpg`;
const pathQ = encodeURIComponent(name);
return new Promise((resolve, reject) => {
wx.uploadFile({
url: `${config.apiBase}/storage/quality-reports/upload?path=${pathQ}`,
filePath,
name: 'file',
formData: { path: name },
timeout: 120000,
header: session?.access_token ? { Authorization: `Bearer ${session.access_token}` } : {},
success(res) {
let body = {};
try {
body = typeof res.data === 'string' ? JSON.parse(res.data) : res.data || {};
} catch (_) {
body = {};
}
if (res.statusCode >= 200 && res.statusCode < 300 && body.path) {
resolve(String(body.path));
return;
}
if (res.statusCode === 401) {
const code = readErrorCode(body) || 'invalid_token';
maybeRedirectOnUnauthorized(true, false, code);
}
reject(new Error(body.error_description || body.error || `上传失败(${res.statusCode})`));
},
fail(err) {
reject(new Error(err.errMsg || '上传失败'));
},
});
});
}
function fetchSupplierQualityReportTypes() {
return request('/mobile/supplier/quality-report-types');
}
function fetchSupplierQualityReports(params = {}) {
const qs = [];
if (params.days != null) qs.push(`days=${encodeURIComponent(params.days)}`);
const suffix = qs.length ? `?${qs.join('&')}` : '';
return request(`/mobile/supplier/quality-reports${suffix}`);
}
function uploadPurchaseQualityReport(payload) {
return request('/mobile/purchase/quality-reports', {
method: 'POST',
data: payload,
});
}
function fetchPrepAmendPending() {
return request('/mobile/prep-amend/pending');
}
function fetchPrepAmendReviewed() {
return request('/mobile/prep-amend/reviewed');
}
function fetchPrepAmendPendingCount() {
return request('/mobile/prep-amend/pending-count');
}
function fetchPrepAmendDetail(id) {
return request(`/mobile/prep-amend/${encodeURIComponent(id || '')}`);
}
function confirmPrepAmend(id, payload) {
return request(`/mobile/prep-amend/${encodeURIComponent(id || '')}/confirm`, {
method: 'POST',
data: payload || {},
});
}
function rejectPrepAmend(id, payload) {
return request(`/mobile/prep-amend/${encodeURIComponent(id || '')}/reject`, {
method: 'POST',
data: payload || {},
});
}
function searchPurchaserOrderCustomers(params = {}) {
const parts = [];
if (params.q) parts.push(`q=${encodeURIComponent(params.q)}`);
if (params.date_range) parts.push(`date_range=${encodeURIComponent(params.date_range)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/purchaser/order-items/customers${qs}`);
}
function fetchPurchaserOrderList(params = {}) {
const parts = [];
if (params.customer_code) parts.push(`customer_code=${encodeURIComponent(params.customer_code)}`);
if (params.all_pending) parts.push('all_pending=1');
if (params.date_range) parts.push(`date_range=${encodeURIComponent(params.date_range)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/purchaser/order-items/orders${qs}`);
}
function fetchPurchaserOrderDetail(orderCode) {
return request(`/mobile/purchaser/order-items/orders/${encodeURIComponent(orderCode || '')}`);
}
function searchPurchaserOrderSkus(params = {}) {
const parts = [`customer_code=${encodeURIComponent(params.customer_code || '')}`];
if (params.q) parts.push(`q=${encodeURIComponent(params.q)}`);
return request(`/mobile/purchaser/order-items/skus?${parts.join('&')}`);
}
function savePurchaserOrderItems(orderCode, payload) {
return request(`/mobile/purchaser/order-items/orders/${encodeURIComponent(orderCode || '')}/items`, {
method: 'POST',
data: payload || {},
});
}
function updatePurchaserOrder(orderCode, payload) {
return request(`/mobile/purchaser/order-items/orders/${encodeURIComponent(orderCode || '')}`, {
method: 'PATCH',
data: payload || {},
});
}
function fetchSubstitutionCandidates(originalSkuCode, maxPrice = 0) {
return request(
`/mobile/supplier/substitution/candidates?original_sku_code=${encodeURIComponent(originalSkuCode)}&max_price=${maxPrice}`
);
}
function submitSupplierSubstitution(payload) {
return request('/mobile/supplier/substitution', {
method: 'POST',
data: payload,
});
}
function fetchInspectionTasks(params = {}) {
const parts = [];
if (params.source_type) parts.push(`source_type=${encodeURIComponent(params.source_type)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
if (params.date_field) parts.push(`date_field=${encodeURIComponent(params.date_field)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/inspection/tasks${qs}`);
}
function completeInspection(payload) {
return request('/mobile/inspection/complete', {
method: 'POST',
data: payload,
});
}
/** 订单入库:批量上传批次报告(图/PDF 已上传对象路径)→ 返回 OCR 提取的品名与生产日期 */
function createInspectionBatchReports(payload) {
return request('/mobile/inspection/batch-reports', {
method: 'POST',
data: payload,
});
}
function uploadInspectionPhoto(payload) {
return request('/mobile/inspection/photo', {
method: 'POST',
data: payload,
});
}
function deleteInspectionPhoto(payload) {
const id = encodeURIComponent(payload.id || '');
const index = Number(payload.index);
return request(`/mobile/inspection/photo?id=${id}&index=${index}`, {
method: 'DELETE',
});
}
function analyzeInspectionQuality(payload) {
return request('/functions/ai-quality-analysis', {
method: 'POST',
data: {
image: payload.image,
imageBase64: payload.image,
product_name: payload.product_name,
expected_qty: payload.expected_qty,
actual_qty: payload.actual_qty,
loss_qty: payload.loss_qty || 0,
},
timeout: 120000,
}).then((result) => {
const data = result && result.data;
if (!data) {
const err = result && result.error;
const message =
(err && typeof err === 'object' && err.message) ||
(typeof err === 'string' && err) ||
'AI 分析失败';
throw new Error(message);
}
return data;
});
}
// ── 仓库管理(2026-10-23):库存批次 / 批次报告 / 改价改量,与 Web 同一套 service ──
function fetchInventoryBatches(params = {}) {
const parts = [];
if (params.page) parts.push(`page=${encodeURIComponent(params.page)}`);
if (params.page_size) parts.push(`page_size=${encodeURIComponent(params.page_size)}`);
if (params.search) parts.push(`search=${encodeURIComponent(params.search)}`);
if (params.only_available) parts.push('only_available=true');
if (params.without_cost) parts.push('without_cost=true');
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/inventory/batches${qs}`);
}
function fetchInventoryBatchReports(inventoryId) {
return request(`/mobile/inventory/batches/${encodeURIComponent(inventoryId)}/reports`);
}
function uploadInventoryBatchReports(inventoryId, payload = {}) {
return request(`/mobile/inventory/batches/${encodeURIComponent(inventoryId)}/reports`, {
method: 'POST',
data: {
files: payload.files || [],
report_type: payload.report_type || undefined,
report_no: payload.report_no || undefined,
},
timeout: 120000,
});
}
/** 批量上传报告:上传 + 解析,返回候选批次(与 Web 页级「上传报告」同一 service) */
function parseInventoryBatchReports(payload = {}) {
return request('/mobile/inventory/batch-reports/parse', {
method: 'POST',
data: {
files: payload.files || [],
report_type: payload.report_type || undefined,
report_no: payload.report_no || undefined,
},
timeout: 120000,
});
}
/** 确认报告要绑定到哪些入库批次 */
function confirmInventoryBatchReportMatches(reportId, matches) {
return request(
`/mobile/inventory/batch-reports/${encodeURIComponent(reportId)}/confirm`,
{
method: 'POST',
data: { matches: Array.isArray(matches) ? matches : [] },
timeout: 60000,
}
);
}
function deleteInventoryBatchReport(reportId) {
return request(`/mobile/inventory/batch-reports/${encodeURIComponent(reportId)}`, {
method: 'DELETE',
});
}
function updateInventoryBatchCostPrice(inventoryId, costPrice) {
return request(`/mobile/inventory/batches/${encodeURIComponent(inventoryId)}/cost-price`, {
method: 'POST',
data: { cost_price: costPrice },
});
}
function updateInventoryBatchAvailableQty(inventoryId, availableQty) {
return request(`/mobile/inventory/batches/${encodeURIComponent(inventoryId)}/available-qty`, {
method: 'POST',
data: { available_qty: availableQty },
});
}
function fetchStockInboundCategories() {
return request('/mobile/inventory/categories');
}
function fetchStockInboundStorageZones() {
return request('/mobile/inventory/storage-zones');
}
function createStockInboundCategory(name) {
return request('/mobile/inventory/categories', {
method: 'POST',
data: { name },
});
}
function recognizeStockInboundCatalog(payload) {
return request('/mobile/inventory/recognize-catalog', {
method: 'POST',
data: payload,
});
}
function fetchStockInboundSkuSimilar(params = {}) {
const parts = [];
if (params.name) parts.push(`name=${encodeURIComponent(params.name)}`);
if (params.spec) parts.push(`spec=${encodeURIComponent(params.spec)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/inventory/sku-similar${qs}`);
}
function fetchStockInboundSkuOptions(params = {}) {
const parts = [];
if (params.search) parts.push(`search=${encodeURIComponent(params.search)}`);
if (params.limit) parts.push(`limit=${encodeURIComponent(params.limit)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/inventory/sku-options${qs}`);
}
function createStockInboundProduct(payload) {
return request('/mobile/catalog/products', {
method: 'POST',
data: payload,
});
}
function submitStockInbound(payload) {
return request('/mobile/inventory/stock-in', {
method: 'POST',
data: payload,
});
}
/** 多商品识别(送货单/实物堆):单张图 → 多行 + 逐行匹配 */
function recognizeStockInboundLines(payload) {
return request('/mobile/inventory/recognize-lines', {
method: 'POST',
data: payload,
});
}
/** 小程序库存入库:上传批次报告后只解析(不落库)→ 返回品名/生产日期 + 与待入库行的匹配建议 */
function parseStockInboundBatchReport(payload) {
return request('/mobile/inventory/batch-report/parse', {
method: 'POST',
data: payload,
});
}
/** 多商品审核后批量入库 */
function submitStockInboundBatch(payload) {
return request('/mobile/inventory/stock-in-batch', {
method: 'POST',
data: payload,
});
}
function fetchPickingTasks(params = {}) {
const parts = [];
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
if (params.date_field) parts.push(`date_field=${encodeURIComponent(params.date_field)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/picking/tasks${qs}`);
}
function fetchPickingWeighDevices(opts = {}) {
const mine = opts === true || opts.mine === true;
const online = opts && typeof opts === 'object' && opts.online === true;
const parts = [];
if (mine) parts.push('mine=1');
if (online) parts.push('online=1');
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/picking/weigh-devices${qs}`);
}
function createPickingPrintJobs(payload) {
return request('/mobile/picking/print-jobs', {
method: 'POST',
data: payload,
});
}
function savePickingProgress(payload) {
return request('/mobile/picking/progress', {
method: 'POST',
data: payload,
});
}
function confirmPickingComplete(payload) {
return request('/mobile/picking/complete', {
method: 'POST',
data: payload,
});
}
function fetchPickingOutboundBatches(pickItemId) {
const id = String(pickItemId || '').trim();
const qs = id ? `?pick_item_id=${encodeURIComponent(id)}` : '';
return request(`/mobile/picking/outbound-batches${qs}`);
}
/** 分拣 · 拍包装照读生产日期(用于按生产日期匹配出库批次,AI-30) */
function recognizePickingProductionDate(payload) {
return request('/mobile/picking/recognize-production-date', {
method: 'POST',
data: payload,
});
}
function scanPickingBarcode(payload) {
return request('/mobile/picking/scan', {
method: 'POST',
data: payload,
});
}
function searchPurchaseSkus(q) {
const query = String(q || '').trim();
const qs = query ? `?q=${encodeURIComponent(query)}` : '';
return request(`/mobile/purchase/skus${qs}`);
}
function createSelfPurchaseStockInbound(payload) {
return request('/mobile/purchase/self-purchase-stock-inbound', {
method: 'POST',
data: payload,
});
}
function fetchPurchaseOrders(params = {}) {
const parts = [];
if (params.all_pending) parts.push('all_pending=1');
if (params.delivery_date) parts.push(`delivery_date=${encodeURIComponent(params.delivery_date)}`);
if (params.category_code) parts.push(`category_code=${encodeURIComponent(params.category_code)}`);
if (params.view) parts.push(`view=${encodeURIComponent(params.view)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
if (params.date_field) parts.push(`date_field=${encodeURIComponent(params.date_field)}`);
if (params.scope) parts.push(`scope=${encodeURIComponent(params.scope)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/purchase/orders${qs}`);
}
function fetchAdminPurchaseOrders(params = {}) {
const parts = [];
if (params.view) parts.push(`view=${encodeURIComponent(params.view)}`);
if (params.status_group) parts.push(`status_group=${encodeURIComponent(params.status_group)}`);
if (params.category_code) parts.push(`category_code=${encodeURIComponent(params.category_code)}`);
if (params.category) parts.push(`category=${encodeURIComponent(params.category)}`);
if (params.search) parts.push(`search=${encodeURIComponent(params.search)}`);
if (params.source_type) parts.push(`source_type=${encodeURIComponent(params.source_type)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
if (params.date_field) parts.push(`date_field=${encodeURIComponent(params.date_field)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/admin/purchase/orders${qs}`);
}
function completeAdminPurchase(payload) {
return request('/workflow/purchase/complete', {
method: 'POST',
data: payload,
});
}
function setAdminPurchaseSelfProcessed(purchaseCode, selfProcessed) {
return request('/workflow/purchase/self-process', {
method: 'POST',
data: { purchase_code: purchaseCode, self_processed: selfProcessed },
});
}
function fetchAdminPurchaseAssignSuppliers(purchaseCode) {
return request(
`/workflow/purchase/assign-suppliers?purchase_code=${encodeURIComponent(purchaseCode)}`
);
}
function assignAdminPurchaseToSupplier(payload) {
return request('/workflow/purchase/assign-supplier', {
method: 'POST',
data: payload,
});
}
function amendAdminPurchaseActual(purchaseCode, payload) {
return request(`/workflow/purchase/${encodeURIComponent(purchaseCode)}/amend-actual`, {
method: 'PATCH',
data: payload,
});
}
function updateAdminPurchaseSalePrice(purchaseCode, salePrice) {
return request(`/workflow/purchase/${encodeURIComponent(purchaseCode)}/linked-sale-price`, {
method: 'PATCH',
data: { sale_price: salePrice },
});
}
function fetchAdminPurchasePurchasers() {
return request('/workflow/purchase/purchasers');
}
function patchAdminPurchasePurchaser(purchaseCode, purchaserCode) {
return request(`/workflow/purchase/${encodeURIComponent(purchaseCode)}/purchaser`, {
method: 'PATCH',
data: { purchaser_code: purchaserCode },
});
}
function assignAdminPurchasePurchasers(payload) {
return request('/workflow/purchase/assign-purchasers', {
method: 'POST',
data: payload,
});
}
function fetchPurchaseCategories() {
return request('/mobile/purchase/categories');
}
function createPurchaseCategory(name) {
return request('/mobile/purchase/categories', {
method: 'POST',
data: { name },
});
}
function fetchPurchaseAssignSuppliers(purchaseCode) {
return request(`/workflow/purchase/assign-suppliers?purchase_code=${encodeURIComponent(purchaseCode)}`);
}
function assignPurchaseToSupplier(payload) {
return request('/workflow/purchase/assign-supplier', {
method: 'POST',
data: payload,
});
}
function fetchUiPreference(key) {
return request(`/mobile/ui-preferences/${encodeURIComponent(key)}`);
}
function setUiPreference(key, value) {
return request(`/mobile/ui-preferences/${encodeURIComponent(key)}`, {
method: 'PUT',
data: { value },
});
}
function fetchPurchaserSupplierStatus(params = {}) {
const parts = [];
if (params.all_pending) parts.push('all_pending=1');
if (params.delivery_date) parts.push(`delivery_date=${encodeURIComponent(params.delivery_date)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/purchase/supplier-status${qs}`);
}
function completePurchaserSupplierInspectionBatch(payload) {
return request('/mobile/purchase/supplier-inspection/complete-batch', {
method: 'POST',
data: payload,
});
}
function updatePurchaseOrderStatus(payload) {
return request('/mobile/purchase/orders/status', {
method: 'POST',
data: payload,
});
}
function uploadPurchaseDirectDeliveryPhoto(payload) {
return request('/mobile/purchase/direct-delivery-photo', {
method: 'POST',
data: payload,
});
}
function fetchOrderEntryCustomers() {
return request('/mobile/order-entry/customers');
}
/** 录单员:客户生效报价单价目(成本/售价) */
function fetchOrderEntryQuotePrices(customerCode) {
return request(`/mobile/order-entry/quote-prices/${encodeURIComponent(customerCode)}`);
}
function searchOrderEntrySkus(params = {}) {
const parts = [];
if (params.customer_code) parts.push(`customer_code=${encodeURIComponent(params.customer_code)}`);
if (params.q) parts.push(`q=${encodeURIComponent(params.q)}`);
return request(`/mobile/order-entry/skus?${parts.join('&')}`);
}
/** 录单员:写回生效报价单成本价 */
function upsertOrderEntryQuoteCosts(payload) {
return request('/mobile/order-entry/quote-costs', {
method: 'POST',
data: payload,
});
}
function submitOrderEntryOrder(payload) {
return request('/mobile/order-entry/orders', {
method: 'POST',
data: payload,
});
}
/** 散客录单:与 Web 同源(`submitRetailOrder`)—— 建单即全额库存抵扣,无采购/分拣/配送 */
function submitRetailOrderEntry(payload) {
return request('/mobile/order-entry/retail-orders', {
method: 'POST',
data: payload,
});
}
/** 提交订单;若需新建基础商品则弹窗确认后带 confirm_new_products 重试 */
function submitOrderWithCatalogConfirm(submitFn, payload) {
return submitFn({ ...payload, confirm_new_products: false }).catch((err) => {
const code = err?.body?.error;
if (code !== 'needs_confirm_new_products') {
throw err;
}
const names = (err.body?.new_products || [])
.map((row) => row.name)
.filter(Boolean);
const unique = [...new Set(names)];
const preview = unique.slice(0, 8).join('、');
const more = unique.length > 8 ? `等共 ${unique.length} 个` : '';
const content =
err.message ||
`有 ${unique.length || names.length} 个商品不在基础商品库,确认后将自动创建:${preview}${more}`;
return new Promise((resolve, reject) => {
wx.showModal({
title: '自动创建基础商品',
content,
confirmText: '确认创建',
cancelText: '取消',
success(res) {
if (!res.confirm) {
reject(Object.assign(new Error('已取消提交'), { cancelled: true }));
return;
}
submitFn({ ...payload, confirm_new_products: true }).then(resolve).catch(reject);
},
fail: () => reject(new Error('确认失败')),
});
});
});
}
function fetchOrderEntryDetail(orderCode) {
return request(`/mobile/order-entry/orders/${encodeURIComponent(orderCode)}`);
}
function updateOrderEntryOrder(orderCode, payload) {
return request(`/mobile/order-entry/orders/${encodeURIComponent(orderCode)}`, {
method: 'PATCH',
data: payload,
});
}
function fetchCustomerOrderPrefill(customerCode) {
return request(`/mobile/customer-order/prefill/${encodeURIComponent(customerCode)}`);
}
function fetchCustomerOrderBudget(customerCode, orderAmount = 0) {
return request(
`/mobile/customer-order/budget/${encodeURIComponent(customerCode)}?order_amount=${Number(orderAmount) || 0}`
);
}
function submitOrderEntryOrderWithConfirm(payload) {
return submitOrderWithCatalogConfirm(submitOrderEntryOrder, payload);
}
function parseCustomerOrder(payload) {
return request('/mobile/customer-order/parse', {
method: 'POST',
data: payload,
});
}
function fetchOrderCategories() {
return request('/mobile/customer-order/categories');
}
function fetchCustomerMappingSkus(customerCode) {
const qs = customerCode ? `?customer_code=${encodeURIComponent(customerCode)}` : '';
return request(`/mobile/customer-order/customer-skus${qs}`);
}
function createOrderCategory(name) {
return request('/mobile/customer-order/categories', {
method: 'POST',
data: { name },
});
}
function fetchProcessingTasks(params = {}) {
const tab = params.tab || 'work';
const parts = [`tab=${encodeURIComponent(tab)}`];
if (params.delivery_date) parts.push(`delivery_date=${encodeURIComponent(params.delivery_date)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
if (params.date_field) parts.push(`date_field=${encodeURIComponent(params.date_field)}`);
return request(`/mobile/processing/tasks?${parts.join('&')}`);
}
function fetchStandaloneProcessingSkuOptions(search = '', limit = 20) {
const parts = [];
if (search) parts.push(`search=${encodeURIComponent(search)}`);
if (limit) parts.push(`limit=${encodeURIComponent(limit)}`);
return request(`/mobile/processing/standalone/sku-options?${parts.join('&')}`);
}
function createStandaloneProcessingTask(payload) {
// payload 支持多行原料 `materials: [{sku_code, qty}]` 与幂等键 `client_request_no`(2026-10-23)
return request('/mobile/processing/standalone/create', {
method: 'POST',
data: payload,
});
}
/** 独立加工完工:申报成品(多行)→ 成品回仓(与 Web 同一服务) */
function completeStandaloneProcessingTask(taskId, payload) {
return request(`/mobile/processing/standalone/${encodeURIComponent(taskId)}/complete`, {
method: 'POST',
data: payload,
});
}
/** 独立加工单的原料行 / 成品行 */
function listStandaloneLines(taskId) {
return request(`/mobile/processing/standalone/${encodeURIComponent(taskId)}/lines`);
}
function pickDemandSheetMaterial(taskId, payload) {
return request(`/mobile/processing/demand/${encodeURIComponent(taskId)}/pick`, {
method: 'POST',
data: payload,
});
}
function skipWarehouseDemandPurchase(purchaseCode) {
return request('/workflow/purchase/skip-warehouse-demand', {
method: 'POST',
data: { purchase_code: purchaseCode },
});
}
function startProcessingTask(taskId) {
return request('/mobile/processing/start', {
method: 'POST',
data: { task_id: taskId },
});
}
function completeProcessingWork(payload) {
return request('/mobile/processing/complete', {
method: 'POST',
data: payload,
});
}
function uploadProcessingInspectPhoto(payload) {
return request('/mobile/processing/inspect/photo', {
method: 'POST',
data: payload,
});
}
function submitProcessingInspection(payload) {
return request('/mobile/processing/inspect/complete', {
method: 'POST',
data: payload,
});
}
function fetchNotifications(limit) {
const params = {};
const max = Number(limit);
if (max > 0) params.limit = max;
return request('/mobile/notifications', { data: params });
}
function markAllNotificationsRead() {
return request('/mobile/notifications/mark-all-read', { method: 'POST' });
}
function fetchOrdersManagement(params = {}) {
const data = {};
Object.keys(params || {}).forEach((key) => {
const value = params[key];
if (value === undefined || value === null || value === '') return;
data[key] = value;
});
return request('/mobile/orders/management-list', { data });
}
function fetchOrderManageDetail(orderCode) {
const code = String(orderCode || '').trim();
return request(`/mobile/orders/${encodeURIComponent(code)}`);
}
function searchOrderManageSkus(params = {}) {
const parts = [];
if (params.q) parts.push(`q=${encodeURIComponent(params.q)}`);
if (params.customer_code) parts.push(`customer_code=${encodeURIComponent(params.customer_code)}`);
if (params.branch_code) parts.push(`branch_code=${encodeURIComponent(params.branch_code)}`);
return request(`/mobile/admin/skus?${parts.join('&')}`);
}
function resolveOrderManageCatalogProduct(payload) {
return request('/mobile/admin/catalog-products/resolve', {
method: 'POST',
data: payload,
});
}
function updateOrderManage(orderCode, payload) {
return request(`/mobile/orders/${encodeURIComponent(orderCode)}`, {
method: 'PATCH',
data: payload,
});
}
function advanceOrderManage(orderCode, targetStatus) {
return request('/mobile/orders/advance', {
method: 'POST',
data: { order_code: orderCode, target_status: targetStatus },
});
}
/**
* 散客录单:一键「确认扣除并完结」(30 → 90)。
* 后端调与 Web 同源的 `confirmRetailOrderComplete`(硬扣 `retail_out`);
* 散客单**不能**走 `advanceOrderManage`(服务端会 409 `retail_order_not_advanceable`)。
*/
function confirmRetailOrder(orderCode) {
return request('/mobile/orders/retail-confirm', {
method: 'POST',
data: { order_code: orderCode },
});
}
function deleteOrderManage(orderCode) {
return request('/mobile/orders/delete', {
method: 'POST',
data: { order_code: orderCode },
});
}
function searchProductTrace(params = {}) {
const q = typeof params === 'string' ? params : String(params.q || '');
const input = typeof params === 'string' ? { q } : params || {};
const qs = [];
if (q) qs.push(`q=${encodeURIComponent(q)}`);
if (input.date_from) qs.push(`date_from=${encodeURIComponent(input.date_from)}`);
if (input.date_to) qs.push(`date_to=${encodeURIComponent(input.date_to)}`);
if (input.date_field) qs.push(`date_field=${encodeURIComponent(input.date_field)}`);
if (input.limit) qs.push(`limit=${encodeURIComponent(input.limit)}`);
if (input.offset != null && input.offset !== '') qs.push(`offset=${encodeURIComponent(input.offset)}`);
const suffix = qs.length ? `?${qs.join('&')}` : '';
return request(`/mobile/trace/search${suffix}`, { method: 'GET' });
}
function fetchProductTrace(batchNo) {
return request(`/mobile/trace/batch/${encodeURIComponent(batchNo || '')}`, { method: 'GET' });
}
function fetchUnits() {
return request('/mobile/units', { method: 'GET' });
}
function fetchFreeCostTypes() {
return request('/workflow/cost/free-cost/types', { method: 'GET' });
}
function fetchFreeCostSettings() {
return request('/workflow/cost/free-cost/settings', { method: 'GET' });
}
function addFreeCostType(label) {
return request('/workflow/cost/free-cost/types', {
method: 'POST',
data: { label },
});
}
function fetchFreeCostEntries(params = {}) {
const qs = [];
if (params.cycle_code) qs.push(`cycle_code=${encodeURIComponent(params.cycle_code)}`);
if (params.page) qs.push(`page=${encodeURIComponent(params.page)}`);
if (params.page_size) qs.push(`page_size=${encodeURIComponent(params.page_size)}`);
qs.push('mine=1');
return request(`/workflow/cost/free-cost/entries?${qs.join('&')}`, { method: 'GET' });
}
function createFreeCostEntry(payload) {
return request('/workflow/cost/free-cost', {
method: 'POST',
data: payload,
});
}
/**
* 凭证识图。优先 voucher_path(服务端读已上传文件,避免真机大图 base64 超 JSON 限制)。
* @param {{ voucher_path?: string, image_base64?: string }|string} payload
*/
function extractFreeCostVoucherAmount(payload) {
const data =
payload && typeof payload === 'object' && !Array.isArray(payload)
? payload
: { image_base64: String(payload || '') };
return request('/workflow/cost/free-cost/voucher-amount', {
method: 'POST',
data,
timeout: 120000,
});
}
function uploadFreeCostVoucher(filePath) {
const session = getSession();
const ext = String(filePath.split('.').pop() || 'jpg').toLowerCase().replace(/[^a-z0-9]/g, '') || 'jpg';
return new Promise((resolve, reject) => {
wx.uploadFile({
url: `${config.apiBase}/storage/invoices/upload`,
filePath,
name: 'file',
formData: { path: `free-cost/voucher.${ext}` },
header: session?.access_token ? { Authorization: `Bearer ${session.access_token}` } : {},
success(res) {
let body = {};
try {
body = typeof res.data === 'string' ? JSON.parse(res.data) : res.data || {};
} catch (_) {
body = {};
}
if (res.statusCode >= 200 && res.statusCode < 300 && body.path) {
resolve(body);
return;
}
if (res.statusCode === 401) {
const code = readErrorCode(body) || 'invalid_token';
maybeRedirectOnUnauthorized(true, false, code);
}
reject(new Error(body.error_description || body.error || `上传失败(${res.statusCode})`));
},
fail(err) {
reject(new Error(err.errMsg || '上传失败'));
},
});
});
}
/** 分拣出库留证照片上传(bucket=delivery-photos),返回对象路径;与自由成本凭证同款 wx.uploadFile。 */
function uploadPickingOutboundPhoto(filePath) {
const session = getSession();
const ext = String((filePath || '').split('.').pop() || 'jpg').toLowerCase().replace(/[^a-z0-9]/g, '') || 'jpg';
return new Promise((resolve, reject) => {
wx.uploadFile({
url: `${config.apiBase}/storage/delivery-photos/upload`,
filePath,
name: 'file',
formData: { path: `picking-outbound.${ext}` },
header: session?.access_token ? { Authorization: `Bearer ${session.access_token}` } : {},
success(res) {
let body = {};
try {
body = typeof res.data === 'string' ? JSON.parse(res.data) : res.data || {};
} catch (_) {
body = {};
}
if (res.statusCode >= 200 && res.statusCode < 300 && body.path) {
resolve(body.path);
return;
}
reject(new Error(body.error_description || body.error || `上传失败(${res.statusCode})`));
},
fail(err) {
reject(new Error(err.errMsg || '上传失败'));
},
});
});
}
function extractFreeCostInvoice(payload) {
return request('/workflow/cost/free-cost/extract-invoice', {
method: 'POST',
data: payload,
timeout: 120000,
});
}
function saveFreeCostInvoice(payload) {
return request('/workflow/cost/free-cost/invoices', {
method: 'POST',
data: payload,
});
}
function uploadFreeCostInvoice(filePath) {
const session = getSession();
const ext = String(filePath.split('.').pop() || 'jpg').toLowerCase().replace(/[^a-z0-9]/g, '') || 'jpg';
return new Promise((resolve, reject) => {
wx.uploadFile({
url: `${config.apiBase}/storage/invoices/upload`,
filePath,
name: 'file',
formData: { path: `free-cost-invoice/invoice.${ext}` },
header: session?.access_token ? { Authorization: `Bearer ${session.access_token}` } : {},
success(res) {
let body = {};
try {
body = typeof res.data === 'string' ? JSON.parse(res.data) : res.data || {};
} catch (_) {
body = {};
}
if (res.statusCode >= 200 && res.statusCode < 300 && body.path) {
resolve(body);
return;
}
if (res.statusCode === 401) {
const code = readErrorCode(body) || 'invalid_token';
maybeRedirectOnUnauthorized(true, false, code);
}
reject(new Error(body.error_description || body.error || `上传失败(${res.statusCode})`));
},
fail(err) {
reject(new Error(err.errMsg || '上传失败'));
},
});
});
}
/** 下单客户商城(2026-10-30):归属由服务端从绑定表推导,客户端不传 customer_code。 */
function fetchMallBootstrap() {
return request('/mobile/mall/bootstrap').then((body) => (body && body.data) || {});
}
function fetchMallProducts(params) {
return request('/mobile/mall/products', { data: params || {} }).then((body) => (body && body.data) || {});
}
function submitMallOrder(payload) {
return request('/mobile/mall/orders', { method: 'POST', data: payload || {} }).then((body) => (body && body.data) || {});
}
function saveMallAddress(address) {
return request('/mobile/mall/address', { method: 'PUT', data: { address } }).then((body) => (body && body.data) || {});
}
/** 下单客户溯源(order_customer):订单维度,只返回展示字段。 */
function fetchCustomerTraceOrders(params = {}) {
const parts = [];
if (params.q) parts.push(`q=${encodeURIComponent(params.q)}`);
if (params.date_from) parts.push(`date_from=${encodeURIComponent(params.date_from)}`);
if (params.date_to) parts.push(`date_to=${encodeURIComponent(params.date_to)}`);
if (params.limit) parts.push(`limit=${encodeURIComponent(params.limit)}`);
if (params.offset) parts.push(`offset=${encodeURIComponent(params.offset)}`);
const qs = parts.length ? `?${parts.join('&')}` : '';
return request(`/mobile/customer-trace/orders${qs}`);
}
function fetchCustomerTraceOrder(orderCode) {
return request(`/mobile/customer-trace/orders/${encodeURIComponent(orderCode || '')}`);
}
/** 需求单领料:BOM 明细(原材料、可用库存、损耗率) */
function fetchDemandProcessingBom(taskId) {
return request(`/mobile/processing/demand/${encodeURIComponent(taskId || '')}/bom`);
}
/** 需求单完工:按实际产出预览客户分配 */
function previewDemandFinishedOutput(taskId, actualQty) {
return request(
`/mobile/processing/demand/${encodeURIComponent(taskId || '')}/finished-output-preview?actual_qty=${encodeURIComponent(actualQty)}`
);
}
module.exports = {
request,
fetchCustomerTraceOrders,
fetchCustomerTraceOrder,
fetchMallBootstrap,
fetchMallProducts,
submitMallOrder,
saveMallAddress,
login,
loginByPhone,
loginChooseBranch,
fetchMe,
fetchMobileRoles,
fetchMobileBadges,
switchMobileRole,
fetchDeliveryTasks,
fetchDeliveryLoading,
uploadDeliveryLoadingPhoto,
confirmDeliveryLoadingItem,
unconfirmDeliveryLoadingItem,
scanDeliveryLoading,
startDelivery,
startDeliveryBatch,
fetchDeliveryPresence,
setDeliveryOnline,
setDeliveryOffline,
stopDelivery,
reportDeliveryLocation,
uploadDeliverySignPhoto,
fetchSupplierPreparations,
fetchSupplierBids,
fetchSupplierBidDetail,
submitSupplierBidQuotes,
fetchAdminPreparations,
updateAdminPreparationStatus,
updateAdminPreparationPurchasePrice,
transferAdminPreparationStockout,
updateSupplierPreparationStatus,
amendSupplierPreparationPrice,
uploadSupplierQualityReport,
uploadQualityReportStorageFile,
confirmSupplierQualityReportHits,
discardSupplierQualityReport,
fetchSupplierQualityReports,
fetchSupplierQualityReportTypes,
uploadPurchaseQualityReport,
fetchPrepAmendPending,
fetchPrepAmendReviewed,
fetchPrepAmendPendingCount,
fetchPrepAmendDetail,
confirmPrepAmend,
rejectPrepAmend,
searchPurchaserOrderCustomers,
fetchPurchaserOrderList,
fetchPurchaserOrderDetail,
searchPurchaserOrderSkus,
savePurchaserOrderItems,
updatePurchaserOrder,
fetchSubstitutionCandidates,
submitSupplierSubstitution,
fetchInspectionTasks,
completeInspection,
createInspectionBatchReports,
uploadInspectionPhoto,
deleteInspectionPhoto,
analyzeInspectionQuality,
fetchStockInboundCategories,
fetchStockInboundStorageZones,
createStockInboundCategory,
recognizeStockInboundCatalog,
fetchStockInboundSkuSimilar,
fetchStockInboundSkuOptions,
// 仓库管理(小程序)
fetchInventoryBatches,
fetchInventoryBatchReports,
uploadInventoryBatchReports,
parseInventoryBatchReports,
confirmInventoryBatchReportMatches,
deleteInventoryBatchReport,
updateInventoryBatchCostPrice,
updateInventoryBatchAvailableQty,
createStockInboundProduct,
submitStockInbound,
recognizeStockInboundLines,
submitStockInboundBatch,
parseStockInboundBatchReport,
fetchPickingTasks,
fetchPickingWeighDevices,
createPickingPrintJobs,
savePickingProgress,
confirmPickingComplete,
fetchPickingOutboundBatches,
recognizePickingProductionDate,
scanPickingBarcode,
searchPurchaseSkus,
createSelfPurchaseStockInbound,
fetchPurchaseOrders,
fetchAdminPurchaseOrders,
completeAdminPurchase,
setAdminPurchaseSelfProcessed,
fetchAdminPurchaseAssignSuppliers,
assignAdminPurchaseToSupplier,
amendAdminPurchaseActual,
updateAdminPurchaseSalePrice,
fetchAdminPurchasePurchasers,
patchAdminPurchasePurchaser,
assignAdminPurchasePurchasers,
fetchPurchaseCategories,
createPurchaseCategory,
fetchPurchaseAssignSuppliers,
assignPurchaseToSupplier,
fetchUiPreference,
setUiPreference,
fetchPurchaserSupplierStatus,
completePurchaserSupplierInspectionBatch,
updatePurchaseOrderStatus,
uploadPurchaseDirectDeliveryPhoto,
fetchOrderEntryCustomers,
fetchOrderEntryQuotePrices,
searchOrderEntrySkus,
upsertOrderEntryQuoteCosts,
submitOrderEntryOrder,
submitOrderEntryOrderWithConfirm,
submitRetailOrderEntry,
fetchOrderEntryDetail,
updateOrderEntryOrder,
fetchCustomerOrderPrefill,
fetchCustomerOrderBudget,
parseCustomerOrder,
fetchOrderCategories,
fetchCustomerMappingSkus,
createOrderCategory,
fetchProcessingTasks,
fetchStandaloneProcessingSkuOptions,
createStandaloneProcessingTask,
completeStandaloneProcessingTask,
listStandaloneLines,
pickDemandSheetMaterial,
fetchDemandProcessingBom,
previewDemandFinishedOutput,
skipWarehouseDemandPurchase,
startProcessingTask,
completeProcessingWork,
uploadProcessingInspectPhoto,
submitProcessingInspection,
fetchNotifications,
markAllNotificationsRead,
fetchOrdersManagement,
fetchOrderManageDetail,
searchOrderManageSkus,
resolveOrderManageCatalogProduct,
updateOrderManage,
advanceOrderManage,
confirmRetailOrder,
deleteOrderManage,
searchProductTrace,
fetchProductTrace,
fetchUnits,
fetchFreeCostTypes,
fetchFreeCostSettings,
addFreeCostType,
fetchFreeCostEntries,
createFreeCostEntry,
extractFreeCostVoucherAmount,
uploadFreeCostVoucher,
uploadPickingOutboundPhoto,
extractFreeCostInvoice,
saveFreeCostInvoice,
uploadFreeCostInvoice,
};