保存工作区合并前的本地开发现场 ledger-route-sizes-389952f
This commit is contained in:
1 parent
389952f31c
commit
9952128ba4
45 files changed
+356
-321
No files matched your search
@@ -0,0 +1,4 @@
|
||||
import{n as e}from"./rolldown-runtime-Dl_DZoUm.js";import{i as t,t as n}from"./react-1o5M9n0k.js";import{i as r,n as i,r as a,u as o}from"./data-eE5dxIXS.js";import{a as s,n as c,o as l}from"./index-D-ox0wtk.js";import{t as u}from"./printStatus-DCPEAOZ9.js";import{c as d,n as f,o as p,t as m}from"./shared-DZLPF0cC.js";import{n as h,r as g,t as _}from"./materialQuote--cXNGK6N.js";var v=e(t(),1),y={exports:{}};(function(e){let t={direct:`直接回收`,exchange:`置换`},n=e=>String(e??``).trim(),r=[`new_name`,`new_quantity`,`pocket`,`stockCount`,`labor_mode`,`labor_rate`,`cost_labor_mode`,`cost_labor_value`,`labor_payer`];function i(e,t,r,{zero:i=!0}={}){let a=n(e);if(!RegExp(`^\\d+(?:\\.\\d{1,`+t+`})?$`).test(a))throw Error(`${r}请填写${i?`不小于0`:`大于0`}的数字,最多保留${t}位小数。`);let[o,s=``]=a.split(`.`),c=BigInt(o)*10n**BigInt(t)+BigInt(s.padEnd(t,`0`));if(c>100000000000n||!i&&c===0n)throw Error(`${r}超出范围或尚未填写。`);return Number(c)}function a(e,t=`回收/置换合计`){if(!Number.isSafeInteger(e)||Math.abs(e)>1e11)throw Error(t+`超出支持范围,请核对。`);return e}function o(e,t){return a(Number((BigInt(e)*BigInt(t)+500n)/1000n))}function s(e){return{new_name:e.name,new_quantity:e.quantity,pocket:e.pocket,stockCount:e.stockCount??``,labor_mode:e.labor_mode,labor_rate:e.labor_rate,cost_labor_mode:e.cost_labor?.mode||`total`,cost_labor_value:e.cost_labor?.mode===`gram`?e.cost_labor.rate:e.cost_labor?.amount??``,labor_payer:e.cost_labor_payer}}function c(e){return[e,...e.extra_products||[]].reduce((e,t)=>a(e+i(t.new_quantity,3,`新货克重`,{zero:!1})),0)}function l(e){return e.independent_products?{...e,independent_products:!1,extra_products:(e.extra_products||[]).map(e=>Object.fromEntries(r.map(t=>[t,e[t]]))),...e.extra_products?.length?{buy_total_manual:!1,buy_total:``,depreciation_manual:!1}:{},verified:!1,shared_old_notice:e.extra_products?.length?`已恢复为一份来料,沿用上方第一份来料;请核对实际总克重。`:``}:e}function u(e){if(e.mode===`exchange`&&e.exchange?.items)return d(e);if(!Object.hasOwn(t,e.mode))throw Error(`请选择直接回收或置换。`);let n=(e.old_lines||[]).map(e=>{let t=i(e.incoming_weight,3,`来料重量`,{zero:!1}),n=i(e.melted_weight,3,`熔后重量`,{zero:!1}),r=i(e.purity,3,`成色`,{zero:!1});if(n>t)throw Error(`熔后重量不能大于来料重量,请核对。`);if(r>1e5)throw Error(`成色请填写0到100之间的百分数,例如99表示99%。`);let a=Number((BigInt(n)*BigInt(r)+50000n)/100000n);if(a<=0)throw Error(`折后重量须至少为0.001g,请核对重量和成色。`);return{...e,incomingMg:t,meltedMg:n,purity:r/1e3,foldedMg:a}});if(!n.length)throw Error(`请填写旧料重量。`);let r=a(n.reduce((e,t)=>e+t.foldedMg,0),`旧料总重量`),s=i(e.buy_rate,2,`回收单价`),c=0,l=0,u=0,f=r,p=0,m=0,h=0,g=0,_=0,v=0,y=0,b=0;if(e.mode===`exchange`){let t=e.exchange||{};c=t.products?a(t.products.reduce((e,t)=>e+i(t.quantity,3,`新货克重`,{zero:!1}),0)):i(t.quantity,3,`新货克重`,{zero:!1}),l=Math.min(r,c),u=Math.max(0,c-r),f=Math.max(0,r-c);let n=u>0?i(t.gold_price,2,`当天销售金价`):0,s=i(t.labor_rate,2,`销售工费`),d=i(t.depreciation_rate??`10`,2,`折旧费单价`);if(u>0&&n<=0)throw Error(`有补金差重时,请填写大于0的当天销售金价。`);p=o(u,n),m=t.products?a(t.products.reduce((e,t)=>{let n=i(t.labor_rate,2,`销售工费`);return e+(t.labor_mode===`total`?n:o(i(t.quantity,3,`新货克重`),n))},0)):t.labor_mode===`total`?s:o(c,s),h=t.depreciation_weight==null?l:i(t.depreciation_weight,3,`折旧费计费克重`),g=o(h,d),_=a((t.charges||[]).reduce((e,t)=>e+i(t.amount,2,`其他收费`),0)),v=i(t.discount||`0`,2,`优惠金额`);let x=a(p+m+g+_)-v;if(x<0)throw Error(`优惠金额不能大于本次置换费用。`);y=t.rounding_mode===`yuan`?Math.floor((x+50)/100)*100:x,b=y-x}let x=e.mode===`exchange`&&e.surplus_mode===`deposit`?f:0,S=f-x;if(S>0&&s<=0)throw Error(`有回收旧料或余料时,请填写大于0的回收单价。`);let C=o(S,s),w=x?0:e.buy_total==null?C:i(e.buy_total,2,e.mode===`direct`?`回收结算额`:`余料回收款`);if(S>0&&w<=0)throw Error(`回收结算金额须大于0,请核对。`);if(!f&&w)throw Error(`本次没有余料,余料回收款应为0。`);let T=a(y-w);return{mode:e.mode,old_lines:n,oldMg:r,newMg:c,matchedMg:l,differenceMg:u,surplusMg:f,depositMg:x,purchaseMg:S,goldAmount:p,laborAmount:m,depreciationMg:h,depreciationAmount:g,chargesAmount:_,discount:v,receivable:y,purchaseAmount:w,defaultPurchaseAmount:C,roundingAdjustment:b,netSettlement:T,cashReceipt:Math.max(0,T),cashPayment:Math.max(0,-T)}}function d(e){let t=e.exchange.items.map(t=>u({...e,...t,buy_total:t.buy_total,buy_rate:t.buy_rate,surplus_mode:t.surplus_mode,surplus_memo:t.surplus_memo,mode:`exchange`,exchange:t.exchange})),n={mode:`exchange`,old_lines:t.flatMap(e=>e.old_lines),exchangeItems:t};for(let e of[`oldMg`,`newMg`,`matchedMg`,`differenceMg`,`surplusM
Line truncated
|
||||
`),f=e=>e?.exchange?.fee_items.map(e=>`${e.note}:${e.amount}元 · ${c(e.payer)}付款`).join(`
|
||||
`)||`无`,m=e=>e?.exchange?.charges.map(e=>`${e.name}:${e.amount}元`).join(`
|
||||
`)||`无`,h=n.exchange||{},g=r?.exchange||{},_=e=>e?.mode===`pool`?`料池 `+e.poolId:e?`手填 `+e.rate+`元/克`:`无补金差重`,v=e=>e?e.mode===`gram`?e.rate+`元/克`:e.amount+`元总工费`:`未提供`;if(a.push(o(`业务日期`,n.date,r?.date||`取消原记录`),o(`客户`,n.customer,r?.customer),o(`开单人`,n.salesperson,r?.salesperson),o(`归属`,c(n.member),r?c(r.member):`沿用原身份留档`),o(`旧料逐项称重`,d(n),r?d(r):`冲正原库存及关联购料`),o(`旧料入库货盘`,l(n.old_pocket??`回收旧料`),r?l(r.old_pocket??`回收旧料`):`冲回原入库货盘`),o(`旧料入库数量(对)`,i(n.old_stock_count==null?null:Number(n.old_stock_count)),r?i(r.old_stock_count==null?null:Number(r.old_stock_count)):`冲回原入库数量`),o(`回收单价(元/克)`,n.buy_rate,r?.buy_rate),o(`回收结算额(元)`,n.buy_total,r?.buy_total),o(`实际收付款账户`,u(n.payment_account),r?u(r.payment_account):`冲正原收付记录`),o(`付款人`,c(n.payer),r?c(r.payer):`原付款流水保留`),o(`备注`,n.note,r?.note)),(n.surplus_mode===`deposit`||r?.surplus_mode===`deposit`)&&a.push(o(`余料处理`,n.surplus_mode===`deposit`?`寄存,暂不结算`:`按回收价结算`,r?r.surplus_mode===`deposit`?`寄存,暂不结算`:`按回收价结算`:`撤回本单寄存余料`)),(n.old_source===`deposit`||r?.old_source===`deposit`)&&a.push(o(`使用客户寄存料`,n.old_source===`deposit`?n.deposit_id+` · `+n.deposit_weight+`g`:`本次交来旧料`,r?.old_source===`deposit`?r.deposit_id+` · `+r.deposit_weight+`g`:r?`本次交来旧料`:`退回寄存账户`)),n.exchange?.items||r?.exchange?.items){let e=e=>(e?.exchange?.items||[]).map((e,t)=>t+1+` · `+e.exchange.name+(e.old_source===`deposit`?` · 寄存记录 `+e.deposit_id+` 使用 `+e.deposit_weight+`g`:``)+(e.surplus_mode===`deposit`?` · 余料寄存,暂不结算`:``)+` · 旧料 `+e.old_lines.map(e=>e.melted_weight+`g × `+e.purity+`%`).join(`+`)+` 入`+l(e.old_pocket)+` · 新货 `+e.exchange.quantity+`g `+(l(e.exchange.pocket)||`外配`)+` · 补金 `+e.exchange.gold_price+`元/g · 折旧 `+e.exchange.depreciation_weight+`g × `+e.exchange.depreciation_rate+`元/g · 回收 `+e.buy_rate+`元/g,`+e.buy_total+`元 · 料费 `+JSON.stringify(e.exchange.cost_material)+` · 料费付款 `+c(e.exchange.cost_material_payer)+` · 进货工费 `+JSON.stringify(e.exchange.cost_labor)+`,`+c(e.exchange.cost_labor_payer)).join(`;`);a.push(o(`逐件置换完整资料`,e(n),r?e(r):`全部冲回`))}if(n.exchange?.products||r?.exchange?.products){let e=e=>(e?.products??(e?[e]:[])).map((e,t)=>t+1+` · `+e.name+` · `+e.quantity+`g · `+(l(e.pocket)||`外配`)+` · 销售工费 `+e.labor_rate+(e.labor_mode===`total`?`元`:`元/克`)+` · 进货工费 `+(e.cost_labor?.rate??e.cost_labor?.amount??`待补`)+` · `+c(e.cost_labor_payer)+(e.stockCount==null?``:` · `+e.stockCount+`对`)).join(`;`);a.push(o(`逐件置换商品`,e(n.exchange),r?e(r.exchange):`冲回全部新货出库`))}n.mode===`exchange`&&a.push(o(`置换新货`,h.name,g.name),o(`新货克重(g)`,h.quantity,g.quantity),o(`实际货盘`,l(h.pocket)||`外配`,r?l(g.pocket)||`外配`:`冲回原出库货盘`),o(`出库数量(对)`,i(h.stockCount==null?null:Number(h.stockCount)),i(g.stockCount==null?null:Number(g.stockCount))),o(`销售金价(元/克)`,h.gold_price,g.gold_price),o(`销售工费`,h.labor_rate+`元/`+(h.labor_mode===`gram`?`克`:`总额`),r?g.labor_rate+`元/`+(g.labor_mode===`gram`?`克`:`总额`):`取消`),o(`折旧计费克重/单价`,h.depreciation_weight+`g × `+h.depreciation_rate+`元/克`,r?g.depreciation_weight+`g × `+g.depreciation_rate+`元/克`:`取消`),o(`附加收费`,m(n),r?m(r):`取消`),o(`优惠(元)`,h.discount,g.discount),o(`取整方式`,h.rounding_mode===`yuan`?`四舍五入到元`:`保留到分`,r?g.rounding_mode===`yuan`?`四舍五入到元`:`保留到分`:`取消`),o(`补金差重进货来源`,_(h.cost_material),r?_(g.cost_material):`释放原耗用`),o(`料费付款人`,c(h.cost_material_payer),r?c(g.cost_material_payer):`原来源留档`),o(`进货工费`,v(h.cost_labor),r?v(g.cost_labor):`取消`),o(`工费付款人`,c(h.cost_labor_payer),r?c(g.cost_labor_payer):`原来源留档`),o(`实际费用`,f(n),r?f(r):`冲正原费用`));let y=e.summary.before||{},b=e.summary.after||{};return a.push(...[[`实际收客户`,`cashReceipt`],[`实际付客户`,`cashPayment`],[`购料成本`,`purchaseAmount`],[`订单货品成本`,`goodsCost`],[`实际费用`,`directCost`],[`原账利润`,`profit`]].map(([e,t])=>o(e,y[t]==null?`待核实`:`¥`+s(y[t]),r?b[t]==null?`待核实`:`¥`+s(b[t]):`取消后冲正`))),(0,C.jsxs)(C.Fragment,{children:[e.summary.legacyCountNotice&&(0,C.jsxs)(`p`,{children:[e.summary.legacyCountNotice,e.summary.legacyCountVerified&&`(申请人已确认)`]}),(0,C.jsx)(`div`,{className:`table-wrap`,children:(0,C.jsxs)(`table`,{"aria-label":`回收更正原值与申请值`,children:[(0,C.jsx)(`theaLine truncated
|
||||
Reference in new issue
Block a user