diff --git a/src/pages/WellOperations/WellOperationsEditor.jsx b/src/pages/WellOperations/WellOperationsEditor.jsx index ab45ace..3220d67 100644 --- a/src/pages/WellOperations/WellOperationsEditor.jsx +++ b/src/pages/WellOperations/WellOperationsEditor.jsx @@ -31,7 +31,7 @@ export const WellOperationsEditor = ({idWell, idType}) => { async () => { const skip = ((pageNumAndPageSize.current - 1) * pageNumAndPageSize.pageSize) || 0 const take = pageNumAndPageSize.pageSize - const paginatedOperations = await WellOperationService.getOperations(idWell, idType, undefined, undefined, undefined, undefined, skip, take ) + const paginatedOperations = await WellOperationService.getOperations(idWell, idType, undefined, undefined, undefined, undefined, undefined, undefined, skip, take ) const operations = paginatedOperations?.items ?? [] setOperations(operations) const total = paginatedOperations.count?? paginatedOperations.items?.length ?? 0 diff --git a/src/pages/WellOperations/WellSectionsStat.jsx b/src/pages/WellOperations/WellSectionsStat.jsx index 8843dee..6ca03fe 100644 --- a/src/pages/WellOperations/WellSectionsStat.jsx +++ b/src/pages/WellOperations/WellSectionsStat.jsx @@ -10,23 +10,51 @@ const columns = [ makeColumn('Тип секции','sectionType'), makeColumnsPlanFact('Глубина' ,'wellDepth', {render:makeNumberRender(2)}), makeColumnsPlanFact('Часы' ,'duration', {render:makeNumberRender(2)}), - makeColumnsPlanFact('МСП' ,'mechSpeed', {render:makeNumberRender(2)}), + makeColumnsPlanFact('МСП' ,'rop', {render:makeNumberRender(2)}), makeColumnsPlanFact('Рейсовая скорость' ,'routeSpeed', {render:makeNumberRender(2)}), makeColumnsPlanFact('Подъем КНБК' ,'bhaUpSpeed', {render:makeNumberRender(2)}), makeColumnsPlanFact('Спуск КНБК' ,'bhaDownSpeed', {render:makeNumberRender(2)}), makeColumnsPlanFact('Спуск ОК' ,'casingDownSpeed', {render:makeNumberRender(2)}), ] +const calcDuration = (start, end) => { + const msInDay = 1000*60*60*24 + const startD = new Date(start) + const endD = new Date(end) + const ms = endD - startD + return ms / msInDay +} + export const WellSectionsStat = ({idWell}) => { const [sections, setSections] = useState([]) const [showLoader, setShowLoader] = useState(false) useEffect(() => invokeWebApiWrapperAsync( async () => { - const sectionsResponse = await WellOperationStatService.getSectionsByWellId(idWell) + const sectionsResponse = await WellOperationStatService.getStatWell(idWell) - if(sectionsResponse){ - const sections = sectionsResponse.sort((a,b)=>a.wellDepthPlan - b.wellDepthPlan) + if(sectionsResponse?.sections){ + const sections = sectionsResponse.sections + .map(s=>({ + key: s.id, + sectionType: s.caption, + wellDepthPlan: s.plan?.wellDepthEnd, + durationPlan: calcDuration(s.plan?.start, s.plan?.end), + ropPlan: s.plan?.rop, + routeSpeedPlan: s.plan?.routeSpeed, + bhaUpSpeedPlan: s.plan?.bhaUpSpeed, + bhaDownSpeedPlan: s.plan?.bhaDownSpeed, + casingDownSpeedPlan: s.plan?.casingDownSpeed, + + wellDepthFact : s.fact?.wellDepthEnd, + durationFact : calcDuration(s.fact?.start, s.fact?.end), + ropFact : s.fact?.rop, + routeSpeedFact : s.fact?.routeSpeed, + bhaUpSpeedFact : s.fact?.bhaUpSpeed, + bhaDownSpeedFact : s.fact?.bhaDownSpeed, + casingDownSpeedFact : s.fact?.casingDownSpeed, + })) + .sort((a,b) => a.wellDepthPlan - b.wellDepthPlan) setSections(sections) } }, diff --git a/src/pages/WellOperations/dictionary.js b/src/pages/WellOperations/dictionary.js index 92b1db9..bf4a39f 100644 --- a/src/pages/WellOperations/dictionary.js +++ b/src/pages/WellOperations/dictionary.js @@ -1,11 +1,10 @@ export const dictionarySectionType = new Map([ - [1, 'Обощенное по скважине'], - [2, 'Пилотный ствол'], - [3, 'Направление'], - [4, 'Кондуктор'], - [5, 'Эксплуатационная колонна'], - [6, 'Транспортный ствол'], - [7, 'Хвостовик'], + [1, 'Пилотный ствол'], + [2, 'Направление'], + [3, 'Кондуктор'], + [4, 'Эксплуатационная колонна'], + [5, 'Транспортный ствол'], + [6, 'Хвостовик'], ]) export const getByKeyOrReturnKey = (dictionary, key) => {