| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.entity.param.taskCreateParam; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.entity.param.TaskCreateParam; |
| | | import com.zy.asrs.service.*; |
| | | import com.zy.asrs.utils.Utils; |
| | | import com.zy.common.service.CommonService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | import java.util.*; |
| | | |
| | | @Service |
| | | public class OpenServiceImpl implements OpenService { |
| | | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | @Autowired |
| | | private CommonService commonService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | @Override |
| | | public void taskCreate(taskCreateParam param) { |
| | | public HashMap<String, Object> taskCreate(TaskCreateParam param) { |
| | | HashMap<String,Object> map=new HashMap<>(); |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(param.getTaskNo()); |
| | | if (taskWrk != null) { |
| | | throw new CoolException(param.getTaskNo() + "任务已存在,请勿重复提交"); |
| | | } |
| | | if (param.getIoType().equals(0)){ |
| | | throw new CoolException("生成任务失败,任务类型不存在!"); |
| | | map.put("Code","0"); |
| | | map.put("Msg",param.getTaskNo()+"任务已经生成!"); |
| | | return map; |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | taskWrk = new TaskWrk(); |
| | | LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getStartPoint())); |
| | | int workNo1 = commonService.getWorkNo(WorkNoType.PAKOUT.type);//获取入库工作号 |
| | | taskWrk.setTaskNo(param.getTaskNo());//任务号 |
| | | taskWrk.setWrkNo(workNo1); |
| | | taskWrk.setStatus(TaskStatusType.RECEIVE.id);//任务状态:接收 |
| | | taskWrk.setCreateTime(now); |
| | | try { |
| | | if (param.getIoType() > 1) { |
| | | if (Utils.locNoRowBoolean(locMast.getRow1())) { |
| | | param.setTaskPriority(11); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | } |
| | | taskWrk.setIoType(param.getIoType());//任务类型 |
| | | taskWrk.setIoPri(param.getTaskPriority());//优先级 |
| | | taskWrk.setBarcode(param.getBarcode());//条码 |
| | | if (!Cools.isEmpty(param.getStartPoint())) { |
| | | taskWrk.setStartPoint(param.getStartPoint());//起点 |
| | | taskWrk.setCrnNo(locMast.getCrnNo()); |
| | | if (param.getIoType() == 1) { |
| | | taskWrk.setWrkSts(1); |
| | | if (!Cools.isEmpty(param.getTargetPoint())) { |
| | | taskWrk.setTargetPoint(Utils.getWcsLocNo(param.getTargetPoint()));//终点 |
| | | taskWrk.setOriginTargetPoint(param.getTargetPoint()); |
| | | } |
| | | |
| | | } else if (param.getIoType() == 2) { |
| | | taskWrk.setWrkSts(11); |
| | | if (!Cools.isEmpty(param.getStartPoint())) { |
| | | taskWrk.setStartPoint(param.getStartPoint());//起点 |
| | | taskWrk.setTargetPoint(param.getTargetPoint()); |
| | | } |
| | | taskWrk.setTargetPoint(param.getTargetPoint()); |
| | | } else if (param.getIoType() == 3) { |
| | | taskWrk.setWrkSts(11); |
| | | if (!Cools.isEmpty(param.getStartPoint())) { |
| | | taskWrk.setStartPoint(param.getStartPoint());//起点 |
| | | taskWrk.setTargetPoint(param.getTargetPoint()); |
| | | } |
| | | } |
| | | if (!Cools.isEmpty(param.getTargetPoint())) { |
| | | taskWrk.setTargetPoint(param.getTargetPoint());//终点 |
| | | } |
| | | |
| | | |
| | | if (!Cools.isEmpty(param.getMemo())) { |
| | | taskWrk.setMemo(param.getMemo());//备注 |
| | | } |
| | | |
| | | if (!taskWrkService.insert(taskWrk)) { |
| | | throw new CoolException("生成任务失败,请联系管理员"); |
| | | map.put("Code","0"); |
| | | map.put("Msg",param.getTaskNo()+"创建任务失败!"); |
| | | return map; |
| | | } |
| | | map.put("Code","1"); |
| | | map.put("Msg","ok"); |
| | | return map; |
| | | } |
| | | |
| | | } |