Merge branch 'devlop' of http://47.97.1.152:5880/r/wms-master into devlop
# Conflicts:
# rsf-server/src/main/java/com/vincent/rsf/server/manager/service/impl/MatnrServiceImpl.java
| | |
| | | batchMix: 'batchFiexed', |
| | | batchWarehouse: 'batchWarehouse', |
| | | batchStockLevel: "batchStockLevel", |
| | | batchWarehouseAreas: "batchWarehouseAreas", |
| | | batchLocType: "batchLocType", |
| | | }, |
| | | }; |
| | | |
| | |
| | | batchStockLevel: "批量ABC分类", |
| | | batchValidWarn: "批量预警", |
| | | batchFlagCheck: "批量免检", |
| | | batchWarehouseAreas: "批量库区", |
| | | batchLocType: "批量库位类型", |
| | | }, |
| | | }; |
| | | |
| | |
| | | const inspection = () => { }; |
| | | |
| | | const print = () => { |
| | | const imageUrls = ['https://www.baidu.com/img/flexible/logo/pc/result@2.png',] |
| | | const iframe = document.createElement('iframe'); |
| | | iframe.style.display = 'none'; |
| | | document.body.appendChild(iframe); |
| | | // const imageUrls = ['https://www.baidu.com/img/flexible/logo/pc/result@2.png',] |
| | | // const iframe = document.createElement('iframe'); |
| | | // iframe.style.display = 'none'; |
| | | // document.body.appendChild(iframe); |
| | | |
| | | const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; |
| | | iframeDoc.open(); |
| | | iframeDoc.write('<html><head><title>Print Images</title></head><body>'); |
| | | // const iframeDoc = iframe.contentDocument || iframe.contentWindow.document; |
| | | // iframeDoc.open(); |
| | | // iframeDoc.write('<html><head><title>Print Images</title></head><body>'); |
| | | |
| | | // 将图片插入到 iframe 中 |
| | | imageUrls.forEach((imageUrl) => { |
| | | iframeDoc.write(`<img src="${imageUrl}" style="margin: 10px;">`); |
| | | }); |
| | | // // 将图片插入到 iframe 中 |
| | | // imageUrls.forEach((imageUrl) => { |
| | | // iframeDoc.write(`<img src="${imageUrl}" style="margin: 10px;">`); |
| | | // }); |
| | | |
| | | iframeDoc.write('</body></html>'); |
| | | iframeDoc.close(); |
| | | // iframeDoc.write('</body></html>'); |
| | | // iframeDoc.close(); |
| | | |
| | | // 等待图片加载完成后触发打印 |
| | | iframe.contentWindow.onload = () => { |
| | | iframe.contentWindow.print(); |
| | | // 打印完成后移除 iframe |
| | | document.body.removeChild(iframe); |
| | | }; |
| | | // // 等待图片加载完成后触发打印 |
| | | // iframe.contentWindow.onload = () => { |
| | | // iframe.contentWindow.print(); |
| | | // // 打印完成后移除 iframe |
| | | // document.body.removeChild(iframe); |
| | | // }; |
| | | }; |
| | | |
| | | |
| | |
| | | import StatusSelectInput from "../../components/StatusSelectInput"; |
| | | |
| | | |
| | | const BatchModal = ({ open, setOpen }) => { |
| | | const BatchModal = ({ open, setOpen, fieldType }) => { |
| | | const refresh = useRefresh(); |
| | | const translate = useTranslate(); |
| | | |
| | |
| | | } |
| | | |
| | | return ( |
| | | <Dialog open={open} maxWidth="md" fullWidth> |
| | | <Dialog open={open} maxWidth="xs" fullWidth> |
| | | <Form onSubmit={handleSubmit}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | <DialogTitle>{translate('toolbar.batch')}</DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <Box sx={{ display: 'flex', flexDirection: 'column', gap: 3 }}> |
| | | <Grid container spacing={2}> |
| | | <Grid item xs={4}> |
| | | {fieldType === 'warehouseId' && |
| | | <Grid item xs={6}> |
| | | <ReferenceInput |
| | | source="warehouseId" |
| | | reference="warehouse" |
| | |
| | | <AutocompleteInput |
| | | label="table.field.loc.warehouseId" |
| | | optionText="name" |
| | | onChange={(value) => handleChange(value, 'warehouseId')} |
| | | value={formData.warehouseId} |
| | | filterToQuery={(val) => ({ name: val })} |
| | | /> |
| | | </ReferenceInput> |
| | | |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | } |
| | | {fieldType === 'areaId' && |
| | | <Grid item xs={6}> |
| | | <ReferenceInput |
| | | source="areaId" |
| | | reference="warehouseAreas" |
| | | filter={{ warehouseId: formData.warehouseId }} |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.areaId" |
| | |
| | | </ReferenceInput> |
| | | |
| | | </Grid> |
| | | |
| | | <Grid item xs={4}> |
| | | } |
| | | {fieldType === 'typeIds' && |
| | | <Grid item xs={6}> |
| | | {/* <DictionarySelect |
| | | label={translate("table.field.loc.type")} |
| | | name="type" |
| | |
| | | <SelectArrayInput label="table.field.loc.type" onChange={(e) => handleChange(e.target.value, 'typeIds')} /> |
| | | </ReferenceArrayInput> |
| | | </Grid> |
| | | } |
| | | |
| | | <Grid item xs={4}> |
| | | {fieldType === 'status' && |
| | | <Grid item xs={6}> |
| | | <StatusSelectInput |
| | | onChange={(e) => handleChange(e.target.value, 'status')} |
| | | defaultValue={''} |
| | | require={false} |
| | | /> |
| | | </Grid> |
| | | |
| | | } |
| | | </Grid> |
| | | |
| | | </Box> |
| | |
| | | source="warehouseId" |
| | | label="table.field.loc.warehouseId" |
| | | reference="warehouse" |
| | | alwaysOn |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.warehouseId" |
| | |
| | | source="areaId" |
| | | label="table.field.loc.areaId" |
| | | reference="warehouseAreas" |
| | | alwaysOn |
| | | > |
| | | <AutocompleteInput |
| | | label="table.field.loc.areaId" |
| | |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | aside={<LocListAside />} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='loc' |
| | | align="left" |
| | | bulkActionButtons={ |
| | | <> |
| | | <BatchButton /> |
| | | <BatchWateButton /> |
| | | <BatchAreasButton /> |
| | | <BatchLocTypeButton /> |
| | | <BatchStatusButton /> |
| | | <BindButton /> |
| | | <SubzoneButton /> |
| | | <BulkDeleteButton /> |
| | |
| | | ) |
| | | } |
| | | |
| | | const BatchButton = () => { |
| | | const BatchWateButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batch"}> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchWarehouse"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'warehouseId'} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | |
| | | const BatchAreasButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchWarehouseAreas"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'areaId'} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | |
| | | const BatchLocTypeButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchLocType"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'typeIds'} |
| | | /> |
| | | </> |
| | | |
| | | ) |
| | | } |
| | | |
| | | const BatchStatusButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button onClick={() => setCreateDialog(true)} label={"toolbar.batchStatus"}> |
| | | <EditIcon /> |
| | | </Button> |
| | | |
| | | <BatchModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | fieldType={'status'} |
| | | /> |
| | | </> |
| | | |
| | |
| | | |
| | | } |
| | | const handleNodeSelect = (event, nodeId) => { |
| | | console.log(nodeId); |
| | | // setFilters({ groupId: nodeId }); |
| | | const row = apiRef.current.getItem(nodeId); |
| | | console.log(row); |
| | | |
| | | if (row.type === 'warehouseId') { |
| | | // setFilters({ warehouseId: row.id ,areaId:''}); |
| | | } else if (row.type === 'areaId') { |
| | | // setFilters({ areaId: row.id ,warehouseId:''}); |
| | | } |
| | | |
| | | }; |
| | | const handleSearch = (e) => { |
| | | setCondition(e.target.value) |
| | |
| | | |
| | | <RichTreeView |
| | | expansionTrigger="iconContainer" |
| | | checkboxSelection |
| | | multiSelect |
| | | // checkboxSelection |
| | | // multiSelect |
| | | items={matnrTree} |
| | | apiRef={apiRef} |
| | | getItemId={(item) => item.id} |
| | |
| | | |
| | | <RichTreeView |
| | | expansionTrigger="iconContainer" |
| | | checkboxSelection |
| | | multiSelect |
| | | items={locTree} |
| | | apiRef={apiRef} |
| | | selectedItems={selectedItems} |
| | | getItemId={(item) => item.id} |
| | | getItemLabel={(item) => item.name} |
| | | defaultExpandedItems={['grid']} |
| | | onSelectedItemsChange={handleSelectedItemsChange} |
| | | onItemSelectionToggle={handleItemSelectionToggle} |
| | | onItemClick={handleNodeSelect} |
| | | onItemSelectionToggle={handleItemSelectionToggle} |
| | | // checkboxSelection |
| | | // multiSelect |
| | | selectedItems={selectedItems} |
| | | onSelectedItemsChange={handleSelectedItemsChange} |
| | | /> |
| | | |
| | | <BindLocModal |
| | |
| | | <Grid key={item.id} item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label={item.fieldsAlise} |
| | | source={`extendFields.[${item.fields}]`} |
| | | source={item.fields} |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | |
| | | <Grid key={item.id} item xs={6} display="flex" gap={1}> |
| | | <TextInput |
| | | label={item.fieldsAlise} |
| | | source={`extendFields.[${item.fields}]`} |
| | | source={item.fields} |
| | | validate={required()} |
| | | /> |
| | | </Grid> |
| | |
| | | const fields = data.map(el => <TextField key={el.fields} source={`extendFields.[${el.fields}]`} label={el.fieldsAlise} />) |
| | | const opt = <WrapperField key="opt" cellClassName="fixed" className="fixed" label="common.field.opt"> |
| | | <EditButton sx={{ padding: '1px', fontSize: '.75rem' }} /> |
| | | <EnableButton /> |
| | | <PrintButton /> |
| | | </WrapperField> |
| | | setColumns([...arr, ...fields, opt]); |
| | | |
| | |
| | | <BatchStatusButton /> |
| | | <BatchLevelButton /> |
| | | <BindButton /> |
| | | <PrintButton /> |
| | | <BatchPrintButton /> |
| | | <BulkDeleteButton mutationMode={OPERATE_MODE} /> |
| | | </>} |
| | | rowClick={(id, resource, record) => false} |
| | |
| | | ) |
| | | } |
| | | |
| | | const PrintButton = () => { |
| | | const BatchPrintButton = () => { |
| | | const record = useRecordContext(); |
| | | const { resource, selectedIds } = useListContext(); |
| | | const notify = useNotify(); |
| | |
| | | ) |
| | | } |
| | | |
| | | const PrintButton = () => { |
| | | const record = useRecordContext(); |
| | | |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | |
| | | return ( |
| | | <> |
| | | <Button color="secondary" onClick={() => setCreateDialog(true)} label={"toolbar.print"}> |
| | | <PrintIcon /> |
| | | </Button> |
| | | |
| | | <PrintModal |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | rows={[record]} |
| | | /> |
| | | </> |
| | | ) |
| | | } |
| | | |
| | | const BindButton = () => { |
| | | const record = useRecordContext(); |
| | | const notify = useNotify(); |
| | |
| | | overflow: 'hidden', |
| | | fontSize: 'small', |
| | | tableLayout: 'fixed', |
| | | width: '280px', |
| | | width: '520px', |
| | | borderCollapse: 'collapse', |
| | | borderSpacing: 0, |
| | | margin: '0 auto', |
| | |
| | | String index = fieldsIndex.toString(); |
| | | FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); |
| | | for (Fields field : fields) { |
| | | Map<String, String> extendFields = (Map<String, String>) params.get("extendFields"); |
| | | if (!Objects.isNull(extendFields)) { |
| | | if (!Objects.isNull(extendFields.get(field.getFields()))) { |
| | | if (!Objects.isNull(params.get(field.getFields()))) { |
| | | FieldsItem indexItem = fieldsItemService.getOne(new LambdaQueryWrapper<FieldsItem>() |
| | | .eq(FieldsItem::getUuid, index) |
| | | .eq(FieldsItem::getFieldsId, field.getId())); |
| | |
| | | FieldsItem item = new FieldsItem(); |
| | | item.setUuid(index) |
| | | .setFieldsId(field.getId()) |
| | | .setValue(extendFields.get(field.getFields()).toString()); |
| | | .setValue(params.get(field.getFields()).toString()); |
| | | if (!fieldsItemService.save(item)) { |
| | | throw new CoolException("扩展字段修改失败!!"); |
| | | } |
| | | } else { |
| | | indexItem.setValue(extendFields.get(field.getFields()).toString()); |
| | | indexItem.setValue(params.get(field.getFields()).toString()); |
| | | if (!fieldsItemService.updateById(indexItem)) { |
| | | throw new CoolException("扩展字段修改失败!!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | saveFields(params, uuid16); |
| | | saveFields(params, params.get("index").toString()); |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.common.domain.PageResult; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import com.vincent.rsf.server.common.utils.ExcelUtil; |
| | | import com.vincent.rsf.server.common.annotation.OperationLog; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | @PreAuthorize("hasAuthority('manager:matnr:list')") |
| | | @PostMapping("/matnr/page") |
| | | public R page(@RequestBody Map<String, Object> map) { |
| | | // if (!Objects.isNull(map.get("groupId"))) { |
| | | // return R.ok(matnrService.getPages(map)); |
| | | // } else { |
| | | // BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | // PageParam<Matnr, BaseParam> pageParam = new PageParam<>(baseParam, Matnr.class); |
| | | // return R.ok().add(matnrService.getMatnrPage(pageParam, map)); |
| | | // } |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<Matnr, BaseParam> pageParam = new PageParam<>(baseParam, Matnr.class); |
| | | return R.ok().add(matnrService.getMatnrPage(pageParam)); |
| | | return R.ok().add(matnrService.getMatnrPage(pageParam, map)); |
| | | |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:matnr:list')") |
| | |
| | | throw new CoolException("名称不能为空!!"); |
| | | } |
| | | matnr.setUpdateBy(getLoginUserId()); |
| | | if (!matnrService.updateById(matnr)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | |
| | | if (!FieldsUtils.getFieldsSta().isEmpty()) { |
| | | Matnr matnr1 = matnrService.getById(matnr.getId()); |
| | | if (!Objects.isNull(matnr1.getFieldsIndex())) { |
| | | params.put("fieldsIndex", matnr1.getFieldsIndex()); |
| | | } else { |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | params.put("index", uuid16); |
| | | matnr.setFieldsIndex(uuid16); |
| | | } |
| | | FieldsUtils.updateFieldsValue(params); |
| | | } |
| | | |
| | | if (!matnrService.updateById(matnr)) { |
| | | return R.error("Update Fail"); |
| | | } |
| | | return R.ok("Update Success").add(matnr); |
| | | } |
| | | |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | |
| | | R saveMatnrs(Map<String, Object> matnr); |
| | | |
| | | PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam); |
| | | PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam, Map<String, Object> map); |
| | | |
| | | Matnr selectMatnrById(Long id); |
| | | |
| | | boolean bindMatnrs(MatnrToGroupParams params); |
| | | |
| | | boolean batchUpdate(MatnrToGroupParams params); |
| | | |
| | | PageParam<Matnr, BaseParam> getPages(Map<String, Object> map); |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("matnrService") |
| | | public class MatnrServiceImpl extends ServiceImpl<MatnrMapper, Matnr> implements MatnrService { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam) { |
| | | public PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam, Map<String, Object> params) { |
| | | QueryWrapper<Matnr> queryWrapper = pageParam.buildWrapper(true); |
| | | IPage<Map<String, Object>> reulst = this.baseMapper.selectMatnrs(pageParam, pageParam.buildWrapper(true)); |
| | | /**获取物料分页信息 */ |
| | | List<Map<String, Object>> mapList = reulst.getRecords(); |
| | | if (!mapList.isEmpty()) { |
| | | mapList.forEach(map -> { |
| | | if (!Objects.isNull(map.get("fieldsIndex"))) { |
| | | FieldsUtils.mergeFields(map, map.get("fieldsIndex").toString()); |
| | | if (params.containsKey("groupId")) { |
| | | Object groupId = params.get("groupId"); |
| | | if (!Objects.isNull(groupId)) { |
| | | List<MatnrGroup> matnrGroups = matnrGroupService.list(new LambdaQueryWrapper<MatnrGroup>().eq(MatnrGroup::getParentId, Long.parseLong(groupId.toString())).select(MatnrGroup::getId)); |
| | | if (!matnrGroups.isEmpty()) { |
| | | List<Long> longs = matnrGroups.stream().map(MatnrGroup::getId).collect(Collectors.toList()); |
| | | queryWrapper.or().in("group_id", longs); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | // IPage<Map<String, Object>> reulst = this.baseMapper.selectMatnrs(pageParam, queryWrapper); |
| | | // /**获取物料分页信息 */ |
| | | // List<Map<String, Object>> mapList = reulst.getRecords(); |
| | | // if (!mapList.isEmpty()) { |
| | | // mapList.forEach(map -> { |
| | | // if (!Objects.isNull(map.get("fieldsIndex"))) { |
| | | // FieldsUtils.mergeFields(map, map.get("fieldsIndex").toString()); |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | PageParam<Matnr, BaseParam> page = this.page(pageParam, pageParam.buildWrapper(true)); |
| | | /**拼接扩展字段*/ |
| | | PageParam<Matnr, BaseParam> page = this.page(pageParam, queryWrapper); |
| | | List<Matnr> records = page.getRecords(); |
| | | for (Matnr record : records) { |
| | | if (!Objects.isNull(record.getFieldsIndex())) { |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public PageParam<Matnr, BaseParam> getPages(Map<String, Object> map) { |
| | | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * @desc 更新扩展物料扩展字段值 |
| | | * @param matnr |
| | |
| | | */ |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | if (!FieldsUtils.getFieldsSta().isEmpty()) { |
| | | Map<String, ?> extendFields = (Map<String, ?>) matnr.get("extendFields"); |
| | | // Map<String, ?> extendFields = (Map<String, ?>) matnr.get("extendFields"); |
| | | try { |
| | | FieldsUtils.saveFields(extendFields, uuid16); |
| | | FieldsUtils.saveFields(matnr, uuid16); |
| | | matnr1.setFieldsIndex(uuid16); |
| | | } catch (Exception ex) { |
| | | log.error(ex.toString()); |