New file |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | 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.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | | import com.zy.asrs.service.ToWmsService; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | @Slf4j |
| | | public class TransferTaskController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | |
| | | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | |
| | | @Autowired |
| | | private ToWmsService toWmsService; |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/transferTask/{wrkNo}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("wrkNo") Integer wrkNo) { |
| | | return R.ok(taskWrkService.selectByWrkNo(wrkNo)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTask/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<TaskWrk> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(taskWrkService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTask/add/auth") |
| | | @ManagerAuth |
| | | public R add(TaskWrk taskWrk) { |
| | | taskWrkService.insert(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTask/update/auth") |
| | | @ManagerAuth |
| | | public R update(TaskWrk taskWrk) { |
| | | if (Cools.isEmpty(taskWrk) || null == taskWrk.getTaskNo()) { |
| | | return R.error(); |
| | | } |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTask/updatePoint/auth") |
| | | @ManagerAuth |
| | | public R updatePoint(TaskWrk taskWrk) { |
| | | if (Cools.isEmpty(taskWrk) || null == taskWrk.getTaskNo()) { |
| | | return R.error(); |
| | | } |
| | | TaskWrk taskWrk1 = taskWrkService.selectByTaskNo(taskWrk.getTaskNo()); |
| | | if (taskWrk1 == null) { |
| | | return R.error(); |
| | | } |
| | | taskWrk1.setStartPoint(taskWrk.getStartPoint()); |
| | | taskWrk1.setTargetPoint(taskWrk.getTargetPoint()); |
| | | taskWrk1.setModiTime(new Date()); |
| | | taskWrk1.setModiUser(getUserId()); |
| | | taskWrkService.updateById(taskWrk1); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTask/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | taskWrkService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTask/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<TaskWrk> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("taskWrk")); |
| | | convert(map, wrapper); |
| | | List<TaskWrk> list = taskWrkService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/transferTask/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<TaskWrk> wrapper = new EntityWrapper<TaskWrk>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != taskWrkService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(TaskWrk.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTask/distribute/auth") |
| | | @ManagerAuth(memo = "手动派发任务") |
| | | public R distribute(@RequestParam String taskNo) { |
| | | taskWrkService.distribute(taskNo, getUserId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTask/complete/auth") |
| | | @ManagerAuth(memo = "手动完成任务") |
| | | public R complete(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | 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()); |
| | | |
| | | } |
| | | toWmsService.addReportLog(taskWrk); |
| | | locMastService.updateById(locMast); |
| | | taskWrk.setStatus(7);//手动完成任务 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTask/returnWorkingCondition/auth") |
| | | @ManagerAuth(memo = "重新给堆垛机下发任务") |
| | | public R returnWorkingCondition(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts() == 12) { |
| | | taskWrk.setWrkSts(11); |
| | | if (!taskWrkService.updateById(taskWrk)) { |
| | | return R.error("更新任务状态失败"); |
| | | } |
| | | return R.ok(); |
| | | } else if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts() == 3) { |
| | | taskWrk.setWrkSts(2); |
| | | taskWrkService.updateById(taskWrk); |
| | | if (!taskWrkService.updateById(taskWrk)) { |
| | | return R.error("更新任务状态失败"); |
| | | } |
| | | return R.ok(); |
| | | } else { |
| | | return R.error("任务状态不对无法重新给堆垛机下发任务"); |
| | | } |
| | | |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTask/cancel/auth") |
| | | @ManagerAuth(memo = "手动取消任务") |
| | | public R cancel(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (taskWrk == null) { |
| | | return R.error(); |
| | | } |
| | | if (taskWrk.getStatus().equals(TaskStatusType.CANCEL.id)) { |
| | | return R.error(taskWrk.getTaskNo() + "已被取消"); |
| | | } |
| | | Date now = new Date(); |
| | | taskWrk.setStatus(TaskStatusType.CANCEL.id); |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | try { |
| | | taskWrk.setModiUser(getUserId());//操作员 |
| | | } catch (Exception e) { |
| | | taskWrk.setModiUser(9999L);//操作员 |
| | | } |
| | | toWmsService.addReportLog(taskWrk); |
| | | |
| | | taskWrk.setCompleteTime(now);//完结时间 |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTask/updateCommandStep") |
| | | @ManagerAuth(memo = "更新步序") |
| | | public R updateCommandStep(@RequestParam Integer wrkNo, @RequestParam Integer commandStep) { |
| | | TaskWrk taskWrk = taskWrkService.selectByWrkNo(wrkNo); |
| | | if (taskWrk == null) { |
| | | return R.error(); |
| | | } |
| | | Date now = new Date(); |
| | | taskWrk.setCommandStep(commandStep); |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | taskWrk.setModiUser(getUserId());//操作员 |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.controller; |
| | | |
| | | 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.annotations.ManagerAuth; |
| | | import com.core.common.BaseRes; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.R; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.LocMast; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.service.LocMastService; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | | import com.zy.asrs.service.ToWmsService; |
| | | import com.zy.common.web.BaseController; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | @RestController |
| | | @Slf4j |
| | | public class TransferTaskLogController extends BaseController { |
| | | |
| | | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | |
| | | |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | |
| | | |
| | | @Autowired |
| | | private ToWmsService toWmsService; |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/transferTaskLog/{wrkNo}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("wrkNo") Integer wrkNo) { |
| | | return R.ok(taskWrkService.selectByWrkNo(wrkNo)); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTaskLog/list/auth") |
| | | @ManagerAuth |
| | | public R list(@RequestParam(defaultValue = "1") Integer curr, |
| | | @RequestParam(defaultValue = "10") Integer limit, |
| | | @RequestParam(required = false) String orderByField, |
| | | @RequestParam(required = false) String orderByType, |
| | | @RequestParam Map<String, Object> param) { |
| | | EntityWrapper<TaskWrk> wrapper = new EntityWrapper<>(); |
| | | excludeTrash(param); |
| | | convert(param, wrapper); |
| | | if (!Cools.isEmpty(orderByField)) { |
| | | wrapper.orderBy(humpToLine(orderByField), "asc".equals(orderByType)); |
| | | } |
| | | return R.ok(taskWrkService.selectPage(new Page<>(curr, limit), wrapper)); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper) { |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | String val = String.valueOf(entry.getValue()); |
| | | if (val.contains(RANGE_TIME_LINK)) { |
| | | String[] dates = val.split(RANGE_TIME_LINK); |
| | | wrapper.ge(entry.getKey(), DateUtils.convert(dates[0])); |
| | | wrapper.le(entry.getKey(), DateUtils.convert(dates[1])); |
| | | } else { |
| | | wrapper.like(entry.getKey(), val); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTaskLog/add/auth") |
| | | @ManagerAuth |
| | | public R add(TaskWrk taskWrk) { |
| | | taskWrkService.insert(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTaskLog/update/auth") |
| | | @ManagerAuth |
| | | public R update(TaskWrk taskWrk) { |
| | | if (Cools.isEmpty(taskWrk) || null == taskWrk.getTaskNo()) { |
| | | return R.error(); |
| | | } |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTaskLog/updatePoint/auth") |
| | | @ManagerAuth |
| | | public R updatePoint(TaskWrk taskWrk) { |
| | | if (Cools.isEmpty(taskWrk) || null == taskWrk.getTaskNo()) { |
| | | return R.error(); |
| | | } |
| | | TaskWrk taskWrk1 = taskWrkService.selectByTaskNo(taskWrk.getTaskNo()); |
| | | if (taskWrk1 == null) { |
| | | return R.error(); |
| | | } |
| | | taskWrk1.setStartPoint(taskWrk.getStartPoint()); |
| | | taskWrk1.setTargetPoint(taskWrk.getTargetPoint()); |
| | | taskWrk1.setModiTime(new Date()); |
| | | taskWrk1.setModiUser(getUserId()); |
| | | taskWrkService.updateById(taskWrk1); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTaskLog/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value = "ids[]") Long[] ids) { |
| | | for (Long id : ids) { |
| | | taskWrkService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/transferTaskLog/export/auth") |
| | | @ManagerAuth |
| | | public R export(@RequestBody JSONObject param) { |
| | | EntityWrapper<TaskWrk> wrapper = new EntityWrapper<>(); |
| | | List<String> fields = JSONObject.parseArray(param.getJSONArray("fields").toJSONString(), String.class); |
| | | Map<String, Object> map = excludeTrash(param.getJSONObject("taskWrk")); |
| | | convert(map, wrapper); |
| | | List<TaskWrk> list = taskWrkService.selectList(wrapper); |
| | | return R.ok(exportSupport(list, fields)); |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/transferTaskLog/check/column/auth") |
| | | @ManagerAuth |
| | | public R query(@RequestBody JSONObject param) { |
| | | Wrapper<TaskWrk> wrapper = new EntityWrapper<TaskWrk>().eq(humpToLine(String.valueOf(param.get("key"))), param.get("val")); |
| | | if (null != taskWrkService.selectOne(wrapper)) { |
| | | return R.parse(BaseRes.REPEAT).add(getComment(TaskWrk.class, String.valueOf(param.get("key")))); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTaskLog/distribute/auth") |
| | | @ManagerAuth(memo = "手动派发任务") |
| | | public R distribute(@RequestParam String taskNo) { |
| | | taskWrkService.distribute(taskNo, getUserId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTaskLog/complete/auth") |
| | | @ManagerAuth(memo = "手动完成任务") |
| | | public R complete(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | 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()); |
| | | |
| | | } |
| | | toWmsService.addReportLog(taskWrk); |
| | | locMastService.updateById(locMast); |
| | | taskWrk.setStatus(7);//手动完成任务 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTaskLog/returnWorkingCondition/auth") |
| | | @ManagerAuth(memo = "重新给堆垛机下发任务") |
| | | public R returnWorkingCondition(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts() == 12) { |
| | | taskWrk.setWrkSts(11); |
| | | if (!taskWrkService.updateById(taskWrk)) { |
| | | return R.error("更新任务状态失败"); |
| | | } |
| | | return R.ok(); |
| | | } else if (!Cools.isEmpty(taskWrk) && taskWrk.getWrkSts() == 3) { |
| | | taskWrk.setWrkSts(2); |
| | | taskWrkService.updateById(taskWrk); |
| | | if (!taskWrkService.updateById(taskWrk)) { |
| | | return R.error("更新任务状态失败"); |
| | | } |
| | | return R.ok(); |
| | | } else { |
| | | return R.error("任务状态不对无法重新给堆垛机下发任务"); |
| | | } |
| | | |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTaskLog/cancel/auth") |
| | | @ManagerAuth(memo = "手动取消任务") |
| | | public R cancel(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (taskWrk == null) { |
| | | return R.error(); |
| | | } |
| | | if (taskWrk.getStatus().equals(TaskStatusType.CANCEL.id)) { |
| | | return R.error(taskWrk.getTaskNo() + "已被取消"); |
| | | } |
| | | Date now = new Date(); |
| | | taskWrk.setStatus(TaskStatusType.CANCEL.id); |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | try { |
| | | taskWrk.setModiUser(getUserId());//操作员 |
| | | } catch (Exception e) { |
| | | taskWrk.setModiUser(9999L);//操作员 |
| | | } |
| | | toWmsService.addReportLog(taskWrk); |
| | | |
| | | taskWrk.setCompleteTime(now);//完结时间 |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/transferTaskLog/updateCommandStep") |
| | | @ManagerAuth(memo = "更新步序") |
| | | public R updateCommandStep(@RequestParam Integer wrkNo, @RequestParam Integer commandStep) { |
| | | TaskWrk taskWrk = taskWrkService.selectByWrkNo(wrkNo); |
| | | if (taskWrk == null) { |
| | | return R.error(); |
| | | } |
| | | Date now = new Date(); |
| | | taskWrk.setCommandStep(commandStep); |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | taskWrk.setModiUser(getUserId());//操作员 |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("wcs_transfer_task") |
| | | public class TransferTask implements Serializable { |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | /** |
| | | * wms任务号 |
| | | */ |
| | | @ApiModelProperty(value = "wms任务号") |
| | | @TableId(value = "task_no", type = IdType.INPUT) |
| | | @TableField("task_no") |
| | | private String taskNo; |
| | | |
| | | /** |
| | | * 任务状态 1: 接收 2: 派发 3: 完结 4: 取消 |
| | | */ |
| | | @ApiModelProperty(value = "任务状态 1: 接收 2: 派发 5: 完结 4: 取消 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 任务号 |
| | | */ |
| | | @ApiModelProperty(value = "任务号") |
| | | @TableField("wrk_no") |
| | | private Integer wrkNo; |
| | | |
| | | |
| | | /** |
| | | * 任务时间(接收时间) |
| | | */ |
| | | @ApiModelProperty(value = "任务时间(接收时间)") |
| | | @TableField("create_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | |
| | | /** |
| | | * 起点 |
| | | */ |
| | | @ApiModelProperty(value = "起点") |
| | | @TableField("start_point") |
| | | private Integer startPoint; |
| | | |
| | | /** |
| | | * 终点 |
| | | */ |
| | | @ApiModelProperty(value = "终点") |
| | | @TableField("target_point") |
| | | private Integer targetPoint; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value = "修改人员") |
| | | @TableField("modi_user") |
| | | private Long modiUser; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("modi_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date modiTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 条码 |
| | | */ |
| | | @ApiModelProperty(value = "条码") |
| | | private String barcode; |
| | | |
| | | /** |
| | | * 派发时间 |
| | | */ |
| | | @ApiModelProperty(value = "派发时间") |
| | | @TableField("assign_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date assignTime; |
| | | |
| | | /** |
| | | * 执行时间 |
| | | */ |
| | | @ApiModelProperty(value = "执行时间") |
| | | @TableField("execute_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date executeTime; |
| | | |
| | | /** |
| | | * 完结时间 |
| | | */ |
| | | @ApiModelProperty(value = "完结时间") |
| | | @TableField("complete_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date completeTime; |
| | | |
| | | /** |
| | | * 取消时间 |
| | | */ |
| | | @ApiModelProperty(value = "取消时间") |
| | | @TableField("cancel_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date cancelTime; |
| | | |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @TableName("wcs_transfer_task_log") |
| | | public class TransferTaskLog implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | |
| | | /** |
| | | * wms任务号 |
| | | */ |
| | | @ApiModelProperty(value = "wms任务号") |
| | | @TableId(value = "task_no", type = IdType.INPUT) |
| | | @TableField("task_no") |
| | | private String taskNo; |
| | | |
| | | /** |
| | | * 任务状态 1: 接收 2: 派发 3: 完结 4: 取消 |
| | | */ |
| | | @ApiModelProperty(value = "任务状态 1: 接收 2: 派发 5: 完结 4: 取消 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 任务号 |
| | | */ |
| | | @ApiModelProperty(value = "任务号") |
| | | @TableField("wrk_no") |
| | | private Integer wrkNo; |
| | | |
| | | |
| | | /** |
| | | * 任务时间(接收时间) |
| | | */ |
| | | @ApiModelProperty(value = "任务时间(接收时间)") |
| | | @TableField("create_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | |
| | | /** |
| | | * 起点 |
| | | */ |
| | | @ApiModelProperty(value = "起点") |
| | | @TableField("start_point") |
| | | private String startPoint; |
| | | |
| | | /** |
| | | * 终点 |
| | | */ |
| | | @ApiModelProperty(value = "终点") |
| | | @TableField("target_point") |
| | | private String targetPoint; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value = "修改人员") |
| | | @TableField("modi_user") |
| | | private Long modiUser; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value = "修改时间") |
| | | @TableField("modi_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date modiTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value = "备注") |
| | | private String memo; |
| | | |
| | | /** |
| | | * 条码 |
| | | */ |
| | | @ApiModelProperty(value = "条码") |
| | | private String barcode; |
| | | |
| | | /** |
| | | * 派发时间 |
| | | */ |
| | | @ApiModelProperty(value = "派发时间") |
| | | @TableField("assign_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date assignTime; |
| | | |
| | | /** |
| | | * 执行时间 |
| | | */ |
| | | @ApiModelProperty(value = "执行时间") |
| | | @TableField("execute_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date executeTime; |
| | | |
| | | /** |
| | | * 完结时间 |
| | | */ |
| | | @ApiModelProperty(value = "完结时间") |
| | | @TableField("complete_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date completeTime; |
| | | |
| | | /** |
| | | * 取消时间 |
| | | */ |
| | | @ApiModelProperty(value = "取消时间") |
| | | @TableField("cancel_time") |
| | | @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | private Date cancelTime; |
| | | |
| | | /** |
| | | * 工作状态 |
| | | */ |
| | | @ApiModelProperty(value = "工作状态") |
| | | @TableField("wrk_sts") |
| | | private Integer wrkSts; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.TransferTask; |
| | | import com.zy.asrs.entity.TransferTaskLog; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface TransferTaskLogMapper extends BaseMapper<TransferTaskLog> { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import com.zy.asrs.entity.TransferTask; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface TransferTaskMapper extends BaseMapper<TransferTask> { |
| | | |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.TaskWrkLog; |
| | | import com.zy.asrs.entity.TransferTask; |
| | | import com.zy.asrs.entity.TransferTaskLog; |
| | | |
| | | public interface TransferTaskLogService extends IService<TransferTaskLog> { |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | import com.zy.asrs.entity.TransferTask; |
| | | |
| | | public interface TransferTaskService extends IService<TransferTask> { |
| | | |
| | | TransferTask selectByStartPoint(Integer startPoint); |
| | | |
| | | TransferTask selectByEndPoint(Integer endPoint); |
| | | |
| | | } |
| | |
| | | @Autowired |
| | | private CrnController crnController; |
| | | |
| | | @Autowired |
| | | private TransferTaskService transferTaskService; |
| | | |
| | | |
| | | public void generateStoreWrkFile1() throws IOException, InterruptedException { |
| | | try { |
| | |
| | | try { |
| | | // 根据输送线plc遍历 |
| | | for (DevpSlave devp : slaveProperties.getDevp()) { |
| | | if (devp.getId() == 2) { |
| | | continue; |
| | | } |
| | | SiemensDevpThread devpThread = (SiemensDevpThread) SlaveConnection.get(SlaveType.Devp, devp.getId()); |
| | | for (DevpSlave.Sta inSta : devp.getInSta()) { |
| | | WrkMast pakout = wrkMastMapper.selectWorkingPakout(inSta.getBackSta()); |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 转移任务下发 |
| | | */ |
| | | public void transferTaskStart() { |
| | | |
| | | for (DevpSlave.Sta sta : slaveProperties.getDevp().get(1).getInSta()) { |
| | | try { |
| | | // 获取入库站信息 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2); |
| | | StaProtocol staProtocol = devpThread.getStation().get(sta.getStaNo()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == 0)) { |
| | | // 查询工作档 |
| | | TransferTask transferTask = transferTaskService.selectByStartPoint(sta.getStaNo()); |
| | | if (transferTask == null) { |
| | | continue; |
| | | } |
| | | log.info("下发输送线转移任务:taskWrk:" + JSON.toJSONString(transferTask)); |
| | | staProtocol.setWorkNo(transferTask.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(transferTask.getTargetPoint().shortValue()); |
| | | boolean offer = false; |
| | | try { |
| | | offer = MessageQueue.offer(SlaveType.Devp, 1, new Task(2, staProtocol)); |
| | | } catch (Exception e) { |
| | | log.error("下发输送线转移任务:异常:" + e); |
| | | log.error("下发输送线转移任务:异常:offer:" + offer); |
| | | } |
| | | if (offer) { |
| | | log.info("下发输送线任务成功:taskWrk:" + JSON.toJSONString(transferTask)); |
| | | transferTask.setStatus(2); |
| | | transferTaskService.updateById(transferTask); |
| | | } else { |
| | | log.error("下发输送线任务失败:taskWrk:" + JSON.toJSONString(transferTask)); |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("转移任务异常:异常信息:" + e); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 转移任务完成 |
| | | */ |
| | | public void transferTaskEnd() { |
| | | for (DevpSlave.Sta sta : slaveProperties.getDevp().get(1).getInSta()) { |
| | | try { |
| | | // 获取终点站 |
| | | DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Devp, 2); |
| | | StaProtocol staProtocol = devpThread.getStation().get(sta.getOverSta()); |
| | | if (staProtocol == null) { |
| | | continue; |
| | | } else { |
| | | staProtocol = staProtocol.clone(); |
| | | } |
| | | if (staProtocol.isAutoing() && staProtocol.isLoading() && (staProtocol.getWorkNo() == 0 || staProtocol.getStaNo() == 0)) { |
| | | // 查询工作档 |
| | | TransferTask transferTask = transferTaskService.selectByEndPoint(sta.getStaNo()); |
| | | if (transferTask == null) { |
| | | continue; |
| | | } |
| | | log.info("转移任务完成:transferTask:" + JSON.toJSONString(transferTask)); |
| | | transferTask.setStatus(5); |
| | | transferTaskService.updateById(transferTask); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("转移任务异常:异常信息:" + e); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.TransferTaskLog; |
| | | import com.zy.asrs.mapper.TransferTaskLogMapper; |
| | | import com.zy.asrs.service.TransferTaskLogService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class TransferTaskLogServiceImpl extends ServiceImpl<TransferTaskLogMapper, TransferTaskLog> implements TransferTaskLogService { |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.asrs.entity.TransferTask; |
| | | import com.zy.asrs.mapper.TransferTaskMapper; |
| | | import com.zy.asrs.service.TransferTaskService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | @Slf4j |
| | | @Service |
| | | public class TransferTaskServiceImpl extends ServiceImpl<TransferTaskMapper, TransferTask> implements TransferTaskService { |
| | | |
| | | |
| | | @Override |
| | | public TransferTask selectByStartPoint(Integer startPoint) { |
| | | return null; |
| | | } |
| | | |
| | | @Override |
| | | public TransferTask selectByEndPoint(Integer endPoint) { |
| | | return null; |
| | | } |
| | | } |
| | |
| | | private Integer scale; |
| | | |
| | | private Integer backSta; |
| | | |
| | | private Integer overSta; |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | rack: 0 |
| | | port: 102 |
| | | slot: 0 |
| | | inSta[0]: |
| | | staNo: 301 |
| | | inSta[1]: |
| | | staNo: 303 |
| | | inSta[2]: |
| | | staNo: 305 |
| | | inSta[3]: |
| | | staNo: 307 |
| | | |
| | | barcode[0]: #条码扫描仪 |
| | | port: 51236 |
| | | ip: 172.17.91.39 |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.mapper.TransferTaskLogMapper"> |
| | | |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.zy.asrs.mapper.TransferTaskMapper"> |
| | | |
| | | |
| | | |
| | | </mapper> |
| | |
| | | "type": "stn", |
| | | "id": "site-307", |
| | | "text": "308", |
| | | "top": 535, |
| | | "top": 231, |
| | | "left": 200, |
| | | "width": 62, |
| | | "height": 23 |
| | |
| | | "type": "stn", |
| | | "id": "site-308", |
| | | "text": "308", |
| | | "top": 560, |
| | | "top": 256, |
| | | "left": 200, |
| | | "width": 62, |
| | | "height": 23 |
| | |
| | | "type": "stn", |
| | | "id": "site-305", |
| | | "text": "305", |
| | | "top": 535, |
| | | "top": 231, |
| | | "left": 300, |
| | | "width": 62, |
| | | "height": 23 |
| | |
| | | "type": "stn", |
| | | "id": "site-306", |
| | | "text": "306", |
| | | "top": 560, |
| | | "top": 256, |
| | | "left": 300, |
| | | "width": 62, |
| | | "height": 23 |
| | |
| | | "type": "stn", |
| | | "id": "site-303", |
| | | "text": "303", |
| | | "top": 535, |
| | | "top": 231, |
| | | "left": 400, |
| | | "width": 62, |
| | | "height": 23 |
| | |
| | | "type": "stn", |
| | | "id": "site-304", |
| | | "text": "304", |
| | | "top": 560, |
| | | "top": 256, |
| | | "left": 400, |
| | | "width": 62, |
| | | "height": 23 |
| | |
| | | "type": "stn", |
| | | "id": "site-301", |
| | | "text": "301", |
| | | "top": 535, |
| | | "top": 231, |
| | | "left": 500, |
| | | "width": 62, |
| | | "height": 23 |
| | |
| | | "type": "stn", |
| | | "id": "site-302", |
| | | "text": "302", |
| | | "top": 560, |
| | | "top": 256, |
| | | "left": 500, |
| | | "width": 62, |
| | | "height": 23 |
New file |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | |
| | | <head> |
| | | <meta charset="UTF-8"> |
| | | <title>任务管理</title> |
| | | <link rel="stylesheet" href="../../static/wcs/css/element.css"> |
| | | <script type="text/javascript" src="../../static/wcs/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/wms/layui/layui.js"></script> |
| | | <script type="text/javascript" src="../../static/wcs/js/common.js"></script> |
| | | <script type="text/javascript" src="../../static/wcs/js/vue.min.js"></script> |
| | | <script type="text/javascript" src="../../static/wcs/js/element.js"></script> |
| | | </head> |
| | | |
| | | <body> |
| | | <div id="app" style="display: flex;justify-content: center;flex-wrap: wrap;"> |
| | | <div style="width: 100%;"> |
| | | <el-card class="box-card"> |
| | | <el-form :inline="true" :model="tableSearchParam" class="demo-form-inline"> |
| | | <el-form-item label=""> |
| | | <el-input v-model="tableSearchParam.task_no" placeholder="任务号"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-select v-model="tableSearchParam.status" placeholder="任务状态"> |
| | | <el-option label="接收" value="1"></el-option> |
| | | <el-option label="派发" value="2"></el-option> |
| | | <el-option label="完结" value="3"></el-option> |
| | | <el-option label="取消" value="4"></el-option> |
| | | </el-select> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-input v-model="tableSearchParam.wrk_no" placeholder="工作号"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label=""> |
| | | <el-date-picker |
| | | v-model="tableSearchParam.datetime" |
| | | value-format="yyyy-MM-dd HH:mm:ss" |
| | | type="datetimerange" |
| | | range-separator="至" |
| | | start-placeholder="开始日期" |
| | | end-placeholder="结束日期"> |
| | | </el-date-picker> |
| | | </el-form-item> |
| | | <el-form-item> |
| | | <el-button type="primary" @click="getTableData">查询</el-button> |
| | | <el-button type="primary" @click="resetParam">重置</el-button> |
| | | </el-form-item> |
| | | </el-form> |
| | | <el-table ref="singleTable" :data="tableData" style="width: 100%;"> |
| | | <el-table-column label="操作" width="100"> |
| | | <template slot-scope="scope"> |
| | | <el-dropdown @command="(command)=>{handleCommand(command, scope.row)}"> |
| | | <el-button icon="el-icon-more" size="mini" type="primary"></el-button> |
| | | <el-dropdown-menu slot="dropdown"> |
| | | <!-- <el-dropdown-item command="showCommand">查看指令</el-dropdown-item>--> |
| | | <el-dropdown-item command="returnWorkingCondition">重新给堆垛机下发任务</el-dropdown-item> |
| | | <el-dropdown-item command="changeCommand">修改</el-dropdown-item> |
| | | <el-dropdown-item command="assign">派发</el-dropdown-item> |
| | | <el-dropdown-item command="complete">完结</el-dropdown-item> |
| | | <el-dropdown-item command="cancel">取消</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column property="taskNo" label="任务号"> |
| | | </el-table-column> |
| | | <el-table-column property="status$" label="任务状态"> |
| | | </el-table-column> |
| | | <el-table-column property="wrkNo" label="工作号"> |
| | | </el-table-column> |
| | | <el-table-column property="createTime$" label="任务时间"> |
| | | </el-table-column> |
| | | <el-table-column property="durationTime" label="持续时长"> |
| | | </el-table-column> |
| | | <el-table-column property="startPoint" label="起点位置"> |
| | | </el-table-column> |
| | | <el-table-column property="targetPoint" label="终点位置"> |
| | | </el-table-column> |
| | | <el-table-column property="wrkSts$" label="工作状态"> |
| | | </el-table-column> |
| | | <el-table-column property="barcode" label="托盘码"> |
| | | </el-table-column> |
| | | |
| | | </el-table> |
| | | |
| | | <div style="margin-top: 10px;"> |
| | | <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" |
| | | :current-page="currentPage" :page-sizes="pageSizes" :page-size="pageSize" |
| | | layout="total, sizes, prev, pager, next, jumper" :total="pageTotal"> |
| | | </el-pagination> |
| | | </div> |
| | | </el-card> |
| | | </div> |
| | | |
| | | <el-dialog :title="taskWrkFormTitle" :visible.sync="taskWrkFormVisible"> |
| | | <el-form :model="taskWrkForm"> |
| | | <el-form-item label="起点位置" :label-width="taskWrkFormLabelWidth"> |
| | | <el-input v-model="taskWrkForm.startPoint" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | <el-form-item label="终点位置" :label-width="taskWrkFormLabelWidth"> |
| | | <el-input v-model="taskWrkForm.targetPoint" autocomplete="off"></el-input> |
| | | </el-form-item> |
| | | </el-form> |
| | | <div slot="footer" class="dialog-footer"> |
| | | <el-button @click="taskWrkFormVisible = false">取 消</el-button> |
| | | <el-button type="primary" @click="taskWrkFormConfirm">确 定</el-button> |
| | | </div> |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | <script> |
| | | var $layui = layui.config({ |
| | | base: baseUrl + "/static/wms/layui/lay/modules/" |
| | | }).use(['layer', 'form'], function() {}) |
| | | |
| | | var app = new Vue({ |
| | | el: '#app', |
| | | data: { |
| | | tableData: [], |
| | | currentPage: 1, |
| | | pageSizes: [16, 30, 50, 100, 150, 200], |
| | | pageSize: 16, |
| | | pageTotal: 0, |
| | | tableSearchParam: { |
| | | task_no: null, |
| | | status: null, |
| | | wrk_no: null, |
| | | datetime: null, |
| | | }, |
| | | taskWrkFormVisible: false, |
| | | taskWrkForm: {}, |
| | | taskWrkFormLabelWidth: '80px', |
| | | taskWrkFormTitle: '' |
| | | }, |
| | | created() { |
| | | this.init() |
| | | }, |
| | | methods: { |
| | | init() { |
| | | let taskNo = getQueryVariable('taskNo') |
| | | let wrkNo = getQueryVariable('wrkNo') |
| | | if (taskNo != false) { |
| | | this.tableSearchParam.task_no = taskNo |
| | | } |
| | | if (wrkNo != false) { |
| | | this.tableSearchParam.wrk_no = wrkNo |
| | | } |
| | | |
| | | this.getTableData() |
| | | }, |
| | | getTableData() { |
| | | let that = this; |
| | | let data = JSON.parse(JSON.stringify(this.tableSearchParam)) |
| | | data.curr = this.currentPage |
| | | data.limit = this.pageSize |
| | | if (this.tableSearchParam.datetime != null) { |
| | | data.datetime = null |
| | | data.create_time = this.tableSearchParam.datetime[0] + " - " + this.tableSearchParam.datetime[1] |
| | | } |
| | | $.ajax({ |
| | | url: baseUrl + "/taskWrk/list/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: data, |
| | | dataType: 'json', |
| | | contentType: 'application/json;charset=UTF-8', |
| | | method: 'GET', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.tableData = res.data.records |
| | | that.pageTotal = res.data.total |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | handleSizeChange(val) { |
| | | console.log(`每页 ${val} 条`); |
| | | this.pageSize = val |
| | | this.getTableData() |
| | | }, |
| | | handleCurrentChange(val) { |
| | | console.log(`当前页: ${val}`); |
| | | this.currentPage = val |
| | | this.getTableData() |
| | | }, |
| | | resetParam() { |
| | | this.tableSearchParam = { |
| | | task_no: null, |
| | | status: null, |
| | | wrk_no: null |
| | | } |
| | | this.getTableData() |
| | | }, |
| | | handleCommand(command, row) { |
| | | switch (command) { |
| | | case "returnWorkingCondition": |
| | | //重新给堆垛机下发任务 |
| | | this.returnWorkingConditionWrk(row) |
| | | break; |
| | | case "changeCommand": |
| | | //修改指令 |
| | | this.changeCommand(row); |
| | | break |
| | | case "assign": |
| | | //派发任务 |
| | | this.assignWrk(row) |
| | | break; |
| | | case "complete": |
| | | //完结任务 |
| | | this.completeWrk(row) |
| | | break; |
| | | case "cancel": |
| | | //取消任务 |
| | | this.cancelWrk(row) |
| | | break; |
| | | } |
| | | }, |
| | | showCommand(row) { |
| | | let wrkNo = row.wrkNo == null ? "" : row.wrkNo |
| | | //查看指令 |
| | | $layui.layer.open({ |
| | | type: 2, |
| | | title: '指令管理', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | | content: 'commandManage.html?taskNo=' + row.taskNo + "&wrkNo=" + wrkNo, |
| | | success: function(layero, index) {} |
| | | }); |
| | | }, |
| | | changeCommand(row) { |
| | | //修改指令 |
| | | this.taskWrkFormVisible = true |
| | | this.taskWrkFormTitle = "任务:" + row.taskNo |
| | | this.taskWrkForm = row |
| | | }, |
| | | assignWrk(row){ |
| | | //派发任务 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/taskWrk/distribute/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | taskNo: row.taskNo |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "派发成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | completeWrk(row){ |
| | | //完成任务 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/taskWrk/complete/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | taskNo: row.taskNo |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "完结成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | returnWorkingConditionWrk(row){ |
| | | //重新给堆垛机下发任务 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/taskWrk/returnWorkingCondition/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | taskNo: row.taskNo |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "取消成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | cancelWrk(row){ |
| | | //取消任务 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/taskWrk/cancel/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | taskNo: row.taskNo |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.$message({ |
| | | message: "取消成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | taskWrkFormConfirm() { |
| | | //修改指定任务数据 |
| | | let that = this |
| | | $.ajax({ |
| | | url: baseUrl + "/taskWrk/updatePoint/auth", |
| | | headers: { |
| | | 'token': localStorage.getItem('token') |
| | | }, |
| | | data: { |
| | | taskNo: this.taskWrkForm.taskNo, |
| | | startPoint: this.taskWrkForm.startPoint, |
| | | targetPoint: this.taskWrkForm.targetPoint, |
| | | }, |
| | | method: 'POST', |
| | | success: function(res) { |
| | | if (res.code == 200) { |
| | | that.taskWrkFormVisible = false |
| | | that.$message({ |
| | | message: "更新成功", |
| | | type: 'success' |
| | | }); |
| | | that.getTableData() |
| | | } else if (res.code === 403) { |
| | | top.location.href = baseUrl + "/"; |
| | | } else { |
| | | that.$message({ |
| | | message: res.msg, |
| | | type: 'error' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |