|
@@ -1,7 +1,8 @@
|
|
|
/* eslint-disable */
|
|
|
import { createSlice, PayloadAction, Middleware, createAsyncThunk } from '@reduxjs/toolkit';
|
|
|
-import { AprConfig, getAprExposureParams } from '../../API/exam/APRActions';
|
|
|
+import { AprConfig, getAprExposureParams, SetAPR } from '../../API/exam/APRActions';
|
|
|
import { workstationIdFromWorkstation } from '../workstation';
|
|
|
+import { ExtendedBodyPosition, setSelectedBodyPosition } from '../exam/bodyPositionListSlice';
|
|
|
|
|
|
interface AprState {
|
|
|
aprConfig: AprConfig;
|
|
@@ -158,6 +159,37 @@ const aprSlice = createSlice({
|
|
|
})
|
|
|
.addCase(decDensity.rejected, (state, action) => {
|
|
|
console.error('Failed to decrease Density', action.error);
|
|
|
+ })
|
|
|
+ .addCase(setSelectedBodyPosition, (state, action: PayloadAction<ExtendedBodyPosition | null>) => {
|
|
|
+ console.log('APR Extra Reducer triggered for setSelectedBodyPosition action');
|
|
|
+ const selectedBodyPosition = action.payload;
|
|
|
+ if (selectedBodyPosition) {
|
|
|
+ const reqParam = JSON.stringify({
|
|
|
+ FOCUS: "0",
|
|
|
+ TECHMODE: "0",
|
|
|
+ AECFIELD: "101",
|
|
|
+ AECFILM: "0",
|
|
|
+ AECDENSITY: "0",
|
|
|
+ KV: state.aprConfig.kV.toString(),
|
|
|
+ MA: state.aprConfig.mA.toString(),
|
|
|
+ MS: state.aprConfig.ms.toString(),
|
|
|
+ MAS: state.aprConfig.mAs.toString(),
|
|
|
+ KV2: "0.0",
|
|
|
+ MA2: "0.0",
|
|
|
+ MS2: "0.0",
|
|
|
+ DOSE: "0.0",
|
|
|
+ FILTER: "null",
|
|
|
+ TUBELOAD: "0.0",
|
|
|
+ WORKSTATION: selectedBodyPosition.work_station_id
|
|
|
+ });
|
|
|
+ SetAPR(reqParam)
|
|
|
+ .then(() => {
|
|
|
+ console.log('SetAPR method called successfully');
|
|
|
+ })
|
|
|
+ .catch((error) => {
|
|
|
+ console.error('Error calling SetAPR method:', error);
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
},
|
|
|
});
|