From 5759f14373e0746b15e2ba1e2491b1475ebbcdfc Mon Sep 17 00:00:00 2001 From: gwbvipvip Date: Wed, 25 May 2022 15:20:41 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/device/deviceStock/index.jsx | 48 ++++++++++++++++-------- src/pages/device/deviceStock/services.js | 8 ++++ 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/src/pages/device/deviceStock/index.jsx b/src/pages/device/deviceStock/index.jsx index c1c838f..0210d37 100644 --- a/src/pages/device/deviceStock/index.jsx +++ b/src/pages/device/deviceStock/index.jsx @@ -12,6 +12,7 @@ import { PushStockAsync, CheckStockAdjust, removeSingleStockAdjust, + PushDeviceTMC } from './services'; const key = 'message'; @@ -24,7 +25,7 @@ const DeviceStockManager = (props) => { const [currentRow, setCurrentRow] = useState(); const [selectedRowsState, setSelectedRows] = useState([]); const [total, setTotal] = useState(0); - + //添加 const handleAdd = async (fields) => { try { @@ -53,19 +54,36 @@ const DeviceStockManager = (props) => { const pushStock = async (id) => { try { message.loading('正在同步', key); - await PushStockAsync(id).then((r) => { - message.destroy(key); - if (r.data) { - setSelectedRows([]); - message.success('同步成功'); - actionRef.current.reload(); - return true; - } else { - message.success('同步失败'); - actionRef.current.reload(); - return false; - } - }); + if (props.isbom) { + await PushDeviceTMC(id).then((r) => { + message.destroy(key); + if (r.data) { + setSelectedRows([]); + message.success('同步成功'); + actionRef.current.reload(); + return true; + } else { + message.success('同步失败'); + actionRef.current.reload(); + return false; + } + }); + } else { + await PushStockAsync(id).then((r) => { + message.destroy(key); + if (r.data) { + setSelectedRows([]); + message.success('同步成功'); + actionRef.current.reload(); + return true; + } else { + message.success('同步失败'); + actionRef.current.reload(); + return false; + } + }); + + } } catch (error) { message.error('同步失败请重试!'); actionRef.current.reload(); @@ -250,7 +268,7 @@ const DeviceStockManager = (props) => { 同步库存原料 ,