| | |
| | |
|
| | | import com.alibaba.fastjson.JSON;
|
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
| | | import com.zy.asrs.framework.common.Cools;
|
| | | import com.zy.asrs.framework.common.DateUtils;
|
| | | import com.zy.asrs.framework.exception.CoolException;
|
| | | import com.zy.asrs.wms.asrs.entity.*;
|
| | | import com.zy.asrs.wms.asrs.entity.enums.*;
|
| | |
| | | import com.zy.asrs.wms.utils.LocUtils;
|
| | | import com.zy.asrs.wms.utils.OrderUtils;
|
| | | import com.zy.asrs.wms.utils.Utils;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
| | |
|
| | | @Service("workService")
|
| | | public class WorkServiceImpl implements WorkService {
|
| | |
|
| | | public static final Logger logger = LoggerFactory.getLogger(WorkServiceImpl.class);
|
| | |
|
| | | @Autowired
|
| | | private TaskService taskService;
|
| | |
| | |
|
| | | @Override
|
| | | public String generateTaskNo(Long taskType) {
|
| | | String format = DateUtils.format(new Date(), "MMddHHmm");
|
| | | Random random = new Random();
|
| | | int nextInt = random.nextInt(99999);
|
| | | return "R" + nextInt;
|
| | | logger.info("R" + format + nextInt);
|
| | | return "R" + format + nextInt;
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | } else {
|
| | | //出库
|
| | | TaskDetl taskDetl = taskDetls.get(0); //TODO 出库流程待确认,ESS取货后,输送线流转到扫码处状态
|
| | | if (taskDetl.getWaveId() == null) {
|
| | | if (taskDetl.getWaveId() == null && task.getTaskType() != 103 && task.getTaskType() != 107) {
|
| | | task.setTaskSts(TaskStsType.COMPLETE_OUT.id);//199.出库完成
|
| | | } else {
|
| | | task.setTaskSts(TaskStsType.WAVE_SEED.id);//198.播种中
|
| | | }
|
| | | }
|
| | |
|
| | | task.setUpdateTime(new Date());
|
| | | if (!taskService.updateById(task)) {
|
| | | throw new CoolException("任务更新失败");
|
| | |
| | | throw new CoolException("任务不存在");
|
| | | }
|
| | |
|
| | | if (task.getTaskType() != 103) {
|
| | | if (task.getTaskType() != 103 && task.getTaskType() != 107) {
|
| | | throw new CoolException("任务类型不可拣料");
|
| | | }
|
| | |
|
| | |
| | | }
|
| | |
|
| | | //获取源库位高度
|
| | | LocTypeBind locTypeBind = locTypeBindService.getOne(new LambdaQueryWrapper<LocTypeBind>().eq(LocTypeBind::getLocId, originLoc.getId()).in(LocTypeBind::getTypeId, LocBindType.HEIGHT.list()));
|
| | | LocTypeBind locTypeBind = locTypeBindService.getOne(new LambdaQueryWrapper<LocTypeBind>()
|
| | | .eq(LocTypeBind::getLocId, originLoc.getId())
|
| | | .in(LocTypeBind::getTypeId, LocBindType.HEIGHT.list()));
|
| | | if (locTypeBind == null) {
|
| | | throw new CoolException("库位类型不存在");
|
| | | }
|
| | |
| | | if (loc == null) {
|
| | | throw new CoolException("没有空库位");
|
| | | }
|
| | | // 获取新任务号
|
| | | String taskNo = generateTaskNo(53L);
|
| | | // 设置新任务号
|
| | | task.setTaskNo(taskNo);
|
| | | //102拣料此处需修改为WCS_CONTAINER_RECEIVE,定时任务查询后,自动下发入库任务至ESS
|
| | | task.setTaskSts(TaskStsType.WCS_CONTAINER_RECEIVE.id);//1.生成入库任务
|
| | | task.setTaskSts(TaskStsType.GENERATE_IN.id);//1.生成入库任务
|
| | | task.setTaskType(taskType);
|
| | | //原库位变目标库位, 原站点变目标站点
|
| | | //todo 需确认原站点为空,该怎么处理
|
| | |
| | | if (!taskService.updateById(task)) {
|
| | | throw new CoolException("拣料失败");
|
| | | }
|
| | | // 更新任务明细新任务号
|
| | | UpdateWrapper<TaskDetl> updateWrapper = new UpdateWrapper<>();
|
| | | updateWrapper.set("task_no",taskNo).eq("task_id",task.getId());
|
| | | //库位状态改为预约入库 R => S
|
| | | loc.setLocStsId(LocStsType.S.val());
|
| | | loc.setUpdateTime(new Date());
|