|
@@ -32,6 +32,7 @@ import {
|
|
decDensity as decDensityFromAction,
|
|
decDensity as decDensityFromAction,
|
|
incThickness as incThicknessFromAction,
|
|
incThickness as incThicknessFromAction,
|
|
decThickness as decThicknessFromAction,
|
|
decThickness as decThicknessFromAction,
|
|
|
|
+ setExposureModeFromAction,
|
|
} from '../../API/exam/APRActions';
|
|
} from '../../API/exam/APRActions';
|
|
import emitter from '../../utils/eventEmitter';
|
|
import emitter from '../../utils/eventEmitter';
|
|
import {
|
|
import {
|
|
@@ -47,6 +48,7 @@ import {
|
|
decDensity,
|
|
decDensity,
|
|
incThickness,
|
|
incThickness,
|
|
decThickness,
|
|
decThickness,
|
|
|
|
+ setExposureModeThunk,
|
|
} from '../../states/exam/aprSlice';
|
|
} from '../../states/exam/aprSlice';
|
|
import store from '../../states/store';
|
|
import store from '../../states/store';
|
|
|
|
|
|
@@ -66,6 +68,9 @@ class ParaSettingCoordinator {
|
|
emitter.on('NEW_THICKNESS', (newValue) =>
|
|
emitter.on('NEW_THICKNESS', (newValue) =>
|
|
this.handleNewThickness(newValue)
|
|
this.handleNewThickness(newValue)
|
|
);
|
|
);
|
|
|
|
+ emitter.on('NEW_EXPOSURE_MODE', (newValue) =>
|
|
|
|
+ this.handleNewExposureMode(newValue)
|
|
|
|
+ );
|
|
}
|
|
}
|
|
|
|
|
|
handleNewKV(newValue) {
|
|
handleNewKV(newValue) {
|
|
@@ -117,6 +122,54 @@ class ParaSettingCoordinator {
|
|
});
|
|
});
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ handleNewExposureMode(newValue) {
|
|
|
|
+ // 将数字转换为字符串: 0 -> 'time', 1 -> 'mAs'
|
|
|
|
+ const mode = newValue === 0 ? 'time' : 'mAs';
|
|
|
|
+ console.info('有新的曝光模式从设备端到来。handleNewExposureMode', newValue, '转换为:', mode);
|
|
|
|
+ this.dispatch({
|
|
|
|
+ type: setExposureModeThunk.fulfilled.type,
|
|
|
|
+ payload: mode,
|
|
|
|
+ meta: { arg: mode, requestId: '' },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ setExposureMode(mode: string) {
|
|
|
|
+ console.info('[ParaSettingCoordinator] 切换曝光模式:', mode);
|
|
|
|
+
|
|
|
|
+ // 1. Dispatch pending
|
|
|
|
+ this.dispatch({
|
|
|
|
+ type: setExposureModeThunk.pending.type,
|
|
|
|
+ meta: { arg: mode, requestId: '' },
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // 2. 调用API
|
|
|
|
+ try {
|
|
|
|
+ // 将UI字符串转换为API需要的数字: 'mAs' -> 1, 'time' -> 0
|
|
|
|
+ let reqParam;
|
|
|
|
+ if (mode === 'mAs') {
|
|
|
|
+ // 构造参数对象
|
|
|
|
+ reqParam = JSON.stringify({
|
|
|
|
+ P0: "1"
|
|
|
|
+ });
|
|
|
|
+ } else if (mode === 'time') {
|
|
|
|
+ // 构造参数对象
|
|
|
|
+ reqParam = JSON.stringify({
|
|
|
|
+ P0: "0"
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ console.info('[ParaSettingCoordinator] 下发曝光模式参数:', reqParam);
|
|
|
|
+ setExposureModeFromAction(reqParam);
|
|
|
|
+ } catch (error) {
|
|
|
|
+ console.error('[ParaSettingCoordinator] 切换曝光模式失败:', error);
|
|
|
|
+ this.dispatch({
|
|
|
|
+ type: setExposureModeThunk.rejected.type,
|
|
|
|
+ payload: error,
|
|
|
|
+ meta: { arg: mode, requestId: '' },
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
increaseKV() {
|
|
increaseKV() {
|
|
this.dispatch({
|
|
this.dispatch({
|
|
type: incKV.pending.type,
|
|
type: incKV.pending.type,
|