wuyouming666
2024-07-10 fc7b97877ca01587fe4b3e6c7ac2f9f5be8dcc53
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downworkstation/controller/DownWorkstationController.java
@@ -2,6 +2,7 @@
import com.mes.downworkstation.entity.DownWorkstation;
import com.mes.downworkstation.entity.request.DownWorkRequest;
import com.mes.downworkstation.service.DownWorkstationService;
import com.mes.glassinfo.service.GlassInfoService;
import io.swagger.annotations.Api;
@@ -25,7 +26,7 @@
 */
@RestController
@Api(tags = "工位")
@Api(description = "工位")
@RequestMapping("/downWorkStation")
public class DownWorkstationController {
@@ -37,7 +38,7 @@
    @GetMapping("/getone")
    public ResponseEntity<?> getOneDownWorkstations() {
        try {
            List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,5);
            List<DownWorkstation> data = downWorkstationService.getoneDownWorkstations(1,6);
            // 构建符合预期格式的响应数据
            Map<String, Object> responseData = new HashMap<>();
            responseData.put("code", 200);
@@ -74,20 +75,13 @@
    }
//绑定架子
@ApiOperation("绑定架子")
    //绑定架子
    @ApiOperation("绑定架子")
    @PostMapping("/updateFlowCardId")
    public ResponseEntity<Map<String, Object>> updateFlowCardId(@RequestBody Map<String, Object> requestData) {
        // 从 requestData 中获取传入的 flowCardId
        String flowCardId = (String) requestData.get("flowCardId");
        int workstationId = (int) requestData.get("workstationId");
    public ResponseEntity<Map<String, Object>> updateFlowCardId(@RequestBody DownWorkRequest request) {
        // 查询对应 flowCardId 的玻璃信息总数量
        int glassInfoCount = glassInfoService.getGlassInfoCountByFlowCardId(flowCardId);
        // 更新 down_workstation 表中的总数量
        downWorkstationService.updateFlowCardIdAndCount(flowCardId, glassInfoCount, workstationId);
        // 绑定架子
        downWorkstationService.updateFlowCardIdAndCount(request.getFlowCardId(),  request.getWorkstationId(), request.getLayer());
        // 构建响应数据
        Map<String, Object> responseData = new HashMap<>();
@@ -131,6 +125,44 @@
    @ApiOperation("获取工位显示图1")
    @GetMapping("/getwo")
    public ResponseEntity<Map<String, Object>> getwo() {
        Map<String, Object> responseData = new HashMap<>();
        try {
            List<Map<String, Object>> data = downWorkstationService.getTotalGlassDimensionsByWorkstation(1,3);
            responseData.put("code", 200);
            responseData.put("msg", "成功");
            responseData.put("data", data);
            return ResponseEntity.ok(responseData);
        } catch (Exception e) {
            responseData.put("code", 500);
            responseData.put("msg", "失败");
            responseData.put("data", null);
            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseData);
        }
    }
    @ApiOperation("获取工位显示图2")
    @GetMapping("/getwo2")
    public ResponseEntity<Map<String, Object>> getw2o() {
        Map<String, Object> responseData = new HashMap<>();
        try {
            List<Map<String, Object>> data = downWorkstationService.getTotalGlassDimensionsByWorkstation(4,6);
            responseData.put("code", 200);
            responseData.put("msg", "成功");
            responseData.put("data", data);
            return ResponseEntity.ok(responseData);
        } catch (Exception e) {
            responseData.put("code", 500);
            responseData.put("msg", "失败");
            responseData.put("data", null);
            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(responseData);
        }
    }
}