fix: 保存前重校验出库库存

This commit is contained in:
zhouz
2026-07-22 16:02:43 +08:00
parent a65f96dab6
commit 4e276c5b05
12 changed files with 179 additions and 5 deletions

View File

@@ -37,6 +37,8 @@ export namespace WmsIostorInvApi {
/** 出库单可持久化明细 */
export interface OutboundDetail {
groupId?: number | string; // 组盘记录标识(库存选择方式)
vehicleCode?: string; // 箱号(库存选择方式)
materialCode: string; // 物料编码
materialId?: string; // 物料标识
pcsn?: string; // 批次序列号
@@ -51,11 +53,9 @@ export namespace WmsIostorInvApi {
/** 出库明细页面展示模型(提交时应转换为 OutboundDetail */
export interface OutboundDisplayDetail extends OutboundDetail {
groupId?: number | string;
materialName?: string;
rowKey?: string;
sapBatchNo?: string;
vehicleCode?: string;
}
/** 出库单新增请求 */

View File

@@ -59,6 +59,7 @@ describe('buildOutboundPayload', () => {
expect(payload.bizDate).toBe(bizDate.valueOf());
expect(payload.details).toEqual([
{
groupId: 11,
materialCode: 'M-1',
materialId: '1',
pcsn: 'P-1',
@@ -69,11 +70,22 @@ describe('buildOutboundPayload', () => {
sourceBillCode: 'SRC-1',
sourceBillType: 'SALE',
sourceBilldtlId: 'D-1',
vehicleCode: 'BOX-1',
},
]);
expect(payload).not.toHaveProperty('detailCount');
expect(payload).not.toHaveProperty('totalWeight');
});
it('手工汇总行不附带库存引用字段', () => {
const payload = buildOutboundPayload(
{ billType: 'SALE', bizDate: 1, storId: 'S-1' },
[{ materialCode: 'M-1', planQty: 2 }],
);
expect(payload.details[0]?.groupId).toBeUndefined();
expect(payload.details[0]?.vehicleCode).toBeUndefined();
});
});
describe('mergeOutboundInventory', () => {

View File

@@ -50,6 +50,7 @@ export function buildOutboundPayload(
billType: values.billType!,
bizDate: Number(values.bizDate?.valueOf()),
details: details.map((detail) => ({
groupId: detail.groupId,
materialCode: detail.materialCode,
materialId: detail.materialId,
pcsn: detail.pcsn,
@@ -60,6 +61,7 @@ export function buildOutboundPayload(
sourceBillCode: detail.sourceBillCode,
sourceBillType: detail.sourceBillType,
sourceBilldtlId: detail.sourceBilldtlId,
vehicleCode: detail.vehicleCode,
})),
remark: values.remark || undefined,
storId: values.storId!,