7个文件已添加
1 文件已重命名
14个文件已删除
15个文件已修改
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.common.DateUtils; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | 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.common.web.BaseController; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class TaskWrkController extends BaseController { |
| | | |
| | | @Autowired |
| | | private TaskWrkService taskWrkService; |
| | | |
| | | @RequestMapping(value = "/taskWrk/{id}/auth") |
| | | @ManagerAuth |
| | | public R get(@PathVariable("id") String id) { |
| | | return R.ok(taskWrkService.selectById(String.valueOf(id))); |
| | | } |
| | | |
| | | @RequestMapping(value = "/taskWrk/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 = "/taskWrk/add/auth") |
| | | @ManagerAuth |
| | | public R add(TaskWrk taskWrk) { |
| | | taskWrkService.insert(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/taskWrk/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 = "/taskWrk/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(@RequestParam(value="ids[]") Long[] ids){ |
| | | for (Long id : ids){ |
| | | taskWrkService.deleteById(id); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/taskWrk/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 = "/taskWrkQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | EntityWrapper<TaskWrk> wrapper = new EntityWrapper<>(); |
| | | wrapper.like("id", condition); |
| | | Page<TaskWrk> page = taskWrkService.selectPage(new Page<>(0, 10), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (TaskWrk taskWrk : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", taskWrk.getTaskNo()); |
| | | map.put("value", taskWrk.getTaskNo()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | @RequestMapping(value = "/taskWrk/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 = "/taskWrk/distribute/auth") |
| | | @ManagerAuth(memo = "手动派发任务") |
| | | public R distribute(@RequestParam String taskNo) { |
| | | taskWrkService.distribute(taskNo, getUserId()); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/taskWrk/complete/auth") |
| | | @ManagerAuth(memo = "手动完成任务") |
| | | public R complete(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (taskWrk == null) { |
| | | return R.error(); |
| | | } |
| | | if (taskWrk.getStatus() == TaskStatusType.COMPLETE.id) { |
| | | return R.error(taskWrk.getTaskNo() + "已完结"); |
| | | } |
| | | Date now = new Date(); |
| | | taskWrk.setStatus(TaskStatusType.COMPLETE.id); |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | taskWrk.setModiUser(getUserId());//操作员 |
| | | taskWrk.setCompleteTime(now);//完结时间 |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PostMapping(value = "/taskWrk/cancel/auth") |
| | | @ManagerAuth(memo = "手动取消任务") |
| | | public R cancel(@RequestParam String taskNo) { |
| | | TaskWrk taskWrk = taskWrkService.selectByTaskNo(taskNo); |
| | | if (taskWrk == null) { |
| | | return R.error(); |
| | | } |
| | | if (taskWrk.getStatus() == TaskStatusType.CANCEL.id) { |
| | | return R.error(taskWrk.getTaskNo() + "已被取消"); |
| | | } |
| | | Date now = new Date(); |
| | | taskWrk.setStatus(TaskStatusType.CANCEL.id); |
| | | taskWrk.setModiTime(now);//操作时间 |
| | | taskWrk.setModiUser(getUserId());//操作员 |
| | | taskWrk.setCompleteTime(now);//完结时间 |
| | | taskWrkService.updateById(taskWrk); |
| | | return R.ok(); |
| | | } |
| | | |
| | | } |
File was renamed from src/main/java/com/zy/asrs/domain/enums/WmsWrkStatusType.java |
| | |
| | | package com.zy.asrs.domain.enums; |
| | | |
| | | import com.zy.core.enums.CrnForkPosType; |
| | | |
| | | public enum WmsWrkStatusType { |
| | | public enum TaskStatusType { |
| | | |
| | | RECEIVE(1,"接收"), |
| | | DISTRIBUTE(2,"派发"), |
| | | WORKING(3,"执行"), |
| | | COMPLETE(4,"完结"), |
| | | CANCEL(5,"取消"), |
| | | COMPLETE(3,"完结"), |
| | | CANCEL(4,"取消"), |
| | | ; |
| | | |
| | | public Integer id; |
| | | public String desc; |
| | | |
| | | WmsWrkStatusType(Integer id,String desc){ |
| | | TaskStatusType(Integer id, String desc){ |
| | | this.id = id; |
| | | this.desc = desc; |
| | | } |
| | |
| | | if (null == id) { |
| | | return null; |
| | | } |
| | | for (WmsWrkStatusType type : WmsWrkStatusType.values()) { |
| | | for (TaskStatusType type : TaskStatusType.values()) { |
| | | if (type.id.equals(id)) { |
| | | return type.desc; |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.Duration; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | |
| | | private Integer id; |
| | | |
| | | /** |
| | | * 任务号wcs_command_info |
| | | * 工作号 |
| | | */ |
| | | @ApiModelProperty(value= "任务号") |
| | | @ApiModelProperty(value= "工作号") |
| | | @TableField("wrk_no") |
| | | private Integer wrkNo; |
| | | |
| | | /** |
| | | * WMS任务号 |
| | | */ |
| | | @ApiModelProperty(value= "WMS任务号") |
| | | @TableField("wms_wrk_no") |
| | | private Integer wmsWrkNo; |
| | | @ApiModelProperty(value= "任务号") |
| | | @TableField("task_no") |
| | | private String taskNo; |
| | | |
| | | /** |
| | | * 指令类型{1:创建,2:执行,3:完成} |
| | |
| | | |
| | | public CommandInfo() {} |
| | | |
| | | public CommandInfo(Integer wrkNo, Integer wmsWrkNo, Integer commandStatus, Date startTime, Date endTime, Integer commandType, String device, String deviceLog, String commandDesc) { |
| | | public CommandInfo(Integer id, Integer wrkNo, String taskNo, Integer commandStatus, Date startTime, Date endTime, Integer commandType, String device, String deviceLog, String commandDesc, String command) { |
| | | this.id = id; |
| | | this.wrkNo = wrkNo; |
| | | this.wmsWrkNo = wmsWrkNo; |
| | | this.taskNo = taskNo; |
| | | this.commandStatus = commandStatus; |
| | | this.startTime = startTime; |
| | | this.endTime = endTime; |
| | |
| | | this.device = device; |
| | | this.deviceLog = deviceLog; |
| | | this.commandDesc = commandDesc; |
| | | this.command = command; |
| | | } |
| | | |
| | | // CommandInfo commandInfo = new CommandInfo( |
| | | // null, // 任务号 |
| | | // null, // 起点位置 |
| | | // null, // 终点位置 |
| | | // null, // 指令状态 |
| | | // null, // 开始时间 |
| | | // null, // 结束时间 |
| | | // null, // 指令类型 |
| | | // null, // 设备 |
| | | // null, // 设备执行信息 |
| | | // null // 命令描述 |
| | | // ); |
| | | |
| | | public String getStartTime$(){ |
| | | if (Cools.isEmpty(this.startTime)){ |
New file |
| | |
| | | package com.zy.asrs.entity; |
| | | |
| | | import com.core.common.Cools;import com.baomidou.mybatisplus.annotations.TableId; |
| | | import com.baomidou.mybatisplus.enums.IdType; |
| | | import com.baomidou.mybatisplus.annotations.TableField; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.service.BasWrkIotypeService; |
| | | import com.zy.asrs.entity.BasWrkIotype; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.system.service.UserService; |
| | | import com.zy.system.entity.User; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | import com.core.common.SpringUtils; |
| | | import com.zy.asrs.service.BasWrkStatusService; |
| | | import com.zy.asrs.entity.BasWrkStatus; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.baomidou.mybatisplus.annotations.TableName; |
| | | import java.io.Serializable; |
| | | |
| | | @Data |
| | | @TableName("wcs_task_wrk") |
| | | public class TaskWrk 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: 派发 3: 完结 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("io_type") |
| | | private Integer ioType; |
| | | |
| | | /** |
| | | * 优先级 |
| | | */ |
| | | @ApiModelProperty(value= "优先级") |
| | | @TableField("io_pri") |
| | | private Double ioPri; |
| | | |
| | | /** |
| | | * 起点 |
| | | */ |
| | | @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; |
| | | |
| | | public TaskWrk() {} |
| | | |
| | | public TaskWrk(String taskNo,Integer status,Integer wrkNo,Date createTime,Integer ioType,Double ioPri,String startPoint,String targetPoint,Long modiUser,Date modiTime,String memo,String barcode,Date assignTime,Date executeTime,Date completeTime,Date cancelTime,Integer wrkSts) { |
| | | this.taskNo = taskNo; |
| | | this.status = status; |
| | | this.wrkNo = wrkNo; |
| | | this.createTime = createTime; |
| | | this.ioType = ioType; |
| | | this.ioPri = ioPri; |
| | | this.startPoint = startPoint; |
| | | this.targetPoint = targetPoint; |
| | | this.modiUser = modiUser; |
| | | this.modiTime = modiTime; |
| | | this.memo = memo; |
| | | this.barcode = barcode; |
| | | this.assignTime = assignTime; |
| | | this.executeTime = executeTime; |
| | | this.completeTime = completeTime; |
| | | this.cancelTime = cancelTime; |
| | | this.wrkSts = wrkSts; |
| | | } |
| | | |
| | | // TaskWrk taskWrk = new TaskWrk( |
| | | // null, // wms任务号[非空] |
| | | // null, // 任务状态 |
| | | // null, // 任务号 |
| | | // null, // 任务时间(接收时间) |
| | | // null, // 任务类型 |
| | | // null, // 优先级 |
| | | // null, // 起点 |
| | | // null, // 终点 |
| | | // null, // 修改人员 |
| | | // null, // 修改时间 |
| | | // null, // 备注 |
| | | // null, // 条码 |
| | | // null, // 派发时间 |
| | | // null, // 执行时间 |
| | | // null, // 完结时间 |
| | | // null, // 取消时间 |
| | | // null // 工作状态 |
| | | // ); |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "接收"; |
| | | case 2: |
| | | return "派发"; |
| | | case 3: |
| | | return "完结"; |
| | | case 4: |
| | | return "取消"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getIoType$(){ |
| | | BasWrkIotypeService service = SpringUtils.getBean(BasWrkIotypeService.class); |
| | | BasWrkIotype basWrkIotype = service.selectById(this.ioType); |
| | | if (!Cools.isEmpty(basWrkIotype)){ |
| | | return String.valueOf(basWrkIotype.getIoDesc()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getModiUser$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.selectById(this.modiUser); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getUsername()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getModiTime$(){ |
| | | if (Cools.isEmpty(this.modiTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.modiTime); |
| | | } |
| | | |
| | | public String getAssignTime$(){ |
| | | if (Cools.isEmpty(this.assignTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.assignTime); |
| | | } |
| | | |
| | | public String getExecuteTime$(){ |
| | | if (Cools.isEmpty(this.executeTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.executeTime); |
| | | } |
| | | |
| | | public String getCompleteTime$(){ |
| | | if (Cools.isEmpty(this.completeTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.completeTime); |
| | | } |
| | | |
| | | public String getCancelTime$(){ |
| | | if (Cools.isEmpty(this.cancelTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.cancelTime); |
| | | } |
| | | |
| | | public String getWrkSts$(){ |
| | | BasWrkStatusService service = SpringUtils.getBean(BasWrkStatusService.class); |
| | | BasWrkStatus basWrkStatus = service.selectById(this.wrkSts); |
| | | if (!Cools.isEmpty(basWrkStatus)){ |
| | | return String.valueOf(basWrkStatus.getWrkDesc()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 获取持续时间 |
| | | */ |
| | | public String getDurationTime() { |
| | | if (Cools.isEmpty(this.createTime)) { |
| | | return ""; |
| | | } |
| | | |
| | | Date endDate = new Date(); |
| | | if (!Cools.isEmpty(this.assignTime)) { |
| | | endDate = this.assignTime; |
| | | } |
| | | |
| | | //用来获取两个时间相差的毫秒数 |
| | | long l = this.createTime.getTime() - endDate.getTime(); |
| | | |
| | | //分别计算相差的天、小时、分、秒 |
| | | long day = l / (24 * 60 * 60 * 1000); |
| | | long hour = (l / (60 * 60 * 1000) - day * 24); |
| | | long min = ((l / (60 * 1000)) - day * 24 * 60 - hour * 60); |
| | | long s = (l / 1000 - day * 24 * 60 * 60 - hour * 60 * 60 - min * 60); |
| | | |
| | | return Math.abs(day) + "天" + Math.abs(hour) + "小时" + Math.abs(min) + "分" + Math.abs(s) + "秒"; |
| | | } |
| | | |
| | | } |
| | |
| | | private String fullPlt; |
| | | |
| | | /** |
| | | * 满板 |
| | | * wms任务号 |
| | | */ |
| | | @ApiModelProperty(value= "wms任务号") |
| | | @TableField("wms_wrk_no") |
| | | private Integer wmsWrkNo; |
| | | @TableField("task_no") |
| | | private String taskNo; |
| | | |
| | | /** |
| | | * 结束时间 |
| | |
| | | @Repository |
| | | public interface CommandInfoMapper extends BaseMapper<CommandInfo> { |
| | | |
| | | List<CommandInfo> selectByWmsWrkNoAndWrkNo(Integer wmsWrkNo, Integer wrkNo); |
| | | List<CommandInfo> selectByTaskNoAndWrkNo(String taskNo, Integer wrkNo); |
| | | } |
New file |
| | |
| | | package com.zy.asrs.mapper; |
| | | |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.baomidou.mybatisplus.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface TaskWrkMapper extends BaseMapper<TaskWrk> { |
| | | |
| | | TaskWrk selectByTaskNo(String taskNo); |
| | | |
| | | TaskWrk selectByWrkNo(Integer wrkNo); |
| | | |
| | | } |
| | |
| | | |
| | | public interface CommandInfoService extends IService<CommandInfo> { |
| | | |
| | | List<CommandInfo> selectByWmsWrkNoAndWrkNo(Integer wmsWrkNo, Integer wrkNo); |
| | | List<CommandInfo> selectByTaskNoAndWrkNo(String taskNo, Integer wrkNo); |
| | | |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service; |
| | | |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.baomidou.mybatisplus.service.IService; |
| | | |
| | | public interface TaskWrkService extends IService<TaskWrk> { |
| | | |
| | | TaskWrk selectByTaskNo(String taskNo); |
| | | |
| | | TaskWrk selectByWrkNo(Integer wrkNo); |
| | | |
| | | //派发任务 |
| | | void distribute(String taskNo, Long userId); |
| | | |
| | | //入库 |
| | | void startup(TaskWrk taskWrk, Long userId); |
| | | |
| | | //出库 |
| | | void stockOut(TaskWrk taskWrk, Long userId); |
| | | |
| | | //库位移转 |
| | | void locMove(TaskWrk taskWrk, Long userId); |
| | | |
| | | } |
| | |
| | | public class CommandInfoServiceImpl extends ServiceImpl<CommandInfoMapper, CommandInfo> implements CommandInfoService { |
| | | |
| | | @Override |
| | | public List<CommandInfo> selectByWmsWrkNoAndWrkNo(Integer wmsWrkNo, Integer wrkNo) { |
| | | return this.baseMapper.selectByWmsWrkNoAndWrkNo(wmsWrkNo, wrkNo); |
| | | public List<CommandInfo> selectByTaskNoAndWrkNo(String taskNo, Integer wrkNo) { |
| | | return this.baseMapper.selectByTaskNoAndWrkNo(taskNo, wrkNo); |
| | | } |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.common.SpringUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.WmsWrkStatusType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.mapper.BasCrnErrorMapper; |
| | | import com.zy.asrs.mapper.WaitPakinMapper; |
| | |
| | | private BasErrLogService basErrLogService; |
| | | @Autowired |
| | | private BasCrnErrorMapper basCrnErrorMapper; |
| | | @Autowired |
| | | private WmsWrkService wmsWrkService; |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | |
| | | |
| | | // 命令下发区 -------------------------------------------------------------------------- |
| | | |
| | | // 更新站点信息 且 下发plc命令 |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (result) { |
| | | // 更新工作主档 |
| | | wrkMast.setWrkSts(2L); // 工作状态:2.设备上走 |
| | | wrkMast.setModiTime(new Date()); |
| | | if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | log.error("更新工作档失败!!! [工作号:{}]", wrkMast.getWrkNo()); |
| | | } |
| | | |
| | | //更新WMS任务状态 |
| | | WmsWrk wmsWrk = wmsWrkService.selectByWmsWrkNo(wrkMast.getWmsWrkNo()); |
| | | wmsWrk.setWmsStatus(WmsWrkStatusType.WORKING.id);//执行中 |
| | | wmsWrk.setModiTime(new Date()); |
| | | wmsWrkService.updateById(wmsWrk); |
| | | |
| | | } else { |
| | | log.error("发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId()); |
| | | } |
| | | // // 更新站点信息 且 下发plc命令 |
| | | // staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); |
| | | // staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // if (result) { |
| | | // // 更新工作主档 |
| | | // wrkMast.setWrkSts(2L); // 工作状态:2.设备上走 |
| | | // wrkMast.setModiTime(new Date()); |
| | | // if (wrkMastMapper.updateById(wrkMast) == 0) { |
| | | // log.error("更新工作档失败!!! [工作号:{}]", wrkMast.getWrkNo()); |
| | | // } |
| | | // |
| | | // //更新WMS任务状态 |
| | | // WmsWrk wmsWrk = wmsWrkService.selectByWmsWrkNo(wrkMast.getWmsWrkNo()); |
| | | // wmsWrk.setWmsStatus(WmsStatusType.WORKING.id);//执行中 |
| | | // wmsWrk.setModiTime(new Date()); |
| | | // wmsWrkService.updateById(wmsWrk); |
| | | // |
| | | // } else { |
| | | // log.error("发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId()); |
| | | // } |
| | | |
| | | } |
| | | |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.core.common.Cools; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.WmsWrkStatusType; |
| | | import com.zy.asrs.entity.WmsWrk; |
| | | import com.zy.asrs.entity.param.WmsWrkCreateParam; |
| | | import com.zy.asrs.service.OpenService; |
| | | import com.zy.asrs.service.WmsWrkService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Service |
| | | public class OpenServiceImpl implements OpenService { |
| | | |
| | | @Autowired |
| | | private WmsWrkService wmsWrkService; |
| | | |
| | | @Override |
| | | public void wmsWrkCreate(WmsWrkCreateParam param) { |
| | | WmsWrk wmsWrk = wmsWrkService.selectByWmsWrkNo(param.getWmsWrkNo()); |
| | | if (wmsWrk != null) { |
| | | throw new CoolException(param.getWmsWrkNo() + "任务已存在,请勿重复提交"); |
| | | } |
| | | |
| | | Date now = new Date(); |
| | | wmsWrk = new WmsWrk(); |
| | | wmsWrk.setWmsWrkNo(param.getWmsWrkNo());//WMS任务号 |
| | | wmsWrk.setWmsStatus(WmsWrkStatusType.RECEIVE.id);//WMS状态:接收 |
| | | wmsWrk.setCreateTime(now); |
| | | wmsWrk.setAppeTime(now); |
| | | wmsWrk.setAppeUser(9527L); |
| | | wmsWrk.setIoType(param.getIoType());//任务类型 |
| | | wmsWrk.setIoPri(13D);//优先级 |
| | | wmsWrk.setBarcode(param.getBarcode());//条码 |
| | | if (!Cools.isEmpty(param.getLocNo())) { |
| | | wmsWrk.setLocNo(param.getLocNo());//目标库位 |
| | | } |
| | | if (!Cools.isEmpty(param.getSourceLocNo())) { |
| | | wmsWrk.setSourceLocNo(param.getSourceLocNo());//源库位 |
| | | } |
| | | if (!Cools.isEmpty(param.getStaNo())) { |
| | | wmsWrk.setStaNo(param.getStaNo());//目标站 |
| | | } |
| | | if (!Cools.isEmpty(param.getSourceStaNo())) { |
| | | wmsWrk.setSourceStaNo(param.getSourceStaNo());//源站 |
| | | } |
| | | if (!Cools.isEmpty(param.getMemo())) { |
| | | wmsWrk.setMemo(param.getMemo());//备注 |
| | | } |
| | | |
| | | if (!wmsWrkService.insert(wmsWrk)) { |
| | | throw new CoolException("生成任务失败,请联系管理员"); |
| | | } |
| | | // WmsWrk wmsWrk = wmsWrkService.selectByWmsWrkNo(param.getWmsWrkNo()); |
| | | // if (wmsWrk != null) { |
| | | // throw new CoolException(param.getWmsWrkNo() + "任务已存在,请勿重复提交"); |
| | | // } |
| | | // |
| | | // Date now = new Date(); |
| | | // wmsWrk = new WmsWrk(); |
| | | // wmsWrk.setWmsWrkNo(param.getWmsWrkNo());//WMS任务号 |
| | | // wmsWrk.setWmsStatus(WmsWrkStatusType.RECEIVE.id);//WMS状态:接收 |
| | | // wmsWrk.setCreateTime(now); |
| | | // wmsWrk.setAppeTime(now); |
| | | // wmsWrk.setAppeUser(9527L); |
| | | // wmsWrk.setIoType(param.getIoType());//任务类型 |
| | | // wmsWrk.setIoPri(13D);//优先级 |
| | | // wmsWrk.setBarcode(param.getBarcode());//条码 |
| | | // if (!Cools.isEmpty(param.getLocNo())) { |
| | | // wmsWrk.setLocNo(param.getLocNo());//目标库位 |
| | | // } |
| | | // if (!Cools.isEmpty(param.getSourceLocNo())) { |
| | | // wmsWrk.setSourceLocNo(param.getSourceLocNo());//源库位 |
| | | // } |
| | | // if (!Cools.isEmpty(param.getStaNo())) { |
| | | // wmsWrk.setStaNo(param.getStaNo());//目标站 |
| | | // } |
| | | // if (!Cools.isEmpty(param.getSourceStaNo())) { |
| | | // wmsWrk.setSourceStaNo(param.getSourceStaNo());//源站 |
| | | // } |
| | | // if (!Cools.isEmpty(param.getMemo())) { |
| | | // wmsWrk.setMemo(param.getMemo());//备注 |
| | | // } |
| | | // |
| | | // if (!wmsWrkService.insert(wmsWrk)) { |
| | | // throw new CoolException("生成任务失败,请联系管理员"); |
| | | // } |
| | | } |
| | | } |
New file |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.TaskStatusType; |
| | | import com.zy.asrs.domain.enums.WorkNoType; |
| | | import com.zy.asrs.mapper.TaskWrkMapper; |
| | | import com.zy.asrs.entity.TaskWrk; |
| | | import com.zy.asrs.service.TaskWrkService; |
| | | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| | | import com.zy.common.service.CommonService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | |
| | | @Service("taskWrkService") |
| | | public class TaskWrkServiceImpl extends ServiceImpl<TaskWrkMapper, TaskWrk> implements TaskWrkService { |
| | | |
| | | @Autowired |
| | | private CommonService commonService; |
| | | |
| | | @Override |
| | | public TaskWrk selectByTaskNo(String taskNo) { |
| | | return this.baseMapper.selectByTaskNo(taskNo); |
| | | } |
| | | |
| | | @Override |
| | | public TaskWrk selectByWrkNo(Integer wrkNo) { |
| | | return this.baseMapper.selectByWrkNo(wrkNo); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void distribute(String taskNo, Long userId) { |
| | | TaskWrk taskWrk = this.selectByTaskNo(taskNo); |
| | | if (taskWrk == null) { |
| | | throw new CoolException("WMS任务不存在"); |
| | | } |
| | | |
| | | //创建任务 |
| | | if (taskWrk.getIoType() == 1) { |
| | | //1.入库 |
| | | startup(taskWrk, userId); |
| | | }else if(taskWrk.getIoType() == 2){ |
| | | //2.出库 |
| | | stockOut(taskWrk, userId); |
| | | } else if (taskWrk.getIoType() == 3) { |
| | | //3.库格移载 |
| | | locMove(taskWrk, userId); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void startup(TaskWrk taskWrk, Long userId) { |
| | | //入库任务派发 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PAKIN.type);//获取入库工作号 |
| | | taskWrk.setWrkNo(workNo);//工作号 |
| | | taskWrk.setStatus(TaskStatusType.DISTRIBUTE.id);//派发状态 |
| | | taskWrk.setAssignTime(new Date());//派发时间 |
| | | taskWrk.setWrkSts(2);//工作状态 2.设备上走 |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrk.setModiUser(userId); |
| | | updateById(taskWrk); |
| | | } |
| | | |
| | | @Override |
| | | public void stockOut(TaskWrk taskWrk, Long userId) { |
| | | //出库任务派发 |
| | | int workNo = commonService.getWorkNo(WorkNoType.PAKOUT.type);//获取出库工作号 |
| | | taskWrk.setWrkNo(workNo);//工作号 |
| | | taskWrk.setStatus(TaskStatusType.DISTRIBUTE.id);//派发状态 |
| | | taskWrk.setAssignTime(new Date());//派发时间 |
| | | taskWrk.setWrkSts(11);//工作状态 11.生成出库ID |
| | | taskWrk.setModiTime(new Date()); |
| | | taskWrk.setModiUser(userId); |
| | | updateById(taskWrk); |
| | | } |
| | | |
| | | @Override |
| | | public void locMove(TaskWrk taskWrk, Long userId) { |
| | | //库格移载任务派发 |
| | | 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.setModiTime(new Date()); |
| | | taskWrk.setModiUser(userId); |
| | | updateById(taskWrk); |
| | | } |
| | | } |
| | |
| | | package com.zy.asrs.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.common.Cools; |
| | | import com.core.common.DateUtils; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.domain.enums.WmsWrkStatusType; |
| | | import com.zy.asrs.entity.*; |
| | | import com.zy.asrs.service.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.concurrent.TimeUnit; |
| | | |
| | | @Service |
| | | public class WorkServiceImpl implements WorkService { |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | @Autowired |
| | | private WmsWrkService wmsWrkService; |
| | | @Autowired |
| | | private LocMastService locMastService; |
| | | @Autowired |
| | |
| | | @Override |
| | | @Transactional |
| | | public void completeWrkMast(String workNo, Long userId) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | WmsWrk wmsWrk = wmsWrkService.selectByWmsWrkNo(wrkMast.getWmsWrkNo()); |
| | | if (Cools.isEmpty(wrkMast, wmsWrk)) { |
| | | throw new CoolException(workNo + "任务不存在"); |
| | | } |
| | | if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 14) { |
| | | throw new CoolException("当前任务已完成"); |
| | | } |
| | | // 入库 + 库位转移 |
| | | if (wrkMast.getWrkSts() < 4 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType()==11)) { |
| | | wrkMast.setWrkSts(4L); |
| | | // 出库 |
| | | } else if (wrkMast.getWrkSts() > 10) { |
| | | wrkMast.setWrkSts(14L); |
| | | } |
| | | Date now = new Date(); |
| | | wrkMast.setCrnStrTime(DateUtils.calculate(now, 1L, TimeUnit.SECONDS, true)); |
| | | wrkMast.setCrnEndTime(now); |
| | | wrkMast.setModiTime(now); |
| | | wrkMast.setModiUser(userId); |
| | | // 完成操作人员记录 |
| | | wrkMast.setManuType("手动完成"); |
| | | |
| | | wmsWrk.setWmsStatus(WmsWrkStatusType.COMPLETE.id); |
| | | wmsWrk.setModiUser(userId); |
| | | wmsWrk.setModiTime(now); |
| | | wmsWrk.setEndTime(now); |
| | | if (!wrkMastService.updateById(wrkMast) || !wmsWrkService.updateById(wmsWrk)) { |
| | | throw new CoolException("修改任务失败"); |
| | | } |
| | | // WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | // WmsWrk wmsWrk = wmsWrkService.selectByTaskNo(wrkMast.getWmsWrkNo()); |
| | | // if (Cools.isEmpty(wrkMast, wmsWrk)) { |
| | | // throw new CoolException(workNo + "任务不存在"); |
| | | // } |
| | | // if (wrkMast.getWrkSts() == 4 || wrkMast.getWrkSts() == 14) { |
| | | // throw new CoolException("当前任务已完成"); |
| | | // } |
| | | // // 入库 + 库位转移 |
| | | // if (wrkMast.getWrkSts() < 4 || (wrkMast.getWrkSts() > 10 && wrkMast.getIoType()==11)) { |
| | | // wrkMast.setWrkSts(4L); |
| | | // // 出库 |
| | | // } else if (wrkMast.getWrkSts() > 10) { |
| | | // wrkMast.setWrkSts(14L); |
| | | // } |
| | | // Date now = new Date(); |
| | | // wrkMast.setCrnStrTime(DateUtils.calculate(now, 1L, TimeUnit.SECONDS, true)); |
| | | // wrkMast.setCrnEndTime(now); |
| | | // wrkMast.setModiTime(now); |
| | | // wrkMast.setModiUser(userId); |
| | | // // 完成操作人员记录 |
| | | // wrkMast.setManuType("手动完成"); |
| | | // |
| | | // wmsWrk.setStatus(WmsStatusType.COMPLETE.id); |
| | | // wmsWrk.setModiUser(userId); |
| | | // wmsWrk.setModiTime(now); |
| | | // wmsWrk.setCompleteTime(now); |
| | | // if (!wrkMastService.updateById(wrkMast) || !wmsWrkService.updateById(wmsWrk)) { |
| | | // throw new CoolException("修改任务失败"); |
| | | // } |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public void cancelWrkMast(String workNo, Long userId) { |
| | | Date now = new Date(); |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | WmsWrk wmsWrk = wmsWrkService.selectByWmsWrkNo(wrkMast.getWmsWrkNo()); |
| | | if (Cools.isEmpty(wrkMast, wmsWrk)) { |
| | | throw new CoolException(workNo + "任务不存在"); |
| | | } |
| | | |
| | | String locNo = ""; // 待修改目标库位 |
| | | String locSts = ""; // 待修改目标库位状态 |
| | | // 入库取消(修改目标库位) |
| | | if (wrkMast.getWrkSts() < 4) { |
| | | locNo = wrkMast.getLocNo(); |
| | | locSts = "O"; |
| | | |
| | | // 库位转移 |
| | | if (wrkMast.getIoType() == 11) { |
| | | // 库位转移:源库位 |
| | | LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("取消库位转移失败,源库位不存在:"+ wrkMast.getSourceLocNo()); |
| | | } |
| | | locMast.setLocSts(wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F"); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | // 出库取消(修改源库位) |
| | | } else if (wrkMast.getWrkSts() > 10 && wrkMast.getWrkSts() != 14) { |
| | | locNo = wrkMast.getSourceLocNo(); |
| | | // 出库 ===>> F.在库 |
| | | if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) { |
| | | locSts = "F"; |
| | | // 空板出库 ===>> D.空桶/空栈板 |
| | | } else if (wrkMast.getIoType() == 110) { |
| | | locSts = "D"; |
| | | // 库位转移 ===>> D.空桶/空栈板 |
| | | } else if (wrkMast.getIoType() == 11) { |
| | | locSts = wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F"; |
| | | // 库位转移:目标库位 |
| | | LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("取消库位转移失败,目标库位不存在:"+ wrkMast.getSourceLocNo()); |
| | | } |
| | | locMast.setLocSts("O"); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | locMastService.updateById(locMast); |
| | | } |
| | | } else { |
| | | throw new CoolException("当前工作状态无法取消"); |
| | | } |
| | | |
| | | //取消入库工作档时,查询组托表,如果有将状态改为待处理 |
| | | if(wrkMast.getIoType() == 1) { |
| | | List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode())); |
| | | for (WaitPakin waitPakin:waitPakins){ |
| | | if (!Cools.isEmpty(waitPakin)) { |
| | | waitPakin.setIoStatus("N"); |
| | | waitPakin.setLocNo(""); |
| | | waitPakinService.update(waitPakin, new EntityWrapper<WaitPakin>() |
| | | .eq("order_no", waitPakin.getOrderNo()) |
| | | .eq("matnr", waitPakin.getMatnr()) |
| | | .eq("batch", waitPakin.getBatch())); |
| | | } |
| | | } |
| | | } |
| | | |
| | | // 取消操作人员记录 |
| | | wrkMast.setManuType("手动取消"); |
| | | wrkMast.setModiUser(userId); |
| | | wrkMast.setModiTime(now); |
| | | if (!wrkMastService.updateById(wrkMast)) { |
| | | throw new CoolException("取消任务失败"); |
| | | } |
| | | |
| | | wmsWrk.setWmsStatus(WmsWrkStatusType.CANCEL.id); |
| | | wmsWrk.setModiUser(userId); |
| | | wmsWrk.setModiTime(now); |
| | | wmsWrk.setEndTime(now); |
| | | if (!wmsWrkService.updateById(wmsWrk)) { |
| | | throw new CoolException("取消任务失败"); |
| | | } |
| | | |
| | | // 保存工作主档历史档 |
| | | if (!wrkMastLogService.save(wrkMast.getWrkNo())) { |
| | | throw new CoolException("保存任务历史档失败, workNo = " + wrkMast.getWrkNo()); |
| | | } |
| | | // 删除工作主档 |
| | | boolean wrkMastRes = wrkMastService.deleteById(wrkMast); |
| | | |
| | | // 修改库位状态 |
| | | LocMast locMast = locMastService.selectById(locNo); |
| | | if (Cools.isEmpty(locMast)) { |
| | | throw new CoolException("取消任务失败,库位不存在:"+ locNo); |
| | | } |
| | | locMast.setLocSts(locSts); |
| | | locMast.setModiTime(now); |
| | | locMast.setModiUser(userId); |
| | | boolean locMastRes = locMastService.updateById(locMast); |
| | | if (!wrkMastRes || !locMastRes) { |
| | | throw new CoolException("保存数据失败"); |
| | | } |
| | | // Date now = new Date(); |
| | | // WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | // WmsWrk wmsWrk = wmsWrkService.selectByWmsWrkNo(wrkMast.getWmsWrkNo()); |
| | | // if (Cools.isEmpty(wrkMast, wmsWrk)) { |
| | | // throw new CoolException(workNo + "任务不存在"); |
| | | // } |
| | | // |
| | | // String locNo = ""; // 待修改目标库位 |
| | | // String locSts = ""; // 待修改目标库位状态 |
| | | // // 入库取消(修改目标库位) |
| | | // if (wrkMast.getWrkSts() < 4) { |
| | | // locNo = wrkMast.getLocNo(); |
| | | // locSts = "O"; |
| | | // |
| | | // // 库位转移 |
| | | // if (wrkMast.getIoType() == 11) { |
| | | // // 库位转移:源库位 |
| | | // LocMast locMast = locMastService.selectById(wrkMast.getSourceLocNo()); |
| | | // if (Cools.isEmpty(locMast)) { |
| | | // throw new CoolException("取消库位转移失败,源库位不存在:"+ wrkMast.getSourceLocNo()); |
| | | // } |
| | | // locMast.setLocSts(wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F"); |
| | | // locMast.setModiTime(now); |
| | | // locMast.setModiUser(userId); |
| | | // locMastService.updateById(locMast); |
| | | // } |
| | | // // 出库取消(修改源库位) |
| | | // } else if (wrkMast.getWrkSts() > 10 && wrkMast.getWrkSts() != 14) { |
| | | // locNo = wrkMast.getSourceLocNo(); |
| | | // // 出库 ===>> F.在库 |
| | | // if (wrkMast.getIoType() > 100 && wrkMast.getIoType() != 110) { |
| | | // locSts = "F"; |
| | | // // 空板出库 ===>> D.空桶/空栈板 |
| | | // } else if (wrkMast.getIoType() == 110) { |
| | | // locSts = "D"; |
| | | // // 库位转移 ===>> D.空桶/空栈板 |
| | | // } else if (wrkMast.getIoType() == 11) { |
| | | // locSts = wrkMast.getFullPlt().equalsIgnoreCase("N")?"D":"F"; |
| | | // // 库位转移:目标库位 |
| | | // LocMast locMast = locMastService.selectById(wrkMast.getLocNo()); |
| | | // if (Cools.isEmpty(locMast)) { |
| | | // throw new CoolException("取消库位转移失败,目标库位不存在:"+ wrkMast.getSourceLocNo()); |
| | | // } |
| | | // locMast.setLocSts("O"); |
| | | // locMast.setModiTime(now); |
| | | // locMast.setModiUser(userId); |
| | | // locMastService.updateById(locMast); |
| | | // } |
| | | // } else { |
| | | // throw new CoolException("当前工作状态无法取消"); |
| | | // } |
| | | // |
| | | // //取消入库工作档时,查询组托表,如果有将状态改为待处理 |
| | | // if(wrkMast.getIoType() == 1) { |
| | | // List<WaitPakin> waitPakins = waitPakinService.selectList(new EntityWrapper<WaitPakin>().eq("zpallet", wrkMast.getBarcode())); |
| | | // for (WaitPakin waitPakin:waitPakins){ |
| | | // if (!Cools.isEmpty(waitPakin)) { |
| | | // waitPakin.setIoStatus("N"); |
| | | // waitPakin.setLocNo(""); |
| | | // waitPakinService.update(waitPakin, new EntityWrapper<WaitPakin>() |
| | | // .eq("order_no", waitPakin.getOrderNo()) |
| | | // .eq("matnr", waitPakin.getMatnr()) |
| | | // .eq("batch", waitPakin.getBatch())); |
| | | // } |
| | | // } |
| | | // } |
| | | // |
| | | // // 取消操作人员记录 |
| | | // wrkMast.setManuType("手动取消"); |
| | | // wrkMast.setModiUser(userId); |
| | | // wrkMast.setModiTime(now); |
| | | // if (!wrkMastService.updateById(wrkMast)) { |
| | | // throw new CoolException("取消任务失败"); |
| | | // } |
| | | // |
| | | // wmsWrk.setStatus(WmsStatusType.CANCEL.id); |
| | | // wmsWrk.setModiUser(userId); |
| | | // wmsWrk.setModiTime(now); |
| | | // wmsWrk.setCancelTime(now); |
| | | // if (!wmsWrkService.updateById(wmsWrk)) { |
| | | // throw new CoolException("取消任务失败"); |
| | | // } |
| | | // |
| | | // // 保存工作主档历史档 |
| | | // if (!wrkMastLogService.save(wrkMast.getWrkNo())) { |
| | | // throw new CoolException("保存任务历史档失败, workNo = " + wrkMast.getWrkNo()); |
| | | // } |
| | | // // 删除工作主档 |
| | | // boolean wrkMastRes = wrkMastService.deleteById(wrkMast); |
| | | // |
| | | // // 修改库位状态 |
| | | // LocMast locMast = locMastService.selectById(locNo); |
| | | // if (Cools.isEmpty(locMast)) { |
| | | // throw new CoolException("取消任务失败,库位不存在:"+ locNo); |
| | | // } |
| | | // locMast.setLocSts(locSts); |
| | | // locMast.setModiTime(now); |
| | | // locMast.setModiUser(userId); |
| | | // boolean locMastRes = locMastService.updateById(locMast); |
| | | // if (!wrkMastRes || !locMastRes) { |
| | | // throw new CoolException("保存数据失败"); |
| | | // } |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.zy.asrs.entity.WmsWrk; |
| | | import com.zy.asrs.service.WmsWrkLogService; |
| | | import com.zy.asrs.service.WmsWrkService; |
| | | import com.zy.common.utils.HttpHandler; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Component |
| | | public class WmsWrkLogScheduler { |
| | | |
| | | @Autowired |
| | | private WmsWrkService wmsWrkService; |
| | | @Autowired |
| | | private WmsWrkLogService wmsWrkLogService; |
| | | |
| | | @Value("${wms.url}") |
| | | private String wmsUrl; |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public void execute() { |
| | | for (WmsWrk wmsWrk : wmsWrkService.selectToBeHistoryData()) { |
| | | boolean save = wmsWrkLogService.save(wmsWrk.getWmsWrkNo()); |
| | | boolean delete = wmsWrkService.deleteById(wmsWrk.getWmsWrkNo()); |
| | | if (!save || !delete) { |
| | | log.error("任务[wmsWrkNo={}]历史处理失败", wmsWrk.getWmsWrkNo()); |
| | | } |
| | | |
| | | try { |
| | | //任务上报 |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/wmsWrk/test") |
| | | .setJson(JSON.toJSONString(wmsWrk)) |
| | | .build() |
| | | .doPost(); |
| | | JSONObject jsonObject = JSON.parseObject(response); |
| | | if (jsonObject.getInteger("code").equals(200)) { |
| | | //todo |
| | | // StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | |
| | | } else { |
| | | log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/wmsWrk/test", JSON.toJSONString(wmsWrk), response); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | // for (WmsWrk wmsWrk : wmsWrkService.selectToBeHistoryData()) { |
| | | // boolean save = wmsWrkLogService.save(wmsWrk.getWmsWrkNo()); |
| | | // boolean delete = wmsWrkService.deleteById(wmsWrk.getWmsWrkNo()); |
| | | // if (!save || !delete) { |
| | | // log.error("任务[wmsWrkNo={}]历史处理失败", wmsWrk.getWmsWrkNo()); |
| | | // } |
| | | // |
| | | // try { |
| | | // //任务上报 |
| | | // String response = new HttpHandler.Builder() |
| | | // .setUri(wmsUrl) |
| | | // .setPath("/wmsWrk/test") |
| | | // .setJson(JSON.toJSONString(wmsWrk)) |
| | | // .build() |
| | | // .doPost(); |
| | | // JSONObject jsonObject = JSON.parseObject(response); |
| | | // if (jsonObject.getInteger("code").equals(200)) { |
| | | // //todo |
| | | //// StartupDto dto = jsonObject.getObject("data", StartupDto.class); |
| | | // |
| | | // } else { |
| | | // log.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/wmsWrk/test", JSON.toJSONString(wmsWrk), response); |
| | | // } |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | CommandInfo commandInfo = null; |
| | | WrkMast wrkMast = null; |
| | | int taskNo = 0; |
| | | int wmsWrkNo = 0; |
| | | int wrkNo = 0; |
| | | String taskNo = null; |
| | | switch (type) { |
| | | case Crn: |
| | | CrnCommand command = (CrnCommand) task.getData(); |
| | | taskNo = command.getTaskNo(); |
| | | if (taskNo != 0) { |
| | | wrkMast = wrkMastService.selectById(taskNo); |
| | | wmsWrkNo = wrkMast.getWmsWrkNo(); |
| | | wrkNo = command.getTaskNo(); |
| | | if (wrkNo != 0) { |
| | | wrkMast = wrkMastService.selectById(wrkNo); |
| | | taskNo = wrkMast.getTaskNo(); |
| | | } |
| | | |
| | | commandInfo = new CommandInfo(); |
| | | commandInfo.setWrkNo(taskNo); |
| | | commandInfo.setWmsWrkNo(wmsWrkNo); |
| | | commandInfo.setWrkNo(wrkNo); |
| | | commandInfo.setTaskNo(taskNo); |
| | | commandInfo.setCommandStatus(1); |
| | | commandInfo.setStartTime(new Date()); |
| | | commandInfo.setDevice("crn"); |
| | |
| | | break; |
| | | case Devp: |
| | | StaProtocol staProtocol = (StaProtocol) task.getData(); |
| | | taskNo = staProtocol.getWorkNo(); |
| | | if (taskNo != 0) { |
| | | wrkMast = wrkMastService.selectById(taskNo); |
| | | wmsWrkNo = wrkMast.getWmsWrkNo(); |
| | | wrkNo = staProtocol.getWorkNo(); |
| | | if (wrkNo != 0) { |
| | | wrkMast = wrkMastService.selectById(wrkNo); |
| | | taskNo = wrkMast.getTaskNo(); |
| | | } |
| | | |
| | | commandInfo = new CommandInfo(); |
| | | commandInfo.setWrkNo(taskNo); |
| | | commandInfo.setWmsWrkNo(wmsWrkNo); |
| | | commandInfo.setWrkNo(wrkNo); |
| | | commandInfo.setTaskNo(taskNo); |
| | | commandInfo.setCommandStatus(1); |
| | | commandInfo.setStartTime(new Date()); |
| | | commandInfo.setDevice("devp"); |
| | |
| | | case Led: |
| | | List<LedCommand> data = (List<LedCommand>) task.getData(); |
| | | for (LedCommand ledCommand : data) { |
| | | taskNo = ledCommand.getWorkNo(); |
| | | if (taskNo != 0) { |
| | | wrkMast = wrkMastService.selectById(taskNo); |
| | | wmsWrkNo = wrkMast.getWmsWrkNo(); |
| | | wrkNo = ledCommand.getWorkNo(); |
| | | if (wrkNo != 0) { |
| | | wrkMast = wrkMastService.selectById(wrkNo); |
| | | taskNo = wrkMast.getTaskNo(); |
| | | } |
| | | |
| | | commandInfo = new CommandInfo(); |
| | | commandInfo.setWrkNo(ledCommand.getWorkNo()); |
| | | commandInfo.setWmsWrkNo(wmsWrkNo); |
| | | commandInfo.setTaskNo(taskNo); |
| | | commandInfo.setCommandStatus(1); |
| | | commandInfo.setStartTime(new Date()); |
| | | commandInfo.setDevice("led"); |
| | |
| | | public class CommonService { |
| | | |
| | | @Autowired |
| | | private WrkMastService wrkMastService; |
| | | private TaskWrkService taskWrkService; |
| | | @Autowired |
| | | private WrkLastnoService wrkLastnoService; |
| | | @Autowired |
| | |
| | | int eNo = wrkLastno.getENo(); |
| | | workNo = workNo>=eNo ? sNo : workNo+1; |
| | | while (true) { |
| | | WrkMast wrkMast = wrkMastService.selectById(workNo); |
| | | if (null != wrkMast) { |
| | | TaskWrk taskWrk = taskWrkService.selectByWrkNo(workNo); |
| | | if (null != taskWrk) { |
| | | workNo = workNo>=eNo ? sNo : workNo+1; |
| | | } else { |
| | | break; |
| | |
| | | if (workNo == 0) { |
| | | throw new CoolException("生成工作号失败,请联系管理员"); |
| | | } else { |
| | | if (wrkMastService.selectById(workNo)!=null) { |
| | | if (taskWrkService.selectByWrkNo(workNo)!=null) { |
| | | throw new CoolException("生成工作号" + workNo + "在工作档中已存在"); |
| | | } |
| | | } |
| | |
| | | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.CommandInfo"> |
| | | <id column="id" property="id" /> |
| | | <result column="wrk_no" property="wrkNo" /> |
| | | <result column="wms_wrk_no" property="wmsWrkNo" /> |
| | | <result column="task_no" property="taskNo" /> |
| | | <result column="command_status" property="commandStatus" /> |
| | | <result column="start_time" property="startTime" /> |
| | | <result column="end_time" property="endTime" /> |
| | |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="selectByWmsWrkNoAndWrkNo" resultMap="BaseResultMap"> |
| | | <select id="selectByTaskNoAndWrkNo" resultMap="BaseResultMap"> |
| | | select * from wcs_command_info |
| | | where wrk_no = #{wrkNo} |
| | | and wms_wrk_no = #{wmsWrkNo} |
| | | and task_no = #{taskNo} |
| | | </select> |
| | | |
| | | </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.TaskWrkMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.zy.asrs.entity.TaskWrk"> |
| | | <result column="task_no" property="taskNo" /> |
| | | <result column="status" property="status" /> |
| | | <result column="wrk_no" property="wrkNo" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="io_type" property="ioType" /> |
| | | <result column="io_pri" property="ioPri" /> |
| | | <result column="start_point" property="startPoint" /> |
| | | <result column="target_point" property="targetPoint" /> |
| | | <result column="modi_user" property="modiUser" /> |
| | | <result column="modi_time" property="modiTime" /> |
| | | <result column="memo" property="memo" /> |
| | | <result column="barcode" property="barcode" /> |
| | | <result column="assign_time" property="assignTime" /> |
| | | <result column="execute_time" property="executeTime" /> |
| | | <result column="complete_time" property="completeTime" /> |
| | | <result column="cancel_time" property="cancelTime" /> |
| | | <result column="wrk_sts" property="wrkSts" /> |
| | | |
| | | </resultMap> |
| | | |
| | | <select id="selectByTaskNo" resultMap="BaseResultMap"> |
| | | select top 1 * from wcs_task_wrk |
| | | where 1=1 |
| | | and task_no = #{taskNo} |
| | | </select> |
| | | |
| | | <select id="selectByWrkNo" resultMap="BaseResultMap"> |
| | | select top 1 * from wcs_task_wrk |
| | | where 1=1 |
| | | and wrk_no = #{wrkNo} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | ,{field: 'source$', align: 'center',title: '制购', hide: true} |
| | | ,{field: 'check$', align: 'center',title: '要求检验', hide: true} |
| | | ,{field: 'danger$', align: 'center',title: '危险品', hide: true} |
| | | ] |
| | | ] |
| | | |
| | | function getQueryVariable(variable) |
| | | { |
| | | var query = window.location.search.substring(1); |
| | | var vars = query.split("&"); |
| | | for (var i=0;i<vars.length;i++) { |
| | | var pair = vars[i].split("="); |
| | | if(pair[0] == variable){return pair[1];} |
| | | } |
| | | return(false); |
| | | } |
| | |
| | | cellMinWidth: 50, |
| | | height: 'full-120', |
| | | cols: [[ |
| | | {type: 'checkbox'} |
| | | ,{field: 'wmsWrkNo', align: 'center',title: 'WMS任务号',width: 110} |
| | | ,{field: 'wmsStatus$', align: 'center',title: 'WMS任务状态',width: 130} |
| | | {title:'操作', align: 'center', toolbar: '#operate', width: 110} |
| | | ,{field: 'taskNo', align: 'center',title: 'WMS任务号',width: 110} |
| | | ,{field: 'status$', align: 'center',title: '任务状态',width: 130} |
| | | ,{field: 'wrkNo', align: 'center',title: '任务号'} |
| | | ,{field: 'createTime$', align: 'center',title: '任务时间',width: 170} |
| | | ,{field: 'durationTime', align: 'center',title: '持续时长',width: 150} |
| | | ,{field: 'ioType$', align: 'center',title: '任务类型'} |
| | | ,{field: 'ioPri', align: 'center',title: '优先级'} |
| | | ,{field: 'sourceStaNo$', align: 'center',title: '源站'} |
| | | ,{field: 'staNo$', align: 'center',title: '目标站'} |
| | | ,{field: 'sourceLocNo', align: 'center',title: '源库位'} |
| | | ,{field: 'locNo', align: 'center',title: '目标库位'} |
| | | ,{field: 'barcode', align: 'center',title: '条码'} |
| | | // ,{field: 'modiUser$', align: 'center',title: '修改人员'} |
| | | // ,{field: 'modiTime$', align: 'center',title: '修改时间'} |
| | | // ,{field: 'appeUser$', align: 'center',title: '创建者'} |
| | | // ,{field: 'appeTime$', align: 'center',title: '添加时间'} |
| | | ,{field: 'startPoint', align: 'center',title: '起点'} |
| | | ,{field: 'targetPoint', align: 'center',title: '终点'} |
| | | ,{field: 'memo', align: 'center',title: '备注'} |
| | | |
| | | ,{fixed: 'right', title:'操作', align: 'center', toolbar: '#operate', width: 110} |
| | | // ,{field: 'assignTime$', align: 'center',title: '派发时间',width: 170} |
| | | // ,{field: 'executeTime$', align: 'center',title: '执行时间',width: 170} |
| | | // ,{field: 'completeTime$', align: 'center',title: '完结时间',width: 170} |
| | | // ,{field: 'cancelTime$', align: 'center',title: '取消时间',width: 170} |
| | | ]], |
| | | request: { |
| | | pageName: 'curr', |
| | |
| | | var data = obj.data; |
| | | switch (obj.event) { |
| | | case 'distribute'://派发 |
| | | layer.confirm('确认派发该笔任务?', {title: 'WMS任务号:' + data.wmsWrkNo, shadeClose: true}, function () { |
| | | layer.confirm('确认派发该笔任务?', {title: 'WMS任务号:' + data.taskNo, shadeClose: true}, function () { |
| | | $.ajax({ |
| | | url: baseUrl + "/wmsWrk/distribute/auth", |
| | | headers: {'token': localStorage.getItem('token')}, |
| | | data: { |
| | | wmsWrkNo: data.wmsWrkNo |
| | | taskNo: data.taskNo |
| | | }, |
| | | method: 'POST', |
| | | success: function (res) { |
| | |
| | | <!DOCTYPE html> |
| | | <html lang="en"> |
| | | <head> |
| | | <meta charset="utf-8"> |
| | | <title></title> |
| | | <meta name="renderer" content="webkit"> |
| | | <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| | | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
| | | <link rel="stylesheet" href="../../static/wms/layui/css/layui.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/wms/css/cool.css" media="all"> |
| | | <link rel="stylesheet" href="../../static/wms/css/common.css" media="all"> |
| | | </head> |
| | | <body> |
| | | <!-- 搜索栏 --> |
| | | <div id="search-box" class="layui-form layui-card-header"> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="id" placeholder="指令编号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="wrk_no" id="wrkNo" placeholder="任务号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | <div class="layui-inline"> |
| | | <div class="layui-input-inline"> |
| | | <input class="layui-input" type="text" name="wms_wrk_no" id="wmsWrkNo" placeholder="WMS任务号" autocomplete="off"> |
| | | </div> |
| | | </div> |
| | | |
| | | <!-- 待添加 --> |
| | | <div id="data-search-btn" class="layui-btn-container layui-form-item"> |
| | | <button id="search" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="search">搜索</button> |
| | | <button id="reset" class="layui-btn layui-btn-primary layui-btn-radius" lay-submit lay-filter="reset">重置</button> |
| | | </div> |
| | | </div> |
| | | <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> |
| | | |
| | | <!-- 表格 --> |
| | | <div class="layui-form"> |
| | | <table class="layui-hide" id="commandManage" lay-filter="commandManage"></table> |
| | | </div> |
| | | <script type="text/html" id="toolbar"> |
| | | <div class="layui-btn-container"> |
| | | <button class="layui-btn layui-btn-primary layui-btn-sm" id="btn-export" lay-event="exportData" style="margin-top: 10px">导出</button> |
| | | </div> |
| | | </script> |
| | | <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.command_status" placeholder="指令状态"> |
| | | <el-option label="创建" value="1"></el-option> |
| | | <el-option label="执行" value="2"></el-option> |
| | | <el-option label="完成" value="3"></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> |
| | | <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="showTask">查看任务</el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column property="id" label="指令编号"> |
| | | </el-table-column> |
| | | <el-table-column property="wrkNo" label="工作号"> |
| | | </el-table-column> |
| | | <el-table-column property="taskNo" label="任务号"> |
| | | </el-table-column> |
| | | <el-table-column property="commandStatus$" label="指令状态"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="durationTime" label="持续时长"> |
| | | </el-table-column> |
| | | <el-table-column property="commandType" label="指令类型"> |
| | | </el-table-column> |
| | | <el-table-column property="device" label="设备"> |
| | | </el-table-column> |
| | | <el-table-column property="deviceLog" label="设备执行信息"> |
| | | </el-table-column> |
| | | <el-table-column property="commandDesc" label="命令描述"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="startTime$" label="开始时间"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="endTime$" label="结束时间"> |
| | | </el-table-column> |
| | | <el-table-column show-overflow-tooltip property="command" label="命令报文"> |
| | | </el-table-column> |
| | | </el-table> |
| | | |
| | | <script type="text/html" id="operate"> |
| | | <a class="layui-btn layui-btn-xs btn-detlShow" id="btn-wrkMastShow" lay-event="wrkMastShow">任务</a> |
| | | </script> |
| | | <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> |
| | | </div> |
| | | <script> |
| | | var $layui = layui.config({ |
| | | base: baseUrl + "/static/wms/layui/lay/modules/" |
| | | }).use(['layer', 'form'], function() {}) |
| | | |
| | | <script type="text/javascript" src="../../static/wms/js/jquery/jquery-3.3.1.min.js"></script> |
| | | <script type="text/javascript" src="../../static/wms/layui/layui.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/wms/js/common.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/wms/js/cool.js" charset="utf-8"></script> |
| | | <script type="text/javascript" src="../../static/wms/js/commandManage/commandManage.js" charset="utf-8"></script> |
| | | 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 |
| | | } |
| | | }, |
| | | created() { |
| | | this.init() |
| | | }, |
| | | watch: { |
| | | |
| | | <iframe id="detail-iframe" scrolling="auto" style="display:none;"></iframe> |
| | | }, |
| | | 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 |
| | | } |
| | | |
| | | </body> |
| | | this.getTableData() |
| | | }, |
| | | getTableData() { |
| | | let that = this; |
| | | let data = this.tableSearchParam |
| | | data.curr = this.currentPage |
| | | data.limit = this.pageSize |
| | | $.ajax({ |
| | | url: baseUrl + "/commandInfo/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 "showTask": |
| | | //查看任务 |
| | | this.showTask(row) |
| | | break; |
| | | } |
| | | }, |
| | | showTask(row) { |
| | | //查看任务 |
| | | $layui.layer.open({ |
| | | type: 2, |
| | | title: '任务管理', |
| | | maxmin: true, |
| | | area: [top.detailWidth, top.detailHeight], |
| | | shadeClose: true, |
| | | content: '../taskWrk/taskWrk.html?taskNo=' + row.taskNo + "&wrkNo=" + row.wrkNo, |
| | | success: function(layero, index) {} |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |
| | | |
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> |
| | | <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="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="ioType$" 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> |
| | | |
| | | <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> |
| | | </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 |
| | | } |
| | | }, |
| | | created() { |
| | | this.init() |
| | | }, |
| | | watch: { |
| | | |
| | | }, |
| | | 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 = this.tableSearchParam |
| | | data.curr = this.currentPage |
| | | data.limit = this.pageSize |
| | | $.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 "showCommand": |
| | | //查看指令 |
| | | this.showCommand(row) |
| | | break; |
| | | case "assign": |
| | | //派发任务 |
| | | this.assginWrk(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/commandManage.html?taskNo=' + row.taskNo + "&wrkNo=" + wrkNo, |
| | | success: function(layero, index) {} |
| | | }); |
| | | }, |
| | | assginWrk(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' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | 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' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }) |
| | | </script> |
| | | </body> |
| | | |
| | | </html> |