From 14466bd111a43a723e0bdbe945c31e3993e7ab60 Mon Sep 17 00:00:00 2001 From: luxiaotao1123 <t1341870251@163.com> Date: 星期三, 18 九月 2024 15:38:39 +0800 Subject: [PATCH] # --- zy-acs-flow/src/i18n/en.js | 14 +++ zy-acs-flow/src/page/loc/LocInit.jsx | 139 +++++++++++++++++++--------------- zy-acs-flow/src/i18n/zh.js | 14 +++ zy-acs-framework/src/main/java/com/zy/acs/framework/common/BaseRes.java | 25 ++++-- zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java | 6 + zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/AuthController.java | 20 ++-- zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/param/LocInitParam.java | 6 + 7 files changed, 141 insertions(+), 83 deletions(-) diff --git a/zy-acs-flow/src/i18n/en.js b/zy-acs-flow/src/i18n/en.js index 8d5d374..c7b3e33 100644 --- a/zy-acs-flow/src/i18n/en.js +++ b/zy-acs-flow/src/i18n/en.js @@ -498,7 +498,19 @@ }, 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', } } }; diff --git a/zy-acs-flow/src/i18n/zh.js b/zy-acs-flow/src/i18n/zh.js index 857726d..f6a2717 100644 --- a/zy-acs-flow/src/i18n/zh.js +++ b/zy-acs-flow/src/i18n/zh.js @@ -497,7 +497,19 @@ }, page: { loc: { - init: '鍒濆鍖�' + init: '鍒濆鍖�', + start: { + row: '寮�濮嬫帓', + bay: '寮�濮嬪垪', + lev: '寮�濮嬪眰', + }, + end: { + row: '缁撴潫鎺�', + bay: '缁撴潫鍒�', + lev: '缁撴潫灞�', + }, + levOffset: '姣忓眰楂樺害', + bottomOffset: '搴曢儴鍋忕Щ閲�', } } }; diff --git a/zy-acs-flow/src/page/loc/LocInit.jsx b/zy-acs-flow/src/page/loc/LocInit.jsx index 503cd2d..d57670b 100644 --- a/zy-acs-flow/src/page/loc/LocInit.jsx +++ b/zy-acs-flow/src/page/loc/LocInit.jsx @@ -1,12 +1,10 @@ import React, { useState, useRef, useEffect, useMemo } from "react"; import { - CreateBase, useTranslate, TextInput, NumberInput, BooleanInput, DateInput, - SaveButton, SelectInput, ReferenceInput, ReferenceArrayInput, @@ -16,7 +14,6 @@ useDataProvider, useNotify, Form, - useCreateController, } from 'react-admin'; import { Dialog, @@ -26,8 +23,11 @@ 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; @@ -41,6 +41,20 @@ } }; + 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 @@ -51,7 +65,7 @@ disableRestoreFocus maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' > - <Form> + <Form onSubmit={onSubmit}> <DialogTitle id="form-dialog-title" sx={{ position: 'sticky', top: 0, @@ -80,56 +94,6 @@ </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" @@ -144,15 +108,68 @@ </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}> @@ -171,7 +188,7 @@ </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> diff --git a/zy-acs-framework/src/main/java/com/zy/acs/framework/common/BaseRes.java b/zy-acs-framework/src/main/java/com/zy/acs/framework/common/BaseRes.java index 8ce046b..cae9ddc 100644 --- a/zy-acs-framework/src/main/java/com/zy/acs/framework/common/BaseRes.java +++ b/zy-acs-framework/src/main/java/com/zy/acs/framework/common/BaseRes.java @@ -2,13 +2,22 @@ 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-鏈嶅姟鍣ㄩ敊璇�"; } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java index 4c307dc..8daf91e 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/LocController.java @@ -2,6 +2,7 @@ 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; @@ -141,13 +142,13 @@ locNo, // 搴撲綅缂栧彿 null, // 鍚嶇О null, // 鏉$爜 - LocStsType.IDLE.val(), // 搴撲綅鐘舵�� + param.getLocSts(), // 搴撲綅鐘舵�� offset, // 鍋忕Щ閲� r, // 鎺� b, // 鍒� l, // 灞� null, // 鎵樼洏鐮� - null, // 搴撲綅绫诲瀷 + param.getLocType(), // 搴撲綅绫诲瀷 null, // 鐘舵�乕闈炵┖] null, // 鏄惁鍒犻櫎[闈炵┖] null, // 绉熸埛 @@ -157,6 +158,7 @@ null, // 淇敼鏃堕棿 null // 澶囨敞 ); + loc.setCompDirect(param.getCompDirect()); if (locService.count(new LambdaQueryWrapper<Loc>().eq(Loc::getLocNo, locNo)) > 0) { throw new CoolException(locNo + " location has exist !"); } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/param/LocInitParam.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/param/LocInitParam.java index dd78a22..4689b06 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/param/LocInitParam.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/manager/controller/param/LocInitParam.java @@ -26,4 +26,10 @@ private Double bottom; + private Integer compDirect; + + private Long locSts; + + private Long locType; + } diff --git a/zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/AuthController.java b/zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/AuthController.java index b107b95..2f4bc83 100644 --- a/zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/AuthController.java +++ b/zy-acs-manager/src/main/java/com/zy/acs/manager/system/controller/AuthController.java @@ -51,18 +51,18 @@ 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") @@ -95,7 +95,7 @@ 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')") @@ -103,22 +103,22 @@ @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("鍘熷瘑鐮佽緭鍏ヤ笉姝g‘"); + 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"); } } -- Gitblit v1.9.1