import {
|
buildOutStockItemSearchParams,
|
normalizeOutStockItemRow
|
} from '../out-stock-item/outStockItemPage.helpers.js'
|
|
export const PREPARATION_ITEM_REPORT_TITLE = '备料单明细报表'
|
export const PREPARATION_ITEM_REPORT_STYLE = {
|
titleAlign: 'center',
|
titleLevel: 'strong',
|
orientation: 'landscape',
|
density: 'compact',
|
showSequence: true
|
}
|
|
export function createPreparationItemSearchState(seed = {}) {
|
return {
|
condition: '',
|
orderId: '',
|
orderCode: '',
|
poCode: '',
|
platItemId: '',
|
matnrCode: '',
|
maktx: '',
|
batch: '',
|
splrBatch: '',
|
trackCode: '',
|
barcode: '',
|
fieldsIndex: '',
|
status: '',
|
...seed
|
}
|
}
|
|
export function getPreparationItemPaginationKey() {
|
return {
|
current: 'current',
|
size: 'pageSize'
|
}
|
}
|
|
export function buildPreparationItemSearchParams(params = {}) {
|
const result = {
|
...buildOutStockItemSearchParams(params)
|
}
|
|
if (params.orderId !== '' && params.orderId !== undefined && params.orderId !== null) {
|
const numericValue = Number(params.orderId)
|
if (!Number.isNaN(numericValue)) {
|
result.orderId = numericValue
|
}
|
}
|
|
return result
|
}
|
|
export function buildPreparationItemPageQueryParams(params = {}) {
|
return {
|
current: params.current || 1,
|
pageSize: params.pageSize || params.size || 20,
|
...buildPreparationItemSearchParams(params)
|
}
|
}
|
|
export function normalizePreparationItemRow(record = {}) {
|
return normalizeOutStockItemRow(record)
|
}
|
|
export function getPreparationItemReportColumns() {
|
return [
|
{ key: 'orderCode', label: '备料单号' },
|
{ key: 'poCode', label: 'PO单号' },
|
{ key: 'platItemId', label: '平台行号' },
|
{ key: 'matnrCode', label: '物料编码' },
|
{ key: 'maktx', label: '物料名称' },
|
{ key: 'batch', label: '批次' },
|
{ key: 'splrBatch', label: '供应商批次' },
|
{ key: 'stockUnit', label: '库存单位' },
|
{ key: 'anfme', label: '数量' },
|
{ key: 'workQty', label: '执行数量' },
|
{ key: 'qty', label: '已出数量' },
|
{ key: 'fieldsIndex', label: '字段索引' },
|
{ key: 'statusText', label: '状态' },
|
{ key: 'updateTimeText', label: '更新时间' },
|
{ key: 'memo', label: '备注' }
|
]
|
}
|
|
export function buildPreparationItemPrintRows(records = []) {
|
if (!Array.isArray(records)) {
|
return []
|
}
|
return records.map((record) => normalizePreparationItemRow(record))
|
}
|
|
export function buildPreparationItemReportMeta({
|
previewMeta = {},
|
count = 0,
|
orientation = PREPARATION_ITEM_REPORT_STYLE.orientation
|
} = {}) {
|
return {
|
reportTitle: PREPARATION_ITEM_REPORT_TITLE,
|
reportDate: previewMeta.reportDate,
|
printedAt: previewMeta.printedAt,
|
operator: previewMeta.operator,
|
count,
|
reportStyle: {
|
...PREPARATION_ITEM_REPORT_STYLE,
|
orientation
|
}
|
}
|
}
|