Browse Source

物料同步

tags/小炒逻辑变更前
gwbvipvip 2 years ago
parent
commit
5759f14373
2 changed files with 41 additions and 15 deletions
  1. +33
    -15
      src/pages/device/deviceStock/index.jsx
  2. +8
    -0
      src/pages/device/deviceStock/services.js

+ 33
- 15
src/pages/device/deviceStock/index.jsx View File

@@ -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={() => {


+ 8
- 0
src/pages/device/deviceStock/services.js View File

@@ -7,6 +7,14 @@ export async function GetStoreBatchingStockPageAsync(data) {
data: data,
});
}

/** 同步库存 */
export async function PushDeviceTMC(data) {
return request(`/kitchen/api/Device/PushDeviceTMC?DeviceId=${data}`, {
method: 'post',
});
}

/** 同步库存 */
export async function PushStockAsync(data) {
return request(`/kitchen/api/Device/PushDevice?DeviceId=${data}`, {


Loading…
Cancel
Save