| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Propagation; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public void distribute(String taskNo, Long userId) { |
| | | TaskWrk taskWrk = this.selectByTaskNo(taskNo); |
| | | if (taskWrk == null) { |
| | |
| | | //创建任务 |
| | | if (taskWrk.getIoType() == 1) { |
| | | //1.入库 |
| | | if (taskWrk.getStartPoint() == null || taskWrk.getTargetPoint() == null) { |
| | | throw new CoolException("未接收到起点和终点,不进行派发"); |
| | | } |
| | | startup(taskWrk, userId); |
| | | }else if(taskWrk.getIoType() == 2){ |
| | | //2.出库 |
| | |
| | | @Override |
| | | public void startup(TaskWrk taskWrk, Long userId) { |
| | | //入库任务派发 |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getStartPoint())); |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getStartPoint()), taskWrk.getCrnNo()); |
| | | if (staDesc == null) { |
| | | throw new CoolException("入库路径不存在"); |
| | | } |
| | |
| | | @Override |
| | | public void stockOut(TaskWrk taskWrk, Long userId) { |
| | | //出库任务派发 |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint())); |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint()), taskWrk.getCrnNo()); |
| | | if (staDesc == null) { |
| | | return;//不存在路径 |
| | | } |
| | |
| | | @Override |
| | | public void locMove(TaskWrk taskWrk, Long userId) { |
| | | //库格移载任务派发 |
| | | StaDesc staDesc = staDescService.queryCrn(taskWrk.getIoType(), Integer.parseInt(taskWrk.getTargetPoint())); |
| | | if (staDesc == null) { |
| | | return;//不存在路径 |
| | | } |
| | | if (Cools.isEmpty(taskWrk.getTargetPoint())){ |
| | | return; |
| | | } |
| | | int workNo = commonService.getWorkNo(WorkNoType.OTHER.type);//获取工作号 |
| | | taskWrk.setWrkNo(workNo);//工作号 |
| | | taskWrk.setStatus(TaskStatusType.DISTRIBUTE.id);//派发状态 |
| | | taskWrk.setAssignTime(new Date());//派发时间 |
| | | taskWrk.setWrkSts(11);//工作状态 11.生成出库ID |
| | | taskWrk.setCrnNo(staDesc.getCrnNo());//堆垛机号 |
| | | //taskWrk.setCrnNo(staDesc.getCrnNo());//堆垛机号 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrk.setModiUser(userId); |
| | | updateById(taskWrk); |