|
@ -1,6 +1,7 @@ |
|
|
package org.nl.wms.ext.sorting.service.impl; |
|
|
package org.nl.wms.ext.sorting.service.impl; |
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
|
import cn.hutool.core.collection.CollUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
|
import cn.hutool.core.util.StrUtil; |
|
@ -31,6 +32,7 @@ import org.nl.wms.sch.task_manage.task.tasks.sorting.SortingSMTTask; |
|
|
import org.nl.wms.sch.task_manage.task.tasks.sorting.SortingSNTTask; |
|
|
import org.nl.wms.sch.task_manage.task.tasks.sorting.SortingSNTTask; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.util.Assert; |
|
|
import org.springframework.util.Assert; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
@ -75,9 +77,11 @@ public class SortingServiceImpl implements SortingService { |
|
|
JSONArray jsonArray = JSONUtil.parseArray(jsonObject.get("pallet_detail")); |
|
|
JSONArray jsonArray = JSONUtil.parseArray(jsonObject.get("pallet_detail")); |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(pointCode); |
|
|
SchBasePoint schBasePoint = iSchBasePointService.selectByPointCode(pointCode); |
|
|
if (ObjectUtil.isEmpty(schBasePoint)) { |
|
|
if (ObjectUtil.isEmpty(schBasePoint)) { |
|
|
|
|
|
log.info("点位编码不存在:{}", pointCode); |
|
|
return MapOf.of("status", 400, "msg", "点位编码不存在!"); |
|
|
return MapOf.of("status", 400, "msg", "点位编码不存在!"); |
|
|
} |
|
|
} |
|
|
if (schBasePoint.getIs_lock()) { |
|
|
if (schBasePoint.getIs_lock()) { |
|
|
|
|
|
log.info("该点位已创建任务:{}", pointCode); |
|
|
return MapOf.of("status", 400, "msg", "该点位已创建任务!"); |
|
|
return MapOf.of("status", 400, "msg", "该点位已创建任务!"); |
|
|
} |
|
|
} |
|
|
JSONObject taskParam = new JSONObject(MapOf.of("task_code", task_code, "job_name", jobname, "device_code", pointCode, "requestNo" |
|
|
JSONObject taskParam = new JSONObject(MapOf.of("task_code", task_code, "job_name", jobname, "device_code", pointCode, "requestNo" |
|
@ -85,10 +89,6 @@ public class SortingServiceImpl implements SortingService { |
|
|
AbstractTask connectorTask = taskFactory.getTask("CNTTask"); |
|
|
AbstractTask connectorTask = taskFactory.getTask("CNTTask"); |
|
|
if ("0".equals(vehicle_type)) { |
|
|
if ("0".equals(vehicle_type)) { |
|
|
// TODO:呼叫空托
|
|
|
// TODO:呼叫空托
|
|
|
iSchBasePointService.update(new UpdateWrapper<SchBasePoint>() |
|
|
|
|
|
.set("is_lock", true) |
|
|
|
|
|
.set("remark", task_code) |
|
|
|
|
|
.eq("point_code", pointCode)); |
|
|
|
|
|
if (SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)) { |
|
|
if (SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)) { |
|
|
taskParam.put("vehicle_type", "G01"); |
|
|
taskParam.put("vehicle_type", "G01"); |
|
|
taskParam.put("config_code", "SortingCNTTask"); |
|
|
taskParam.put("config_code", "SortingCNTTask"); |
|
@ -96,6 +96,7 @@ public class SortingServiceImpl implements SortingService { |
|
|
//TODO:叫料
|
|
|
//TODO:叫料
|
|
|
} else if (SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) { |
|
|
} else if (SortingEnum.TASK_TYPE_ONE.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) { |
|
|
if (StrUtil.isEmpty(vehicle_code)) { |
|
|
if (StrUtil.isEmpty(vehicle_code)) { |
|
|
|
|
|
log.info("载具号未传递"); |
|
|
return MapOf.of("status", 400, "msg", "载具号未传递!"); |
|
|
return MapOf.of("status", 400, "msg", "载具号未传递!"); |
|
|
} |
|
|
} |
|
|
taskParam.put("config_code", "SortingCMTTask"); |
|
|
taskParam.put("config_code", "SortingCMTTask"); |
|
@ -103,6 +104,7 @@ public class SortingServiceImpl implements SortingService { |
|
|
//TODO:将空托盘放到线边库
|
|
|
//TODO:将空托盘放到线边库
|
|
|
} else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)) { |
|
|
} else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.IS_EMPTY.getValue().equals(is_empty)) { |
|
|
if (StrUtil.isEmpty(vehicle_code)) { |
|
|
if (StrUtil.isEmpty(vehicle_code)) { |
|
|
|
|
|
log.info("载具号未传递"); |
|
|
return MapOf.of("status", 400, "msg", "载具号未传递!"); |
|
|
return MapOf.of("status", 400, "msg", "载具号未传递!"); |
|
|
} |
|
|
} |
|
|
taskParam.put("config_code", "SortingSNTTask"); |
|
|
taskParam.put("config_code", "SortingSNTTask"); |
|
@ -110,8 +112,13 @@ public class SortingServiceImpl implements SortingService { |
|
|
//TODO:将满料放到线边库
|
|
|
//TODO:将满料放到线边库
|
|
|
} else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) { |
|
|
} else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) { |
|
|
if (StrUtil.isEmpty(vehicle_code)) { |
|
|
if (StrUtil.isEmpty(vehicle_code)) { |
|
|
|
|
|
log.info("载具号未传递"); |
|
|
return MapOf.of("status", 400, "msg", "载具号未传递!"); |
|
|
return MapOf.of("status", 400, "msg", "载具号未传递!"); |
|
|
} |
|
|
} |
|
|
|
|
|
if (CollUtil.isEmpty(jsonArray) || jsonArray.size() < 1) { |
|
|
|
|
|
log.info("物料信息为空!"); |
|
|
|
|
|
return MapOf.of("status", 400, "msg", "物料信息为空!"); |
|
|
|
|
|
} |
|
|
taskParam.put("config_code", "SortingSMTTask"); |
|
|
taskParam.put("config_code", "SortingSMTTask"); |
|
|
connectorTask.apply(taskParam); |
|
|
connectorTask.apply(taskParam); |
|
|
} |
|
|
} |
|
@ -130,8 +137,13 @@ public class SortingServiceImpl implements SortingService { |
|
|
//TODO:将两个笼框放到线边库
|
|
|
//TODO:将两个笼框放到线边库
|
|
|
} else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) { |
|
|
} else if (SortingEnum.TASK_TYPE_TWO.getValue().equals(task_type) && SortingEnum.NOT_EMPTY.getValue().equals(is_empty)) { |
|
|
if (StrUtil.isEmpty(jsonObject.getString("vehicle_code2"))) { |
|
|
if (StrUtil.isEmpty(jsonObject.getString("vehicle_code2"))) { |
|
|
|
|
|
log.info("第二个笼框载具号未传递"); |
|
|
return MapOf.of("status", 400, "msg", "第二个笼框载具号未传递!"); |
|
|
return MapOf.of("status", 400, "msg", "第二个笼框载具号未传递!"); |
|
|
} |
|
|
} |
|
|
|
|
|
if (CollUtil.isEmpty(jsonArray) || jsonArray.size() < 1) { |
|
|
|
|
|
log.info("物料信息为空!"); |
|
|
|
|
|
return MapOf.of("status", 400, "msg", "物料信息为空!"); |
|
|
|
|
|
} |
|
|
taskParam.put("config_code", "SortingSMTTask"); |
|
|
taskParam.put("config_code", "SortingSMTTask"); |
|
|
taskParam.put("task_seq", "1"); |
|
|
taskParam.put("task_seq", "1"); |
|
|
taskParam.put("vehicle_code", jsonObject.getString("vehicle_code2")); |
|
|
taskParam.put("vehicle_code", jsonObject.getString("vehicle_code2")); |
|
@ -145,14 +157,20 @@ public class SortingServiceImpl implements SortingService { |
|
|
connectorTask.apply(taskParam); |
|
|
connectorTask.apply(taskParam); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
iSchBasePointService.update(new UpdateWrapper<SchBasePoint>() |
|
|
|
|
|
.set("is_lock", true) |
|
|
|
|
|
.set("remark", task_code) |
|
|
|
|
|
.eq("point_code", pointCode)); |
|
|
return MapOf.of("status", 200, "msg", "sucess"); |
|
|
return MapOf.of("status", 200, "msg", "sucess"); |
|
|
} catch (Exception ex) { |
|
|
} catch (Exception ex) { |
|
|
|
|
|
log.info("sorting下发任务失败:{}", ex.getMessage()); |
|
|
return MapOf.of("status", 200, "msg", "操作失败", "errMsg", ex.getMessage()); |
|
|
return MapOf.of("status", 200, "msg", "操作失败", "errMsg", ex.getMessage()); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public List<ConnectorDto> getStructList(String jobName) { |
|
|
public List<ConnectorDto> getStructList(String jobName) { |
|
|
|
|
|
log.info("sorting查询组盘请求参数数据:{}", jobName); |
|
|
List<SchBaseVehiclematerialgroup> list = iSchBaseVehiclematerialgroupService.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) |
|
|
List<SchBaseVehiclematerialgroup> list = iSchBaseVehiclematerialgroupService.list(Wrappers.lambdaQuery(SchBaseVehiclematerialgroup.class) |
|
|
.eq(SchBaseVehiclematerialgroup::getJob_name, jobName)); |
|
|
.eq(SchBaseVehiclematerialgroup::getJob_name, jobName)); |
|
|
List<ConnectorDto> connectors = new ArrayList<>(); |
|
|
List<ConnectorDto> connectors = new ArrayList<>(); |
|
@ -163,7 +181,7 @@ public class SortingServiceImpl implements SortingService { |
|
|
connectorDto.setNextOperation(StrUtil.isNotEmpty(connectorDto.getNextOperation()) ? connectorDto.getNextOperation() : DateUtil.now()); |
|
|
connectorDto.setNextOperation(StrUtil.isNotEmpty(connectorDto.getNextOperation()) ? connectorDto.getNextOperation() : DateUtil.now()); |
|
|
connectors.add(connectorDto); |
|
|
connectors.add(connectorDto); |
|
|
} |
|
|
} |
|
|
// List<PointMaterialInfo> structList = iSchBasePointService.getStructList(RegionEnum.ZDFJ.getRegion_code(), "1");
|
|
|
log.info("sorting查询组盘响应参数:{}", JSONObject.toJSONString(connectors)); |
|
|
return connectors; |
|
|
return connectors; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|