| | |
| | | import { Box, Typography, Card, Stack, Dialog, DialogActions, DialogTitle } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import OutOrderItemCreate from "./OutOrderItemCreate"; |
| | | import EmptyData from "../../components/EmptyData"; |
| | | import MyCreateButton from "../../components/MyCreateButton"; |
| | | import MyExportButton from '../../components/MyExportButton'; |
| | | import PageDrawer from "../../components/PageDrawer"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | import OutOrderItemEdit from "./OutOrderItemEdit"; |
| | | import ImportButton from "../../components/ImportButton"; |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | <MyCreateButton onClick={() => { setCreateDialog(true) }} /> |
| | | <SelectColumnsButton preferenceKey='outStockItem' /> |
| | | {/* <MyExportButton /> */} |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_ITEM_PAGE_SIZE} |
| | |
| | | <StyledDatagrid |
| | | preferenceKey='outStockItem' |
| | | bulkActionButtons={false} |
| | | rowClick={(id, resource, record) => { |
| | | setSelect(record) |
| | | setEditDialog(true) |
| | | }} |
| | | rowClick={false} |
| | | omit={['id', 'createTime', 'createBy', 'memo', 'poDetlId', 'purQty', 'purUnit', 'trackCode', 'packName', 'qrcode', 'splrName', 'matnrId', 'asnId']} |
| | | > |
| | | <NumberField source="id" /> |
| | |
| | | import ImportButton from "../../components/ImportButton"; |
| | | import DetailsIcon from '@mui/icons-material/Details'; |
| | | import CancelOutlinedIcon from '@mui/icons-material/CancelOutlined'; |
| | | import OutOrderCreate from "./OutOrderCreate"; |
| | | import AddIcon from '@mui/icons-material/Add'; |
| | | import OutOrderModal from "./OutOrderModal"; |
| | | import PublicIcon from '@mui/icons-material/Public'; |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo } from "react"; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | Button, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | WrapperField, |
| | | Toolbar, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | SimpleForm, |
| | | Form, |
| | | SaveButton, |
| | | useRefresh, |
| | | useGetList, |
| | | } from 'react-admin'; |
| | | |
| | | const OutStockPublic = (props) => { |
| | | |
| | | return ( |
| | | <> |
| | | |
| | | </> |
| | | ); |
| | | } |
| | | |
| | | export default OutStockPublic; |
| | |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | Map<Long, List<DeliveryItem>> listMap = items.stream().collect(Collectors.groupingBy(DeliveryItem::getDeliveryId)); |
| | | //获取第一个ID |
| | | Long deliveryId = items.stream().findFirst().get().getDeliveryId(); |
| | | Delivery delivery = deliveryService.getById(deliveryId); |
| | | listMap.keySet().forEach(key -> { |
| | | //TODO 判断单据是否已经存在,如存在则累加修改子表,不存在才新建 |
| | | Delivery delivery = deliveryService.getById(key); |
| | | if (Objects.isNull(delivery)) { |
| | | throw new CoolException("主单据不存在!!"); |
| | | throw new CoolException("单据不存在!!"); |
| | | } |
| | | AsnOrder order = new AsnOrder(); |
| | | BeanUtils.copyProperties(delivery, order); |
| | |
| | | .setType(delivery.getType()) |
| | | .setWkType(delivery.getWkType()) |
| | | .setCode(ruleCode) |
| | | .setPoId(delivery.getId()) |
| | | .setId(null) |
| | | .setUpdateBy(loginUserId) |
| | | .setCreateBy(loginUserId); |
| | | .setCreateBy(loginUserId) |
| | | .setPoCode(delivery.getCode()); |
| | | if (!this.save(order)) { |
| | | throw new CoolException("主单保存失败!!"); |
| | | } |
| | | |
| | | listMap.keySet().forEach(key -> { |
| | | Delivery delivery1 = deliveryService.getById(key); |
| | | List<AsnOrderItem> orderItems = new ArrayList<>(); |
| | | listMap.get(key).forEach(item -> { |
| | | AsnOrderItem orderItem = new AsnOrderItem(); |
| | | Double anfme = Math.round((item.getAnfme() - item.getWorkQty() - item.getQty()) * 10000) / 10000.0; |
| | | BeanUtils.copyProperties(item, orderItem); |
| | | orderItem.setId(null) |
| | | .setPoCode(delivery1.getCode()) |
| | | .setPoCode(order.getPoCode()) |
| | | .setMaktx(item.getMaktx()) |
| | | .setMatnrCode(item.getMatnrCode()) |
| | | .setFieldsIndex(item.getFieldsIndex()) |
| | |
| | | .setPlatOrderCode(item.getPlatOrderCode()) |
| | | .setProjectCode(item.getProjectCode()) |
| | | .setPlatItemId(item.getPlatItemId()) |
| | | .setFieldsIndex(item.getFieldsIndex()) |
| | | .setUpdateBy(loginUserId) |
| | | .setCreateBy(loginUserId) |
| | | .setPoDetlId(item.getId()); |
| | |
| | | }); |
| | | |
| | | Double sum = orderItems.stream().mapToDouble(AsnOrderItem::getAnfme).sum(); |
| | | |
| | | //修改计划数量 |
| | | order.setAnfme(sum).setWorkQty(0.0); |
| | | if (!this.saveOrUpdate(order)) { |
| | | throw new CoolException("主单数量修改失败!!"); |
| | | } |
| | | if (!asnOrderItemService.saveBatch(orderItems)) { |
| | | throw new CoolException("明细保存失败!!"); |
| | | } |
| | | |
| | | Short exceStatus = POExceStatus.PO_EXCE_STATUS_SECTION_DONE.val; |
| | | if (delivery1.getAnfme().compareTo(sum) <= 0) { |
| | | if (delivery.getAnfme().compareTo(order.getAnfme()) <= 0) { |
| | | exceStatus = AsnExceStatus.ASN_EXCE_STATUS_TASK_DONE.val; |
| | | } |
| | | |
| | |
| | | .eq(Delivery::getId, key))) { |
| | | throw new CoolException("主单修改失败!!"); |
| | | } |
| | | |
| | | }); |
| | | |
| | | Double sum = items.stream().mapToDouble(DeliveryItem::getAnfme).sum(); |
| | | //修改计划数量 |
| | | order.setAnfme(sum).setWorkQty(0.0); |
| | | if (!this.saveOrUpdate(order)) { |
| | | throw new CoolException("主单数量修改失败!!"); |
| | | } |
| | | |
| | | return R.ok(); |
| | | } |
| | | |