Browse Source

实时获取库存原料/同步库存原料

dev
ywh 1 year ago
parent
commit
7090f900d6
4 changed files with 69 additions and 7 deletions
  1. +49
    -3
      src/pages/device/deviceInfo/components/StockMaterial.jsx
  2. +1
    -1
      src/pages/device/deviceInfo/components/StockMaterialForm.jsx
  3. +15
    -1
      src/pages/device/deviceInfo/services.js
  4. +4
    -2
      src/pages/foodMenu/foodMenuInfo/index.jsx

+ 49
- 3
src/pages/device/deviceInfo/components/StockMaterial.jsx View File

@@ -1,7 +1,7 @@
import { Modal, message, Popconfirm, Button } from 'antd';
import React, { useEffect, useState, useRef } from 'react';
import ProTable from '@ant-design/pro-table';
import { GetDeviceStorePage, removeSingleStockAdjust } from '../services';
import { GetDeviceStorePage, removeSingleStockAdjust, PushStockAsync, CheckStockAdjust } from '../services';
import StockMaterialForm from "./StockMaterialForm";
import { PlusOutlined } from '@ant-design/icons';

@@ -64,7 +64,7 @@ const StockMaterial = (props) => {
];

const handleOk = () => {
props.onOk();
}

/**
@@ -103,6 +103,52 @@ const StockMaterial = (props) => {
deviceId: props.device.id,
}}
toolBarRender={() => [
<Popconfirm
type="primary"
key="primary-async-time"
title="获取实时库存会覆盖本次补货数据"
okText="是"
cancelText="否"
onConfirm={async () => {
const response = await CheckStockAdjust(props.device.id);
if (response.data) {
message.success('获取实时库存会成功!');
actionRef.current.reload();
} else {
message.error(response.errors || '获取实时库存会失败!');
}
}}
>
<Button
type="primary"
key="primary"
>
获取实时库存
</Button>
</Popconfirm>,
<Popconfirm
type="primary"
key="primary-async"
title="确认同步吗?"
okText="是"
cancelText="否"
onConfirm={async () => {
const response = await PushStockAsync(props.device.id);
if (response.data) {
message.success('同步成功!');
actionRef.current.reload();
} else {
message.error(response.errors || '同步失败!');
}
}}
>
<Button
type="primary"
key="primary"
>
同步库存
</Button>
</Popconfirm>,
<Button
type="primary"
key="primary"
@@ -112,7 +158,7 @@ const StockMaterial = (props) => {
}}
>
<PlusOutlined /> 新增库存原料
</Button>,
</Button>
]}
request={async (params) => {
const response = await GetDeviceStorePage(params);


+ 1
- 1
src/pages/device/deviceInfo/components/StockMaterialForm.jsx View File

@@ -81,7 +81,7 @@ const StockMaterialForm = (props) => {
取消
</Button>,
<Popconfirm
title="重启设备后生效!!!"
title="点击同步库存或重启设备后生效!!!"
onConfirm={handleOk}
okText="确定"
cancelText="取消"


+ 15
- 1
src/pages/device/deviceInfo/services.js View File

@@ -176,4 +176,18 @@ export async function getFoodMenuList(params) {
...params,
},
});
}
}

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

/** 获取实时库存 */
export async function CheckStockAdjust(data) {
return request(`/kitchen/api/Device/CheckStockAdjust?DeviceId=${data}`, {
method: 'POST',
});
}

+ 4
- 2
src/pages/foodMenu/foodMenuInfo/index.jsx View File

@@ -99,12 +99,14 @@ const GoodsTypeManage = () => {
{
title: '菜谱名称',
dataIndex: 'name',
valueType: 'textarea',
},
{
title: '菜谱编码',
dataIndex: 'code',
valueType: 'textarea',
},
{
title: '排序',
dataIndex: 'sort',
},
{
title: '操作',


Loading…
Cancel
Save