Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
| | |
| | | |
| | | onMounted(() => { |
| | | if (props.project) { |
| | | console.log(props.project) |
| | | handleFetchData(props.project.projectNumber); |
| | | //handleTableData(data); |
| | | //handleDataReceive(data); |
| | |
| | | |
| | | const handleSimulation = async () => { |
| | | const data=computeCardRef.value.selectFullData(); |
| | | console.log(data) |
| | | if(props.project!=null){ |
| | | computed.value.glass_thickness=props.project.glass_thickness |
| | | computed.value.glass_type=props.project.glass_type |
| | | } |
| | | data.forEach(item=>{ |
| | | const processCard = { |
| | | process_no: item.processId, |
| | | layers: item.technologyNumber, |
| | | total_layers: item.total_layers, |
| | | total_num: item.total_num, |
| | | total_area: item.total_area, |
| | | is_must: true, |
| | | allow_rotate: item.allow_rotate, |
| | | priority_level: 0, |
| | | tempering: item.tempering, |
| | | curtain_wall: item.curtain_wall, |
| | | patch_state: item.patch_state, |
| | | merge: item.merge, |
| | | glass_details: [] |
| | | }; |
| | | request.post(`/glassOptimize/selectComputeDetail/${item.processId}/${item.technologyNumber}/${item.patch_state}`).then((res) => { |
| | | if(Number(res.code) === 200){ |
| | | processCard.glass_details=res.data.data |
| | | }else{ |
| | | ElMessage.warning(res.msg) |
| | | } |
| | | }) |
| | | computed.value.process_cards.push(processCard) |
| | | }) |
| | | console.log(computed.value) |
| | | /*try { |
| | | const responses = await Promise.all(requests); |
| | | |
| | | // 整合数据 |
| | | const processData = responses.reduce((acc, res, index) => { |
| | | |
| | | // 检查res.data是否为对象,并且包含'data'字段 |
| | | if (typeof res.data === 'object' && res.data !== null && 'data' in res.data) { |
| | | |
| | | // 检查data是否为数组 |
| | | if (!Array.isArray(data)) { |
| | | console.error(`响应数据中的'data'字段不是数组,process_id:`); |
| | | return acc; |
| | | } |
| | | |
| | | // 初始化process_card对象 |
| | | const processCard = { |
| | | process_no: data.processId, |
| | | layers: data.technologyNumber, |
| | | total_layers: data.total_layers, |
| | | total_num: data.total_num, |
| | | total_area: data.total_area, |
| | | is_must: true, |
| | | allow_rotate: data.allow_rotate, |
| | | priority_level: 0, |
| | | tempering: data.tempering, |
| | | curtain_wall: data.curtain_wall, |
| | | patch_state: data.patch_state, |
| | | merge: data.merge, |
| | | glass_details: [] |
| | | }; |
| | | |
| | | |
| | | // 整合glass_details |
| | | data.forEach(detail => { |
| | | const matchedNewData = data.find( |
| | | item => item.technology_number === detail.technology_number |
| | | ); |
| | | |
| | | processCard.glass_details.push({ |
| | | process_id: data.processId, |
| | | technology_number: detail.technology_number, |
| | | order_number: detail.order_number, |
| | | layers_number: detail.layers_number, |
| | | max_width: detail.width, |
| | | max_height: detail.height, |
| | | child_width: detail.child_width, |
| | | child_height: detail.child_height, |
| | | quantity: matchedNewData ? matchedNewData.quantity : 0, |
| | | patch_state: 0 |
| | | }); |
| | | }); |
| | | |
| | | // 将processCard添加到acc中 |
| | | if (!acc.process_cards) { |
| | | acc.process_cards = []; |
| | | } |
| | | acc.process_cards.push(processCard); |
| | | // 设置其他字段的值 |
| | | |
| | | } else { |
| | | console.error(`响应数据格式不正确,process_id: ${processId}`); |
| | | } |
| | | return acc; |
| | | }, {}); |
| | | if (data.length > 0) { |
| | | // 假设所有条目的thickness和glassType相同 |
| | | processData.glass_thickness = data[0].thickness; |
| | | processData.glass_type = data[0].glassType; |
| | | } else { |
| | | processData.glass_thickness = ""; |
| | | processData.glass_type = ""; |
| | | } |
| | | |
| | | |
| | | |
| | | // 发送整合后的数据到父组件 |
| | | emit('sendData', processData); |
| | | } catch (error) { |
| | | console.error('请求失败:', error); |
| | | }*/ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | const loading = ElLoading.service({ |
| | | lock: true, |
| | | text: '正在计算中,请稍候...', |
| | |
| | | if (newValue) { |
| | | // 处理数据并更新表格 |
| | | const processData = newValue.data[0]; |
| | | console.log('Processed Data:', processData); |
| | | const processedData = [ |
| | | { |
| | | id: "1", |
| | |
| | | } |
| | | ]; |
| | | gridOptions.data = processedData; |
| | | console.log(gridOptions.data) |
| | | } else { |
| | | console.error("数据格式不正确或为空"); |
| | | gridOptions.data = []; |
| | |
| | | |
| | | // let emit = defineEmits(['fetch-data']); |
| | | let emit = defineEmits(['fetch-data', 'sendData']) |
| | | const inputValues = { |
| | | project_no:inputValue, |
| | | |
| | | const handleSearchClick = () => { |
| | | // 通过 $emit 触发自定义事件,将工程号传递给父组件,由父组件去调用接口获取数据 |
| | | emit('fetch-data', inputValue.value); |
| | | |
| | | |
| | | }; |
| | | const handleSimulationClick = () => { |
| | | const inputValues = { |
| | | project_no:inputValue.value, |
| | | glass_thickness:"", |
| | | glass_type:"", |
| | | chaos_pct: optionVal.value*0.01,//混排等级 |
| | |
| | | max_load_pct: percentage1.value*0.01,//最大装载率 |
| | | max_area: 0,//最大面积 |
| | | max_qty:0,//最大片数 |
| | | load_width:furnaceWidth, |
| | | load_length: furnaceLength, |
| | | x_space: spacingWidth, |
| | | y_space: spacingLong, |
| | | load_rate: null, |
| | | load_width:furnaceWidth.value, |
| | | load_length: furnaceLength.value, |
| | | x_space: spacingWidth.value, |
| | | y_space: spacingLong.value, |
| | | load_rate: null, |
| | | furnaces_qty:"", |
| | | rotate_mode:0, |
| | | polys_allow_rotate: rotateMode.value, |
| | | process_cards:[] |
| | | }; |
| | | |
| | | // 发送所有数据到父组件 |
| | | emit('sendData', { |
| | | ...inputValues |
| | | }); |
| | | const handleSearchClick = () => { |
| | | // 通过 $emit 触发自定义事件,将工程号传递给父组件,由父组件去调用接口获取数据 |
| | | emit('fetch-data', inputValue.value); |
| | | |
| | | |
| | | }; |
| | | const handleSimulationClick = () => { |
| | | }) |
| | | // 触发父组件的 simulate-click 事件 |
| | | emit('simulate-click'); |
| | | |
| | | |
| | | }; |
| | | |
| | |
| | | |
| | | columns:[ |
| | | {type: 'seq', title: t('basicData.Number'), width: 80}, |
| | | {field: 'curtain_wall',type:'checkbox',title: '幕墙模式', width: 80}, |
| | | {field: 'allow_rotate',type:'checkbox',title: '允许横排', width: 80}, |
| | | {field: 'tempering',type:'checkbox',title: '钢化', width: 80}, |
| | | /*{field: "allow_rotate", title: '允许横排', width: 80, slots: { default: 'state' }}, |
| | | {field: "tempering", title: '钢化', width: 80, slots: { default: 'state' }},*/ |
| | | {field: 'curtain_wall',title: '幕墙模式',width: 80, slots: { default: 'state1' }}, |
| | | {field: "allow_rotate", title: '允许横排', width: 80, slots: { default: 'state2' }}, |
| | | {field: "tempering", title: '钢化', width: 80, slots: { default: 'state3' }}, |
| | | |
| | | {field: 'processId',width: 150, title: t('processCard.processId'), sortable: true}, |
| | | {field: 'technologyNumber',width: 70, title: '层', sortable: true}, |
| | |
| | | technologyNumber: null, |
| | | patchState: null, |
| | | }); |
| | | const handleCheckChange=({ column, records })=> { |
| | | if (column.field === 'tempering') { |
| | | console.log(records) |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | watch(() => props.tableData, async (newData) => { |
| | | if (Array.isArray(newData)) { |
| | | console.log(newData) |
| | | xGrid.value.loadData(deepClone(newData)) |
| | | const data=xGrid.value.getTableData().fullData |
| | | const data = xGrid.value.getTableData().fullData |
| | | data.forEach(item => { |
| | | item.tempering = item.tempering === 1; |
| | | item.allow_rotate = item.allow_rotate === 1; |
| | | item.curtain_wall = item.curtain_wall === 1; |
| | | }) |
| | | xGrid.value.reloadData(data); |
| | | /*await nextTick(); |
| | | if (xGrid.value) { |
| | | const grid = xGrid.value; |
| | | if (typeof grid.refresh === 'function') { |
| | | grid.refresh(); |
| | | } |
| | | |
| | | |
| | | // 提取所有唯一的process_id |
| | | const processIds = Array.from(new Set(newData.map(item => item.process_id))); |
| | | |
| | | /!*const requests = newData.map(item => |
| | | request.post(`/glassOptimize/selectComputeDetail/${item.process_id}/${item.technologyNumber}/${item.patchState}`) |
| | | );*!/ |
| | | |
| | | /!*try { |
| | | const responses = await Promise.all(requests); |
| | | |
| | | // 整合数据 |
| | | const processData = responses.reduce((acc, res, index) => { |
| | | const processId = processIds[index]; |
| | | |
| | | // 检查res.data是否为对象,并且包含'data'字段 |
| | | if (typeof res.data === 'object' && res.data !== null && 'data' in res.data) { |
| | | const data = res.data.data; |
| | | |
| | | // 检查data是否为数组 |
| | | if (!Array.isArray(data)) { |
| | | console.error(`响应数据中的'data'字段不是数组,process_id: ${processId}`); |
| | | return acc; |
| | | } |
| | | |
| | | // 获取对应process_id的newData条目 |
| | | const relatedNewData = newData.filter(item => item.process_id === processId); |
| | | |
| | | // 初始化process_card对象 |
| | | const processCard = { |
| | | process_no: processId, |
| | | layers: relatedNewData.technology_number, |
| | | total_layers: relatedNewData.TotalNumber, |
| | | total_num: relatedNewData.quantity, |
| | | total_area: relatedNewData.area, |
| | | is_must: true, |
| | | allow_rotate: relatedNewData.check === 1 ? true : false, |
| | | priority_level: 0, |
| | | tempering: relatedNewData.check === 2 ? true : false, |
| | | curtain_wall: relatedNewData.check === 3 ? true : false, |
| | | patch_state: 0, |
| | | merge: 0, |
| | | glass_details: [] |
| | | }; |
| | | |
| | | |
| | | // 整合glass_details |
| | | data.forEach(detail => { |
| | | const matchedNewData = relatedNewData.find( |
| | | item => item.technology_number === detail.technology_number |
| | | ); |
| | | |
| | | processCard.glass_details.push({ |
| | | process_id: processId, |
| | | technology_number: detail.technology_number, |
| | | order_number: detail.order_number, |
| | | layers_number: detail.layers_number, |
| | | max_width: detail.width, |
| | | max_height: detail.height, |
| | | child_width: detail.child_width, |
| | | child_height: detail.child_height, |
| | | quantity: matchedNewData ? matchedNewData.quantity : 0, |
| | | patch_state: 0 |
| | | }); |
| | | }); |
| | | |
| | | // 将processCard添加到acc中 |
| | | if (!acc.process_cards) { |
| | | acc.process_cards = []; |
| | | } |
| | | acc.process_cards.push(processCard); |
| | | // 设置其他字段的值 |
| | | |
| | | } else { |
| | | console.error(`响应数据格式不正确,process_id: ${processId}`); |
| | | } |
| | | return acc; |
| | | }, {}); |
| | | if (newData.length > 0) { |
| | | // 假设所有条目的thickness和glassType相同 |
| | | processData.glass_thickness = newData[0].thickness; |
| | | processData.glass_type = newData[0].glassType; |
| | | } else { |
| | | processData.glass_thickness = ""; |
| | | processData.glass_type = ""; |
| | | } |
| | | |
| | | |
| | | |
| | | // 发送整合后的数据到父组件 |
| | | emit('sendData', processData); |
| | | } catch (error) { |
| | | console.error('请求失败:', error); |
| | | }*!/ |
| | | }*/ |
| | | } else { |
| | | console.error('传递给表格的数据格式不符合要求,期望是数组格式'); |
| | | } |
| | | }); |
| | | |
| | |
| | | cellClick({row}) { |
| | | rowClickIndex.value = row |
| | | // Emit 事件将更新后的值传递给父组件 |
| | | emit('upProcessId', rowClickIndex.value.process_id,rowClickIndex.value.patch_state,rowClickIndex.value.technology_number); |
| | | emit('updateTechnologyNumber', rowClickIndex.value.process_id,rowClickIndex.value.patch_state,rowClickIndex.value.technology_number); |
| | | emit('upProcessId', rowClickIndex.value.processId,rowClickIndex.value.patch_state,rowClickIndex.value.technologyNumber); |
| | | emit('updateTechnologyNumber', rowClickIndex.value.processId,rowClickIndex.value.patch_state,rowClickIndex.value.technologyNumber); |
| | | } |
| | | } |
| | | |
| | |
| | | ref="xGrid" |
| | | v-bind="gridOptions" |
| | | v-on="gridEvents" |
| | | @checkbox-change="handleCheckChange" |
| | | > |
| | | <template #num2_filter="{ column, $panel }"> |
| | | <div> |
| | |
| | | </div> |
| | | </template> |
| | | |
| | | <template #state="{ row,column}"> |
| | | <template #state1="{ row,column}"> |
| | | <el-checkbox |
| | | v-if="row[column.field] === 1" |
| | | :checked="true"/> |
| | | v-model="row.curtain_wall"/> |
| | | </template> |
| | | <template #state2="{ row,column}"> |
| | | <el-checkbox |
| | | v-else |
| | | :checked="false"/> |
| | | v-model="row.allow_rotate"/> |
| | | </template> |
| | | <template #state3="{ row,column}"> |
| | | <el-checkbox |
| | | v-model="row.tempering"/> |
| | | </template> |
| | | </vxe-grid> |
| | | </div> |
| | |
| | | |
| | | <select id="getFootSum"> |
| | | SELECT |
| | | ifnull(SUM(this_completed_quantity),0) AS thisCompletedQuantity, |
| | | ifnull(SUM(ROUND(child_width * child_height * this_completed_quantity / 1000000, 2)),0) AS completedArea, |
| | | ifnull(SUM(this_worn_quantity),0) AS thisWornQuantity, |
| | | ifnull(SUM(ROUND(child_width * child_height * this_worn_quantity / 1000000, 2)),0) AS wornArea |
| | | FROM ( |
| | | -- 先对 reporting_work_id 进行去重 |
| | | SELECT |
| | | rw.reporting_work_id, |
| | | MAX(rw.this_completed_quantity) AS this_completed_quantity, |
| | | MAX(rw.this_worn_quantity) AS this_worn_quantity, |
| | | MAX(ogd.child_width) AS child_width, |
| | | MAX(ogd.child_height) AS child_height |
| | | FROM reporting_work as rw left join reporting_work_detail as rwd on rw.reporting_work_id=rwd.reporting_work_id |
| | | left join sd.order_glass_detail as ogd on ogd.order_id=rw.order_id and ogd.order_number=rwd.order_number and ogd.technology_number=rwd.technology_number |
| | | left join sd.`order` as o on o.order_id=rw.order_id |
| | | WHERE rw.reviewed_state != 2 |
| | | and rw.reporting_work_time >= #{selectTime1} |
| | | AND rw.reporting_work_time < #{selectTime2} |
| | | and position(#{orderId} in rw.order_id) |
| | | AND rw.reviewed_state != -1 |
| | | AND o.create_order > 0 |
| | | SUM(rw.this_completed_quantity) AS thisCompletedQuantity, |
| | | ROUND(SUM(ogd.child_width * ogd.child_height * rw.this_completed_quantity / 1000000), 2) AS completedArea, |
| | | SUM(rw.this_worn_quantity) AS thisWornQuantity, |
| | | ROUND(SUM(ogd.child_width * ogd.child_height * rw.this_worn_quantity / 1000000), 2) AS wornArea |
| | | FROM reporting_work AS rw |
| | | LEFT JOIN reporting_work_detail AS rwd ON rw.reporting_work_id = rwd.reporting_work_id |
| | | LEFT JOIN sd.order_glass_detail AS ogd ON ogd.order_id = rw.order_id |
| | | AND ogd.order_number = rwd.order_number |
| | | AND ogd.technology_number = rwd.technology_number |
| | | LEFT JOIN sd.`order` AS o ON o.order_id = rw.order_id |
| | | WHERE rw.reviewed_state != 2 |
| | | and rw.reporting_work_time >= #{selectTime1} |
| | | AND rw.reporting_work_time < #{selectTime2} |
| | | AND position(#{orderId} in rw.order_id) |
| | | AND rw.reviewed_state != -1 |
| | | AND o.create_order > 0 |
| | | <if test="reportingWork.reportingWorkId != null and reportingWork.reportingWorkId != ''"> |
| | | and rw.reporting_work_id regexp #{reportingWork.reportingWorkId} |
| | | </if> |
| | |
| | | <if test="reportingWork.teamsGroupsName != null and reportingWork.teamsGroupsName != ''"> |
| | | and rw.teams_groups_name regexp #{reportingWork.teamsGroupsName} |
| | | </if> |
| | | GROUP BY rw.reporting_work_id -- 按 reporting_work_id 进行分组,确保唯一 |
| | | |
| | | ) AS subquery; |
| | | |
| | | </select> |
| | | |