huang
2025-10-22 78d73df2f8e0c6855d65eb1f2c6df08e0f99bab1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package com.mes.rawglassstation.controller;
 
import com.mes.rawglassstation.service.RawGlassStorageStationService;
import com.mes.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.context.MessageSource;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.web.bind.annotation.*;
 
import javax.annotation.Resource;
 
/**
 * 前端控制器
 *
 * @author wf
 * @since 2024-09-10
 */
@RestController
@RequestMapping("/rawGlassStorageStation")
public class RawGlassStorageStationController {
 
  @Resource RawGlassStorageStationService rawGlassStorageStationService;
 
  // 国际语言库
  @Resource
  private MessageSource messageSource;
 
  @ApiOperation("工位状态")
  @PostMapping("/updateSlotState")
  @ResponseBody
  public Result<Boolean> updateSlotState(@RequestParam(value = "state")int enableState, @RequestParam(value = "slot")int slot) {
    boolean result = rawGlassStorageStationService.updateSlotState(slot, enableState);
    String enable = messageSource.getMessage(
            "rawglass.enable",
            null,
            LocaleContextHolder.getLocale()
    );
    String disable = messageSource.getMessage(
            "rawglass.disable",
            null,
            LocaleContextHolder.getLocale()
    );
    if (enableState == 1) {
      return Result.build(200, enable, result);
    } else {
      return Result.build(200, disable, result);
    }
  }
}