| | |
| | | import { Add, Edit, Delete } from '@mui/icons-material'; |
| | | import _ from 'lodash'; |
| | | import { DataGrid } from '@mui/x-data-grid'; |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | // import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | |
| | | |
| | | const BatchModal = ({ open, setOpen, fieldType }) => { |
| | |
| | | "warehouseId": null, |
| | | "areaId": null, |
| | | "type": null, |
| | | 'status': null |
| | | 'useStatus': null |
| | | }); |
| | | |
| | | const { selectedIds, onUnselectItems } = useListContext(); |
| | |
| | | "areaId": null, |
| | | "type": null, |
| | | "typeIds": null, |
| | | 'status': null |
| | | 'useStatus': null |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | const handleSubmit = async () => { |
| | | const locData = removeEmptyKeys(formData) |
| | | // 批量禁用库位 |
| | | if (fieldType === 'status') { |
| | | locData.useStatus = 'X' |
| | | } |
| | | const parmas = { |
| | | id: selectedIds, |
| | | loc: removeEmptyKeys(formData) |
| | | loc: locData |
| | | } |
| | | |
| | | const res = await request.post(`/loc/modify`, parmas); |
| | |
| | | |
| | | {fieldType === 'status' && |
| | | <Grid item xs={6}> |
| | | <StatusSelectInput |
| | | {/* <StatusSelectInput |
| | | onChange={(e) => handleChange(e.target.value, 'status')} |
| | | defaultValue={''} |
| | | require={false} |
| | | /> */} |
| | | <TextField |
| | | label={translate('table.field.loc.useStatus')} |
| | | value={'X(禁用)'} |
| | | size="small" |
| | | fullWidth |
| | | disabled |
| | | /> |
| | | </Grid> |
| | | } |
| | |
| | | |
| | | @Override |
| | | public R modifyLocs(LocModifyParams locs) { |
| | | if (locs.getId().isEmpty()) { |
| | | if (Objects.isNull(locs.getId()) || locs.getId().isEmpty()) { |
| | | throw new CoolException("库位ID不能为空!!"); |
| | | } |
| | | Loc loc = locs.getLoc(); |
| | | |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("修改库位信息不能为空!!"); |
| | | } |
| | | // 兼容旧请求中的状态禁用参数 |
| | | if (Objects.equals(loc.getStatus(), 0) && Objects.isNull(loc.getUseStatus())) { |
| | | loc.setUseStatus("X"); |
| | | // loc.setStatus(0); |
| | | loc.setStatus(null); |
| | | } |
| | | |
| | | List<Loc> exists = this.list(new LambdaQueryWrapper<Loc>().in(Loc::getId, locs.getId())); |
| | | if (exists.isEmpty()) { |
| | | throw new CoolException("未找到可修改的库位信息!!"); |
| | | } |
| | | |
| | | String join = loc.getType(); |
| | |
| | | } |
| | | boolean update = this.update(new LambdaUpdateWrapper<Loc>() |
| | | .in(Loc::getId, locs.getId()) |
| | | .eq(Loc::getStatus, 1) |
| | | // .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.getFlagLabelMange()), Loc::getFlagLabelMange, loc.getFlagLabelMange()) |
| | | .set(!Objects.isNull(loc.getStatus()), Loc::getStatus, loc.getStatus())); |
| | | if (!update) { |
| | | throw new CoolException("库位信息修改失败!!"); |
| | | // 无数据变更时按成功返回,避免重复操作报错 |
| | | return R.ok(loc); |
| | | } |
| | | |
| | | return R.ok(loc); |