| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.param.*; |
| | | import com.zy.asrs.entity.ApiLog; |
| | | import com.zy.asrs.entity.DeviceConfig; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.service.ApiLogService; |
| | | import com.zy.asrs.service.DeviceConfigService; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.asrs.utils.NotifyUtils; |
| | | import com.zy.common.annotations.OpenApiLog; |
| | | import com.zy.common.service.CommonService; |
| | | import com.zy.core.cache.SlaveConnection; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | |
| | | private String mainProcessPlugin; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private NotifyUtils notifyUtils; |
| | | @Autowired |
| | | private ApiLogService apiLogService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean result = commonService.createLocMoveTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "移库任务" |
| | | , "/createLocMoveTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , result ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (result) { |
| | | return R.ok(); |
| | | } |
| | |
| | | if (param == null) { |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean result = commonService.createInTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "入库任务" |
| | | , "/createInTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , result ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (result) { |
| | | WrkMast wrkMast = commonService.createInTask(param); |
| | | if (wrkMast != null) { |
| | | return R.ok(); |
| | | } |
| | | return R.error("生成入库任务失败"); |
| | |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean result = commonService.createOutTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "出库任务" |
| | | , "/createOutTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , result ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (result) { |
| | | return R.ok(); |
| | | } |
| | |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean completeTask = commonService.completeTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "任务完成" |
| | | , "/completeTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , completeTask ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (completeTask) { |
| | | return R.ok(); |
| | | } |
| | |
| | | return R.error("参数不能为空"); |
| | | } |
| | | boolean completeTask = commonService.cancelTask(param); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "任务取消" |
| | | , "/cancelTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , null |
| | | , null |
| | | , completeTask ? 1 : 0 |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | if (completeTask) { |
| | | return R.ok(); |
| | | } |
| | |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("locNo", locMast.getLocNo()); |
| | | map.put("locSts", locMast.getLocSts()); |
| | | |
| | | map.put("barcode", locMast.getBarcode()); |
| | | return R.ok().add(map); |
| | | } |
| | | |
| | | @PostMapping("/getAllLocInformation") |
| | | @OpenApiLog(memo = "获取全部库位信息") |
| | | public R getAllLocInformation() { |
| | | List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()); |
| | | if (locMasts.isEmpty()) { |
| | | return R.error("库位信息不存在"); |
| | | public R getAllLocInformation(@RequestBody GetAllLocInformationParam param) { |
| | | List<HashMap<String, Object>> list = new ArrayList<>(); |
| | | EntityWrapper<LocMast> wrapper = new EntityWrapper<>(); |
| | | |
| | | if (!Cools.isEmpty(param.getRow())) { |
| | | wrapper.eq("row1", param.getRow()); |
| | | } |
| | | |
| | | ArrayList<HashMap<String, Object>> list = new ArrayList<>(); |
| | | if (!Cools.isEmpty(param.getLev())) { |
| | | wrapper.eq("lev1", param.getLev()); |
| | | } |
| | | |
| | | List<LocMast> locMasts = locMastService.selectList(wrapper); |
| | | if (locMasts.isEmpty()) { |
| | | return R.ok().add(list); |
| | | } |
| | | |
| | | for (LocMast locMast : locMasts) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("locNo", locMast.getLocNo()); |
| | | map.put("locSts", locMast.getLocSts()); |
| | | map.put("barcode", locMast.getBarcode()); |
| | | map.put("row", locMast.getRow1()); |
| | | map.put("bay", locMast.getBay1()); |
| | | map.put("lev", locMast.getLev1()); |
| | | list.add(map); |
| | | } |
| | | |
| | |
| | | wrapper.eq("io_type", ioType.id); |
| | | } |
| | | List<WrkMast> wrkMasts = wrkMastService.selectList(wrapper); |
| | | apiLogService.insert(new ApiLog( |
| | | null |
| | | , "查询任务" |
| | | , "/queryTask" |
| | | , null |
| | | , null |
| | | , null |
| | | , JSON.toJSONString(param) |
| | | , JSON.toJSONString(wrkMasts) |
| | | , null |
| | | , null |
| | | , 1 |
| | | , new Date() |
| | | , null |
| | | , null |
| | | )); |
| | | |
| | | return R.ok().add(wrkMasts); |
| | | } |
| | | |
| | |
| | | @GetMapping("/getFakeSystemRunStatus") |
| | | public R getFakeSystemRunStatus() { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | if(mainProcessPlugin.equals("FakeProcess")) { |
| | | if(mainProcessPlugin.contains("Fake")) { |
| | | map.put("running", false); |
| | | map.put("isFake", true); |
| | | Config config = configService.selectOne(new EntityWrapper<Config>().eq("code", "enableFake")); |