From c65a357fc8b907af755e1ef6a2c201e31eb71e94 Mon Sep 17 00:00:00 2001
From: vincentlu <t1341870251@gmail.com>
Date: 星期六, 07 二月 2026 13:50:38 +0800
Subject: [PATCH] #

---
 zy-acs-flow/src/page/sta/StaCreate.jsx |  116 +++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 90 insertions(+), 26 deletions(-)

diff --git a/zy-acs-flow/src/page/sta/StaCreate.jsx b/zy-acs-flow/src/page/sta/StaCreate.jsx
index e0fca1f..5370934 100644
--- a/zy-acs-flow/src/page/sta/StaCreate.jsx
+++ b/zy-acs-flow/src/page/sta/StaCreate.jsx
@@ -1,4 +1,4 @@
-import React, { useState, useRef, useEffect, useMemo } from "react";
+import React, { useMemo } from "react";
 import {
     CreateBase,
     useTranslate,
@@ -30,12 +30,19 @@
 import DialogCloseButton from "../components/DialogCloseButton";
 import StatusSelectInput from "../components/StatusSelectInput";
 import MemoInput from "../components/MemoInput";
+import { compDirectChoices } from "../loc/compDirect";
 
 const StaCreate = (props) => {
     const { open, setOpen } = props;
 
     const translate = useTranslate();
     const notify = useNotify();
+    const greaterThanZero = useMemo(() => (value) => {
+        if (value === undefined || value === null || value === '') {
+            return undefined;
+        }
+        return Number(value) >= 0 ? undefined : translate('validate.gtZero');
+    }, [translate]);
 
     const handleClose = (event, reason) => {
         if (reason !== "backdropClick") {
@@ -48,8 +55,8 @@
         notify('common.response.success');
     };
 
-    const handleError = async (data) => {
-        notify('common.response.fail');
+    const handleError = async (error) => {
+        notify(error.message || 'common.response.fail', { type: 'error', messageArgs: { _: error.message } });
     };
 
     return (
@@ -85,14 +92,6 @@
                         <DialogContent>
                             <Grid container rowSpacing={2} columnSpacing={2}>
                                 <Grid item xs={6} display="flex" gap={1}>
-                                    <TextInput
-                                        label="table.field.sta.uuid"
-                                        source="uuid"
-                                        parse={v => v}
-                                        autoFocus
-                                    />
-                                </Grid>
-                                <Grid item xs={6} display="flex" gap={1}>
                                     <ReferenceInput
                                         source="zoneId"
                                         reference="zone"
@@ -101,23 +100,33 @@
                                             label="table.field.sta.zoneId"
                                             optionText="name"
                                             filterToQuery={(val) => ({ name: val })}
+                                            validate={required()}
                                         />
                                     </ReferenceInput>
                                 </Grid>
+                                {/* <Grid item xs={6} display="flex" gap={1}>
+                                    <TextInput
+                                        label="table.field.sta.uuid"
+                                        source="uuid"
+                                        parse={v => v}
+                                        autoFocus
+                                    />
+                                </Grid> */}
                                 <Grid item xs={6} display="flex" gap={1}>
                                     <TextInput
                                         label="table.field.sta.staNo"
                                         source="staNo"
                                         parse={v => v}
+                                        validate={required()}
                                     />
                                 </Grid>
-                                <Grid item xs={6} display="flex" gap={1}>
+                                {/* <Grid item xs={6} display="flex" gap={1}>
                                     <TextInput
                                         label="table.field.sta.name"
                                         source="name"
                                         parse={v => v}
                                     />
-                                </Grid>
+                                </Grid> */}
                                 <Grid item xs={6} display="flex" gap={1}>
                                     <ReferenceInput
                                         source="staType"
@@ -140,51 +149,105 @@
                                             label="table.field.sta.code"
                                             optionText="data"
                                             filterToQuery={(val) => ({ data: val })}
+                                            validate={required()}
                                         />
                                     </ReferenceInput>
                                 </Grid>
                                 <Grid item xs={6} display="flex" gap={1}>
                                     <NumberInput
+                                        label="table.field.sta.capacity"
+                                        source="capacity"
+                                        validate={[required(), greaterThanZero]}
+                                    />
+                                </Grid>
+                                {/* <Grid item xs={6} display="flex" gap={1}>
+                                    <NumberInput
                                         label="table.field.sta.offset"
                                         source="offset"
+                                        validate={required()}
+                                    />
+                                </Grid> */}
+                                <Grid item xs={6} display="flex" gap={1}>
+                                    <NumberInput
+                                        label="table.field.sta.height"
+                                        source="height"
+                                        validate={[required(), greaterThanZero]}
+                                    />
+                                </Grid>
+                                {/* <Grid item xs={6} display="flex" gap={1}>
+                                    <NumberInput
+                                        label="table.field.sta.depth"
+                                        source="depth"
+                                        helperText={translate('page.sta.depthHint')}
+                                        validate={[required(), greaterThanZero]}
+                                    />
+                                </Grid> */}
+                                <Grid item xs={6} display="flex" gap={1}>
+                                    <NumberInput
+                                        label="table.field.sta.angle"
+                                        source="angle"
+                                        validate={[required(), greaterThanZero]}
                                     />
                                 </Grid>
                                 <Grid item xs={6} display="flex" gap={1}>
+                                    <SelectInput
+                                        label="table.field.sta.actDir"
+                                        source="actDir"
+                                        choices={compDirectChoices}
+                                        translateChoice
+                                        validate={[required(), greaterThanZero]}
+                                    />
+                                </Grid>
+                                <Grid item xs={6} display="flex" gap={1}>
+                                    <NumberInput
+                                        label="table.field.sta.inboundWait"
+                                        source="inboundWait"
+                                        validate={greaterThanZero}
+                                    />
+                                </Grid>
+                                <Grid item xs={6} display="flex" gap={1}>
+                                    <NumberInput
+                                        label="table.field.sta.outboundWait"
+                                        source="outboundWait"
+                                        validate={greaterThanZero}
+                                    />
+                                </Grid>
+                                {/* <Grid item xs={6} display="flex" gap={1}>
                                     <TextInput
                                         label="table.field.sta.autoing"
                                         source="autoing"
                                         parse={v => v}
                                     />
-                                </Grid>
-                                <Grid item xs={6} display="flex" gap={1}>
+                                </Grid> */}
+                                {/* <Grid item xs={6} display="flex" gap={1}>
                                     <TextInput
                                         label="table.field.sta.loading"
                                         source="loading"
                                         parse={v => v}
                                     />
-                                </Grid>
-                                <Grid item xs={6} display="flex" gap={1}>
+                                </Grid> */}
+                                {/* <Grid item xs={6} display="flex" gap={1}>
                                     <TextInput
                                         label="table.field.sta.inEnable"
                                         source="inEnable"
                                         parse={v => v}
                                     />
-                                </Grid>
-                                <Grid item xs={6} display="flex" gap={1}>
+                                </Grid> */}
+                                {/* <Grid item xs={6} display="flex" gap={1}>
                                     <TextInput
                                         label="table.field.sta.outEnable"
                                         source="outEnable"
                                         parse={v => v}
                                     />
-                                </Grid>
-                                <Grid item xs={6} display="flex" gap={1}>
+                                </Grid> */}
+                                {/* <Grid item xs={6} display="flex" gap={1}>
                                     <TextInput
                                         label="table.field.sta.zpallet"
                                         source="zpallet"
                                         parse={v => v}
                                     />
-                                </Grid>
-                                <Grid item xs={6} display="flex" gap={1}>
+                                </Grid> */}
+                                {/* <Grid item xs={6} display="flex" gap={1}>
                                     <ReferenceInput
                                         source="staSts"
                                         reference="staSts"
@@ -193,13 +256,14 @@
                                             label="table.field.sta.staSts"
                                             optionText="name"
                                             filterToQuery={(val) => ({ name: val })}
+                                            validate={required()}
                                         />
                                     </ReferenceInput>
-                                </Grid>
+                                </Grid> */}
 
-                                <Grid item xs={6} display="flex" gap={1}>
+                                {/* <Grid item xs={6} display="flex" gap={1}>
                                     <StatusSelectInput />
-                                </Grid>
+                                </Grid> */}
                                 <Grid item xs={12} display="flex" gap={1}>
                                     <Stack direction="column" spacing={1} width={'100%'}>
                                         <MemoInput />

--
Gitblit v1.9.1