| | |
| | | import { $t } from '@/locales' |
| | | |
| | | const PREPARATION_STATUS_META = { |
| | | 8: { text: '取消', type: 'danger' }, |
| | | 10: { text: '初始化', type: 'info' }, |
| | |
| | | |
| | | function normalizeStatusMeta(exceStatus, exceStatusText) { |
| | | if (exceStatusText) { |
| | | return PREPARATION_STATUS_META[Number(exceStatus)] || { |
| | | text: exceStatusText, |
| | | type: 'info' |
| | | } |
| | | return ( |
| | | PREPARATION_STATUS_META[Number(exceStatus)] || { |
| | | text: exceStatusText, |
| | | type: 'info' |
| | | } |
| | | ) |
| | | } |
| | | |
| | | return PREPARATION_STATUS_META[Number(exceStatus)] || { |
| | | text: normalizeText(exceStatus) || '--', |
| | | type: 'info' |
| | | } |
| | | return ( |
| | | PREPARATION_STATUS_META[Number(exceStatus)] || { |
| | | text: normalizeText(exceStatus) || '--', |
| | | type: 'info' |
| | | } |
| | | ) |
| | | } |
| | | |
| | | function normalizeRleStatusMeta(rleStatus, rleStatusText) { |
| | | if (rleStatusText) { |
| | | return PREPARATION_RLE_STATUS_META[Number(rleStatus)] || { |
| | | text: rleStatusText, |
| | | type: 'info' |
| | | } |
| | | return ( |
| | | PREPARATION_RLE_STATUS_META[Number(rleStatus)] || { |
| | | text: rleStatusText, |
| | | type: 'info' |
| | | } |
| | | ) |
| | | } |
| | | |
| | | return PREPARATION_RLE_STATUS_META[Number(rleStatus)] || { |
| | | text: normalizeText(rleStatus) || '--', |
| | | type: 'info' |
| | | } |
| | | return ( |
| | | PREPARATION_RLE_STATUS_META[Number(rleStatus)] || { |
| | | text: normalizeText(rleStatus) || '--', |
| | | type: 'info' |
| | | } |
| | | ) |
| | | } |
| | | |
| | | export function createPreparationSearchState() { |
| | |
| | | condition: '', |
| | | code: '', |
| | | poCode: '', |
| | | poId: '', |
| | | wkType: '', |
| | | exceStatus: '', |
| | | rleStatus: '', |
| | | anfme: '', |
| | | qty: '', |
| | | logisNo: '', |
| | | arrTime: '', |
| | | customerName: '', |
| | | saleOrgName: '', |
| | | memo: '' |
| | |
| | | 'poCode', |
| | | 'wkType', |
| | | 'logisNo', |
| | | 'arrTime', |
| | | 'customerName', |
| | | 'saleOrgName', |
| | | 'memo' |
| | |
| | | if (params.rleStatus !== '' && params.rleStatus !== undefined && params.rleStatus !== null) { |
| | | result.rleStatus = normalizeNumber(params.rleStatus) |
| | | } |
| | | |
| | | ;['poId', 'anfme', 'qty'].forEach((key) => { |
| | | if (params[key] !== '' && params[key] !== undefined && params[key] !== null) { |
| | | result[key] = normalizeNumber(params[key]) |
| | | } |
| | | }) |
| | | |
| | | return result |
| | | } |
| | |
| | | memo: normalizeText(record.memo) || '--', |
| | | canComplete: Number(record.exceStatus) !== 15, |
| | | canCancel: Number(record.exceStatus) === 10, |
| | | canDelete: Number(record.exceStatus) !== 15 |
| | | canDelete: Number(record.exceStatus) !== 15, |
| | | canPublic: Number(record.workQty || 0) < Number(record.anfme || 0) |
| | | } |
| | | } |
| | | |
| | |
| | | export function getPreparationActionList(row = {}) { |
| | | const normalizedRow = normalizePreparationRow(row) |
| | | return [ |
| | | { key: 'view', label: '查看详情', icon: 'ri:eye-line' }, |
| | | { key: 'print', label: '打印', icon: 'ri:printer-line' }, |
| | | { key: 'view', label: $t('common.actions.detail'), icon: 'ri:eye-line' }, |
| | | { key: 'items', label: $t('common.actions.items'), icon: 'ri:list-check-3' }, |
| | | { |
| | | key: 'public', |
| | | label: '下发执行', |
| | | icon: 'ri:send-plane-line', |
| | | color: 'var(--el-color-primary)', |
| | | disabled: !normalizedRow.canPublic |
| | | }, |
| | | { key: 'print', label: $t('common.actions.print'), icon: 'ri:printer-line' }, |
| | | { |
| | | key: 'complete', |
| | | label: '完成', |
| | | label: $t('common.actions.complete'), |
| | | icon: 'ri:check-line', |
| | | color: 'var(--el-color-success)', |
| | | disabled: !normalizedRow.canComplete |
| | | }, |
| | | { |
| | | key: 'cancel', |
| | | label: '取消', |
| | | label: $t('common.cancel'), |
| | | icon: 'ri:close-circle-line', |
| | | color: 'var(--el-color-danger)', |
| | | disabled: !normalizedRow.canCancel |
| | | }, |
| | | { |
| | | key: 'delete', |
| | | label: '删除', |
| | | label: $t('common.actions.delete'), |
| | | icon: 'ri:delete-bin-6-line', |
| | | color: 'var(--el-color-danger)', |
| | | disabled: !normalizedRow.canDelete |
| | |
| | | |
| | | export function createPreparationDetailItemColumns() { |
| | | return [ |
| | | { type: 'globalIndex', label: '序号', width: 72, align: 'center' }, |
| | | { type: 'globalIndex', label: $t('table.index'), width: 72, align: 'center' }, |
| | | { prop: 'matnrCode', label: '物料编码', minWidth: 160, showOverflowTooltip: true }, |
| | | { prop: 'maktx', label: '物料名称', minWidth: 180, showOverflowTooltip: true }, |
| | | { prop: 'splrBatch', label: '供应商批次', minWidth: 140, showOverflowTooltip: true }, |
| | | { prop: 'splrName', label: '供应商', minWidth: 160, showOverflowTooltip: true }, |
| | | { prop: 'anfme', label: '应出数量', width: 100, align: 'right' }, |
| | | { prop: 'qty', label: '已出数量', width: 100, align: 'right' }, |
| | | { prop: 'memo', label: '备注', minWidth: 160, showOverflowTooltip: true } |
| | | { prop: 'memo', label: $t('table.remark'), minWidth: 160, showOverflowTooltip: true } |
| | | ] |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | export function buildPreparationGenerateWavePayload(rows = [], waveRuleId) { |
| | | return { |
| | | ids: Array.isArray(rows) |
| | | ? rows.map((row) => Number(row?.id)).filter((id) => Number.isFinite(id)) |
| | | : [], |
| | | waveRuleId: normalizeNumber(waveRuleId) |
| | | } |
| | | } |