提交
This commit is contained in:
1 parent
b74d483682
commit
dd1acdc787
50 files changed
+636156
-7218
No files matched your search
@@ -1,7 +1,6 @@
|
||||
// web-admin/src/utils/pl-batch-print.ts
|
||||
import type { Plan, PlanProduct } from '@/api/pl'
|
||||
import type { PlPrintSlipCommand } from '@/utils/pl-display'
|
||||
import { canPrintSlipCommand } from '@/utils/pl-display'
|
||||
|
||||
export type SlipPlanProduct = PlanProduct & { slipPlanNo?: string }
|
||||
|
||||
@@ -10,52 +9,29 @@ export function normalizeCustomerName(name?: string | null) {
|
||||
}
|
||||
|
||||
export function canBatchPrintSlip(
|
||||
plans: Array<Pick<Plan, 'planType' | 'customerName' | 'planDate'>>,
|
||||
plans: Array<Pick<Plan, 'customerName' | 'planDate'>>,
|
||||
command: PlPrintSlipCommand
|
||||
): { ok: boolean; reason?: string } {
|
||||
if (!plans?.length) return { ok: false, reason: '请先勾选运输计划' }
|
||||
|
||||
if (plans.length === 1) {
|
||||
if (!canPrintSlipCommand(plans[0].planType, command)) {
|
||||
return { ok: false, reason: '当前单据类型不支持打印该单据' }
|
||||
}
|
||||
return { ok: true }
|
||||
}
|
||||
|
||||
if (command === 'inbound') {
|
||||
if (!plans.every((p) => p.planType === 'inbound')) {
|
||||
return { ok: false, reason: '合打入库单要求:均为入库类计划' }
|
||||
}
|
||||
if (command === 'inbound' || command === 'delivery') {
|
||||
const c = normalizeCustomerName(plans[0].customerName)
|
||||
const d = plans[0].planDate
|
||||
const slipLabel = command === 'inbound' ? '入库单' : '送(提)货单'
|
||||
if (!c || !d || !plans.every((p) => normalizeCustomerName(p.customerName) === c && p.planDate === d)) {
|
||||
return {
|
||||
ok: false,
|
||||
reason: '合打入库单要求:客户名称一致且计划日期一致,且均为入库类计划'
|
||||
}
|
||||
}
|
||||
return { ok: true }
|
||||
}
|
||||
|
||||
if (command === 'delivery') {
|
||||
if (!plans.every((p) => p.planType === 'outbound')) {
|
||||
return { ok: false, reason: '合打送(提)货单要求:均为出库类计划' }
|
||||
}
|
||||
const c = normalizeCustomerName(plans[0].customerName)
|
||||
const d = plans[0].planDate
|
||||
if (!c || !d || !plans.every((p) => normalizeCustomerName(p.customerName) === c && p.planDate === d)) {
|
||||
return {
|
||||
ok: false,
|
||||
reason: '合打送(提)货单要求:客户名称一致且计划日期一致,且均为出库类计划'
|
||||
reason: `合打${slipLabel}要求:客户名称一致且计划日期一致`
|
||||
}
|
||||
}
|
||||
return { ok: true }
|
||||
}
|
||||
|
||||
if (command === 'subpack') {
|
||||
if (!plans.every((p) => canPrintSlipCommand(p.planType, 'subpack'))) {
|
||||
return { ok: false, reason: '分装单仅支持出库类计划' }
|
||||
}
|
||||
return { ok: true }
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user