From 2c2413760b6467bf62402dba7338bd3bbcbd7341 Mon Sep 17 00:00:00 2001 From: huang <1532065656@qq.com> Date: 星期二, 20 五月 2025 14:20:38 +0800 Subject: [PATCH] 添加产量报表功能页面 --- JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/TaskingController.java | 188 ++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 153 insertions(+), 35 deletions(-) diff --git a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/TaskingController.java b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/TaskingController.java index 9cad4da..156a2d2 100644 --- a/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/TaskingController.java +++ b/JiuMuMesParent/moduleService/DeviceInteractionModule/src/main/java/com/mes/md/controller/TaskingController.java @@ -1,7 +1,17 @@ package com.mes.md.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.yulichang.wrapper.MPJLambdaWrapper; +import com.mes.md.entity.KBBTLensSorting; +import com.mes.md.entity.LineConfiguration; +import com.mes.md.entity.Machine; import com.mes.md.entity.Tasking; +import com.mes.md.mapper.KBBTLensSortingMapper; +import com.mes.md.mapper.MachineMapper; +import com.mes.md.mapper.TaskingMapper; +import com.mes.md.service.ProjectService; +import com.mes.md.service.TaskingLogService; import com.mes.md.service.TaskingService; import com.mes.utils.Result; import io.swagger.annotations.ApiOperation; @@ -9,61 +19,169 @@ import org.springframework.web.bind.annotation.*; import java.util.List; +import java.util.Map; /** * <p> * 宸ヤ綔浠诲姟鎿嶄綔璁板綍鏄庣粏 鍓嶇鎺у埗鍣� * </p> * - * @author wu - * @since 2024-08-28 + * @author yanzhixin + * @since 2024-09-13 */ @RestController - @RequestMapping("/jiumumes/tasking") + @RequestMapping("/tasking") public class TaskingController { @Autowired private TaskingService taskingService; - @ApiOperation("鍒囨崲妯″紡") - @PostMapping("/updateLoadState") //鍒囨崲妯″紡" + @Autowired + private ProjectService projectService; + @Autowired + private MachineMapper machineMapper; + @Autowired + private TaskingMapper taskingMapper; + @Autowired + private TaskingLogService taskingLogService; + @Autowired + private KBBTLensSortingMapper kBBTLensSortingMapper; + + + + @ApiOperation("鏌ヨ搴撲綅淇℃伅 杩斿洖缁撴灉") + @PostMapping("/findKBBTLensSorting") @ResponseBody - public Result<Boolean> updateStatus(@RequestBody Integer state) { - if(state == 1){ - boolean result =taskingService.updateStatus(state); - return Result.build(1,"瀹氬埗妯″紡",result); - }else { - boolean result =taskingService.updateStatus(state); - return Result.build(0,"鏍囧噯妯″紡",result); + public Result findKBBTLensSorting(@RequestBody Map<String, String> map) { + try { + String scanId=map.get("scanId").toString(); + if (!scanId.isEmpty()){ + List<KBBTLensSorting> list=kBBTLensSortingMapper.selectList(new QueryWrapper<KBBTLensSorting>().lambda() + .eq(KBBTLensSorting::getBarcode,scanId)); + return Result.build(200,"鎴愬姛",list); + } + return Result.build(199,"鍓嶇浼犲�糔ULL",map); + }catch (Exception e){ + return Result.build(199,"寮傚父",map); } } - @ApiOperation("鐐瑰嚮鏆傚仠璁惧") - @PostMapping("/updateLoadStatus") //鐐瑰嚮鏆傚仠璁惧 + @ApiOperation("鎵爜鎴愬姛鍚庤繑鍥炵粨鏋� machineId,scanId") + @PostMapping("/scanMachineAdd") @ResponseBody - public Result<Boolean> updateLoadStatus(@RequestBody Integer state) { - if(state == 1){ - boolean result =taskingService.updateLoadState(state); - return Result.build(1,"鎴愬姛",result); - }else { - boolean result =taskingService.updateLoadState(state); - return Result.build(0,"鎴愬姛",result); + public Result scanMachineAdd(@RequestBody Map<String, String> map) { + try { + String machineId=map.get("machineId").toString(); + String scanId=map.get("scanId").toString(); + if (!scanId.isEmpty()&&!machineId.isEmpty()){ + Machine machine = machineMapper.selectById(machineId); + int addCount =taskingService.scanMachineAdd(machine,scanId); + return Result.build(200,"鎴愬姛",addCount); + } + return Result.build(199,"鍓嶇浼犲�糔ULL",map); + }catch (Exception e){ + return Result.build(199,"寮傚父",map); } } - @ApiOperation("鐐瑰嚮鐮存崯") - @PostMapping("/updateDamage") //鏆傚仠涓婄墖浠诲姟 + @ApiOperation("鎶ュ伐鎻愪氦 ") + @PostMapping("/reportForWork") @ResponseBody - public Result<Tasking> updateDamage(@RequestBody Tasking tasking) { - - boolean result =taskingService.updateDamage(tasking); - return Result.build(1,"瀹氬埗妯″紡",null); - - + public Result reportForWork(@RequestBody Machine machine) { + try { + int deleteCount=taskingMapper.deleteJoin(new MPJLambdaWrapper<Tasking>() + .selectAll(Tasking.class) + .innerJoin(LineConfiguration.class,LineConfiguration::getId,Tasking::getLineConfigurationId) + .innerJoin(Machine.class,Machine::getId,LineConfiguration::getMachineId) + .eq(LineConfiguration::getMachineId,machine.getId()) + .eq(Tasking::getGlassState,"姝e父") + .eq(Tasking::getState,"绾夸笂") + .ne(Tasking::getWorkState,"瀹屽伐")); + taskingLogService.reportTaskingLog(); + return Result.build(200,"鎴愬姛",deleteCount); + }catch (Exception e){ + return Result.build(199,"寮傚父",machine); + } } - @ApiOperation("鏌ヨ褰撳墠妯″紡杩囧幓鐨勭幓鐠�") - @PostMapping("/selectTasking") //鏆傚仠涓婄墖浠诲姟 + @ApiOperation("鏌ヨ褰撳墠璁惧锛屾湭瀹屽伐鐘舵�佺殑绾夸笂浠诲姟") + @PostMapping("/findMachineTask") @ResponseBody - public Result<List<Tasking>> selectTasking() { - - List<Tasking> tasking =taskingService.selectTasking(); - return Result.build(1,"瀹氬埗妯″紡",tasking); + public Result findMachineTask(@RequestBody Machine machine) { + List<Tasking> list =taskingService.findMachineTask(machine); + return Result.build(200,"鎴愬姛",list); } + + @ApiOperation("鏌ヨ褰撳墠璁惧锛屾煇鐘舵�佺殑绾夸笂浠诲姟銆愮瓑寰�/姝e湪宸ヤ綔/瀹屽伐銆�") + @PostMapping("/findMachineWorkStateTask") + @ResponseBody + public Result findMachineWorkStateTask(@RequestBody Machine machine,String workState) { + List<Tasking> list =taskingService.findMachineWorkStateTask(machine,workState); + return Result.build(200,"鎴愬姛",list); + } + + @ApiOperation("淇敼鐜荤拑鐘舵�� 銆愮牬鎹熴��") + @PostMapping("/damagedTask") + @ResponseBody + public Result damagedTask(@RequestBody Tasking tasking) { + int count =taskingService.damagedTask(tasking); + return Result.build(200,"淇敼鎴愬姛锛�"+count,count); + } + @ApiOperation("淇敼浠诲姟鐘舵�� 銆愭鍦ㄥ伐浣溿��") + @PostMapping("/startMachineTask") + @ResponseBody + public Result startMachineTask(@RequestBody Machine machine) { + Tasking tasking =taskingService.startMachineTask(machine); + return Result.build(200,"淇敼鎴愬姛锛�",tasking); + } + @ApiOperation("淇敼浠诲姟鐘舵�� 銆愬け璐ャ��") + @PostMapping("/loseMachineTask") + @ResponseBody + public Result loseMachineTask(@RequestBody Machine machine) { + int count =taskingService.loseMachineTask(machine); + return Result.build(200,"淇敼鎴愬姛锛�"+count,count); + } + @ApiOperation("淇敼浠诲姟鐘舵�� 銆愬畬宸ャ��") + @PostMapping("/finishMachineTask") + @ResponseBody + public Result finishMachineTask(@RequestBody Machine machine) { + int count =taskingService.finishMachineTask(machine); + return Result.build(200,"淇敼鎴愬姛锛�"+count,count); + } + + @ApiOperation("淇敼褰撳墠璁惧 銆愪笂绾裤��") + @PostMapping("/glassTopLineList") + @ResponseBody + public Result glassTopLineList(@RequestBody List<Tasking> taskingList) { + int count =taskingService.glassTopLine(taskingList); + return Result.build(200,"淇敼鎴愬姛锛�"+count,count); + } + + @ApiOperation("淇敼褰撳墠璁惧 銆愪笂绾裤��") + @PostMapping("/glassTopLine") + @ResponseBody + public Result glassTopLine(@RequestBody Tasking tasking) { + int count =taskingService.glassTopLine(tasking); + return Result.build(200,"淇敼鎴愬姛锛�"+count,count); + } + + @ApiOperation("淇敼褰撳墠璁惧 銆愪笅绾裤��") + @PostMapping("/glassDownLine") + @ResponseBody + public Result glassDownLine(@RequestBody Tasking tasking) { + int count =taskingService.glassDownLine(tasking); + return Result.build(200,"淇敼鎴愬姛锛�"+count,count); + } + @ApiOperation("鐜荤拑 銆愪笅绾裤��") + @PostMapping("/glassAgainTopLine") + @ResponseBody + public Result glassAgainTopLine(@RequestBody Tasking tasking) { + int count =taskingService.stopTasking(tasking); + return Result.build(200,"淇敼鎴愬姛锛�"+count,count); + } + + @ApiOperation("鎻愪氦 鎵爜鎶ュ伐 ") + @PostMapping("/scanReport") + @ResponseBody + public Result scanReport(@RequestBody Tasking tasking) { + int count =taskingService.stopTasking(tasking); + return Result.build(200,"淇敼鎴愬姛锛�"+count,count); + } + } -- Gitblit v1.8.0