21 changed files with 387 additions and 456 deletions
After Width: | Height: | Size: 91 KiB |
@ -1,176 +0,0 @@ |
|||||
/* |
|
||||
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,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.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::getVehicle_code, null) |
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.OUT_OF_STOCK.getValue()) |
|
||||
.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::getVehicle_code, taskObj.getVehicle_code()) |
|
||||
.set(SchBasePoint::getPoint_status, GoodsEnum.EMPTY_PALLETS.getValue()) |
|
||||
.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) { |
|
||||
// 获取参数
|
|
||||
SchBasePoint schBasePoint1 = schBasePointService.selectByPointCode(taskObj.getPoint_code1()); |
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint1)) { |
|
||||
schBasePoint1.setIs_lock(false); |
|
||||
PointUtils.setUpdateByAcs(schBasePoint1); |
|
||||
schBasePointService.updateById(schBasePoint1); |
|
||||
} |
|
||||
SchBasePoint schBasePoint = schBasePointService.selectByPointCode(taskObj.getPoint_code2()); |
|
||||
if (ObjectUtil.isNotEmpty(schBasePoint)) { |
|
||||
schBasePoint.setIs_lock(false); |
|
||||
PointUtils.setUpdateByAcs(schBasePoint); |
|
||||
schBasePointService.updateById(schBasePoint); |
|
||||
} |
|
||||
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); |
|
||||
} |
|
||||
} |
|
||||
*/ |
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 91 KiB |
Loading…
Reference in new issue