forked from ddrilling/asb_cloud_front
fix WellSectionsStat and WellOperationsEditor data mapping
This commit is contained in:
parent
f39e550ac7
commit
2a6a53a1ce
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
},
|
||||
|
@ -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) => {
|
||||
|
Loading…
Reference in New Issue
Block a user