| | |
| | | wave: { |
| | | code: "波次号", |
| | | type: "单据类型", |
| | | exceStatus: "状态", |
| | | exceStatus: "执行状态", |
| | | anfme: "数量", |
| | | groupQty: '品类数', |
| | | qty: "完成数量", |
| | |
| | | NumberInput, |
| | | useRefresh, |
| | | useRedirect, |
| | | AutocompleteInput, |
| | | Button, |
| | | } from 'react-admin'; |
| | | import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_WAVE_AUTO_EXCE } from '@/config/setting'; |
| | |
| | | }, |
| | | })); |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | <TextInput source="code" label="table.field.wave.code" />, |
| | | <SelectInput source="type" label="table.field.wave.type" |
| | | choices={[ |
| | | { id: 0, name: '手动' }, |
| | | { id: 1, name: '自动' }, |
| | | ]} |
| | | />, |
| | | <SelectInput source="exceStatus" label="table.field.wave.exceStatus" |
| | | choices={[ |
| | | { id: 0, name: '初始化' }, |
| | | { id: 1, name: '生成任务' }, |
| | | { id: 2, name: '任务播种' }, |
| | | { id: 3, name: '完成' }, |
| | | ]} |
| | | />, |
| | | <NumberInput source="anfme" label="table.field.wave.anfme" />, |
| | | <NumberInput source="qty" label="table.field.wave.qty" />, |
| | | <NumberInput source="orderNum" label="table.field.wave.orderNum" />, |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | resettable |
| | | />, |
| | | ] |
| | | |
| | | |
| | | const WaveList = () => { |
| | | const translate = useTranslate(); |
| | |
| | | const [detailDialog, setDetailDialog] = useState(false); |
| | | const [select, setSelectIds] = useState({}); |
| | | const [drawerVal, setDrawerVal] = useState(false); |
| | | const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_wave_exce_status')) || []; |
| | | |
| | | const filters = [ |
| | | <SearchInput source="condition" alwaysOn />, |
| | | <DateInput label='common.time.after' source="timeStart" alwaysOn />, |
| | | <DateInput label='common.time.before' source="timeEnd" alwaysOn />, |
| | | <TextInput source="code" label="table.field.wave.code" />, |
| | | <AutocompleteInput |
| | | choices={dicts} |
| | | optionText="label" |
| | | label="table.field.wave.exceStatus" |
| | | source="exceStatus" |
| | | format={value => value || '0'} |
| | | optionValue="value" |
| | | parse={v => v} |
| | | alwaysOn |
| | | />, |
| | | <SelectInput source="type" label="table.field.wave.type" |
| | | choices={[ |
| | | { id: 0, name: '手动' }, |
| | | { id: 1, name: '自动' }, |
| | | ]} |
| | | />, |
| | | <NumberInput source="anfme" label="table.field.wave.anfme" />, |
| | | <NumberInput source="qty" label="table.field.wave.qty" />, |
| | | <NumberInput source="orderNum" label="table.field.wave.orderNum" />, |
| | | <TextInput label="common.field.memo" source="memo" />, |
| | | <SelectInput |
| | | label="common.field.status" |
| | | source="status" |
| | | choices={[ |
| | | { id: '1', name: 'common.enums.statusTrue' }, |
| | | { id: '0', name: 'common.enums.statusFalse' }, |
| | | ]} |
| | | resettable |
| | | />, |
| | | ] |
| | | |
| | | |
| | | useEffect(() => { |
| | | getConfig() |
New file |
| | |
| | | package com.vincent.rsf.server.manager.schedules; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | | import com.vincent.rsf.server.manager.entity.WaitPakin; |
| | | import com.vincent.rsf.server.manager.entity.WaitPakinItem; |
| | | import com.vincent.rsf.server.manager.entity.WaitPakinItemLog; |
| | | import com.vincent.rsf.server.manager.entity.WaitPakinLog; |
| | | import com.vincent.rsf.server.manager.enums.PakinIOStatus; |
| | | import com.vincent.rsf.server.manager.service.WaitPakinItemLogService; |
| | | import com.vincent.rsf.server.manager.service.WaitPakinItemService; |
| | | import com.vincent.rsf.server.manager.service.WaitPakinLogService; |
| | | import com.vincent.rsf.server.manager.service.WaitPakinService; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Component |
| | | public class PakinSchedules { |
| | | |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private WaitPakinItemService waitPakinItemService; |
| | | @Autowired |
| | | private WaitPakinLogService waitPakinLogService; |
| | | @Autowired |
| | | private WaitPakinItemLogService waitPakinItemLogService; |
| | | |
| | | /** |
| | | * @param |
| | | * @return |
| | | * @author Ryan |
| | | * @description 组拖历史档 |
| | | * @time 2025/3/29 12:36 |
| | | */ |
| | | @Scheduled(cron = "0/25 * * * * ?") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void pakinLog() { |
| | | List<WaitPakin> pakinIds = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val) |
| | | .select(WaitPakin::getId)); |
| | | if (pakinIds.isEmpty()) { |
| | | return; |
| | | } |
| | | List<Long> list = pakinIds.stream().map(WaitPakin::getId).collect(Collectors.toList()); |
| | | List<WaitPakin> pakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().in(WaitPakin::getId, list)); |
| | | if (pakins.isEmpty()) { |
| | | throw new CoolException("组拖单为空!!"); |
| | | } |
| | | pakins.forEach(pakin -> { |
| | | WaitPakinLog log = new WaitPakinLog(); |
| | | BeanUtils.copyProperties(pakin, log); |
| | | log.setPakinId(pakin.getId()).setIoStatus(PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val); |
| | | |
| | | if (!waitPakinLogService.save(log)) { |
| | | throw new CoolException("组托日志保存失败!!"); |
| | | } |
| | | List<WaitPakinItem> pakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().in(WaitPakinItem::getPakinId, pakin.getId())); |
| | | if (pakinItems.isEmpty()) { |
| | | throw new CoolException("组拖明细为空!!"); |
| | | } |
| | | List<WaitPakinItemLog> itemLogs = new ArrayList<>(); |
| | | |
| | | pakinItems.forEach(item -> { |
| | | WaitPakinItemLog itemLog = new WaitPakinItemLog(); |
| | | BeanUtils.copyProperties(item, itemLog); |
| | | itemLog.setPakinItemId(item.getId()) |
| | | .setLogId(log.getId()) |
| | | .setQty(item.getWorkQty()) |
| | | .setWorkQty(0.0) |
| | | .setPakinId(item.getPakinId()); |
| | | itemLogs.add(itemLog); |
| | | }); |
| | | |
| | | if (!waitPakinItemLogService.saveBatch(itemLogs)) { |
| | | throw new CoolException("历史明细档保存失败!!"); |
| | | } |
| | | }); |
| | | |
| | | if (!waitPakinService.removeByIds(list)) { |
| | | throw new CoolException("原单据删除失败!!"); |
| | | } |
| | | if (!waitPakinItemService.remove(new LambdaQueryWrapper<WaitPakinItem>().in(WaitPakinItem::getPakinId, list))) { |
| | | throw new CoolException("原单据明细删除失败!!"); |
| | | } |
| | | } |
| | | } |
| | |
| | | @Resource |
| | | private SysStockProperties flowProperties; |
| | | @Autowired |
| | | private WaitPakinService waitPakinService; |
| | | @Autowired |
| | | private WaitPakinItemService waitPakinItemService; |
| | | @Autowired |
| | | private WaitPakinLogService waitPakinLogService; |
| | | @Autowired |
| | | private WaitPakinItemLogService waitPakinItemLogService; |
| | | @Autowired |
| | | private ConfigService configService; |
| | | @Autowired |
| | | private WarehouseAreasService warehouseAreasService; |
| | |
| | | throw new CoolException("生成编码失败!!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * @param |
| | | * @return |
| | | * @author Ryan |
| | | * @description 组拖历史档 |
| | | * @time 2025/3/29 12:36 |
| | | */ |
| | | @Scheduled(cron = "0/25 * * * * ?") |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void pakinLog() { |
| | | List<WaitPakin> pakinIds = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val) |
| | | .select(WaitPakin::getId)); |
| | | if (pakinIds.isEmpty()) { |
| | | return; |
| | | } |
| | | List<Long> list = pakinIds.stream().map(WaitPakin::getId).collect(Collectors.toList()); |
| | | List<WaitPakin> pakins = waitPakinService.list(new LambdaQueryWrapper<WaitPakin>().in(WaitPakin::getId, list)); |
| | | if (pakins.isEmpty()) { |
| | | throw new CoolException("组拖单为空!!"); |
| | | } |
| | | pakins.forEach(pakin -> { |
| | | WaitPakinLog log = new WaitPakinLog(); |
| | | BeanUtils.copyProperties(pakin, log); |
| | | log.setPakinId(pakin.getId()).setIoStatus(PakinIOStatus.PAKIN_IO_STATUS_TASK_DONE.val); |
| | | |
| | | if (!waitPakinLogService.save(log)) { |
| | | throw new CoolException("组托日志保存失败!!"); |
| | | } |
| | | List<WaitPakinItem> pakinItems = waitPakinItemService.list(new LambdaQueryWrapper<WaitPakinItem>().in(WaitPakinItem::getPakinId, pakin.getId())); |
| | | if (pakinItems.isEmpty()) { |
| | | throw new CoolException("组拖明细为空!!"); |
| | | } |
| | | List<WaitPakinItemLog> itemLogs = new ArrayList<>(); |
| | | |
| | | pakinItems.forEach(item -> { |
| | | WaitPakinItemLog itemLog = new WaitPakinItemLog(); |
| | | BeanUtils.copyProperties(item, itemLog); |
| | | itemLog.setPakinItemId(item.getId()) |
| | | .setLogId(log.getId()) |
| | | .setQty(item.getWorkQty()) |
| | | .setWorkQty(0.0) |
| | | .setPakinId(item.getPakinId()); |
| | | itemLogs.add(itemLog); |
| | | }); |
| | | |
| | | if (!waitPakinItemLogService.saveBatch(itemLogs)) { |
| | | throw new CoolException("历史明细档保存失败!!"); |
| | | } |
| | | }); |
| | | |
| | | if (!waitPakinService.removeByIds(list)) { |
| | | throw new CoolException("原单据删除失败!!"); |
| | | } |
| | | if (!waitPakinItemService.remove(new LambdaQueryWrapper<WaitPakinItem>().in(WaitPakinItem::getPakinId, list))) { |
| | | throw new CoolException("原单据明细删除失败!!"); |
| | | } |
| | | } |
| | | |
| | | } |