From 26ac8df73cec9d90dca7be6bae1d0e288e7af3e7 Mon Sep 17 00:00:00 2001 From: "ZHOUZ\\Noble'lift" <1014987728@qq.com> Date: Mon, 10 Oct 2022 16:05:31 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pda/mps/rest/PointStatusController.java | 3 +- .../pda/mps/service/PointStatusService.java | 4 +- .../service/impl/PointStatusServiceImpl.java | 98 +++++++++++++++++-- 3 files changed, 94 insertions(+), 11 deletions(-) diff --git a/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/PointStatusController.java b/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/PointStatusController.java index fa5964a6e..a299c7fbe 100644 --- a/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/PointStatusController.java +++ b/nladmin-system/src/main/java/org/nl/wms/pda/mps/rest/PointStatusController.java @@ -29,7 +29,8 @@ public class PointStatusController { @Log("点位解绑绑定") @ApiOperation("点位解绑绑定") public ResponseEntity pointOperate(@RequestBody JSONObject whereJson) { - return new ResponseEntity<>(pointStatusService.pointOperate(whereJson), HttpStatus.OK); + pointStatusService.pointOperate(whereJson); + return new ResponseEntity<>(HttpStatus.OK); } @PostMapping("/pointStatusQuery") diff --git a/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/PointStatusService.java b/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/PointStatusService.java index 8e8de9e47..9613d7edf 100644 --- a/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/PointStatusService.java +++ b/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/PointStatusService.java @@ -6,13 +6,15 @@ public interface PointStatusService { /** * 点位操作 + * * @param whereJson / * @return JSONObject */ - JSONObject pointOperate(JSONObject whereJson); + void pointOperate(JSONObject whereJson); /** * 点位状态查询 + * * @param whereJson / * @return JSONObject */ diff --git a/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/PointStatusServiceImpl.java b/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/PointStatusServiceImpl.java index e82d2168f..a82f610f4 100644 --- a/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/PointStatusServiceImpl.java +++ b/nladmin-system/src/main/java/org/nl/wms/pda/mps/service/impl/PointStatusServiceImpl.java @@ -1,32 +1,112 @@ package org.nl.wms.pda.mps.service.impl; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; import com.alibaba.fastjson.JSONObject; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.nl.modules.common.exception.BadRequestException; +import org.nl.modules.wql.core.bean.WQLObject; import org.nl.wms.pda.mps.service.BakingService; import org.nl.wms.pda.mps.service.PointStatusService; import org.springframework.stereotype.Service; @Service @RequiredArgsConstructor + @Slf4j public class PointStatusServiceImpl implements PointStatusService { @Override - public JSONObject pointOperate(JSONObject whereJson) { - JSONObject result = new JSONObject(); - result.put("code", "1"); - result.put("desc", "查询成功"); - return result; + public void pointOperate(JSONObject whereJson) { + String point_code = whereJson.getString("point_code"); + if (StrUtil.isEmpty(point_code)){ + throw new BadRequestException("输入的点位不能为空!"); + } + + String option = whereJson.getString("point_code"); + //1-绑定 + if (option.equals("1")){ + String container_name = whereJson.getString("container_name"); + if (StrUtil.isEmpty(container_name)){ + throw new BadRequestException("空轴/母卷不能为空!"); + } + //查询该点对应的是什么位置 + JSONObject cut_point = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("full_point_code = '"+point_code+"'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(cut_point)){ + String now_container_name = cut_point.getString("container_name"); + if (StrUtil.isNotEmpty(now_container_name)){ + throw new BadRequestException("该点位上已存在母卷,不能进行绑定!"); + } + cut_point.put("container_name",container_name); + cut_point.put("full_point_status","02"); + }else { + cut_point = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("empty_point_code = '"+point_code+"'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(cut_point)){ + String empty_vehicle_code = cut_point.getString("empty_vehicle_code"); + if (StrUtil.isNotEmpty(empty_vehicle_code)){ + throw new BadRequestException("该点位上已存在空轴,不能进行绑定!"); + } + cut_point.put("empty_vehicle_code",container_name); + cut_point.put("empty_point_status","02"); + }else { + throw new BadRequestException("未查询到对应的分切点!"); + } + } + } + //2-解绑 + if (option.equals("2")){ + //查询该点对应的是什么位置 + JSONObject cut_point = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("full_point_code = '"+point_code+"'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(cut_point)){ + String now_container_name = cut_point.getString("container_name"); + if (StrUtil.isNotEmpty(now_container_name)){ + throw new BadRequestException("该点位上已存在母卷,不能进行绑定!"); + } + cut_point.put("container_name",""); + cut_point.put("full_point_status","01"); + }else { + cut_point = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("empty_point_code = '"+point_code+"'").uniqueResult(0); + if (ObjectUtil.isNotEmpty(cut_point)){ + String empty_vehicle_code = cut_point.getString("empty_vehicle_code"); + if (StrUtil.isNotEmpty(empty_vehicle_code)){ + throw new BadRequestException("该点位上已存在空轴,不能进行绑定!"); + } + cut_point.put("empty_vehicle_code",""); + cut_point.put("empty_point_status","01"); + }else { + throw new BadRequestException("未查询到对应的分切点!"); + } + } + } } @Override public JSONObject pointStatusQuery(JSONObject whereJson) { - JSONObject result = new JSONObject(); - result.put("code", "1"); - result.put("desc", "查询成功"); - return result; + String point_code = whereJson.getString("point_code"); + if (StrUtil.isEmpty(point_code)){ + throw new BadRequestException("输入的点位不能为空!"); + } + String vehicle_code = ""; + String have_goods = ""; + JSONObject cut_point = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("full_point_code = '"+point_code+"'").uniqueResult(0); + if (ObjectUtil.isEmpty(cut_point)){ + cut_point = WQLObject.getWQLObject("ST_IVT_CutPointIvt").query("empty_point_code = '"+point_code+"'").uniqueResult(0); + if (ObjectUtil.isEmpty(cut_point)){ + throw new BadRequestException("未查询到对应的分切机点位!"); + }else { + vehicle_code = cut_point.getString("empty_vehicle_code"); + have_goods = cut_point.getString("empty_point_status"); + } + }else { + vehicle_code = cut_point.getString("container_name"); + have_goods = cut_point.getString("full_point_status"); + } + JSONObject jo = new JSONObject(); + jo.put("container_name",vehicle_code); + jo.put("have_goods",have_goods); + return jo; }