rsf-admin/.env
@@ -1,3 +1,3 @@ VITE_BASE_IP=127.0.0.1 VITE_BASE_IP=192.168.4.50 # VITE_BASE_IP=47.76.147.249 VITE_BASE_PORT=8080 rsf-admin/src/config/setting.js
@@ -25,7 +25,7 @@ export const ABORT_SIGNAL = false; export const DEFAULT_PAGE_SIZE = 15; export const DEFAULT_PAGE_SIZE = 25; export const DEFAULT_ITEM_PAGE_SIZE = 10; rsf-admin/src/i18n/en.js
@@ -891,6 +891,7 @@ taskItem: { taskId: "taskId", orderId: "orderId", wkType: 'Work Type', orderType: "orderType", orderItemId: "orderItemId", sourceCode: "sourceCode", rsf-admin/src/i18n/zh.js
@@ -920,6 +920,7 @@ taskId: "taskId", orderId: "订单ID", orderType: "单据类型", wkType: '业务类型', orderItemId: "订单明细ID", source: "源ID", matnrId: "物料ID", rsf-admin/src/page/basicInfo/matnr/MatnrList.jsx
@@ -423,7 +423,6 @@ const notify = useNotify(); const refresh = useRefresh(); const [createDialog, setCreateDialog] = useState(false); return ( rsf-admin/src/page/task/TaskItemList.jsx
@@ -146,6 +146,7 @@ <NumberField source="taskId" label="table.field.taskItem.taskId" />, <NumberField source="orderId" label="table.field.taskItem.orderId" />, <NumberField source="orderType$" label="table.field.taskItem.orderType" />, <NumberField source="wkType$" label="table.field.taskItem.wkType" />, <NumberField source="orderItemId" label="table.field.taskItem.orderItemId" />, <NumberField source="matnrId" label="table.field.taskItem.matnrId" />, <TextField source="maktx" label="table.field.taskItem.maktx" />, rsf-server/src/main/java/com/vincent/rsf/server/api/utils/LocUtils.java
@@ -272,7 +272,6 @@ int eRow = deviceBind.getEndRow(); int deviceQty = deviceBind.getDeviceQty(); // ===============>>>> 开始执行 curRow = deviceBind.getCurrentRow(); rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/TaskController.java
@@ -1,6 +1,7 @@ package com.vincent.rsf.server.manager.controller; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.vincent.rsf.framework.common.Cools; @@ -19,6 +20,8 @@ import com.vincent.rsf.server.system.service.impl.ConfigServiceImpl; import io.swagger.annotations.ApiOperation; import org.apache.commons.lang3.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; @@ -29,6 +32,8 @@ @RestController public class TaskController extends BaseController { public static final Logger logger = LoggerFactory.getLogger(TaskController.class); @Autowired private TaskService taskService; @@ -47,7 +52,9 @@ public R page(@RequestBody Map<String, Object> map) { BaseParam baseParam = buildParam(map, BaseParam.class); PageParam<Task, BaseParam> pageParam = new PageParam<>(baseParam, Task.class); return R.ok().add(taskService.page(pageParam, pageParam.buildWrapper(true))); QueryWrapper<Task> queryWrapper = pageParam.buildWrapper(true); queryWrapper.orderByDesc("sort"); return R.ok().add(taskService.page(pageParam, queryWrapper)); } @PreAuthorize("hasAuthority('manager:task:list')") @@ -102,7 +109,7 @@ if (Objects.isNull(ids) || ids.length < 1) { return R.error("参数不能为空!!"); } return taskService.removeTask(ids); return taskService.removeTask(ids, getLoginUserId()); // return R.ok("Delete Success").add(ids); } @@ -137,14 +144,13 @@ List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() .eq(Task::getId, id) .in(Task::getTaskStatus, longs)); for (Task task : tasks) { if (StringUtils.isNotBlank(task.getParentId() + "")) { Task task1 = taskService.getById(task.getParentId()); if (!Objects.isNull(task1) && task1.getTaskType().equals(TaskStsType.UPDATED_IN.id)) { throw new CoolException("父任务:" + task1.getTaskCode() + "未执行完成!"); } } // if (StringUtils.isNotBlank(task.getParentId() + "")) { // Task task1 = taskService.getById(task.getParentId()); // if (!Objects.isNull(task1) && task1.getTaskType().equals(TaskStsType.UPDATED_IN.id)) { // throw new CoolException("父任务:" + task1.getTaskCode() + "未执行完成!"); // } // } task.setTaskStatus(task.getTaskType() < 100 ? TaskStsType.COMPLETE_IN.id : TaskStsType.COMPLETE_OUT.id); } @@ -205,21 +211,15 @@ @PreAuthorize("hasAuthority('manager:task:update')") @ApiOperation("任务出库置顶") @PostMapping("/task/top/{id}") public R setTop(@PathVariable String id) { public R setTop(@PathVariable Long id) { if (Objects.isNull(id)) { throw new CoolException("参数不能为空!!"); } List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getId, id).in(Task::getTaskStatus, longs)); if (tasks.isEmpty()) { throw new CoolException("任务已处执行状态不可一键置顶!!"); } try { if (!taskService.update(new LambdaUpdateWrapper<Task>().set(Task::getSort, 100).eq(Task::getId, id))) { throw new CoolException("置顶失败!!"); } } catch (Exception ex) { return R.error("任务异常,无法完成!!"); taskService.taskToTop(id); } catch (Exception e) { logger.error("UNK", e); throw new CoolException(e.getMessage()); } return R.ok(); } rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/Task.java
@@ -122,7 +122,7 @@ * 优先级 */ @ApiModelProperty(value= "优先级") private Short sort; private Integer sort; /** * 异常编码 @@ -199,7 +199,7 @@ public Task() {} public Task(String taskCode,Integer taskStatus,Integer taskType,String orgLoc,String targLoc,String barcode,String robotCode,Short exceStatus,String expDesc,Short sort,String expCode,Date startTime,Date endTime,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { public Task(String taskCode,Integer taskStatus,Integer taskType,String orgLoc,String targLoc,String barcode,String robotCode,Short exceStatus,String expDesc,Integer sort,String expCode,Date startTime,Date endTime,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { this.taskCode = taskCode; this.taskStatus = taskStatus; this.taskType = taskType; rsf-server/src/main/java/com/vincent/rsf/server/manager/entity/TaskItem.java
@@ -263,6 +263,19 @@ return dictDatas.getLabel(); } public String getWkType$(){ if (Cools.isEmpty(this.wkType)){ return ""; } DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>().eq(DictData::getDictTypeCode, DictTypeCode.DICT_SYS_BUSINESS_TYPE).eq(DictData::getValue, this.wkType)); if (Objects.isNull(dictData)) { return null; } return dictData.getLabel(); } public String getIsptResult$(){ if (Cools.isEmpty(this.isptResult)){ return null; rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/TaskSchedules.java
@@ -17,10 +17,7 @@ import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.*; import java.util.stream.Collectors; /** @@ -52,11 +49,13 @@ */ @Scheduled(cron = "0/3 * * * * ?") public void completeInStock() throws Exception { List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id)); List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskStatus, TaskStsType.COMPLETE_IN.id).select(Task::getId)); if (tasks.isEmpty()) { return; } taskService.complateInTask(tasks); List<Long> longSet = tasks.stream().map(Task::getId).collect(Collectors.toList()); List<Task> vaildTasks = taskService.list(new LambdaQueryWrapper<Task>().in(Task::getId, longSet)); taskService.complateInTask(vaildTasks); } /** @@ -67,11 +66,15 @@ */ @Scheduled(cron = "0/5 * * * * ? ") public void complateOutStock() throws Exception { List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskStatus, TaskStsType.COMPLETE_OUT.id)); List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>() .eq(Task::getTaskStatus, TaskStsType.COMPLETE_OUT.id) .select(Task::getId)); if (tasks.isEmpty()) { return; } taskService.completeTask(tasks); List<Long> longSet = tasks.stream().map(Task::getId).collect(Collectors.toList()); List<Task> vaildTasks = taskService.list(new LambdaQueryWrapper<Task>().in(Task::getId, longSet)); taskService.completeTask(vaildTasks); } /** rsf-server/src/main/java/com/vincent/rsf/server/manager/service/TaskService.java
@@ -19,9 +19,11 @@ // R completeTask(String id); void completeTask(List<Task> task) throws Exception; R removeTask(Long[] ids); R removeTask(Long[] ids, Long loginUserId); Task pickOrCheckTask(Long id, String oType) throws Exception; void complateInTask(List<Task> tasks) throws Exception; Task taskToTop(Long id) throws Exception; } rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/LocItemServiceImpl.java
@@ -41,8 +41,6 @@ @Autowired private DeviceSiteService deviceSiteService; @Autowired private SlaveProperties slaveProperties; @Autowired private WcsService wcsService; @@ -100,6 +98,7 @@ .setTaskCode(ruleCode) .setParentId(moveTask.getId()) .setTargSite(siteNo) .setSort(Short.valueOf("49")) .setUpdateBy(loginUserId) .setCreateBy(loginUserId) .setCreateTime(new Date()) @@ -158,7 +157,6 @@ } task.setTaskType(TaskType.TASK_TYPE_CHECK_OUT.type).setWarehType(deviceSite.getDevice()); } if (!taskService.save(task)) { @@ -173,6 +171,9 @@ .setBatch(item.getBatch()) .setUpdateBy(loginUserId) .setCreateBy(loginUserId) .setSource(item.getId()) .setSourceId(item.getLocId()) .setSourceCode(item.getLocCode()) .setCreateTime(new Date()) .setUpdateTime(new Date()) .setOrderType(OrderType.ORDER_OUT.type) @@ -283,6 +284,7 @@ .setTaskType(TaskType.TASK_TYPE_LOC_MOVE.type) .setTargLoc(targetLoc.getCode()) .setUpdateBy(loginUserId) .setSort(Short.valueOf("49")) .setUpdateTime(new Date()) .setTaskStatus(TaskStsType.GENERATE_IN.id) .setBarcode(orgLoc.getBarcode()); @@ -301,6 +303,9 @@ .setAnfme(item.getAnfme()) .setBatch(item.getBatch()) .setUpdateBy(loginUserId) .setSourceId(item.getLocId()) .setSourceCode(item.getLocCode()) .setSource(item.getId()) .setUpdateTime(new Date()) .setOrderType(OrderType.ORDER_IN.type) .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER_IN.type)); rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/TaskServiceImpl.java
@@ -197,13 +197,18 @@ .setTargLoc(targetLoc) .setBarcode(pakin.getBarcode()) .setCreateBy(loginUserId) .setUpdateTime(new Date()) .setUpdateBy(loginUserId); if (!this.save(task)) { throw new CoolException("任务保存失败!!"); } if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()) .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type).set(Loc::getBarcode, pakin.getBarcode()))) { if (!locService.update(new LambdaUpdateWrapper<Loc>() .eq(Loc::getCode, task.getTargLoc()) .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_S.type) .set(Loc::getUpdateBy, loginUserId) .set(Loc::getUpdateTime, new Date()) .set(Loc::getBarcode, pakin.getBarcode()))) { throw new CoolException("库位预约失败!!"); } /**获取组拖明细**/ @@ -405,6 +410,47 @@ } } /** * 任务置顶 * * @param id * @return */ @Override @Transactional(rollbackFor = Exception.class) public Task taskToTop(Long id) throws Exception { List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); Task tasks = taskService.getOne(new LambdaQueryWrapper<Task>().eq(Task::getId, id).in(Task::getTaskStatus, longs)); if (Objects.isNull(tasks)) { throw new CoolException("任务已处执行状态不可一键置顶!!"); } if (!LocUtils.isShallowLoc(tasks.getOrgLoc())) { String shallowLoc = LocUtils.getShallowLoc(tasks.getOrgLoc()); Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, shallowLoc)); if (Objects.isNull(loc)) { throw new CoolException("数据错误,库位不存在!!"); } if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type)) { Task serviceOne = taskService.getOne(new LambdaQueryWrapper<Task>() .eq(Task::getOrgLoc, loc.getCode()) .or() .eq(Task::getTargLoc, loc.getCode())); if (Objects.isNull(serviceOne)) { tasks.setSort(999); } else { int i = serviceOne.getSort() - 1; tasks.setSort(i); } } } if (!taskService.updateById(tasks)) { throw new CoolException("置顶失败!!"); } return null; } @Transactional(rollbackFor = Exception.class) public void moveInStock(Task task, Long loginUserId) { if (Objects.isNull(task)) { @@ -443,31 +489,30 @@ if (!locItemService.remove(new LambdaQueryWrapper<LocItem>().eq(LocItem::getLocCode, task.getOrgLoc()))) { throw new CoolException("源库位明细删除失败!"); } } /**修改库位状态为F.在库*/ if (!locService.update(new LambdaUpdateWrapper<Loc>() .set(Loc::getBarcode, task.getBarcode()) .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) .set(Loc::getUpdateBy, loginUserId) .set(Loc::getUpdateTime, new Date()) .eq(Loc::getCode, task.getTargLoc()))) { .set(Loc::getBarcode, task.getBarcode()) .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) .set(Loc::getUpdateBy, loginUserId) .set(Loc::getUpdateTime, new Date()) .eq(Loc::getCode, task.getTargLoc()))) { throw new CoolException("库位状态修改失败!!"); } if (!locService.update(new LambdaUpdateWrapper<Loc>() .set(Loc::getBarcode, null) .set(Loc::getUpdateBy, loginUserId) .set(Loc::getUpdateTime, new Date()) .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) .set(Loc::getBarcode, null) .set(Loc::getUpdateBy, loginUserId) .set(Loc::getUpdateTime, new Date()) .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) .eq(Loc::getCode, task.getOrgLoc()))) { throw new CoolException("库位状态修改失败!!"); } if (!this.update(new LambdaUpdateWrapper<Task>().eq(Task::getId, task.getId()) .set(Task::getUpdateBy, loginUserId) .set(Task::getUpdateTime, new Date()) .set(Task::getUpdateBy, loginUserId) .set(Task::getUpdateTime, new Date()) .set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { throw new CoolException("任务状态修改失败!!"); } @@ -574,11 +619,12 @@ * 任务取消 * * @param ids * @param loginUserId * @return */ @Override @Transactional(rollbackFor = Exception.class) public R removeTask(Long[] ids) { public R removeTask(Long[] ids, Long loginUserId) { List<Integer> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type); List<Task> tasks = this.list(new LambdaQueryWrapper<Task>() @@ -588,24 +634,6 @@ throw new CoolException("任务已处执行状态不可取消!!"); } for (Task task : tasks) { //恢复组托状态 WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() .eq(WaitPakin::getBarcode, task.getBarcode()) ); if (null != waitPakin) { waitPakin.setIoStatus(PakinIOStatus.PAKIN_IO_STATUS_DONE.val); if (!waitPakinService.updateById(waitPakin)) { throw new CoolException("更新组托状态失败!!"); } } Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc())); if (null != loc && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) { loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type); if (!locService.updateById(loc)) { throw new CoolException("更新库位状态失败!!"); } } if (!Objects.isNull(task.getWarehType()) && task.getWarehType().equals(WarehType.WAREHOUSE_TYPE_AGV.val)) { BasStation basStation = null; if (task.getTaskType().equals(TaskType.TASK_TYPE_IN.type) || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_IN.type)) { @@ -632,8 +660,47 @@ } } if (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()))) { throw new CoolException("任务明细删除失败!!"); List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); if (!taskItems.isEmpty()) { for (TaskItem item : taskItems) { if (item.getOrderType().equals(OrderType.ORDER_OUT.type)) { //出库 if (item.getWkType().equals(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type))) { //库存出库 Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getId, item.getSourceId())); if (Objects.isNull(loc)) { throw new CoolException("数据错误:库位信息不存在!!"); } loc.setUseStatus(LocStsType.LOC_STS_TYPE_F.type).setBarcode(task.getBarcode()).setUpdateBy(loginUserId).setUpdateTime(new Date()); if (!locService.updateById(loc)) { throw new CoolException("库位信息修改失败!!"); } } } else { //入库 //恢复组托状态 WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() .eq(WaitPakin::getBarcode, task.getBarcode())); if (null != waitPakin) { waitPakin.setIoStatus(PakinIOStatus.PAKIN_IO_STATUS_DONE.val); if (!waitPakinService.updateById(waitPakin)) { throw new CoolException("更新组托状态失败!!"); } } Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, task.getTaskType() < TaskStsType.UPDATED_IN.id ? task.getTargLoc() : task.getOrgLoc())); if (null != loc && (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) || loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type))) { loc.setUseStatus(LocStsType.LOC_STS_TYPE_O.type); if (!locService.updateById(loc)) { throw new CoolException("更新库位状态失败!!"); } } } } if (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId()))) { throw new CoolException("任务明细删除失败!!"); } } } if (!this.removeByIds(Arrays.asList(ids))) { @@ -830,8 +897,8 @@ if (!locService.update(new LambdaUpdateWrapper<Loc>() .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) .set(Loc::getBarcode, null) .set(Loc::getUpdateBy, loginUserId) .set(Loc::getUpdateTime, new Date()) .set(Loc::getUpdateBy, loginUserId) .set(Loc::getUpdateTime, new Date()) .eq(Loc::getId, loc.getId()))) { throw new CoolException("库位状态修改失败!!"); } @@ -1001,7 +1068,7 @@ if (!waitPakinService.update(new LambdaUpdateWrapper<WaitPakin>() .set(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val) .set(WaitPakin::getUpdateBy, loginUserId) .set(WaitPakin::getUpdateBy, loginUserId) .eq(WaitPakin::getId, pakinItem.getPakinId()))) { throw new CoolException("组拖状态修改失败!!"); }