23 changed files with 1317 additions and 228 deletions
@ -0,0 +1,22 @@ |
|||||
|
package org.nl.common.enums; |
||||
|
|
||||
|
import lombok.AllArgsConstructor; |
||||
|
import lombok.Getter; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
* 载具类型 |
||||
|
*/ |
||||
|
@Getter |
||||
|
@AllArgsConstructor |
||||
|
public enum VehicleTypeEnum { |
||||
|
|
||||
|
TRAY("T001","钢托盘"), |
||||
|
FRAME_R01("R01","料框 1230mm*840mm*990mm"), |
||||
|
FRAME_R02("R02","料框 1230mm*840mm*450mm"), |
||||
|
RACKS_S04("S04","料架 1230mm*840mm*1670mm"), |
||||
|
RACKS_S06("S06","料架 1230mm*840mm*1700mm"); |
||||
|
|
||||
|
private final String vehicleCode; |
||||
|
private final String vehicleName; |
||||
|
} |
@ -0,0 +1,174 @@ |
|||||
|
package org.nl.wms.sch.task_manage.task.tasks.handheld; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import org.nl.common.enums.GoodsEnum; |
||||
|
import org.nl.common.exception.BadRequestException; |
||||
|
import org.nl.system.service.notice.ISysNoticeService; |
||||
|
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService; |
||||
|
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle; |
||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; |
||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
||||
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
||||
|
import org.nl.wms.sch.task_manage.AbstractTask; |
||||
|
import org.nl.wms.sch.task_manage.GeneralDefinition; |
||||
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
||||
|
import org.nl.wms.util.PointUtils; |
||||
|
import org.nl.wms.util.TaskUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
* 工序下料 |
||||
|
*/ |
||||
|
@Component("BLANKINGTask") |
||||
|
public class BlankingTask extends AbstractTask { |
||||
|
private static final String TASK_CONFIG_CODE = "BLANKINGTask"; |
||||
|
@Autowired |
||||
|
private ISchBasePointService pointService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskService taskService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskconfigService taskConfigService; |
||||
|
@Autowired |
||||
|
private ISysNoticeService noticeService; |
||||
|
@Autowired |
||||
|
private ISchBasePointService schBasePointService; |
||||
|
@Autowired |
||||
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService; |
||||
|
@Autowired |
||||
|
private IMdBaseVehicleService iMdBaseVehicleService; |
||||
|
|
||||
|
@Override |
||||
|
protected void create() throws BadRequestException { |
||||
|
// 获取任务
|
||||
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
||||
|
// 配置信息
|
||||
|
for (SchBaseTask task : tasks) { |
||||
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(task.getVehicle_code()); |
||||
|
if(ObjectUtil.isEmpty(mdBaseVehicle)){ |
||||
|
task.setRemark("载具号不存在!"); |
||||
|
taskService.updateById(task); |
||||
|
// 消息通知
|
||||
|
noticeService.createNotice("载具号不存在!", TASK_CONFIG_CODE + task.getTask_code(), |
||||
|
NoticeTypeEnum.WARN.getCode()); |
||||
|
continue; |
||||
|
} |
||||
|
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(), |
||||
|
GoodsEnum.OUT_OF_STOCK.getValue(),mdBaseVehicle.getVehicle_type(),1); |
||||
|
if (ObjectUtil.isEmpty(schBasePoint)) { |
||||
|
task.setRemark("未找到所需点位!"); |
||||
|
taskService.updateById(task); |
||||
|
// 消息通知
|
||||
|
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(), |
||||
|
NoticeTypeEnum.WARN.getCode()); |
||||
|
continue; |
||||
|
} |
||||
|
// 设置终点并修改创建成功状态
|
||||
|
task.setPoint_code2(schBasePoint.getPoint_code()); |
||||
|
task.setVehicle_type(schBasePoint.getCan_vehicle_type()); |
||||
|
task.setRemark(""); |
||||
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
||||
|
TaskUtils.setUpdateByAcs(task); |
||||
|
taskService.updateById(task); |
||||
|
|
||||
|
|
||||
|
schBasePoint.setVehicle_code(task.getVehicle_code()); |
||||
|
schBasePoint.setIng_task_code(task.getTask_code()); |
||||
|
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); |
||||
|
schBasePoint.setIs_lock(true); |
||||
|
PointUtils.setUpdateByAcs(schBasePoint); |
||||
|
pointService.updateById(schBasePoint); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void updateStatus(String task_code, TaskStatus status) { |
||||
|
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void forceFinish(String task_code) { |
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void cancel(String task_code) { |
||||
|
//TODO:取消任务的时候将int_task_code的清除
|
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
// 任务完成
|
||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
|
||||
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
} |
@ -0,0 +1,172 @@ |
|||||
|
package org.nl.wms.sch.task_manage.task.tasks.handheld; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import org.nl.common.enums.GoodsEnum; |
||||
|
import org.nl.common.exception.BadRequestException; |
||||
|
import org.nl.system.service.notice.ISysNoticeService; |
||||
|
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService; |
||||
|
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle; |
||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; |
||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
||||
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
||||
|
import org.nl.wms.sch.task_manage.AbstractTask; |
||||
|
import org.nl.wms.sch.task_manage.GeneralDefinition; |
||||
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
||||
|
import org.nl.wms.util.PointUtils; |
||||
|
import org.nl.wms.util.TaskUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
* 手持呼叫空料笼 |
||||
|
*/ |
||||
|
@Component("CALLEMPTYTask") |
||||
|
public class CallEmptyTask extends AbstractTask { |
||||
|
|
||||
|
private static final String TASK_CONFIG_CODE = "CALLEMPTYTask"; |
||||
|
@Autowired |
||||
|
private ISchBasePointService pointService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskService taskService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskconfigService taskConfigService; |
||||
|
@Autowired |
||||
|
private ISysNoticeService noticeService; |
||||
|
@Autowired |
||||
|
private ISchBasePointService schBasePointService; |
||||
|
@Autowired |
||||
|
private IMdBaseVehicleService iMdBaseVehicleService; |
||||
|
|
||||
|
@Override |
||||
|
protected void create() throws BadRequestException { |
||||
|
// 获取任务
|
||||
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
||||
|
// 配置信息
|
||||
|
for (SchBaseTask task : tasks) { |
||||
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(task.getVehicle_code()); |
||||
|
if (ObjectUtil.isEmpty(mdBaseVehicle)) { |
||||
|
task.setRemark("载具号不存在!"); |
||||
|
taskService.updateById(task); |
||||
|
// 消息通知
|
||||
|
noticeService.createNotice("载具号不存在!", TASK_CONFIG_CODE + task.getTask_code(), |
||||
|
NoticeTypeEnum.WARN.getCode()); |
||||
|
continue; |
||||
|
} |
||||
|
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(), GoodsEnum.OUT_OF_STOCK.getValue(), mdBaseVehicle.getVehicle_type(), 1); |
||||
|
if (ObjectUtil.isEmpty(schBasePoint)) { |
||||
|
task.setRemark("未找到所需点位!"); |
||||
|
taskService.updateById(task); |
||||
|
// 消息通知
|
||||
|
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(), |
||||
|
NoticeTypeEnum.WARN.getCode()); |
||||
|
continue; |
||||
|
} |
||||
|
// 设置终点并修改创建成功状态
|
||||
|
task.setPoint_code1(schBasePoint.getPoint_code()); |
||||
|
task.setVehicle_type(schBasePoint.getCan_vehicle_type()); |
||||
|
task.setRemark(""); |
||||
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
||||
|
TaskUtils.setUpdateByAcs(task); |
||||
|
taskService.updateById(task); |
||||
|
|
||||
|
|
||||
|
schBasePoint.setVehicle_code(task.getVehicle_code()); |
||||
|
schBasePoint.setIng_task_code(task.getTask_code()); |
||||
|
schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue()); |
||||
|
schBasePoint.setIs_lock(true); |
||||
|
PointUtils.setUpdateByAcs(schBasePoint); |
||||
|
pointService.updateById(schBasePoint); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void updateStatus(String task_code, TaskStatus status) { |
||||
|
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void forceFinish(String task_code) { |
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void cancel(String task_code) { |
||||
|
//TODO:取消任务的时候将int_task_code的清除
|
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
// 任务完成
|
||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
|
||||
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
} |
@ -0,0 +1,183 @@ |
|||||
|
package org.nl.wms.sch.task_manage.task.tasks.handheld; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import org.nl.common.enums.GoodsEnum; |
||||
|
import org.nl.common.enums.VehicleTypeEnum; |
||||
|
import org.nl.common.enums.region.RegionEnum; |
||||
|
import org.nl.common.exception.BadRequestException; |
||||
|
import org.nl.system.service.notice.ISysNoticeService; |
||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; |
||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
||||
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
||||
|
import org.nl.wms.sch.task_manage.AbstractTask; |
||||
|
import org.nl.wms.sch.task_manage.GeneralDefinition; |
||||
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
||||
|
import org.nl.wms.util.PointUtils; |
||||
|
import org.nl.wms.util.TaskUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
* 手持创建空料笼入库 |
||||
|
*/ |
||||
|
@Component("EMPTYCAGETask") |
||||
|
public class EmptyCageTask extends AbstractTask { |
||||
|
|
||||
|
private static final String TASK_CONFIG_CODE = "EMPTYCAGETask"; |
||||
|
@Autowired |
||||
|
private ISchBasePointService pointService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskService taskService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskconfigService taskConfigService; |
||||
|
@Autowired |
||||
|
private ISysNoticeService noticeService; |
||||
|
@Autowired |
||||
|
private ISchBasePointService schBasePointService; |
||||
|
@Autowired |
||||
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService; |
||||
|
|
||||
|
@Override |
||||
|
protected void create() throws BadRequestException { |
||||
|
// 获取任务
|
||||
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
||||
|
// 配置信息
|
||||
|
for (SchBaseTask task : tasks) { |
||||
|
TaskUtils.setUpdateByAcs(task); |
||||
|
// 查询是空料笼还是,空料架
|
||||
|
Integer vehicle_qty = task.getVehicle_qty(); |
||||
|
SchBasePoint schBasePoint = null; |
||||
|
switch (vehicle_qty) { |
||||
|
case 1: |
||||
|
//空料架
|
||||
|
/*schBasePoint = schBasePointService.selectByGroundPoint(GoodsEnum.OUT_OF_STOCK.getValue(),task.getVehicle_type(),1);*/ |
||||
|
break; |
||||
|
case 2: |
||||
|
//RO1空料容
|
||||
|
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(), |
||||
|
GoodsEnum.OUT_OF_STOCK.getValue(), VehicleTypeEnum.FRAME_R01.getVehicleCode(),2); |
||||
|
break; |
||||
|
case 4: |
||||
|
//RO2空料容
|
||||
|
schBasePoint = schBasePointService.selectByGroundPoint(RegionEnum.DDLK.getRegion_code(), |
||||
|
GoodsEnum.OUT_OF_STOCK.getValue(),VehicleTypeEnum.FRAME_R02.getVehicleCode(),2); |
||||
|
break; |
||||
|
default: |
||||
|
break; |
||||
|
} |
||||
|
if (ObjectUtil.isEmpty(schBasePoint)) { |
||||
|
task.setRemark("未找到所需点位!"); |
||||
|
taskService.updateById(task); |
||||
|
// 消息通知
|
||||
|
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(), |
||||
|
NoticeTypeEnum.WARN.getCode()); |
||||
|
continue; |
||||
|
} |
||||
|
// 设置终点并修改创建成功状态
|
||||
|
task.setPoint_code2(schBasePoint.getPoint_code()); |
||||
|
task.setVehicle_type(schBasePoint.getCan_vehicle_type()); |
||||
|
task.setRemark(""); |
||||
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
||||
|
taskService.updateById(task); |
||||
|
|
||||
|
|
||||
|
schBasePoint.setVehicle_qty(task.getVehicle_qty()); |
||||
|
schBasePoint.setVehicles(task.getVehicle_code()); |
||||
|
schBasePoint.setPoint_status(GoodsEnum.EMPTY_PALLETS.getValue()); |
||||
|
schBasePoint.setIs_lock(true); |
||||
|
PointUtils.setUpdateByAcs(schBasePoint); |
||||
|
pointService.updateById(schBasePoint); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void updateStatus(String task_code, TaskStatus status) { |
||||
|
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void forceFinish(String task_code) { |
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void cancel(String task_code) { |
||||
|
//TODO:取消任务的时候将int_task_code的清除
|
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
// 任务完成
|
||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
|
||||
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
} |
@ -1,104 +0,0 @@ |
|||||
package org.nl.wms.sch.task_manage.task.tasks.handheld; |
|
||||
|
|
||||
import cn.hutool.core.util.ObjectUtil; |
|
||||
import com.alibaba.fastjson.JSONObject; |
|
||||
import org.nl.common.enums.GoodsEnum; |
|
||||
import org.nl.common.enums.region.RegionEnum; |
|
||||
import org.nl.common.exception.BadRequestException; |
|
||||
import org.nl.system.service.notice.ISysNoticeService; |
|
||||
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; |
|
||||
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
|
||||
import org.nl.wms.sch.point.service.ISchBasePointService; |
|
||||
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
|
||||
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
|
||||
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
|
||||
import org.nl.wms.sch.task_manage.AbstractTask; |
|
||||
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; |
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
|
||||
import org.nl.wms.sch.task_manage.task.core.TaskType; |
|
||||
import org.nl.wms.util.PointUtils; |
|
||||
import org.nl.wms.util.TaskUtils; |
|
||||
import org.springframework.beans.factory.annotation.Autowired; |
|
||||
import org.springframework.stereotype.Component; |
|
||||
|
|
||||
import java.util.List; |
|
||||
|
|
||||
/** |
|
||||
* @author LENOVO |
|
||||
*/ |
|
||||
@Component("HHTask") |
|
||||
public class HHTask extends AbstractTask { |
|
||||
|
|
||||
|
|
||||
private static final String TASK_CONFIG_CODE = "HHTask"; |
|
||||
@Autowired |
|
||||
private ISchBasePointService pointService; |
|
||||
@Autowired |
|
||||
private ISchBaseTaskService taskService; |
|
||||
@Autowired |
|
||||
private ISchBaseTaskconfigService taskConfigService; |
|
||||
@Autowired |
|
||||
private ISysNoticeService noticeService; |
|
||||
@Autowired |
|
||||
private ISchBasePointService schBasePointService; |
|
||||
@Autowired |
|
||||
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService; |
|
||||
|
|
||||
@Override |
|
||||
protected void create() throws BadRequestException { |
|
||||
// 获取任务
|
|
||||
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
|
||||
// 配置信息
|
|
||||
for (SchBaseTask task : tasks) { |
|
||||
TaskUtils.setUpdateByAcs(task); |
|
||||
// 查询终点
|
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByVehicleQty(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(),task.getVehicle_type()); |
|
||||
if (TaskType.CARRY_TASK.getValue().equals(task.getTask_type())) { |
|
||||
schBasePoint = schBasePointService.selectByRegionCode(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code()); |
|
||||
} else if (TaskType.REASSIGN_TASK.getValue().equals(task.getTask_type())) { |
|
||||
schBasePoint = schBasePointService.selectByReassign(RegionEnum.TRUBEND_SHELVES_3_1_1.getRegion_code(), task.getVehicle_code()); |
|
||||
} |
|
||||
if (ObjectUtil.isEmpty(schBasePoint)) { |
|
||||
task.setRemark("未找到所需点位!"); |
|
||||
taskService.updateById(task); |
|
||||
// 消息通知
|
|
||||
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(), |
|
||||
NoticeTypeEnum.WARN.getCode()); |
|
||||
continue; |
|
||||
} |
|
||||
|
|
||||
// 设置终点并修改创建成功状态
|
|
||||
task.setPoint_code2(schBasePoint.getPoint_code()); |
|
||||
task.setVehicle_type(schBasePoint.getCan_vehicle_type()); |
|
||||
task.setRemark(""); |
|
||||
task.setTask_status(TaskStatus.CREATED.getCode()); |
|
||||
taskService.updateById(task); |
|
||||
|
|
||||
schBasePoint.setIng_task_code(task.getTask_code()); |
|
||||
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); |
|
||||
PointUtils.setUpdateByAcs(schBasePoint); |
|
||||
pointService.updateById(schBasePoint); |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
protected void updateStatus(String task_code, TaskStatus status) { |
|
||||
|
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void forceFinish(String task_code) { |
|
||||
|
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public void cancel(String task_code) { |
|
||||
|
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
|
||||
|
|
||||
} |
|
||||
} |
|
@ -0,0 +1,174 @@ |
|||||
|
package org.nl.wms.sch.task_manage.task.tasks.handheld; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import org.nl.common.enums.GoodsEnum; |
||||
|
import org.nl.common.exception.BadRequestException; |
||||
|
import org.nl.system.service.notice.ISysNoticeService; |
||||
|
import org.nl.wms.database.vehicle.service.IMdBaseVehicleService; |
||||
|
import org.nl.wms.database.vehicle.service.dao.MdBaseVehicle; |
||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; |
||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
||||
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
||||
|
import org.nl.wms.sch.task_manage.AbstractTask; |
||||
|
import org.nl.wms.sch.task_manage.GeneralDefinition; |
||||
|
import org.nl.wms.sch.task_manage.enums.NoticeTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
||||
|
import org.nl.wms.util.PointUtils; |
||||
|
import org.nl.wms.util.TaskUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
* 物料回库 |
||||
|
*/ |
||||
|
@Component("TOSTOREHOUSETask") |
||||
|
public class ToStoreHouseTask extends AbstractTask { |
||||
|
private static final String TASK_CONFIG_CODE = "TOSTOREHOUSETask"; |
||||
|
@Autowired |
||||
|
private ISchBasePointService pointService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskService taskService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskconfigService taskConfigService; |
||||
|
@Autowired |
||||
|
private ISysNoticeService noticeService; |
||||
|
@Autowired |
||||
|
private ISchBasePointService schBasePointService; |
||||
|
@Autowired |
||||
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService; |
||||
|
@Autowired |
||||
|
private IMdBaseVehicleService iMdBaseVehicleService; |
||||
|
|
||||
|
@Override |
||||
|
protected void create() throws BadRequestException { |
||||
|
// 获取任务
|
||||
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
||||
|
// 配置信息
|
||||
|
for (SchBaseTask task : tasks) { |
||||
|
TaskUtils.setUpdateByAcs(task); |
||||
|
MdBaseVehicle mdBaseVehicle = iMdBaseVehicleService.selectByVehicleCode(task.getVehicle_code()); |
||||
|
if(ObjectUtil.isEmpty(mdBaseVehicle)){ |
||||
|
task.setRemark("该载具不存在!"); |
||||
|
taskService.updateById(task); |
||||
|
// 消息通知
|
||||
|
noticeService.createNotice("该载具不存在!", TASK_CONFIG_CODE + task.getTask_code(), |
||||
|
NoticeTypeEnum.WARN.getCode()); |
||||
|
continue; |
||||
|
} |
||||
|
SchBasePoint schBasePoint = schBasePointService.selectByGroundPoint(task.getRegion_code(), GoodsEnum.OUT_OF_STOCK.getValue() |
||||
|
,mdBaseVehicle.getVehicle_type(),1); |
||||
|
if (ObjectUtil.isEmpty(schBasePoint)) { |
||||
|
task.setRemark("未找到所需点位!"); |
||||
|
taskService.updateById(task); |
||||
|
// 消息通知
|
||||
|
noticeService.createNotice("未找到所需点位!", TASK_CONFIG_CODE + task.getTask_code(), |
||||
|
NoticeTypeEnum.WARN.getCode()); |
||||
|
continue; |
||||
|
} |
||||
|
// 设置终点并修改创建成功状态
|
||||
|
task.setPoint_code2(schBasePoint.getPoint_code()); |
||||
|
task.setVehicle_type(schBasePoint.getCan_vehicle_type()); |
||||
|
task.setRemark(""); |
||||
|
task.setTask_status(TaskStatus.CREATED.getCode()); |
||||
|
taskService.updateById(task); |
||||
|
|
||||
|
|
||||
|
schBasePoint.setVehicle_code(task.getVehicle_code()); |
||||
|
schBasePoint.setIng_task_code(task.getTask_code()); |
||||
|
schBasePoint.setPoint_status(GoodsEnum.IN_STOCK.getValue()); |
||||
|
schBasePoint.setIs_lock(true); |
||||
|
PointUtils.setUpdateByAcs(schBasePoint); |
||||
|
pointService.updateById(schBasePoint); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void updateStatus(String task_code, TaskStatus status) { |
||||
|
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void forceFinish(String task_code) { |
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void cancel(String task_code) { |
||||
|
//TODO:取消任务的时候将int_task_code的清除
|
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
// 任务完成
|
||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
|
||||
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
} |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
} |
@ -0,0 +1,153 @@ |
|||||
|
package org.nl.wms.sch.task_manage.task.tasks.sorting; |
||||
|
|
||||
|
import cn.hutool.core.util.ObjectUtil; |
||||
|
import com.alibaba.fastjson.JSONObject; |
||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||
|
import org.nl.common.enums.GoodsEnum; |
||||
|
import org.nl.common.enums.VehicleEnum; |
||||
|
import org.nl.common.enums.VehicleTypeEnum; |
||||
|
import org.nl.common.enums.region.RegionEnum; |
||||
|
import org.nl.common.exception.BadRequestException; |
||||
|
import org.nl.system.service.notice.ISysNoticeService; |
||||
|
import org.nl.wms.ext.acs.service.dto.to.BaseResponse; |
||||
|
import org.nl.wms.sch.group.service.ISchBaseVehiclematerialgroupService; |
||||
|
import org.nl.wms.sch.point.service.ISchBasePointService; |
||||
|
import org.nl.wms.sch.point.service.dao.SchBasePoint; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskService; |
||||
|
import org.nl.wms.sch.task.service.ISchBaseTaskconfigService; |
||||
|
import org.nl.wms.sch.task.service.dao.SchBaseTask; |
||||
|
import org.nl.wms.sch.task_manage.AbstractTask; |
||||
|
import org.nl.wms.sch.task_manage.GeneralDefinition; |
||||
|
import org.nl.wms.sch.task_manage.enums.TaskFinishedTypeEnum; |
||||
|
import org.nl.wms.sch.task_manage.task.core.TaskStatus; |
||||
|
import org.nl.wms.util.PointUtils; |
||||
|
import org.nl.wms.util.TaskUtils; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @author LENOVO |
||||
|
* sorting呼叫两个笼框 |
||||
|
*/ |
||||
|
@Component("SortingTwoCNTTask") |
||||
|
public class SortingTwoCNTTask extends AbstractTask { |
||||
|
|
||||
|
|
||||
|
private static final String TASK_CONFIG_CODE = "SortingTwoCNTTask"; |
||||
|
@Autowired |
||||
|
private ISchBasePointService pointService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskService taskService; |
||||
|
@Autowired |
||||
|
private ISchBaseTaskconfigService taskConfigService; |
||||
|
@Autowired |
||||
|
private ISysNoticeService noticeService; |
||||
|
@Autowired |
||||
|
private ISchBasePointService schBasePointService; |
||||
|
@Autowired |
||||
|
private ISchBaseVehiclematerialgroupService schBaseVehiclematerialgroupService; |
||||
|
|
||||
|
@Override |
||||
|
protected void create() throws BadRequestException { |
||||
|
// 获取任务
|
||||
|
List<SchBaseTask> tasks = taskService.findTasksByTaskStatus(TASK_CONFIG_CODE, TaskStatus.APPLY); |
||||
|
for (SchBaseTask task : tasks) { |
||||
|
TaskUtils.setUpdateByAcs(task); |
||||
|
// 找起点
|
||||
|
SchBasePoint basePoint = schBasePointService.selectByEmptyCage(RegionEnum.DDLK.getRegion_code(), |
||||
|
VehicleTypeEnum.FRAME_R02.getVehicleCode(),GoodsEnum.EMPTY_PALLETS.getValue(),true,task); |
||||
|
if (basePoint==null){ |
||||
|
task.setRemark("未找到所需点位!"); |
||||
|
taskService.updateById(task); |
||||
|
continue; |
||||
|
} |
||||
|
taskService.update(new UpdateWrapper<SchBaseTask>() |
||||
|
.set("task_status",TaskStatus.CREATED.getCode()) |
||||
|
.set("point_code1",basePoint.getPoint_code()) |
||||
|
.set("vehicle_code",basePoint.getVehicle_code()) |
||||
|
.eq("task_id",task.getTask_id())); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void updateStatus(String task_code, TaskStatus status) { |
||||
|
//TODO:完成任务的时候将int_task_code的清除
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void forceFinish(String task_code) { |
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.finishTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public void cancel(String task_code) { |
||||
|
//TODO:取消任务的时候将int_task_code的清除
|
||||
|
SchBaseTask taskObj = taskService.getByCode(task_code); |
||||
|
if (ObjectUtil.isEmpty(taskObj)) { |
||||
|
throw new BadRequestException("该任务不存在"); |
||||
|
} |
||||
|
this.cancelTask(taskObj, TaskFinishedTypeEnum.MANUAL_CONNECTOR); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
protected void feedbackTaskState(JSONObject param, SchBaseTask schBaseTask, BaseResponse result) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public void finishTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
/*// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, startPoint) |
||||
|
.set(SchBasePoint::getIs_lock, false).set(SchBasePoint::getVehicle_code,null)); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.update(Wrappers.lambdaUpdate(SchBasePoint.class).eq(SchBasePoint::getPoint_code, point_code2) |
||||
|
.set(SchBasePoint::getIs_lock, false)); |
||||
|
}*/ |
||||
|
// 任务完成
|
||||
|
taskObj.setTask_status(TaskStatus.FINISHED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_FINISH); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
|
||||
|
public void cancelTask(SchBaseTask taskObj, TaskFinishedTypeEnum taskFinishedType) { |
||||
|
// 获取参数
|
||||
|
String startPoint = taskObj.getPoint_code1(); |
||||
|
SchBasePoint schBasePoint = pointService.selectByPointCode(startPoint); |
||||
|
// 起点清空
|
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint); |
||||
|
pointService.updateById(schBasePoint); |
||||
|
} |
||||
|
String point_code2 = taskObj.getPoint_code2(); |
||||
|
SchBasePoint schBasePoint2 = pointService.selectByPointCode(point_code2); |
||||
|
if (ObjectUtil.isNotEmpty(schBasePoint2)) { |
||||
|
PointUtils.updateByIngTaskCode(schBasePoint2); |
||||
|
pointService.updateById(schBasePoint2); |
||||
|
} |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setRemark(GeneralDefinition.TASK_CANCEL); |
||||
|
taskObj.setTask_status(TaskStatus.CANCELED.getCode()); |
||||
|
taskObj.setFinished_type(taskFinishedType.getCode()); |
||||
|
TaskUtils.setUpdateByType(taskObj, taskFinishedType); |
||||
|
taskService.updateById(taskObj); |
||||
|
} |
||||
|
|
||||
|
} |
Loading…
Reference in new issue