| | |
| | | package com.mes.bigstorage.controller; |
| | | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.mes.bigstorage.entity.BigStorageCageDetails; |
| | | import com.mes.bigstorage.entity.dto.GlassInfoLackDTO; |
| | | import com.mes.bigstorage.entity.dto.TemperingGlassCountDTO; |
| | | import com.mes.bigstorage.entity.vo.BigStorageQueryVO; |
| | | import com.mes.bigstorage.service.BigStorageCageDetailsService; |
| | | import io.swagger.annotations.ApiModel; |
| | | import com.mes.bigstorage.service.BigStorageCageService; |
| | | import com.mes.common.config.Const; |
| | | import com.mes.glassinfo.entity.GlassInfo; |
| | | import com.mes.utils.RedisUtil; |
| | | import com.mes.utils.Result; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @author zhoush |
| | | * @since 2024-03-27 |
| | | */ |
| | | @ApiModel(description = "理片笼详情") |
| | | @Api(tags = "理片笼详情") |
| | | @RestController |
| | | @RequestMapping("/bigStorageCageDetails") |
| | | public class BigStorageCageDetailsController { |
| | | |
| | | @Autowired |
| | | private BigStorageCageDetailsService bigStorageCageDetailsService; |
| | | @Autowired |
| | | private BigStorageCageService bigStorageCageService; |
| | | @Resource |
| | | private RedisUtil redisUtil; |
| | | |
| | | @ApiOperation("理片笼详情") |
| | | @GetMapping("/bigStorageCageDetails") |
| | | public List<BigStorageCageDetails> bigStorageCageDetails() { |
| | | return bigStorageCageDetailsService.list(); |
| | | |
| | | @ApiOperation("玻璃详情查询") |
| | | @PostMapping("/selectBigStorageCageDetails") |
| | | public Result selectBigStorageCageDetails(@RequestBody Map map) { |
| | | List<BigStorageCageDetails> bigStorageCageDetails = bigStorageCageDetailsService.selectBigStorageCageDetails(map.get("glassId").toString()); |
| | | if (bigStorageCageDetails.size() > 0) { |
| | | return Result.build(200, "查询成功", bigStorageCageDetails); |
| | | } else { |
| | | return Result.build(200, "查询失败,无此玻璃id", bigStorageCageDetails); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("理片笼详情添加") |
| | | @PostMapping("/insertBigStorageCageDetails") |
| | | public Result insertBigStorageCageDetails(@RequestBody BigStorageCageDetails bigStorageCageDetails) { |
| | | bigStorageCageDetailsService.insertBigStorageCageDetails(bigStorageCageDetails); |
| | | return Result.build(200, "添加成功", bigStorageCageService.querybigStorageCageDetail()); |
| | | } |
| | | |
| | | @ApiOperation("理片笼详情删除") |
| | | @PostMapping("/deleteBigStorageCageDetails") |
| | | public Result deleteBigStorageCageDetails(@RequestBody BigStorageCageDetails bigStorageCageDetails) { |
| | | bigStorageCageDetailsService.deleteBigStorageCageDetails(bigStorageCageDetails); |
| | | return Result.build(200, "删除成功", bigStorageCageService.querybigStorageCageDetail()); |
| | | } |
| | | |
| | | @ApiOperation("理片笼任务破损0/拿走1") |
| | | @PostMapping("/damageBigStorageCageDetails") |
| | | public Result damageBigStorageCageDetails(@RequestBody BigStorageCageDetails bigStorageCageDetails, int status) { |
| | | bigStorageCageDetailsService.damageBigStorageCageDetails(bigStorageCageDetails.getGlassId(), status); |
| | | return Result.build(200, "破损/拿走成功", 1); |
| | | } |
| | | |
| | | @ApiOperation("理片笼任务完成") |
| | | @PostMapping("/finishBigStorageCageDetails") |
| | | public Result finishBigStorageCageDetails(@RequestBody BigStorageCageDetails bigStorageCageDetails) { |
| | | bigStorageCageDetailsService.finishBigStorageCageDetails(bigStorageCageDetails); |
| | | return Result.build(200, "任务完成成功", 1); |
| | | } |
| | | |
| | | @ApiOperation("理片笼任务出片") |
| | | @PostMapping("/outBigStorageCageDetails") |
| | | public Result outBigStorageCageDetails(@RequestBody BigStorageCageDetails bigStorageCageDetails) { |
| | | bigStorageCageDetailsService.outBigStorageCageDetails(bigStorageCageDetails); |
| | | return Result.build(200, "出片添加成功", 1); |
| | | } |
| | | |
| | | @ApiOperation("指定钢化") |
| | | @PostMapping("/TemperingGlass") |
| | | public Result temperingGlass(@RequestBody BigStorageCageDetails bigStorageCageDetails) { |
| | | boolean result = bigStorageCageDetailsService |
| | | .temperingGlass(bigStorageCageDetails.getTemperingLayoutId().toString(), bigStorageCageDetails.getEngineerId(), bigStorageCageDetails.getTemperingFeedSequence().toString()); |
| | | if (result == true) { |
| | | return Result.build(200, "指定钢化成功", 1); |
| | | } else { |
| | | return Result.build(200, "已存在钢化任务,请等待钢化完成再指定钢化", 1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("指定钢化工程") |
| | | @PostMapping("/appointTemperingEngineerId") |
| | | public Result appointTemperingEngineerId(@RequestBody BigStorageCageDetails bigStorageCageDetails) { |
| | | boolean result = bigStorageCageDetailsService.appointTemperingEngineerId(bigStorageCageDetails.getEngineerId()); |
| | | if (result == true) { |
| | | return Result.build(200, "指定钢化成功", 1); |
| | | } else { |
| | | return Result.build(200, "已存在钢化任务,请等待钢化完成再指定钢化", 1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation("钢化/非钢化查询:0 非钢化 1:钢化") |
| | | @PostMapping("/selectTemperingGlass") |
| | | public Result<List<TemperingGlassCountDTO>> selectTemperingGlass(int isTempering) { |
| | | return Result.build(200, "查询成功", bigStorageCageDetailsService.selectTemperingGlass(isTempering)); |
| | | } |
| | | |
| | | @ApiOperation("缺片数量查询") |
| | | @PostMapping("/queryLackGlassInfo") |
| | | public Result<List<GlassInfoLackDTO>> queryLackGlassInfo(@RequestBody BigStorageQueryVO bigStorageQueryVO) { |
| | | return Result.build(200, "查询成功", bigStorageCageDetailsService.queryLackGlassInfo(bigStorageQueryVO)); |
| | | } |
| | | |
| | | @ApiOperation("是否调度开关") |
| | | @PostMapping("/dispatchSwitch") |
| | | public Result dispatchSwitch(Boolean flag) { |
| | | bigStorageCageDetailsService.dispatchSwitch(flag); |
| | | return Result.build(200, "修改成功", redisUtil.getCacheObject("dispatchSwitch")); |
| | | } |
| | | |
| | | @ApiOperation("是否钢化开关") |
| | | @PostMapping("/temperingSwitch") |
| | | public Result temperingSwitch(Boolean flag) { |
| | | bigStorageCageDetailsService.temperingSwitch(flag); |
| | | return Result.build(200, "修改成功", redisUtil.getCacheObject("temperingSwitch")); |
| | | } |
| | | |
| | | @ApiOperation("流程卡查询") |
| | | @PostMapping("/selectFlowCardByCache") |
| | | public Result selectFlowCardByCache() { |
| | | List<Map<String, Object>> flowCardIdCount = bigStorageCageDetailsService.listMaps( |
| | | new QueryWrapper<BigStorageCageDetails>() |
| | | .select("flow_card_id,layer,count(*) as count") |
| | | .eq("state", Const.GLASS_STATE_IN) |
| | | .eq("tempering_layout_id", 0) |
| | | .groupBy("flow_card_id,layer") |
| | | ); |
| | | return Result.build(200, "查询成功", flowCardIdCount); |
| | | } |
| | | |
| | | @ApiOperation("指定流程卡") |
| | | @PostMapping("/appointFlowCard") |
| | | public Result appointFlowCard(@RequestBody BigStorageCageDetails bigStorageCageDetails) { |
| | | List<BigStorageCageDetails> bigStorageCageDetailsList = bigStorageCageDetailsService.list( |
| | | new LambdaQueryWrapper<BigStorageCageDetails>() |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL) |
| | | ); |
| | | if (bigStorageCageDetailsList.size() == 0) { |
| | | bigStorageCageDetailsService.update( |
| | | new LambdaUpdateWrapper<BigStorageCageDetails>() |
| | | .set(BigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL) |
| | | .eq(BigStorageCageDetails::getFlowCardId, bigStorageCageDetails.getFlowCardId()) |
| | | .eq(BigStorageCageDetails::getLayer, bigStorageCageDetails.getLayer()) |
| | | .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN) |
| | | ); |
| | | return Result.build(200, "指定流程卡成功", 1); |
| | | } else { |
| | | return Result.build(200, "指定流程卡成功", 1); |
| | | } |
| | | } |
| | | @ApiOperation("大理片笼报破损") |
| | | @PostMapping("/bigStorageGlassDamageByGlassId") |
| | | public Result<String> bigStorageGlassDamageByGlassId(String glassId) { |
| | | return Result.build(200, "报破损成功", bigStorageCageDetailsService.bigStorageGlassDamageByGlassId(glassId)); |
| | | } |
| | | } |
| | | |