From 06d7fb698ce6d0efc7ff4224c6b68d2f50feb716 Mon Sep 17 00:00:00 2001 From: skyouc Date: 星期一, 21 四月 2025 16:23:46 +0800 Subject: [PATCH] DO单修改及优化 --- rsf-admin/src/page/orders/delivery/DeliveryCreate.jsx | 40 +++++++------------- rsf-admin/src/page/system/serialRule/SerialRuleItemEdit.jsx | 10 ++++- rsf-server/src/main/java/com/vincent/rsf/server/system/constant/SerialRuleCode.java | 5 ++ rsf-admin/src/page/system/serialRule/SerialRuleItemList.jsx | 2 rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/DeliveryController.java | 14 ++++++- 5 files changed, 40 insertions(+), 31 deletions(-) diff --git a/rsf-admin/src/page/orders/delivery/DeliveryCreate.jsx b/rsf-admin/src/page/orders/delivery/DeliveryCreate.jsx index eeccfba..eb55fcb 100644 --- a/rsf-admin/src/page/orders/delivery/DeliveryCreate.jsx +++ b/rsf-admin/src/page/orders/delivery/DeliveryCreate.jsx @@ -36,6 +36,8 @@ const translate = useTranslate(); const notify = useNotify(); + const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_order_type')) || []; + const business = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || []; const handleClose = (event, reason) => { if (reason !== "backdropClick") { @@ -84,36 +86,28 @@ </DialogTitle> <DialogContent sx={{ mt: 2 }}> <Grid container rowSpacing={2} columnSpacing={2}> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.delivery.code" - source="code" - parse={v => v} - autoFocus - /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> + <Grid item xs={16} display="flex" gap={1}> <TextInput label="table.field.delivery.platId" source="platId" parse={v => v} /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.delivery.type" + <AutocompleteInput + choices={dicts} + optionText="label" + label="table.field.asnOrder.type" source="type" + optionValue="value" parse={v => v} /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> - <TextInput - label="table.field.delivery.wkType" + <AutocompleteInput + choices={business} + optionText="label" + label="table.field.asnOrder.wkType" source="wkType" + optionValue="value" parse={v => v} /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.delivery.source" source="source" @@ -121,28 +115,22 @@ validate={required()} /> </Grid> - <Grid item xs={6} display="flex" gap={1}> + <Grid item xs={16} display="flex" gap={1}> <NumberInput label="table.field.delivery.anfme" source="anfme" validate={required()} /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> <NumberInput label="table.field.delivery.qty" source="qty" validate={required()} /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> <NumberInput label="table.field.delivery.workQty" source="workQty" validate={required()} /> - </Grid> - <Grid item xs={6} display="flex" gap={1}> <TextInput label="table.field.delivery.platCode" source="platCode" diff --git a/rsf-admin/src/page/system/serialRule/SerialRuleItemEdit.jsx b/rsf-admin/src/page/system/serialRule/SerialRuleItemEdit.jsx index 4dc8087..8fc5ff5 100644 --- a/rsf-admin/src/page/system/serialRule/SerialRuleItemEdit.jsx +++ b/rsf-admin/src/page/system/serialRule/SerialRuleItemEdit.jsx @@ -110,7 +110,7 @@ source="wkType" optionValue="value" parse={v => v} - /> + /> </Stack> <Stack direction='row' gap={2}> <TextInput @@ -152,7 +152,13 @@ </Grid> </DialogContent> <DialogActions> - + <Toolbar sx={{ width: '100%', justifyContent: 'end' }} > + <SaveButton type="button" mutationOptions={{ + onSuccess: () => { + setOpen(false) + } + }} /> + </Toolbar> </DialogActions> </Form> diff --git a/rsf-admin/src/page/system/serialRule/SerialRuleItemList.jsx b/rsf-admin/src/page/system/serialRule/SerialRuleItemList.jsx index 9ae1736..e2bfea6 100644 --- a/rsf-admin/src/page/system/serialRule/SerialRuleItemList.jsx +++ b/rsf-admin/src/page/system/serialRule/SerialRuleItemList.jsx @@ -118,7 +118,7 @@ empty={false} filters={filters} filter={{ ruleId: ruleId }} - sort={{ field: "create_time", order: "desc" }} + sort={{ field: "sort", order: "asc" }} actions={ <TopToolbar> <FilterButton /> diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/DeliveryController.java b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/DeliveryController.java index 0509ebf..0df7a00 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/DeliveryController.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/manager/controller/DeliveryController.java @@ -11,7 +11,11 @@ import com.vincent.rsf.server.common.domain.PageParam; import com.vincent.rsf.server.manager.entity.Delivery; import com.vincent.rsf.server.manager.service.DeliveryService; +import com.vincent.rsf.server.system.constant.SerialRuleCode; import com.vincent.rsf.server.system.controller.BaseController; +import com.vincent.rsf.server.system.service.SerialRuleService; +import com.vincent.rsf.server.system.utils.SerialRuleUtils; +import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -24,6 +28,7 @@ @Autowired private DeliveryService deliveryService; + @PreAuthorize("hasAuthority('manager:delivery:list')") @PostMapping("/delivery/page") @@ -56,9 +61,14 @@ @PostMapping("/delivery/save") public R save(@RequestBody Delivery delivery) { delivery.setCreateBy(getLoginUserId()); - delivery.setCreateTime(new Date()); delivery.setUpdateBy(getLoginUserId()); - delivery.setUpdateTime(new Date()); + if (Objects.isNull(delivery.getCode())) { + String ruleCode = SerialRuleUtils.generateRuleCode(SerialRuleCode.SYS_DELIVERY_RULE_CODE, delivery); + if (Objects.isNull(ruleCode) || StringUtils.isBlank(ruleCode)) { + return R.error("缂栫爜瑙勫垯閿欒锛氱紪鐮併�孲YS_DELIVERY_RULE_CODE銆嶆槸鏈缃垚鍔燂紒锛�"); + } + delivery.setCode(ruleCode); + } if (!deliveryService.save(delivery)) { return R.error("Save Fail"); } diff --git a/rsf-server/src/main/java/com/vincent/rsf/server/system/constant/SerialRuleCode.java b/rsf-server/src/main/java/com/vincent/rsf/server/system/constant/SerialRuleCode.java index 1a030bc..9d2adf7 100644 --- a/rsf-server/src/main/java/com/vincent/rsf/server/system/constant/SerialRuleCode.java +++ b/rsf-server/src/main/java/com/vincent/rsf/server/system/constant/SerialRuleCode.java @@ -58,4 +58,9 @@ * 缁煎悎璁㈠崟缂栫爜瑙勫垯 */ public final static String SYS_MANAGE_ORDER_CODE = "sys_manage_order_code"; + + /** + * DO鍗曟嵁缂栫爜瑙勫垯 + */ + public final static String SYS_DELIVERY_RULE_CODE = "sys_delivery_rule_code"; } -- Gitblit v1.9.1