| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <AsnCreatButton /> |
| | | <MyCreateButton onClick={() => { setOpCreateDialog(true) }} /> |
| | | {/* <MyCreateButton onClick={() => { setOpCreateDialog(true) }} /> */} |
| | | <FilterButton /> |
| | | <SelectColumnsButton preferenceKey='qlyInspect' /> |
| | | <MyExportButton /> |
| | |
| | | |
| | | const PrintLabelButton = () => { |
| | | const record = useRecordContext(); |
| | | |
| | | |
| | | } |
| | | |
| | | const InspectionButton = () => { |
| | |
| | | storeKey="qlyIsptItem" |
| | | resource="qlyIsptItem" |
| | | filter={{ ispectId: isptId }} |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.qlyIsptItem"} |
| | | empty={false} |
| | | filters={filters} |
| | |
| | | })); |
| | | |
| | | const QlyIsptItemResult = (props) => { |
| | | const { record, drawerVal, setDrawerVal } = props |
| | | const { record, drawerVal, setDrawerVal, from } = props |
| | | const translate = useTranslate(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const handleClose = (event, reason) => { |
| | |
| | | <List |
| | | storeKey="IsptItem" |
| | | resource="qlyIsptItem/ispt/result" |
| | | filter={{ id: record?.id }} |
| | | filter={{ id: record?.id, type: '1' }} |
| | | empty={false} |
| | | filters={false} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | |
| | | import MyField from "../components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE } from '@/config/setting'; |
| | | import * as Common from '@/utils/common'; |
| | | import WarehouseIsptResult from "./WarehouseIsptResult" |
| | | |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | |
| | | |
| | | const WarehouseAreasItemList = () => { |
| | | const translate = useTranslate(); |
| | | |
| | | const [itemInfo, setItemInfo] = useState({}) |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | |
| | | return ( |
| | | <Box display="flex"> |
| | | <List |
| | | sx={{ |
| | | flexGrow: 1, |
| | | transition: (theme) => |
| | | theme.transitions.create(['all'], { |
| | | duration: theme.transitions.duration.enteringScreen, |
| | | }), |
| | | marginRight: drawerVal ? `${PAGE_DRAWER_WIDTH}px` : 0, |
| | | }} |
| | | title={"menu.warehouseAreasItem"} |
| | | empty={false} |
| | | filters={filters} |
| | |
| | | actions={( |
| | | <TopToolbar> |
| | | <FilterButton /> |
| | | {/* <MyCreateButton onClick={() => { setCreateDialog(true) }} /> */} |
| | | <SelectColumnsButton preferenceKey='warehouseAreasItem' /> |
| | | <MyExportButton /> |
| | | </TopToolbar> |
| | | )} |
| | | perPage={DEFAULT_PAGE_SIZE} |
| | | > |
| | | <DynamicFields /> |
| | | <DynamicFields |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | itemInfo={itemInfo} |
| | | setItemInfo={setItemInfo} /> |
| | | </List> |
| | | <WarehouseAreasItemCreate |
| | | open={createDialog} |
| | | setOpen={setCreateDialog} |
| | | /> |
| | | <PageDrawer |
| | | <WarehouseIsptResult |
| | | record={itemInfo} |
| | | drawerVal={drawerVal} |
| | | from="warehosueItem" |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </WarehouseIsptResult> |
| | | {/* <PageDrawer |
| | | title='WarehouseAreasItem Detail' |
| | | drawerVal={drawerVal} |
| | | setDrawerVal={setDrawerVal} |
| | | > |
| | | </PageDrawer> |
| | | </PageDrawer> */} |
| | | </Box> |
| | | ) |
| | | } |
| | |
| | | |
| | | |
| | | const DynamicFields = (props) => { |
| | | const { drawerVal, setDrawerVal, itemInfo, setItemInfo } = props |
| | | const translate = useTranslate(); |
| | | const notify = useNotify(); |
| | | const [columns, setColumns] = useState([]); |
| | |
| | | <NumberField source="anfme" label="table.field.warehouseAreasItem.anfme" />, |
| | | <NumberField source="workQty" label="table.field.warehouseAreasItem.workQty" />, |
| | | <NumberField source="qty" label="table.field.warehouseAreasItem.qty" />, |
| | | <MyField source="isptQty" label="table.field.qlyIsptItem.anfme" |
| | | onClick={(event, record, val) => { |
| | | event.stopPropagation(); |
| | | setItemInfo(record) |
| | | setDrawerVal(!!drawerVal && drawerVal === val ? null : val); |
| | | }} |
| | | />, |
| | | <TextField source="splrBatch" label="table.field.warehouseAreasItem.splrBtch" />, |
| | | <TextField source="batch" label="table.field.warehouseAreasItem.batch" />, |
| | | <TextField source="unit" label="table.field.warehouseAreasItem.unit" />, |
New file |
| | |
| | | import React, { useState, useRef, useEffect, useMemo, useCallback } from "react"; |
| | | import { useNavigate } from 'react-router-dom'; |
| | | import { |
| | | List, |
| | | DatagridConfigurable, |
| | | SearchInput, |
| | | TopToolbar, |
| | | SelectColumnsButton, |
| | | EditButton, |
| | | FilterButton, |
| | | CreateButton, |
| | | ExportButton, |
| | | BulkDeleteButton, |
| | | WrapperField, |
| | | useRecordContext, |
| | | useTranslate, |
| | | useNotify, |
| | | useListContext, |
| | | FunctionField, |
| | | TextField, |
| | | NumberField, |
| | | DateField, |
| | | BooleanField, |
| | | ReferenceField, |
| | | TextInput, |
| | | DateTimeInput, |
| | | DateInput, |
| | | SelectInput, |
| | | NumberInput, |
| | | ReferenceInput, |
| | | ReferenceArrayInput, |
| | | AutocompleteInput, |
| | | DeleteButton, |
| | | useGetOne, |
| | | Button, |
| | | useRefresh, |
| | | useGetRecordId, |
| | | } from 'react-admin'; |
| | | import { Box, Typography, Card, Stack, LinearProgress, Dialog, DialogActions, DialogContent, DialogTitle, } from '@mui/material'; |
| | | import { styled } from '@mui/material/styles'; |
| | | import DialogCloseButton from "../components/DialogCloseButton"; |
| | | import request from '@/utils/request'; |
| | | import MyField from "@/page/components/MyField"; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_ITEM_PAGE_SIZE } from '@/config/setting'; |
| | | |
| | | |
| | | |
| | | const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({ |
| | | '& .css-1vooibu-MuiSvgIcon-root': { |
| | | height: '.9em' |
| | | }, |
| | | '& .RaDatagrid-row': { |
| | | cursor: 'auto' |
| | | }, |
| | | '& .column-name': { |
| | | }, |
| | | '& .opt': { |
| | | width: 200 |
| | | }, |
| | | })); |
| | | |
| | | const WarehouseIsptResult = (props) => { |
| | | const { record, drawerVal, setDrawerVal, from } = props |
| | | const translate = useTranslate(); |
| | | const [createDialog, setCreateDialog] = useState(false); |
| | | const handleClose = (event, reason) => { |
| | | if (reason !== "backdropClick") { |
| | | setDrawerVal(false); |
| | | } |
| | | }; |
| | | |
| | | return ( |
| | | <Dialog |
| | | open={drawerVal} |
| | | onClose={handleClose} |
| | | aria-labelledby="form-dialog-title" |
| | | fullWidth |
| | | disableRestoreFocus |
| | | maxWidth="lg" |
| | | > |
| | | <DialogTitle id="form-dialog-title" sx={{ |
| | | position: 'sticky', |
| | | top: 0, |
| | | backgroundColor: 'background.paper', |
| | | zIndex: 1000 |
| | | }}> |
| | | <Box sx={{ position: 'absolute', top: 8, right: 8, zIndex: 1001 }}> |
| | | <DialogCloseButton onClose={handleClose} /> |
| | | </Box> |
| | | </DialogTitle> |
| | | <DialogContent sx={{ mt: 2 }}> |
| | | <List |
| | | storeKey="ReceiptIsptItem" |
| | | resource="warehouseAreasItem/ispts" |
| | | filter={{ id: record?.id}} |
| | | empty={false} |
| | | filters={false} |
| | | sort={{ field: "create_time", order: "desc" }} |
| | | actions={false} |
| | | perPage={DEFAULT_ITEM_PAGE_SIZE} |
| | | > |
| | | <StyledDatagrid |
| | | preferenceKey='ReceiptIsptItem' |
| | | bulkActionButtons={false} |
| | | rowClick={false} |
| | | omit={['id', 'memo', 'dlyQty', 'label', 'stockBatch', 'picPath', 'ispectId']} |
| | | > |
| | | <NumberField source="id" /> |
| | | <NumberField source="ispectId" label="table.field.qlyIsptItem.ispectId" /> |
| | | <TextField source="matnrCode" label="table.field.qlyIsptItem.matnrCode" /> |
| | | <TextField source="maktx" label="table.field.qlyIsptItem.maktx" /> |
| | | <TextField source="label" label="table.field.qlyIsptItem.label" /> |
| | | <TextField source="splrBatch" label="table.field.qlyIsptItem.splrBatch" /> |
| | | <NumberField source="dlyQty" label="table.field.qlyIsptItem.dlyQty" /> |
| | | <NumberField source="anfme" label="table.field.qlyIsptItem.anfme" /> |
| | | <TextField source="splrName" label="table.field.qlyIsptItem.splrName" /> |
| | | <NumberField source="isptResult$" label="table.field.qlyIsptItem.isptResult" /> |
| | | </StyledDatagrid> |
| | | </List> |
| | | </DialogContent> |
| | | </Dialog> |
| | | ) |
| | | } |
| | | |
| | | export default WarehouseIsptResult; |
| | |
| | | .eq(WarehouseAreasItem::getAsnCode, item.getAsnCode()) |
| | | .eq(!Cools.isEmpty(item.getIsptResult()), WarehouseAreasItem::getIsptResult, item.getIsptResult()) |
| | | .eq(StringUtils.isNotBlank(item.getSplrBatch()), WarehouseAreasItem::getSplrBatch, item.getSplrBatch())); |
| | | |
| | | if (!Objects.isNull(serviceOne)) { |
| | | item.setId(serviceOne.getId()); |
| | | item.setAnfme(item.getAnfme() + serviceOne.getAnfme()); |
| | |
| | | import com.vincent.rsf.server.manager.controller.params.IsptOrderParam; |
| | | import com.vincent.rsf.server.manager.controller.params.QlyInspectAndItem; |
| | | import com.vincent.rsf.server.manager.entity.QlyInspect; |
| | | import com.vincent.rsf.server.manager.entity.QlyIsptItem; |
| | | import com.vincent.rsf.server.manager.service.QlyInspectService; |
| | | import com.vincent.rsf.server.manager.service.QlyIsptItemService; |
| | | import com.vincent.rsf.server.system.constant.SerialRuleCode; |
| | | import com.vincent.rsf.server.system.controller.BaseController; |
| | | import com.vincent.rsf.server.system.utils.SerialRuleUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.*; |
| | | |
| | | @Slf4j |
| | | @Api(tags = "质检信息") |
| | | @RestController |
| | | public class QlyInspectController extends BaseController { |
| | | |
| | | @Autowired |
| | | private QlyInspectService qlyInspectService; |
| | | @Autowired |
| | | private QlyIsptItemService qlyIsptItemService; |
| | | |
| | | @PreAuthorize("hasAuthority('manager:qlyInspect:list')") |
| | | @PostMapping("/qlyInspect/page") |
| | |
| | | return R.error("有明细单据已在质检中!!"); |
| | | } |
| | | if (!qlyInspectService.removeByIds(Arrays.asList(ids))) { |
| | | return R.error("Delete Fail"); |
| | | return R.error("主单删除失败!!"); |
| | | } |
| | | |
| | | if (!qlyIsptItemService.remove(new LambdaQueryWrapper<QlyIsptItem>().in(QlyIsptItem::getIspectId, ids))) { |
| | | return R.error("明细删除失败!!"); |
| | | } |
| | | return R.ok("Delete Success").add(ids); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.common.R; |
| | |
| | | return R.ok().add(page); |
| | | } |
| | | |
| | | |
| | | @PreAuthorize("hasAuthority('manager:warehouseAreasItem:list')") |
| | | @PostMapping("/warehouseAreasItem/ispts/page") |
| | | public R getIsptPage(@RequestBody Map<String, Object> map) { |
| | | BaseParam baseParam = buildParam(map, BaseParam.class); |
| | | PageParam<WarehouseAreasItem, BaseParam> pageParam = new PageParam<>(baseParam, WarehouseAreasItem.class); |
| | | QueryWrapper<WarehouseAreasItem> queryWrapper = pageParam.buildWrapper(true); |
| | | /**拼接扩展字段*/ |
| | | IPage<WarehouseAreasItem> page = warehouseAreasItemService.pageByItemId(pageParam, queryWrapper); |
| | | List<WarehouseAreasItem> records = page.getRecords(); |
| | | for (WarehouseAreasItem record : records) { |
| | | if (!Objects.isNull(record.getFieldsIndex())) { |
| | | Map<String, String> fields = FieldsUtils.getFields(record.getFieldsIndex()); |
| | | record.setExtendFields(fields); |
| | | } |
| | | } |
| | | page.setRecords(records); |
| | | return R.ok().add(page); |
| | | } |
| | | |
| | | @PreAuthorize("hasAuthority('manager:warehouseAreasItem:list')") |
| | | @PostMapping("/warehouseAreasItem/list") |
| | | public R list(@RequestBody Map<String, Object> map) { |
| | |
| | | @ApiModelProperty(value= "ASN主单标识") |
| | | private Long asnId; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 平台标识(行号) |
| | | */ |
| | |
| | | @ApiModelProperty(value= "质检明细单ID") |
| | | private Long isptItemId; |
| | | |
| | | @ApiModelProperty("收货区库存ID") |
| | | private Long rcptId; |
| | | |
| | | /** |
| | | * 数量 |
| | | */ |
| | |
| | | |
| | | @ApiModelProperty("单据明细ID") |
| | | private Long asnItemId; |
| | | |
| | | @ApiModelProperty("收货明细ID") |
| | | private Long rcptId; |
| | | /** |
| | | * 编号 |
| | | */ |
| | |
| | | package com.vincent.rsf.server.manager.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreasItem; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface WarehouseAreasItemMapper extends BaseMapper<WarehouseAreasItem> { |
| | | |
| | | IPage<WarehouseAreasItem> pageByItemId(PageParam<WarehouseAreasItem, BaseParam> pageParam, @Param(Constants.WRAPPER) QueryWrapper<WarehouseAreasItem> queryWrapper); |
| | | } |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.vincent.rsf.framework.common.Cools; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.api.entity.dto.ReceiptDetlsDto; |
| | | import com.vincent.rsf.server.common.config.SysStockProperties; |
| | | import com.vincent.rsf.server.common.utils.CommonUtil; |
| | | import com.vincent.rsf.server.common.utils.DateUtils; |
| | |
| | | .setAreaName(areaName) |
| | | .setAsnId(order.getId()); |
| | | items.add(param); |
| | | Matnr matnr = matnrService.getOne(new LambdaQueryWrapper<Matnr>().eq(Matnr::getId, item.getMatnrId())); |
| | | if (Objects.isNull(matnr)) { |
| | | throw new CoolException("物料不存在!!"); |
| | | } |
| | | //更新收货区库存 |
| | | extracted(one, item, order, matnr); |
| | | |
| | | if (!asnOrderItemService.update(new LambdaUpdateWrapper<AsnOrderItem>().set(AsnOrderItem::getQty, item.getAnfme()).eq(AsnOrderItem::getId, item.getId()))) { |
| | | throw new CoolException("收货单明细完成数量修改失败!!"); |
| | | } |
| | | } |
| | | if (!warehouseAreasItemService.saveBatch(items)) { |
| | | throw new CoolException("收货单保存至收货区执行失败!!"); |
| | | } |
| | | // if (!warehouseAreasItemService.saveBatch(items)) { |
| | | // throw new CoolException("收货单保存至收货区执行失败!!"); |
| | | // } |
| | | |
| | | if (!asnOrderService.update(new LambdaUpdateWrapper<AsnOrder>() |
| | | .set(AsnOrder::getQty, order.getQty()) |
| | |
| | | |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/5/12 |
| | | * @description: 收货区库存更新 |
| | | * @version 1.0 |
| | | */ |
| | | private void extracted(WarehouseAreas areasItem, AsnOrderItem orderItem, AsnOrder asnOrder, Matnr matnr) { |
| | | WarehouseAreasItem item = new WarehouseAreasItem(); |
| | | item.setTrackCode(orderItem.getBarcode()) |
| | | .setAreaName(areasItem.getName()) |
| | | .setAreaId(areasItem.getId()) |
| | | .setAsnItemId(orderItem.getId()) |
| | | .setAsnCode(asnOrder.getCode()) |
| | | .setAsnId(asnOrder.getId()) |
| | | .setProdTime(orderItem.getProdTime()) |
| | | //库存单位为最小单位 |
| | | .setUnit(orderItem.getStockUnit()) |
| | | .setStockUnit(orderItem.getStockUnit()) |
| | | .setMatnrCode(matnr.getCode()) |
| | | .setAnfme(orderItem.getAnfme()) |
| | | .setMatnrId(matnr.getId()) |
| | | .setIsptResult(orderItem.getIsptResult()) |
| | | .setMaktx(matnr.getName()) |
| | | .setWeight(matnr.getWeight()) |
| | | .setFieldsIndex(orderItem.getFieldsIndex()) |
| | | .setShipperId(matnr.getShipperId()); |
| | | WarehouseAreasItem serviceOne = warehouseAreasItemService.getOne(new LambdaQueryWrapper<WarehouseAreasItem>() |
| | | .eq(WarehouseAreasItem::getMatnrCode, item.getMatnrCode()) |
| | | .eq(!Cools.isEmpty(item.getFieldsIndex()), WarehouseAreasItem::getFieldsIndex, item.getFieldsIndex()) |
| | | .eq(WarehouseAreasItem::getAsnCode, item.getAsnCode()) |
| | | .eq(!Cools.isEmpty(item.getIsptResult()), WarehouseAreasItem::getIsptResult, item.getIsptResult()) |
| | | .eq(StringUtils.isNotBlank(item.getSplrBatch()), WarehouseAreasItem::getSplrBatch, item.getSplrBatch())); |
| | | if (!Objects.isNull(serviceOne)) { |
| | | item.setId(serviceOne.getId()); |
| | | item.setAnfme(item.getAnfme() + serviceOne.getAnfme()); |
| | | } |
| | | //未质检 |
| | | if (!warehouseAreasItemService.saveOrUpdate(item)) { |
| | | throw new CoolException("收货失败!!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return |
| | | * @throws |
| | | * @author Ryan |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreasItem; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | |
| | | |
| | | List<WarehouseAreasItem> getList(); |
| | | |
| | | IPage<WarehouseAreasItem> pageByItemId(PageParam<WarehouseAreasItem, BaseParam> pageParam, QueryWrapper<WarehouseAreasItem> queryWrapper); |
| | | } |
| | |
| | | try { |
| | | if (Objects.isNull(asnOrderItem.getFieldsIndex()) || StringUtils.isBlank(asnOrderItem.getFieldsIndex())) { |
| | | StringBuffer sb = new StringBuffer(); |
| | | if (!asnOrderItem.getExtendFields().isEmpty()) { |
| | | if (!Objects.isNull(asnOrderItem.getExtendFields()) && !asnOrderItem.getExtendFields().isEmpty()) { |
| | | Map<String, String> fields = asnOrderItem.getExtendFields(); |
| | | asnOrderItem.getExtendFields().keySet().forEach(key -> { |
| | | sb.append(fields.get(key)); |
| | |
| | | isptItem.setAsnItemId(orderItem.getId()) |
| | | .setIspectId(inspect.getId()) |
| | | .setRcptQty(orderItem.getAnfme()) |
| | | .setRcptId(orderItem.getId()) |
| | | .setAnfme(0.0) |
| | | .setFieldsIndex(orderItem.getFieldsIndex()) |
| | | .setSplrBatch(orderItem.getSplrBatch()) |
| | |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.controller.params.IsptItemsParams; |
| | | import com.vincent.rsf.server.manager.entity.QlyInspect; |
| | | import com.vincent.rsf.server.manager.entity.QlyInspectResult; |
| | | import com.vincent.rsf.server.manager.entity.*; |
| | | import com.vincent.rsf.server.manager.enums.QlyIsptResult; |
| | | import com.vincent.rsf.server.manager.mapper.QlyIsptItemMapper; |
| | | import com.vincent.rsf.server.manager.entity.QlyIsptItem; |
| | | import com.vincent.rsf.server.manager.service.AsnOrderItemService; |
| | | import com.vincent.rsf.server.manager.service.QlyInspectResultService; |
| | | import com.vincent.rsf.server.manager.service.QlyInspectService; |
| | | import com.vincent.rsf.server.manager.service.QlyIsptItemService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private QlyInspectResultService qlyInspectResultService; |
| | | @Autowired |
| | | private QlyIsptItemService qlyIsptItemService; |
| | | @Autowired |
| | | private WarehouseAreasItemServiceImpl warehouseAreasItemService; |
| | | |
| | | /** |
| | | * @param |
| | |
| | | |
| | | QlyInspectResult result = new QlyInspectResult(); |
| | | result.setIsptId(item.getIspectId()) |
| | | .setRcptId(item.getRcptId()) |
| | | .setIsptItemId(item.getId()); |
| | | if (!Objects.isNull(item.getDisQty()) && item.getDisQty().compareTo(0.00) > 0) { |
| | | result.setAnfme(item.getDisQty()) |
| | |
| | | |
| | | result = new QlyInspectResult(); |
| | | result.setIsptId(item.getIspectId()) |
| | | .setRcptId(item.getRcptId()) |
| | | .setIsptItemId(item.getId()); |
| | | if (!Objects.isNull(item.getSafeQty()) && item.getSafeQty().compareTo(0.00) > 0) { |
| | | result.setAnfme(item.getSafeQty()) |
| | |
| | | .eq(QlyIsptItem::getId, item.getId()))) { |
| | | throw new CoolException("单据明细数量修改失败!!"); |
| | | } |
| | | |
| | | WarehouseAreasItem orderItem = warehouseAreasItemService.getById(item.getRcptId()); |
| | | if (Objects.isNull(orderItem)) { |
| | | throw new CoolException("收货单据不存在!!"); |
| | | } |
| | | Double sum = item.getDisQty() + item.getSafeQty(); |
| | | orderItem.setIsptQty(sum); |
| | | |
| | | if (!warehouseAreasItemService.updateById(orderItem)) { |
| | | throw new CoolException("收货区库存信息更新失败!!"); |
| | | } |
| | | |
| | | if (Objects.isNull(orderItem.getIsptResult())) { |
| | | operateReceipt(item, orderItem); |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | |
| | | Set<Long> isptIds = isptItem.stream().map(QlyIsptItem::getIspectId).collect(Collectors.toSet()); |
| | | List<QlyInspectResult> items = qlyInspectResultService.list(new LambdaQueryWrapper<QlyInspectResult>().in(QlyInspectResult::getIsptId, isptIds)); |
| | | List<QlyInspectResult> items = qlyInspectResultService.list(new LambdaQueryWrapper<QlyInspectResult>() |
| | | .in(QlyInspectResult::getIsptId, isptIds)); |
| | | Double sum = items.stream().mapToDouble(QlyInspectResult::getAnfme).sum(); |
| | | if (sum.compareTo(0.00) > 0) { |
| | | qlyInspectService.update(new LambdaUpdateWrapper<QlyInspect>() |
| | |
| | | .eq(QlyInspect::getId, isptItem.stream().findFirst().get().getIspectId())); |
| | | } |
| | | |
| | | // qlyIsptItemService.pageByIsptResult(null, new QueryWrapper<QlyIsptItem>()) |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * @author Ryan |
| | | * @date 2025/5/12 |
| | | * @description: 质检后修改收货区存信息 |
| | | * @version 1.0 |
| | | */ |
| | | private void operateReceipt(QlyIsptItem item, WarehouseAreasItem orderItem) { |
| | | Double sum = item.getDisQty() + item.getSafeQty(); |
| | | if (sum.compareTo(orderItem.getAnfme()) >= 0) { |
| | | //完成质检,做更新操作 |
| | | if (item.getSafeQty().compareTo(0.0) > 0) { |
| | | orderItem.setIsptQty(item.getSafeQty()); |
| | | orderItem.setIsptResult(QlyIsptResult.QLY_ISPT_RESULT_EXCELLENT.val); |
| | | if (!warehouseAreasItemService.updateById(orderItem)) { |
| | | throw new CoolException("收货区库存明细更新失败!!"); |
| | | } |
| | | } |
| | | |
| | | if (item.getDisQty().compareTo(0.0) > 0) { |
| | | orderItem.setIsptQty(item.getDisQty()) |
| | | .setId(null) |
| | | .setIsptResult(QlyIsptResult.QLY_ISPT_RESULT_DEFECT.val); |
| | | if (!warehouseAreasItemService.saveOrUpdate(orderItem)) { |
| | | throw new CoolException("收货区库存明细更新失败!!"); |
| | | } |
| | | } |
| | | } else { |
| | | //未完成做添加操作 |
| | | if (item.getSafeQty().compareTo(0.0) > 0) { |
| | | orderItem.setIsptQty(item.getSafeQty()) |
| | | .setId(null) |
| | | .setIsptResult(QlyIsptResult.QLY_ISPT_RESULT_EXCELLENT.val); |
| | | if (!warehouseAreasItemService.saveOrUpdate(orderItem)) { |
| | | throw new CoolException("收货区库存明细更新失败!!"); |
| | | } |
| | | } |
| | | |
| | | if (item.getDisQty().compareTo(0.0) > 0) { |
| | | orderItem.setIsptQty(item.getDisQty()) |
| | | .setId(null) |
| | | .setIsptResult(QlyIsptResult.QLY_ISPT_RESULT_DEFECT.val); |
| | | if (!warehouseAreasItemService.saveOrUpdate(orderItem)) { |
| | | throw new CoolException("收货区库存明细更新失败!!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | |
| | | List<QlyIsptItem> records = page.getRecords(); |
| | | for (int i = 0; i < records.size(); i++) { |
| | | List<QlyInspectResult> results = qlyInspectResultService.list(new QueryWrapper<QlyInspectResult>() |
| | | .select("id, ispt_result, SUM(anfme) anfme, ispt_item_id, ispt_id") |
| | | .select("id, ispt_result, SUM(anfme) anfme, ispt_item_id, ispt_id, rcpt_id") |
| | | .lambda() |
| | | .eq(QlyInspectResult::getIsptItemId, records.get(i).getId()).groupBy(QlyInspectResult::getIsptResult)); |
| | | if (!results.isEmpty()) { |
| | |
| | | |
| | | @Override |
| | | public IPage<QlyIsptItem> pageByIsptResult(PageParam<QlyIsptItem, BaseParam> pageParam, QueryWrapper<QlyIsptItem> queryWrapper) { |
| | | return this.baseMapper.pageByWrapper(pageParam, queryWrapper); |
| | | if (Objects.isNull(pageParam)) { |
| | | PageParam<QlyIsptItem, BaseParam> param = new PageParam<>(); |
| | | return this.baseMapper.selectPage(param, queryWrapper); |
| | | } else { |
| | | return this.baseMapper.pageByWrapper(pageParam, queryWrapper); |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | 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.mapper.WarehouseAreasItemMapper; |
| | | import com.vincent.rsf.server.manager.entity.WarehouseAreasItem; |
| | |
| | | } |
| | | return areasItems; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<WarehouseAreasItem> pageByItemId(PageParam<WarehouseAreasItem, BaseParam> pageParam, QueryWrapper<WarehouseAreasItem> queryWrapper) { |
| | | IPage<WarehouseAreasItem> itemIPage = this.baseMapper.pageByItemId(pageParam, queryWrapper); |
| | | return itemIPage; |
| | | } |
| | | } |
| | |
| | | <?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.WarehouseAreasItemMapper"> |
| | | |
| | | <select id="pageByItemId" resultType="com.vincent.rsf.server.manager.entity.WarehouseAreasItem"> |
| | | SELECT * |
| | | FROM (SELECT qai.id, |
| | | area_id, |
| | | area_name, |
| | | asn_id, |
| | | plat_item_id, |
| | | po_code, |
| | | asn_code, |
| | | asn_item_id, |
| | | matnr_id, |
| | | maktx, |
| | | matnr_code, |
| | | fields_index, |
| | | work_qty, |
| | | qty, |
| | | splr_batch, |
| | | unit, |
| | | stock_unit, |
| | | brand, |
| | | splr_id, |
| | | weight, |
| | | prod_time, |
| | | flag_norm, |
| | | qir.anfme, |
| | | qir.ispt_result, |
| | | track_code, |
| | | `status`, |
| | | deleted, |
| | | tenant_id, |
| | | create_by, |
| | | create_time, |
| | | update_by, |
| | | update_time, |
| | | memo |
| | | FROM man_warehouse_areas_item qai |
| | | LEFT JOIN man_qly_inspect_result qir ON qai.id = qir.rcpt_id) t |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | </mapper> |