| | |
| | | taskLog: 'TaskLog', |
| | | orderItem: 'OrderItem', |
| | | order: 'Order', |
| | | locItem: 'LocItem', |
| | | locPreview: 'LocItem', |
| | | stock: 'Stock Manage', |
| | | histories: 'Histories', |
| | | wareWork: 'Warehouse Working', |
| | |
| | | taskItemLog: '任务明细历史档', |
| | | stock: '入出库历史', |
| | | stockItem: '单据明细', |
| | | locItem: '库位明细', |
| | | locPreview: '库位明细', |
| | | histories: '历史档', |
| | | wareWork: '仓库作业', |
| | | statistics: '库存查询', |
| | |
| | | import outStock from "./orders/outStock"; |
| | | import deviceBind from "./deviceBind"; |
| | | import wave from "./orders/wave"; |
| | | import locItem from "./locItem"; |
| | | import locPreview from "./locPreview"; |
| | | import basStation from "./basicInfo/basStation"; |
| | | import warehouseStock from "./statistics/stockManage"; |
| | | import basContainer from "./basicInfo/basContainer"; |
| | |
| | | return deviceBind; |
| | | case "wave": |
| | | return wave; |
| | | case "locItem": |
| | | return locItem; |
| | | case "locPreview": |
| | | return locPreview; |
| | | case "basStation": |
| | | return basStation; |
| | | case "basContainer": |
File was renamed from rsf-admin/src/page/locItem/LocItemEdit.jsx |
| | |
| | | return ( |
| | | <> |
| | | <Edit |
| | | redirect="list" |
| | | resource="locItem" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | aside={<EditBaseAside />} |
File was renamed from rsf-admin/src/page/locItem/LocItemList.jsx |
| | |
| | | }), |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | storeKey="locItem" |
| | | resource="loc/items" |
| | | title={"menu.locItem"} |
| | | storeKey="locPreview" |
| | | resource="loc/preview" |
| | | title={"menu.locPreview"} |
| | | empty={false} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | {/* <SelectColumnsButton preferenceKey='loc' /> */} |
| | | <SelectColumnsButton preferenceKey='loc' /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | aside={<LocListAside />} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='locItem' |
| | | preferenceKey='locPreview' |
| | | align="left" |
| | | bulkActionButtons={false} |
| | | rowClick={() => false} |
| | |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} align="left" /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} resource="locItem" label="toolbar.detail" /> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} label="toolbar.detail" /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
File was renamed from rsf-admin/src/page/locItem/LocQueryList.jsx |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | |
| | | DeleteButton, |
| | | useGetRecordId, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack, LinearProgress } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import PageDrawer from "../components/PageDrawer"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import { Box, Typography, Card, Stack, LinearProgress } from '@mui/material'; |
| | | import PageDrawer from "../components/PageDrawer"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | |
| | | width: 100 |
| | | }, |
| | | '& .MuiTableCell-root': { |
| | | whiteSpace: 'nowrap', |
| | | overflow: 'visible', |
| | | textOverflow: 'unset' |
| | | } |
| | | whiteSpace: 'nowrap', |
| | | overflow: 'visible', |
| | | textOverflow: 'unset' |
| | | } |
| | | })); |
| | | |
| | | const filters = [ |
| | |
| | | ] |
| | | |
| | | const LocItemList = () => { |
| | | const translate = useTranslate(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const translate = useTranslate(); |
| | | const locId = useGetRecordId(); |
| | | |
| | | return ( |
| | |
| | | }), |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.locItem"} |
| | | title={"menu.locPreview"} |
| | | empty={false} |
| | | filter={{locId: locId}} |
| | | filter={{ locId: locId }} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <SelectColumnsButton preferenceKey='locItem' /> |
| | | <SelectColumnsButton preferenceKey='locPreview' /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | |
| | | |
| | | |
| | | const DynamicFields = (props) => { |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const [columns, setColumns] = useState([]); |
| | | const { isLoading } = useListContext(); |
| | | const translate = useTranslate(); |
| | | const refresh = useRefresh(); |
| | | const notify = useNotify(); |
| | | |
| | | useEffect(() => { |
| | | getDynamicFields(); |
| | | }, []); |
| | |
| | | )} |
| | | {columns.length > 0 && |
| | | <StyledDatagrid |
| | | preferenceKey='locItem' |
| | | preferenceKey='locPreview' |
| | | bulkActionButtons={false} |
| | | rowClick={false} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime','spec', 'model', 'locId', 'orderId', 'trackCode', 'orderItemId', 'matnrId', 'splrBatch','createBy$', 'memo', 'fieldsIndex','statusBool']} |
| | | omit={['id', 'createTime', 'spec', 'model', 'locId', 'orderId', 'trackCode', 'orderItemId', 'matnrId', 'splrBatch', 'createBy$', 'memo', 'fieldsIndex', 'statusBool']} |
| | | > |
| | | {columns.map((column) => column)} |
| | | </StyledDatagrid>} |
| | |
| | | <SimpleForm |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | toolbar={false} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | > |
| | |
| | | useRecordContext, |
| | | DeleteButton, |
| | | } from "react-admin"; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { Stack, Grid, Box, Typography } from "@mui/material"; |
| | | import * as Common from "@/utils/common.js"; |
| | | |
| | | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from "@/config/setting.js"; |
| | | import EditBaseAside from "../../components/EditBaseAside.jsx"; |
| | | import CustomerTopToolBar from "../../components/EditTopToolBar.jsx"; |
| | | import MemoInput from "../../components/MemoInput.jsx"; |
| | | import StatusSelectInput from "../../components/StatusSelectInput.jsx"; |
| | | import CustomerTopToolBar from "../../components/EditTopToolBar.jsx"; |
| | | import EditBaseAside from "../../components/EditBaseAside.jsx"; |
| | | import { Stack, Grid, Box, Typography } from "@mui/material"; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import MemoInput from "../../components/MemoInput.jsx"; |
| | | import TransferItemList from "./TransferItemList.jsx"; |
| | | import * as Common from "@/utils/common.js"; |
| | | |
| | | const FormToolbar = () => { |
| | | const { getValues } = useFormContext(); |
| | |
| | | autoFocus |
| | | readOnly |
| | | /> |
| | | <NumberInput label="table.field.transfer.type" source="type" readOnly/> |
| | | <TextInput label="table.field.transfer.type" source="type$" readOnly/> |
| | | <SelectInput |
| | | label="table.field.transfer.source" |
| | | source="source" |
| | |
| | | /> |
| | | <SelectInput |
| | | label="table.field.transfer.exceStatus" |
| | | source="exceStatus" |
| | | source="exceStatus$" |
| | | readOnly |
| | | choices={[ |
| | | { id: 0, name: "未执行" }, |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.manager.controller.params.LocMastInitParam; |
| | | import com.vincent.rsf.server.manager.controller.params.LocModifyParams; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | |
| | | @Api(tags = "库位信息") |
| | | @RestController |
| | | public class LocPreviewController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LocService locService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @PostMapping("/loc/preview/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Loc, BaseParam> pageParam = new PageParam<>(baseParam, Loc.class); |
| | | List<String> list = new ArrayList<>(); |
| | | list.add("row"); |
| | | list.add("col"); |
| | | list.add("lev"); |
| | | return R.ok().add(locService.page(pageParam, pageParam.buildWrapper(true,list))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @PostMapping("/loc/preview/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(locService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @PostMapping("/loc/preview/areaNoUse/list") |
| | | public R areaNoUselist(@RequestBody Map<String, Object> map) { |
| | | String locCode = map.get("locCode").toString(); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, locCode),false); |
| | | List<Loc> list = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getAreaId, loc.getAreaId()) |
| | | .eq(Loc::getChannel,loc.getChannel()) |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_O.type) |
| | | ); |
| | | List<String> list1 = list.stream().map(obj -> obj.getCode()).collect(Collectors.toList()); |
| | | return R.ok(list1); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @PostMapping({"/loc/preview/many/{ids}", "/loc/preview/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(locService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @GetMapping("/loc/preview/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:save')") |
| | | @OperationLog("Create 库位信息表") |
| | | @PostMapping("/loc/preview/save") |
| | | public R save(@RequestBody Loc loc) { |
| | | if (Objects.isNull(loc.getWarehouseId())) { |
| | | throw new CoolException("仓库ID不能为空!!"); |
| | | } |
| | | if (Objects.isNull(loc.getAreaId())) { |
| | | throw new CoolException("仓库ID不能为空!!"); |
| | | } |
| | | if (Objects.isNull(loc.getTypeIds())) { |
| | | throw new CoolException("库位类型不能为空!!"); |
| | | } |
| | | String join = StringUtils.join(loc.getTypeIds(), ","); |
| | | loc.setType(join); |
| | | loc.setCreateBy(getLoginUserId()); |
| | | loc.setUpdateBy(getLoginUserId()); |
| | | if (!locService.save(loc)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | |
| | | if (!locService.saveType(loc)) { |
| | | throw new CoolException("库位类型关联关系保存失败!!"); |
| | | } |
| | | return R.ok("Save Success").add(loc); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:update')") |
| | | @OperationLog("Update 库位信息表") |
| | | @PostMapping("/loc/preview/update") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R update(@RequestBody Loc loc) { |
| | | loc.setUpdateBy(getLoginUserId()); |
| | | String join = StringUtils.join(loc.getTypeIds(), ","); |
| | | loc.setType(join); |
| | | if (Objects.isNull(loc.getTypeIds())) { |
| | | throw new CoolException("库位类型不能为空!!"); |
| | | } |
| | | if (!locService.updateById(loc)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | if (!locService.updateLoc(loc)) { |
| | | throw new CoolException("库位类型关联关系修改失败!!"); |
| | | } |
| | | return R.ok("Update Success").add(loc); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:remove')") |
| | | @OperationLog("Delete 库位信息表") |
| | | @PostMapping("/loc/preview/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!locService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @PostMapping("/loc/preview/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<Loc> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(Loc::getCode, condition); |
| | | } |
| | | locService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getCode())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:list')") |
| | | @ApiOperation("库位导出") |
| | | @PostMapping("/loc/preview/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | List<Loc> locs = new ArrayList<>(); |
| | | if (Objects.isNull(map.get("ids"))) { |
| | | locs = locService.list(); |
| | | } else { |
| | | locs = locService.list(new LambdaQueryWrapper<Loc>().eq(Loc::getStatus, 1)); |
| | | } |
| | | ExcelUtil.build(ExcelUtil.create(locs, Loc.class), response); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locPreview:update')") |
| | | @ApiOperation("库位批量修改") |
| | | @PostMapping("/loc/preview/modify") |
| | | public R batchUpdate(@RequestBody LocModifyParams locs) { |
| | | if (Objects.isNull(locs)) { |
| | | throw new CoolException("参为不能为空!!"); |
| | | } |
| | | return locService.modifyLocs(locs); |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | @ApiOperation("单据信息修改") |
| | | @PostMapping("/transfer/items/update") |
| | | @PreAuthorize("hasAuthority('manager:transfer:update')") |
| | | public R orderAndrItemUpdate(@RequestBody TransferItemParams params) throws Exception { |
| | | public R orderAndrItemUpdate(@RequestBody TransferItemParams params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | |
| | | @ApiOperation("获取原库区物料信息") |
| | | @PostMapping("/transfer/locs/items") |
| | | @PreAuthorize("hasAuthority('manager:transfer:list')") |
| | | public R locsPage(@RequestBody OrgLocParams params) throws Exception { |
| | | public R locsPage(@RequestBody OrgLocParams params) { |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | |
| | | @PostMapping("/transfer/template/download") |
| | | @ApiOperation("下载盘点单模板") |
| | | @PreAuthorize("hasAuthority('manager:transfer:update')") |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) { |
| | | CheckOrderTemplate template = ExcelUtil.mockData(CheckOrderTemplate.class); |
| | | List<CheckOrderTemplate> list = Arrays.asList(template); |
| | | ExcelUtil.build(ExcelUtil.create(list, CheckOrderTemplate.class, true), response); |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.manager.controller.params.LocMastInitParam; |
| | | import com.vincent.rsf.server.manager.controller.params.LocModifyParams; |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | |
| | | public interface LocPreviewService extends IService<Loc> { |
| | | |
| | | R modifyLocs(LocModifyParams locs); |
| | | |
| | | R initLocs(LocMastInitParam param, Long loginUserId); |
| | | |
| | | boolean saveType(Loc typeIds); |
| | | |
| | | boolean updateLoc(Loc loc); |
| | | |
| | | R batchBindLocs(LocModifyParams locs); |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.LocMastInitParam; |
| | | import com.vincent.rsf.server.manager.controller.params.LocModifyParams; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.mapper.LocMapper; |
| | | import com.vincent.rsf.server.manager.mapper.LocTypeRelaMapper; |
| | | import com.vincent.rsf.server.manager.utils.Shelves; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | @Service("locPreviewService") |
| | | public class LocPreviewServiceImpl extends ServiceImpl<LocMapper, Loc> implements LocPreviewService { |
| | | |
| | | @Autowired |
| | | private WarehouseAreasService warehouseAreasService; |
| | | |
| | | @Autowired |
| | | private LocTypeRelaService locTypeRelaService; |
| | | |
| | | @Autowired |
| | | private LocAreaRelaService locAreaRelaService; |
| | | |
| | | @Autowired |
| | | private LocAreaService locAreaService; |
| | | |
| | | @Autowired |
| | | private LocTypeRelaMapper locTypeRelaMapper; |
| | | |
| | | @Override |
| | | public R modifyLocs(LocModifyParams locs) { |
| | | if (locs.getId().isEmpty()) { |
| | | throw new CoolException("库位ID不能为空!!"); |
| | | } |
| | | Loc loc = locs.getLoc(); |
| | | |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("修改库位信息不能为空!!"); |
| | | } |
| | | |
| | | String join = loc.getType(); |
| | | if (!Objects.isNull(loc.getTypeIds()) && !loc.getTypeIds().isEmpty()) { |
| | | join = StringUtils.join(loc.getTypeIds(), ","); |
| | | } |
| | | boolean update = this.update(new LambdaUpdateWrapper<Loc>() |
| | | .in(Loc::getId, locs.getId()) |
| | | .eq(Loc::getStatus, 1) |
| | | .set(!Objects.isNull(loc.getAreaId()), Loc::getAreaId, loc.getAreaId()) |
| | | .set(!Objects.isNull(loc.getWarehouseId()), Loc::getWarehouseId, loc.getWarehouseId()) |
| | | .set(!Objects.isNull(loc.getUseStatus()), Loc::getUseStatus, loc.getUseStatus()) |
| | | .set(!Objects.isNull(loc.getTypeIds()) && !loc.getTypeIds().isEmpty(), Loc::getType, join) |
| | | .set(!Objects.isNull(loc.getLength()), Loc::getLength, loc.getLength()) |
| | | .set(!Objects.isNull(loc.getWidth()), Loc::getWidth, loc.getWidth()) |
| | | .set(!Objects.isNull(loc.getHeight()), Loc::getHeight, loc.getHeight()) |
| | | .set(!Objects.isNull(loc.getChannel()), Loc::getChannel, loc.getChannel()) |
| | | .set(!Objects.isNull(loc.getFlagLabelMange()), Loc::getFlagLabelMange, loc.getFlagLabelMange()) |
| | | .set(!Objects.isNull(loc.getStatus()), Loc::getStatus, loc.getStatus())); |
| | | if (!update) { |
| | | throw new CoolException("库位信息修改失败!!"); |
| | | } |
| | | |
| | | return R.ok(loc); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R initLocs(LocMastInitParam param, Long loginUserId) { |
| | | //清空表 |
| | | // this.baseMapper.deleteAll(); |
| | | //清空当前库区库位 |
| | | List<Loc> locs = this.list(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, param.getWarehouseId()).eq(Loc::getAreaId, param.getAreaId())); |
| | | if (!locs.isEmpty()) { |
| | | if (!this.remove(new LambdaQueryWrapper<Loc>().eq(Loc::getWarehouseId, param.getWarehouseId()).eq(Loc::getAreaId, param.getAreaId()))) { |
| | | throw new CoolException("初始化失败:数据删除失败!!"); |
| | | } |
| | | } |
| | | WarehouseAreas warehouseAreas = warehouseAreasService.getOne(new LambdaQueryWrapper<WarehouseAreas>() |
| | | .eq(WarehouseAreas::getWarehouseId, param.getWarehouseId()) |
| | | .eq(WarehouseAreas::getId, param.getAreaId())); |
| | | if (Objects.isNull(warehouseAreas)) { |
| | | throw new CoolException("库区不存在!!"); |
| | | } |
| | | String join = StringUtils.join(param.getTypeIds(), ","); |
| | | |
| | | String[] split = warehouseAreas.getCode().split("\\."); |
| | | if (split.length == 0){ |
| | | throw new CoolException("库区编码错误!!"); |
| | | } |
| | | StringBuilder locStar = new StringBuilder(); |
| | | for (int i = 0; i < split.length; i++) { |
| | | locStar.append(split[i]).append("-"); |
| | | } |
| | | |
| | | List<Loc> list = new ArrayList<>(); |
| | | Integer chanl = 0; //默认第一巷道 |
| | | for (int r = param.getStartRow(); r <= param.getEndRow(); r++) { |
| | | try{ |
| | | Shelves shelves = new Shelves(param.getEndRow() - param.getStartRow() + 1, param.getChannel(),param.getStartRow()); |
| | | for (List<Integer> node : shelves.nodes){ |
| | | if (node.contains(r)) { |
| | | if (!Cools.isEmpty(param.getStartChannel()) && param.getStartChannel() > 0){ |
| | | chanl = shelves.nodes.indexOf(node) + param.getStartChannel(); |
| | | }else { |
| | | chanl = shelves.nodes.indexOf(node) + 1; |
| | | } |
| | | break; |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | throw new CoolException("解析巷道号失败"); |
| | | } |
| | | for (int b = param.getStartBay(); b <= param.getEndBay(); b++) { |
| | | for (int l = param.getStartLev(); l <= param.getEndLev(); l++) { |
| | | // 获取库位号 |
| | | String locNo = locStar + String.format("%d", r) + String.format("-%d", b) + String.format("-%d", l); |
| | | Loc loc = new Loc(); |
| | | loc.setCode(locNo) |
| | | .setUseStatus("O") |
| | | .setRow(r) |
| | | .setCol(b) |
| | | .setLev(l) |
| | | .setChannel(chanl) |
| | | .setType(join) |
| | | .setAreaId(param.getAreaId()) |
| | | .setUpdateBy(loginUserId) |
| | | .setCreateBy(loginUserId) |
| | | .setWarehouseId(warehouseAreas.getWarehouseId()); |
| | | list.add(loc); |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!this.saveBatch(list)) { |
| | | throw new CoolException("库位初始化失败!!"); |
| | | } |
| | | List<LocTypeRela> locTypeRelas = new ArrayList<>(); |
| | | for (Long typeId : param.getTypeIds()) { |
| | | for (Loc loc : list) { |
| | | LocTypeRela typeRela = new LocTypeRela(); |
| | | typeRela.setLocId(loc.getId()).setTypeId(typeId); |
| | | locTypeRelas.add(typeRela); |
| | | } |
| | | } |
| | | if (!locTypeRelaService.saveBatch(locTypeRelas)) { |
| | | throw new CoolException("库位类型关联失败!!"); |
| | | } |
| | | return R.ok("初始化成功!!"); |
| | | } |
| | | |
| | | @Override |
| | | public boolean saveType(Loc loc) { |
| | | List<LocTypeRela> relas = new ArrayList<>(); |
| | | loc.getTypeIds().forEach(id -> { |
| | | LocTypeRela typeRela = new LocTypeRela(); |
| | | typeRela.setTypeId(id) |
| | | .setLocId(loc.getId()); |
| | | relas.add(typeRela); |
| | | }); |
| | | if (!locTypeRelaService.saveOrUpdateBatch(relas)) { |
| | | throw new CoolException("库位关联关系保存失败!!"); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public boolean updateLoc(Loc loc) { |
| | | locTypeRelaMapper.delete(new LambdaQueryWrapper<LocTypeRela>().eq(LocTypeRela::getLocId, loc.getId())); |
| | | List<LocTypeRela> relas = new ArrayList<>(); |
| | | loc.getTypeIds().forEach(id -> { |
| | | LocTypeRela typeRela = new LocTypeRela(); |
| | | typeRela.setTypeId(id) |
| | | .setLocId(loc.getId()); |
| | | relas.add(typeRela); |
| | | }); |
| | | if (!locTypeRelaService.saveOrUpdateBatch(relas)) { |
| | | throw new CoolException("库位关联关系保存失败!!"); |
| | | } |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public R batchBindLocs(LocModifyParams locs) { |
| | | if (locs.getId().isEmpty()) { |
| | | throw new CoolException("库位ID不能为空!!"); |
| | | } |
| | | if (Objects.isNull(locs.getLocAreaId())) { |
| | | throw new CoolException("修改库位信息不能为空!!"); |
| | | } |
| | | List<LocArea> locAreas = locAreaService.list(new LambdaQueryWrapper<LocArea>().eq(LocArea::getId, locs.getLocAreaId())); |
| | | if (locAreas.isEmpty()) { |
| | | throw new CoolException("库位分区不存在!!"); |
| | | } |
| | | List<LocAreaRela> relas = new ArrayList<>(); |
| | | locs.getId().forEach(id -> { |
| | | LocAreaRela locAreaRela = new LocAreaRela(); |
| | | locAreaRela.setLocId(id) |
| | | .setLocAreaId(locs.getLocAreaId()); |
| | | relas.add(locAreaRela); |
| | | }); |
| | | if (!locAreaRelaService.saveBatch(relas)) { |
| | | throw new CoolException("库位分区失败!!"); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | } |
| | |
| | | if (Objects.isNull(wkOrderItem.getAnfme()) || Double.compare(wkOrderItem.getAnfme(), 0.0) <= 0) { |
| | | throw new CoolException("计划数不能为空!!"); |
| | | } |
| | | //保存扩展字段 |
| | | try { |
| | | StringBuffer sb = new StringBuffer(); |
| | | if (Objects.isNull(wkOrderItem.getFieldsIndex()) || StringUtils.isBlank(wkOrderItem.getFieldsIndex())) { |
| | | sb.append(wkOrderItem.getMatnrId() + wkOrderItem.getBatch() ); |
| | | //获取16位uuid |
| | | String uuid16 = Cools.md5Chinese(sb.toString()); |
| | | wkOrderItem.setFieldsIndex(uuid16); |
| | | params.put("index", uuid16); |
| | | } |
| | | //保存或更新动态字段值 |
| | | FieldsUtils.updateFieldsValue(params); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | // //保存扩展字段 |
| | | // try { |
| | | // StringBuffer sb = new StringBuffer(); |
| | | // if (Objects.isNull(wkOrderItem.getFieldsIndex()) || StringUtils.isBlank(wkOrderItem.getFieldsIndex())) { |
| | | // sb.append(wkOrderItem.getMatnrId() + wkOrderItem.getBatch()); |
| | | // //获取16位uuid |
| | | // String uuid16 = Cools.md5Chinese(sb.toString()); |
| | | // wkOrderItem.setFieldsIndex(uuid16); |
| | | // params.put("index", uuid16); |
| | | // } |
| | | // //保存或更新动态字段值 |
| | | // FieldsUtils.updateFieldsValue(params); |
| | | // } catch (Exception e) { |
| | | // throw new RuntimeException(e); |
| | | // } |
| | | wkOrderItem.setUpdateBy(loginUserId).setCreateBy(loginUserId); |
| | | if (!this.saveOrUpdate(wkOrderItem)) { |
| | | throw new CoolException("收货通知单明细保存失败!!"); |
| | |
| | | import com.vincent.rsf.server.manager.enums.WaveRuleType; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | |
| | | import javax.swing.*; |
| | | import java.math.BigDecimal; |
| | |
| | | public static List<LocItem> getEfficiencyFirstItemList(String matnrCode, String splrBatch, Double anfme) { |
| | | LambdaQueryWrapper<LocItem> locItemQueryWrapper = new LambdaQueryWrapper<>(); |
| | | locItemQueryWrapper.eq(LocItem::getMatnrCode, matnrCode); |
| | | locItemQueryWrapper.eq(LocItem::getBatch, splrBatch); |
| | | locItemQueryWrapper.eq(StringUtils.isNotBlank(splrBatch), LocItem::getBatch, splrBatch); |
| | | String applySql = String.format( |
| | | "EXISTS (SELECT 1 FROM man_loc ml " + |
| | | "WHERE ml.use_status = '%s'" + |