修改
This commit is contained in:
@@ -29,7 +29,8 @@ public class PointStatusController {
|
||||
@Log("点位解绑绑定")
|
||||
@ApiOperation("点位解绑绑定")
|
||||
public ResponseEntity<Object> pointOperate(@RequestBody JSONObject whereJson) {
|
||||
return new ResponseEntity<>(pointStatusService.pointOperate(whereJson), HttpStatus.OK);
|
||||
pointStatusService.pointOperate(whereJson);
|
||||
return new ResponseEntity<>(HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/pointStatusQuery")
|
||||
|
||||
@@ -6,13 +6,15 @@ public interface PointStatusService {
|
||||
|
||||
/**
|
||||
* 点位操作
|
||||
*
|
||||
* @param whereJson /
|
||||
* @return JSONObject
|
||||
*/
|
||||
JSONObject pointOperate(JSONObject whereJson);
|
||||
void pointOperate(JSONObject whereJson);
|
||||
|
||||
/**
|
||||
* 点位状态查询
|
||||
*
|
||||
* @param whereJson /
|
||||
* @return JSONObject
|
||||
*/
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user