| | |
| | | |
| | | export const LOGIN_BACKGROUND = 'media'; // image | media |
| | | |
| | | export const CUSTOM_PAGES_DATA_INTERVAL = 1000; |
| | | export const CUSTOM_PAGES_DATA_INTERVAL = 1000; |
| | | |
| | | export const DEFAULT_TYPE = 15; //默认效率优化 15:效率优化 16:先进先出 |
| | |
| | | main: 'Main', |
| | | common: 'Common', |
| | | changePwd: 'Change Password', |
| | | insuffInventory: 'Insufficient inventory' |
| | | }, |
| | | side: { |
| | | title: 'More Info' |
| | |
| | | recover: "recover", |
| | | createWave: "Create Wave", |
| | | order: 'Orders', |
| | | |
| | | modiftySite: 'Modify SiteNo', |
| | | }, |
| | | request: { |
| | | error: { |
| | |
| | | main: '主要', |
| | | common: '通用', |
| | | changePwd: '重置密码', |
| | | insuffInventory: '库存不足' |
| | | }, |
| | | side: { |
| | | title: '更多' |
| | |
| | | }, |
| | | waveRule: { |
| | | code: "编码", |
| | | type: "波次类型", |
| | | type: "出库策略", |
| | | name: "名称", |
| | | }, |
| | | } |
| | |
| | | publicWorking: '下发执行', |
| | | createWave: "生成波次", |
| | | recover: "继续收货", |
| | | modiftySite: '修改库口', |
| | | }, |
| | | request: { |
| | | error: { |
| | |
| | | const SelectMatnrs = () => { |
| | | const { selectedIds, data, isPending, onUnselectItems } = useListContext(); |
| | | const clickMatnrs = () => { |
| | | console.log(selectedIds); |
| | | onUnselectItems() |
| | | } |
| | | |
| | |
| | | ]); |
| | | |
| | | const handleInput = (value) => { |
| | | console.log(value); |
| | | setSearchVal(value); |
| | | }; |
| | | |
| | |
| | | }; |
| | | |
| | | useEffect(() => { |
| | | console.log(selAll); |
| | | |
| | | const setAllChecked = (nodes, checked) => { |
| | | nodes.forEach((node) => { |
| | | node.checked = !checked; |
| | |
| | | const ImportButton = (props) => { |
| | | const [modalOpen, setModalOpen] = useState(false); |
| | | const { selectedIds } = useListContext(); |
| | | console.log(selectedIds) |
| | | const handleOpenModal = () => { |
| | | setModalOpen(true); |
| | | }; |
| | |
| | | ...prevData, |
| | | [name]: value |
| | | })); |
| | | console.log(formData); |
| | | }; |
| | | |
| | | const resetData = () => { |
| | |
| | | } = await request.post("companys/page", parmas); |
| | | if (code === 200) { |
| | | setFormData(data.records) |
| | | console.log(data.records) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | |
| | | } = await request.post("companys/page", parmas); |
| | | if (code === 200) { |
| | | setFormData(data.records) |
| | | console.log(data.records) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | |
| | | }; |
| | | |
| | | |
| | | const handleSelectionChange = (ids) => { |
| | | console.log(ids); |
| | | |
| | | const handleSelectionChange = (ids) => { |
| | | setSelectedRows(ids) |
| | | |
| | | }; |
| | |
| | | rowClick={(id, resource, record) => false} |
| | | expand={false} |
| | | expandSingle={true} |
| | | omit={['id', 'createTime', 'createBy', 'platId', 'platCode', 'memo', 'startTime', 'endTime', 'updateBy', 'createTime']} |
| | | omit={['id', 'createTime', 'createBy', 'platId', 'platCode', 'memo', 'startTime','qty', 'endTime', 'updateBy', 'createTime']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <TextField source="code" label="table.field.delivery.code" /> |
| | |
| | | <TextField source="wkType$" label="table.field.delivery.wkType" /> |
| | | <TextField source="source" label="table.field.delivery.source" /> |
| | | <NumberField source="anfme" label="table.field.delivery.anfme" /> |
| | | <NumberField source="workQty" label="table.field.delivery.workQty" /> |
| | | <NumberField source="workQty" label="table.field.delivery.qty" /> |
| | | <NumberField source="qty" label="table.field.delivery.qty" /> |
| | | <TextField source="platCode" label="table.field.delivery.platCode" /> |
| | | <DateField source="startTime" label="table.field.delivery.startTime" showTime /> |
| | |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | Toolbar, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | |
| | | <CreateByOrderButton setCreateDialog={setCreateDialog} /> |
| | | <MyCreateButton onClick={() => { setManualDialog(true); setmodalType(0) }} /> |
| | | <SelectColumnsButton preferenceKey='outStock' /> |
| | | <ImportButton value={'outStock'} /> |
| | | {/* <MyExportButton /> */} |
| | | <ImportButton value={'outStockItem'} /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | |
| | | } |
| | | |
| | | return ( |
| | | record.exceStatus == 10 ? <ConfirmButton label={"toolbar.publicWorking"} startIcon={<AddTaskIcon />} onConfirm={taskEvent} size={"small"} /> : <></> |
| | | record.workQty < record.anfme ? <Button label={"toolbar.publicWorking"} startIcon={<AddTaskIcon />} onClick={taskEvent} size={"small"} /> : <></> |
| | | ) |
| | | } |
| | |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | Toolbar, |
| | | Button, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | |
| | | const [params, setParams] = useState({}); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | |
| | | import { Box, Card, Grid, LinearProgress, Select, MenuItem, ListItemText, Tooltip, IconButton } from "@mui/material"; |
| | | import { Box, Card, Grid, LinearProgress, Select, MenuItem, ListItemText } from "@mui/material"; |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | List, |
| | |
| | | useRefresh, |
| | | useRedirect, |
| | | } from 'react-admin'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE, DEFAULT_TYPE } from '@/config/setting'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import { DataGrid, useGridApiContext, GridActionsCellItem, useGridApiRef } from '@mui/x-data-grid'; |
| | | import request from '@/utils/request'; |
| | |
| | | import CloseSharpIcon from '@mui/icons-material/CloseSharp'; |
| | | import ConfirmButton from '../../components/ConfirmButton'; |
| | | import { Delete, Edit, Add } from '@mui/icons-material'; |
| | | import OutStockSiteDialog from "./OutStockSiteDialog"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | }, |
| | | '& .column-maktx': { |
| | | width: 200 |
| | | }, |
| | | '& .RaBulkActionsToolbar-toolbar': { |
| | | display: 'none' |
| | | } |
| | | })); |
| | | |
| | | })); |
| | | |
| | | const OutStockPublic = (props) => { |
| | | const { record, open, setOpen } = props; |
| | | const notify = useNotify(); |
| | | const gridRef = useGridApiRef(); |
| | | const [rows, setRows] = useState({}); |
| | | const [rows, setRows] = useState([]); |
| | | const translate = useTranslate(); |
| | | const [selectedIds, setSelectedIds] = React.useState([]); |
| | | const [selectedIds, setSelectedIds] = useState([]); |
| | | const [formData, setFormData] = useState({ |
| | | orderId: record?.id |
| | | orderId: record?.id, |
| | | waveId: DEFAULT_TYPE |
| | | }); |
| | | const [dialog, setDialog] = useState(false); |
| | | const [selectedValue, setSelectedValue] = useState({}); |
| | | |
| | | const handleClickOpen = () => { |
| | | setDialog(true); |
| | | }; |
| | | |
| | | const handleClose = (value) => { |
| | | setDialog(false); |
| | | setSelectedValue(value); |
| | | const newRows = rows.map(item => { |
| | | return selectedIds.includes(item?.id) ? { |
| | | ...item, |
| | | siteNo: value?.site |
| | | } : item |
| | | }) |
| | | setRows(newRows); |
| | | }; |
| | | |
| | | useEffect(() => { |
| | | getWaveRule() |
| | | }, [formData, open]) |
| | | if (open) { |
| | | getWaveRule() |
| | | } |
| | | }, [open, formData]) |
| | | |
| | | const getWaveRule = async () => { |
| | | if (formData.waveId == null && formData.waveId == undefined) { |
| | | return |
| | | } |
| | | const { data: { code, data, msg } } = await request.post('/outStock/order/getOutTaskItems', { ...formData }); |
| | | |
| | | if (code === 200) { |
| | | setRows(data) |
| | | } else { |
| | |
| | | <AutocompleteInput |
| | | label="table.field.waveRule.type" |
| | | onChange={(e) => handleChange(e, 'waveId')} |
| | | defaultValue={15} |
| | | value={formData.type} |
| | | validate={required()} |
| | | /> |
| | |
| | | /> |
| | | <StyledDatagrid |
| | | preferenceKey='outStockItem' |
| | | bulkActionButtons={false} |
| | | bulkActionButtons={<></>} |
| | | rowClick={false} |
| | | omit={['id', 'splrName', 'qty', 'poCode', 'workQty']} |
| | | > |
| | |
| | | <Grid item xl={6.3} gap={2}> |
| | | <Card> |
| | | <Box sx={{ height: 500, width: '100%' }}> |
| | | <PreviewTable rows={rows} gridRef={gridRef} setRows={setRows} record={record}/> |
| | | <PreviewTable |
| | | rows={rows} |
| | | gridRef={gridRef} |
| | | setRows={setRows} |
| | | record={record} |
| | | formData={formData} |
| | | selectedIds={selectedIds} |
| | | setDialog={setDialog} |
| | | setSelectedIds={setSelectedIds} |
| | | /> |
| | | </Box> |
| | | <Box sx={{ textAlign: 'center' }}> |
| | | <CloseButton setOpen={setOpen} /> |
| | | <SubmitButton selectedIds={selectedIds} setSelectedIds={setSelectedIds} gridRef={gridRef} record={record}/> |
| | | <SubmitButton selectedIds={selectedIds} setSelectedIds={setSelectedIds} gridRef={gridRef} record={record} /> |
| | | </Box> |
| | | </Card> |
| | | </Grid> |
| | | </Grid> |
| | | <Grid> |
| | | <OutStockSiteDialog |
| | | selectedValue={selectedValue} |
| | | open={dialog} |
| | | onClose={handleClose} |
| | | /> |
| | | </Grid> |
| | | </Box> |
| | | </> |
| | | ); |
| | | } |
| | | |
| | | const PreviewTable = ({ rows, gridRef, setRows, record }) => { |
| | | const PreviewTable = ({ rows, gridRef, setRows, record, selectedIds, setSelectedIds, setDialog, formData }) => { |
| | | gridRef.current = useGridApiRef(); |
| | | const translate = useTranslate(); |
| | | |
| | | const columns = [ |
| | | { field: 'id', headerName: 'ID', width: 40 }, |
| | | useEffect(() => { |
| | | if (selectedIds.length > 0) { |
| | | console.log(selectedIds); |
| | | } |
| | | }, [selectedIds]) |
| | | |
| | | |
| | | const baseColumns = [ |
| | | // { field: 'id', headerName: 'ID', width: 40 }, |
| | | { field: 'locCode', headerName: '库位', width: 110 }, |
| | | { field: 'barcode', headerName: '容器', width: 120 }, |
| | | { field: 'matnrCode', headerName: '物料编码', width: 120 }, |
| | | { field: 'batch', headerName: '批次', width: 90 }, |
| | | { field: 'unit', headerName: '单位', width: 90 }, |
| | | { field: 'outQty', headerName: '本次出库数量', width: 110 }, |
| | | { field: 'unit', headerName: '单位', width: 60 }, |
| | | { field: 'outQty', headerName: '出库数量', width: 110, }, |
| | | { |
| | | field: 'anfme', headerName: '库存数量', width: 110, |
| | | renderCell: (params) => ( |
| | | <OutStockAnfme value={params.value} /> |
| | | ) |
| | | }, |
| | | { |
| | | field: 'siteNo', |
| | | headerName: '出库口', |
| | |
| | | <OutStockSite {...params} /> |
| | | ), |
| | | }, |
| | | { |
| | | field: 'actions', |
| | | type: 'actions', |
| | | headerName: '操作', |
| | | with: 120, |
| | | getActions: (params) => [ |
| | | <GridActionsCellItem |
| | | icon={<Delete />} |
| | | label="Delete" |
| | | onClick={() => handleDelete(params.row, rows, setRows)} |
| | | />, |
| | | ] |
| | | }, |
| | | ] |
| | | |
| | | const optAction = { |
| | | field: 'actions', |
| | | type: 'actions', |
| | | headerName: translate('common.field.opt'), |
| | | with: 120, |
| | | getActions: (params) => [ |
| | | <GridActionsCellItem |
| | | icon={<Delete />} |
| | | label="Delete" |
| | | onClick={() => handleDelete(params.row, rows, setRows)} |
| | | />, |
| | | ] |
| | | } |
| | | |
| | | const columns = (formData.waveId == 15 || formData.waveId == 16) ? [...baseColumns] : [...baseColumns, optAction]; |
| | | |
| | | /** |
| | | * 删除事件 |
| | | * @param {*} params |
| | | */ |
| | | const handleDelete = (params, rows, setRows) => { |
| | | const outRows = rows.filter(row => { |
| | | return row.id !== params.id |
| | | const outRows = rows.filter(row => { |
| | | return row.id !== params.id |
| | | }) |
| | | setRows(outRows) |
| | | } |
| | | |
| | | const OutStockAnfme = React.memo(function OutStockAnfme(props) { |
| | | const { value } = props; |
| | | return ( |
| | | value > 0 ? |
| | | <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> |
| | | <span>{value}</span> |
| | | </Box> |
| | | : |
| | | <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> |
| | | <span style={{ color: 'red' }}>{translate('common.edit.title.insuffInventory')}</span> |
| | | </Box> |
| | | ); |
| | | }); |
| | | |
| | | const OutStockSiteNo = React.memo(function OutStockSiteNo(props) { |
| | | const { value } = props; |
| | |
| | | return null; |
| | | } |
| | | return ( |
| | | <Box |
| | | sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }} |
| | | > |
| | | <Box sx={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}> |
| | | <span>{value}</span> |
| | | </Box> |
| | | ); |
| | | }); |
| | | |
| | | const CustomToolBar = () => { |
| | | const selectSiteNo = () => { |
| | | setDialog(true) |
| | | } |
| | | return ( |
| | | <Box sx={{ |
| | | p: 1, |
| | | display: 'flex', |
| | | justifyContent: 'flex-end', |
| | | borderTop: '1px solid rgba(224, 224, 224, 1)' |
| | | }}> |
| | | <Button |
| | | onClick={selectSiteNo} |
| | | variant="outlined" |
| | | label="toolbar.modiftySite" |
| | | size="medium" |
| | | sx={{ mr: 1 }} /> |
| | | </Box> |
| | | ); |
| | | } |
| | | |
| | | const OutStockSite = (params) => { |
| | | const { id, field, siteNo, row: { staNos } } = params; |
| | |
| | | <DataGrid |
| | | rows={rows} |
| | | columns={columns} |
| | | slots={{ toolbar: CustomToolBar }} |
| | | apiRef={gridRef} |
| | | initialState={{ |
| | | pagination: { |
| | | paginationModel: { |
| | | pageSize: 15, |
| | | }, |
| | | }, |
| | | }} |
| | | checkboxSelection |
| | | pageSizeOptions={[15, 25, 35, 45]} |
| | | disableRowSelectionOnClick |
| | | hideFooterPagination={true} // 隐藏分页控件 |
| | | hideFooter={false} |
| | | onRowSelectionModelChange={(ids) => { |
| | | setSelectedIds(ids) |
| | | }} |
| | |
| | | ) |
| | | } |
| | | |
| | | |
| | | |
| | | //提交按钮 |
| | | const SubmitButton = ({ selectedIds, setSelectedIds, gridRef, record }) => { |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | const redirect = useRedirect(); |
| | | const submit = async () => { |
| | | console.log(record); |
| | | const items = gridRef.current?.getSortedRows(); |
| | | const { data: { code, data, msg } } = await request.post('/outStock/generate/tasks', { items, outId: record?.id }); |
| | | if (code == 200) { |
| | |
| | | ...prevData, |
| | | [name]: value |
| | | })); |
| | | console.log(formData); |
| | | }; |
| | | |
| | | const resetData = () => { |
| | |
| | | } = await request.post("companys/page", parmas); |
| | | if (code === 200) { |
| | | setFormData(data.records) |
| | | console.log(data.records) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | |
| | | } = await request.post("companys/page", parmas); |
| | | if (code === 200) { |
| | | setFormData(data.records) |
| | | console.log(data.records) |
| | | } else { |
| | | notify(msg); |
| | | } |
| | |
| | | const { open, setOpen } = props; |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_in_stock_type')) || []; |
| | | const business = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type'))?.filter(data => (data.group == '1')) || []; |
| | | console.log(business); |
| | | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | |
| | |
| | | const DetailButton = (setEditDialog) => { |
| | | const record = useRecordContext(); |
| | | const editClick = (event) => { |
| | | console.log('--========--->'); |
| | | event.stopPropagation() |
| | | setEditDialog(true) |
| | | } |
| | |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='task' |
| | | bulkActionButtons={false |
| | | // <> |
| | | // <BulkResortButton /> |
| | | // <BulkCancelButton /> |
| | | // <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | | // </> |
| | | } |
| | | bulkActionButtons={false} |
| | | rowClick={false} |
| | | expand={<TaskPanel />} |
| | | expandSingle={true} |
| | |
| | | }; |
| | | //取消任务 |
| | | const cancleTask = async (row) => { |
| | | console.log(row); |
| | | const { data: { code, data, msg } } = await request.post(`/task/remove/` + row.id); |
| | | if (code === 200) { |
| | | notify(msg); |
| | |
| | | setOpen(false); |
| | | } |
| | | }; |
| | | console.log(source); |
| | | return ( |
| | | <Box> |
| | | <Dialog |
| | |
| | | label={translate("table.field.outBound.checkSta")} |
| | | onChange={(e) => { |
| | | setSta(e.target.value); |
| | | console.log("站点已选择:", e.target.value); |
| | | }} |
| | | size="small" |
| | | type="[107]" |
| | |
| | | label={translate("table.field.outBound.outSta")} |
| | | onChange={(e) => { |
| | | setSta(e.target.value); |
| | | console.log("站点已选择:", e.target.value); |
| | | }} |
| | | size="small" |
| | | type="[101,103]" |
| | |
| | | http(sta, data); |
| | | } |
| | | const http = async (sta, items) => { |
| | | console.log(items); |
| | | // const filZores = items.filter(item => item.outQty <= 0.0); |
| | | // const filter = items.filter(item => (item.outQty + item.workQty) > item.anfme); |
| | | // if (filter.length > 0 || filZores.length > 0) { |
| | |
| | | } |
| | | |
| | | }) |
| | | console.log(newData); |
| | | setTarLocList(newData); |
| | | } |
| | | |
| | |
| | | const refresh = useRefresh(); |
| | | const { orgLoc, tarLoc, tabelData } = props; |
| | | const move = () => { |
| | | console.log(orgLoc, tarLoc); |
| | | if (orgLoc === "" || orgLoc === undefined || orgLoc === null) { |
| | | notify("请输入源库位"); |
| | | return; |
| | |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; |
| | | import com.vincent.rsf.server.manager.entity.DeviceSite; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.enums.LocStsType; |
| | | import com.vincent.rsf.server.manager.enums.TaskResouceType; |
| | | import com.vincent.rsf.server.manager.service.DeviceSiteService; |
| | | import com.vincent.rsf.server.manager.service.LocItemService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | |
| | | param.setType(Constants.TASK_TYPE_OUT_STOCK); |
| | | |
| | | try { |
| | | locItemService.generateTask(param, getLoginUserId()); |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val, param, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | package com.vincent.rsf.server.common.config; |
| | | |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | | import com.vincent.rsf.server.common.interceptor.severlet.DynamicFieldsInterceptor; |
| | | import com.vincent.rsf.server.common.utils.Http; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | |
| | | registry.addInterceptor(getAsyncHandlerInterceptor()) |
| | | .addPathPatterns("/**") |
| | | .excludePathPatterns("/swagger-resources/**", "/webjars/**","/erp/**", "/v2/**","/v3/**","/doc.html/**", "/swagger-ui.html/**"); |
| | | |
| | | registry.addInterceptor(dynamicFieldsInterceptor()) |
| | | .addPathPatterns("/**") |
| | | .excludePathPatterns("/swagger-resources/**", |
| | | "/webjars/**", |
| | | "/erp/**", |
| | | "/v2/**", |
| | | "/v3/**", |
| | | "/doc.html/**", |
| | | "/swagger-ui.html/**"); |
| | | } |
| | | |
| | | @Bean |
| | | public DynamicFieldsInterceptor dynamicFieldsInterceptor() { |
| | | return new DynamicFieldsInterceptor(); |
| | | } |
| | | |
| | | @Bean |
| | | public AsyncHandlerInterceptor getAsyncHandlerInterceptor() { |
| | |
| | | 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.server.api.utils.LocUtils; |
| | | import com.vincent.rsf.server.common.constant.Constants; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | |
| | | import com.vincent.rsf.server.common.utils.FieldsUtils; |
| | | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.enums.TaskResouceType; |
| | | import com.vincent.rsf.server.manager.service.LocItemService; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | |
| | | param.setType(Constants.TASK_TYPE_OUT_STOCK); |
| | | |
| | | try { |
| | | locItemService.generateTask(param, getLoginUserId()); |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_STOCK_TYPE.val, param, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | map.setType(Constants.TASK_TYPE_OUT_CHECK); |
| | | |
| | | try { |
| | | locItemService.generateTask(map, getLoginUserId()); |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_CHECK_TYPE.val, map, getLoginUserId()); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.manager.controller.params.OrderOutTaskParam; |
| | | import com.vincent.rsf.server.manager.controller.params.OutStockToTaskParams; |
| | | import com.vincent.rsf.server.manager.entity.excel.OutStockTemplate; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | | import com.vincent.rsf.server.manager.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | |
| | | } |
| | | |
| | | @PostMapping("/outStock/order/getOutTaskItems") |
| | | @ApiOperation("出库单库位预览") |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | public R getOrderOutTaskItem(@RequestBody OrderOutTaskParam param) { |
| | | if (Cools.isEmpty(param)) { |
| | |
| | | return outStockService.genOutStockTask(taskParams, getLoginUserId(), Long.parseLong(params.get("outId").toString())); |
| | | } |
| | | |
| | | /** |
| | | * 获取出库站点 |
| | | * @return |
| | | */ |
| | | @GetMapping("/outStock/tasks/sites") |
| | | @ApiOperation("获取出库库口") |
| | | @PreAuthorize("hasAuthority('manager:outStock:list')") |
| | | public R getSiteNos() { |
| | | return outStockService.getSiteNos(); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 下载模板 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/18 08:17 |
| | | */ |
| | | @PostMapping("/outStock/template/download") |
| | | @ApiOperation("下载收货单模板") |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:update')") |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | OutStockTemplate template = ExcelUtil.mockData(OutStockTemplate.class); |
| | | List<OutStockTemplate> list = Arrays.asList(template); |
| | | ExcelUtil.build(ExcelUtil.create(list, OutStockTemplate.class, true), response); |
| | | } |
| | | |
| | | } |
| | |
| | | @PostMapping("/outStockItem/import") |
| | | @ApiOperation("ASN导入接口") |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:update')") |
| | | public R importExcel(@RequestParam(value = "file") MultipartFile file, @RequestParam String asnId) throws Exception { |
| | | public R importExcel(@RequestParam(value = "file") MultipartFile file) throws Exception { |
| | | if (Objects.isNull(file)) { |
| | | R.error("文件不能为空!!"); |
| | | } |
| | |
| | | return outStockItemService.excelImport(file, hashMap, getLoginUserId()); |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 下载模板 |
| | | * @param |
| | | * @return |
| | | * @time 2025/4/18 08:17 |
| | | */ |
| | | @PostMapping("/outStockItem/template/download") |
| | | @ApiOperation("下载收货单模板") |
| | | @PreAuthorize("hasAuthority('manager:outStockItem:update')") |
| | | public void downloadTemplate(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | AsnOrderTemplate template = ExcelUtil.mockData(AsnOrderTemplate.class); |
| | | List<AsnOrderTemplate> list = Arrays.asList(template); |
| | | ExcelUtil.build(ExcelUtil.create(list, AsnOrderTemplate.class, true), response); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | @ApiModelProperty(value= "任务号") |
| | | private String taskCode; |
| | | |
| | | @ApiModelProperty("任务来源") |
| | | private Short resource; |
| | | |
| | | /** |
| | | * 任务状态 |
| | | */ |
| | |
| | | |
| | | @Excel(name = "单据类型") |
| | | @ApiModelProperty(value= "单据类型") |
| | | @ExcelComment(value = "type", example = "入库单") |
| | | @ExcelComment(value = "type", example = "出库单") |
| | | private String type; |
| | | |
| | | @Excel(name = "单据来源") |
| | |
| | | |
| | | @Excel(name = "业务类型") |
| | | @ApiModelProperty(value= "业务类型") |
| | | @ExcelComment(value = "wkType", example = "采购入库单") |
| | | @ExcelComment(value = "wkType", example = "销售出库单") |
| | | private String wkType; |
| | | |
| | | @Excel(name = "项目名称") |
| | |
| | | */ |
| | | @Excel(name = "*单据类型") |
| | | @ApiModelProperty(value = "*单据类型") |
| | | @ExcelComment(value = "type", example = "入库单") |
| | | @ExcelComment(value = "type", example = "出库单") |
| | | private String type; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @Excel(name = "*业务类型") |
| | | @ApiModelProperty(value = "*业务类型") |
| | | @ExcelComment(value = "wkType", example = "采购入库单") |
| | | @ExcelComment(value = "wkType", example = "销售出库单") |
| | | private String wkType; |
| | | |
| | | |
New file |
| | |
| | | package com.vincent.rsf.server.manager.enums; |
| | | |
| | | /** |
| | | * 任务生成来源类型 |
| | | */ |
| | | public enum TaskResouceType { |
| | | |
| | | //订单类型 |
| | | TASK_RESOUCE_WAVE_TYPE("1", "波次任务"), |
| | | |
| | | TASK_RESOUCE_STOCK_TYPE("2", "库存出库任务"), |
| | | |
| | | TASK_RESOUCE_PAKIN_TYPE("3", "组拖任务"), |
| | | |
| | | TASK_RESOUCE_ORDER_TYPE("4", "单据出库任务"), |
| | | |
| | | TASK_RESOUCE_CHECK_TYPE("4", "盘点出库任务"), |
| | | |
| | | |
| | | ; |
| | | TaskResouceType(String val, String desc) { |
| | | this.val = Short.parseShort(val); |
| | | this.desc = desc; |
| | | } |
| | | |
| | | public Short val; |
| | | |
| | | public String desc; |
| | | } |
| | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void taskLogUpdate() { |
| | | LambdaQueryWrapper<Task> queryWrapper = new LambdaQueryWrapper<Task>(); |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.ORDER_INOF_REPORT_PLAT)); |
| | | Config config = configService.getOne(new LambdaQueryWrapper<Config>().eq(Config::getFlag, GlobalConfigCode.ORDER_INOF_REPORT_PLAT));//是否上报平台 |
| | | if (!Objects.isNull(config)) { |
| | | if (Boolean.parseBoolean(config.getVal())) { |
| | | queryWrapper.in(Task::getTaskStatus, TaskStsType.REPORT_IN.id); |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.manager.controller.params.LocToTaskParams; |
| | | import com.vincent.rsf.server.manager.entity.LocItem; |
| | | import com.vincent.rsf.server.manager.entity.Task; |
| | | |
| | | public interface LocItemService extends IService<LocItem> { |
| | | |
| | | void generateTask(LocToTaskParams map, Long loginUserId) throws Exception; |
| | | void generateTask(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception; |
| | | |
| | | Task genMoveTask(LocToTaskParams map, Long loginUserId); |
| | | |
| | |
| | | R getOrderOutTaskItem(OrderOutTaskParam param); |
| | | |
| | | R genOutStockTask(List<OutStockToTaskParams> params, Long loginUserId, Long outId); |
| | | |
| | | R getSiteNos(); |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.controller.params.TaskInParam; |
| | | import com.vincent.rsf.server.api.entity.dto.InTaskMsgDto; |
| | |
| | | * 库存出库生成出库任务 |
| | | * type: check 盘点, stock: 库存出库 |
| | | * |
| | | * @param resouce |
| | | * @param map |
| | | * @param loginUserId |
| | | * @return |
| | |
| | | @Override |
| | | @Synchronized |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void generateTask(LocToTaskParams map, Long loginUserId) throws Exception { |
| | | public void generateTask(Short resouce, LocToTaskParams map, Long loginUserId) throws Exception { |
| | | if (Objects.isNull(map.getSiteNo())) { |
| | | throw new CoolException("站点不能为空!"); |
| | | } |
| | |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_TASK_CODE, null); |
| | | task.setOrgLoc(loc.getCode()) |
| | | .setTaskCode(ruleCode) |
| | | .setResource(resouce) |
| | | .setTargSite(siteNo) |
| | | .setSort(Constants.TASK_SORT_DEFAULT_VALUE) |
| | | .setUpdateBy(loginUserId) |
| | |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.entity.excel.OutStockTemplate; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.OrderType; |
| | | import com.vincent.rsf.server.manager.enums.OrderWorkType; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | public R excelImport(MultipartFile file, HashMap<String, Object> hashMap, Long loginUserId) throws Exception { |
| | | ExcelImportResult result = ExcelImportUtil.importExcelMore(file.getInputStream(), OutStockTemplate.class, ExcelUtil.getDefaultImportParams()); |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("物料导入失败!!"); |
| | | } |
| | | if (result.getList().isEmpty()) { |
| | | throw new CoolException("表格内容不能为空!!"); |
| | | } |
| | | List<OutStockTemplate> resultList = result.getList(); |
| | |
| | | for (String key : listMap.keySet()) { |
| | | OutStockTemplate template = listMap.get(key).stream().findFirst().get(); |
| | | AsnOrder asnOrder = outStockService.getOne(new LambdaQueryWrapper<AsnOrder>().eq(AsnOrder::getCode, template.getCode())); |
| | | if (Objects.isNull(asnOrder)) { |
| | | if (!Objects.isNull(asnOrder)) { |
| | | continue; |
| | | } |
| | | AsnOrder order = new AsnOrder(); |
| | |
| | | for (OutStockTemplate orderTemplate : listMap.get(key)) { |
| | | AsnOrderItem orderItem = new AsnOrderItem(); |
| | | Matnr matnr = null; |
| | | if (!Objects.isNull(orderTemplate.getMatnrCode()) || StringUtils.isNotBlank(orderTemplate.getMatnrCode())) { |
| | | if (StringUtils.isNotBlank(orderTemplate.getMatnrCode())) { |
| | | matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>() |
| | | .eq(Matnr::getCode, orderTemplate.getMatnrCode())); |
| | | } |
| | |
| | | } |
| | | } |
| | | if (!items.isEmpty()) { |
| | | double qty = items.stream().mapToDouble(AsnOrderItem::getQty).sum(); |
| | | double purQty = items.stream().mapToDouble(AsnOrderItem::getPurQty).sum(); |
| | | if (!outStockService.update(new LambdaUpdateWrapper<AsnOrder>().set(AsnOrder::getQty, qty).set(AsnOrder::getAnfme, purQty).eq(AsnOrder::getId, order.getId()))) { |
| | | double purQty = items.stream().mapToDouble(AsnOrderItem::getAnfme).sum(); |
| | | if (!outStockService.update(new LambdaUpdateWrapper<AsnOrder>() |
| | | .set(AsnOrder::getExceStatus, AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val) |
| | | .set(AsnOrder::getAnfme, purQty).eq(AsnOrder::getId, order.getId()))) { |
| | | throw new CoolException("单据数量修改失败!!"); |
| | | } |
| | | } |
| | |
| | | .setSiteNo(param.getSiteNo()); |
| | | try { |
| | | //生成出库任务 |
| | | locItemService.generateTask(taskParams, loginUserId); |
| | | locItemService.generateTask(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val, taskParams, loginUserId); |
| | | } catch (Exception e) { |
| | | logger.error("UNK", e); |
| | | throw new CoolException(e.getMessage()); |
| | |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 获取出库站点 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public R getSiteNos() { |
| | | List<Integer> list = Arrays.asList(TaskType.TASK_TYPE_MERGE_OUT.type, |
| | | TaskType.TASK_TYPE_OUT.type, |
| | | TaskType.TASK_TYPE_MERGE_OUT.type, |
| | | TaskType.TASK_TYPE_PICK_AGAIN_OUT.type); |
| | | List<DeviceSite> sites = deviceSiteService.list(new LambdaQueryWrapper<DeviceSite>().in(DeviceSite::getType, list).groupBy(DeviceSite::getSite)); |
| | | return R.ok(sites); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | issued = issued.subtract(new BigDecimal(locItem.getAnfme().toString())); |
| | | } |
| | | } |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | if (issued.doubleValue() > 0) { |
| | | LocItem locItem = new LocItem() |
| | | .setId(new Random().nextLong()) |
| | | .setMatnrCode(asnOrderItem.getMatnrCode()) |
| | | .setMaktx(asnOrderItem.getMaktx()) |
| | | .setAnfme(0.00) |
| | | .setWorkQty(issued.doubleValue()) |
| | | .setOutQty(issued.doubleValue()) |
| | | .setUnit(asnOrderItem.getStockUnit()) |
| | | .setBatch(asnOrderItem.getSplrBatch()); |
| | | OrderOutItemDto orderOutItemDto = new OrderOutItemDto(); |
| | | orderOutItemDto.setLocItem(locItem); |
| | | list.add(orderOutItemDto); |
| | | } |
| | | } |
| | | |
| | |
| | | task.setTaskCode(ruleCode) |
| | | .setTaskStatus(TaskStsType.GENERATE_IN.id) |
| | | .setTaskType(TaskType.TASK_TYPE_IN.type) |
| | | .setResource(TaskResouceType.TASK_RESOUCE_PAKIN_TYPE.val) |
| | | .setTargLoc(targetLoc) |
| | | .setBarcode(pakin.getBarcode()) |
| | | .setOrgSite(deviceSite.getSite()) |
| | |
| | | Double workQty = Math.round((asnOrder.getWorkQty() - item.getAnfme()) * 10000) / 10000.0; |
| | | |
| | | asnOrder.setExceStatus(AsnExceStatus.OUT_STOCK_STATUS_TASK_INIT.val) |
| | | .setWorkQty(workQty.compareTo(0.00) > 0 ? workQty : 0.00 ) |
| | | .setWorkQty(workQty.compareTo(0.00) > 0 ? workQty : 0.00) |
| | | .setUpdateBy(loginUserId) |
| | | .setUpdateTime(new Date()); |
| | | if (!outStockService.updateById(asnOrder)) { |
| | |
| | | if (Objects.isNull(list) || list.isEmpty()) { |
| | | Map<Long, List<TaskItem>> maps = taskItems.stream().collect(Collectors.groupingBy(TaskItem::getSource)); |
| | | maps.keySet().forEach(key -> { |
| | | WaveItem waveItem = waveItemService.getById(key); |
| | | if (Objects.isNull(waveItem)) { |
| | | throw new CoolException("波次明细不存在!!"); |
| | | } |
| | | try { |
| | | saveOutStockItem(maps.get(key), waveItem, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val)) { |
| | | WaveItem waveItem = waveItemService.getById(key); |
| | | if (Objects.isNull(waveItem)) { |
| | | throw new CoolException("波次明细不存在!!"); |
| | | } |
| | | try { |
| | | saveOutStockItem(maps.get(key), null, waveItem, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } else if (task.getResource().equals(TaskResouceType.TASK_RESOUCE_ORDER_TYPE.val)) { |
| | | AsnOrderItem orderItem = asnOrderItemService.getById(key); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("单据明细不存在!!"); |
| | | } |
| | | |
| | | try { |
| | | saveOutStockItem(maps.get(key), orderItem, null, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | | } else { |
| | | |
| | | } |
| | | }); |
| | | } else { |
| | | try { |
| | | saveOutStockItem(taskItems, null, loginUserId); |
| | | saveOutStockItem(taskItems, null, null, loginUserId); |
| | | } catch (Exception e) { |
| | | throw new CoolException(e.getMessage()); |
| | | } |
| | |
| | | * @version 1.0 |
| | | */ |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void saveOutStockItem(List<TaskItem> taskItems, WaveItem waveItem, Long loginUserId) throws Exception { |
| | | public void saveOutStockItem(List<TaskItem> taskItems, AsnOrderItem orderItem, WaveItem waveItem, Long loginUserId) throws Exception { |
| | | Stock stock = new Stock(); |
| | | String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_STOCK_CODE, null); |
| | | if (StringUtils.isBlank(ruleCode)) { |
| | |
| | | .setAnfme(sum); |
| | | if (Objects.isNull(waveItem)) { |
| | | stock.setWkType(Short.parseShort(OrderWorkType.ORDER_WORK_TYPE_STOCK_OUT.type)) |
| | | .setMemo("出库单出库,无单据信息!!") |
| | | .setMemo("库存出库,无单据信息!!") |
| | | .setType(OrderType.ORDER_OUT.type); |
| | | } else if (!Objects.isNull(orderItem) && StringUtils.isNotBlank(orderItem.getId() + "")) { |
| | | AsnOrder asnOrder = asnOrderService.getById(orderItem.getAsnId()); |
| | | stock.setWkType(Short.parseShort(asnOrder.getWkType())) |
| | | .setType(OrderType.ORDER_OUT.type); |
| | | } else { |
| | | //TODO 生成波次时需要将波次号写入单据,通过物料,批次,动态字段等唯一值反查单据信息 |
| | |
| | | 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.enums.TaskStsType; |
| | | import com.vincent.rsf.server.manager.enums.TaskType; |
| | | import com.vincent.rsf.server.manager.enums.*; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.AsnExceStatus; |
| | | import com.vincent.rsf.server.manager.enums.WaveExceStatus; |
| | | import com.vincent.rsf.server.manager.mapper.WaveMapper; |
| | | import com.vincent.rsf.server.manager.service.*; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | |
| | | task.setTaskCode(ruleCode) |
| | | .setTaskType(TaskType.TASK_TYPE_OUT.type) |
| | | .setTaskStatus(TaskStsType.GENERATE_OUT.id) |
| | | .setResource(TaskResouceType.TASK_RESOUCE_WAVE_TYPE.val) |
| | | .setBarcode(loc.getBarcode()) |
| | | .setOrgLoc(loc.getCode()) |
| | | .setCreateBy(loginUserId) |
| | |
| | | aoi.asn_code, |
| | | aoi.plat_item_id, |
| | | aoi.po_detl_id, |
| | | aoi.plat_order_code, |
| | | aoi.project_code, |
| | | aoi.ispt_status, |
| | | aoi.ispt_result, |
| | | aoi.batch, |
| | | aoi.spec, |
| | | aoi.model, |
| | | aoi.plat_work_code, |
| | | aoi.po_code, |
| | | aoi.fields_index, |