Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
| | |
| | | "axios": "^1.7.4", |
| | | "date-fns": "^3.6.0", |
| | | "framer-motion": "^12.4.10", |
| | | "jsbarcode": "^3.11.6", |
| | | "lodash": "^4.17.21", |
| | | "motion": "^12.4.1", |
| | | "papaparse": "^5.4.1", |
| | |
| | | framer-motion: |
| | | specifier: ^12.4.10 |
| | | version: 12.4.10(@emotion/is-prop-valid@1.3.1)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) |
| | | jsbarcode: |
| | | specifier: ^3.11.6 |
| | | version: 3.11.6 |
| | | lodash: |
| | | specifier: ^4.17.21 |
| | | version: 4.17.21 |
| | |
| | | id: 'ID', |
| | | uuid: '编号', |
| | | name: '名称', |
| | | createTime: '添加时间', |
| | | createBy: '添加人员', |
| | | createTime: '创建时间', |
| | | createBy: '创建人员', |
| | | updateTime: '修改时间', |
| | | updateBy: '修改人员', |
| | | status: '状态', |
| | |
| | | userLogin: '登录日志', |
| | | customer: '客户表', |
| | | shipper: '货主信息', |
| | | matnr: '物料数据', |
| | | matnr: '物料', |
| | | matnrGroup: '物料分组', |
| | | warehouse: '仓库信息', |
| | | warehouseAreas: '仓库库区', |
| | | loc: '基础库位', |
| | | warehouse: '仓库', |
| | | warehouseAreas: '库区', |
| | | loc: '库位', |
| | | locType: '库位类型', |
| | | locArea: '逻辑分区', |
| | | container: '容器管理', |
| | |
| | | |
| | | |
| | | const notify = useNotify(); |
| | | const [disabled, setDisabled] = useState(false) |
| | | |
| | | const [formData, setFormData] = useState({ |
| | | "warehouseId": null, |
| | |
| | | }; |
| | | |
| | | const handleSubmit = async () => { |
| | | setDisabled(true) |
| | | const res = await request.post(`/loc/init`, formData); |
| | | if (res?.data?.code === 200) { |
| | | setOpen(false); |
| | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | setDisabled(false) |
| | | } |
| | | |
| | | |
| | |
| | | </DialogContent> |
| | | <DialogActions sx={{ position: 'sticky', bottom: 0, backgroundColor: 'background.paper', zIndex: 1000 }}> |
| | | <Box sx={{ width: '100%', display: 'flex', justifyContent: 'space-between' }}> |
| | | <Button type="submit" variant="contained" startIcon={<SaveIcon />}> |
| | | <Button disabled={disabled} type="submit" variant="contained" startIcon={<SaveIcon />} > |
| | | {translate('toolbar.confirm')} |
| | | </Button> |
| | | </Box> |
| | | |
| | | </DialogActions> |
| | | </Form> |
| | | </Dialog> |
| | |
| | | validate={[required()]} |
| | | /> */} |
| | | <ReferenceArrayInput source="typeIds" reference="locType" > |
| | | <SelectArrayInput label="table.field.loc.type" /> |
| | | <SelectArrayInput label="table.field.loc.type" validate={[required()]} /> |
| | | </ReferenceArrayInput> |
| | | </Grid> |
| | | {/* <Grid item xs={6} display="flex" gap={1}> |
| | |
| | | validate={[required()]} |
| | | /> */} |
| | | <ReferenceArrayInput source="typeIds" reference="locType" > |
| | | <SelectArrayInput label="table.field.loc.type" /> |
| | | <SelectArrayInput label="table.field.loc.type" validate={[required()]} /> |
| | | </ReferenceArrayInput> |
| | | </Grid> |
| | | <Grid item xs={6} display="flex" gap={1}> |
| | |
| | | import EditIcon from '@mui/icons-material/Edit'; |
| | | import request from '@/utils/request'; |
| | | import DiscountIcon from '@mui/icons-material/Discount'; |
| | | import { textAlign } from "@mui/system"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | '& .opt': { |
| | | width: 200 |
| | | }, |
| | | '& .RaDatagrid-headerCell': { |
| | | textAlign: 'left' |
| | | } |
| | | })); |
| | | |
| | | const filters = [ |
| | |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='loc' |
| | | align="left" |
| | | bulkActionButtons={ |
| | | <> |
| | | <BatchButton /> |
| | |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="warehouseId$" label="table.field.loc.warehouseId" /> |
| | | <NumberField source="areaId$" label="table.field.loc.areaId" /> |
| | | <TextField source="code" label="table.field.loc.code" /> |
| | | <TextField source="typeIds$" label="table.field.loc.type" /> |
| | | <NumberField source="areaId$" label="table.field.loc.areaId" align="left" /> |
| | | <TextField source="code" label="table.field.loc.code" align="left" /> |
| | | <TextField source="typeIds$" label="table.field.loc.type" align="left" /> |
| | | {/* <TextField source="name" label="table.field.loc.name" /> */} |
| | | {/* <NumberField source="flagLogic" label="table.field.loc.flagLogic" /> |
| | | <TextField source="fucAtrrs" label="table.field.loc.fucAtrrs" /> |
| | |
| | | <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}> |
| | | <DateField source="updateTime" label="common.field.updateTime" showTime align="left" /> |
| | | <ReferenceField source="createBy" label="common.field.createBy" align="left" 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} /> |
| | | <DateField source="createTime" label="common.field.createTime" showTime align="left" /> |
| | | <BooleanField source="statusBool" label="common.field.status" sortable={false} align="left" /> |
| | | <TextField source="memo" label="common.field.memo" sortable={false} /> |
| | | |
| | | <WrapperField cellClassName="opt" label="common.field.opt"> |
| | |
| | | |
| | | const [columns, setColumns] = useState([]); |
| | | const refresh = useRefresh(); |
| | | const { refetch } = useListContext(); |
| | | |
| | | useEffect(() => { |
| | | getDynamicFields(); |
| | |
| | | |
| | | const PrintButton = () => { |
| | | const record = useRecordContext(); |
| | | const { resource, selectedIds } = useListContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | |
| | | <PrintModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | rows={selectedIds} |
| | | /> |
| | | </> |
| | | |
| | |
| | | const { setFilters } = useListContext(); // 获取列表上下文 |
| | | const [selectedOption, setSelectedOption] = useState(null); |
| | | const [treeData, setTreeData] = useState([]); |
| | | const [defaultIds, setDefaultIds] = useState(['29']); |
| | | const [defaultIds, setDefaultIds] = useState(['65']); |
| | | const [condition, setCondition] = useState(''); |
| | | |
| | | const haveChildren = (item) => { |
| | |
| | | border: theme.palette.mode === 'light' && '1px solid #e0e0e3', |
| | | width: 250, |
| | | minWidth: 150, |
| | | height: `calc(100% - 120px)`, |
| | | height: `100%`, |
| | | }} |
| | | > |
| | | <CardContent> |
| | | <Input |
| | | placeholder="搜索物料分区" |
| | | placeholder="搜索物料分组" |
| | | sx={{ '--Input-focused': 1, marginBottom: '10px' }} |
| | | onChange={handleSearch} |
| | | /> |
| | |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | |
| | | import { useReactToPrint } from "react-to-print"; |
| | | import jsbarcode from 'jsbarcode' |
| | | import { el } from "date-fns/locale"; |
| | | |
| | | const PrintModal = ({ open, setOpen }) => { |
| | | const PrintModal = ({ open, setOpen, rows }) => { |
| | | const refresh = useRefresh(); |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | |
| | | </FormControl> |
| | | |
| | | <Box> |
| | | <div style={{ textAlign: 'center' }}> |
| | | <PrintTemp /> |
| | | <div style={{ textAlign: 'center', display: 'flex', justifyContent: 'center' }}> |
| | | <table |
| | | className="contain" |
| | | style={{ |
| | | overflow: 'hidden', |
| | | fontSize: 'small', |
| | | tableLayout: 'fixed', |
| | | width: '280px', |
| | | borderCollapse: 'collapse', // 合并边框 |
| | | border: '1px solid black' // 设置表格整体边框 |
| | | }} |
| | | > |
| | | <tbody> |
| | | <tr style={{ height: '74px' }}> |
| | | <td |
| | | align="center" |
| | | colSpan={3} |
| | | style={{ border: '1px solid black' }} // 设置单元格边框 |
| | | > |
| | | 商品编码 |
| | | </td> |
| | | <td |
| | | align="center" |
| | | className="barcode" |
| | | colSpan={9} |
| | | style={{ border: '1px solid black' }} |
| | | > |
| | | <img className="template-code" src={'/img/barcode.jpeg'} style={{ width: '90%' }} alt="Barcode" /> |
| | | <div style={{ letterSpacing: '2px', marginTop: '1px', textAlign: 'center' }}> |
| | | <span>{'xxxxxx'}</span> |
| | | </div> |
| | | </td> |
| | | </tr> |
| | | <tr style={{ height: '74px' }}> |
| | | <td |
| | | align="center" |
| | | colSpan={3} |
| | | style={{ border: '1px solid black' }} |
| | | > |
| | | 商品 |
| | | </td> |
| | | <td |
| | | align="center" |
| | | colSpan={5} |
| | | style={{ |
| | | overflow: 'hidden', |
| | | whiteSpace: 'nowrap', |
| | | textOverflow: 'ellipsis', |
| | | border: '1px solid black' |
| | | }} |
| | | > |
| | | {'xxxxxxxx'} |
| | | </td> |
| | | <td |
| | | align="center" |
| | | colSpan={2} |
| | | style={{ border: '1px solid black' }} |
| | | > |
| | | 备注 |
| | | </td> |
| | | <td |
| | | align="center" |
| | | colSpan={2} |
| | | style={{ border: '1px solid black' }} |
| | | > |
| | | {'xx'} |
| | | </td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | <style>{` |
| | | @media print { |
| | |
| | | } |
| | | }`} </style> |
| | | <div ref={contentRef} className="print-content" style={{ textAlign: 'center', display: 'none' }}> |
| | | <PrintTemp /> |
| | | <PrintTemp key={'bb'} rows={rows} /> |
| | | </div> |
| | | </Box> |
| | | </DialogContent> |
| | |
| | | |
| | | export default PrintModal; |
| | | |
| | | const PrintTemp = (props) => { |
| | | const [data, setData] = useState([{ |
| | | barcode: '/img/barcode.jpeg', |
| | | product: 'xxxxxx-xx/xx', |
| | | remark: 'xx' |
| | | }]); |
| | | const PrintTemp = ({ rows }) => { |
| | | const notify = useNotify(); |
| | | const [data, setData] = useState([]); |
| | | const http = async () => { |
| | | const res = await request.post(`/matnrs/many/${rows?.join()}`); |
| | | if (res?.data?.code === 200) { |
| | | let val = res.data.data.map((el => { |
| | | return { |
| | | barcode: '/img/barcode.jpeg', |
| | | code: el.code, |
| | | name: el.name, |
| | | memo: el.memo |
| | | } |
| | | })) |
| | | setData(val) |
| | | val.forEach((el) => { |
| | | jsbarcode(`#barcode${el.code}`, el.code, { height: 30 }); |
| | | }); |
| | | |
| | | |
| | | } else { |
| | | notify(res.data.msg); |
| | | } |
| | | } |
| | | |
| | | useEffect(() => { |
| | | if (rows?.length > 0) { |
| | | http(); |
| | | } |
| | | |
| | | }, [rows]); |
| | | |
| | | |
| | | return ( |
| | | <> |
| | | {data.map((item, index) => ( |
| | |
| | | colSpan={9} |
| | | style={{ border: '1px solid black' }} |
| | | > |
| | | <img className="template-code" src={item.barcode} style={{ width: '90%', verticalAlign: 'middle' }} alt="Barcode" /> |
| | | <div style={{ letterSpacing: '2px', marginTop: '1px', textAlign: 'center' }}> |
| | | <span>{'xxxxxx'}</span> |
| | | </div> |
| | | <img id={"barcode" + item.code} style={{ width: '70%', verticalAlign: 'middle' }} /> |
| | | {/* <img className="template-code" src={item.barcode} style={{ width: '90%', verticalAlign: 'middle' }} alt="Barcode" /> */} |
| | | {/* <div style={{ letterSpacing: '2px', marginTop: '1px', textAlign: 'center' }}> |
| | | <span>{item.code}</span> |
| | | </div> */} |
| | | </td> |
| | | </tr> |
| | | <tr style={{ height: '74px' }}> |
| | |
| | | border: '1px solid black' |
| | | }} |
| | | > |
| | | {item.product} |
| | | {item.name} |
| | | </td> |
| | | <td |
| | | align="center" |
| | |
| | | colSpan={2} |
| | | style={{ border: '1px solid black' }} |
| | | > |
| | | {item.remark} |
| | | {item.memo} |
| | | </td> |
| | | </tr> |
| | | </tbody> |
| | |
| | | // generator.username="sa"; |
| | | // generator.password="Zoneyung@zy56$"; |
| | | |
| | | generator.table="man_loc_area_rela"; |
| | | generator.tableDesc="loc areas rela"; |
| | | generator.table="man_loc_area_mat_rela"; |
| | | generator.tableDesc="loc areas mats rela"; |
| | | generator.packagePath="com.vincent.rsf.server.manager"; |
| | | |
| | | generator.build(); |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | 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.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.KeyValVo; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.controller.params.LocAreaMatsParam; |
| | | import com.vincent.rsf.server.manager.entity.LocAreaMatRela; |
| | | import com.vincent.rsf.server.manager.service.LocAreaMatRelaService; |
| | | 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.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @Api(tags = "库区物料关系绑定") |
| | | @RestController |
| | | public class LocAreaMatRelaController extends BaseController { |
| | | |
| | | @Autowired |
| | | private LocAreaMatRelaService locAreaMatRelaService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:list')") |
| | | @PostMapping("/locAreaMatRela/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<LocAreaMatRela, BaseParam> pageParam = new PageParam<>(baseParam, LocAreaMatRela.class); |
| | | return R.ok().add(locAreaMatRelaService.page(pageParam, pageParam.buildWrapper(true))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:list')") |
| | | @PostMapping("/locAreaMatRela/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | | return R.ok().add(locAreaMatRelaService.list()); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:list')") |
| | | @PostMapping({"/locAreaMatRela/many/{ids}", "/locAreaMatRelas/many/{ids}"}) |
| | | public R many(@PathVariable Long[] ids) { |
| | | return R.ok().add(locAreaMatRelaService.listByIds(Arrays.asList(ids))); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:list')") |
| | | @GetMapping("/locAreaMatRela/{id}") |
| | | public R get(@PathVariable("id") Long id) { |
| | | return R.ok().add(locAreaMatRelaService.getById(id)); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:save')") |
| | | @OperationLog("Create loc areas mats rela") |
| | | @PostMapping("/locAreaMatRela/save") |
| | | public R save(@RequestBody LocAreaMatRela locAreaMatRela) { |
| | | locAreaMatRela.setCreateBy(getLoginUserId()); |
| | | locAreaMatRela.setCreateTime(new Date()); |
| | | locAreaMatRela.setUpdateBy(getLoginUserId()); |
| | | locAreaMatRela.setUpdateTime(new Date()); |
| | | if (!locAreaMatRelaService.save(locAreaMatRela)) { |
| | | return R.error("Save Fail"); |
| | | } |
| | | return R.ok("Save Success").add(locAreaMatRela); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:update')") |
| | | @OperationLog("Update loc areas mats rela") |
| | | @PostMapping("/locAreaMatRela/update") |
| | | public R update(@RequestBody LocAreaMatRela locAreaMatRela) { |
| | | locAreaMatRela.setUpdateBy(getLoginUserId()); |
| | | locAreaMatRela.setUpdateTime(new Date()); |
| | | if (!locAreaMatRelaService.updateById(locAreaMatRela)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(locAreaMatRela); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:remove')") |
| | | @OperationLog("Delete loc areas mats rela") |
| | | @PostMapping("/locAreaMatRela/remove/{ids}") |
| | | public R remove(@PathVariable Long[] ids) { |
| | | if (!locAreaMatRelaService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:list')") |
| | | @PostMapping("/locAreaMatRela/query") |
| | | public R query(@RequestParam(required = false) String condition) { |
| | | List<KeyValVo> vos = new ArrayList<>(); |
| | | LambdaQueryWrapper<LocAreaMatRela> wrapper = new LambdaQueryWrapper<>(); |
| | | if (!Cools.isEmpty(condition)) { |
| | | wrapper.like(LocAreaMatRela::getAreaId, condition); |
| | | } |
| | | locAreaMatRelaService.page(new Page<>(1, 30), wrapper).getRecords().forEach( |
| | | item -> vos.add(new KeyValVo(item.getId(), item.getAreaId())) |
| | | ); |
| | | return R.ok().add(vos); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:list')") |
| | | @PostMapping("/locAreaMatRela/export") |
| | | public void export(@RequestBody Map<String, Object> map, HttpServletResponse response) throws Exception { |
| | | ExcelUtil.build(ExcelUtil.create(locAreaMatRelaService.list(), LocAreaMatRela.class), response); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:locAreaMatRela:update')") |
| | | @PostMapping("/locAreaMatRela/matnr/bind") |
| | | @ApiOperation("物料绑定库区") |
| | | public R matnrBindArea(@RequestBody LocAreaMatsParam param) { |
| | | if (Objects.isNull(param)) { |
| | | throw new CoolException("参数不能为空!!"); |
| | | } |
| | | if (Objects.isNull(param.getAreaId())) { |
| | | throw new CoolException("库区不能为空!!"); |
| | | } |
| | | if (param.getLocId().isEmpty() || param.getTypeId().isEmpty()) { |
| | | throw new CoolException("库位类型或库位不能为空!!"); |
| | | } |
| | | if (Objects.isNull(param.getGroupId()) || param.getMatnrId().isEmpty()) { |
| | | throw new CoolException("物料或物料分类不能为空!!"); |
| | | } |
| | | return locAreaMatRelaService.binMatnrs(param); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.vincent.rsf.server.manager.entity.MatnrGroup; |
| | | import com.vincent.rsf.server.manager.service.LocTypeService; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @Api(tags = "库位类型") |
| | | @RestController |
| | | public class LocTypeController extends BaseController { |
| | | |
New file |
| | |
| | | package com.vincent.rsf.server.manager.controller.params; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @version 1.0 |
| | | * @title LocAreaMatsParam |
| | | * @description |
| | | * @create 2025/3/22 10:58 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "LocAreaMatsParam", description = "库区物料关系绑定") |
| | | public class LocAreaMatsParam { |
| | | |
| | | @ApiModelProperty("物料ID") |
| | | private List<Long> matnrId; |
| | | |
| | | @ApiModelProperty("物料分组ID") |
| | | private Long groupId; |
| | | |
| | | @ApiModelProperty("库区ID") |
| | | private Long areaId; |
| | | |
| | | @ApiModelProperty("库位类型") |
| | | private List<Long> typeId; |
| | | |
| | | @ApiModelProperty("库位ID") |
| | | private List<Long> locId; |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.entity; |
| | | |
| | | 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 com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableLogic; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.server.system.service.UserService; |
| | | import com.vincent.rsf.server.system.entity.User; |
| | | import java.io.Serializable; |
| | | import java.util.Date; |
| | | |
| | | @Data |
| | | @Accessors(chain = true) |
| | | @TableName("man_loc_area_mat_rela") |
| | | public class LocAreaMatRela implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | /** |
| | | * ID |
| | | */ |
| | | @ApiModelProperty(value= "ID") |
| | | @TableId(value = "id", type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | /** |
| | | * 物料ID |
| | | */ |
| | | @ApiModelProperty(value= "物料ID") |
| | | private Long areaId; |
| | | |
| | | /** |
| | | * 编号 |
| | | */ |
| | | @ApiModelProperty(value= "编号") |
| | | private String code; |
| | | |
| | | /** |
| | | * 物料ID |
| | | */ |
| | | @ApiModelProperty(value= "物料ID") |
| | | private Long matnrId; |
| | | |
| | | /** |
| | | * 物料分组ID |
| | | */ |
| | | @ApiModelProperty(value= "物料分组ID") |
| | | private Long groupId; |
| | | |
| | | /** |
| | | * 库位类型ID |
| | | */ |
| | | @ApiModelProperty(value= "库位类型ID") |
| | | private Long locTypeId; |
| | | |
| | | /** |
| | | * 库位ID |
| | | */ |
| | | @ApiModelProperty(value= "库位ID") |
| | | private Long locId; |
| | | |
| | | /** |
| | | * 状态 1: 正常 0: 冻结 |
| | | */ |
| | | @ApiModelProperty(value= "状态 1: 正常 0: 冻结 ") |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 是否删除 1: 是 0: 否 |
| | | */ |
| | | @ApiModelProperty(value= "是否删除 1: 是 0: 否 ") |
| | | @TableLogic |
| | | private Integer deleted; |
| | | |
| | | /** |
| | | * 租户 |
| | | */ |
| | | @ApiModelProperty(value= "租户") |
| | | private Integer tenantId; |
| | | |
| | | /** |
| | | * 添加人员 |
| | | */ |
| | | @ApiModelProperty(value= "添加人员") |
| | | private Long createBy; |
| | | |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value= "添加时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date createTime; |
| | | |
| | | /** |
| | | * 修改人员 |
| | | */ |
| | | @ApiModelProperty(value= "修改人员") |
| | | private Long updateBy; |
| | | |
| | | /** |
| | | * 修改时间 |
| | | */ |
| | | @ApiModelProperty(value= "修改时间") |
| | | @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") |
| | | private Date updateTime; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @ApiModelProperty(value= "备注") |
| | | private String memo; |
| | | |
| | | public LocAreaMatRela() {} |
| | | |
| | | public LocAreaMatRela(Long areaId,String code,Long matnrId,Long groupId,Long locTypeId,Long locId,Integer status,Integer deleted,Integer tenantId,Long createBy,Date createTime,Long updateBy,Date updateTime,String memo) { |
| | | this.areaId = areaId; |
| | | this.code = code; |
| | | this.matnrId = matnrId; |
| | | this.groupId = groupId; |
| | | this.locTypeId = locTypeId; |
| | | this.locId = locId; |
| | | this.status = status; |
| | | this.deleted = deleted; |
| | | this.tenantId = tenantId; |
| | | this.createBy = createBy; |
| | | this.createTime = createTime; |
| | | this.updateBy = updateBy; |
| | | this.updateTime = updateTime; |
| | | this.memo = memo; |
| | | } |
| | | |
| | | // LocAreaMatRela locAreaMatRela = new LocAreaMatRela( |
| | | // null, // 物料ID |
| | | // null, // 编号 |
| | | // null, // 物料ID |
| | | // null, // 物料分组ID |
| | | // null, // 库位类型ID |
| | | // null, // 库位ID |
| | | // null, // 状态[非空] |
| | | // null, // 是否删除[非空] |
| | | // null, // 租户 |
| | | // null, // 添加人员 |
| | | // null, // 添加时间[非空] |
| | | // null, // 修改人员 |
| | | // null, // 修改时间[非空] |
| | | // null // 备注 |
| | | // ); |
| | | |
| | | public String getStatus$(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return "正常"; |
| | | case 0: |
| | | return "冻结"; |
| | | default: |
| | | return String.valueOf(this.status); |
| | | } |
| | | } |
| | | |
| | | public String getCreateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.createBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getCreateTime$(){ |
| | | if (Cools.isEmpty(this.createTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.createTime); |
| | | } |
| | | |
| | | public String getUpdateBy$(){ |
| | | UserService service = SpringUtils.getBean(UserService.class); |
| | | User user = service.getById(this.updateBy); |
| | | if (!Cools.isEmpty(user)){ |
| | | return String.valueOf(user.getNickname()); |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | public String getUpdateTime$(){ |
| | | if (Cools.isEmpty(this.updateTime)){ |
| | | return ""; |
| | | } |
| | | return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(this.updateTime); |
| | | } |
| | | |
| | | |
| | | |
| | | public Boolean getStatusBool(){ |
| | | if (null == this.status){ return null; } |
| | | switch (this.status){ |
| | | case 1: |
| | | return true; |
| | | case 0: |
| | | return false; |
| | | default: |
| | | return null; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.vincent.rsf.server.manager.mapper; |
| | | |
| | | import com.vincent.rsf.server.manager.entity.LocAreaMatRela; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface LocAreaMatRelaMapper extends BaseMapper<LocAreaMatRela> { |
| | | |
| | | } |
New file |
| | |
| | | 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.LocAreaMatsParam; |
| | | import com.vincent.rsf.server.manager.entity.LocAreaMatRela; |
| | | |
| | | public interface LocAreaMatRelaService extends IService<LocAreaMatRela> { |
| | | |
| | | R binMatnrs(LocAreaMatsParam param); |
| | | } |
New file |
| | |
| | | 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.manager.controller.params.LocAreaMatsParam; |
| | | import com.vincent.rsf.server.manager.entity.LocTypeRela; |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import com.vincent.rsf.server.manager.mapper.LocAreaMatRelaMapper; |
| | | import com.vincent.rsf.server.manager.entity.LocAreaMatRela; |
| | | import com.vincent.rsf.server.manager.service.LocAreaMatRelaService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.vincent.rsf.server.manager.service.LocService; |
| | | import com.vincent.rsf.server.manager.service.LocTypeRelaService; |
| | | import com.vincent.rsf.server.manager.service.MatnrService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("locAreaMatRelaService") |
| | | public class LocAreaMatRelaServiceImpl extends ServiceImpl<LocAreaMatRelaMapper, LocAreaMatRela> implements LocAreaMatRelaService { |
| | | |
| | | @Autowired |
| | | private MatnrService matnrService; |
| | | |
| | | @Autowired |
| | | private LocService locService; |
| | | |
| | | @Autowired |
| | | private LocTypeRelaService locTypeRelaService; |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @description 库区绑定物料 |
| | | * @param |
| | | * @return |
| | | * @time 2025/3/22 11:32 |
| | | */ |
| | | @Override |
| | | public R binMatnrs(LocAreaMatsParam param) { |
| | | List<Matnr> matnrIds = new ArrayList<>(); |
| | | if (!Objects.isNull(param.getGroupId())) { |
| | | List<Matnr> list = matnrService.list(new LambdaQueryWrapper<Matnr>().eq(Matnr::getGroupId, param.getGroupId()).select(Matnr::getId, Matnr::getGroupId)); |
| | | if (list.isEmpty()) { |
| | | throw new CoolException("物料分组没有物料"); |
| | | } |
| | | matnrIds.addAll(list); |
| | | } |
| | | if (!param.getMatnrId().isEmpty()) { |
| | | List<Matnr> matnrs = matnrService.list(new LambdaQueryWrapper<Matnr>() |
| | | .select(Matnr::getId, Matnr::getGroupId) |
| | | .in(Matnr::getId, param.getMatnrId())); |
| | | if (matnrs.isEmpty()) { |
| | | throw new CoolException("物料不存在!!"); |
| | | } |
| | | matnrIds.addAll(matnrs); |
| | | } |
| | | List<LocAreaMatRela> locAreaMatRelas = new ArrayList<>(); |
| | | if (!param.getTypeId().isEmpty()) { |
| | | for (Long typeId : param.getTypeId()) { |
| | | List<LocTypeRela> list = locTypeRelaService.list(new LambdaQueryWrapper<LocTypeRela>() |
| | | .select(LocTypeRela::getLocId).eq(LocTypeRela::getTypeId, typeId)); |
| | | if (list.isEmpty()) { |
| | | continue; |
| | | } |
| | | List<Long> longs = list.stream().map(LocTypeRela::getLocId).collect(Collectors.toList()); |
| | | for (Long locId : longs) { |
| | | for (Matnr matnrId : matnrIds) { |
| | | LocAreaMatRela locAreaMatRela = new LocAreaMatRela(); |
| | | locAreaMatRela |
| | | .setAreaId(param.getAreaId()) |
| | | .setLocId(locId) |
| | | .setLocTypeId(typeId) |
| | | .setMatnrId(matnrId.getId()) |
| | | .setGroupId(matnrId.getGroupId()); |
| | | locAreaMatRelas.add(locAreaMatRela); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (!param.getLocId().isEmpty()) { |
| | | List<LocTypeRela> list = locTypeRelaService.list(new LambdaQueryWrapper<LocTypeRela>().in(LocTypeRela::getLocId, param.getTypeId()).select(LocTypeRela::getTypeId, LocTypeRela::getLocId)); |
| | | if (list.isEmpty()) { |
| | | throw new CoolException("数据错误:库位未绑定库位类型!!"); |
| | | } |
| | | for (LocTypeRela locTypeRela : list) { |
| | | for (Matnr matnr : matnrIds) { |
| | | LocAreaMatRela locAreaMatRela = new LocAreaMatRela(); |
| | | locAreaMatRela |
| | | .setAreaId(param.getAreaId()) |
| | | .setLocId(locTypeRela.getLocId()) |
| | | .setLocTypeId(locTypeRela.getTypeId()) |
| | | .setMatnrId(matnr.getId()) |
| | | .setGroupId(matnr.getGroupId()); |
| | | locAreaMatRelas.add(locAreaMatRela); |
| | | } |
| | | } |
| | | } |
| | | if (!this.saveBatch(locAreaMatRelas)) { |
| | | throw new CoolException("物料库位类型绑定失败!!"); |
| | | } |
| | | return R.ok("绑定成功!!"); |
| | | } |
| | | } |
New file |
| | |
| | | -- save locAreaMatRela record |
| | | -- mysql |
| | | insert into `sys_menu` ( `name`, `parent_id`, `route`, `component`, `type`, `sort`, `tenant_id`, `status`) values ( 'menu.locAreaMatRela', '0', '/manager/locAreaMatRela', 'locAreaMatRela', '0' , '0', '1' , '1'); |
| | | |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Query loc areas mats rela', '', '1', 'manager:locAreaMatRela:list', '0', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Create loc areas mats rela', '', '1', 'manager:locAreaMatRela:save', '1', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Update loc areas mats rela', '', '1', 'manager:locAreaMatRela:update', '2', '1', '1'); |
| | | insert into `sys_menu` ( `name`, `parent_id`, `type`, `authority`, `sort`, `tenant_id`, `status`) values ( 'Delete loc areas mats rela', '', '1', 'manager:locAreaMatRela:remove', '3', '1', '1'); |
| | | |
| | | -- locale menu name |
| | | locAreaMatRela: 'LocAreaMatRela', |
| | | |
| | | -- locale field |
| | | locAreaMatRela: { |
| | | areaId: "areaId", |
| | | code: "code", |
| | | matnrId: "matnrId", |
| | | groupId: "groupId", |
| | | locTypeId: "locTypeId", |
| | | locId: "locId", |
| | | }, |
| | | |
| | | -- ResourceContent |
| | | import locAreaMatRela from './locAreaMatRela'; |
| | | |
| | | case 'locAreaMatRela': |
| | | return locAreaMatRela; |
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.vincent.rsf.server.manager.mapper.LocAreaMatRelaMapper"> |
| | | |
| | | </mapper> |