| | |
| | | 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.TaskingService; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.ApiOperation; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class TaskingController { |
| | | @Autowired |
| | | private TaskingService taskingService; |
| | | @Autowired |
| | | private ProjectService projectService; |
| | | @Autowired |
| | | private MachineMapper machineMapper; |
| | | @Autowired |
| | | private TaskingMapper taskingMapper; |
| | | |
| | | // @ApiOperation("切换模式") |
| | | // @PostMapping("/updateLoadState") //切换模式" |
| | | // @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); |
| | | // } |
| | | // } |
| | | // @ApiOperation("点击暂停设备") |
| | | // @PostMapping("/updateLoadStatus") //点击暂停设备 |
| | | // @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); |
| | | // } |
| | | // } |
| | | // @ApiOperation("点击破损") |
| | | // @PostMapping("/updateDamage") //暂停上片任务 |
| | | // @ResponseBody |
| | | // public Result<Tasking> updateDamage(@RequestBody Tasking tasking) { |
| | | // |
| | | // boolean result =taskingService.updateDamage(tasking); |
| | | // return Result.build(1,"定制模式",null); |
| | | // |
| | | // |
| | | // } |
| | | // @ApiOperation("查询当前模式过去的玻璃") |
| | | // @PostMapping("/selectTasking") //暂停上片任务 |
| | | // @ResponseBody |
| | | // public Result<List<Tasking>> selectTasking() { |
| | | // |
| | | // List<Tasking> tasking =taskingService.selectTasking(); |
| | | // return Result.build(1,"定制模式",tasking); |
| | | // } |
| | | @Autowired |
| | | private KBBTLensSortingMapper kBBTLensSortingMapper; |
| | | |
| | | |
| | | |
| | | @ApiOperation("查询库位信息 返回结果") |
| | | @PostMapping("/findKBBTLensSorting") |
| | | @ResponseBody |
| | | 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,"前端传值NULL",map); |
| | | }catch (Exception e){ |
| | | return Result.build(199,"异常",map); |
| | | } |
| | | } |
| | | @ApiOperation("扫码成功后返回结果 machineId,scanId") |
| | | @PostMapping("/scanMachineAdd") |
| | | @ResponseBody |
| | | 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,"前端传值NULL",map); |
| | | }catch (Exception e){ |
| | | return Result.build(199,"异常",map); |
| | | } |
| | | } |
| | | @ApiOperation("报工提交 ") |
| | | @PostMapping("/reportForWork") |
| | | @ResponseBody |
| | | 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,"正常") |
| | | .eq(Tasking::getState,"线上") |
| | | .ne(Tasking::getWorkState,"完工")); |
| | | return Result.build(200,"成功",deleteCount); |
| | | }catch (Exception e){ |
| | | return Result.build(199,"异常",machine); |
| | | } |
| | | } |
| | | @ApiOperation("查询当前设备,未完工状态的线上任务") |
| | | @PostMapping("/findMachineTask") |
| | | @ResponseBody |
| | |
| | | } |
| | | |
| | | @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 List<Tasking> taskingList) { |
| | | int count =taskingService.glassTopLine(taskingList); |
| | | public Result glassTopLine(@RequestBody Tasking tasking) { |
| | | int count =taskingService.glassTopLine(tasking); |
| | | return Result.build(200,"修改成功:"+count,count); |
| | | } |
| | | |
| | |
| | | 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); |
| | | } |
| | | |
| | | } |
| | | |