beginSocket(ws: Client): void { const facilityData: IZSendAlgoFacilityInfo[] = []; if…
- User
beginSocket(ws: Client): void { const facilityData: IZSendAlgoFacilityInfo[] = []; if (this.facilitiesData.length > 0) { this.facilitiesData.forEach((element: IZAlgoFacility) => { if (element.zexOperationUnitTms[0] && element.zexFacUnitCosts[0]) facilityData.push({ facilityId: element.facUnitCd, name: element.facUnitNm, address: element.zexSrvcLoc.srvcAddr1, openTm: element.zexOperationUnitTms[0].unitDowOpenTm.replace(':', ''), closeTm: element.zexOperationUnitTms[0].unitDowCloseTm.replace(':', ''), tippingFee: element.zexFacUnitCosts[0].unitCostDispTipFees, costPerTon: element.zexFacUnitCosts[0].unitCostDispPerTon, srvtTm: element.zexOperationUnitTms[0].srvcUnitTm, materialTypId: element.zexFacUnitCosts[0].materialTypId == 0 ? null : element.zexFacUnitCosts[0].materialTypId }); }); }
const vehiclesData: IZSendAlgoVehicleInfo[] = []; if (this.rvData.length > 0) { this.rvData.forEach((element: IZAlgoVehicleunit) => { vehiclesData.push({ vehicleId: element.zexVehUnit.vehId, size: element.zexVehUnit.vehSizeVal, netWeight: element.zexVehUnit.vehNetWtVal, compactionRatio: element.zexVehUnit.vehCompRatioVal, lunchStartTm: element.zexVehUnit.vehLunchStartTm, lunchEndTm: element.zexVehUnit.vehLunchStopTm, lunchDuration: element.zexVehUnit.vehLunchTm, vehStartTm: element.zexVehUnit.vehStartTm, vehStopTm: element.zexVehUnit.vehStopTm, vehStartLocId: element.zexVehUnit.vehStartLocId, vehEndLocId: element.zexVehUnit.vehEndLocId, dow: element.dow } as IZSendAlgoVehicleInfo); }); } const containerList: { qty: number; size: number }[] = []; if (this.containerData.length > 0) { this.containerData.forEach((element: IZContainerInfo) => { containerList.push({ qty: element.contQty, size: element.contSize }); }); } let routeConstraintsData: IZRouteConstraints = {} as IZRouteConstraints; if (this.routeData[0]) { routeConstraintsData = { routeBeginTm: this.routeData[0].unitDowOpenTm?.replace(':', ''), routeEndTime: this.routeData[0].unitDowCloseTm?.replace(':', ''), maxYards: 999999999, maxWeight: 999999999, maxLifts: 999999, maxHours: 15, costPerHour: this.routeData[0].costPerHr, travelTmFactor: this.routeData[0].odTtmFacVal, preTripTm: this.routeData[0].preTripTmSec, postTripTm: this.routeData[0].postTripTmSec, lunchStartTm: this.routeData[0].lunchStartTm.replace(':', ''), lunchEndTm: this.routeData[0].lunchStopTm.replace(':', ''), lunchDuration: this.routeData[0].lunchTmSec }; } const data: IZCTSAlgoRequest = { algType: this.reportName == 'Disposal' ? 'DISPOSAL' : (algoTypeLut[this.commonService.appCode]?.CTS ?? ''), userId: this._http.usrId, accountId: this._http.accountId, opArea: this.opsUnit, routeType: this.routeType, routes: [], algoRequestCommonParam: { stops: this.stops, lifts: this.lifts, weight: this.weight, volume: this.yards }, routeConstraints: routeConstraintsData, facilities: facilityData, vehicleList: vehiclesData, containerList, isRequestAgain: this.isReqForSmAlgAgnRn, //ZRP-2418 - Added below params for Cost To Serve to use DLO for cost and time calculation dbgCollapseOption: 2, optimizeFlag: this.optimizedBy, minPctFull: 10, maxPctAllowance: 0, honorCustomerTimeWindows: 'Y', honorLoadNo: 'N', mustDisposalFlag: 'N', clusterByLoad: 'Y', keepRouteNo: 'Y', keepSequenceNo: 'Y' }; if (this.reportName == 'Disposal' && this.reportTypeInfo.type == 'RT') { data.dowList = []; } else { if (this.dow.length) { data.dowList = this.dow; } } this.startTime = new Date(); this.refreshTime = this.startTime; const secs: number = this.commonService.getTimeDifferenceInSeconds(this.refreshTime, this.startTime); this.duration = this._http.convertSecsIntoMins(secs); ws.send('/app/startJob', {}, JSON.stringify(data)); - Assistant