| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.annotations.AppAuth; |
| | | import com.core.common.*; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.WrkMast; |
| | | import com.zy.asrs.entity.param.*; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.asrs.service.WorkService; |
| | | import com.zy.asrs.service.WrkMastService; |
| | | import com.zy.common.model.DetlDto; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | |
| | | |
| | | @Autowired |
| | | private OpenService openService; |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WorkService workService; |
| | | |
| | | @PostMapping("/order/matSync/default/v1") |
| | | @AppAuth(memo = "商品信息同步接口") |
| | | public synchronized R syncMatInfo(@RequestHeader(required = false) String appkey, |
| | | @RequestBody(required = false) MatSyncParam param, |
| | | HttpServletRequest request){ |
| | | HttpServletRequest request) { |
| | | auth(appkey, param, request); |
| | | if (Cools.isEmpty(param)) { |
| | | return R.parse(BaseRes.PARAM); |
| | |
| | | |
| | | /*********************************同步物料档案和订单****************************************************/ |
| | | |
| | | /*********************************wcs接口对接****************************************************/ |
| | | |
| | | /** |
| | | * 任务开始 |
| | | */ |
| | | @RequestMapping("/start/task") |
| | | public HashMap<String, Object> startTask(@RequestBody HashMap<String, Object> map) { |
| | | String taskNo = map.get("TaskNo") + ""; |
| | | HashMap<String, Object> map1 = new HashMap<>(); |
| | | if (Cools.isEmpty(taskNo)) { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "任务号为空"); |
| | | } else { |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", Integer.valueOf(taskNo))); |
| | | if (wrkMast == null) { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "没有找到该任务号:" + taskNo); |
| | | } else { |
| | | if (wrkMast.getIoType() == 1) { |
| | | wrkMast.setWrkSts(3L);//入库开始 |
| | | } else if (wrkMast.getIoType() == 11) { |
| | | wrkMast.setWrkSts(13L);//出库开始 |
| | | } |
| | | wrkMast.setModiTime(new Date()); |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | map1.put("ReturnStatus", "0"); |
| | | map1.put("ErrorMessage", ""); |
| | | } else { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "更新任务状态失败" + wrkMast); |
| | | } |
| | | } |
| | | } |
| | | return map1; |
| | | } |
| | | |
| | | /** |
| | | * 搬运到目的地 |
| | | */ |
| | | @RequestMapping("/destination/task") |
| | | public HashMap<String, Object> destinationTask(@RequestBody HashMap<String, Object> map) { |
| | | String taskNo = map.get("TaskNo") + ""; |
| | | HashMap<String, Object> map1 = new HashMap<>(); |
| | | if (Cools.isEmpty(taskNo)) { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "任务号为空"); |
| | | } else { |
| | | //任务完成 |
| | | if (map.get("Result").equals(1)) { |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", Integer.valueOf(taskNo))); |
| | | if (wrkMast == null) { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "没有找到该任务号:" + taskNo); |
| | | } else { |
| | | if (wrkMast.getIoType() == 1 || wrkMast.getIoType() == 10) { |
| | | wrkMast.setWrkSts(4L);//任务结束 |
| | | } else if (wrkMast.getIoType() == 101) { |
| | | wrkMast.setWrkSts(13L);//出库到站点上 |
| | | } else if (wrkMast.getIoType() == 53 || wrkMast.getIoType() == 57) { |
| | | wrkMast.setWrkSts(4L);//4.任务结束 |
| | | } else if (wrkMast.getIoType() == 103 || wrkMast.getIoType() == 107 || wrkMast.getIoType() == 110) { |
| | | wrkMast.setWrkSts(14L); |
| | | } |
| | | wrkMast.setModiTime(new Date()); |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | map1.put("ReturnStatus", "0"); |
| | | map1.put("ErrorMessage", ""); |
| | | } else { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "更新任务状态失败" + wrkMast); |
| | | } |
| | | } |
| | | } else { |
| | | //任务取消 |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", Integer.valueOf(taskNo))); |
| | | if (wrkMast == null) { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "没有找到该任务号:" + taskNo); |
| | | return map1; |
| | | } |
| | | workService.cancelWrkMast(String.valueOf(wrkMast.getWrkNo()),9999L); |
| | | } |
| | | } |
| | | return map1; |
| | | } |
| | | |
| | | /** |
| | | * 出库---目的地搬离 |
| | | */ |
| | | @RequestMapping("/leave/task") |
| | | public HashMap<String, Object> leaveTask(@RequestBody HashMap<String, Object> map) { |
| | | String taskNo = map.get("TaskNo") + ""; |
| | | HashMap<String, Object> map1 = new HashMap<>(); |
| | | if (Cools.isEmpty(taskNo)) { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "任务号为空"); |
| | | } else { |
| | | |
| | | WrkMast wrkMast = wrkMastService.selectOne(new EntityWrapper<WrkMast>().eq("wrk_no", Integer.valueOf(taskNo))); |
| | | if (wrkMast == null) { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "没有找到该任务号:" + taskNo); |
| | | return map1; |
| | | } |
| | | if ((wrkMast.getIoType() == 103 || wrkMast.getIoType() == 107 || wrkMast.getIoType() == 110) && wrkMast.getWrkSts() != 14) { |
| | | wrkMast.setWrkSts(14L);//出库到站点上 |
| | | wrkMast.setModiTime(new Date()); |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | map1.put("ReturnStatus", "0"); |
| | | map1.put("ErrorMessage", ""); |
| | | } else { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "更新任务状态失败" + wrkMast); |
| | | } |
| | | } else if (wrkMast.getIoType() != 101) { |
| | | map1.put("ReturnStatus", "0"); |
| | | map1.put("ErrorMessage", ""); |
| | | return map1; |
| | | } else { |
| | | wrkMast.setWrkSts(14L);//出库到站点上 |
| | | wrkMast.setModiTime(new Date()); |
| | | if (wrkMastService.updateById(wrkMast)) { |
| | | map1.put("ReturnStatus", "0"); |
| | | map1.put("ErrorMessage", ""); |
| | | } else { |
| | | map1.put("ReturnStatus", "1"); |
| | | map1.put("ErrorMessage", "更新任务状态失败" + wrkMast); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | return map1; |
| | | } |
| | | } |