|
|
@@ -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) => { |
|
|
|
同步库存原料 |
|
|
|
</Button>, |
|
|
|
<Button |
|
|
|
disabled={props.isbom&&total>14} |
|
|
|
disabled={props.isbom && total > 14} |
|
|
|
type="primary" |
|
|
|
key="primary" |
|
|
|
onClick={() => { |
|
|
|