宏丰二期手持
This commit is contained in:
@@ -30,11 +30,21 @@ public class pdaPointController {
|
|||||||
return new ResponseEntity<>(pdaPointService.queryPoint(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(pdaPointService.queryPoint(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/queryVehicle")
|
||||||
|
@Log("查询组盘")
|
||||||
|
@ApiOperation("查询组盘")
|
||||||
|
public ResponseEntity<Object> queryVehicle(@RequestBody JSONObject whereJson) {
|
||||||
|
return new ResponseEntity<>(pdaPointService.queryVehicle(whereJson), HttpStatus.OK);
|
||||||
|
}
|
||||||
|
|
||||||
@PostMapping("/binding")
|
@PostMapping("/binding")
|
||||||
@Log("点位绑定解绑")
|
@Log("点位绑定解绑")
|
||||||
@ApiOperation("点位绑定解绑")
|
@ApiOperation("点位绑定解绑")
|
||||||
public ResponseEntity<Object> binding(@RequestBody JSONObject whereJson) {
|
public ResponseEntity<Object> binding(@RequestBody JSONObject whereJson) {
|
||||||
return new ResponseEntity<>(pdaPointService.queryPoint(whereJson), HttpStatus.OK);
|
return new ResponseEntity<>(pdaPointService.binding(whereJson), HttpStatus.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,4 +11,18 @@ public interface PdaPointService {
|
|||||||
* @return JSONObject
|
* @return JSONObject
|
||||||
*/
|
*/
|
||||||
JSONObject queryPoint(JSONObject whereJson);
|
JSONObject queryPoint(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询组盘
|
||||||
|
* @param whereJson /
|
||||||
|
* @return JSONObject
|
||||||
|
*/
|
||||||
|
JSONObject queryVehicle(JSONObject whereJson);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点位绑定/解绑
|
||||||
|
* @param whereJson /
|
||||||
|
* @return JSONObject
|
||||||
|
*/
|
||||||
|
JSONObject binding(JSONObject whereJson);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,13 @@ package org.nl.wms.pda.point.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
import org.nl.modules.common.utils.RedisUtils;
|
import org.nl.modules.common.utils.RedisUtils;
|
||||||
|
import org.nl.modules.wql.WQL;
|
||||||
import org.nl.modules.wql.core.bean.WQLObject;
|
import org.nl.modules.wql.core.bean.WQLObject;
|
||||||
import org.nl.wms.basedata.service.VehicleService;
|
import org.nl.wms.basedata.service.VehicleService;
|
||||||
import org.nl.wms.basedata.service.dto.VehicleDto;
|
import org.nl.wms.basedata.service.dto.VehicleDto;
|
||||||
@@ -29,42 +31,77 @@ public class PdaPointServiceImpl implements PdaPointService {
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public JSONObject queryPoint(JSONObject param) {
|
public JSONObject queryPoint(JSONObject param) {
|
||||||
String vehicle_code = param.getString("carrier_code");
|
|
||||||
if (StrUtil.isBlank(vehicle_code)) {
|
|
||||||
throw new BadRequestException("载具号不能为空");
|
|
||||||
}
|
|
||||||
VehicleDto vehicle = vehicleService.findByCode(vehicle_code);
|
|
||||||
if (ObjectUtil.isEmpty(vehicle)) {
|
|
||||||
throw new BadRequestException("载具号不存在");
|
|
||||||
}
|
|
||||||
WQLObject wo = WQLObject.getWQLObject("ST_IVT_StructIvt");
|
|
||||||
WQLObject wo_point = WQLObject.getWQLObject("sch_base_point");
|
|
||||||
log.info("手持出库确认,从redis中删除对应的载具号:{},物料信息:{}", vehicle_code, redisUtils.get(vehicle_code));
|
|
||||||
redisUtils.del(vehicle_code);
|
|
||||||
redisUtils.del(vehicle_code + "-ivt_qty");
|
|
||||||
JSONObject jsonObject = wo.query("vehicle_code = '" + vehicle_code + "'").uniqueResult(0);
|
|
||||||
if (ObjectUtil.isNotEmpty(jsonObject)) {
|
|
||||||
jsonObject.put("vehicle_type", "");
|
|
||||||
jsonObject.put("vehicle_code", "");
|
|
||||||
jsonObject.put("material_id", "");
|
|
||||||
jsonObject.put("instorage_time", "");
|
|
||||||
wo.update(jsonObject);
|
|
||||||
String point_id = jsonObject.getString("point_id");
|
|
||||||
JSONObject jsonObject1 = wo_point.query("point_id = '" + point_id + "'").uniqueResult(0);
|
|
||||||
jsonObject1.put("point_status", "1");
|
|
||||||
jsonObject1.put("lock_type", "1");
|
|
||||||
jsonObject1.put("task_id", "");
|
|
||||||
jsonObject1.put("vehicle_type", "");
|
|
||||||
jsonObject1.put("vehicle_code", "");
|
|
||||||
wo_point.update(jsonObject1);
|
|
||||||
if (jsonObject.getString("region_code").equals(RegionTypeEnum.KLZCQ.getCode())
|
|
||||||
|| (jsonObject.getString("region_code").equals(RegionTypeEnum.GT1.getCode()))) {
|
|
||||||
KlhcqIvt.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
JSONObject result = new JSONObject();
|
JSONObject result = new JSONObject();
|
||||||
|
// 1.查询区域
|
||||||
|
JSONArray regionArr = WQL.getWO("PDA_Point_01").addParam("flag", "1").process().getResultJSONArray(0);
|
||||||
|
// 2.根据区域查询对应的物料上料位
|
||||||
|
JSONObject resultJson = new JSONObject();
|
||||||
|
for (int i = 0; i < regionArr.size(); i++) {
|
||||||
|
JSONObject jsonRegion = regionArr.getJSONObject(i);
|
||||||
|
JSONArray pointArr = WQL.getWO("PDA_Point_01").addParam("flag", "2").addParam("region_id", jsonRegion.getString("region_id")).process().getResultJSONArray(0);
|
||||||
|
jsonRegion.put("pointArr", pointArr);
|
||||||
|
}
|
||||||
|
resultJson.put("regionja", regionArr);
|
||||||
|
result.put("result", resultJson);
|
||||||
result.put("code", "1");
|
result.put("code", "1");
|
||||||
result.put("desc", "出库成功");
|
result.put("desc", "查询成功");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public JSONObject queryVehicle(JSONObject param) {
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
// 1.查询区域
|
||||||
|
JSONArray regionArr = WQL.getWO("PDA_Point_01")
|
||||||
|
.addParam("flag", "3")
|
||||||
|
.addParam("point_code",param.getString("point_code"))
|
||||||
|
.addParam("vehicle_code",param.getString("vehicle_code"))
|
||||||
|
.process().getResultJSONArray(0);
|
||||||
|
result.put("result", regionArr);
|
||||||
|
result.put("code", "1");
|
||||||
|
result.put("desc", "查询成功");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public JSONObject binding(JSONObject param) {
|
||||||
|
String point_code = param.getString("point_id");
|
||||||
|
if(StrUtil.isBlank(point_code)){
|
||||||
|
throw new BadRequestException("点位编号不能为空");
|
||||||
|
}
|
||||||
|
String vehicle_code = param.getString("vehicle_code");
|
||||||
|
int flag = param.getIntValue("flag");
|
||||||
|
WQLObject wo = WQLObject.getWQLObject("sch_base_vehicle_group");
|
||||||
|
WQLObject wo2 = WQLObject.getWQLObject("sch_base_point");
|
||||||
|
JSONObject result = new JSONObject();
|
||||||
|
JSONObject vehicleResult=new JSONObject();
|
||||||
|
JSONObject pointResult=new JSONObject();
|
||||||
|
if(flag==0){
|
||||||
|
//todo 判断载具是否已经绑定点位,如果已绑定提示先解绑
|
||||||
|
//todo 更新组盘表及点位表
|
||||||
|
vehicleResult.put("point_code",point_code);
|
||||||
|
JSONArray arr = wo.query("point_code = '" + point_code + "' and is_delete = 0").getResultJSONArray(0);;
|
||||||
|
if (ObjectUtil.isNotEmpty(arr)){
|
||||||
|
result.put("code", "0");
|
||||||
|
result.put("desc", "操作失败,当前点位存在载具,请先解绑!");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
wo.update(vehicleResult,"vehicle_code = '" + vehicle_code +"'");
|
||||||
|
pointResult.put("point_status",3);
|
||||||
|
wo2.update(pointResult,"point_code = '" + point_code +"'");
|
||||||
|
} else if (flag==1) {
|
||||||
|
//todo 解绑当前点位的载具,将载具点位编号置为0
|
||||||
|
//todo 更新点位表当前点位为无货
|
||||||
|
vehicleResult.put("point_code",null);
|
||||||
|
vehicleResult.put("vehicle_code",vehicle_code);
|
||||||
|
wo.update(vehicleResult,"vehicle_code = '" + vehicle_code +"'");
|
||||||
|
pointResult.put("point_status",1);
|
||||||
|
wo2.update(pointResult,"point_code = '" + point_code +"'");
|
||||||
|
}
|
||||||
|
result.put("code", "1");
|
||||||
|
result.put("desc", "查询成功");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
#################################################
|
#################################################
|
||||||
输入.flag TYPEAS s_string
|
输入.flag TYPEAS s_string
|
||||||
输入.region_id TYPEAS s_string
|
输入.region_id TYPEAS s_string
|
||||||
|
输入.point_code TYPEAS s_string
|
||||||
|
输入.vehicle_code TYPEAS s_string
|
||||||
|
|
||||||
[临时表]
|
[临时表]
|
||||||
--这边列出来的临时表就会在运行期动态创建
|
--这边列出来的临时表就会在运行期动态创建
|
||||||
@@ -46,21 +48,28 @@
|
|||||||
region_name
|
region_name
|
||||||
FROM
|
FROM
|
||||||
sch_base_region
|
sch_base_region
|
||||||
ENDSELECT
|
WHERE
|
||||||
|
region_code IN ('YWLQQ01', 'YWLQQ02')
|
||||||
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
|
|
||||||
IF 输入.flag = "2"
|
IF 输入.flag = "2"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
point_id,
|
p.point_id,
|
||||||
point_code,
|
p.point_code,
|
||||||
point_name
|
p.point_name,
|
||||||
|
v.vehicle_code
|
||||||
FROM
|
FROM
|
||||||
sch_base_point
|
sch_base_point p
|
||||||
|
LEFT JOIN
|
||||||
|
sch_base_vehicle_group v
|
||||||
|
ON
|
||||||
|
FIND_IN_SET(p.point_code,v.point_code) and v.is_delete=0
|
||||||
WHERE
|
WHERE
|
||||||
is_used = '1'
|
p.is_used = '1'
|
||||||
AND is_delete = '0'
|
AND p.is_delete = '0'
|
||||||
OPTION 输入.region_id <> ""
|
OPTION 输入.region_id <> ""
|
||||||
region_id = 输入.region_id
|
region_id = 输入.region_id
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
@@ -71,11 +80,20 @@
|
|||||||
IF 输入.flag = "3"
|
IF 输入.flag = "3"
|
||||||
QUERY
|
QUERY
|
||||||
SELECT
|
SELECT
|
||||||
material_id,
|
vehicle_code,
|
||||||
material_code,
|
point_code,
|
||||||
material_name
|
product_code,
|
||||||
|
material_code,
|
||||||
|
order_code
|
||||||
FROM
|
FROM
|
||||||
md_me_materialbase
|
sch_base_vehicle_group
|
||||||
|
WHERE is_delete=0
|
||||||
|
OPTION 输入.vehicle_code <> ""
|
||||||
|
vehicle_code = 输入.vehicle_code
|
||||||
|
ENDOPTION
|
||||||
|
OPTION 输入.point_code <> ""
|
||||||
|
point_code = 输入.point_code
|
||||||
|
ENDOPTION
|
||||||
ENDSELECT
|
ENDSELECT
|
||||||
ENDQUERY
|
ENDQUERY
|
||||||
ENDIF
|
ENDIF
|
||||||
Reference in New Issue
Block a user