PageSourceSearch

https://lesstat.ru/assets/ExportAnalysis-DmlrbE26.js

js lesstat.ru collected 2026-10-02 02:07:33 UTC 17,601 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-radix-j51FbGWj.js";import{r as H}from"./vendor-react-CzwWGMlW.js";import{E as re}from"./vendor-excel-BmHXwAT0.js";import{s as le}from"./saveFile-CuSvqsta.js";import{g as B,B as ie,C as de,a as ce,b as me,d as he,P as xe,c as pe,A as ue,p as je,e as fe,f as ge}from"./vendor-charts-CCcLMIy6.js";import{k as Ne,C as b,f as y,g as T,b as w,I as be,B as ee,a as se}from"./index-CMgi7Nl8.js";import{T as I,a as Y,b as A,c as h,d as z,e as c}from"./table-DvS7udR6.js";import{T as we,a as Ce,b as V,c as _}from"./tabs-CtkUE6WE.js";import{S as J,a as q,b as K,c as U,d as k}from"./select-DjZg9c5p.js";import{D as ve}from"./DateRangePicker--okN5a2e.js";import{bD as Z,bE as G,a9 as ye,bt as Q,m as Te,aL as ke,b as Ee,F as De,bF as Ae}from"./vendor-icons-CaDFxAI1.js";import{k as O,m as Se,n as Re,i as W,o as X,j as $}from"./vendor-utils-DYobRrOj.js";de.register(ce,me,he,xe,pe,ue,je,fe,ge);const Pe=(i,x,a,n,j)=>{const m=new re.Workbook;m.creator="Система мониторинга экспортных поставок",m.lastModifiedBy="Система мониторинга экспортных поставок",m.created=new Date,m.modified=new Date;const f=m.addWorksheet("Поставки",{pageSetup:{paperSize:9,orientation:"landscape"}});f.columns=[{header:"№ документа",key:"docNo",width:20},{header:"Дата",key:"date",width:12},{header:"Статус",key:"status",width:20},{header:"Покупатель",key:"receiver",width:30},{header:"Перевозчик",key:"carrier",width:25},{header:"Страна назначения",key:"country",width:20},{header:"Объем (м³)",key:"volume",width:15},{header:"Тип древесины",key:"woodType",width:20},{header:"Транспорт",key:"transport",width:20},{header:"Транспортное средство",key:"vehicle",width:20},{header:"Пункт отправления",key:"departure",width:30},{header:"Пункт назначения",key:"destination",width:20}],f.getRow(1).font={bold:!0},f.getRow(1).fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFE0E0E0"}}
1,i.forEach(t=>{let p="Неизвестно";t.transportationDocStatusCode==="terminated"?t.terminationReasonCode===E.COMPLETED?p="Завершена":t.terminationReasonCode===E.STOPPED_ACCEPTANCE?p="Остановлена (приемка)":t.terminationReasonCode===E.STOPPED_VIOLATION?p="Остановлена (нарушение)":p="Завершена (другое)":t.transportationDocStatusCode==="onTheWay"&&(p="В пути");const D=t.consignmentJson?t.consignmentJson.map(N=>`${N.tnvedCode} (${(N.volumeNval||0).toFixed(3)} м³)`).join(", "):"",F=`https://pub.fgislk.gov.ru/pudpd/api/pudpd/public/transportation/html/${t.transportationDocNo}`;f.addRow({docNo:t.transportationDocNo,date:O(new Date(t.signDttm),"dd.MM.yyyy HH:mm"),status:p,receiver:t.receiverName||"Не указан",carrier:t.carrierName||"Не указан",country:`${t.destinationCountryName} (${t.destinationCountryCode})`,volume:(t.totalVolumeNval||0).toFixed(3),woodType:D,transport:t.transportKindName,vehicle:t.machineryNumberDesc,departure:t.departureAddress,destination:t.destinationCountryName});const g=f.lastRow.getCell(1);g.value={text:t.transportationDocNo,hyperlink:F,tooltip:"Открыть документ в системе ФГИС ЛК"},g.font={color:{argb:"0000FF"},underline:!0}});const C=m.addWorksheet("Статистика по странам");C.columns=[{header:"Страна",key:"country",width:20},{header:"Код страны",key:"code",width:15},{header:"Количество поставок",key:"count",width:20},{header:"Общий объем (м³)",key:"volume",width:20},{header:"В пути (шт)",key:"onTheWay",width:15},{header:"Завершено (шт)",key:"completed",width:15},{header:"Остановлено (шт)",key:"stopped",width:15}],C.getRow(1).font={bold:!0},C.getRow(1).fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFE0E0E0"}},x.forEach(t=>{C.addRow({country:t.countryName,code:t.countryCode,count:t.deliveriesCount,volume:t.totalVolume.toFixed(3),onTheWay:t.onTheWayCount,completed:t.completedCount,stopped:t.stoppedCount})});const o=m.addWorksheet("Общая статистика");o.addRow(["Общая статистика экспортных поставок"]),o.mergeCells("A1:B1"),o.getCell("A1").font={bold:!0,size:14},o.addRow(["Общий объем экспорта (м³)",n.totalVolume.toFixed(3)]),o.addRow(["Количество поставок",n.totalDeliveries]),o.addRow(["Количество стран экспорта",n.uniqueCountries]),o.addRow([""]),o.addRow(["Статистика по статусам"]),o.getCell("A6").font={bold:!0},o.addRow(["В пути",a.onTheWay]),o.addRow(["Завершены",a.completed]),o.addRow(["Остановлены (приемка)",a.stoppedAcceptance]),o.addRow(["Остановлены (нарушение)",a.stoppedViolation]),o.addRow([""]),o.addRow(["Статистика по типам лесоматериалов"]),o.getCell("A12").font={bold:!0},j.forEach(t=>{o.addRow([t.name,t.volume.toFixed(3)])}),m.xlsx.writeBuffer().then(t=>{const p=`Экспортные_поставки_${O(new Date,"yyyy-MM-dd_HH-mm")}.xlsx`,D=new Blob([t],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"});le(D,p)})},E={COMPLETED:"departureFromRfToEaes",STOPPED_ACCEPTANCE:"acceptanceObd",STOPPED_VIOLATION:"lawViolation"},R={ALL:"all",ON_THE_WAY:"onTheWay",COMPLETED:"completed",STOPPED:"stopped"},Oe=({status:i,terminationReason:x})=>{let a="Неизвестно",n="secondary";return i==="terminated"?x===E.COMPLETED?(a="Завершена",n="success"):x===E.STOPPED_ACCEPTANCE?(a="Остановлена (приемка)",n="warning"):x===E.STOPPED_VIOLATION?(a="Остановлена (нарушение)",n="destructive"):(a="Завершена (другое)",n="secondary"):i==="onTheWay"&&(a="В пути",n="info"),e.jsx(se,{variant:n,children:a})},Fe=({dateRange:i,onDateRangeChange:x,onPresetSelect:a})=>{const n=[{key:"currentMonth",label:"Месяц"},{key:"previousMonth",label:"Пред."},{key:"last3Months",label:"3 мес"},{key:"currentYear",label:"Год"}];return e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[e.jsx(ve,{dateRange:i,onDateRangeChange:x}),e.jsx("div",{className:"flex gap-1",children:n.map(j=>e.jsx(ee,{variant:"outline",size:"sm",className:"h-8 px-2 text-xs",onClick:()=>a==null?void 0:a(j.key),children:j.label},j.key))})]})},P=({icon:i,title:x,value:a,unit:n,variant:j="default",className:m=""})=>{const f={default:"bg-background border",primary:"bg-primary text-primary-foreground",success:"bg-emerald-500 text-white",warning:"bg-amber-500 text-white",info:"bg-blue-500 text-white",destructive:"bg-red-500 text-white"};return e.jsxs("div",{className:`rounded-lg p-4 ${f[j]} ${m}`,children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[i&&e.jsx(i,{className:"h-4 w-4 opacity-80"}),e.jsx("span",{className:"text-sm font-medium opacity-90",children:x})]}),e.jsxs("div",{className:"text-2xl font-bold",children:[typeof a=="number"&&n==="м³"?a.toFixed(3):a,n&&e.jsx("span",{className:"text-sm font-normal ml-1 opacity-80",children:n})]})]})},qe=({data:i,loading:x,filter:a,onFilterChange:n,dateRange:j,onDateRangeChange:m})=>{const[f,C]=H.useState("overview"),[o,t]=H.useState(""),p=s=>n({statusType:s}),D=s=>n({countryCode:s}),F=s=>{const r=new Date;let l,d;switch(s){case"currentMonth":l=W(r),d=$(r);break;case"previousMonth":{const v=X(r,1);l=W(v),d=$(v);break}case"last3Months":l=W(X(r,2)),d=$(r);break;case"currentYear":l=Se(r),d=Re(r);break;default:return}l.setHours(0,0,0,0),d.setHours(23,59,59,999),m({startDate:l,endDate:d})};if(x)return e.jsx(Ne,{message:"Загружаем экспортные поставки..."});if(!i||!i.deliveries||i.deliveries.length===0)return e.jsxs(b,{children:[e.jsx(y,{children:e.jsx(T,{children:"Анализ экспортных поставок"})}),e.jsxs(w,{className:"text-center py-8 text-muted-foreground space-y-2",children:[e.jsx(Z,{className:"mx-auto h-10 w-10 mb-2"}),e.jsx("div",{className:"font-semibold",children:"Нет данных для отображения"}),e.jsx("div",{className:"text-sm",children:"За выбранный период Ð
1½Ðµ найдено экспортных поставок. Попробуйте изменить фильтры или период."})]})]});const{deliveries:S,stats:g,countryStats:N,woodTypeStats:M,statusStats:u}=i,L=S.filter(s=>{const r=o.toLowerCase();return s.transportationDocNo.toLowerCase().includes(r)||s.destinationCountryName.toLowerCase().includes(r)||(s.machineryNumberDesc||"").toLowerCase().includes(r)}),te={labels:N.map(s=>s.countryName),datasets:[{label:"Объем поставок (м³)",data:N.map(s=>s.totalVolume),backgroundColor:["#4e73df","#1cc88a","#36b9cc","#f6c23e","#e74a3b","#6f42c1","#fd7e14","#20c9a6","#5a5c69","#858796"]}]},ae={labels:["Завершены","В пути","Остановлены (приемка)","Остановлены (нарушение)"],datasets:[{data:[u.completed,u.onTheWay,u.stoppedAcceptance,u.stoppedViolation],backgroundColor:["#22c55e","#3b82f6","#eab308","#ef4444"]}]},oe={labels:M.map(s=>s.name),datasets:[{label:"Объем (м³)",data:M.map(s=>s.volume),backgroundColor:"#0ea5e9",borderColor:"#0284c7",borderWidth:1}]},ne=()=>{S.length&&Pe(S,N,u,g,M)};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs(b,{children:[e.jsx(y,{className:"pb-4",children:e.jsxs("div",{className:"flex flex-col md:flex-row md:items-center md:justify-between gap-4",children:[e.jsxs(T,{className:"flex items-center gap-2",children:[e.jsx(G,{className:"h-5 w-5"}),"Анализ экспортных поставок"]}),e.jsx(Fe,{dateRange:j,onDateRangeChange:m,onPresetSelect:F})]})}),e.jsxs(w,{className:"space-y-6",children:[e.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[e.jsx(P,{icon:G,title:"Общий объем экспорта",value:g.totalVolume,unit:"м³",variant:"primary"}),e.jsx(P,{icon:ye,title:"Количество поставок",value:g.totalDeliveries,variant:"success"}),e.jsx(P,{icon:Q,title:"Страны экспорта",value:g.uniqueCountries,variant:"info"}),e.jsx(P,{icon:Te,title:"Поставки в пути",value:u.onTheWay,variant:"warning"})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3 p-3 rounded-lg bg-muted/30 border",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ke,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm font-medium",children:"Фильтры:"})]}),e.jsxs(J,{value:a.statusType,onValueChange:p,children:[e.jsx(q,{className:"w-[160px] h-8",children:e.jsx(K,{placeholder:"Статус поставки"})}),e.jsxs(U,{children:[e.jsx(k,{value:R.ALL,children:"Все статусы"}),e.jsx(k,{value:R.ON_THE_WAY,children:"В пути"}),e.jsx(k,{value:R.COMPLETED,children:"Завершены"}),e.jsx(k,{value:R.STOPPED,children:"Остановлены"})]})]}),e.jsxs(J,{value:a.countryCode||"all",onValueChange:s=>D(s==="all"?"":s),children:[e.jsx(q,{className:"w-[180px] h-8",children:e.jsx(K,{placeholder:"Страна назначения"})}),e.jsxs(U,{children:[e.jsx(k,{value:"all",children:"Все страны"}),N.map(s=>e.jsxs(k,{value:s.countryCode,children:[s.countryName," (",s.deliveriesCount,")"]},s.countryCode))]})]})]})]})]}),e.jsx(b,{children:e.jsx(w,{className:"pt-6",children:e.jsxs(we,{value:f,onValueChange:C,children:[e.jsxs(Ce,{className:"mb-4",children:[e.jsxs(V,{value:"overview",className:"gap-2",children:[e.jsx(Ee,{className:"h-4 w-4"}),"Обзор"]}),e.jsxs(V,{value:"countries",className:"gap-2",children:[e.jsx(Q,{className:"h-4 w-4"}),"Страны"]}),e.jsxs(V,{value:"deliveries",className:"gap-2",children:[e.jsx(De,{className:"h-4 w-4"}),"Поставки"]})]}),e.jsxs(_,{value:"overview",className:"space-y-4 pt-2",children:[e.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[e.jsxs(b,{children:[e.jsx(y,{children:e.jsx(T,{className:"text-sm",children:"Распределение по странам"})}),e.jsx(w,{children:e.jsx("div",{style:{height:320},children:e.jsx(B,{data:te,options:{maintainAspectRatio:!1,plugins:{legend:{position:"right"},tooltip:{callbacks:{label:s=>{const r=s.label||"",l=s.raw||0,d=g.totalVolume?(l/g.totalVolume*100).toFixed(1):0;return`${r}: ${l.toFixed(3)} м³ (${d}%)`}}}}}})})})]}),e.jsxs(b,{children:[e.jsx(y,{children:e.jsx(T,{className:"text-sm",children:"Статусы поставок"})}),e.jsx(w,{children:e.jsx("div",{style:{height:320},children:e.jsx(B,{data:ae,options:{maintainAspectRatio:!1,plugins:{legend:{position:"right"},tooltip:{callbacks:{label:s=>{const r=s.label||"",l=s.raw||0,d=u.completed+u.onTheWay+u.stoppedAcceptance+u.stoppedViolation,v=d?(l/d*100).toFixed(1):0;return`${r}: ${l} (${v}%)`}}}}}})})})]})]}),e.jsxs(b,{children:[e.jsx(y,{children:e.jsx(T,{className:"text-sm",children:"Объем по типу лесоматериалов"})}),e.jsx(w,{children:e.jsx("div",{style:{height:320},children:e.jsx(ie,{data:oe,options:{maintainAspectRatio:!1,scales:{y:{beginAtZero:!0,title:{display:!0,text:"Объем (м³)"}},x:{title:{display:!0,text:"Лесоматериалы"}}},plugins:{tooltip:{callbacks:{label:s=>`${s.dataset.label}: ${s.raw.toFixed(3)} м³`}}}}})})})]})]}),e.jsx(_,{value:"countries",className:"pt-2",children:e.jsxs(b,{children:[e.jsx(y,{children:e.jsx(T,{className:"text-sm",children:"Экспорт по странам"})}),e.jsx(w,{className:"overflow-x-auto",children:e.jsxs(I,{children:[e.jsx(Y,{children:e.jsxs(A,{children:[e.jsx(h,{children:"Страна"}),e.jsx(h,{children:"Кол-во поставок"}),e.jsx(h,{children:"Общий объем (м³)"}),e.jsx(h,{children:"В пути"}),e.jsx(h,{children:"Завершено"}),e.jsx(h,{children:"Остановлено"})]})}),e.jsx(z,{children:N.map(s=>e.jsxs(A,{children:[e.jsxs(c,{children:[e.jsx("div",{className:"font-semibold",children:s.countryName}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Код: ",s.countryCode]})]}),e.jsx(c,{children:s.deliveriesCount}),e.jsx(c,{children:s.totalVolume.toFixed(3)}),e.jsx(c,{children:s.onTheWayCount}),e.jsx(c,{children:s.completedCount}),e.jsx(c,{children:s.stoppedCount})]},s.countryCode))})]})})]})}),e.jsxs(_,{value:"deliveries",className:"pt-2 space-y-3",children:[e.jsxs("div",{className:"flex flex-col gap-2 md:flex-row md:items-center md:justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"text-sm font-semibold",children:["Список поставок (",L.length,")"]}),e.jsxs("div",{className:"relative",children:[e.jsx(be,{className:"pl-7 h-8 text-sm",placeholder:"Поиск по №, стране, ТС...",value:o,onChange:s=>t(s.target.value)}),e.jsx(Z,{className:"absolute left-2 top-1.5 h-4 w-4 text-muted-foreground"})]})]}),e.jsxs(ee,{variant:"outline",size:"sm",onClick:ne,className:"gap-2",children:[e.jsx(Ae,{className:"h-4 w-4"}),"Экспорт в Excel"]})]}),e.jsx("div",{className:"overflow-x-auto",children:e.jsxs(I,{children:[e.jsx(Y,{children:e.jsxs(A,{children:[e.jsx(h,{children:"№ документа"}),e.jsx(h,{children:"Дата"}),e.jsx(h,{children:"Статус"}),e.jsx(h,{children:"Покупатель"}),e.jsx(h,{children:"Код ТНВЭД"}),e.jsx(h,{children:"Транспорт"}),e.jsx(h,{children:"Маршрут"})]})}),e.jsxs(z,{children:[L.map(s=>{var r,l;return e.jsxs(A,{children:[e.jsx(c,{children:e.jsx("a",{href:`https://pub.fgislk.gov.ru/pudpd
1/api/pudpd/public/transportation/html/${s.transportationDocNo}`,target:"_blank",rel:"noopener noreferrer",className:"text-primary underline text-sm",children:s.transportationDocNo})}),e.jsxs(c,{children:[e.jsx("div",{className:"text-sm",children:O(new Date(s.signDttm),"dd.MM.yyyy")}),e.jsx("div",{className:"text-xs text-muted-foreground",children:O(new Date(s.signDttm),"HH:mm")})]}),e.jsx(c,{children:e.jsx(Oe,{status:s.transportationDocStatusCode,terminationReason:s.terminationReasonCode})}),e.jsxs(c,{children:[e.jsx("div",{className:"text-sm",children:s.receiverName||"Не указан"}),e.jsxs("div",{className:"text-xs text-muted-foreground",children:["Перевозчик: ",s.carrierName||"—"]}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-1",children:["Страна: ",s.destinationCountryName]})]}),e.jsx(c,{children:(r=s.consignmentJson)==null?void 0:r.map((d,v)=>e.jsxs("div",{className:"text-xs",children:[d.tnvedCode," ",e.jsxs(se,{variant:"secondary",className:"ml-1",children:[(d.volumeNval||0).toFixed(3)," м³"]})]},v))}),e.jsxs(c,{children:[e.jsx("div",{className:"text-sm",children:s.transportKindName}),e.jsx("div",{className:"text-xs text-muted-foreground",children:s.machineryNumberDesc})]}),e.jsxs(c,{className:"text-xs",children:[e.jsxs("div",{className:"flex items-center",children:[e.jsx("span",{className:"text-destructive mr-1",children:"📍"}),"От: ",((l=s.departureAddress)==null?void 0:l.slice(0,30))||"—",s.departureAddress&&s.departureAddress.length>30&&"..."]}),e.jsxs("div",{className:"flex items-center mt-1",children:[e.jsx("span",{className:"text-emerald-600 mr-1",children:"🚩"}),"Назначение: ",s.destinationCountryName]})]})]},s.transportationDocNo)}),!L.length&&e.jsx(A,{children:e.jsx(c,{colSpan:7,className:"text-center py-4 text-muted-foreground",children:"Поставки не найдены"})})]})]})})]})]})})})]})};export{qe as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.