From e918d4fa4f5065b51be706f21da6793c378c9aaf Mon Sep 17 00:00:00 2001
From: skyouc
Date: 星期六, 16 八月 2025 17:05:05 +0800
Subject: [PATCH] 接口文档修改

---
 rsf-admin/src/page/work/stockTransfer/stockTransferList.jsx |   95 +++++++++++++++++++++++++++++------------------
 1 files changed, 59 insertions(+), 36 deletions(-)

diff --git a/rsf-admin/src/page/work/stockTransfer/stockTransferList.jsx b/rsf-admin/src/page/work/stockTransfer/stockTransferList.jsx
index a0355b8..a036f5e 100644
--- a/rsf-admin/src/page/work/stockTransfer/stockTransferList.jsx
+++ b/rsf-admin/src/page/work/stockTransfer/stockTransferList.jsx
@@ -75,19 +75,47 @@
     tableRef.current = useGridApiRef();
     const translate = useTranslate();
 
-    const [orgLoc, setOrgLoc] = useState([]);
-    const [tarLoc, setTarLoc] = useState([]);
+    const [orgLoc, setOrgLoc] = useState("");
+    const [tarLoc, setTarLoc] = useState("");
     const [tarLocList, setTarLocList] = useState([]);
 
     useEffect(() => {
-        selectAreaNoUse();
+        if (orgLoc === "" || orgLoc.length < 7) {
+            return;
+        }
+        selectLocItem().then((is) => {            
+            if (is) {
+                selectAreaNoUse();
+            }
+
+        });
     },[orgLoc])
+
+
+    const selectLocItem = async() =>{
+        const {
+            data: { code, data, msg },
+        } = await request.post("/locItem/useO/page",{
+            locCode: orgLoc,
+            current: 1,
+            pageSize: 100,
+            orderBy: "create_time desc"
+        });
+        if (code === 200) {
+            if(data.total !== 0) {                
+                setTableData(data.records);  
+                return true;
+            }
+              
+        }
+        return false;  
+    }
 
     const selectAreaNoUse = async() =>{
         const {
             data: { code, data, msg },
         } = await request.post("/loc/areaNoUse/list",{
-
+            locCode: orgLoc            
         });
         if (code === 200) {
             const newData = data.map((item) => {
@@ -97,7 +125,6 @@
                 }
                 
             })  
-            console.log(newData);
             setTarLocList(newData);         
         }
 
@@ -154,7 +181,8 @@
                                 <Stack direction='row' spacing={2} minWidth={200}>
                                     <SubmitButton
                                         orgLoc={orgLoc}
-                                        tarLoc={tarLoc}                                        
+                                        tarLoc={tarLoc} 
+                                        tabelData={tabelData}                                       
                                     />
                                 </Stack>
                             </Box>
@@ -185,32 +213,27 @@
     const notify = useNotify();
     const redirect = useRedirect();
     const refresh = useRefresh();
-    const { orgLoc, tarLoc } = props;
-    const check = () => {
-        console.log(orgLoc, tarLoc);
+    const { orgLoc, tarLoc, tabelData } = props;
+    const move = () => {
         if (orgLoc === "" || orgLoc === undefined || orgLoc === null) {
-            notify("璇烽�夋嫨绔欑偣");
+            notify("璇疯緭鍏ユ簮搴撲綅");
             return;
         }
-        if (tarLoc === "" || tarLoc === undefined || tarLoc === null) {
-            notify("璇烽�夋嫨绔欑偣");
+        // if (tarLoc === "" || tarLoc === undefined || tarLoc === null) {
+        //     notify("璇疯緭鍏ョ洰鏍囧簱浣�");
+        //     return;
+        // }   
+        if (tabelData.length === 0) {
+            notify("婧愬簱浣嶆槑缁嗘棤锛岃妫�鏌ュ簱浣嶇姸鎬�");
             return;
-        }        
-        
+        }     
+        http(orgLoc, tarLoc?.id)
     }
-    const http = async (sta, items) => {
-        console.log(items);
-
-        const filter = items.filter(item => (item.outQty + item.workQty) > item.anfme);
-        if (filter.length > 0) {
-            notify(translate('toolbar.request.error.out_stock_qty'))
-            return
-        }
-        const { data: { code, data, msg } } = await request.post(`/locItem/generate/task`, { siteNo: sta, items: items });
+    const http = async (orgLoc, tarLoc) => {
+        const { data: { code, data, msg } } = await request.post(`/locItem/move/task`, { orgLoc, tarLoc });
         if (code === 200) {
             notify(msg);
             refresh()
-            setTableData([])
             redirect("/task")
         } else {
             notify(msg);
@@ -220,7 +243,7 @@
         <ConfirmButton
             variant="contained"
             color="primary"
-            onConfirm={check}
+            onConfirm={move}
             label={"table.field.outBound.createTask"}
         >
         </ConfirmButton>
@@ -246,13 +269,13 @@
             width: 100,
             editable: false,
         },
-        {
-            field: 'workQty',
-            headerName: translate('table.field.locItem.workQty'),
-            width: 100,
-            type: 'number',
-            editable: false,
-        },
+        // {
+        //     field: 'workQty',
+        //     headerName: translate('table.field.locItem.workQty'),
+        //     width: 100,
+        //     type: 'number',
+        //     editable: false,
+        // },
         {
             field: 'locCode',
             headerName: translate('table.field.locItem.locCode'),
@@ -316,7 +339,7 @@
                 flex: 1,
                 editable: false
             }))
-            setColumns([...columns, ...cols, action])
+            setColumns([...columns, ...cols])
         } else {
             notify(msg);
         }
@@ -348,7 +371,8 @@
             <DataGrid
                 apiRef={tableRef}
                 rows={tabelData}
-                columns={columns}
+                columns={columns}                
+                checkboxSelection = {false}
                 disableRowSelectionOnClick
                 getRowId={(row) => row.matnrId ? row.matnrId : row.id}
                 disableColumnFilter
@@ -364,8 +388,7 @@
                     },
                 }}
                 pageSizeOptions={[10, 25, 50, 100]}
-                editMode="row"
-                checkboxSelection
+                editMode="row"                
                 onRowSelectionModelChange={handleSelectionChange}
                 selectionModel={selectedRows}
                 sx={{

--
Gitblit v1.9.1