库存流水支持按日期区间筛选及导出Excel
This commit is contained in:
1 parent
67678d73c6
commit
6cde5e6999
5 files changed
+72
-25
No files matched your search
@@ -15,6 +15,7 @@ function actorDisplayName(value){const member=value==='助理2'?'assistant2':val
|
||||
function inventoryMovementsFile(result,date,pocketLabel=key=>key){
|
||||
const rows=[['序号','日期','货盘','增减克重(g)','类型','备注/原单','经办人','记录时间','状态','增减对数(对)'],...result.movements.map((row,index)=>[index+1,row.date,pocketLabel(row.pocket),row.mg/1000,types[row.kind]||'其他库存变动('+row.kind+')',row.reversal||row.kind==='manual_reversal'?'撤回旧记录的库存影响':row.note||'',actorDisplayName(row.actor),recordedAt(row.created),status(row),row.stockCount??(row.countUnit==='pair'?'未登记':'')])];
|
||||
const name=(result.pocket?pocketLabel(result.pocket):'全部货盘').replace(/[\\/:*?"<>|\u0000-\u001f]/g,'_');
|
||||
return {buffer:workbook(rows,{widths:[8,14,16,18,20,48,18,24,30,18],optionalNumericColumns:[9]}),filename:`库存流水-${name}-${filters[result.kind]}-${date}.xlsx`,contentType:MIME};
|
||||
const period=result.from||result.to?`${result.from||'最早'}至${result.to||'今'}`:date;
|
||||
return {buffer:workbook(rows,{widths:[8,14,16,18,20,48,18,24,30,18],optionalNumericColumns:[9]}),filename:`库存流水-${name}-${filters[result.kind]}-${period}.xlsx`,contentType:MIME};
|
||||
}
|
||||
module.exports={inventoryMovementsFile,MIME};
|
||||
Reference in new issue
Block a user