Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
| | |
| | | batchStatus: 'batchStatus', |
| | | batchMix: 'batchFiexed', |
| | | batchWarehouse: 'batchWarehouse', |
| | | batchStockLevel: "batchStockLevel", |
| | | }, |
| | | }; |
| | | |
| | |
| | | minQty: "最小值", |
| | | maxQty: "最大值", |
| | | stagn: "停滞预警值", |
| | | valid: "保质期", |
| | | validWarn: "效期预警", |
| | | valid: "保质期(天)", |
| | | validWarn: "效期预警(天)", |
| | | flagCheck: "免检", |
| | | }, |
| | | matnrGroup: { |
| | |
| | | batchStatus: '批量状态', |
| | | batchMix: '批量混放', |
| | | batchWarehouse: '批量仓库', |
| | | batchStockLevel: "批量ABC分类", |
| | | }, |
| | | }; |
| | | |
| | |
| | | |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "../../components/DialogCloseButton"; |
| | | import DictionarySelect from "../../components/DictionarySelect"; |
| | | import { useForm, Controller, useWatch, FormProvider, useFormContext } from "react-hook-form"; |
| | | import SaveIcon from '@mui/icons-material/Save'; |
| | | import request from '@/utils/request'; |
| | |
| | | import { DataGrid } from '@mui/x-data-grid'; |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | |
| | | const InitModal = ({ open, setOpen }) => { |
| | | const InitModal = ({ open, setOpen, fieldType }) => { |
| | | const refresh = useRefresh(); |
| | | const translate = useTranslate(); |
| | | |
| | |
| | | const notify = useNotify(); |
| | | |
| | | const [formData, setFormData] = useState({ |
| | | 'status': null |
| | | 'status': null, |
| | | 'stockLevel': null, |
| | | 'validWarn': null, |
| | | 'valid': null, |
| | | 'flagCheck': null, |
| | | }); |
| | | |
| | | const { selectedIds, onUnselectItems } = useListContext(); |
| | |
| | | |
| | | const reset = () => { |
| | | setFormData({ |
| | | 'status': null |
| | | 'status': null, |
| | | 'stockLevel': null, |
| | | 'validWarn': null, |
| | | 'valid': null, |
| | | 'flagCheck': null, |
| | | }) |
| | | } |
| | | |
| | |
| | | const handleChange = (value, name) => { |
| | | setFormData((prevData) => ({ |
| | | ...prevData, |
| | | [name]: ['locType', 'type'].includes(name) ? value : +value |
| | | [name]: value |
| | | })); |
| | | }; |
| | | |
| | |
| | | const newObj = removeEmptyKeys(value); |
| | | return !_.isEmpty(newObj); |
| | | } |
| | | return !_.isNil(value) && (_.isNumber(value) ? value !== 0 : !_.isEmpty(value)); |
| | | return !_.isNil(value); |
| | | }); |
| | | } |
| | | |
| | | |
| | | const handleSubmit = async () => { |
| | | const parmas = { |
| | | id: selectedIds, |
| | | matnr: removeEmptyKeys(formData) |
| | | ids: selectedIds, |
| | | matnr: { |
| | | ...removeEmptyKeys(formData) |
| | | } |
| | | } |
| | | |
| | | const res = await request.post(`/matnr/modify`, parmas); |
| | | const res = await request.post(`/matnr/batch/update`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | handleClose() |
| | | |
| | |
| | | } |
| | | |
| | | return ( |
| | | <Dialog open={open} maxWidth="md" fullWidth> |
| | | <Dialog open={open} maxWidth="xs" fullWidth> |
| | | <Form onSubmit={handleSubmit}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>{translate('toolbar.batch')}</DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={4}> |
| | | <StatusSelectInput |
| | | onChange={(e) => handleChange(e.target.value, 'status')} |
| | | defaultValue={''} |
| | | require={false} |
| | | /> |
| | | </Grid> |
| | | {fieldType === 'status' && |
| | | <Grid item xs={6}> |
| | | <StatusSelectInput |
| | | onChange={(e) => handleChange(+e.target.value, 'status')} |
| | | defaultValue={''} |
| | | require={false} |
| | | /> |
| | | </Grid> |
| | | } |
| | | {fieldType === 'stockLevel' && |
| | | <Grid item xs={6}> |
| | | <SelectInput |
| | | label="table.field.matnr.stockLevel" |
| | | source="stockLevel" |
| | | onChange={(e) => handleChange(e.target.value, 'stockLevel')} |
| | | choices={[ |
| | | { id: 0, name: ' A' }, |
| | | { id: 1, name: ' B' }, |
| | | { id: 2, name: 'C' }, |
| | | ]} |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | } |
| | | {fieldType === 'validWarn' && |
| | | <Grid item xs={6}> |
| | | <NumberInput |
| | | onChange={(e) => handleChange(e.target.value, 'validWarn')} |
| | | label="table.field.matnr.validWarn" |
| | | source="validWarn" |
| | | /> |
| | | </Grid> |
| | | } |
| | | {fieldType === 'validWarn' && |
| | | <Grid item xs={6}> |
| | | <NumberInput |
| | | onChange={(e) => handleChange(e.target.value, 'valid')} |
| | | label="table.field.matnr.valid" |
| | | source="valid" |
| | | /> |
| | | </Grid> |
| | | } |
| | | {fieldType === 'flagCheck' && |
| | | <Grid item xs={6}> |
| | | <SelectInput |
| | | onChange={(e) => handleChange(e.target.value, 'flagCheck')} |
| | | label="table.field.matnr.flagCheck" |
| | | source="flagCheck" |
| | | choices={[ |
| | | { id: 0, name: ' 否' }, |
| | | { id: 1, name: ' 是' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | } |
| | | </Grid> |
| | | |
| | | </Box> |
| | |
| | | source="valid" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.matnr.flagCheck" |
| | | source="flagCheck" |
| | | choices={[ |
| | | { id: 0, name: ' 否' }, |
| | | { id: 1, name: ' 是' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | </Grid> |
| | | </CustomTabPanel> |
| | | <CustomTabPanel value={value} index={2}> |
| | |
| | | preferenceKey='matnr' |
| | | bulkActionButtons={<> |
| | | <BatchGroupButton /> |
| | | <BatchButton /> |
| | | <BatchStatusButton /> |
| | | <BatchLevelButton /> |
| | | <BindButton /> |
| | | <PrintButton /> |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | |
| | | ) |
| | | } |
| | | |
| | | const BatchButton = () => { |
| | | const BatchStatusButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batch"}> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchStatus"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'status'} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | const BatchLevelButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchStockLevel"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'stockLevel'} |
| | | /> |
| | | </> |
| | | |
| | |
| | | const EditContent = ({ editRecord }) => { |
| | | const { resource } = useCreateContext(); |
| | | const translate = useTranslate(); |
| | | |
| | | const { update } = useFieldArray({ name: "parCode" }) |
| | | const formContext = useFormContext() |
| | | |
| | | const pChange = (val) => { |
| | | if (val > 0) { |
| | |
| | | const http = async (val) => { |
| | | const res = await request.post(`/matnrGroup/page`, { id: val }); |
| | | const code = res.data.data.records[0].code || '' |
| | | editRecord && (editRecord.parCode = code); |
| | | update(code) |
| | | |
| | | formContext.setValue('parCode', code) |
| | | |
| | | } |
| | | return ( |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | |
| | | isTranslate |
| | | resource={resource} |
| | | onChange={(e) => pChange(e.target.value)} |
| | | required |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.matnrGroup.parCode" |
| | | source="parCode" |
| | | value={'11'} |
| | | readOnly |
| | | /> |
| | | </Grid> |
| | |
| | | disableRestoreFocus |
| | | maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' |
| | | > |
| | | <Form record={editRecord} onSubmit={onSubmit}> |
| | | <Form record={editRecord || {}} onSubmit={onSubmit}> |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | |
| | | {expandAll ? translate('common.action.collapseAll') : translate('common.action.expandAll')} |
| | | </Button> |
| | | <TextField |
| | | label="搜索" |
| | | label="搜索名称" |
| | | value={filter} |
| | | onChange={({ target }) => { |
| | | setFilter(target.value) |
| | |
| | | import * as Common from '@/utils/common'; |
| | | import { useFormContext } from 'react-hook-form'; |
| | | |
| | | const TreeSelectInput = ({ resource, onChange, label, source = 'parentId', value, isTranslate = false, ...rest }) => { |
| | | const TreeSelectInput = ({ resource, required, onChange, label, source = 'parentId', value, isTranslate = false, ...rest }) => { |
| | | const translate = useTranslate(); |
| | | const { setValue } = useFormContext(); |
| | | const [filter, setFilter] = React.useState(""); |
| | |
| | | }; |
| | | |
| | | return ( |
| | | <FormControl fullWidth> |
| | | <FormControl fullWidth required={required}> |
| | | <InputLabel>{translate(label)}</InputLabel> |
| | | <Select |
| | | value={proxyVal || ''} |
| | |
| | | const newObj = removeEmptyKeys(value); |
| | | return !_.isEmpty(newObj); |
| | | } |
| | | return !_.isNil(value) && (_.isNumber(value) ? value !== 0 : !_.isEmpty(value)); |
| | | return !_.isNil(value); |
| | | }); |
| | | } |
| | | |
| | | |
| | | const handleSubmit = async () => { |
| | | const parmas = { |
| | | id: selectedIds, |
| | | ...removeEmptyKeys(formData) |
| | | ids: selectedIds, |
| | | warehouseAreas: { |
| | | ...removeEmptyKeys(formData) |
| | | } |
| | | } |
| | | |
| | | const res = await request.post(`/warehouseAreas/modify`, parmas); |
| | | const res = await request.post(`/warehouseAreas/batch/update`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | handleClose() |
| | | |
| | |
| | | {fieldType === 'status' && |
| | | <Grid item xs={6}> |
| | | <StatusSelectInput |
| | | onChange={(e) => handleChange(e.target.value, 'status')} |
| | | onChange={(e) => handleChange(+e.target.value, 'status')} |
| | | defaultValue={''} |
| | | require={false} |
| | | /> |
| | |
| | | "/pda/login", |
| | | "/erp/**", |
| | | "/login", |
| | | "/**/download", |
| | | "/register", |
| | | "/druid/**", |
| | | "/doc.html", |
| | |
| | | @OperationLog("Create loc areas mats") |
| | | @PostMapping("/locAreaMat/save") |
| | | public R save(@RequestBody LocAreaMat locAreaMat) { |
| | | if (Objects.isNull(locAreaMat.getWarehouseId())) { |
| | | return R.error("仓库不能为空!!"); |
| | | } |
| | | if (Objects.isNull(locAreaMat.getAreaId())) { |
| | | return R.error("库区不能为空!!"); |
| | | } |
| | | locAreaMat.setCreateBy(getLoginUserId()); |
| | | locAreaMat.setCreateTime(new Date()); |
| | | locAreaMat.setUpdateBy(getLoginUserId()); |
| | | locAreaMat.setUpdateTime(new Date()); |
| | | if (!locAreaMatService.save(locAreaMat)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | |
| | | if (Objects.isNull(param)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | if (Objects.isNull(param.getAreaId())) { |
| | | throw new CoolException("库区不能为空!!"); |
| | | } |
| | | if (Objects.isNull(param.getWarehouseId())) { |
| | | throw new CoolException("仓库不能为空!!"); |
| | | } |
| | | // if (Objects.isNull(param.getAreaId())) { |
| | | // throw new CoolException("库区不能为空!!"); |
| | | // } |
| | | // if (Objects.isNull(param.getWarehouseId())) { |
| | | // throw new CoolException("仓库不能为空!!"); |
| | | // } |
| | | if (Objects.isNull(param.getAreaMatId())) { |
| | | throw new CoolException("主单ID不能为空!!"); |
| | | } |
| | |
| | | @PostMapping("/matnrGroup/save") |
| | | public R save(@RequestBody MatnrGroup matnrGroup) { |
| | | if (Objects.isNull(matnrGroup)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | |
| | | if (Objects.isNull(matnrGroup.getName())) { |
| | | throw new CoolException("分组名称不能为空!!"); |
| | | return R.error("分组名称不能为空!!"); |
| | | } |
| | | if (Objects.isNull(matnrGroup.getCode())) { |
| | | throw new CoolException("分组编码不能为空!!"); |
| | | return R.error("分组编码不能为空!!"); |
| | | } |
| | | matnrGroup.setCreateBy(getLoginUserId()); |
| | | matnrGroup.setUpdateBy(getLoginUserId()); |
| | |
| | | .eq(!Objects.isNull(matnrGroup.getParCode()), MatnrGroup::getParCode, matnrGroup.getParCode()) |
| | | .eq(MatnrGroup::getCode, matnrGroup.getCode())); |
| | | if (!list.isEmpty()) { |
| | | throw new CoolException("物料分组编码不能重复!!"); |
| | | return R.error("物料分组编码不能重复!!"); |
| | | } |
| | | List<MatnrGroup> groups = matnrGroupService.list(new LambdaQueryWrapper<MatnrGroup>() |
| | | .eq(MatnrGroup::getName, matnrGroup.getName())); |
| | | if (!groups.isEmpty()) { |
| | | throw new CoolException("分组已存在,请勿重复添加!!"); |
| | | return R.error("分组已存在,请勿重复添加!!"); |
| | | } |
| | | //判断上级编码是否为空 |
| | | if (!Objects.isNull(matnrGroup.getParCode()) && !StringUtils.isBlank(matnrGroup.getParCode())) { |
| | |
| | | |
| | | matnrGroup.setUpdateBy(getLoginUserId()); |
| | | MatnrGroup matGroup = matnrGroupService.getById(matnrGroup.getId()); |
| | | if (Objects.isNull(matGroup)) { |
| | | return R.error("物料分组不存在!!"); |
| | | } |
| | | if (!matnrGroup.getName().equals(matGroup.getName())) { |
| | | List<MatnrGroup> areasList = matnrGroupService.list(new LambdaQueryWrapper<MatnrGroup>().eq(MatnrGroup::getName, matnrGroup.getName())); |
| | | if (!areasList.isEmpty()) { |
| | | throw new CoolException("仓库名已存在!!"); |
| | | return R.error("仓库名已存在!!"); |
| | | } |
| | | } |
| | | if (!Objects.isNull(matnrGroup.getCode()) && !matnrGroup.getCode().equals(matGroup.getCode())) { |
| | |
| | | .eq(!Objects.isNull(matnrGroup.getParCode()), MatnrGroup::getParCode, matnrGroup.getParCode()) |
| | | .eq(MatnrGroup::getCode, matnrGroup.getCode())); |
| | | if (!areasList.isEmpty()) { |
| | | throw new CoolException("仓库编码已存在!!"); |
| | | return R.error("仓库编码已存在!!"); |
| | | } |
| | | } |
| | | |
| | | //判断上级编码是否为空 |
| | | if (!Objects.isNull(matnrGroup.getParCode()) && !StringUtils.isBlank(matnrGroup.getParCode())) { |
| | | matnrGroup.setCode(matnrGroup.getParCode() + matnrGroup.getCode()); |
| | | } |
| | | |
| | | if (!matnrGroupService.updateById(matnrGroup)) { |
| | |
| | | @PostMapping("/warehouseAreas/update") |
| | | public R update(@RequestBody WarehouseAreas warehouseAreas) { |
| | | warehouseAreas.setUpdateBy(getLoginUserId()); |
| | | WarehouseAreas areas = warehouseAreasService.getById(warehouseAreas.getWarehouseId()); |
| | | WarehouseAreas areas = warehouseAreasService.getById(warehouseAreas.getId()); |
| | | if (Objects.isNull(areas)) { |
| | | throw new CoolException("数据错误:仓库库区不存在!!"); |
| | | } |
| | |
| | | return null; |
| | | } |
| | | |
| | | public String getSupplier$() { |
| | | public String getSupplierId$() { |
| | | CompanysService service = SpringUtils.getBean(CompanysService.class); |
| | | Companys supplier = service.getById(this.supplierId); |
| | | if (!Cools.isEmpty(supplier)){ |
| | |
| | | LocAreaMatRela locAreaMatRela = new LocAreaMatRela(); |
| | | locAreaMatRela |
| | | .setAreaMatId(param.getAreaMatId()) |
| | | .setAreaId(param.getAreaId()) |
| | | // .setAreaId(param.getAreaId()) |
| | | .setLocId(locId) |
| | | .setLocTypeId(typeId) |
| | | .setMatnrId(matnrId.getId()) |
| | |
| | | throw new CoolException("修改库位信息不能为空!!"); |
| | | } |
| | | |
| | | String join = locs.getLoc().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.getType()), Loc::getType, loc.getType()) |
| | | .set(!Objects.isNull(loc.getType()), 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()) |