From 92a30abbdc9f65cb1a45a65e39cbfd3f6b52461e Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期三, 21 五月 2025 14:06:26 +0800 Subject: [PATCH] Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop --- rsf-admin/src/page/outWork/outBound/locItemInfoModal.jsx | 28 ++---- rsf-admin/src/page/outWork/outBound/StaSelect.jsx | 70 +++++++++++++++++ rsf-admin/src/page/outWork/outBound/OutBoundList.jsx | 132 +++++++++++++++++++++++++------- rsf-admin/src/i18n/zh.js | 1 rsf-server/src/main/java/com/vincent/rsf/server/common/domain/PageParam.java | 8 + 5 files changed, 190 insertions(+), 49 deletions(-) diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js index c12402d..c00e157 100644 --- a/rsf-admin/src/i18n/zh.js +++ b/rsf-admin/src/i18n/zh.js @@ -218,6 +218,7 @@ outSta: '鍑哄簱绔�', outQty: '鍑哄簱鏁伴噺', anfme: '鏁伴噺', + createTask: '鐢熸垚浠诲姟', }, basContainer: { diff --git a/rsf-admin/src/page/outWork/outBound/OutBoundList.jsx b/rsf-admin/src/page/outWork/outBound/OutBoundList.jsx index 6afcfcd..0be7f8f 100644 --- a/rsf-admin/src/page/outWork/outBound/OutBoundList.jsx +++ b/rsf-admin/src/page/outWork/outBound/OutBoundList.jsx @@ -57,12 +57,18 @@ import request from '@/utils/request'; import LocItemInfoModal from "./locItemInfoModal"; import { Delete } from '@mui/icons-material'; +import _, { set } from 'lodash'; +import StaSelect from "./StaSelect"; const OutBoundList = () => { const [createDialog, setCreateDialog] = useState(false); const [tabelData, setTableData] = useState([]); const [selectedRows, setSelectedRows] = useState([]); + const [sta,setSta] = useState([ + + ]) + const notify = useNotify(); const tableRef = useRef(); tableRef.current = useGridApiRef(); const translate = useTranslate(); @@ -71,6 +77,19 @@ const newTableData = _.filter(tabelData, (item) => !selectedRows.includes(item.matnrId)); setTableData(newTableData); } + + // 娣诲姞涓�涓鐞嗘柊鏁版嵁鐨勫嚱鏁帮紝璁剧疆outQty榛樿鍊� + const handleSetData = (newData) => { + // 涓烘柊娣诲姞鐨勬暟鎹缃畂utQty榛樿鍊间负anfme鐨勫�� + const dataWithDefaultQty = newData.map(item => ({ + ...item, + outQty: item.outQty || item.anfme // 濡傛灉outQty宸插瓨鍦ㄥ垯淇濈暀锛屽惁鍒欎娇鐢╝nfme鐨勫�� + })); + setTableData([...tabelData, ...dataWithDefaultQty]); + }; + + + return ( <> <Card sx={{ p: 2, mb: 2, mt:2}}> @@ -88,37 +107,42 @@ onClick={() => setCreateDialog(true)} > {translate('table.field.outBound.withdrawal')} - </Button> - <ConfirmButton - label={'鍒犻櫎'} - variant="outlined" - color="error" - onConfirm={handleDeleteItem} - /> + </Button> </Stack> </Box> </Grid> </Grid> </Card> - <Card sx={{ p: 2, mb: 2, mt:2}}> - <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> - <Grid container spacing={2}> - <Grid item md={2}> - <Box sx={{ display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 1 }}> - <Typography width={100} vvariant="h6" gutterBottom> + <Card sx={{ p: 2, mb: 2}}> + <Form> + <Grid container spacing={2}> + <Grid item xs={12}> + <Box sx={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', gap: 1 }}> + <Typography width={100} vvariant="h6" gutterBottom> {translate('table.field.outBound.outSta')} - </Typography> - <DictSelect - label={translate("table.field.outStock.wkType")} - variant="filled" - group='2' - dictTypeCode="sys_business_type" - required + </Typography> + <Stack direction='row' spacing={2} minWidth={200}> + <StaSelect + source="sta" + label={translate("table.field.outBound.outSta")} + onChange={(e) => { + setSta(e.target.value); + console.log("绔欑偣宸查�夋嫨:", e.target.value); + }} + size="small" + type="1" /> - </Box> - </Grid> - </Grid> - </Box> + </Stack> + <Stack direction='row' spacing={2} minWidth={200}> + <SubmitButton + sta={sta} + data={tabelData} + /> + </Stack> + </Box> + </Grid> + </Grid> + </Form> </Card> <Card sx={{ mb: 2}}> <Box sx={{ }}> @@ -129,7 +153,7 @@ open={createDialog} setOpen={setCreateDialog} data={tabelData} - setData={setTableData} + setData={handleSetData} /> </> @@ -137,6 +161,54 @@ } export default OutBoundList; + +const SubmitButton = (props) =>{ + const translate = useTranslate(); + const notify = useNotify(); + const { sta, data } = props; + const check = ()=>{ + if(sta === ""){ + notify("璇烽�夋嫨绔欑偣"); + return; + } + if(data.length === 0){ + notify("璇烽�夋嫨鐗╂枡"); + return; + } + http(sta,data); + + } + const http = async (sta,data) => { + console.log("鎻愪氦鏁版嵁",sta,data); + } + return ( + <Button + variant="contained" + color="primary" + onClick={check} + > + {translate('table.field.outBound.createTask')} + </Button> + ) + +} + + +const BulkResortButton = () => { + const record = useRecordContext(); + const bulkResort = () => { + resortTask([record]) + }; + //鎵归噺鎺掑簭 + const resortTask = async (row) => { } + return ( + <Button + onClick={bulkResort} + label="toolbar.resort"> + <SwapVertIcon /> + </Button> + ) +} const ModalTable = ({ tabelData, setTableData, selectedRows, setSelectedRows, tableRef }) => { @@ -146,9 +218,10 @@ const [columns, setColumns] = useState([ { field: 'outQty', - headerName: translate('table.field.outBound.outQty'), + headerName: translate('table.field.outBound.outQty')+"*", width: 100, - editable: true, + editable: true, + headerClassName: "custom", }, { field: 'anfme', @@ -201,7 +274,6 @@ cdata.current = tabelData }, [tabelData]); - const getDynamicFields = async () => { const { data: { code, data, msg }, @@ -222,14 +294,14 @@ const handleDelete = (row) => { - const newData = _.filter(cdata.current, (item) => item.matnrId !== row.matnrId); + const newData = _.filter(cdata.current, (item) => item.id !== row.id); setTableData(newData); }; const processRowUpdate = (newRow, oldRow) => { const rows = tabelData.map((r) => - r.matnrId === newRow.matnrId ? { ...newRow } : r + r.id === newRow.id ? { ...newRow } : r ) setTableData(rows) return newRow; diff --git a/rsf-admin/src/page/outWork/outBound/StaSelect.jsx b/rsf-admin/src/page/outWork/outBound/StaSelect.jsx new file mode 100644 index 0000000..3a60e1c --- /dev/null +++ b/rsf-admin/src/page/outWork/outBound/StaSelect.jsx @@ -0,0 +1,70 @@ +import EditIcon from '@mui/icons-material/Edit'; +import { useState, useEffect } from 'react'; +import { + Button, useListContext, SelectInput, + required, SelectArrayInput, + useTranslate, useNotify, + SelectArrayInputClasses +} from 'react-admin'; +import request from '@/utils/request'; + +const StaSelect = (props) => { + const { + type , + name, + multiple = false, + perPage = 100, // 榛樿姣忛〉鏄剧ず100鏉℃暟鎹� + page = 1, // 榛樿绗竴椤� + ...parmas + } = props; + const translate = useTranslate(); + const notify = useNotify(); + const [list, setList] = useState([]); + const [loading, setLoading] = useState(false); + + useEffect(() => { + http(); + }, [type, page, perPage]); + + const http = async () => { + setLoading(true); + try { + const res = await request.post('/deviceSite/page', { + type: type, + current: page, + pageSize: perPage + }); + + if (res?.data?.code === 200) { + setList(res.data.data.records.map((item) => { + return { + id: item.site, + name: item.site + } + })); + } else { + notify(res.data.msg); + } + } catch (error) { + notify('鍔犺浇绔欑偣澶辫触', 'error'); + console.error('鍔犺浇绔欑偣澶辫触:', error); + } finally { + setLoading(false); + } + }; + + const InputComponent = multiple ? SelectArrayInput : SelectInput; + + return ( + <SelectInput + source={name} + choices={list} + isLoading={loading} + optionValue='id' + optionText='name' + {...parmas} + /> + ); +}; + +export default StaSelect; \ No newline at end of file diff --git a/rsf-admin/src/page/outWork/outBound/locItemInfoModal.jsx b/rsf-admin/src/page/outWork/outBound/locItemInfoModal.jsx index 6e3d3bc..22de8aa 100644 --- a/rsf-admin/src/page/outWork/outBound/locItemInfoModal.jsx +++ b/rsf-admin/src/page/outWork/outBound/locItemInfoModal.jsx @@ -44,15 +44,12 @@ }; const reset = () => { - setFormData({ - name: '', - code: '', - groupId: 0 + setFormData({ }) } const handleSubmit = () => { - const hasarr = data.map(el => +el.matnrId) + const hasarr = data.map(el => +el.id) const selectedData = selectedRows.filter(item => !hasarr.includes(item)).map(id => (tableData.find(row => row.id === id))); const value = selectedData.map((el => { const dynamicFields = dyFields.reduce((acc, item) => { @@ -60,15 +57,12 @@ return acc; }, {}); return { - matnrId: el.id, - maktx: el.name, - matnrCode: el.code, - stockUnit: el.stockUnit || '', - purUnit: el.purchaseUnit || '', + ...el, + outQty: el.anfme, // 璁剧疆outQty榛樿鍊间负anfme鐨勫�� ...dynamicFields } })) - setData([...data, ...value]); + setData([...value]); setOpen(false); reset(); }; @@ -120,18 +114,18 @@ <Grid container spacing={2}> <Grid item md={4}> <TextField - label={translate('table.field.matnr.name')} - name="name" - value={formData.name} + label={translate('table.field.locItem.maktx')} + name="maktx" + value={formData.maktx} onChange={handleChange} size="small" /> </Grid> <Grid item md={4}> <TextField - label={translate('table.field.matnr.code')} - name="code" - value={formData.code} + label={translate('table.field.locItem.matnrCode')} + name="matnrCode" + value={formData.matnrCode} onChange={handleChange} size="small" /> diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/common/domain/PageParam.java b/rsf-server/src/main/java/com/vincent/rsf/server/common/domain/PageParam.java index b513578..01bb3f2 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/common/domain/PageParam.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/common/domain/PageParam.java @@ -82,7 +82,9 @@ Map<String, Object> map = where.getMap(); for (String key : map.keySet()) { Object val = map.get(key); - + if (Cools.isEmpty(val)){ + continue; + } if (key.contains("Range")) { ArrayList<String> list = null; if (val instanceof ArrayList) { @@ -175,7 +177,9 @@ Map<String, Object> map = where.getMap(); for (String key : map.keySet()) { Object val = map.get(key); - + if (Cools.isEmpty(val)){ + continue; + } if (key.contains("Range")) { ArrayList<String> list = null; if (val instanceof ArrayList) { -- Gitblit v1.9.1