| | |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack, Drawer } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import TaskCreate from "./TaskCreate"; |
| | | import TaskPanel from "./TaskPanel"; |
| | | import EmptyData from "../components/EmptyData"; |
| | | import MyCreateButton from "../components/MyCreateButton"; |
| | | import MyExportButton from '../components/MyExportButton'; |
| | | import SwapVertIcon from '@mui/icons-material/SwapVert'; |
| | | import AlignVerticalTopIcon from '@mui/icons-material/AlignVerticalTop'; |
| | | import TaskAltIcon from '@mui/icons-material/TaskAlt'; |
| | | import CancelIcon from '@mui/icons-material/Cancel'; |
| | | import PageDrawer from "../components/PageDrawer"; |
| | | import TaskPanel from "./TaskPanel"; |
| | | import MyField from "../components/MyField"; |
| | | import ConfirmButton from "../components/ConfirmButton"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='task' |
| | | bulkActionButtons={ |
| | | <> |
| | | <BulkResortButton /> |
| | | <BulkCancelButton /> |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | | </> |
| | | bulkActionButtons={false |
| | | // <> |
| | | // <BulkResortButton /> |
| | | // <BulkCancelButton /> |
| | | // <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | | // </> |
| | | } |
| | | rowClick={false} |
| | | expand={false} |
| | | expand={<TaskPanel />} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'robotCode', 'exceStatus', 'expDesc', 'expCode', 'status']} |
| | | > |
| | |
| | | refresh(); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | } |
| | | return ( |
| | | (record.taskStatus == 1 || record.taskStatus == 101) && (record.taskType == 1 || record.taskType == 101 || record.taskType == 10 || record.taskType == 103 || record.taskType == 11) ? |
| | |
| | | // private String locType; |
| | | |
| | | private Long user; |
| | | |
| | | private String orgLoc; |
| | | // private Integer locType2; //库位类型 |
| | | // private Integer locType3; //库位类型 |
| | | } |
| | |
| | | //根据立库类型获取获取库位 |
| | | if (warehouseArea.getType().equals(WarehType.WAREHOUSE_TYPE_CRN.val)) { |
| | | //堆垛机 |
| | | dto = getLocNoCrn(deviceBind, warehouseArea.getId(), param.getSourceStaNo(), matnr, batch, locTypeDto, 0, param.getIoType()); |
| | | dto = getLocNoCrn(param.getOrgLoc(),deviceBind, warehouseArea.getId(), param.getSourceStaNo(), matnr, batch, locTypeDto, 0, param.getIoType()); |
| | | |
| | | } else if (warehouseArea.getType().equals(WarehType.WAREHOUSE_TYPE_FOUR_DIRECTIONS.val)) { |
| | | //四向库 |
| | |
| | | return dto; |
| | | } |
| | | |
| | | private InTaskMsgDto getLocNoCrn(DeviceBind deviceBind, Long area, Integer sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) { |
| | | private InTaskMsgDto getLocNoCrn(String orgLoc,DeviceBind deviceBind, Long area, Integer sourceStaNo, String matnr, String batch, LocTypeDto locTypeDto, int times, Integer ioType) { |
| | | if (Cools.isEmpty(matnr)) { //物料号 |
| | | matnr = ""; |
| | | } |
| | |
| | | throw new CoolException("无可用堆垛机"); |
| | | } |
| | | //入库靠近摆放 |
| | | if (ioType == 1 && deviceBind.getBeSimilar().equals("1") && !Cools.isEmpty(matnr)) { |
| | | if (ioType == 1 && deviceBind.getBeSimilar().equals("1") && !Cools.isEmpty(matnr) && Cools.isEmpty(orgLoc)) { |
| | | if (nearRow != curRow) { |
| | | List<LocItem> locItems = locItemService.list(new LambdaQueryWrapper<LocItem>().eq(LocItem::getMatnrCode, matnr)); |
| | | for (LocItem locItem : locItems) { |
| | |
| | | .orderByAsc(Loc::getLev) |
| | | .orderByAsc(Loc::getCol) |
| | | ); |
| | | Loc orgMoveLoc = null; |
| | | if (!Cools.isEmpty(orgLoc)) { |
| | | orgMoveLoc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, orgLoc)); |
| | | } |
| | | for (Loc locMast1 : locMasts) { |
| | | if (!LocUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) { |
| | | continue; |
| | |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .eq(Loc::getAreaId, area) |
| | | ); |
| | | |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | if (null != orgMoveLoc){ |
| | | if (!locMast2.getChannel().equals(orgMoveLoc.getChannel())) { |
| | | break; |
| | | } |
| | | } |
| | | loc = locMast2; |
| | | break; |
| | | } |
| | |
| | | .in(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type, LocStsType.LOC_STS_TYPE_F.type) |
| | | .eq(Loc::getAreaId, area) |
| | | ); |
| | | |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | if (null != orgMoveLoc){ |
| | | if (!locMast2.getChannel().equals(orgMoveLoc.getChannel())) { |
| | | break; |
| | | } |
| | | } |
| | | loc = locMast1; |
| | | break; |
| | | } else { |
| | |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .eq(Loc::getAreaId, area) |
| | | ); |
| | | |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | if (null != orgMoveLoc){ |
| | | if (!locMast2.getChannel().equals(orgMoveLoc.getChannel())) { |
| | | break; |
| | | } |
| | | } |
| | | loc = locMast2; |
| | | break; |
| | | } |
| | |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | .eq(Loc::getAreaId, area) |
| | | ); |
| | | |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | if (null != orgMoveLoc){ |
| | | if (!locMast2.getChannel().equals(orgMoveLoc.getChannel())) { |
| | | break; |
| | | } |
| | | } |
| | | loc = locMast2; |
| | | break; |
| | | } else { |
| | |
| | | .in(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_D.type, LocStsType.LOC_STS_TYPE_D.type) |
| | | .eq(Loc::getAreaId, area) |
| | | ); |
| | | |
| | | if (!Cools.isEmpty(locMast2)) { |
| | | if (null != orgMoveLoc){ |
| | | if (!locMast2.getChannel().equals(orgMoveLoc.getChannel())) { |
| | | break; |
| | | } |
| | | } |
| | | loc = locMast1; |
| | | break; |
| | | } |
| | |
| | | // 当前巷道无空库位时,递归调整至下一巷道,检索全部巷道无果后,跳出递归 |
| | | if (times < rowCount * 2) { |
| | | times = times + 1; |
| | | return getLocNoCrn(deviceBind, area, sourceStaNo, matnr, batch, locTypeDto, times, ioType); |
| | | return getLocNoCrn(orgLoc,deviceBind, area, sourceStaNo, matnr, batch, locTypeDto, times, ioType); |
| | | |
| | | } |
| | | // 2.库位当前所属尺寸无空库位时,调整尺寸参数,向上兼容检索库位 |
| | | if (locTypeDto.getLocType1() < 3) { |
| | | int i = locTypeDto.getLocType1() + 1; |
| | | locTypeDto.setLocType1(i); |
| | | return getLocNoCrn(deviceBind, area, sourceStaNo, matnr, batch, locTypeDto, 0, ioType); |
| | | return getLocNoCrn(orgLoc,deviceBind, area, sourceStaNo, matnr, batch, locTypeDto, 0, ioType); |
| | | } |
| | | throw new CoolException("没有空库位"); |
| | | } |
| | |
| | | Double useQty = Math.round((outQty + workQty) * 10000) / 10000.0; |
| | | if (orgQty.compareTo(useQty) > 0) { |
| | | //拣料出库 |
| | | |
| | | DeviceSite deviceSite = deviceSiteService.getOne(new LambdaQueryWrapper<DeviceSite>() |
| | | .eq(DeviceSite::getSite, siteNo) |
| | | .eq(DeviceSite::getChannel, loc.getChannel()) |
| | |
| | | if (!taskService.save(task)) { |
| | | throw new CoolException("任务创建失败!!"); |
| | | } |
| | | |
| | | if (!Objects.isNull(moveTask.getId())) { |
| | | moveTask.setParentId(task.getId()); |
| | | if (!taskService.saveOrUpdate(moveTask)) { |
| | | throw new CoolException("任务信息修改失败!!"); |
| | | } |
| | | } |
| | | |
| | | List<TaskItem> taskItems = new ArrayList<>(); |
| | | listMap.get(key).forEach(item -> { |
| | | TaskItem taskItem = new TaskItem(); |
| | |
| | | throw new CoolException("源库位不存在!!"); |
| | | } |
| | | |
| | | if (orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type) |
| | | || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) |
| | | || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_X.type ) ) { |
| | | throw new CoolException("源库位有任务正在执行中..."); |
| | | } |
| | | // if (orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_R.type) |
| | | // || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_S.type) |
| | | // || orgLoc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_X.type ) ) { |
| | | // throw new CoolException("源库位有任务正在执行中..."); |
| | | // } |
| | | |
| | | orgLoc.setUseStatus(LocStsType.LOC_STS_TYPE_R.type); |
| | | |
| | |
| | | } |
| | | TaskInParam param = new TaskInParam(); |
| | | param.setIoType(TaskType.TASK_TYPE_OUT.type) |
| | | .setOrgLoc(map.getOrgLoc()) |
| | | .setSourceStaNo(Integer.parseInt(deviceSite.getSite())) |
| | | .setLocType1(Integer.parseInt(orgLoc.getType())); |
| | | .setLocType1(Integer.parseInt(orgLoc.getType()) |
| | | ); |
| | | InTaskMsgDto locNo = null; |
| | | try { |
| | | locNo = wcsService.getLocNo(param); |
| | |
| | | .setUpdateBy(loginUserId) |
| | | .setSort(Constants.TASK_SORT_DEFAULT_VALUE) |
| | | .setUpdateTime(new Date()) |
| | | .setTaskStatus(TaskStsType.GENERATE_IN.id) |
| | | .setTaskStatus(TaskStsType.GENERATE_OUT.id) |
| | | .setBarcode(orgLoc.getBarcode()); |
| | | |
| | | if (!taskService.save(task)) { |
| | |
| | | .setSourceCode(item.getLocCode()) |
| | | .setSource(item.getId()) |
| | | .setUpdateTime(new Date()) |
| | | .setOrderType(OrderType.ORDER_IN.type) |
| | | .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER_IN.type)); |
| | | .setOrderType(OrderType.ORDER_OUT.type) |
| | | .setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_OTHER.type)); |
| | | taskItems.add(taskItem); |
| | | } |
| | | if (!taskItemService.saveBatch(taskItems)) { |
| | |
| | | } |
| | | //深库位先出情况 |
| | | if (!LocUtils.isShallowLoc(curLoc)) { |
| | | //深库位 |
| | | String shallowLoc = LocUtils.getShallowLoc(curLoc); |
| | | if (StringUtils.isBlank(shallowLoc)) { |
| | | throw new CoolException("数据异常,请联系管理员!"); |
| | |
| | | task.setSort(i); |
| | | } |
| | | } |
| | | // else if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_F.type)) { |
| | | // //如果为在库状态,生成移库任务 |
| | | // LocToTaskParams params = new LocToTaskParams(); |
| | | // params.setOrgLoc(curLoc); |
| | | // //生成移深库位任务 |
| | | // Task moveTask = locItemService.genMoveTask(params, loginUserId); |
| | | // moveTask.setTaskType(task.getSort() + 1); |
| | | // |
| | | // return moveTask; |
| | | // } |
| | | } else { |
| | | //浅库位,判断深对应深库位是否为空,如果为空生成一个移库任务,将托盘送入深库位 |
| | | String deepLoc = LocUtils.getDeepLoc(curLoc); |
| | |
| | | //判断深库位是否为空 |
| | | if (loc.getUseStatus().equals(LocStsType.LOC_STS_TYPE_O.type)) { |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(loc.getCode()).setTarLoc(deepLoc); |
| | | |
| | | Task task1 = locItemService.genMoveTask(params, loginUserId); |
| | | params.setOrgLoc(curLoc).setTarLoc(deepLoc); |
| | | //生成移深库位任务 |
| | | locItemService.genMoveTask(params, loginUserId); |
| | | } |
| | | } |
| | | |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | 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<Integer> list = Arrays.asList(TaskType.TASK_TYPE_IN.type, TaskType.TASK_TYPE_OUT.type,TaskType.TASK_TYPE_PICK_AGAIN_OUT.type, |
| | | TaskType.TASK_TYPE_CHECK_OUT.type, TaskType.TASK_TYPE_EMPITY_IN.type, TaskType.TASK_TYPE_LOC_MOVE.type, |
| | | TaskType.TASK_TYPE_EMPITY_OUT.type, TaskType.TASK_TYPE_MERGE_OUT.type); |
| | | List<Task> tasks = this.list(new LambdaQueryWrapper<Task>() |
| | | .in(Task::getTaskType, list) |
| | | .in(Task::getId, ids).in(Task::getTaskStatus, longs)); |
| | |
| | | throw new CoolException("任务已处执行状态不可取消!!"); |
| | | } |
| | | for (Task task : tasks) { |
| | | //取消移库任务 |
| | | if (task.getTaskType().equals(TaskType.TASK_TYPE_LOC_MOVE.type) && task.getTaskStatus().equals(TaskStsType.GENERATE_OUT.id)) { |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>() |
| | | .eq(Loc::getCode, task.getOrgLoc()) |
| | | .set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type))) { |
| | | throw new CoolException("源库位状态修改失败!!"); |
| | | } |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().eq(Loc::getCode, task.getTargLoc()).set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type))) { |
| | | throw new CoolException("移库目标库位状态修改失败!!"); |
| | | } |
| | | |
| | | Task outTask = taskService.getById(task.getParentId()); |
| | | if (!Objects.isNull(outTask)) { |
| | | LocToTaskParams params = new LocToTaskParams(); |
| | | params.setOrgLoc(task.getOrgLoc()).setSiteNo(task.getOrgSite()); |
| | | //生成移深库位任务 |
| | | Task moveTask = locItemService.genMoveTask(params, loginUserId); |
| | | moveTask.setSort(task.getSort() + 1).setParentId(outTask.getId()); |
| | | if (!this.updateById(moveTask)) { |
| | | throw new CoolException("任务信息修改失败!!"); |
| | | } |
| | | outTask.setParentId(moveTask.getId()); |
| | | if (!this.updateById(outTask)) { |
| | | throw new CoolException("任务信息修改失败!!"); |
| | | |
| | | } |
| | | |
| | | } else { |
| | | 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)) { |
| | |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_PICK_AGAIN_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_MERGE_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_CHECK_OUT.type) |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type) |
| | | ) { |
| | | || task.getTaskType().equals(TaskType.TASK_TYPE_EMPITY_OUT.type)) { |
| | | basStation = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getStationName, task.getTargLoc()) |
| | | .eq(BasStation::getUseStatus, LocStsType.LOC_STS_TYPE_R.type)); |