| | |
| | | }, |
| | | page: { |
| | | loc: { |
| | | init: 'INITIALIZE' |
| | | init: 'INITIALIZE', |
| | | start: { |
| | | row: 'start row', |
| | | bay: 'start bay', |
| | | lev: 'start lev', |
| | | }, |
| | | end: { |
| | | row: 'end row', |
| | | bay: 'end bay', |
| | | lev: 'end lev', |
| | | }, |
| | | levOffset: 'lev offset', |
| | | bottomOffset: 'bottom offset', |
| | | } |
| | | } |
| | | }; |
| | |
| | | }, |
| | | page: { |
| | | loc: { |
| | | init: '初始化' |
| | | init: '初始化', |
| | | start: { |
| | | row: '开始排', |
| | | bay: '开始列', |
| | | lev: '开始层', |
| | | }, |
| | | end: { |
| | | row: '结束排', |
| | | bay: '结束列', |
| | | lev: '结束层', |
| | | }, |
| | | levOffset: '每层高度', |
| | | bottomOffset: '底部偏移量', |
| | | } |
| | | } |
| | | }; |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | CreateBase, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SaveButton, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | |
| | | useDataProvider, |
| | | useNotify, |
| | | Form, |
| | | useCreateController, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | |
| | | Stack, |
| | | Grid, |
| | | Box, |
| | | Button, |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "../components/DialogCloseButton"; |
| | | import CheckIcon from '@mui/icons-material/Check'; |
| | | import request from '@/utils/request' |
| | | |
| | | const LocInit = (props) => { |
| | | const { open, setOpen } = props; |
| | |
| | | } |
| | | }; |
| | | |
| | | const onSubmit = (data) => { |
| | | request.post('/loc/init', { ...data }).then(res => { |
| | | const { code, msg, data } = res.data; |
| | | if (code === 200) { |
| | | setOpen(false); |
| | | notify('common.response.success', { type: 'success' }); |
| | | } else { |
| | | notify(msg, { type: 'error', messageArgs: { _: msg } }); |
| | | } |
| | | }).catch(error => { |
| | | notify(error, { type: 'error', messageArgs: { _: error } }); |
| | | }) |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <Dialog |
| | |
| | | disableRestoreFocus |
| | | maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' |
| | | > |
| | | <Form> |
| | | <Form onSubmit={onSubmit}> |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | |
| | | </ReferenceInput> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.loc.locNo" |
| | | source="locNo" |
| | | parse={v => v} |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <Grid item xs={4} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.loc.row" |
| | | source="row" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={4} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.loc.bay" |
| | | source="bay" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={4} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.loc.lev" |
| | | source="lev" |
| | | /> |
| | | </Grid> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="code" |
| | | reference="code" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.code" |
| | | optionText="data" |
| | | filterToQuery={(val) => ({ data: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.loc.compDirect" |
| | | source="compDirect" |
| | | choices={[ |
| | | { id: 1, name: '大于' }, |
| | | { id: 0, name: '小于' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <ReferenceInput |
| | | source="locSts" |
| | | reference="locSts" |
| | |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.loc.offset" |
| | | source="offset" |
| | | label="page.loc.start.row" |
| | | source="startRow" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.loc.barcode" |
| | | source="barcode" |
| | | parse={v => v} |
| | | <NumberInput |
| | | label="page.loc.end.row" |
| | | source="endRow" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="page.loc.start.bay" |
| | | source="startBay" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="page.loc.end.bay" |
| | | source="endBay" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="page.loc.start.lev" |
| | | source="startLev" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="page.loc.end.lev" |
| | | source="endLev" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="page.loc.levOffset" |
| | | source="levOffset" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="page.loc.bottomOffset" |
| | | source="bottom" |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <SelectInput |
| | | label="table.field.loc.compDirect" |
| | | source="compDirect" |
| | | choices={[ |
| | | { id: 1, name: '大于' }, |
| | | { id: 0, name: '小于' }, |
| | | ]} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > |
| | | <SaveButton /> |
| | | <Button variant="contained" type="submit" startIcon={<CheckIcon />}>{translate('ra.action.confirm')}</Button> |
| | | </Toolbar> |
| | | </DialogActions> |
| | | </Form> |
| | |
| | | |
| | | public interface BaseRes { |
| | | |
| | | String OK = "200-操作成功"; |
| | | String EMPTY = "201-暂无数据"; |
| | | String LIMIT = "202-无权限"; |
| | | String PARAM = "401-参数为空"; |
| | | String DENIED = "403-请重新登录"; |
| | | String REPEAT = "407-已存在"; |
| | | String NO_ACTIVATION = "409-请先激活系统"; |
| | | String ERROR = "500-服务器错误"; |
| | | String OK = "200-Success"; |
| | | String EMPTY = "201-Empty Data"; |
| | | String LIMIT = "202-No Authority"; |
| | | String PARAM = "401-Parameters Cannot Be Empty"; |
| | | String DENIED = "403-Please Re-Login"; |
| | | String REPEAT = "407-Already Exist"; |
| | | String NO_ACTIVATION = "409-Please Activate The System First"; |
| | | String ERROR = "500-Internal Server Error"; |
| | | |
| | | // String OK = "200-操作成功"; |
| | | // String EMPTY = "201-暂无数据"; |
| | | // String LIMIT = "202-无权限"; |
| | | // String PARAM = "401-参数为空"; |
| | | // String DENIED = "403-请重新登录"; |
| | | // String REPEAT = "407-已存在"; |
| | | // String NO_ACTIVATION = "409-请先激活系统"; |
| | | // String ERROR = "500-服务器错误"; |
| | | |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.zy.acs.common.utils.GsonUtils; |
| | | import com.zy.acs.common.utils.Utils; |
| | | import com.zy.acs.framework.common.Cools; |
| | | import com.zy.acs.framework.common.R; |
| | |
| | | locNo, // 库位编号 |
| | | null, // 名称 |
| | | null, // 条码 |
| | | LocStsType.IDLE.val(), // 库位状态 |
| | | param.getLocSts(), // 库位状态 |
| | | offset, // 偏移量 |
| | | r, // 排 |
| | | b, // 列 |
| | | l, // 层 |
| | | null, // 托盘码 |
| | | null, // 库位类型 |
| | | param.getLocType(), // 库位类型 |
| | | null, // 状态[非空] |
| | | null, // 是否删除[非空] |
| | | null, // 租户 |
| | |
| | | null, // 修改时间 |
| | | null // 备注 |
| | | ); |
| | | loc.setCompDirect(param.getCompDirect()); |
| | | if (locService.count(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, locNo)) > 0) { |
| | | throw new CoolException(locNo + " location has exist !"); |
| | | } |
| | |
| | | |
| | | private Double bottom; |
| | | |
| | | private Integer compDirect; |
| | | |
| | | private Long locSts; |
| | | |
| | | private Long locType; |
| | | |
| | | } |
| | |
| | | Long tenantId = param.getTenantId(); |
| | | User user = userService.getByUsername(username, tenantId); |
| | | if (user == null) { |
| | | return R.error("账号不存在"); |
| | | return R.error("Username Does Not Exist"); |
| | | } |
| | | if (!user.getStatus().equals(1)) { |
| | | return R.error("账号被冻结"); |
| | | return R.error("Account Frozen"); |
| | | } |
| | | if (!userService.comparePassword(user.getPassword(), param.getPassword())) { |
| | | return R.error("密码错误"); |
| | | return R.error("Wrong Password"); |
| | | } |
| | | String accessToken = JwtUtil.buildToken(new JwtSubject(username, user.getTenantId()), |
| | | configProperties.getTokenExpireTime(), configProperties.getTokenKey()); |
| | | userLoginService.saveAsync(user.getId(), accessToken, UserLogin.TYPE_LOGIN, tenantId, null, request); |
| | | return R.ok("登录成功").add(new LoginResult(accessToken, user)); |
| | | return R.ok("Login Success").add(new LoginResult(accessToken, user)); |
| | | } |
| | | |
| | | @GetMapping("/auth/user") |
| | |
| | | if (userService.updateById(user)) { |
| | | return R.ok().add(userService.getByIdRel(user.getId())); |
| | | } |
| | | return R.error("保存失败"); |
| | | return R.error("Save Fail"); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('sys:auth:password')") |
| | |
| | | @PutMapping("/auth/password") |
| | | public R updatePassword(@RequestBody UpdatePasswordParam param) { |
| | | if (Cools.isEmpty(param.getOldPassword(), param.getPassword())) { |
| | | return R.error("参数不能为空"); |
| | | return R.error("Parameters Cannot Be Empty"); |
| | | } |
| | | Long userId = getLoginUserId(); |
| | | if (userId == null) { |
| | | return R.error("未登录"); |
| | | return R.error("Please Login First"); |
| | | } |
| | | if (!userService.comparePassword(userService.getById(userId).getPassword(), param.getOldPassword())) { |
| | | return R.error("原密码输入不正确"); |
| | | return R.error("The Origin Password Was Incorrect"); |
| | | } |
| | | User user = new User(); |
| | | user.setId(userId); |
| | | user.setPassword(userService.encodePassword(param.getPassword())); |
| | | if (userService.updateById(user)) { |
| | | return R.ok("修改成功"); |
| | | return R.ok("Update Success"); |
| | | } |
| | | return R.error("修改失败"); |
| | | return R.error("Update Fail"); |
| | | } |
| | | |
| | | } |