|
|
@@ -4,12 +4,13 @@ |
|
|
|
* @returns |
|
|
|
*/ |
|
|
|
import type { ActionType, ProColumns } from '@ant-design/pro-components'; |
|
|
|
import { FooterToolbar, ProForm, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components'; |
|
|
|
import { Button, Modal, Form, Input, message, Popconfirm, Tag, DatePicker as TDatePicker, Select, Steps, StepsProps, Popover, ConfigProvider, List, Space, Radio, Card, Row, Col } from 'antd'; |
|
|
|
import { CheckCard, FooterToolbar, ProForm, ProFormSelect, ProFormText, ProTable } from '@ant-design/pro-components'; |
|
|
|
import { Button, Modal, Form, Input, message, Popconfirm, Tag, DatePicker as TDatePicker, Select, Steps, StepsProps, Popover, ConfigProvider, List, Space, Radio, Card, Row, Col, Flex, Empty, Badge, Divider } from 'antd'; |
|
|
|
import { useEffect, useRef, useState } from 'react'; |
|
|
|
import WorkInfoAPI from '@/api/workService'; |
|
|
|
import FinalAPI from '@/api/finalService'; |
|
|
|
import ProductLineAPI from '@/api/productlineService'; |
|
|
|
import productlineInfoStepsAPI from '@/api/productlinesteps/service' |
|
|
|
import styles from "./index.less"; |
|
|
|
import dayjs from 'dayjs' |
|
|
|
import workService from '@/api/workService'; |
|
|
@@ -18,6 +19,7 @@ import workplanApi from '@/api/work/plan/service' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const DatePicker: any = TDatePicker; |
|
|
|
const Stepitems = [ |
|
|
|
{ |
|
|
@@ -76,7 +78,8 @@ export default () => { |
|
|
|
const [lineData, setLineData] = useState<MySelectType.Select[]>([]) |
|
|
|
const [workStatusList, setWorkStatusList] = useState([]) |
|
|
|
|
|
|
|
|
|
|
|
//获取产线工艺流程 |
|
|
|
const [lineProcessList, setLineProcessList] = useState<any[]>([]) |
|
|
|
const [selectfinal, setSelectFinal] = useState<any>(); |
|
|
|
|
|
|
|
const [lineDeviceData, setLineDeviceData] = useState<any[]>([]) |
|
|
@@ -96,12 +99,12 @@ export default () => { |
|
|
|
const batchActionRef = useRef<ActionType>(); |
|
|
|
const [itemData, setItemData] = useState<WorkInfoTypes.WorkInfoOutput[]>([]); |
|
|
|
const [itemLoading, SetItemLoading] = useState<boolean>(false) |
|
|
|
const finalIdFlag = Form.useWatch('finalId', typeForm); |
|
|
|
const columns: ProColumns<WorkInfoTypes.WorkInfoOutput>[] = [ |
|
|
|
{ |
|
|
|
title: '工单编码', |
|
|
|
dataIndex: 'id', |
|
|
|
hideInSearch: true, |
|
|
|
width: 140, |
|
|
|
align: 'center', |
|
|
|
}, |
|
|
|
{ |
|
|
@@ -110,7 +113,6 @@ export default () => { |
|
|
|
ellipsis: true, |
|
|
|
hideInSearch: true, |
|
|
|
align: 'center', |
|
|
|
width: 100 |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '炒锅名称', |
|
|
@@ -118,7 +120,6 @@ export default () => { |
|
|
|
ellipsis: true, |
|
|
|
hideInSearch: true, |
|
|
|
align: 'center', |
|
|
|
width: 100, |
|
|
|
renderText(text, record, index, action) { |
|
|
|
return <>{record.deviceName ? record.deviceName : "自动分配"}</> |
|
|
|
}, |
|
|
@@ -131,12 +132,11 @@ export default () => { |
|
|
|
ellipsis: true, |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '产量', |
|
|
|
title: '下料(锅)', |
|
|
|
dataIndex: 'number', |
|
|
|
ellipsis: true, |
|
|
|
hideInSearch: true, |
|
|
|
align: 'center', |
|
|
|
width: 100 |
|
|
|
}, |
|
|
|
{ |
|
|
|
dataIndex: 'batchId', |
|
|
@@ -179,12 +179,12 @@ export default () => { |
|
|
|
dataIndex: 'createTime', |
|
|
|
ellipsis: true, |
|
|
|
hideInSearch: true, |
|
|
|
width: 140 |
|
|
|
}, |
|
|
|
{ |
|
|
|
title: '操作', |
|
|
|
valueType: 'option', |
|
|
|
key: 'option', |
|
|
|
fixed: 'right', |
|
|
|
render: (_, record) => { |
|
|
|
switch (record.status) { |
|
|
|
case 0: |
|
|
@@ -192,25 +192,37 @@ export default () => { |
|
|
|
return [ |
|
|
|
<Button |
|
|
|
key="edit" |
|
|
|
type="primary" ghost |
|
|
|
type="primary" size='small' |
|
|
|
onClick={async () => { |
|
|
|
setIsModalOpen(true); |
|
|
|
console.log(record); |
|
|
|
typeForm.resetFields() |
|
|
|
setModelTitle('编辑信息'); |
|
|
|
const copyFormData = JSON.parse(JSON.stringify(record)); |
|
|
|
// copyFormData.repairDate =dayjs(record.repairDate) |
|
|
|
console.log('record', record); |
|
|
|
var jsonData: ProductlineTypes.ProductionlineQuery = { |
|
|
|
lineId: record.lineId |
|
|
|
} |
|
|
|
ProductLineAPI.devicelist(jsonData).then((res: MyResponse.Content) => { |
|
|
|
FinalAPI.LineList(record.finalId).then((res: MyResponse.Content) => { |
|
|
|
if (res.statusCode === 200) { |
|
|
|
setLineData(res.data) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
workService.EditDetail(record.id).then((res: MyResponse.Content) => { |
|
|
|
if (res.statusCode === 200) { |
|
|
|
setLineDeviceData(res.data) |
|
|
|
setIsModalOpen(true); |
|
|
|
UpdateGY(res.data.lineId, record.finalId); |
|
|
|
setTimeout(() => { |
|
|
|
res.data.number = record.number |
|
|
|
res.data.finaId = record.finalId |
|
|
|
res.data.id = record.id |
|
|
|
res.data.workDevices.map((item: any) => { |
|
|
|
res.data["pro:" + item.processId] = item.deviceId |
|
|
|
}) |
|
|
|
console.log(res.data); |
|
|
|
typeForm.setFieldsValue(res.data); |
|
|
|
}, 500); |
|
|
|
} |
|
|
|
}) |
|
|
|
typeForm.setFieldsValue(copyFormData); |
|
|
|
|
|
|
|
}} |
|
|
|
> |
|
|
|
编辑 |
|
|
|
编辑工单 |
|
|
|
</Button>, |
|
|
|
<Popconfirm |
|
|
|
key="workdel" |
|
|
@@ -233,7 +245,7 @@ export default () => { |
|
|
|
okText="确认" |
|
|
|
cancelText="关闭" |
|
|
|
> |
|
|
|
<Button type="primary" danger ghost>删除</Button> |
|
|
|
<Button type="primary" danger size='small'>删除</Button> |
|
|
|
</Popconfirm> |
|
|
|
, |
|
|
|
<Popconfirm |
|
|
@@ -259,7 +271,7 @@ export default () => { |
|
|
|
okText="确认" |
|
|
|
cancelText="关闭" |
|
|
|
> |
|
|
|
<Button type="primary" ghost>下发</Button> |
|
|
|
<Button type="primary" size='small'>下发</Button> |
|
|
|
</Popconfirm>] |
|
|
|
case 1: |
|
|
|
return [ |
|
|
@@ -587,7 +599,6 @@ export default () => { |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
|
|
|
|
//初始化 |
|
|
|
useEffect(() => { |
|
|
|
FinalAPI.SelectList().then((res: MyResponse.Content) => { |
|
|
@@ -606,8 +617,13 @@ export default () => { |
|
|
|
} |
|
|
|
}) |
|
|
|
}, []) |
|
|
|
|
|
|
|
|
|
|
|
const UpdateGY = (lineId: string, finalId: string) => { |
|
|
|
productlineInfoStepsAPI.List({ lineId: lineId, finalId: finalId }).then((res: MyResponse.Content) => { |
|
|
|
if (res.statusCode === 200) { |
|
|
|
setLineProcessList(res.data); |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
// const GetItemData=async (jsonData:any)=>{ |
|
|
|
// setItemData([]) |
|
|
|
// SetItemLoading(true) |
|
|
@@ -653,8 +669,23 @@ export default () => { |
|
|
|
*表单提交 |
|
|
|
*/ |
|
|
|
const OnSubmit = async (values: any) => { |
|
|
|
console.log(values); |
|
|
|
|
|
|
|
values.batchId = selectBatchItemRow?.id |
|
|
|
|
|
|
|
const WorkDeviceAddInputs: any[] = [] |
|
|
|
|
|
|
|
Object.keys(values).forEach((item: string) => { |
|
|
|
if (item.includes('pro')) { |
|
|
|
console.log(item); |
|
|
|
const WorkDeviceAddInput: any = { |
|
|
|
processId: item.split(':')[1], |
|
|
|
deviceId: values[item] |
|
|
|
} |
|
|
|
WorkDeviceAddInputs.push(WorkDeviceAddInput) |
|
|
|
} |
|
|
|
}) |
|
|
|
values.workDevices = WorkDeviceAddInputs; |
|
|
|
console.log(values); |
|
|
|
if (values.id) { |
|
|
|
const response = await WorkInfoAPI.Update(values); |
|
|
|
if (response.statusCode === 200) { |
|
|
@@ -678,7 +709,7 @@ export default () => { |
|
|
|
} |
|
|
|
}; |
|
|
|
const [expandedRowKeys, setExpandedRowKeys] = useState<any>([]); |
|
|
|
const expandedRowRender = (data: OrderType.Info) => { |
|
|
|
const expandedRowRender = (data: WorkInfoTypes.Info) => { |
|
|
|
console.log('data', data.workList); |
|
|
|
var res = data.workList; |
|
|
|
// setitemparams({batchId:data.id}) |
|
|
@@ -781,7 +812,7 @@ export default () => { |
|
|
|
|
|
|
|
columns={batchColumns} |
|
|
|
actionRef={batchActionRef} |
|
|
|
|
|
|
|
|
|
|
|
request={async (params = {}) => { |
|
|
|
const jsonData: WorkInfoTypes.Page = { |
|
|
|
pageIndex: params.current || 1, |
|
|
@@ -833,7 +864,7 @@ export default () => { |
|
|
|
/> |
|
|
|
<Modal |
|
|
|
maskClosable={false} |
|
|
|
width={800} |
|
|
|
width={1200} |
|
|
|
title={<Tag color="#cd201f">{modelTitle}</Tag>} |
|
|
|
open={isModalOpen} |
|
|
|
onCancel={() => { |
|
|
@@ -863,51 +894,61 @@ export default () => { |
|
|
|
onFinish={OnSubmit} |
|
|
|
autoComplete="off" |
|
|
|
> |
|
|
|
<ProFormText |
|
|
|
width="md" label="id" name="id" hidden> |
|
|
|
</ProFormText> |
|
|
|
|
|
|
|
<ProFormText |
|
|
|
width="md" label="id" name="id" hidden> |
|
|
|
</ProFormText> |
|
|
|
|
|
|
|
<ProFormSelect |
|
|
|
colProps={{ xl: 8, md: 12 }} |
|
|
|
label="生产计划" |
|
|
|
name="finalId" |
|
|
|
name="planId" |
|
|
|
options={finalPlan} |
|
|
|
fieldProps={{ |
|
|
|
fieldNames:{ |
|
|
|
label:"name", |
|
|
|
value:"id" |
|
|
|
fieldNames: { |
|
|
|
label: "name", |
|
|
|
value: "id" |
|
|
|
} |
|
|
|
}} |
|
|
|
rules={[{ required: true, message: '此项为必填项!' }]} |
|
|
|
onChange={(v)=>{ |
|
|
|
const finalId = finalPlan.find(x => x.id == v)?.finalId; |
|
|
|
const name = finalData.find(x => x.key == finalId)?.value; |
|
|
|
const quantity =finalPlan.find(x => x.id == v)?.quantity; |
|
|
|
setSelectFinal({ name: name, finalId: finalId,quantity:quantity }) |
|
|
|
FinalAPI.LineList(finalId).then((res:MyResponse.Content)=>{ |
|
|
|
onChange={(v: string) => { |
|
|
|
// const finalId = finalPlan.find(x => x.id == v)?.finalId; |
|
|
|
// const name = finalData.find(x => x.key == finalId)?.value; |
|
|
|
// const quantity = finalPlan.find(x => x.id == v)?.quantity; |
|
|
|
typeForm.setFieldValue('lineId', '') |
|
|
|
workplanApi.Detail(v).then((res: MyResponse.Content) => { |
|
|
|
if (res.statusCode === 200) { |
|
|
|
setLineData(res.data) |
|
|
|
setSelectFinal({ name: res.data.Name, finalId: res.data.finalId, quantity: res.data.quantity }) |
|
|
|
setLineProcessList([]) |
|
|
|
FinalAPI.LineList(res.data.finalId).then((res: MyResponse.Content) => { |
|
|
|
if (res.statusCode === 200) { |
|
|
|
setLineData(res.data) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}} |
|
|
|
> |
|
|
|
|
|
|
|
|
|
|
|
</ProFormSelect> |
|
|
|
<Row gutter={18}> |
|
|
|
<Row gutter={18}> |
|
|
|
<Col xl={6} md={12} sm={24}> |
|
|
|
<ProFormText |
|
|
|
width="md" label="成品" > |
|
|
|
<Input readOnly disabled value={selectfinal?.name}></Input> |
|
|
|
</ProFormText> |
|
|
|
</Col> |
|
|
|
<Col xl={6} md={12} sm={24}> |
|
|
|
<Form.Item label="数量" > |
|
|
|
<Input readOnly disabled value={selectfinal?.quantity}></Input> |
|
|
|
</Form.Item> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
<Form.Item name='finalName' |
|
|
|
label="成品" > |
|
|
|
<Input readOnly disabled value={selectfinal?.name}></Input> |
|
|
|
</Form.Item> |
|
|
|
</Col> |
|
|
|
<Col xl={6} md={12} sm={24}> |
|
|
|
<Form.Item label="数量" name='quantity' > |
|
|
|
<Input readOnly disabled value={selectfinal?.quantity}></Input> |
|
|
|
</Form.Item> |
|
|
|
</Col> |
|
|
|
</Row> |
|
|
|
<Form.Item label="产线" name="lineId" rules={[{ required: true, message: '此项为必填项!' }]}> |
|
|
|
<Select onChange={(e) => { |
|
|
|
console.log('selectfinal', selectfinal); |
|
|
|
|
|
|
|
UpdateGY(e, selectfinal?.finalId) |
|
|
|
typeForm.setFieldValue("deviceId", "") |
|
|
|
var jsonData: ProductlineTypes.ProductionlineQuery = { |
|
|
|
lineId: e |
|
|
@@ -925,16 +966,50 @@ export default () => { |
|
|
|
})} |
|
|
|
</Select> |
|
|
|
</Form.Item> |
|
|
|
{/* <Form.Item name="deviceId" label="选择设备" rules={[{ required: true, message: '此项为必选项!' }]}> |
|
|
|
<Select placeholder="请选择设备" > |
|
|
|
{lineDeviceData.map((item, index) => ( |
|
|
|
// <Radio key={index} value={item.deviceId}>{item.deviceName}</Radio> |
|
|
|
<Select.Option value={item.deviceId} key={index}> |
|
|
|
<span>{item.deviceName}</span> |
|
|
|
</Select.Option> |
|
|
|
))} |
|
|
|
</Select> |
|
|
|
</Form.Item> */} |
|
|
|
|
|
|
|
<Card title={'产线工序路线'}> |
|
|
|
<div className={styles.gongyi_tag}> |
|
|
|
<Flex wrap gap="small"> |
|
|
|
{lineProcessList.map((item, index) => ( |
|
|
|
<div className={styles.gongyi_tag_box} key={index} > |
|
|
|
<div |
|
|
|
|
|
|
|
className={styles.gongyi_tag_item}> |
|
|
|
<Space size="middle"> |
|
|
|
<div color="#2db7f5" style={{ fontSize: '22px' }}> {index + 1}-{item.processName}</div> |
|
|
|
</Space> |
|
|
|
</div> |
|
|
|
<Card title='选择设备' size="small" bordered={false} style={{ height: '200px', overflowY: 'auto', overflowX: 'hidden' }} className={styles.gongyi_tag_device}> |
|
|
|
|
|
|
|
<Form.Item name={'pro:' + item.id} > |
|
|
|
<CheckCard.Group > |
|
|
|
{ |
|
|
|
item.devicesInfo.length > 0 ? |
|
|
|
<Space title='设备' direction="vertical"> |
|
|
|
{item.devicesInfo.map((devicesItem: any, devicesIndex: number) => ( |
|
|
|
<CheckCard onClick={(v) => { |
|
|
|
}} size='small' title={devicesItem.name} value={devicesItem.id} /> |
|
|
|
))} |
|
|
|
</Space> |
|
|
|
: <Empty /> |
|
|
|
} |
|
|
|
</CheckCard.Group> |
|
|
|
</Form.Item> |
|
|
|
|
|
|
|
</Card> |
|
|
|
{/* <Card title='备注' size="small" style={{ height: '150px' }}> |
|
|
|
<Input aria-label='备注' /> |
|
|
|
</Card> */} |
|
|
|
|
|
|
|
<Divider /> |
|
|
|
</div> |
|
|
|
|
|
|
|
))} |
|
|
|
</Flex> |
|
|
|
</div> |
|
|
|
|
|
|
|
</Card> |
|
|
|
|
|
|
|
<Form.Item label="下料(锅)" name="number" rules={[{ required: true, message: '此项为必填项!' }]} > |
|
|
|
<Input type='number' min={1} /> |
|
|
|
</Form.Item> |
|
|
|