From 4592353d65d7b5e8477d9cad0bd2836bf7792186 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期三, 02 七月 2025 14:23:20 +0800
Subject: [PATCH] 代码优化 波次功能优化
---
rsf-admin/src/page/orders/wave/WaveList.jsx | 73 ++++++++++--------
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/PakinSchedules.java | 94 +++++++++++++++++++++++
rsf-admin/src/i18n/zh.js | 2
rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java | 68 -----------------
4 files changed, 135 insertions(+), 102 deletions(-)
diff --git a/rsf-admin/src/i18n/zh.js b/rsf-admin/src/i18n/zh.js
index 44b9d02..18807a3 100644
--- a/rsf-admin/src/i18n/zh.js
+++ b/rsf-admin/src/i18n/zh.js
@@ -866,7 +866,7 @@
wave: {
code: "娉㈡鍙�",
type: "鍗曟嵁绫诲瀷",
- exceStatus: "鐘舵��",
+ exceStatus: "鎵ц鐘舵��",
anfme: "鏁伴噺",
groupQty: '鍝佺被鏁�',
qty: "瀹屾垚鏁伴噺",
diff --git a/rsf-admin/src/page/orders/wave/WaveList.jsx b/rsf-admin/src/page/orders/wave/WaveList.jsx
index 7066c06..e6f3f43 100644
--- a/rsf-admin/src/page/orders/wave/WaveList.jsx
+++ b/rsf-admin/src/page/orders/wave/WaveList.jsx
@@ -23,6 +23,7 @@
NumberInput,
useRefresh,
useRedirect,
+ AutocompleteInput,
Button,
} from 'react-admin';
import { PAGE_DRAWER_WIDTH, OPERATE_MODE, DEFAULT_PAGE_SIZE, DEFAULT_WAVE_AUTO_EXCE } from '@/config/setting';
@@ -54,39 +55,7 @@
},
}));
-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();
@@ -95,6 +64,44 @@
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()
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/PakinSchedules.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/PakinSchedules.java
new file mode 100644
index 0000000..9a2fb69
--- /dev/null
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/PakinSchedules.java
@@ -0,0 +1,94 @@
+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("鍘嗗彶鏄庣粏妗d繚瀛樺け璐ワ紒锛�");
+ }
+ });
+
+ if (!waitPakinService.removeByIds(list)) {
+ throw new CoolException("鍘熷崟鎹垹闄ゅけ璐ワ紒锛�");
+ }
+ if (!waitPakinItemService.remove(new LambdaQueryWrapper<WaitPakinItem>().in(WaitPakinItem::getPakinId, list))) {
+ throw new CoolException("鍘熷崟鎹槑缁嗗垹闄ゅけ璐ワ紒锛�");
+ }
+ }
+}
diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java
index 08c9f56..81b7147 100644
--- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java
+++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/schedules/ScheduleJobs.java
@@ -58,14 +58,6 @@
@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;
@@ -318,64 +310,4 @@
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("鍘嗗彶鏄庣粏妗d繚瀛樺け璐ワ紒锛�");
- }
- });
-
- if (!waitPakinService.removeByIds(list)) {
- throw new CoolException("鍘熷崟鎹垹闄ゅけ璐ワ紒锛�");
- }
- if (!waitPakinItemService.remove(new LambdaQueryWrapper<WaitPakinItem>().in(WaitPakinItem::getPakinId, list))) {
- throw new CoolException("鍘熷崟鎹槑缁嗗垹闄ゅけ璐ワ紒锛�");
- }
- }
-
}
--
Gitblit v1.9.1