From 829c4d587ee53abc7f74e5d4a0786ab0625c1b3a Mon Sep 17 00:00:00 2001 From: ranyuqi <836357039@qq.com> Date: Wed, 19 Jul 2023 18:43:52 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E8=AE=BE=E5=A4=87=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/api/craftsinfo.ts | 133 ++++++++++++++++++ frontend/src/api/groupService.ts | 2 +- frontend/src/api/materialService.ts | 4 +- frontend/src/api/productlineService.ts | 60 +++++++++ frontend/src/api/recipeService.ts | 7 + frontend/src/pages/bucket/index.tsx | 9 +- frontend/src/pages/final/index.tsx | 91 ++++++++----- frontend/src/pages/group/index.tsx | 24 ++-- frontend/src/pages/manufacturing/index.tsx | 149 ++++++++++++--------- frontend/src/pages/stock/index.tsx | 4 + frontend/src/types/Crafts.d.ts | 132 ++++++++++++++++++ frontend/src/types/FinalInfo.d.ts | 3 +- frontend/src/types/GroupInfo.d.ts | 107 ++++++++++++++- frontend/src/types/MyResponse.d.ts | 4 +- frontend/src/types/ProductlineInfo.d.ts | 111 +++++++++++++++ node_modules/.cache/logger/umi.log | 0 16 files changed, 720 insertions(+), 120 deletions(-) create mode 100644 frontend/src/api/craftsinfo.ts create mode 100644 frontend/src/api/productlineService.ts create mode 100644 frontend/src/types/Crafts.d.ts create mode 100644 frontend/src/types/ProductlineInfo.d.ts create mode 100644 node_modules/.cache/logger/umi.log diff --git a/frontend/src/api/craftsinfo.ts b/frontend/src/api/craftsinfo.ts new file mode 100644 index 0000000..bb41256 --- /dev/null +++ b/frontend/src/api/craftsinfo.ts @@ -0,0 +1,133 @@ + +import { request } from '@umijs/max'; + +// 工艺 +export default { + /** + * 新增 + * @param parms + * @returns + */ + Add(parms: CraftsTypes.Info) { + return request('/api/craftsinfo/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 删除 + * @param parms + * @returns + */ + Del(parms: CraftsTypes.craftsInfoDelInput) { + return request(`/api/craftsinfo/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 修改 + * @param parms + * @returns + */ + Update(parms: CraftsTypes.Info) { + return request('/api/craftsinfo/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + + + + /** + * 详情 + * @param parms + * @returns + */ + Detail(id: string) { + return request(`/api/craftsinfo/detail?id=${id}`, { + method: 'GET' + }); + }, + /** + * 获取列表 + * @param parms + * @returns + */ + List() { + return request('/api/craftsinfo/list', { + method: 'POST' + }); + }, + /** + * 未绑定的设备列表 + * @param parms + * @returns + */ + UnBindList() { + return request('/api/craftsinfo/UnBindList', { + method: 'GET' + }); + + }, + /** + * 分页查询 + * @param parms + * @returns + */ + PagedList(parms: CraftsTypes.Page) { + return request('/api/craftsinfo/pagedlist', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + /** + * 批量更新 + * @param parms + * @returns + */ + BatchUpdate(parms: CraftsTypes.BatchAdd) { + return request('/api/craftsrecipe/batchupdate', { + method: 'POST', + data: parms + }); + }, + /** + * 根据设备Id查询配方信息 + * @param parms + * @returns + */ + RecipeList(id: string) { + return request(' api/craftsrecipe/list', { + method: 'POST', + data: { + craftsId: id + } + }); + }, + // 根据桶id查询桶的物料记录 + + materialtrecored(parms: CraftsTypes.craftsMaterialsRecordQueryPageInput) { + return request('/api/craftsmaterialsrecord/pagedlist', { + method: 'POST', + data: { ...parms } + }) + }, + // 下拉 + selectlist() { + return request('/api/craftssteps/selectlist', { + method: 'GET', + + }) + } + +} + diff --git a/frontend/src/api/groupService.ts b/frontend/src/api/groupService.ts index 4d35ded..9131325 100644 --- a/frontend/src/api/groupService.ts +++ b/frontend/src/api/groupService.ts @@ -2,7 +2,7 @@ import { request } from '@umijs/max'; export default { - //创建 + //创建分组 Add(parms: GroupInfoTypes.Info) { return request('/api/groupinfo/add', { method: 'POST', diff --git a/frontend/src/api/materialService.ts b/frontend/src/api/materialService.ts index ca5e283..efaa10f 100644 --- a/frontend/src/api/materialService.ts +++ b/frontend/src/api/materialService.ts @@ -50,7 +50,9 @@ export default { method:'GET' }) }, - + + + /** * 分页查询 * @param parms diff --git a/frontend/src/api/productlineService.ts b/frontend/src/api/productlineService.ts new file mode 100644 index 0000000..09a509d --- /dev/null +++ b/frontend/src/api/productlineService.ts @@ -0,0 +1,60 @@ +import { request } from '@umijs/max'; + + +export default { + //创建产线 + Add(parms: ProductlineTypes.Info) { + return request('/api/productline/add', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //删除 + Del(parms: ProductlineTypes.Info) { + return request(`/api/productline/del`, { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //修改 + Update(parms: ProductlineTypes.Info) { + return request('/api/productline/update', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + //列表 + List() { + return request('/api/productline/list', { + method: 'GET', + }); + }, + /** + * 分页查询 + * @param parms + * @returns + */ + PagedList(parms: ProductlineTypes.Page) { + return request('/api/productline/pagedlist', { + method: 'POST', + data: { + ...parms, + }, + }); + }, + // 下拉列表 + selectlist() { + return request('/api/productline/selectlist', { + method: 'GET', + + }); + } +} + + diff --git a/frontend/src/api/recipeService.ts b/frontend/src/api/recipeService.ts index 9619b80..cf12729 100644 --- a/frontend/src/api/recipeService.ts +++ b/frontend/src/api/recipeService.ts @@ -78,6 +78,13 @@ export default { method: 'POST', data: parms }); + }, + // 下拉 + selectlist() { + return request('/api/recipesinfo/selectlist', { + method: 'GET', + + }) } } diff --git a/frontend/src/pages/bucket/index.tsx b/frontend/src/pages/bucket/index.tsx index 458795d..c33d895 100644 --- a/frontend/src/pages/bucket/index.tsx +++ b/frontend/src/pages/bucket/index.tsx @@ -47,11 +47,13 @@ const bucket = () => { tip: '规则名称是唯一的 key', hideInSearch: true, hideInTable: true, + }, { title: '桶名称', dataIndex: 'name', ellipsis: true, + align:'center', }, { @@ -59,18 +61,19 @@ const bucket = () => { dataIndex: 'code', hideInSearch: true, ellipsis: true, - + align:'center', }, { title: '当前原料', dataIndex: 'des', ellipsis: true, hideInSearch: true, - + align:'center', }, { title: '桶二维码', dataIndex: 'type', + align:'center', ellipsis: true, hideInSearch: true, width:160, @@ -451,7 +454,7 @@ const bucket = () => {
- +
diff --git a/frontend/src/pages/final/index.tsx b/frontend/src/pages/final/index.tsx index 77a1107..8f4e71f 100644 --- a/frontend/src/pages/final/index.tsx +++ b/frontend/src/pages/final/index.tsx @@ -3,11 +3,14 @@ import type { ActionType, ProColumns } from '@ant-design/pro-components'; import { ProTable } from '@ant-design/pro-components'; import { Button, Modal, Form, Input, message, Popconfirm, TreeSelect, Select, Tag, Dropdown, Space, MenuProps } from 'antd'; -import { useRef, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; import finalInfoAPI from '@/api/finalService'; import { DownOutlined } from '@ant-design/icons'; import FormItem from 'antd/lib/form/FormItem'; import { ItemType } from 'rc-menu/lib/interface'; +import craftsinfoAPI from '@/api/craftsinfo'; +// 配方服务 +import recipeAPI from '@/api/recipeService'; const final = () => { @@ -79,13 +82,13 @@ const final = () => { > 编辑 , - + { - const EnablejsonData: FinalTypes.Info = { + const EnablejsonData: FinalTypes.FinalInfoDelInput = { id: record.id, // name: '', // code: '' @@ -109,6 +112,26 @@ const final = () => { ], }, ]; + // eslint-disable-next-line react-hooks/rules-of-hooks + useEffect(() => { + // 下拉列表信息 + const areasList = async () => { + + const data = await recipeAPI.selectlist(); + console.log(data); + + // eslint-disable-next-line @typescript-eslint/no-use-before-define + setareas(data.data); + }; + areasList(); + }, []); + + + + + + + const OnSubmit = async (values: FinalTypes.Info) => { if (values.id) { @@ -118,7 +141,7 @@ const final = () => { actionRef.current?.reload(); setIsModalOpen(false); } else { - message.error(JSON.stringify(response.errors) || '修改失败'); + message.error(JSON.stringify(response.errors) || '修改失败'); } } else { const response = await finalInfoAPI.Add(values); @@ -128,32 +151,26 @@ const final = () => { actionRef.current?.reload(); setIsModalOpen(false); } else { - message.error(JSON.stringify(response.errors) || '添加失败'); + message.error(JSON.stringify(response.errors) || '添加失败'); } } }; + + + // 定义工艺列表 + // const areas = [ + // { label: '工艺1', value: '工艺1' }, + // { label: '工艺2', value: '工艺1' }, + // ]; + + - // 定义配方列表的数据 - // const item: MenuProps['items'] = [ - // { - // label: 'hini', - // key: '1', - // }, - // { - // label: 'eer ', - // key: '2', - // } + // 定义配方列表 + const [areas, setareas] = useState([]) + // const formula = [ + // { label: '配方1', value: '配方1' }, + // { label: '配方2', value: '配方1' }, // ]; -// 定义工艺列表 - const areas = [ - { label: '工艺1', value: '工艺1' }, - { label: '工艺2', value: '工艺1' }, - ]; -// 定义配方列表 -const formula = [ - { label: '配方1', value: '配方1' }, - { label: '配方2', value: '配方1' }, -]; return ( <> @@ -206,8 +223,8 @@ const formula = [ , ]} - - + + /> {/* 新增成品的model弹窗 */} @@ -256,22 +273,28 @@ const formula = [ > - + - + - + {/* 工艺列表 */} - */} + {/* 配方列表 */} - - */} + - + diff --git a/frontend/src/pages/manufacturing/index.tsx b/frontend/src/pages/manufacturing/index.tsx index 7a64a16..5a7338f 100644 --- a/frontend/src/pages/manufacturing/index.tsx +++ b/frontend/src/pages/manufacturing/index.tsx @@ -1,3 +1,4 @@ +/* eslint-disable array-callback-return */ // 产线管理 import { ActionType, EditableFormInstance, EditableProTable, ProCard, ProColumns } from '@ant-design/pro-components'; @@ -7,11 +8,18 @@ import { useEffect, useRef, useState } from 'react'; import RecipeInfoAPI from '@/api/recipeService' // import MaterialsInfoAPI from '@/api/materialService' import GroupInfoAPI from '@/api/groupService' +import DeviceInfoAPI from '@/api/DeviceInfo' +import StockInfoAPI from '@/api/StockService'; +import ProductlineInfoAPI from '@/api/productlineService' import { LoadingOutlined, RedoOutlined, PlusSquareOutlined, EditOutlined } from '@ant-design/icons'; // import { RcFile, UploadChangeParam, UploadFile } from 'antd/es/upload'; // import { history } from '@umijs/max'; import styles from './index.less' -const { Option } = Select; + +const { Option } = Select; + + + const Index = () => { //表单 @@ -34,10 +42,12 @@ const Index = () => { const [isModalGroupFormOpen, setIsModalGroupFormOpen] = useState(false); const [selectGroup, setSelectGroup] = useState(0) const [recipeparams, setRecipeparams] = useState(); - const [GroupList, setGroupList] = useState([{ + + const [GroupList, setGroupList] = useState([{ id: '-1', name: '全部', - des: '全部' + describe: '全部', + code:'ff' }]); // const [selectRowItem, setSelectRowItem] = useState(); // const [materiallist, setMateriallist] = useState([]); @@ -49,12 +59,12 @@ const Index = () => { // const editactionformRef = useRef(); // const editactionRef = useRef(); const [groupForm] = Form.useForm(); - const [GroupEditForm] = Form.useForm(); + const [ProductlineEditForm] = Form.useForm(); //设备成功方法 - const OnSubmit = async (values: RecipeTypes.Info) => { + const OnSubmit = async (values: DeviceTypes.DeviceInfoOutput) => { // values.picUrl = imageUrl!; if (values.id) { - const response = await RecipeInfoAPI.Update(values); + const response = await DeviceInfoAPI.Update(values); if (response.statusCode === 200) { message.success('修改成功'); actionRef.current?.reload(); @@ -63,10 +73,10 @@ const Index = () => { message.error(response.errors || '修改失败'); } } else { - const response = await RecipeInfoAPI.Add(values); + const response = await DeviceInfoAPI.Add(values); if (response.statusCode === 200) { message.success('添加成功'); - + actionRef.current?.reload(); setIsModalOpen(false); } else { @@ -77,20 +87,20 @@ const Index = () => { // 料仓成功 - const submission = async (values: RecipeTypes.Info) => { + const submission = async (values: StockTypes.StockInfoOutput) => { // values.picUrl = imageUrl!; if (values.id) { - const response = await RecipeInfoAPI.Update(values); + const response = await StockInfoAPI.Update(values); if (response.statusCode === 200) { message.success('修改成功'); - + actionRef.current?.reload(); setbinModelopen(false); } else { message.error(response.errors || '修改失败'); } } else { - const response = await RecipeInfoAPI.Add(values); + const response = await StockInfoAPI.Add(values); if (response.statusCode === 200) { message.success('添加成功'); actionRef.current?.reload(); @@ -130,10 +140,17 @@ const Index = () => { // // ) //表单名 - const columns: ProColumns[] = [ + const columns: ProColumns[] = [ + { + title: 'id', + dataIndex: 'id', + tip: '规则名称是唯一的 key', + hideInSearch: true, + hideInTable: true, + }, { title: '设备名称', - dataIndex: 'code', + dataIndex: 'name', width: 200, align: 'center', hideInSearch: true, @@ -145,7 +162,7 @@ const Index = () => { { title: '设备功能', width: 200, - dataIndex: 'name', + dataIndex: 'gn', align: 'center', }, { @@ -160,7 +177,7 @@ const Index = () => { }, { title: '设备类型', - dataIndex: 'code', + dataIndex: 'deviceType', align: 'center', width: 100, hideInSearch: true @@ -170,7 +187,7 @@ const Index = () => { align: 'center', width: 40, valueType: 'option', - + key: 'option', render: (_, record) => [ @@ -251,14 +268,15 @@ const Index = () => { key="del" title="确定要删除此条数据吗?" onConfirm={() => { - const delData: RecipeTypes.Info = { + const delData: ProductlineTypes.Info = { id: record.id, name: '', code: '', - picUrl: '', - groupId: '' + // picUrl: '', + // groupId: '' + describe:'', }; - RecipeInfoAPI.Del(delData).then((r) => { + ProductlineInfoAPI.Del(delData).then((r) => { if (r.statusCode === 200) { message.success(r.statusCode === 200 ? '删除成功' : r.message); actionRef.current?.reload(); @@ -279,10 +297,17 @@ const Index = () => { ]; // 料仓列表 - const list: ProColumns[] = [ + const list: ProColumns[] = [ + { + title: 'id', + dataIndex: 'id', + tip: '规则名称是唯一的 key', + hideInSearch: true, + hideInTable: true, + }, { title: '料仓名称', - dataIndex: 'code', + dataIndex: 'name', width: 200, align: 'center', // hideInSearch: true, @@ -294,7 +319,7 @@ const Index = () => { { title: '料仓剩余', width: 200, - dataIndex: 'name', + dataIndex: 'des', align: 'center', hideInSearch: true, @@ -433,15 +458,15 @@ const Index = () => { - // 获取分组数据 + // 获取产线的数据 const GetGroupList = () => { - GroupInfoAPI.List().then((res: MyResponse.Content) => { + ProductlineInfoAPI.List().then((res: MyResponse.Content) => { if (res.statusCode === 200) { res.data.unshift( { - id: '-1', + code: '', name: '全部', - des: '全部' + describe: '' } ) setGroupList(res.data) @@ -467,7 +492,7 @@ const Index = () => { // 修改分组数据 const OnGroupEditSubmit = (value: GroupInfoTypes.Info) => { if (value.id) { - GroupInfoAPI.Update(value).then((res: MyResponse.Content) => { + ProductlineInfoAPI.Update(value).then((res: MyResponse.Content) => { if (res.statusCode) { message.success("修改成功"); setIsModalGroupFormOpen(false); @@ -477,7 +502,7 @@ const Index = () => { } }) } else { - GroupInfoAPI.Add(value).then((res: MyResponse.Content) => { + ProductlineInfoAPI.Add(value).then((res: MyResponse.Content) => { if (res.statusCode) { message.success("新增成功"); setIsModalGroupFormOpen(false); @@ -488,7 +513,7 @@ const Index = () => { } }) } - GroupEditForm.resetFields(); + ProductlineEditForm.resetFields(); } useEffect(() => { GetGroupList(); @@ -620,7 +645,7 @@ const Index = () => { , - , ]} @@ -807,9 +832,9 @@ const Index = () => { wrapperCol={{ span: 12 }} onFinish={OnSubmit} autoComplete="off" - - + + > - + @@ -1176,7 +1201,7 @@ const Index = () => {