From d40c85778470a7e8341f0fae023c41dec981f384 Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期二, 13 五月 2025 20:41:25 +0800
Subject: [PATCH] 新增PO单生成收货单功能

---
 rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx |   64 +++++++++++++++++++++----------
 1 files changed, 43 insertions(+), 21 deletions(-)

diff --git a/rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx b/rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx
index 063790b..4a6bec8 100644
--- a/rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx
+++ b/rsf-admin/src/page/orders/asnOrder/AsnOrderList.jsx
@@ -58,7 +58,8 @@
 import ImportButton from "../../components/ImportButton";
 import PrintOutlinedIcon from '@mui/icons-material/PrintOutlined';
 import OrderPrintPreview from "./OrderPrintPreview";
-
+import CreateNewFolderOutlinedIcon from '@mui/icons-material/CreateNewFolderOutlined';
+import AsnCreateByPoModal from "./AsnCreateByPoModal";
 const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
   '& .css-1vooibu-MuiSvgIcon-root': {
     height: '.9em'
@@ -114,6 +115,7 @@
   const [createDialog, setCreateDialog] = useState(false);
   const [drawerVal, setDrawerVal] = useState(false);
   const [modalType, setmodalType] = useState(0);
+  const [poCreate, setPoCreate] = useState(false);
   const [printOrder, setPrintOrder] = useState(false);
   const [select, setSelect] = useState({});
   const invoiceRef = useRef();
@@ -141,6 +143,7 @@
           <TopToolbar>
             <FilterButton />
             <MyCreateButton onClick={() => { setCreateDialog(true); setmodalType(0) }} />
+            <CreateByPoButton setPoCreate={setPoCreate}/>
             <SelectColumnsButton preferenceKey='asnOrder' />
             <ImportButton value={'asnOrderItem'} />
             <MyExportButton />
@@ -186,8 +189,8 @@
             <MyButton setCreateDialog={setCreateDialog} setmodalType={setmodalType} />
             <InspectionButton />
             <CompleteButton />
-            <ODeleteButton  />
-            <PrintButton setPrintOrder={setPrintOrder} setSelect={setSelect}/>
+            <ODeleteButton />
+            <PrintButton setPrintOrder={setPrintOrder} setSelect={setSelect} />
             {/* <CloseButton /> */}
           </WrapperField>
         </StyledDatagrid>
@@ -198,10 +201,14 @@
         asnId={modalType}
         billReload={billReload}
       />
-      <OrderPrintPreview 
+      <OrderPrintPreview
         open={printOrder}
         setOpen={setPrintOrder}
         record={select}
+      />
+      <AsnCreateByPoModal
+        open={poCreate}
+        setOpen={setPoCreate}
       />
       <PageDrawer
         title='AsnOrder Detail'
@@ -214,9 +221,24 @@
 }
 export default AsnOrderList;
 
+//鎸塒O鍗曟柊寤�
+const CreateByPoButton = ({setPoCreate}) => {
+  const record = useRecordContext();
+
+  const createEvent = (event) => {
+    event.stopPropagation();
+    setPoCreate(true)
+  }
+  return (
+    <Button label={"toolbar.poCreate"} onClick={createEvent}>
+      <CreateNewFolderOutlinedIcon />
+    </Button>
+  )
+}
+
 
 //鎵撳嵃鎸夐挳
-const PrintButton = ({setPrintOrder, setSelect}) => {
+const PrintButton = ({ setPrintOrder, setSelect }) => {
   const record = useRecordContext();
   const printOrder = (event) => {
     event.stopPropagation();
@@ -225,9 +247,9 @@
   }
 
   return (
-      <Button label={"toolbar.print"} onClick={printOrder}>
-          <PrintOutlinedIcon />
-      </Button>
+    <Button label={"toolbar.print"} onClick={printOrder}>
+      <PrintOutlinedIcon />
+    </Button>
   )
 }
 
@@ -235,7 +257,7 @@
 const ODeleteButton = () => {
   const record = useRecordContext();
   return (
-    record.exceStatus === 0 ? <DeleteButton  mutationMode="pessimistic"/> : <></>
+    record.exceStatus === 0 ? <DeleteButton mutationMode="pessimistic" /> : <></>
   )
 
 }
@@ -251,15 +273,15 @@
   };
   return (
     record.exceStatus === 1 || record.exceStatus === 0 ?
-    <Button
-      color="primary"
-      startIcon={<EditIcon />}
-      onClick={(btn) => handleEditClick(btn)}
-      sx={{ ml: 1 }}
-      label={'ra.action.edit'}
-    >
-    </Button>
-    : <></>
+      <Button
+        color="primary"
+        startIcon={<EditIcon />}
+        onClick={(btn) => handleEditClick(btn)}
+        sx={{ ml: 1 }}
+        label={'ra.action.edit'}
+      >
+      </Button>
+      : <></>
   )
 }
 
@@ -284,7 +306,7 @@
   }
 
   return (
-      <ConfirmButton label={"toolbar.inspection"} color="secondary" startIcon={<ConstructionIcon />} onConfirm={inspection} />
+    <ConfirmButton label={"toolbar.inspection"} color="secondary" startIcon={<ConstructionIcon />} onConfirm={inspection} />
   )
 }
 
@@ -388,7 +410,7 @@
     // record.exceStatus === 1 && (record.anfme === record.qty ? <Button onClick={requestComplete} label={"toolbar.complete"} color="secondary">
     //   <TaskIcon />
     // </Button> : )
-    record.exceStatus === 1 ? <ConfirmButton label={"toolbar.complete"} color="secondary"  startIcon={<TaskIcon />} onConfirm={requestComplete} /> : <></>
+    record.exceStatus === 1 ? <ConfirmButton label={"toolbar.complete"} color="secondary" startIcon={<TaskIcon />} onConfirm={requestComplete} /> : <></>
   )
 
 
@@ -410,6 +432,6 @@
   }
 
   return (
-    <ConfirmButton label={"toolbar.close"} color="error"  startIcon={<CloseIcon />} onConfirm={requestClose} />
+    <ConfirmButton label={"toolbar.close"} color="error" startIcon={<CloseIcon />} onConfirm={requestClose} />
   )
 }

--
Gitblit v1.9.1