增加货盘新增改名与启停管理,保留历史库存关联

This commit is contained in:
summer committed 2026-11-08 03:30:58 +08:00
1 parent 337b2a709f
commit ba15795f0a
29 files changed
+748 -218

No files matched your search

+4 -3
View File
@@ -10,8 +10,9 @@ function status(row){
return value+(row.manual&&row.pendingApproval?';待麦麦审批':'');
}
function recordedAt(value){const date=new Date(value);return Number.isNaN(date.getTime())?'时间未提供':new Intl.DateTimeFormat('sv-SE',{timeZone:'Asia/Shanghai',year:'numeric',month:'2-digit',day:'2-digit',hour:'2-digit',minute:'2-digit',second:'2-digit',hourCycle:'h23'}).format(date);}
function inventoryMovementsFile(result,date){
const rows=[['序号','日期','货盘','增减克重(g)','类型','备注/原单','经办人','记录时间','状态'],...result.movements.map((row,index)=>[index+1,row.date,row.pocket,row.mg/1000,types[row.kind]||'其他库存变动('+row.kind+')',row.reversal||row.kind==='manual_reversal'?'撤回旧记录的库存影响':row.note||'',row.actor,recordedAt(row.created),status(row)])];
return {buffer:workbook(rows),filename:`库存流水-${result.pocket||'全部货盘'}-${filters[result.kind]}-${date}.xlsx`,contentType:MIME};
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||'',row.actor,recordedAt(row.created),status(row)])];
const name=(result.pocket?pocketLabel(result.pocket):'全部货盘').replace(/[\\/:*?"<>|\u0000-\u001f]/g,'_');
return {buffer:workbook(rows),filename:`库存流水-${name}-${filters[result.kind]}-${date}.xlsx`,contentType:MIME};
}
module.exports={inventoryMovementsFile,MIME};