From 5bced9128f41b7615040074ddbe04b608f0632e7 Mon Sep 17 00:00:00 2001
From: skyouc <creaycat@gmail.com>
Date: 星期四, 25 十二月 2025 16:11:48 +0800
Subject: [PATCH] 出库添加一键完结功能

---
 rsf-admin/src/page/orders/outStock/OutOrderList.jsx |   63 +++++++++++++++++++++++--------
 1 files changed, 47 insertions(+), 16 deletions(-)

diff --git a/rsf-admin/src/page/orders/outStock/OutOrderList.jsx b/rsf-admin/src/page/orders/outStock/OutOrderList.jsx
index 1181459..814e17b 100644
--- a/rsf-admin/src/page/orders/outStock/OutOrderList.jsx
+++ b/rsf-admin/src/page/orders/outStock/OutOrderList.jsx
@@ -50,16 +50,17 @@
 import ConfirmButton from '../../components/ConfirmButton';
 import ImportButton from "../../components/ImportButton";
 import DetailsIcon from '@mui/icons-material/Details';
+import OutStockWaveDialog from "./OutStockWaveDialog";
 import AddTaskIcon from '@mui/icons-material/AddTask';
 import PublicIcon from '@mui/icons-material/Public';
 import SelectMatnrModal from "./SelectMatnrModal";
 import EditIcon from '@mui/icons-material/Edit';
+import TaskIcon from '@mui/icons-material/Task';
 import OutOrderPreview from "./OutOrderPreview";
 import AddIcon from '@mui/icons-material/Add';
 import OutStockPublic from "./OutStockPublic";
 import OutOrderModal from "./OutOrderModal";
 import request from '@/utils/request';
-import OutStockWaveDialog from "./OutStockWaveDialog";
 
 const StyledDatagrid = styled(DatagridConfigurable)(({ theme }) => ({
   '& .css-1vooibu-MuiSvgIcon-root': {
@@ -113,33 +114,31 @@
 ]
 
 const OutOrderList = (props) => {
-  const translate = useTranslate();
-  const refresh = useRefresh();
 
+  const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || [];
   const [createDialog, setCreateDialog] = useState(false);
   const [manualDialog, setManualDialog] = useState(false);
+  const [drawerVal, setDrawerVal] = useState(false);
+  const [waveRule, setWaveRule] = useState(false);
   const [selectIds, setSelectIds] = useState([]);
   const [preview, setPreview] = useState(false);
-  const [waveRule, setWaveRule] = useState(false);
-  const [drawerVal, setDrawerVal] = useState(false);
   const [modalType, setmodalType] = useState(0);
   const [select, setSelect] = useState(0);
+  const translate = useTranslate();
+  const refresh = useRefresh();
+  const notify = useNotify();
   const billReload = useRef();
-  const dicts = JSON.parse(localStorage.getItem('sys_dicts'))?.filter(dict => (dict.dictTypeCode == 'sys_business_type')) || [];
 
   //鑾峰彇娉㈡瑙勫垯
   const closeDialog = async (value) => {
     setWaveRule(false)
+    const res = await request.post(`/outStock/generate/wave`, { ids: selectIds, waveRuleId: value.id });
+    if (res?.data?.code === 200) {
+      notify(res.data.msg);
+    } else {
+      notify(res.data.msg);
+    }
     refresh()
-    console.log('=====>');
-    console.log(value);
-    console.log(selectIds);
-    // const res = await request.post(`/outStock/generate/wave`, { ids: selectIds });
-    // if (res?.data?.code === 200) {
-    //   notify(res.data.msg);
-    // } else {
-    //   notify(res.data.msg);
-    // }
   }
 
   return (
@@ -175,7 +174,7 @@
           bulkActionButtons={<PublicTaskButton setWaveRule={setWaveRule} setSelectIds={setSelectIds} />}
           rowClick={false}
           expandSingle={true}
-          omit={['id', 'createTime', 'createBy', 'memo', 'rleStatus$']}
+          omit={['id', 'code', 'createTime', 'createBy$', 'memo', 'rleStatus$', 'logisNo', 'updateBy$', 'workQty', 'updateTime']}
         >
           <NumberField source="id" />
           <TextField source="code" label="table.field.outStock.code" />
@@ -193,10 +192,19 @@
           <DateField source="createTime" label="common.field.createTime" showTime />
           <BillStatusField cellClassName="status" source="exceStatus" label="table.field.outStock.exceStatus" />
           <TextField source="memo" label="common.field.memo" sortable={false} />
+
+          {/* 閾跺骇鏂板 */}
+          <TextField source="saleOrgName" label="閿�鍞粍缁�" />
+          <TextField source="saleUserName" label="閿�鍞憳" />
+          <TextField source="saleDate" label="鍑哄簱鏃ユ湡" />
+          <TextField source="customerId" label="瀹㈡埛缂栫爜" />
+          <TextField source="customerName" label="瀹㈡埛" />     
+
           <WrapperField cellClassName="opt" label="common.field.opt" >
             <MyButton setCreateDialog={setManualDialog} setmodalType={setmodalType} />
             <EditButton label="toolbar.detail" icon={(<DetailsIcon />)}></EditButton>
             <CancelButton />
+            <CompleteButton />
             <PublicButton setDrawerVal={setDrawerVal} drawerVal={drawerVal} setSelect={setSelect} />
           </WrapperField>
         </StyledDatagrid>
@@ -253,6 +261,29 @@
   );
 }
 
+//瀹屾垚鍗曟嵁
+const CompleteButton = () => {
+  const record = useRecordContext();
+  const notify = useNotify();
+  const refresh = useRefresh();
+  const requestComplete = async () => {
+    const { data: { code, data, msg } } = await request.get(`/outStock/complete/${record.id}`);
+    if (code === 200) {
+      notify(msg);
+      refresh()
+    } else {
+      notify(msg);
+    }
+  }
+
+  return (
+    // record.exceStatus === 1 && (record.anfme === record.qty ? <Button onClick={requestComplete} label={"toolbar.complete"} color="secondary">
+    //   <TaskIcon />
+    // </Button> : )
+    record.exceStatus != 15 ? <ConfirmButton label={"toolbar.complete"} color="secondary" startIcon={<TaskIcon />} onConfirm={requestComplete} /> : <></>
+  )
+}
+
 const MyButton = ({ setCreateDialog, setmodalType }) => {
   const record = useRecordContext();
   const handleEditClick = (btn) => {

--
Gitblit v1.9.1