src/main/java/com/zy/asrs/controller/OpenController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/controller/TaskWrkController.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/domain/enums/TaskStatusType.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main/java/com/zy/asrs/task/TaskLogScheduler.java | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/main/java/com/zy/asrs/controller/OpenController.java
@@ -149,12 +149,12 @@ return R.error("条码[barcode]不能为空"); } openService.taskCreateIn(param); HashMap<String, Object> result = openService.taskCreateIn(param); return R.ok().add(result); }catch (Exception e){ log.error("任务下发异常"+e); return R.error(); } return R.ok(); return R.error(); } //查询任务详情 src/main/java/com/zy/asrs/controller/TaskWrkController.java
@@ -1,30 +1,22 @@ package com.zy.asrs.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.mapper.Wrapper; import com.baomidou.mybatisplus.plugins.Page; import com.core.common.DateUtils; import com.zy.asrs.domain.dto.NotifyCustomDataDto; import com.zy.asrs.domain.enums.NotifyMsgType; import com.zy.asrs.domain.enums.TaskStatusType; import com.zy.asrs.entity.LocMast; import com.zy.asrs.entity.TaskWrk; import com.zy.asrs.service.ApiLogService; import com.zy.asrs.service.CommandInfoService; import com.zy.asrs.service.LocMastService; import com.zy.asrs.service.TaskWrkService; import com.core.annotations.ManagerAuth; import com.core.common.BaseRes; import com.core.common.Cools; import com.core.common.R; import com.zy.asrs.utils.NotifyUtils; import com.zy.common.utils.HttpHandler; import com.zy.common.web.BaseController; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.web.bind.annotation.*; import java.util.*; @@ -33,20 +25,10 @@ @Slf4j public class TaskWrkController extends BaseController { @Value("${wms.url}") private String wmsUrl; @Autowired private TaskWrkService taskWrkService; @Autowired private CommandInfoService commandInfoService; @Autowired private LocMastService locMastService; @Value("${wms.TaskExecCallback}") private String TaskExecCallback; @Autowired private ApiLogService apiLogService; @Autowired private NotifyUtils notifyUtils; @RequestMapping(value = "/taskWrk/{wrkNo}/auth") @ManagerAuth @@ -173,45 +155,10 @@ @ManagerAuth(memo = "手动完成任务") public R complete(@RequestParam String taskNo) { TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); if (Cools.isEmpty(taskWrk) || taskWrk.getStatus()>=3){ return R.error("已完结或已取消") ; if (Cools.isEmpty(taskWrk) || taskWrk.getStatus() >= 3) { return R.error("已完结或已取消"); } LocMast locMast = new LocMast(); if(taskWrk.getIoType()==1){//入库任务完成库位为F locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); if(Cools.isEmpty(locMast)){ R.error("没有找到该库位") ; } locMast.setLocSts("F"); locMast.setModiTime(new Date()); locMast.setBarcode(taskWrk.getBarcode()); }else if(taskWrk.getIoType()==2){//出库任务完成库位为O locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); if(Cools.isEmpty(locMast)){ R.error("没有找到该库位") ; } locMast.setLocSts("O"); locMast.setModiTime(new Date()); }else if(taskWrk.getIoType()==3){ locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); if(Cools.isEmpty(locMast)){ R.error("没有找到该库位") ; } locMast.setLocSts("O"); locMast.setModiTime(new Date()); locMastService.updateById(locMast); locMast=locMastService.selectByLocNo(taskWrk.getTargetPoint()); if(Cools.isEmpty(locMast)){ R.error("没有找到该库位") ; } locMast.setLocSts("F"); locMast.setModiTime(new Date()); locMast.setBarcode(taskWrk.getBarcode()); } locMastService.updateById(locMast); taskWrk.setStatus(7);//手动完成任务 taskWrk.setStatus(TaskStatusType.MANUAL_OVER.id);//手动完成任务 taskWrk.setModiTime(new Date()); taskWrkService.updateById(taskWrk); return R.ok(); src/main/java/com/zy/asrs/domain/enums/TaskStatusType.java
@@ -6,7 +6,8 @@ DISTRIBUTE(2,"派发"), COMPLETE(3,"命令完成"), CANCEL(4,"取消"), OVER(5,"完结") OVER(5,"完结"), MANUAL_OVER(7,"手动完结"), ; public Integer id; src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -210,6 +210,11 @@ continue; } if (!locMast.getLocSts().equals("O")) { log.info(locNo + "库位不处于空库位"); continue; } Date now = new Date(); taskWrk = new TaskWrk(); taskWrk.setTaskNo(result.getTaskNo());//任务号 @@ -217,21 +222,25 @@ taskWrk.setStatus(TaskStatusType.RECEIVE.id);//任务状态:接收 taskWrk.setWrkSts(2);//2.设备上走 taskWrk.setCreateTime(now); taskWrk.setIoType(1);//任务类型 taskWrk.setIoPri(13);//优先级 taskWrk.setBarcode(barcode);//条码 taskWrk.setCrnNo(locMast.getCrnNo()); taskWrk.setTargetPoint(locNo); taskWrk.setStartPoint(String.valueOf(staProtocol.getStaNo())); if (!Cools.isEmpty(taskWrk.getTargetPoint())) { taskWrk.setOriginTargetPoint(taskWrk.getTargetPoint()); } taskWrk.setIoType(1);//任务类型 taskWrk.setIoPri(13);//优先级 taskWrk.setBarcode(barcode);//条码 taskWrk.setCrnNo(locMast.getCrnNo()); taskWrk.setTargetPoint(locNo); taskWrk.setStartPoint(String.valueOf(staProtocol.getStaNo())); if (!Cools.isEmpty(taskWrk.getTargetPoint())) { taskWrk.setOriginTargetPoint(taskWrk.getTargetPoint()); } if (!taskWrkService.insert(taskWrk)) { log.info("任务:" + result.getTaskNo() + "任务创建失败"); if (!taskWrkService.insert(taskWrk)) { log.info("任务:" + result.getTaskNo() + "任务创建失败"); continue; } locMast.setLocSts("S"); locMast.setModiTime(new Date()); locMastService.updateById(locMast); StaDesc staDesc = staDescService.selectOne(new EntityWrapper<StaDesc>() .eq("crn_no", taskWrk.getCrnNo()).eq("type_no", 1).eq("stn_no", staProtocol.getSiteId())); staProtocol.setWorkNo(taskWrk.getWrkNo().shortValue()); src/main/java/com/zy/asrs/service/impl/OpenServiceImpl.java
@@ -104,6 +104,22 @@ Date now = new Date(); taskWrk = new TaskWrk(); LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", param.getTargetPoint())); if (locMast == null) { map.put("Code","0"); map.put("Msg", param.getTaskNo() + "库位不存在!"); return map; } if (!locMast.getLocSts().equals("O")) { map.put("Code","0"); map.put("Msg", param.getTaskNo() + "库位不处于空库位!"); return map; } locMast.setLocSts("S"); locMast.setModiTime(new Date()); locMastService.updateById(locMast); int workNo1 = commonService.getWorkNo(WorkNoType.PAKIN.type);//获取入库工作号 taskWrk.setTaskNo(param.getTaskNo());//任务号 taskWrk.setWrkNo(workNo1); src/main/java/com/zy/asrs/task/TaskLogScheduler.java
@@ -1,6 +1,8 @@ package com.zy.asrs.task; import com.alibaba.fastjson.JSON; import com.core.common.Cools; import com.core.common.R; import com.core.exception.CoolException; import com.zy.asrs.domain.dto.NotifyCustomDataDto; import com.zy.asrs.domain.enums.NotifyMsgType; @@ -16,6 +18,7 @@ import org.springframework.stereotype.Component; import java.io.IOException; import java.util.Date; import java.util.HashMap; /** @@ -42,6 +45,8 @@ private String taskStatusFeedbackPath; @Autowired private NotifyUtils notifyUtils; @Autowired private LocMastService locMastService; @Scheduled(cron = "0/3 * * * * ? ") public void execute() throws IOException { @@ -50,12 +55,129 @@ headParam.put("TaskNo", taskWrk.getTaskNo()); NotifyMsgType notifyMsgType = null; if (taskWrk.getStatus().equals(TaskStatusType.OVER.id) || taskWrk.getStatus() == 7) {//完成 if (taskWrk.getStatus().equals(TaskStatusType.OVER.id) || taskWrk.getStatus().equals(TaskStatusType.MANUAL_OVER.id)) {//完成 headParam.put("Result", 1);//完成 notifyMsgType = NotifyMsgType.TASK_COMPLETE; if (taskWrk.getIoType() == 1) {//入库任务完成库位为F LocMast locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); if (locMast == null) { throw new CoolException("没有找到该库位" + taskWrk.getTargetPoint()); } if (!locMast.getLocSts().equals("S")) { throw new CoolException(taskWrk.getTaskNo() + "库位不处于S.入库预约"); } locMast.setLocSts("F"); locMast.setModiTime(new Date()); locMast.setBarcode(taskWrk.getBarcode()); locMastService.updateById(locMast); } else if (taskWrk.getIoType() == 2) {//出库任务完成库位为O LocMast locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); if (locMast == null) { throw new CoolException("没有找到该库位" + taskWrk.getStartPoint()); } if (!locMast.getLocSts().equals("R")) { throw new CoolException(taskWrk.getTaskNo() + "库位不处于R.出库预约"); } locMast.setLocSts("O"); locMast.setModiTime(new Date()); locMast.setBarcode(""); locMastService.updateById(locMast); } else if (taskWrk.getIoType() == 3) {//移库 LocMast locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); if (locMast == null) { throw new CoolException("没有找到该库位" + taskWrk.getStartPoint()); } if (!locMast.getLocSts().equals("R")) { throw new CoolException(taskWrk.getTaskNo() + "库位不处于R.出库预约"); } LocMast locMastTarget = locMastService.selectByLocNo(taskWrk.getTargetPoint()); if (locMastTarget == null) { throw new CoolException("没有找到该库位" + taskWrk.getTargetPoint()); } if (!locMastTarget.getLocSts().equals("S")) { throw new CoolException(taskWrk.getTaskNo() + "库位不处于S.入库预约"); } locMastTarget.setLocSts("F"); locMastTarget.setModiTime(new Date()); locMastTarget.setBarcode(taskWrk.getBarcode()); locMastService.updateById(locMastTarget); locMast.setLocSts("O"); locMast.setModiTime(new Date()); locMast.setBarcode(""); locMastService.updateById(locMast); } } else if (taskWrk.getStatus().equals(TaskStatusType.CANCEL.id)) { headParam.put("Result", 2);//取消 notifyMsgType = NotifyMsgType.TASK_CANCEL; if (taskWrk.getIoType() == 1) {//入库任务 LocMast locMast = locMastService.selectByLocNo(taskWrk.getTargetPoint()); if (locMast == null) { throw new CoolException("没有找到该库位" + taskWrk.getTargetPoint()); } if (!locMast.getLocSts().equals("S")) { throw new CoolException(taskWrk.getTaskNo() + "库位不处于S.入库预约"); } locMast.setLocSts("O"); locMast.setModiTime(new Date()); locMast.setBarcode(""); locMastService.updateById(locMast); } else if (taskWrk.getIoType() == 2) {//出库任务 LocMast locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); if (locMast == null) { throw new CoolException("没有找到该库位" + taskWrk.getStartPoint()); } if (!locMast.getLocSts().equals("R")) { throw new CoolException(taskWrk.getTaskNo() + "库位不处于R.出库预约"); } locMast.setLocSts("F"); locMast.setModiTime(new Date()); locMast.setBarcode(taskWrk.getBarcode()); locMastService.updateById(locMast); } else if (taskWrk.getIoType() == 3) {//移库 LocMast locMast = locMastService.selectByLocNo(taskWrk.getStartPoint()); if (locMast == null) { throw new CoolException("没有找到该库位" + taskWrk.getStartPoint()); } if (!locMast.getLocSts().equals("R")) { throw new CoolException(taskWrk.getTaskNo() + "库位不处于R.出库预约"); } LocMast locMastTarget = locMastService.selectByLocNo(taskWrk.getTargetPoint()); if (locMastTarget == null) { throw new CoolException("没有找到该库位" + taskWrk.getTargetPoint()); } if (!locMastTarget.getLocSts().equals("S")) { throw new CoolException(taskWrk.getTaskNo() + "库位不处于S.入库预约"); } locMastTarget.setLocSts("O"); locMastTarget.setModiTime(new Date()); locMastTarget.setBarcode(""); locMastService.updateById(locMastTarget); locMast.setLocSts("F"); locMast.setModiTime(new Date()); locMast.setBarcode(taskWrk.getBarcode()); locMastService.updateById(locMast); } } NotifyCustomDataDto customDataDto = new NotifyCustomDataDto();