| | |
| | | |
| | | |
| | | const CreateBySelectMats = (props) => { |
| | | const { open, setOpen, data, setData } = props; |
| | | const { open, setOpen, data, setData, queryForm } = props; |
| | | const [page, setPage] = useState({ page: DEFAULT_START_PAGE, pageSize: DEFAULT_PAGE_SIZE }); |
| | | const [rowCount, setRowCount] = useState(0); |
| | | const [isLoading, setIsLoading] = useState(false); |
| | |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const refresh = useRefresh(); |
| | | |
| | | console.log("-----=====>"); |
| | | console.log(queryForm); |
| | | |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setOpen(false); |
| | |
| | | }; |
| | | |
| | | const getData = async () => { |
| | | setIsLoading(true) |
| | | const res = await request.post(`/transfer/locs/items`, { |
| | | let params = { |
| | | ...formData, |
| | | orgAreaId: queryForm?.orgAreaId, |
| | | current: page?.page, |
| | | pageSize: page?.pageSize, |
| | | orderBy: "create_time desc" |
| | | }); |
| | | }; |
| | | setIsLoading(true) |
| | | const res = await request.post(`/transfer/locs/items`, params); |
| | | if (res?.data?.code === 200) { |
| | | const { data } = res.data; |
| | | setTableData(data?.records); |
| | |
| | | notify("目标库区不能为空!!", { type: 'error' }) |
| | | return |
| | | } |
| | | console.log(formData); |
| | | |
| | | setCreateDialog(true) |
| | | } |
| | | |
| | |
| | | </Button> |
| | | </Toolbar> |
| | | <CreateBySelectMats |
| | | data={tabelData} |
| | | queryForm={formData} |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | selectedRows={selectedRows} |
| | | setSelectedRows={setSelectedRows} |
| | | data={tabelData} |
| | | setData={setTableData} |
| | | /> |
| | | </Box> |
| | |
| | | const tableIds = tabelData.map(map => map.id); |
| | | // setSelectedRows(tableIds); |
| | | // // console.log(selectedRows); |
| | | |
| | | |
| | | |
| | | return ( |
| | | <Box> |
| | |
| | | List<Loc> locs = locService.list(new LambdaQueryWrapper<Loc>() |
| | | .eq(Loc::getUseStatus, LocStsType.LOC_STS_TYPE_F.type) |
| | | .eq(!Objects.isNull(params.getOrgAreaId()), Loc::getAreaId, params.getOrgAreaId())); |
| | | |
| | | Page<LocItem> page = new Page<>(params.getCurrent(), params.getPageSize()); |
| | | QueryWrapper<LocItem> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("id, matnr_id, maktx, matnr_code, SUM(anfme) anfme, SUM(work_qty) work_qty, SUM(qty) qty, batch, unit, fields_index, model, spec, loc_id ") |
| | | .lambda() |
| | | .eq(StringUtils.isNotBlank(params.getMatnrCode()), LocItem::getMatnrCode, params.getMatnrCode()) |
| | | .like(StringUtils.isNotBlank(params.getMaktx()), LocItem::getMaktx, params.getMaktx()); |
| | | if (!locs.isEmpty()) { |
| | | Page<LocItem> page = new Page<>(params.getCurrent(), params.getPageSize()); |
| | | QueryWrapper<LocItem> wrapper = new QueryWrapper<>(); |
| | | wrapper.select("id, matnr_id, maktx, matnr_code, SUM(anfme) anfme, SUM(work_qty) work_qty, SUM(qty) qty, batch, unit, fields_index, model, spec, loc_id ") |
| | | .lambda() |
| | | .eq(StringUtils.isNotBlank(params.getMatnrCode()), LocItem::getMatnrCode, params.getMatnrCode()) |
| | | .like(StringUtils.isNotBlank(params.getMaktx()), LocItem::getMaktx, params.getMaktx()); |
| | | Set<Long> locIds = locs.stream().map(Loc::getId).collect(Collectors.toSet()); |
| | | wrapper.lambda().in(LocItem::getLocId, locIds) |
| | | .groupBy(LocItem::getBatch, LocItem::getFieldsIndex, LocItem::getMatnrCode); |
| | | return locItemService.page(page, wrapper); |
| | | } else { |
| | | return locItemService.page(page, wrapper); |
| | | IPage<LocItem> page = new Page<>(params.getCurrent(), params.getPageSize()); |
| | | return page; |
| | | } |
| | | } |
| | | } |