1.修改物料查询模糊查询条件。

2.修改出入箱扫码异常状态判断。
This commit is contained in:
2023-03-28 17:43:10 +08:00
parent d3eadbd5fa
commit 4cef6f035a
5 changed files with 263 additions and 40 deletions

View File

@@ -44,8 +44,17 @@ public class CacheLineHandController{
@Log("物料查询")
@ApiOperation("物料查询")
public CommonResult<List<MaterialDto>> materialQuery(@RequestBody JSONObject form) {
String params = form.getString("search_bar");
//任务类型和任务ID校验instruct_uuid为前端参数命名本来应为task_id
if(StringUtils.isNotEmpty(params)) {
//限制查询参数过短,模糊力度大
int length = params.length();
if(length < 3) {
throw new BizCoreException("您输入的条件匹配的范围太大,请重新输入稍长一点的内容。");
}
}
log.info("海亮缓存线手持服务 [查询物料] 接口被请求, 请求参数-{}", form);
return RestBusinessTemplate.execute(() -> cacheLineHandService.materialQuery(form.getString("search_bar")));
return RestBusinessTemplate.execute(() -> cacheLineHandService.materialQuery(params));
}
@PostMapping("/queryMaterial")
@@ -160,6 +169,10 @@ public class CacheLineHandController{
@ApiOperation("空箱初始化--出入空箱")
public CommonResult<String> inOutEmptyBox(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [空箱初始化--出入空箱] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutEmptyBox(param));
}
@@ -167,7 +180,7 @@ public class CacheLineHandController{
@Log("缓存线出入箱异常指令查询")
@ApiOperation("缓存线出入箱异常指令查询")
public CommonResult<JSONArray> inOutExceptionInstQuery(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令查询] 接口被请求, 请求参数-{}", param);
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令查询] 接口被·请求, 请求参数-{}", param);
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutExceptionInstQuery(param));
}
@@ -176,6 +189,10 @@ public class CacheLineHandController{
@ApiOperation("缓存线出入箱异常指令确认")
public CommonResult<String> inOutExceptionInstConfirm(@RequestBody JSONObject param) {
log.info("海亮缓存线手持服务 [缓存线出入箱异常指令确认] 接口被请求, 请求参数-{}", param);
//参数校验
if(StringUtils.isEmpty(param.getString("instruct_uuid")) || StringUtils.isEmpty(param.getString("inOut_type")) || StringUtils.isEmpty(param.getString("wcsdevice_code")) || StringUtils.isEmpty(param.getString("vehicle_code"))) {
throw new BizCoreException(ResultCode.MISS_PARAMETER);
}
return RestBusinessTemplate.execute(() -> cacheLineHandService.inOutExceptionInstConfirm(param));
}

View File

@@ -73,6 +73,9 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
// stopWatch.start();
// stopWatch.stop();
// System.out.println("缓存本地花费时间 totalTime = " + stopWatch.getTotalTimeMillis());
if(StringUtils.isEmpty(param)) {
return WQL.getWO("PDA_QUERY").addParam("flag", "6").addParam("condition", param).process().getResultJSONArray(0).toJavaList(MaterialDto.class);
}
List<MaterialDto> materialList;
ThreadPoolExecutor pool = ThreadPoolExecutorUtil.getPoll();
//12W种物料信息查本地缓存
@@ -83,7 +86,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
//2.查reids
materialList = redisUtils.get("materialList", MaterialDto.class);
if(null != materialList) {
//设置本地缓存
// //设置本地缓存
cache.setLocalCache("materialList", materialList);
return getMaterialDto(materialList, param);
}
@@ -112,7 +115,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
private List<MaterialDto> getMaterialDto(List<MaterialDto> materialList, String param) {
if(StringUtils.isNotEmpty(param)) {
//按条件搜索
materialList = materialList.stream().filter(m -> (m.getMaterial_name().contains(param)) || m.getMaterial_code().contains(param) || m.getMaterial_spec().contains(param) || m.getClass_name().contains(param)).collect(Collectors.toList());
materialList = materialList.stream().filter(m -> (m.getMaterial_name().indexOf(param) > -1) || (m.getMaterial_code().indexOf(param)) > -1 || (m.getMaterial_spec().indexOf(param)) > -1).collect(Collectors.toList());
return materialList;
}
return materialList;
@@ -445,7 +448,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
throw new BadRequestException("箱子【" + vehicle_code + "】已在库内,无法入空箱!");
}
// 3.判断是否可以放入空箱子
JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code +"position_code = '" + position_code + "' and is_blank= '1'").uniqueResult(0);
JSONObject json = positionTab.query("cacheLine_code = '" + cacheLine_code + "position_code = '" + position_code + "' and is_blank= '1'").uniqueResult(0);
if(json == null) {
throw new BadRequestException("无法找到缓存线【" + position_code + "】的空位,无法入空箱!");
}
@@ -481,53 +484,52 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
*/
@Override
public JSONArray inOutExceptionInstQuery(JSONObject param) {
// 1 扫码异常-入箱扫码 2 扫码异常-出箱扫码
// 出入类型 inOut_type
// 缓存线编码 wcsdevice_code
// 料箱码 vehicle_code
// {"inOut_type":"1","wcsdevice_code":"HCX01","vehicle_code":"10001"}
//料箱号
String vehicle_code = param.getString("vehicle_code");
//缓存线编号
String wcsdevice_code = param.getString("wcsdevice_code");
//出入箱类型
String inOut_type = param.getString("inOut_type");
//任务表信息
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
JSONArray result = new JSONArray();
// 入箱扫码异常
if("1".equals(inOut_type)) {
String where = "point_code2 = '" + wcsdevice_code + "' and instruct_status <> '06'";
String where = "point_code2 = '" + wcsdevice_code + "' and task_status <> '7'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "point_code2 = '" + wcsdevice_code + "' and invehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
where = "point_code2 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
}
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
for(int i = 0; i < arr.size(); i++) {
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("instructorder_no", row.getString("task_code"));
json.put("wcsdevice_code", row.getString("point_code2"));
json.put("vehicle_code", row.getString("invehicle_code"));
json.put("startpoint_code", row.getString("startpoint_code"));
json.put("nextpoint_code", row.getString("nextpoint_code"));
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
json.put("vehicle_code", row.getString("vehicle_code"));
json.put("startpoint_code", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
}
// 出箱扫码异常
if("2".equals(inOut_type)) {
String where = "startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'";
String where = "point_code1 = '" + wcsdevice_code + "' and task_status <> '7'";
if(StringUtils.isNotBlank(vehicle_code)) {
where = "startwcsdevice_code = '" + wcsdevice_code + "' and outvehicle_code = '" + vehicle_code + "' and instruct_status <> '06'";
where = "point_code1 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
}
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
for(int i = 0; i < arr.size(); i++) {
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("vehicle_code", row.getString("outvehicle_code"));
json.put("wcsdevice_code", row.getString("startwcsdevice_code"));
json.put("startpoint_code", row.getString("startpoint_code"));
json.put("nextpoint_code", row.getString("nextpoint_code"));
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
json.put("instructorder_no", row.getString("task_code"));
json.put("vehicle_code", row.getString("vehicle_code"));
json.put("wcsdevice_code", row.getString("point_code1"));
json.put("startpoint_code", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
}
@@ -551,7 +553,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
String position_code = param.getString("position_code");
//载具编码
String vehicle_code = param.getString("vehicle_code");
// 封装给wcs的数据
// 封装给acs的数据
JSONArray jsonArray = new JSONArray();
JSONObject jsonObject = new JSONObject();
jsonObject.put("inOut_type", inOut_type);
@@ -713,7 +715,7 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
String where = "point_code2 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'";
if(StringUtils.isEmpty(vehicle_code)) {
where = "point_code2 = '" + wcsdevice_code + "' and instruct_status <> '7'";
where = "point_code2 = '" + wcsdevice_code + "' and task_status <> '7'";
}
JSONArray arr = instructTab.query(where).getResultJSONArray(0);
JSONArray result = new JSONArray();
@@ -721,11 +723,11 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("instructorder_no", row.getString("task_code"));
json.put("wcsdevice_code", row.getString("point_code2"));
json.put("startpoint_code", row.getString("startpoint_code"));
json.put("nextpoint_code", row.getString("nextpoint_code"));
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
json.put("point_code1", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
return result;
@@ -767,22 +769,22 @@ public class CacheLineHandServiceImpl implements CacheLineHandService{
JSONArray arr;
WQLObject instructTab = WQLObject.getWQLObject("sch_base_task");
if(StringUtils.isEmpty(vehicle_code)) {
arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and instruct_status <> '06'").getResultJSONArray(0);
arr = instructTab.query("point_code1 = '" + wcsdevice_code + "' and task_status <> '7'").getResultJSONArray(0);
}
else{
arr = instructTab.query("startwcsdevice_code = '" + wcsdevice_code + "' and outvehicle_code = '" + vehicle_code + "' and instruct_status <> '06'").getResultJSONArray(0);
arr = instructTab.query("point_code1 = '" + wcsdevice_code + "' and vehicle_code = '" + vehicle_code + "' and task_status <> '7'").getResultJSONArray(0);
}
JSONArray result = new JSONArray();
for(int i = 0; i < arr.size(); i++) {
JSONObject row = arr.getJSONObject(i);
JSONObject json = new JSONObject();
json.put("instruct_uuid", row.getString("task_id"));
json.put("instructorder_no", row.getString("instructorder_no"));
json.put("wcsdevice_code", row.getString("startwcsdevice_code"));
json.put("vehicle_code", row.getString("outvehicle_code"));
json.put("startpoint_code", row.getString("startpoint_code"));
json.put("nextpoint_code", row.getString("nextpoint_code"));
json.put("nextpoint_code2", row.getString("nextpoint_code2"));
json.put("instructorder_no", row.getString("task_code"));
json.put("wcsdevice_code", row.getString("point_code1"));
json.put("vehicle_code", row.getString("vehicle_code"));
json.put("startpoint_code", row.getString("point_code1"));
json.put("nextpoint_code", row.getString("point_code2"));
json.put("nextpoint_code2", row.getString("point_code3"));
result.add(json);
}
return result;

View File

@@ -148,6 +148,9 @@
LEFT JOIN MD_PB_ClassStandard class ON class.class_id = mb.material_type_id
WHERE
mb.is_delete = '0'
ORDER BY
mb.material_id desc
LIMIT 1000
OPTION 输入.condition <> ""
mb.material_name LIKE CONCAT ('%', 输入.condition, '%')
OR mb.material_code LIKE CONCAT ('%', 输入.condition, '%')