Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
# Conflicts:
# rsf-admin/.env
| | |
| | | waitPakinItem: 'WaitPakinItem', |
| | | task: 'Task', |
| | | taskItem: 'TaskItem', |
| | | taskItemLog: 'TaskItemLog', |
| | | taskLog: 'TaskLog', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | startTime: "startTime", |
| | | endTime: "endTime", |
| | | }, |
| | | taskLog: { |
| | | taskId: "taskId", |
| | | taskCode: "taskCode", |
| | | taskStatus: "taskStatus", |
| | | taskType: "taskType", |
| | | orgLoc: "orgLoc", |
| | | orgSite: "orgSite", |
| | | targLoc: "targLoc", |
| | | targSite: "targSite", |
| | | barcode: "barcode", |
| | | robotCode: "robotCode", |
| | | exceStatus: "exceStatus", |
| | | expDesc: "expDesc", |
| | | sort: "sort", |
| | | expCode: "expCode", |
| | | startTime: "startTime", |
| | | endTime: "endTime", |
| | | }, |
| | | taskItem: { |
| | | taskId: "taskId", |
| | | orderId: "orderId", |
| | |
| | | matnrId: "matnrId", |
| | | maktx: "maktx", |
| | | matnrCode: "matnrCode", |
| | | unit: "unit", |
| | | anfme: "anfme", |
| | | batch: "batch", |
| | | spec: "spec", |
| | | model: "model", |
| | | }, |
| | | taskItemLog: { |
| | | taskItemId: "taskItemId", |
| | | taskId: "taskId", |
| | | orderId: "orderId", |
| | | orderType: "orderType", |
| | | orderItemId: "orderItemId", |
| | | source: "source", |
| | | matnrId: "matnrId", |
| | | maktx: "maktx", |
| | | matnrCode: "matnrCode", |
| | | trackCode: "trackCode", |
| | | unit: "unit", |
| | | anfme: "anfme", |
| | | batch: "batch", |
| | |
| | | complete: "complete", |
| | | close: "close", |
| | | asnCreate: "asnCreate", |
| | | createTask: "createTask", |
| | | }, |
| | | }; |
| | | |
| | |
| | | waitPakinItemLog: '组拖历史档明细', |
| | | task: '任务工作档', |
| | | taskItem: '任务档明细', |
| | | taskLog: '任务历史档', |
| | | taskItemLog: '任务明细历史档', |
| | | }, |
| | | table: { |
| | | field: { |
| | |
| | | }, |
| | | warehouseAreas: { |
| | | uuid: "唯一编码", |
| | | name: "名称", |
| | | name: "库区名称", |
| | | wareId: "所属仓库", |
| | | code: "编码", |
| | | code: "库区编码", |
| | | shipperId: "货主", |
| | | supplierId: "供应商", |
| | | flagMinus: "允许负库存", |
| | |
| | | loc: { |
| | | warehouseId: "所属仓库", |
| | | areaId: "所属库区", |
| | | code: "编码", |
| | | code: "库位编码", |
| | | type: "库位类型", |
| | | name: "名称", |
| | | flagLogic: "虚拟库位", |
| | |
| | | startTime: "开始时间", |
| | | endTime: "结束时间", |
| | | }, |
| | | taskLog: { |
| | | taskId: "任务ID", |
| | | taskCode: "任务号", |
| | | taskStatus: "状态", |
| | | taskType: "类型", |
| | | orgLoc: "源库位", |
| | | orgSite: "源站点", |
| | | targLoc: "目标库位", |
| | | targSite: "目标站点", |
| | | barcode: "拖盘码", |
| | | robotCode: "机器编码", |
| | | exceStatus: "执行状态", |
| | | expDesc: "异常说明", |
| | | sort: "优先级", |
| | | expCode: "异常编码", |
| | | startTime: "开始时间", |
| | | endTime: "结束时间", |
| | | }, |
| | | taskItem: { |
| | | taskId: "taskId", |
| | | orderId: "订单ID", |
| | | orderType: "单据类型", |
| | | orderItemId: "订单明细ID", |
| | | sourceCode: "订单号", |
| | | source: "源ID", |
| | | matnrId: "物料ID", |
| | | maktx: "物料名称", |
| | | matnrCode: "物料编码", |
| | | unit: "单位", |
| | | anfme: "数量", |
| | | batch: "批次", |
| | | spec: "规格", |
| | | model: "型号", |
| | | }, |
| | | taskItemLog: { |
| | | taskItemId: "taskItemId", |
| | | taskId: "taskId", |
| | | orderId: "订单ID", |
| | | orderType: "单据类型", |
| | | orderItemId: "订单明细ID", |
| | | source: "源ID", |
| | | matnrId: "物料ID", |
| | | maktx: "物料名称", |
| | | matnrCode: "物料编码", |
| | | trackCode: "跟踪码", |
| | | unit: "单位", |
| | | anfme: "数量", |
| | | batch: "批次", |
| | |
| | | complete: "完成", |
| | | close: "关闭", |
| | | asnCreate: "通过ASN创建", |
| | | createTask: "生成任务", |
| | | }, |
| | | }; |
| | | |
| | |
| | | import asnOrderItemLog from './asnOrderItemLog'; |
| | | import task from './task'; |
| | | import taskItem from './taskItem'; |
| | | import taskLog from './taskLog'; |
| | | import taskItemLog from './taskItemLog'; |
| | | |
| | | |
| | | const ResourceContent = (node) => { |
| | |
| | | return task; |
| | | case 'taskItem': |
| | | return taskItem; |
| | | |
| | | case 'taskLog': |
| | | return taskLog; |
| | | case 'taskItemLog': |
| | | return taskItemLog; |
| | | |
| | | default: |
| | | return { |
| | |
| | | import ConstructionIcon from "@mui/icons-material/Construction"; |
| | | import FileDownloadIcon from '@mui/icons-material/FileDownload'; |
| | | import EditIcon from '@mui/icons-material/Edit'; |
| | | import TaskIcon from '@mui/icons-material/Task'; |
| | | import request from '@/utils/request'; |
| | | |
| | | |
| | |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | |
| | | <TextInput source="code" label="table.field.asnOrder.code" />, |
| | | <TextInput source="poCode" label="table.field.asnOrder.poCode" />, |
| | | <NumberInput source="poId" label="table.field.asnOrder.poId" />, |
| | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const [modalType, setmodalType] = useState(0); |
| | | const [billReload, setBillReload] = useState(null); |
| | | |
| | | const navigate = useNavigate(); |
| | | const assign = (record) => { |
| | |
| | | preferenceKey='asnOrder' |
| | | bulkActionButtons={<> <InspectionsButton /><BulkDeleteButton mutationMode={OPERATE_MODE} /></>} |
| | | rowClick={() => false} |
| | | expand={<AsnOrderPanel />} |
| | | expand={<AsnOrderPanel setBillReload={setBillReload} />} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'poId']} |
| | | > |
| | |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="exceStatus$" label="common.field.status" /> |
| | | {/* <BooleanField source="statusBool" label="common.field.status" sortable={false} /> */} |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt" > |
| | | {/* <Button label="toolbar.print" onClick={print}> |
| | |
| | | > |
| | | </Button> */} |
| | | <InspectionButton /> |
| | | <CompleteButton /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | asnId={modalType} |
| | | billReload={billReload} |
| | | /> |
| | | <PageDrawer |
| | | title='AsnOrder Detail' |
| | |
| | | </Button> |
| | | ) |
| | | } |
| | | |
| | | const CompleteButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const requestComplete = async () => { |
| | | const { data: { code, data, msg } } = await request.post(`/asnOrder/complete/${record.id}`); |
| | | |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh() |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | |
| | | |
| | | return ( |
| | | <Button onClick={requestComplete} label={"toolbar.complete"} color="success"> |
| | | <TaskIcon /> |
| | | </Button> |
| | | ) |
| | | } |
| | |
| | | import DictSelect from "../components/DictSelect"; |
| | | |
| | | const AsnOrderModal = (props) => { |
| | | const { open, setOpen, asnId } = props; |
| | | const { open, setOpen, asnId, billReload } = props; |
| | | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | |
| | | const res = await request.post(`/asnOrder/items/save`, parmas); |
| | | if (res?.data?.code === 200) { |
| | | setOpen(false); |
| | | billReload() |
| | | refresh(); |
| | | } else { |
| | | notify(res.data.msg); |
| | |
| | | if (res?.data?.code === 200) { |
| | | setOpen(false); |
| | | refresh(); |
| | | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | |
| | | import { DataGrid } from '@mui/x-data-grid'; |
| | | import PrintModal from './PrintModal'; |
| | | import { width } from "@mui/system"; |
| | | const AsnOrderPanel = () => { |
| | | const AsnOrderPanel = ({ setBillReload }) => { |
| | | const record = useRecordContext(); |
| | | if (!record) return null; |
| | | const translate = useTranslate(); |
| | |
| | | |
| | | useEffect(() => { |
| | | debouncedHttp({ maktx }); |
| | | setBillReload(http) |
| | | }, [asnId, maktx]); |
| | | |
| | | useEffect(() => { |
| | | setBillReload(http) |
| | | }, []); |
| | | |
| | | |
| | | |
| | | const http = async (parmas) => { |
| | |
| | | notify(res.data.msg); |
| | | } |
| | | } |
| | | |
| | | |
| | | const debouncedHttp = useMemo(() => debounce(http, 300), []); |
| | | |
| | |
| | | }, |
| | | { |
| | | field: 'asnCode', |
| | | headerName: translate('table.field.asnOrderItem.asnCode') |
| | | headerName: translate('table.field.asnOrderItem.asnCode'), |
| | | width: 150, |
| | | }, |
| | | { |
| | | field: 'poDetlId', |
| | |
| | | }, |
| | | { |
| | | field: 'matnrCode', |
| | | headerName: translate('table.field.asnOrderItem.matnrCode') |
| | | headerName: translate('table.field.asnOrderItem.matnrCode'), |
| | | width: 150, |
| | | }, |
| | | { |
| | | field: 'maktx', |
| | |
| | | }, |
| | | { |
| | | field: 'trackCode', |
| | | headerName: translate('table.field.asnOrderItem.barcode') |
| | | headerName: translate('table.field.asnOrderItem.barcode'), |
| | | width: 150 |
| | | }, |
| | | { |
| | | field: 'prodTime', |
| | |
| | | |
| | | |
| | | <Grid item xs={4}> |
| | | <ReferenceArrayInput source="typeIds" reference="dictData" filter={{}}> |
| | | <SelectArrayInput label="table.field.loc.type" onChange={(e) => handleChange(e.target.value, 'typeIds')} validate={[required()]} /> |
| | | <ReferenceArrayInput source="typeIds" reference="locType" > |
| | | <SelectArrayInput label="table.field.loc.type" validate={[required()]} onChange={(e) => handleChange(e.target.value, 'typeIds')} /> |
| | | </ReferenceArrayInput> |
| | | {/* <ReferenceArrayInput source="typeIds" reference="dictData" filter={{}}> |
| | | <SelectArrayInput label="table.field.loc.type" onChange={(e) => handleChange(e.target.value, 'typeIds')} validate={[required()]} /> |
| | | </ReferenceArrayInput> */} |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | |
| | | <ReferenceInput |
| | | source="warehouseId" |
| | | label="table.field.loc.warehouseId" |
| | |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.qlyInspect"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | empty={<EmptyData |
| | | children={ |
| | | <Box sx={{ gap: 2, display: 'flex' }}> |
| | | <AsnCreatButton isInit={true} /> |
| | | </Box> |
| | | } |
| | | onClick={() => { }} />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | |
| | | ) |
| | | } |
| | | |
| | | const AsnCreatButton = () => { |
| | | const AsnCreatButton = ({ isInit }) => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.asnCreate"}> |
| | | <AddIcon /> |
| | | </Button> |
| | | { |
| | | isInit ? <Button onClick={() => setCreateDialog(true)} label={"toolbar.asnCreate"} variant="contained" |
| | | color="primary"> |
| | | <AddIcon /> |
| | | </Button> : <Button onClick={() => setCreateDialog(true)} label={"toolbar.asnCreate"} > |
| | | <AddIcon /> |
| | | </Button> |
| | | } |
| | | |
| | | |
| | | <AsnSelModal |
| | | open={createDialog} |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import request from '@/utils/request'; |
| | | |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useRefresh, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.task"} |
| | | // empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | empty={<EmptyData onClick={() => { }} />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | sort={{ field: "sort", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | |
| | | */ |
| | | const CancelButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const clickCancel = () => { |
| | | cancleTask([record]) |
| | | cancleTask(record) |
| | | }; |
| | | //取消任务 |
| | | const cancleTask = async (row) => {} |
| | | const cancleTask = async (row) => { |
| | | console.log(row); |
| | | const { data: { code, data, msg } } = await request.post(`/task/remove/` + row.id); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh(); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | return ( |
| | | <Button |
| | | onClick={clickCancel} |
| | |
| | | */ |
| | | const SetTopButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const clickTop = () => { |
| | | topTask([record]) |
| | | topTask(record) |
| | | }; |
| | | //置顶任务 |
| | | const topTask = async (row) => { } |
| | | const topTask = async (row) => { |
| | | const { data: { code, data, msg } } = await request.post(`/task/top/` + row.id); |
| | | if (code === 200) { |
| | | notify(msg); |
| | | refresh(); |
| | | } else { |
| | | notify(msg); |
| | | } |
| | | } |
| | | return ( |
| | | <Button |
| | | onClick={clickTop} |
| | |
| | | cancleTask([record]) |
| | | }; |
| | | //取消任务 |
| | | const cancleTask = async (row) => {} |
| | | const cancleTask = async (row) => { } |
| | | return ( |
| | | <Button |
| | | onClick={clickCancel} |
| | |
| | | <SwapVertIcon /> |
| | | </Button> |
| | | ) |
| | | |
| | | } |
| | |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.taskItem"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */} |
| | | <SelectColumnsButton preferenceKey='taskItem' /> |
| | | <MyExportButton /> |
| | | {/* <MyExportButton /> */} |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='taskItem' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | // bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <TaskItemPanel />} |
| | | // expand={() => <TaskItemPanel />} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'taskId', 'orderId', 'orderItemId', 'matnrId']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="taskId" label="table.field.taskItem.taskId" /> |
| | | <NumberField source="orderId" label="table.field.taskItem.orderId" /> |
| | | <NumberField source="orderType" label="table.field.taskItem.orderType" /> |
| | | <NumberField source="orderType$" label="table.field.taskItem.orderType" /> |
| | | <NumberField source="orderItemId" label="table.field.taskItem.orderItemId" /> |
| | | <NumberField source="matnrId" label="table.field.taskItem.matnrId" /> |
| | | <TextField source="maktx" label="table.field.taskItem.maktx" /> |
| | |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <TaskItemCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | <PageDrawer |
| | | title='TaskItem Detail' |
| | | drawerVal={drawerVal} |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | CreateBase, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SaveButton, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | Toolbar, |
| | | required, |
| | | useDataProvider, |
| | | useNotify, |
| | | Form, |
| | | useCreateController, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | | DialogActions, |
| | | DialogContent, |
| | | DialogTitle, |
| | | Stack, |
| | | Grid, |
| | | Box, |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "../components/DialogCloseButton"; |
| | | import StatusSelectInput from "../components/StatusSelectInput"; |
| | | import MemoInput from "../components/MemoInput"; |
| | | |
| | | const TaskItemLogCreate = (props) => { |
| | | const { open, setOpen } = props; |
| | | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | |
| | | const handleSuccess = async (data) => { |
| | | setOpen(false); |
| | | notify('common.response.success'); |
| | | }; |
| | | |
| | | const handleError = async (error) => { |
| | | notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <CreateBase |
| | | record={{}} |
| | | transform={(data) => { |
| | | return data; |
| | | }} |
| | | mutationOptions={{ onSuccess: handleSuccess, onError: handleError }} |
| | | > |
| | | <Dialog |
| | | open={open} |
| | | onClose={handleClose} |
| | | aria-labelledby="form-dialog-title" |
| | | fullWidth |
| | | disableRestoreFocus |
| | | maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' |
| | | > |
| | | <Form> |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | | backgroundColor: 'background.paper', |
| | | zIndex: 1000 |
| | | }} |
| | | > |
| | | {translate('create.title')} |
| | | <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | </Box> |
| | | </DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.taskItemId" |
| | | source="taskItemId" |
| | | autoFocus |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.taskId" |
| | | source="taskId" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.orderId" |
| | | source="orderId" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.orderType" |
| | | source="orderType" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.orderItemId" |
| | | source="orderItemId" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.source" |
| | | source="source" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.matnrId" |
| | | source="matnrId" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.maktx" |
| | | source="maktx" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.matnrCode" |
| | | source="matnrCode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.trackCode" |
| | | source="trackCode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.unit" |
| | | source="unit" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.anfme" |
| | | source="anfme" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.batch" |
| | | source="batch" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.spec" |
| | | source="spec" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.model" |
| | | source="model" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.fieldsIndex" |
| | | source="fieldsIndex" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | | </Grid> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <Stack direction="column" spacing={1} width={'100%'}> |
| | | <MemoInput /> |
| | | </Stack> |
| | | </Grid> |
| | | </Grid> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > |
| | | <SaveButton /> |
| | | </Toolbar> |
| | | </DialogActions> |
| | | </Form> |
| | | </Dialog> |
| | | </CreateBase> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | export default TaskItemLogCreate; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | Edit, |
| | | SimpleForm, |
| | | FormDataConsumer, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | SaveButton, |
| | | Toolbar, |
| | | Labeled, |
| | | NumberField, |
| | | required, |
| | | useRecordContext, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { Stack, Grid, Box, Typography } from '@mui/material'; |
| | | import * as Common from '@/utils/common'; |
| | | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; |
| | | import EditBaseAside from "../components/EditBaseAside"; |
| | | import CustomerTopToolBar from "../components/EditTopToolBar"; |
| | | import MemoInput from "../components/MemoInput"; |
| | | import StatusSelectInput from "../components/StatusSelectInput"; |
| | | |
| | | const FormToolbar = () => { |
| | | const { getValues } = useFormContext(); |
| | | |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'space-between' }}> |
| | | <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | </Toolbar> |
| | | ) |
| | | } |
| | | |
| | | const TaskItemLogEdit = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | return ( |
| | | <Edit |
| | | redirect="list" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | aside={<EditBaseAside />} |
| | | > |
| | | <SimpleForm |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | // validate={(values) => { }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={12} md={8}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.taskItemId" |
| | | source="taskItemId" |
| | | autoFocus |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.taskId" |
| | | source="taskId" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.orderId" |
| | | source="orderId" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.orderType" |
| | | source="orderType" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.orderItemId" |
| | | source="orderItemId" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.source" |
| | | source="source" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.matnrId" |
| | | source="matnrId" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.maktx" |
| | | source="maktx" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.matnrCode" |
| | | source="matnrCode" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.trackCode" |
| | | source="trackCode" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.unit" |
| | | source="unit" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskItemLog.anfme" |
| | | source="anfme" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.batch" |
| | | source="batch" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.spec" |
| | | source="spec" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.model" |
| | | source="model" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskItemLog.fieldsIndex" |
| | | source="fieldsIndex" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | |
| | | </Grid> |
| | | <Grid item xs={12} md={4}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.common')} |
| | | </Typography> |
| | | <StatusSelectInput /> |
| | | <Box mt="2em" /> |
| | | <MemoInput /> |
| | | </Grid> |
| | | </Grid> |
| | | </SimpleForm> |
| | | </Edit > |
| | | ) |
| | | } |
| | | |
| | | export default TaskItemLogEdit; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import TaskItemLogCreate from "./TaskItemLogCreate"; |
| | | import TaskItemLogPanel from "./TaskItemLogPanel"; |
| | | import EmptyData from "../components/EmptyData"; |
| | | import MyCreateButton from "../components/MyCreateButton"; |
| | | import MyExportButton from '../components/MyExportButton'; |
| | | import PageDrawer from "../components/PageDrawer"; |
| | | import MyField from "../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | }, |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <NumberInput source="taskItemId" label="table.field.taskItemLog.taskItemId" />, |
| | | <NumberInput source="taskId" label="table.field.taskItemLog.taskId" />, |
| | | <NumberInput source="orderId" label="table.field.taskItemLog.orderId" />, |
| | | <TextInput source="orderType" label="table.field.taskItemLog.orderType" />, |
| | | <NumberInput source="orderItemId" label="table.field.taskItemLog.orderItemId" />, |
| | | <NumberInput source="source" label="table.field.taskItemLog.source" />, |
| | | <NumberInput source="matnrId" label="table.field.taskItemLog.matnrId" />, |
| | | <TextInput source="maktx" label="table.field.taskItemLog.maktx" />, |
| | | <TextInput source="matnrCode" label="table.field.taskItemLog.matnrCode" />, |
| | | <TextInput source="trackCode" label="table.field.taskItemLog.trackCode" />, |
| | | <TextInput source="unit" label="table.field.taskItemLog.unit" />, |
| | | <NumberInput source="anfme" label="table.field.taskItemLog.anfme" />, |
| | | <TextInput source="batch" label="table.field.taskItemLog.batch" />, |
| | | <TextInput source="spec" label="table.field.taskItemLog.spec" />, |
| | | <TextInput source="model" label="table.field.taskItemLog.model" />, |
| | | <TextInput source="fieldsIndex" label="table.field.taskItemLog.fieldsIndex" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | resettable |
| | | />, |
| | | ] |
| | | |
| | | const TaskItemLogList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.taskItemLog"} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <SelectColumnsButton preferenceKey='taskItemLog' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='taskItemLog' |
| | | bulkActionButtons={false} |
| | | rowClick={(id, resource, record) => false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'taskId', 'orderId', 'orderItemId', 'matnrId']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="taskItemId" label="table.field.taskItemLog.taskItemId" /> |
| | | <NumberField source="taskId" label="table.field.taskItemLog.taskId" /> |
| | | <NumberField source="orderId" label="table.field.taskItemLog.orderId" /> |
| | | <TextField source="orderType" label="table.field.taskItemLog.orderType" /> |
| | | <NumberField source="orderItemId" label="table.field.taskItemLog.orderItemId" /> |
| | | <NumberField source="source" label="table.field.taskItemLog.source" /> |
| | | <NumberField source="matnrId" label="table.field.taskItemLog.matnrId" /> |
| | | <TextField source="maktx" label="table.field.taskItemLog.maktx" /> |
| | | <TextField source="matnrCode" label="table.field.taskItemLog.matnrCode" /> |
| | | <TextField source="trackCode" label="table.field.taskItemLog.trackCode" /> |
| | | <TextField source="unit" label="table.field.taskItemLog.unit" /> |
| | | <NumberField source="anfme" label="table.field.taskItemLog.anfme" /> |
| | | <TextField source="batch" label="table.field.taskItemLog.batch" /> |
| | | <TextField source="spec" label="table.field.taskItemLog.spec" /> |
| | | <TextField source="model" label="table.field.taskItemLog.model" /> |
| | | <TextField source="fieldsIndex" label="table.field.taskItemLog.fieldsIndex" /> |
| | | |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | <PageDrawer |
| | | title='TaskItemLog Detail' |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | </Box> |
| | | ) |
| | | } |
| | | |
| | | export default TaskItemLogList; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; |
| | | import { |
| | | useTranslate, |
| | | useRecordContext, |
| | | } from 'react-admin'; |
| | | import PanelTypography from "../components/PanelTypography"; |
| | | import * as Common from '@/utils/common' |
| | | |
| | | const TaskItemLogPanel = () => { |
| | | const record = useRecordContext(); |
| | | if (!record) return null; |
| | | const translate = useTranslate(); |
| | | return ( |
| | | <> |
| | | <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> |
| | | <CardContent> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> |
| | | <Typography variant="h6" gutterBottom align="left" sx={{ |
| | | maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, |
| | | whiteSpace: 'nowrap', |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | }}> |
| | | {Common.camelToPascalWithSpaces(translate('table.field.taskItemLog.id'))}: {record.id} |
| | | </Typography> |
| | | {/* inherit, primary, secondary, textPrimary, textSecondary, error */} |
| | | <Typography variant="h6" gutterBottom align="right" > |
| | | ID: {record.id} |
| | | </Typography> |
| | | </Grid> |
| | | </Grid> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={12} container alignContent="flex-end"> |
| | | <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> |
| | | {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} |
| | | </Typography> |
| | | </Grid> |
| | | </Grid> |
| | | <Box height={20}> </Box> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.taskItemId" |
| | | property={record.taskItemId} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.taskId" |
| | | property={record.taskId} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.orderId" |
| | | property={record.orderId} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.orderType" |
| | | property={record.orderType} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.orderItemId" |
| | | property={record.orderItemId} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.source" |
| | | property={record.source} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.matnrId" |
| | | property={record.matnrId} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.maktx" |
| | | property={record.maktx} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.matnrCode" |
| | | property={record.matnrCode} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.trackCode" |
| | | property={record.trackCode} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.unit" |
| | | property={record.unit} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.anfme" |
| | | property={record.anfme} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.batch" |
| | | property={record.batch} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.spec" |
| | | property={record.spec} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.model" |
| | | property={record.model} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskItemLog.fieldsIndex" |
| | | property={record.fieldsIndex} |
| | | /> |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | </CardContent> |
| | | </Card > |
| | | </> |
| | | ); |
| | | }; |
| | | |
| | | export default TaskItemLogPanel; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | ListGuesser, |
| | | EditGuesser, |
| | | ShowGuesser, |
| | | } from "react-admin"; |
| | | |
| | | import TaskItemLogList from "./TaskItemLogList"; |
| | | import TaskItemLogEdit from "./TaskItemLogEdit"; |
| | | |
| | | export default { |
| | | list: TaskItemLogList, |
| | | edit: TaskItemLogEdit, |
| | | show: ShowGuesser, |
| | | recordRepresentation: (record) => { |
| | | return `${record.id}` |
| | | } |
| | | }; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | CreateBase, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SaveButton, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | Toolbar, |
| | | required, |
| | | useDataProvider, |
| | | useNotify, |
| | | Form, |
| | | useCreateController, |
| | | } from 'react-admin'; |
| | | import { |
| | | Dialog, |
| | | DialogActions, |
| | | DialogContent, |
| | | DialogTitle, |
| | | Stack, |
| | | Grid, |
| | | Box, |
| | | } from '@mui/material'; |
| | | import DialogCloseButton from "../components/DialogCloseButton"; |
| | | import StatusSelectInput from "../components/StatusSelectInput"; |
| | | import MemoInput from "../components/MemoInput"; |
| | | |
| | | const TaskLogCreate = (props) => { |
| | | const { open, setOpen } = props; |
| | | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | |
| | | const handleSuccess = async (data) => { |
| | | setOpen(false); |
| | | notify('common.response.success'); |
| | | }; |
| | | |
| | | const handleError = async (error) => { |
| | | notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } }); |
| | | }; |
| | | |
| | | return ( |
| | | <> |
| | | <CreateBase |
| | | record={{}} |
| | | transform={(data) => { |
| | | return data; |
| | | }} |
| | | mutationOptions={{ onSuccess: handleSuccess, onError: handleError }} |
| | | > |
| | | <Dialog |
| | | open={open} |
| | | onClose={handleClose} |
| | | aria-labelledby="form-dialog-title" |
| | | fullWidth |
| | | disableRestoreFocus |
| | | maxWidth="md" // 'xs' | 'sm' | 'md' | 'lg' | 'xl' |
| | | > |
| | | <Form> |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | | backgroundColor: 'background.paper', |
| | | zIndex: 1000 |
| | | }} |
| | | > |
| | | {translate('create.title')} |
| | | <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | </Box> |
| | | </DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Grid container rowSpacing={2} columnSpacing={2}> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskLog.taskId" |
| | | source="taskId" |
| | | autoFocus |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskLog.taskCode" |
| | | source="taskCode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskLog.taskStatus" |
| | | source="taskStatus" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskLog.taskType" |
| | | source="taskType" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskLog.orgLoc" |
| | | source="orgLoc" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskLog.orgSite" |
| | | source="orgSite" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskLog.targLoc" |
| | | source="targLoc" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskLog.targSite" |
| | | source="targSite" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskLog.barcode" |
| | | source="barcode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskLog.robotCode" |
| | | source="robotCode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskLog.exceStatus" |
| | | source="exceStatus" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskLog.expDesc" |
| | | source="expDesc" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <NumberInput |
| | | label="table.field.taskLog.sort" |
| | | source="sort" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label="table.field.taskLog.expCode" |
| | | source="expCode" |
| | | parse={v => v} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <DateInput |
| | | label="table.field.taskLog.startTime" |
| | | source="startTime" |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <DateInput |
| | | label="table.field.taskLog.endTime" |
| | | source="endTime" |
| | | /> |
| | | </Grid> |
| | | |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | | <StatusSelectInput /> |
| | | </Grid> |
| | | <Grid item xs={12} display="flex" gap={1}> |
| | | <Stack direction="column" spacing={1} width={'100%'}> |
| | | <MemoInput /> |
| | | </Stack> |
| | | </Grid> |
| | | </Grid> |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Toolbar sx={{ width: '100%', justifyContent: 'space-between' }} > |
| | | <SaveButton /> |
| | | </Toolbar> |
| | | </DialogActions> |
| | | </Form> |
| | | </Dialog> |
| | | </CreateBase> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | export default TaskLogCreate; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | Edit, |
| | | SimpleForm, |
| | | FormDataConsumer, |
| | | useTranslate, |
| | | TextInput, |
| | | NumberInput, |
| | | BooleanInput, |
| | | DateInput, |
| | | SelectInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | SaveButton, |
| | | Toolbar, |
| | | Labeled, |
| | | NumberField, |
| | | required, |
| | | useRecordContext, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { useWatch, useFormContext } from "react-hook-form"; |
| | | import { Stack, Grid, Box, Typography } from '@mui/material'; |
| | | import * as Common from '@/utils/common'; |
| | | import { EDIT_MODE, REFERENCE_INPUT_PAGESIZE } from '@/config/setting'; |
| | | import EditBaseAside from "../components/EditBaseAside"; |
| | | import CustomerTopToolBar from "../components/EditTopToolBar"; |
| | | import MemoInput from "../components/MemoInput"; |
| | | import StatusSelectInput from "../components/StatusSelectInput"; |
| | | |
| | | const FormToolbar = () => { |
| | | const { getValues } = useFormContext(); |
| | | |
| | | return ( |
| | | <Toolbar sx={{ justifyContent: 'space-between' }}> |
| | | <SaveButton /> |
| | | <DeleteButton mutationMode="optimistic" /> |
| | | </Toolbar> |
| | | ) |
| | | } |
| | | |
| | | const TaskLogEdit = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | return ( |
| | | <Edit |
| | | redirect="list" |
| | | mutationMode={EDIT_MODE} |
| | | actions={<CustomerTopToolBar />} |
| | | aside={<EditBaseAside />} |
| | | > |
| | | <SimpleForm |
| | | shouldUnregister |
| | | warnWhenUnsavedChanges |
| | | toolbar={<FormToolbar />} |
| | | mode="onTouched" |
| | | defaultValues={{}} |
| | | // validate={(values) => { }} |
| | | > |
| | | <Grid container width={{ xs: '100%', xl: '80%' }} rowSpacing={3} columnSpacing={3}> |
| | | <Grid item xs={12} md={8}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.main')} |
| | | </Typography> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskLog.taskId" |
| | | source="taskId" |
| | | autoFocus |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskLog.taskCode" |
| | | source="taskCode" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskLog.taskStatus" |
| | | source="taskStatus" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskLog.taskType" |
| | | source="taskType" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskLog.orgLoc" |
| | | source="orgLoc" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskLog.orgSite" |
| | | source="orgSite" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskLog.targLoc" |
| | | source="targLoc" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskLog.targSite" |
| | | source="targSite" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskLog.barcode" |
| | | source="barcode" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskLog.robotCode" |
| | | source="robotCode" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskLog.exceStatus" |
| | | source="exceStatus" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskLog.expDesc" |
| | | source="expDesc" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <NumberInput |
| | | label="table.field.taskLog.sort" |
| | | source="sort" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <TextInput |
| | | label="table.field.taskLog.expCode" |
| | | source="expCode" |
| | | parse={v => v} |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <DateInput |
| | | label="table.field.taskLog.startTime" |
| | | source="startTime" |
| | | /> |
| | | </Stack> |
| | | <Stack direction='row' gap={2}> |
| | | <DateInput |
| | | label="table.field.taskLog.endTime" |
| | | source="endTime" |
| | | /> |
| | | </Stack> |
| | | |
| | | </Grid> |
| | | <Grid item xs={12} md={4}> |
| | | <Typography variant="h6" gutterBottom> |
| | | {translate('common.edit.title.common')} |
| | | </Typography> |
| | | <StatusSelectInput /> |
| | | <Box mt="2em" /> |
| | | <MemoInput /> |
| | | </Grid> |
| | | </Grid> |
| | | </SimpleForm> |
| | | </Edit > |
| | | ) |
| | | } |
| | | |
| | | export default TaskLogEdit; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import TaskLogCreate from "./TaskLogCreate"; |
| | | import TaskLogPanel from "./TaskLogPanel"; |
| | | import EmptyData from "../components/EmptyData"; |
| | | import MyCreateButton from "../components/MyCreateButton"; |
| | | import MyExportButton from '../components/MyExportButton'; |
| | | import PageDrawer from "../components/PageDrawer"; |
| | | import MyField from "../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | }, |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | |
| | | <NumberInput source="taskId" label="table.field.taskLog.taskId" />, |
| | | <TextInput source="taskCode" label="table.field.taskLog.taskCode" />, |
| | | <NumberInput source="taskStatus" label="table.field.taskLog.taskStatus" />, |
| | | <NumberInput source="taskType" label="table.field.taskLog.taskType" />, |
| | | <TextInput source="orgLoc" label="table.field.taskLog.orgLoc" />, |
| | | <TextInput source="orgSite" label="table.field.taskLog.orgSite" />, |
| | | <TextInput source="targLoc" label="table.field.taskLog.targLoc" />, |
| | | <TextInput source="targSite" label="table.field.taskLog.targSite" />, |
| | | <TextInput source="barcode" label="table.field.taskLog.barcode" />, |
| | | <TextInput source="robotCode" label="table.field.taskLog.robotCode" />, |
| | | <NumberInput source="exceStatus" label="table.field.taskLog.exceStatus" />, |
| | | <TextInput source="expDesc" label="table.field.taskLog.expDesc" />, |
| | | <NumberInput source="sort" label="table.field.taskLog.sort" />, |
| | | <TextInput source="expCode" label="table.field.taskLog.expCode" />, |
| | | <DateInput source="startTime" label="table.field.taskLog.startTime" />, |
| | | <DateInput source="endTime" label="table.field.taskLog.endTime" />, |
| | | |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | resettable |
| | | />, |
| | | ] |
| | | |
| | | const TaskLogList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: !!drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.taskLog"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <SelectColumnsButton preferenceKey='taskLog' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='taskLog' |
| | | bulkActionButtons={false} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <TaskLogPanel />} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'taskId', 'robotCode', 'exceStatus', 'sort', 'expCode']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="taskId" label="table.field.taskLog.taskId" /> |
| | | <TextField source="taskCode" label="table.field.taskLog.taskCode" /> |
| | | <NumberField source="taskStatus" label="table.field.taskLog.taskStatus" /> |
| | | <NumberField source="taskType" label="table.field.taskLog.taskType" /> |
| | | <TextField source="orgLoc" label="table.field.taskLog.orgLoc" /> |
| | | <TextField source="orgSite" label="table.field.taskLog.orgSite" /> |
| | | <TextField source="targLoc" label="table.field.taskLog.targLoc" /> |
| | | <TextField source="targSite" label="table.field.taskLog.targSite" /> |
| | | <TextField source="barcode" label="table.field.taskLog.barcode" /> |
| | | <TextField source="robotCode" label="table.field.taskLog.robotCode" /> |
| | | <NumberField source="exceStatus" label="table.field.taskLog.exceStatus" /> |
| | | <TextField source="expDesc" label="table.field.taskLog.expDesc" /> |
| | | <NumberField source="sort" label="table.field.taskLog.sort" /> |
| | | <TextField source="expCode" label="table.field.taskLog.expCode" /> |
| | | <DateField source="startTime" label="table.field.taskLog.startTime" showTime /> |
| | | <DateField source="endTime" label="table.field.taskLog.endTime" showTime /> |
| | | |
| | | <ReferenceField source="updateBy" label="common.field.updateBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime /> |
| | | <ReferenceField source="createBy" label="common.field.createBy" reference="user" link={false} sortable={false}> |
| | | <TextField source="nickname" /> |
| | | </ReferenceField> |
| | | <DateField source="createTime" label="common.field.createTime" showTime /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <DeleteButton sx={{ padding: '1px', fontSize: '.75rem' }} mutationMode={OPERATE_MODE} /> |
| | | </WrapperField> |
| | | </StyledDatagrid> |
| | | </List> |
| | | {/* <TaskLogCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> */} |
| | | <PageDrawer |
| | | title='TaskLog Detail' |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | </Box> |
| | | ) |
| | | } |
| | | |
| | | export default TaskLogList; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { Box, Card, CardContent, Grid, Typography, Tooltip } from '@mui/material'; |
| | | import { |
| | | useTranslate, |
| | | useRecordContext, |
| | | } from 'react-admin'; |
| | | import PanelTypography from "../components/PanelTypography"; |
| | | import * as Common from '@/utils/common' |
| | | |
| | | const TaskLogPanel = () => { |
| | | const record = useRecordContext(); |
| | | if (!record) return null; |
| | | const translate = useTranslate(); |
| | | return ( |
| | | <> |
| | | <Card sx={{ width: { xs: 300, sm: 500, md: 600, lg: 800 }, margin: 'auto' }}> |
| | | <CardContent> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={12} sx={{ display: 'flex', justifyContent: 'space-between' }}> |
| | | <Typography variant="h6" gutterBottom align="left" sx={{ |
| | | maxWidth: { xs: '100px', sm: '180px', md: '260px', lg: '360px' }, |
| | | whiteSpace: 'nowrap', |
| | | overflow: 'hidden', |
| | | textOverflow: 'ellipsis', |
| | | }}> |
| | | {Common.camelToPascalWithSpaces(translate('table.field.taskLog.id'))}: {record.id} |
| | | </Typography> |
| | | {/* inherit, primary, secondary, textPrimary, textSecondary, error */} |
| | | <Typography variant="h6" gutterBottom align="right" > |
| | | ID: {record.id} |
| | | </Typography> |
| | | </Grid> |
| | | </Grid> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={12} container alignContent="flex-end"> |
| | | <Typography variant="caption" color="textSecondary" sx={{ wordWrap: 'break-word', wordBreak: 'break-all' }}> |
| | | {Common.camelToPascalWithSpaces(translate('common.field.memo'))}:{record.memo} |
| | | </Typography> |
| | | </Grid> |
| | | </Grid> |
| | | <Box height={20}> </Box> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.taskId" |
| | | property={record.taskId} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.taskCode" |
| | | property={record.taskCode} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.taskStatus" |
| | | property={record.taskStatus} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.taskType" |
| | | property={record.taskType} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.orgLoc" |
| | | property={record.orgLoc} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.orgSite" |
| | | property={record.orgSite} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.targLoc" |
| | | property={record.targLoc} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.targSite" |
| | | property={record.targSite} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.barcode" |
| | | property={record.barcode} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.robotCode" |
| | | property={record.robotCode} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.exceStatus" |
| | | property={record.exceStatus} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.expDesc" |
| | | property={record.expDesc} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.sort" |
| | | property={record.sort} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.expCode" |
| | | property={record.expCode} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.startTime" |
| | | property={record.startTime$} |
| | | /> |
| | | </Grid> |
| | | <Grid item xs={6}> |
| | | <PanelTypography |
| | | title="table.field.taskLog.endTime" |
| | | property={record.endTime$} |
| | | /> |
| | | </Grid> |
| | | |
| | | </Grid> |
| | | </CardContent> |
| | | </Card > |
| | | </> |
| | | ); |
| | | }; |
| | | |
| | | export default TaskLogPanel; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | ListGuesser, |
| | | EditGuesser, |
| | | ShowGuesser, |
| | | } from "react-admin"; |
| | | |
| | | import TaskLogList from "./TaskLogList"; |
| | | import TaskLogEdit from "./TaskLogEdit"; |
| | | |
| | | export default { |
| | | list: TaskLogList, |
| | | edit: TaskLogEdit, |
| | | show: ShowGuesser, |
| | | recordRepresentation: (record) => { |
| | | return `${record.id}` |
| | | } |
| | | }; |
| | |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | Button, |
| | | useRefresh |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | |
| | | import MyField from "../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import AddIcon from '@mui/icons-material/Add'; |
| | | import request from '@/utils/request'; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='waitPakin' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | bulkActionButtons={<> <CreateTaskButton /> <BulkDeleteButton mutationMode={OPERATE_MODE} /></>} |
| | | rowClick={(id, resource, record) => false} |
| | | expand={() => <WaitPakinPanel />} |
| | | expandSingle={true} |
| | |
| | | } |
| | | |
| | | export default WaitPakinList; |
| | | |
| | | const CreateTaskButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const { selectedIds, onUnselectItems, data } = useListContext(); |
| | | const createTask = async () => { |
| | | const rows = data.filter((item) => selectedIds.includes(item.id)) || []; |
| | | const res = await request.post(`/waitPakin/merge`, rows); |
| | | if (res?.data?.code === 200) { |
| | | refresh() |
| | | notify(res.data.msg); |
| | | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | } |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => createTask()} label={"toolbar.createTask"}> |
| | | <AddIcon /> |
| | | </Button> |
| | | |
| | | |
| | | </> |
| | | |
| | | ) |
| | | } |
| | |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <TextField source="warehouseId" label="table.field.warehouseAreas.wareId" />, |
| | | <ReferenceInput |
| | | source="warehouseId" |
| | | label="table.field.loc.warehouseId" |
| | | reference="warehouse" |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.warehouseId" |
| | | optionText="name" |
| | | filterToQuery={(val) => ({ name: val })} |
| | | /> |
| | | </ReferenceInput>, |
| | | <TextInput source="uuid" label="table.field.warehouseAreas.uuid" />, |
| | | <TextInput source="name" label="table.field.warehouseAreas.name" />, |
| | | <TextInput source="code" label="table.field.warehouseAreas.code" />, |
| | |
| | | title={"menu.warehouseAreas"} |
| | | empty={<EmptyData onClick={() => { setCreateDialog(true) }} />} |
| | | filters={filters} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | sort={{ field: "warehouseId", order: "desc" }} |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | |
| | | preferenceKey='warehouseAreasItem' |
| | | bulkActionButtons={() => <BulkDeleteButton mutationMode={OPERATE_MODE} />} |
| | | rowClick={(id, resource, record) => false} |
| | | omit={['id', 'createTime', 'createBy', 'memo']} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'areaId', 'matnrId']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="areaId" label="table.field.warehouseAreasItem.areaId" /> |
| | |
| | | if (Objects.isNull(params)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return mobileService.publicToStock(params); |
| | | return mobileService.publicToStock(params, getLoginUserId()); |
| | | } |
| | | |
| | | @ApiOperation("获取任务信息") |
| | |
| | | |
| | | @ApiOperation("任务上架") |
| | | @PreAuthorize("hasAuthority('manager:qlyInspect:update')") |
| | | @PostMapping("/task/stock") |
| | | @PostMapping("/task/public/{code}") |
| | | public R taskToLocs(@PathVariable String code) throws Exception { |
| | | if (Objects.isNull(code)) { |
| | | return R.error("参数不能为空!!"); |
| | |
| | | package com.vincent.rsf.server.api.entity.dto; |
| | | |
| | | import com.vincent.rsf.server.manager.entity.Loc; |
| | | import com.vincent.rsf.server.manager.entity.Task; |
| | | import com.vincent.rsf.server.manager.entity.TaskItem; |
| | | import io.swagger.annotations.ApiModel; |
| | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @ApiModel(value = "TaskQueueDto", description = "任务信息") |
| | | public class TaskQueueDto implements Serializable { |
| | | public class TaskQueueDto implements Serializable{ |
| | | |
| | | @ApiModelProperty("任务主单") |
| | | private Task task; |
| | |
| | | public enum OrderType { |
| | | //订单类型 |
| | | ORDER_PURCHASE_IN("purchase", "采购入库单"), |
| | | ORDER_OUT("out", "采购出库单"), |
| | | ORDER_RECEIPT("receipt", "收货") |
| | | ORDER_OUT("out", "出库单"), |
| | | ORDER_IN("in", "入库单"), |
| | | ORDER_RECEIPT("receipt", "收货单"), |
| | | ORDER_PLAT_IN("plat in", "平库入库单"), |
| | | |
| | | ; |
| | | |
| | |
| | | |
| | | R operateToStock(OpStockParams params); |
| | | |
| | | R publicToStock(PublicToStockParams params); |
| | | R publicToStock(PublicToStockParams params, Long loginUserId); |
| | | |
| | | R taskToStock(String code); |
| | | |
| | |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.controller.params.*; |
| | | import com.vincent.rsf.server.api.entity.dto.*; |
| | | import com.vincent.rsf.server.api.entity.enums.OrderType; |
| | | import com.vincent.rsf.server.api.entity.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.api.service.MobileService; |
| | | import com.vincent.rsf.server.common.config.ConfigProperties; |
| | |
| | | import com.vincent.rsf.server.system.mapper.TenantMapper; |
| | | import com.vincent.rsf.server.system.mapper.UserMapper; |
| | | import com.vincent.rsf.server.system.service.FieldsItemService; |
| | | import com.vincent.rsf.server.system.service.FieldsService; |
| | | import com.vincent.rsf.server.system.service.UserLoginService; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | List<ReceiptDetlsDto> receipts = params.getReceipts(); |
| | | List<WarehouseAreasItem> allOrders = new ArrayList<>(); |
| | | |
| | | double receiptQty = receipts.stream().mapToDouble(ReceiptDetlsDto::getReceiptQty).sum(); |
| | | Double receiptQty = receipts.stream().mapToDouble(ReceiptDetlsDto::getReceiptQty).sum(); |
| | | |
| | | String asnCode = receipts.stream().findFirst().get().getAsnCode(); |
| | | |
| | |
| | | if (Objects.isNull(asnOrder)) { |
| | | throw new CoolException("数据错误:主单不存在!!"); |
| | | } |
| | | asnOrder.setQty(receiptQty); |
| | | /**收货数量累加,1. 会出超收情况 2. 会有收货不足情况*/ |
| | | Double rcptedQty = asnOrder.getQty() + receiptQty; |
| | | asnOrder.setQty(rcptedQty); |
| | | |
| | | if (!asnOrderMapper.updateById(asnOrder)) { |
| | | throw new CoolException("已收货数量修改失败!!"); |
| | |
| | | if (!warehouseAreasItemService.saveBatch(allOrders)) { |
| | | throw new CoolException("收货失败!!"); |
| | | } |
| | | |
| | | //获取采购数量 |
| | | double purQty = receipts.stream().mapToDouble(ReceiptDetlsDto::getPurQty).sum(); |
| | | |
| | | BigDecimal subtract = BigDecimal.valueOf(receiptQty).subtract(BigDecimal.valueOf(purQty)); |
| | | //判断已收货数量是否小于等于采购数量 |
| | | if (subtract.compareTo(new BigDecimal("0.0")) <= 0) { |
| | | asnOrder.setRleStatus(Short.valueOf("1")); |
| | | //日志表操作 |
| | | operateOrderLogs(asnOrder); |
| | | } |
| | | |
| | | // //获取采购数量 |
| | | // double purQty = receipts.stream().mapToDouble(ReceiptDetlsDto::getPurQty).sum(); |
| | | // |
| | | // BigDecimal subtract = BigDecimal.valueOf(receiptQty).subtract(BigDecimal.valueOf(purQty)); |
| | | // //判断已收货数量是否小于等于采购数量 |
| | | // if (subtract.compareTo(new BigDecimal("0.0")) <= 0) { |
| | | // asnOrder.setRleStatus(Short.valueOf("1")); |
| | | // //日志表操作 |
| | | // operateOrderLogs(asnOrder); |
| | | // } |
| | | return R.ok("操作成功"); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 删除原主单及明细,加入历史档 |
| | | * @param |
| | | * @return |
| | | * @time 2025/3/19 19:53 |
| | | */ |
| | | private void operateOrderLogs(AsnOrder asnOrder) { |
| | | if (!asnOrderMapper.removeById(asnOrder.getId())) { |
| | | throw new CoolException("原单据删除失败!!"); |
| | | } |
| | | |
| | | AsnOrderLog orderLog = new AsnOrderLog(); |
| | | BeanUtils.copyProperties(asnOrder, orderLog); |
| | | orderLog.setAsnId(asnOrder.getId()); |
| | | |
| | | if (!asnOrderLogService.save(orderLog)) { |
| | | throw new CoolException("主单历史档添加失败!!"); |
| | | } |
| | | |
| | | List<AsnOrderItemLog> logs = new ArrayList<>(); |
| | | List<AsnOrderItem> items = asnOrderItemMapper.selectList(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, asnOrder.getId())); |
| | | items.forEach(item -> { |
| | | AsnOrderItemLog itemLog = new AsnOrderItemLog(); |
| | | BeanUtils.copyProperties(item, itemLog); |
| | | itemLog.setAsnItemId(itemLog.getId()) |
| | | .setAsnId(item.getAsnId()); |
| | | logs.add(itemLog); |
| | | }); |
| | | |
| | | if (!asnOrderItemLogService.saveBatch(logs)) { |
| | | throw new CoolException("通知单明细历史档保存失败!!"); |
| | | } |
| | | |
| | | if (asnOrderItemMapper.delete(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, asnOrder.getId())) < 1) { |
| | | throw new CoolException("原单据明细删除失败!!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | |
| | | if (!waitPakins.isEmpty()) { |
| | | throw new CoolException("拖盘已使用!!"); |
| | | } |
| | | List<AsnOrderItem> orderItems = asnOrderItemMapper.selectList(new LambdaQueryWrapper<AsnOrderItem>() |
| | | AsnOrderItem orderItems = asnOrderItemMapper.selectOne(new LambdaQueryWrapper<AsnOrderItem>() |
| | | .eq(AsnOrderItem::getAsnId, asnOrders.getId()) |
| | | .eq(AsnOrderItem::getMatnrCode, params.getMatnrCode())); |
| | | if (orderItems.isEmpty()) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | if (Objects.isNull(orderItems)) { |
| | | return R.ok(null); |
| | | } |
| | | List<AsnOrderItem> stocks = new ArrayList<>(); |
| | | orderItems.forEach(item -> { |
| | | item.setBarcode(params.getBarcode()); |
| | | stocks.add(item); |
| | | }); |
| | | return R.ok(stocks); |
| | | orderItems.setBarcode(params.getBarcode()); |
| | | |
| | | return R.ok(orderItems); |
| | | } |
| | | |
| | | /** |
| | | * 人工上架入库 |
| | | * |
| | | * @param params |
| | | * @param loginUserId |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R publicToStock(PublicToStockParams params) { |
| | | public R publicToStock(PublicToStockParams params, Long loginUserId) { |
| | | if (Objects.isNull(params.getLocCode()) || StringUtils.isBlank(params.getLocCode())) { |
| | | throw new CoolException("库位不能为空!!"); |
| | | } |
| | |
| | | throw new CoolException("单据明细不能为空!!"); |
| | | } |
| | | Long OrderId = params.getItemList().stream().findFirst().get().getAsnId(); |
| | | AsnOrder order = asnOrderMapper.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getId, OrderId)); |
| | | /**获取平库订单*/ |
| | | AsnOrder order = asnOrderMapper.getOne(new LambdaQueryWrapper<AsnOrder>() |
| | | .eq(AsnOrder::getId, OrderId) |
| | | .eq(AsnOrder::getType, OrderType.ORDER_PLAT_IN.type)); |
| | | if (Objects.isNull(order)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | |
| | | stock.setAsnId(OrderId).setAsnCode(order.getCode()); |
| | | if (!Objects.isNull(order.getPoCode()) && StringUtils.isNotBlank(order.getPoCode())) { |
| | | Purchase purchase = purchaseService.getOne(new LambdaQueryWrapper<Purchase>().eq(Purchase::getCode, order.getPoCode())); |
| | | stock.setPlatOrderNo(purchase.getPlatCode()).setPlatToken(purchase.getPlatId()); |
| | | if (!Objects.isNull(purchase)) { |
| | | stock.setPlatOrderNo(purchase.getPlatCode()).setPlatToken(purchase.getPlatId()); |
| | | } |
| | | } |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | |
| | | if (!stockService.save(stock)) { |
| | | throw new CoolException("库存保存失败!!"); |
| | | } |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getBarcode, params.getLocCode())); |
| | | Loc loc = locService.getOne(new LambdaQueryWrapper<Loc>().eq(Loc::getCode, params.getLocCode())); |
| | | if (Objects.isNull(loc)) { |
| | | throw new CoolException("库位不存在!!"); |
| | | } |
| | |
| | | stockItem.setAsnItemId(orderItem.getId()) |
| | | .setBarcode(orderItem.getBarcode()) |
| | | .setLocId(loc.getId()) |
| | | .setUpdateBy(loginUserId) |
| | | .setId(null) |
| | | .setStockId(stock.getId()); |
| | | stockItems.add(stockItem); |
| | |
| | | throw new CoolException("拖盘任务不存在!!"); |
| | | } |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().eq(TaskItem::getTaskId, task.getId())); |
| | | if (!taskItems.isEmpty()) { |
| | | if (taskItems.isEmpty()) { |
| | | throw new CoolException("拖盘任务明细不存在!!"); |
| | | } |
| | | TaskQueueDto queueDto = new TaskQueueDto(); |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_ispt_histories"; |
| | | generator.table="man_task_item_log"; |
| | | generator.tableDesc="任务工作档"; |
| | | generator.packagePath="com.vincent.rsf.server.manager"; |
| | | |
| | |
| | | } |
| | | return R.ok(asnOrderService.batchUpdate(params, getLoginUserId())); |
| | | } |
| | | |
| | | @ApiOperation("一键收货") |
| | | @PostMapping("/asnOrder/complete/{id}") |
| | | @PreAuthorize("hasAuthority('manager:asnOrder:update')") |
| | | public R completeOrder(@PathVariable Long id) { |
| | | if (Objects.isNull(id)) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | return asnOrderService.completeOrder(id, getLoginUserId()); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<StockItem> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(StockItem::getMatnrk, condition); |
| | | wrapper.like(StockItem::getMaktx, condition); |
| | | } |
| | | stockItemService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getMatnrk())) |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getMaktx())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.entity.enums.TaskStsType; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | if (Objects.isNull(ids) || ids.length < 1) { |
| | | return R.error("参数不能为空!!"); |
| | | } |
| | | List<TaskItem> list = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getTaskId, ids)); |
| | | if (!list.isEmpty()) { |
| | | return R.error("有明细列表存在 !!"); |
| | | List<Long> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().in(Task::getId, ids).in(Task::getTaskStatus, longs)); |
| | | if (tasks.isEmpty()) { |
| | | throw new CoolException("任务已处执行状态不可取消!!"); |
| | | } |
| | | if (!taskService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | if (!taskItemService.remove(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getTaskId, ids))) { |
| | | return R.error("Details delete Failed"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | |
| | | ExcelUtil.build(ExcelUtil.create(taskService.list(), Task.class), response); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:update')") |
| | | @ApiOperation("完成任务") |
| | | @GetMapping("/task/complete/{id}") |
| | | @PostMapping("/task/complete/{id}") |
| | | public R completeTask(@PathVariable String id) { |
| | | if (Objects.isNull(id)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | // return taskService.completeTask(id); |
| | | return null; |
| | | List<Long> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getId, id).in(Task::getTaskStatus, longs)); |
| | | if (tasks.isEmpty()) { |
| | | throw new CoolException("任务已处执行状态不可一键完成!!"); |
| | | } |
| | | try { |
| | | taskService.completeTask(tasks); |
| | | } catch (Exception ex) { |
| | | return R.error("任务异常,无法完成!!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:task:update')") |
| | | @ApiOperation("任务出库置顶") |
| | | @PostMapping("/task/top/{id}") |
| | | public R setTop(@PathVariable String id) { |
| | | if (Objects.isNull(id)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | List<Long> longs = Arrays.asList(TaskStsType.GENERATE_IN.id, TaskStsType.GENERATE_OUT.id); |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getId, id).in(Task::getTaskStatus, longs)); |
| | | if (tasks.isEmpty()) { |
| | | throw new CoolException("任务已处执行状态不可一键置顶!!"); |
| | | } |
| | | try { |
| | | if (!taskService.update(new LambdaUpdateWrapper<Task>().set(Task::getSort, 100).eq(Task::getId, id))) { |
| | | throw new CoolException("置顶失败!!"); |
| | | } |
| | | } catch (Exception ex) { |
| | | return R.error("任务异常,无法完成!!"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getExceStatus$() { |
| | | if (Cools.isEmpty(this.exceStatus)){ |
| | | return ""; |
| | | } |
| | | DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); |
| | | DictData dictData = dictDataService.getOne(new LambdaQueryWrapper<DictData>().eq(DictData::getDictTypeCode, DictTypeCode.DICT_ASN_EXCE_STATUS).eq(DictData::getValue, this.exceStatus)); |
| | | if (Objects.isNull(dictData)) { |
| | | return null; |
| | | } |
| | | return dictData.getLabel(); |
| | | } |
| | | |
| | | public String getType$(){ |
| | | if (Cools.isEmpty(this.type)){ |
| | | return ""; |
| | |
| | | * 物料标识 |
| | | */ |
| | | @ApiModelProperty(value= "物料标识") |
| | | private String matnrId; |
| | | private Long matnrId; |
| | | |
| | | /** |
| | | * 物料编码 |
| | |
| | | |
| | | public AsnOrderItem() {} |
| | | |
| | | public AsnOrderItem(Long asnId,String asnCode,Long poDetlId, String matnrCode, String poCode,String matnrId,String matnk,Double anfme,String stockUnit,Double purQty,String purUnit,Double qty,String splrCode,String splrName,String qrcode,String barcode,String packName,Integer status, Integer ntyStatus,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { |
| | | public AsnOrderItem(Long asnId,String asnCode,Long poDetlId, String matnrCode, String poCode,Long matnrId,String matnk,Double anfme,String stockUnit,Double purQty,String purUnit,Double qty,String splrCode,String splrName,String qrcode,String barcode,String packName,Integer status, Integer ntyStatus,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { |
| | | this.asnId = asnId; |
| | | this.asnCode = asnCode; |
| | | this.poDetlId = poDetlId; |
| | |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 冻结 ") |
| | | private Integer status; |
| | | |
| | | @ApiModelProperty("执行状态") |
| | | private Short exceStatus; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | |
| | | * 物料编码 |
| | | */ |
| | | @ApiModelProperty(value= "物料编码") |
| | | private String code; |
| | | private String matnrCode; |
| | | |
| | | |
| | | @ApiModelProperty(value = "通知单明细标识") |
| | |
| | | * 名称 |
| | | */ |
| | | @ApiModelProperty(value= "名称") |
| | | private String matnrk; |
| | | private String maktx; |
| | | |
| | | /** |
| | | * 数量 |
| | |
| | | this.stockId = stockId; |
| | | this.matnrId = matnrId; |
| | | this.asnItemId = asnItemId; |
| | | this.code = code; |
| | | this.matnrk = matnrk; |
| | | this.matnrCode = code; |
| | | this.maktx = matnrk; |
| | | this.anfme = anfme; |
| | | this.workQty = workQty; |
| | | this.qty = qty; |
| | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("man_task") |
| | | @ApiModel(value = "Task", description = "任务档") |
| | | public class Task implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.server.system.constant.DictTypeCode; |
| | | import com.vincent.rsf.server.system.entity.DictData; |
| | | import com.vincent.rsf.server.system.service.DictDataService; |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | import java.util.Objects; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("man_task_item") |
| | | @ApiModel(value = "TaskItem", description = "任务档明细") |
| | | public class TaskItem implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getOrderType$(){ |
| | | if (null == this.orderType) {return null;} |
| | | DictDataService dictDataService = SpringUtils.getBean(DictDataService.class); |
| | | DictData dictDatas = dictDataService.getOne(new LambdaQueryWrapper<DictData>() |
| | | .eq(DictData::getDictTypeCode, DictTypeCode.DICT_SYS_ORDER_TYPE) |
| | | .eq(DictData::getValue, this.orderType)); |
| | | if (Objects.isNull(dictDatas) || Objects.isNull(dictDatas.getLabel())) { |
| | | return null; |
| | | } |
| | | return dictDatas.getLabel(); |
| | | } |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("man_task_item_log") |
| | | public class TaskItemLog implements Serializable { |
| | | |
| | |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | | |
| | | import lombok.experimental.Accessors; |
| | | import org.springframework.format.annotation.DateTimeFormat; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.Date; |
| | |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("man_task_log") |
| | | public class TaskLog implements Serializable { |
| | | |
| | |
| | | */ |
| | | @Scheduled(cron = "0 0/05 * * * ? ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void genAsnOrder() { |
| | | public synchronized void genAsnOrder() { |
| | | //判断是否开启自动生成ASN单据 |
| | | if (!flowProperties.getFlagAutoAsn()) { |
| | | return; |
| | |
| | | .setPurUnit(item.getUnit()) |
| | | .setMatnrCode(matnr.getCode()) |
| | | .setMaktx(matnr.getName()) |
| | | .setMatnrId(matnr.getId() + ""); |
| | | .setMatnrId(matnr.getId()); |
| | | orderItems.add(orderItem); |
| | | }); |
| | | if (!asnOrderItemService.saveBatch(orderItems)) { |
| | |
| | | @Autowired |
| | | private TaskItemService taskItemService; |
| | | @Autowired |
| | | private TaskLogService taskLogService; |
| | | @Autowired |
| | | private TaskItemLogService taskItemLogService; |
| | | @Autowired |
| | | private StockItemService stockItemService; |
| | | @Autowired |
| | | private PurchaseService purchaseService; |
| | |
| | | } |
| | | taskService.completeTask(tasks); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 已完成任务加入历史档 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/3 12:54 |
| | | */ |
| | | @Scheduled(cron = "0 0/05 * * * ? ") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void taskLogUpdate() { |
| | | List<Task> tasks = taskService.list(new LambdaQueryWrapper<Task>().eq(Task::getTaskStatus, TaskStsType.UPDATED_IN.id)); |
| | | if (tasks.isEmpty()) { |
| | | return; |
| | | } |
| | | List<Long> list = tasks.stream().map(Task::getId).collect(Collectors.toList()); |
| | | List<TaskItem> taskItems = taskItemService.list(new LambdaQueryWrapper<TaskItem>().in(TaskItem::getTaskId, list)); |
| | | if (taskItems.isEmpty()) { |
| | | return; |
| | | } |
| | | List<TaskLog> taskLogs = new ArrayList<>(); |
| | | tasks.forEach(task -> { |
| | | TaskLog taskLog = new TaskLog(); |
| | | BeanUtils.copyProperties(task, taskLog); |
| | | taskLog.setTaskId(task.getId()).setId(null); |
| | | taskLogs.add(taskLog); |
| | | }); |
| | | if (!taskLogService.saveBatch(taskLogs)) { |
| | | throw new CoolException("任务历史档保存失败!!"); |
| | | } |
| | | List<TaskItemLog >itemLogs = new ArrayList<>(); |
| | | taskItems.forEach(item -> { |
| | | TaskItemLog itemLog = new TaskItemLog(); |
| | | BeanUtils.copyProperties(item, itemLog); |
| | | itemLog.setId(null).setTaskItemId(item.getId()); |
| | | itemLogs.add(itemLog); |
| | | }); |
| | | if (!taskItemLogService.saveBatch(itemLogs)) { |
| | | throw new CoolException("任务明细历史档保存失败!!"); |
| | | } |
| | | if (!taskService.removeByIds(list)) { |
| | | throw new CoolException("原始任务删除失败!!"); |
| | | } |
| | | List<Long> itemIds = taskItems.stream().map(TaskItem::getId).collect(Collectors.toList()); |
| | | |
| | | if (!taskItemService.removeByIds(itemIds)) { |
| | | throw new CoolException("原始任务明细删除失败!!"); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | |
| | | boolean batchUpdate(BatchUpdateParam params, Long loginUserId); |
| | | |
| | | R completeOrder(Long id, Long loginUserId); |
| | | } |
| | |
| | | import com.vincent.rsf.server.manager.controller.params.AsnOrderAndItemsParams; |
| | | import com.vincent.rsf.server.manager.controller.params.BatchUpdateParam; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItem; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderItemLog; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrderLog; |
| | | import com.vincent.rsf.server.manager.mapper.AsnOrderMapper; |
| | | import com.vincent.rsf.server.manager.entity.AsnOrder; |
| | | import com.vincent.rsf.server.manager.mapper.PurchaseMapper; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemLogService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderLogService; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.mapper.SerialRuleMapper; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private PurchaseMapper purchaseMapper; |
| | | @Autowired |
| | | private AsnOrderItemService asnOrderItemService; |
| | | @Autowired |
| | | private AsnOrderLogService asnOrderLogService; |
| | | @Autowired |
| | | private AsnOrderItemLogService asnOrderItemLogService; |
| | | @Resource |
| | | private SerialRuleMapper serialRuleMapper; |
| | | |
| | |
| | | .set(!Objects.isNull(order.getWkType()), AsnOrder::getWkType, order.getWkType()) |
| | | .set(!Objects.isNull(order.getExceStatus()), AsnOrder::getExceStatus, order.getExceStatus()) |
| | | .set(AsnOrder::getUpdateBy, userId)); |
| | | } |
| | | |
| | | /** |
| | | * @param id |
| | | * @param loginUserId |
| | | * @return |
| | | * @author Ryan |
| | | * @description 一键收货 |
| | | * @time 2025/4/3 15:45 |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R completeOrder(Long id, Long loginUserId) { |
| | | AsnOrder asnOrder = this.getById(id); |
| | | if (Objects.isNull(asnOrder)) { |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | //一键加入历史档 |
| | | try { |
| | | operateOrderLogs(asnOrder); |
| | | } catch (Exception e) { |
| | | throw new CoolException("收货完成失败!!"); |
| | | } |
| | | return R.ok("收货成功!!"); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 删除原主单及明细,加入历史档 |
| | | * @param |
| | | * @return |
| | | * @time 2025/3/19 19:53 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | private void operateOrderLogs(AsnOrder asrder) throws Exception{ |
| | | if (Objects.isNull(asrder) || Objects.isNull(asrder.getId())) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | AsnOrder order = this.getById(asrder.getId()); |
| | | AsnOrderLog orderLog = new AsnOrderLog(); |
| | | order.setExceStatus(Short.valueOf("2")); |
| | | BeanUtils.copyProperties(order, orderLog); |
| | | orderLog.setId(null); |
| | | orderLog.setAsnId(order.getId()); |
| | | |
| | | if (!this.saveOrUpdate(order)) { |
| | | throw new CoolException("状态修改失败!!"); |
| | | } |
| | | if (!asnOrderLogService.save(orderLog)) { |
| | | throw new CoolException("主单历史档添加失败!!"); |
| | | } |
| | | List<AsnOrderItemLog> logs = new ArrayList<>(); |
| | | List<AsnOrderItem> items = asnOrderItemService.list(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, order.getId())); |
| | | items.forEach(item -> { |
| | | AsnOrderItemLog itemLog = new AsnOrderItemLog(); |
| | | BeanUtils.copyProperties(item, itemLog); |
| | | itemLog.setAsnItemId(itemLog.getId()) |
| | | .setAsnId(item.getAsnId()); |
| | | logs.add(itemLog); |
| | | }); |
| | | |
| | | if (!asnOrderItemLogService.saveBatch(logs)) { |
| | | throw new CoolException("通知单明细历史档保存失败!!"); |
| | | } |
| | | if (!asnOrderItemService.remove(new LambdaQueryWrapper<AsnOrderItem>().eq(AsnOrderItem::getAsnId, order.getId()))) { |
| | | throw new CoolException("原单据明细删除失败!!"); |
| | | } |
| | | if (!this.removeById(asrder.getId())) { |
| | | throw new CoolException("原单据删除失败!!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.controller.params.IsptOrderParam; |
| | |
| | | throw new CoolException("明细保存失败!!"); |
| | | } |
| | | } |
| | | if (!asnOrderService.update(new LambdaUpdateWrapper<AsnOrder>().in(AsnOrder::getId, param.getIds()).set(AsnOrder::getNtyStatus, 1))) { |
| | | throw new CoolException("报检状态修改失败!!"); |
| | | } |
| | | return R.ok("保存成功!!"); |
| | | } |
| | | } |
| | |
| | | Stock stock = new Stock(); |
| | | if (!Objects.isNull(order.getPoCode()) && StringUtils.isNotBlank(order.getPoCode())) { |
| | | Purchase purchase = purchaseService.getOne(new LambdaQueryWrapper<Purchase>().eq(Purchase::getCode, order.getPoCode())); |
| | | stock.setPlatOrderNo(purchase.getPlatCode()).setPlatToken(purchase.getPlatId()); |
| | | if (!Objects.isNull(purchase)) { |
| | | stock.setPlatOrderNo(purchase.getPlatCode()).setPlatToken(purchase.getPlatId()); |
| | | } |
| | | } |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | |
| | | if (!locService.update(new LambdaUpdateWrapper<Loc>().set(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type).in(Loc::getCode, locCodes))) { |
| | | throw new CoolException("库位状态修改失败!!"); |
| | | } |
| | | if (!this.update(new LambdaUpdateWrapper<Task>().set(Task::getTaskStatus, TaskStsType.UPDATED_IN.id))) { |
| | | throw new CoolException("任务状态修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | .setUnit(item.getStockUnit()) |
| | | .setFieldsIndex(item.getFieldsIndex()) |
| | | .setUnit(item.getStockUnit()) |
| | | .setMatnrId(StringUtils.isNotBlank(item.getMatnrId()) ? Long.parseLong(item.getMatnrId()) : null) |
| | | .setMatnrId(item.getMatnrId()) |
| | | .setMaktx(item.getMaktx()) |
| | | .setMatnrCode(item.getMatnrCode()); |
| | | for (PakinItem waitPakinItem : waitPakin.getItems()) { |
| | |
| | | */ |
| | | public final static String DICT_INSPECT_RESULT = "sys_inspect_result"; |
| | | |
| | | /** |
| | | * ASN订单执行状态 |
| | | */ |
| | | public final static String DICT_ASN_EXCE_STATUS = "sys_asn_exce_status"; |
| | | |
| | | } |
| | |
| | | matching-strategy: ANT_PATH_MATCHER |
| | | datasource: |
| | | driver-class-name: com.mysql.jdbc.Driver |
| | | # url: jdbc:mysql://192.168.4.24:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | url: jdbc:mysql://192.168.4.24:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | username: root |
| | | url: jdbc:mysql://localhost:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # url: jdbc:mysql://localhost:3306/rsf?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai |
| | | # username: rsf |
| | | |
| | | password: 34821015 |