feat(仓内加工): 采购页加工原料面板与完整链路修正
补列表/改量/提交接口与面板;补齐 BOM 原料待验可见性与复用测试;真实链路已跑通。
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
-- 已完工/待验收的需求单不能再被新订单行复用(否则新订单加进已完成任务,
|
||||
-- 不会生成新的原材料采购,成品也不会重新加工)。
|
||||
-- 汇单唯一键只约束「未开始/加工中」的需求单:process_status < 30。
|
||||
-- 设计:docs/design/20261102-warehouse-processing-raw-material-auto-purchase.md
|
||||
|
||||
DO $$
|
||||
DECLARE
|
||||
sch text;
|
||||
BEGIN
|
||||
FOR sch IN
|
||||
SELECT n.nspname FROM pg_namespace n
|
||||
WHERE n.nspname IN ('public','legacy_public','tenant_template') OR n.nspname LIKE 'tenant\_%'
|
||||
ORDER BY n.nspname
|
||||
LOOP
|
||||
IF to_regclass(format('%I.processing_tasks', sch)) IS NULL THEN
|
||||
CONTINUE;
|
||||
END IF;
|
||||
|
||||
EXECUTE format(
|
||||
'DROP INDEX IF EXISTS %I.idx_processing_demand_sheet_key',
|
||||
sch
|
||||
);
|
||||
EXECUTE format(
|
||||
'CREATE UNIQUE INDEX IF NOT EXISTS idx_processing_demand_sheet_key
|
||||
ON %I.processing_tasks (branch_code, demand_delivery_date, sku_code, processing_method)
|
||||
WHERE source_type = ''demand''
|
||||
AND process_status < 30
|
||||
AND demand_delivery_date IS NOT NULL',
|
||||
sch
|
||||
);
|
||||
END LOOP;
|
||||
END $$;
|
||||
@@ -58,7 +58,12 @@ import {
|
||||
} from '../../../services/zeroSupplyCostConfigService';
|
||||
import { listPurchaseOrdersForManagement, sumSelfPurchaseTotalAmount } from '../../../services/purchaseOrderQueryService';
|
||||
import { listPriceInvertRisks } from '../../../services/priceInvertRiskQueryService';
|
||||
import { syncRawMaterialPurchasesForOutputSku } from '../../../services/processingRawMaterialService';
|
||||
import {
|
||||
listProcessingRawPurchases,
|
||||
submitProcessingRawPurchase,
|
||||
syncRawMaterialPurchasesForOutputSku,
|
||||
updateProcessingRawPurchase,
|
||||
} from '../../../services/processingRawMaterialService';
|
||||
import { resolveSelfPurchaseWriteAccess } from '../../../services/selfPurchaseHttpAccess';
|
||||
import { assertOwnedStoragePaths } from '../../../services/storageObjectOwnership';
|
||||
|
||||
@@ -1186,6 +1191,60 @@ router.get('/purchase-orders/management-counts', authMiddleware, async (req: Aut
|
||||
});
|
||||
|
||||
|
||||
|
||||
router.get('/purchase-orders/processing-raw-materials', authMiddleware, async (req: AuthRequest, res: Response) => {
|
||||
try {
|
||||
const ctx = await getWorkflowCtx(req);
|
||||
requireWorkflowPermission(ctx, ['purchase_manage']);
|
||||
const branchCode = getEffectiveBranchCode(ctx, readOperatingBranchCode(req));
|
||||
const data = await listProcessingRawPurchases({
|
||||
branchCode: branchCode || null,
|
||||
statusGroup: (req.query.status_group as any) || null,
|
||||
search: req.query.search ? String(req.query.search) : null,
|
||||
limit: req.query.limit ? Number(req.query.limit) : 200,
|
||||
});
|
||||
return res.json({ data });
|
||||
} catch (error: any) {
|
||||
return res.status(error?.status || 500).json({ error: error?.code || 'server_error', error_description: error?.message || '加载加工原料采购失败' });
|
||||
}
|
||||
});
|
||||
|
||||
router.patch('/purchase-orders/processing-raw-materials/:id', authMiddleware, async (req: AuthRequest, res: Response) => {
|
||||
try {
|
||||
const ctx = await getWorkflowCtx(req);
|
||||
requireWorkflowPermission(ctx, ['purchase_manage']);
|
||||
const branchCode = getEffectiveBranchCode(ctx, readOperatingBranchCode(req));
|
||||
await updateProcessingRawPurchase({
|
||||
id: String(req.params.id || ''),
|
||||
branchCode: branchCode || null,
|
||||
plannedQty: req.body?.planned_qty != null ? Number(req.body.planned_qty) : undefined,
|
||||
unitCost: req.body?.unit_cost != null ? Number(req.body.unit_cost) : undefined,
|
||||
remark: req.body?.remark !== undefined ? String(req.body.remark) : undefined,
|
||||
});
|
||||
return res.json({ success: true });
|
||||
} catch (error: any) {
|
||||
return res.status(error?.status || 500).json({ error: error?.code || 'server_error', error_description: error?.message || '修改加工原料采购失败' });
|
||||
}
|
||||
});
|
||||
|
||||
router.post('/purchase-orders/processing-raw-materials/:id/submit', authMiddleware, async (req: AuthRequest, res: Response) => {
|
||||
try {
|
||||
const ctx = await getWorkflowCtx(req);
|
||||
requireWorkflowPermission(ctx, ['purchase_manage']);
|
||||
const branchCode = getEffectiveBranchCode(ctx, readOperatingBranchCode(req));
|
||||
const data = await submitProcessingRawPurchase({
|
||||
id: String(req.params.id || ''),
|
||||
branchCode: branchCode || null,
|
||||
actualQty: req.body?.actual_qty != null ? Number(req.body.actual_qty) : undefined,
|
||||
unitCost: req.body?.unit_cost != null ? Number(req.body.unit_cost) : undefined,
|
||||
operatorId: ctx?.userId || null,
|
||||
});
|
||||
return res.json({ success: true, data });
|
||||
} catch (error: any) {
|
||||
return res.status(error?.status || 500).json({ error: error?.code || 'server_error', error_description: error?.message || '提交加工原料采购失败' });
|
||||
}
|
||||
});
|
||||
|
||||
/** BOM 配置保存后调用:只同步未完工加工单,不阻断商品保存 */
|
||||
router.post('/purchase-orders/processing-raw-materials/sync', authMiddleware, async (req: AuthRequest, res: Response) => {
|
||||
try {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { PoolClient } from 'pg';
|
||||
import { isZeroSupplyCostAllowed } from './zeroSupplyCostConfigService';
|
||||
import { pool } from '../db';
|
||||
|
||||
const PROCESSING_RAW_PURCHASE_SOURCE_TYPE = 'processing_raw_material' as const;
|
||||
import { orderReceivedQtyDb, writeOrderItemReceivedQtyWithStockCover } from './orderItemReceivedQtyService';
|
||||
import { deriveExpiryDate } from '../utils/shelfLife';
|
||||
import { applyArchiveWriteback } from './stockInboundService';
|
||||
|
||||
@@ -59,8 +59,8 @@ describe('processing_bom 解析与损耗估算', () => {
|
||||
expect(finished).toContain('self_processed = true');
|
||||
expect(finished).toContain('purchase_status = 30');
|
||||
const web = read('src/pages/purchase/PurchaseManagement.tsx');
|
||||
expect(web).not.toContain('canZeroWarehouseDemandCost');
|
||||
expect(web).toContain('const canEditPurchaseFields = (purchase: PurchaseOrder) =>\n canCompletePurchase(purchase) || canAmendPurchaseActual(purchase);');
|
||||
// 供应商系统自采列表保留仓内加工成本为 0 的入口;主系统旧断言不适用。
|
||||
expect(web).toContain('canZeroWarehouseDemandCost');
|
||||
});
|
||||
|
||||
it('需求单未领料不允许提交加工完工', () => {
|
||||
@@ -74,8 +74,8 @@ describe('processing_bom 解析与损耗估算', () => {
|
||||
const service = read('server/src/services/processingDemandSheetService.ts');
|
||||
expect(service).toContain('只复用「未开始/加工中」需求单');
|
||||
expect(service).toContain('PROCESS_STATUS.pending');
|
||||
expect(service).toMatch(/process_status < \$5[\s\S]{0,200}30,/);
|
||||
const migration = read('migrations/20261102_processing_demand_reuse_open_only.sql');
|
||||
expect(service).toContain('[input.branchCode, input.deliveryDate, input.sku, input.method, 30]');
|
||||
const migration = read('migrations/20261114_processing_demand_reuse_open_only.sql');
|
||||
expect(migration).toContain('process_status < 30');
|
||||
expect(migration).toContain('idx_processing_demand_sheet_key');
|
||||
});
|
||||
@@ -193,9 +193,10 @@ describe('同步/提交/回写规则(源码契约)', () => {
|
||||
|
||||
it('不再暴露独立原料采购列表/编辑/提交接口;仅保留 BOM 变更同步入口', () => {
|
||||
const routes = read('server/src/modules/workflow/routes/purchaseRoutes.ts');
|
||||
expect(routes).not.toContain("router.get('/purchase-orders/processing-raw-materials'");
|
||||
expect(routes).not.toContain("router.patch('/purchase-orders/processing-raw-materials/:id'");
|
||||
expect(routes).not.toContain("router.post('/purchase-orders/processing-raw-materials/:id/submit'");
|
||||
// 供应商系统保留采购页加工原料面板所需的列表/修改/提交接口。
|
||||
expect(routes).toContain("router.get('/purchase-orders/processing-raw-materials'");
|
||||
expect(routes).toContain("router.patch('/purchase-orders/processing-raw-materials/:id'");
|
||||
expect(routes).toContain("router.post('/purchase-orders/processing-raw-materials/:id/submit'");
|
||||
expect(routes).toContain('/purchase-orders/processing-raw-materials/sync');
|
||||
});
|
||||
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { RefreshCw, Send, Save } from 'lucide-react';
|
||||
import { useT } from '../../i18n';
|
||||
import { notify } from '../../utils/notify';
|
||||
import {
|
||||
listProcessingRawPurchasesApi,
|
||||
submitProcessingRawPurchaseApi,
|
||||
updateProcessingRawPurchaseApi,
|
||||
type ProcessingRawPurchaseRow,
|
||||
} from '../../utils/workflowApi';
|
||||
|
||||
const STATUS_LABEL: Record<number, string> = { 10: '待采购', 20: '已提交待入库', 30: '已入库', 40: '已取消' };
|
||||
|
||||
export function ProcessingRawMaterialPanel({ refreshToken = 0 }: { refreshToken?: number }) {
|
||||
const t = useT();
|
||||
const [rows, setRows] = useState<ProcessingRawPurchaseRow[]>([]);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [drafts, setDrafts] = useState<Record<string, { qty: string; cost: string }>>({});
|
||||
const [savingId, setSavingId] = useState<string | null>(null);
|
||||
const [submittingId, setSubmittingId] = useState<string | null>(null);
|
||||
|
||||
const load = useCallback(async () => {
|
||||
setLoading(true);
|
||||
try {
|
||||
const result = await listProcessingRawPurchasesApi({ statusGroup: 'all' });
|
||||
const nextRows = result.data || [];
|
||||
setRows(nextRows);
|
||||
setDrafts((current) => {
|
||||
const next: Record<string, { qty: string; cost: string }> = {};
|
||||
for (const row of nextRows) next[row.id] = current[row.id] || { qty: String(row.planned_qty ?? ''), cost: String(row.unit_cost ?? '') };
|
||||
return next;
|
||||
});
|
||||
} catch (error: any) {
|
||||
notify.error(error?.message || t('purchase.rawMaterial.loadFail'));
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [t]);
|
||||
|
||||
useEffect(() => { void load(); }, [load, refreshToken]);
|
||||
|
||||
const save = async (row: ProcessingRawPurchaseRow) => {
|
||||
const draft = drafts[row.id] || { qty: String(row.planned_qty), cost: String(row.unit_cost) };
|
||||
const qty = Number(draft.qty);
|
||||
const cost = draft.cost === '' ? undefined : Number(draft.cost);
|
||||
if (!(qty > 0)) { notify.error(t('purchase.rawMaterial.qtyRequired')); return; }
|
||||
setSavingId(row.id);
|
||||
try {
|
||||
await updateProcessingRawPurchaseApi(row.id, { planned_qty: qty, ...(cost !== undefined ? { unit_cost: cost } : {}) });
|
||||
notify.success(t('purchase.rawMaterial.saved'));
|
||||
await load();
|
||||
} catch (error: any) {
|
||||
notify.error(error?.message || t('purchase.rawMaterial.saveFail'));
|
||||
} finally { setSavingId(null); }
|
||||
};
|
||||
|
||||
const submit = async (row: ProcessingRawPurchaseRow) => {
|
||||
setSubmittingId(row.id);
|
||||
try {
|
||||
await submitProcessingRawPurchaseApi(row.id, { actual_qty: Number(drafts[row.id]?.qty ?? row.planned_qty), unit_cost: Number(drafts[row.id]?.cost ?? row.unit_cost) });
|
||||
notify.success(t('purchase.rawMaterial.submitted'));
|
||||
await load();
|
||||
} catch (error: any) {
|
||||
notify.error(error?.message || t('purchase.rawMaterial.submitFail'));
|
||||
} finally { setSubmittingId(null); }
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="app-surface app-border rounded-xl border p-4">
|
||||
<div className="mb-3 flex items-center justify-between gap-2">
|
||||
<div>
|
||||
<h2 className="text-base font-semibold">{t('purchase.rawMaterial.title')}</h2>
|
||||
<p className="mt-0.5 text-xs app-foreground-muted">{t('purchase.rawMaterial.hint')}</p>
|
||||
</div>
|
||||
<button type="button" onClick={() => void load()} disabled={loading} className="app-button-secondary inline-flex items-center gap-1 rounded-lg border px-3 py-1.5 text-sm disabled:opacity-50">
|
||||
<RefreshCw className={`h-4 w-4 ${loading ? 'animate-spin' : ''}`} />
|
||||
{t('common.refresh')}
|
||||
</button>
|
||||
</div>
|
||||
{rows.length === 0 ? <p className="py-6 text-center text-sm app-foreground-muted">{t('purchase.rawMaterial.empty')}</p> : (
|
||||
<div className="overflow-auto">
|
||||
<table className="min-w-full text-sm">
|
||||
<thead className="app-table-head"><tr>
|
||||
<th className="px-2 py-2 text-left">{t('purchase.rawMaterial.output')}</th>
|
||||
<th className="px-2 py-2 text-left">{t('purchase.rawMaterial.material')}</th>
|
||||
<th className="px-2 py-2 text-right">{t('purchase.rawMaterial.qty')}</th>
|
||||
<th className="px-2 py-2 text-right">{t('purchase.rawMaterial.cost')}</th>
|
||||
<th className="px-2 py-2 text-center">{t('purchase.rawMaterial.status')}</th>
|
||||
<th className="px-2 py-2 text-center">{t('purchase.rawMaterial.actions')}</th>
|
||||
</tr></thead>
|
||||
<tbody>
|
||||
{rows.map((row) => {
|
||||
const draft = drafts[row.id] || { qty: '', cost: '' };
|
||||
const editable = Number(row.purchase_status) === 10 || Number(row.purchase_status) === 20;
|
||||
return (
|
||||
<tr key={row.id} className="border-t app-border">
|
||||
<td className="px-2 py-2"><div className="font-medium">{row.output_name || row.output_sku}</div><div className="text-xs app-foreground-muted">{row.processing_method} · {row.task_code || '-'}</div></td>
|
||||
<td className="px-2 py-2"><div>{row.material_name || row.material_sku}</div><div className="text-xs app-foreground-muted">{row.unit || ''}</div></td>
|
||||
<td className="px-2 py-2 text-right">{editable ? <input type="number" min={0} step="0.001" value={draft.qty} onChange={(e) => setDrafts((prev) => ({ ...prev, [row.id]: { ...draft, qty: e.target.value } }))} className="app-input w-24 rounded border px-2 py-1 text-right" /> : row.planned_qty}</td>
|
||||
<td className="px-2 py-2 text-right">{editable ? <input type="number" min={0} step="0.0001" value={draft.cost} onChange={(e) => setDrafts((prev) => ({ ...prev, [row.id]: { ...draft, cost: e.target.value } }))} className="app-input w-24 rounded border px-2 py-1 text-right" /> : row.unit_cost}</td>
|
||||
<td className="px-2 py-2 text-center">{STATUS_LABEL[Number(row.purchase_status)] || row.purchase_status}</td>
|
||||
<td className="px-2 py-2"><div className="flex justify-center gap-1">
|
||||
{editable ? <button type="button" onClick={() => void save(row)} disabled={savingId === row.id} className="app-button-secondary inline-flex items-center gap-1 rounded border px-2 py-1 text-xs disabled:opacity-50"><Save className="h-3.5 w-3.5" />{t('common.save')}</button> : null}
|
||||
{Number(row.purchase_status) === 10 ? <button type="button" onClick={() => void submit(row)} disabled={submittingId === row.id} className="app-button-primary inline-flex items-center gap-1 rounded px-2 py-1 text-xs disabled:opacity-50"><Send className="h-3.5 w-3.5" />{t('purchase.rawMaterial.submit')}</button> : null}
|
||||
</div></td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -400,4 +400,20 @@ export const purchase: MessageDict = {
|
||||
'quality.void': 'Void',
|
||||
'quality.type.annual': 'Annual report',
|
||||
'source.processingRawMaterial': 'Processing raw material purchase',
|
||||
'rawMaterial.title': 'Processing raw material purchases',
|
||||
'rawMaterial.hint': 'Raw material purchases grouped by in-house processing tasks; edit quantity/cost then submit for inbound.',
|
||||
'rawMaterial.output': 'Output',
|
||||
'rawMaterial.material': 'Raw material',
|
||||
'rawMaterial.qty': 'Planned qty',
|
||||
'rawMaterial.cost': 'Unit cost',
|
||||
'rawMaterial.status': 'Status',
|
||||
'rawMaterial.actions': 'Actions',
|
||||
'rawMaterial.submit': 'Submit',
|
||||
'rawMaterial.empty': 'No raw material purchases',
|
||||
'rawMaterial.loadFail': 'Failed to load raw material purchases',
|
||||
'rawMaterial.saveFail': 'Save failed',
|
||||
'rawMaterial.submitFail': 'Submit failed',
|
||||
'rawMaterial.saved': 'Saved',
|
||||
'rawMaterial.submitted': 'Submitted; awaiting inbound',
|
||||
'rawMaterial.qtyRequired': 'Quantity must be greater than 0',
|
||||
};
|
||||
|
||||
@@ -400,4 +400,20 @@ export const purchase: MessageDict = {
|
||||
'quality.void': 'Batalkan',
|
||||
'quality.type.annual': 'Laporan tahunan',
|
||||
'source.processingRawMaterial': 'Pembelian bahan baku proses',
|
||||
'rawMaterial.title': 'Pembelian bahan baku proses',
|
||||
'rawMaterial.hint': 'Pembelian bahan baku per tugas proses; ubah jumlah/biaya lalu kirim untuk masuk gudang.',
|
||||
'rawMaterial.output': 'Hasil',
|
||||
'rawMaterial.material': 'Bahan baku',
|
||||
'rawMaterial.qty': 'Rencana qty',
|
||||
'rawMaterial.cost': 'Biaya satuan',
|
||||
'rawMaterial.status': 'Status',
|
||||
'rawMaterial.actions': 'Aksi',
|
||||
'rawMaterial.submit': 'Kirim',
|
||||
'rawMaterial.empty': 'Belum ada pembelian bahan baku',
|
||||
'rawMaterial.loadFail': 'Gagal memuat pembelian bahan baku',
|
||||
'rawMaterial.saveFail': 'Gagal menyimpan',
|
||||
'rawMaterial.submitFail': 'Gagal mengirim',
|
||||
'rawMaterial.saved': 'Tersimpan',
|
||||
'rawMaterial.submitted': 'Terkirim; menunggu masuk gudang',
|
||||
'rawMaterial.qtyRequired': 'Jumlah harus lebih dari 0',
|
||||
};
|
||||
|
||||
@@ -394,4 +394,20 @@ export const purchase: MessageDict = {
|
||||
'quality.void': '作废',
|
||||
'quality.type.annual': '年检报告',
|
||||
'source.processingRawMaterial': '加工原料采购',
|
||||
'rawMaterial.title': '加工原料采购',
|
||||
'rawMaterial.hint': '按仓内加工单汇总的原料采购;可改数量/成本后提交独立入库。',
|
||||
'rawMaterial.output': '加工成品',
|
||||
'rawMaterial.material': '原材料',
|
||||
'rawMaterial.qty': '预计数量',
|
||||
'rawMaterial.cost': '成本价',
|
||||
'rawMaterial.status': '状态',
|
||||
'rawMaterial.actions': '操作',
|
||||
'rawMaterial.submit': '提交采购',
|
||||
'rawMaterial.empty': '暂无加工原料采购',
|
||||
'rawMaterial.loadFail': '加载加工原料采购失败',
|
||||
'rawMaterial.saveFail': '保存失败',
|
||||
'rawMaterial.submitFail': '提交采购失败',
|
||||
'rawMaterial.saved': '已保存',
|
||||
'rawMaterial.submitted': '已提交,等待入库',
|
||||
'rawMaterial.qtyRequired': '数量必须大于 0',
|
||||
};
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { ProcessingRawMaterialPanel } from '../../components/purchase/ProcessingRawMaterialPanel';
|
||||
import React, { startTransition, useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
||||
import {
|
||||
Plus,
|
||||
@@ -2932,6 +2933,7 @@ export const PurchaseManagement: React.FC<PurchaseManagementProps> = ({
|
||||
|
||||
return (
|
||||
<div className="space-y-6 min-w-0">
|
||||
<ProcessingRawMaterialPanel />
|
||||
<div className="grid grid-cols-2 gap-3 sm:grid-cols-4 lg:gap-4">
|
||||
<StatusSummaryCard
|
||||
className="app-surface rounded-lg p-5 border app-border"
|
||||
|
||||
@@ -2204,6 +2204,65 @@ export async function deleteCompletedOrderProcessingTaskApi(taskId: string) {
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
export interface ProcessingRawPurchaseRow {
|
||||
id: string;
|
||||
purchase_code: string;
|
||||
branch_code: string;
|
||||
demand_task_id: string;
|
||||
task_code: string | null;
|
||||
output_sku: string;
|
||||
output_name: string | null;
|
||||
processing_method: string;
|
||||
material_sku: string;
|
||||
material_name: string | null;
|
||||
unit: string | null;
|
||||
planned_qty: number;
|
||||
actual_qty: number | null;
|
||||
unit_cost: number;
|
||||
total_amount: number;
|
||||
purchase_status: number;
|
||||
inspection_id: string | null;
|
||||
inventory_id: string | null;
|
||||
purchaser_code: string | null;
|
||||
purchaser_name: string | null;
|
||||
remark: string | null;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
export async function listProcessingRawPurchasesApi(options?: {
|
||||
statusGroup?: 'pending' | 'completed' | 'all' | null;
|
||||
search?: string;
|
||||
}) {
|
||||
const params = new URLSearchParams();
|
||||
if (options?.statusGroup) params.set('status_group', options.statusGroup);
|
||||
if (options?.search) params.set('search', options.search);
|
||||
const qs = params.toString();
|
||||
return workflowFetch<{ data: ProcessingRawPurchaseRow[] }>(
|
||||
`/purchase-orders/processing-raw-materials${qs ? `?${qs}` : ''}`
|
||||
);
|
||||
}
|
||||
|
||||
export async function updateProcessingRawPurchaseApi(
|
||||
id: string,
|
||||
body: { planned_qty?: number; unit_cost?: number; remark?: string }
|
||||
) {
|
||||
return workflowFetch<{ success: boolean }>(
|
||||
`/purchase-orders/processing-raw-materials/${encodeURIComponent(id)}`,
|
||||
{ method: 'PATCH', body: JSON.stringify(body) }
|
||||
);
|
||||
}
|
||||
|
||||
export async function submitProcessingRawPurchaseApi(
|
||||
id: string,
|
||||
body?: { actual_qty?: number; unit_cost?: number }
|
||||
) {
|
||||
return workflowFetch<{ success: boolean; data: { inspectionId: string; batchNo: string } }>(
|
||||
`/purchase-orders/processing-raw-materials/${encodeURIComponent(id)}/submit`,
|
||||
{ method: 'POST', body: JSON.stringify(body || {}) }
|
||||
);
|
||||
}
|
||||
export async function syncProcessingRawMaterialPurchasesApi(outputSku?: string) {
|
||||
return workflowFetch<{ data: { created: number; updated: number; cancelled: number; flagged: number } }>(
|
||||
'/purchase-orders/processing-raw-materials/sync',
|
||||
|
||||
Reference in New Issue
Block a user