廖井涛
2025-08-01 a93f0e3923cd9e74f4b86a6e8f8f13b0163dcf38
Merge branch 'master' of http://10.153.19.25:10101/r/ERP_override
5个文件已修改
136 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/GlassComputed.vue 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/Compute.vue 103 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/RectRenderer.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimizeThirdParty/GlassComputed.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/GlassComputed.vue
@@ -58,7 +58,7 @@
// 用于存储从后端获取到的数据,初始化为空数组
const receivedData = ref([]);
const emit = defineEmits(['update:project']);
const fetchProjectInfo = async (projectNumber) => {
  try {
    const res = await request.post(`/glassOptimize/getProjectByProjectNo/${projectNumber}`);
@@ -67,10 +67,21 @@
    if (Number(res.code) === 200 && res.data && res.data.data && res.data.data.length > 0) {
      // 正确访问嵌套的数据结构
      const projectData = res.data.data[0]; // 注意这里是 res.data.data[0]
      const updatedProject = {
        ...props.project,
        glass_thickness: projectData.glass_thickness || '',
        glass_type: projectData.glass_type || ''
      };
      console.log('获取到的glass_thickness:', projectData.glass_thickness);
      console.log('获取到的glass_type:', projectData.glass_type);
      // // 通过 emit 更新 project
      emit('update:project', updatedProject);
      // 更新 computed.value
      computed.value = {
        ...computed.value,
        glass_thickness: projectData.glass_thickness,
        glass_type: projectData.glass_type
      };
      // 确保computed.value已初始化
      if (!computed.value) {
        computed.value = {};
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/Compute.vue
@@ -80,8 +80,8 @@
        spacingLong.value=parsedData.tempering.yAxisInterval;
        heatingTime.value=parsedData.tempering.temperingTime;
      }
    } else {
      console.error('请求失败,状态码:', response.code);
    }
@@ -145,6 +145,12 @@
  await firstLoading()
})
onMounted(async () => {
  if (props.project && props.project.projectNumber) {
    await fetchProjectData(props.project.projectNumber);
  }
});
const firstLoading = async() => {
    request.post(`/glassOptimize/selectOptimizeParms/${username}`).then((res) => {
      if (res.code == "200") {
@@ -182,7 +188,11 @@
  }
})
const inputValues = {
// let emit = defineEmits(['fetch-data']);
const emit = defineEmits(['fetch-data', 'sendData', 'simulate-click']);
const inputValues =  reactive({
  project_no:inputValue.value,
  glass_thickness:"",
  glass_type:"",
@@ -202,30 +212,85 @@
  rotate_mode:0,
  polys_allow_rotate: 0,
  process_cards:[]
});
const fetchProjectData = async (projectNumber) => {
  try {
    const res = await request.post(`/glassOptimize/getProjectByProjectNo/${projectNumber}`);
    if (Number(res.code) === 200 && res.data && res.data.data && res.data.data.length > 0) {
      const projectData = res.data.data[0];
      // 更新 inputValues
      inputValues.glass_thickness = projectData.glass_thickness || '';
      inputValues.glass_type = projectData.glass_type || '';
      console.log('更新后的 inputValues:', inputValues);
    } else {
      ElMessage.warning('未找到项目信息或数据格式不正确');
    }
  } catch (error) {
    console.error('请求失败:', error);
    ElMessage.error('获取项目信息失败');
  }
};
// let emit = defineEmits(['fetch-data']);
let emit = defineEmits(['fetch-data', 'sendData'])
const handleSearchClick = () => {
  // 通过 $emit 触发自定义事件,将工程号传递给父组件,由父组件去调用接口获取数据
  emit('fetch-data', inputValue.value);
  const projectNumber = inputValue.value;
  if (!projectNumber) {
    ElMessage.warning('请输入工程号');
    return;
  }
  // 通知父组件更新(可选)
  emit('fetch-data', projectNumber);
  // 子组件自己调用接口更新数据
  fetchProjectData(projectNumber);
};
const handleSimulationClick = () => {
  inputValues.project_no = inputValue.value;
  inputValues.chaos_pct = optionVal.value * 0.01; // 混排等级
  inputValues.cage_free = percentage2.value * 0.01; // 理片龙空闲度
  inputValues.heat_mode = 0; // 模式选择(默认值)
  inputValues.max_load_pct = percentage1.value * 0.01; // 最大装载率
  inputValues.max_area = 0; // 最大面积(默认值)
  inputValues.max_qty = 0; // 最大片数(默认值)
  inputValues.load_width = furnaceWidth.value;
  inputValues.load_length = furnaceLength.value;
  inputValues.x_space = spacingWidth.value;
  inputValues.y_space = spacingLong.value;
  inputValues.polys_allow_rotate = parseInt(rotateMode.value.value);
  inputValues.tempering_time = heatingTime.value || inputValues.tempering_time || 0;
  const sendData = {
    project_no: inputValues.project_no,
    glass_thickness: inputValues.glass_thickness,
    glass_type: inputValues.glass_type,
    chaos_pct: inputValues.chaos_pct, // 混排等级
    cage_free: inputValues.cage_free, // 理片龙空闲度
    tempering_time: inputValues.tempering_time,
    heat_mode: inputValues.heat_mode, // 模式选择
    max_load_pct: inputValues.max_load_pct, // 最大装载率
    max_area: inputValues.max_area, // 最大面积
    max_qty: inputValues.max_qty, // 最大片数
    load_width: inputValues.load_width,
    load_length: inputValues.load_length,
    x_space: inputValues.x_space,
    y_space: inputValues.y_space,
    load_rate: inputValues.load_rate, // 装载率(可能为空)
    furnaces_qty: inputValues.furnaces_qty, // 炉子数量(可能为空)
    rotate_mode: inputValues.rotate_mode, // 钢化旋转模式(可能为空)
    polys_allow_rotate: inputValues.polys_allow_rotate,
    process_cards: inputValues.process_cards || [] // 流程卡列表(默认空数组)
  };
  emit('sendData', sendData);
      inputValues.project_no = inputValue.value;
      inputValues.glass_thickness =  props.project.glass_thickness ;
      inputValues.glass_type = props.project.glass_type;
      inputValues.tempering_time = heatingTime.value || inputValues.tempering_time || 0;
      inputValues.load_width = furnaceWidth.value
      inputValues.load_length = furnaceLength.value
      inputValues.x_space = spacingWidth.value
      inputValues.y_space = spacingLong.value
      inputValues.polys_allow_rotate = parseInt(rotateMode.value.value)
  emit('sendData', {
    ...inputValues
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
@@ -266,7 +266,7 @@
  return {
    position: 'absolute',
    left: `${layout.leftTrim * scale}px`,
    top: `${layout.upTrim * scale}px`,
    bottom: `${layout.upTrim * scale}px`,
    width: `${layout.width * scale}px`,
    height: `${layout.height * scale}px`,
    overflow: 'visible',
@@ -314,7 +314,7 @@
  return {
    position: 'absolute',
    left: `${glassDetail.x * scale}px`,
    bottom: `${glassDetail.y * scale}px`,
    top: `${glassDetail.y * scale}px`,
    width: `${glassDetail.width * scale}px`,
    height: `${glassDetail.height * scale}px`,
    backgroundColor: glassDetail.isRemain ? '#f0f0f0' : themeColor.value,
@@ -632,7 +632,7 @@
    if (Math.abs(glassDetail.y - otherRect.y) < threshold) {
      glassDetail.y = Math.round((glassDetail.y + otherRect.y) / 2);
    }
    // 垂直对齐下边缘
    // 垂直对齐上边缘
    if (Math.abs((glassDetail.y + glassDetail.height) - (otherRect.y + otherRect.height)) < threshold) {
      glassDetail.y = Math.round((otherRect.y + otherRect.height - glassDetail.height));
    }
@@ -962,7 +962,7 @@
//向上移动计算坐标
const getAvailableSpaceUp = (glassDetail, layout, obstacles) => {
  let maxSpace = layout.height - (glassDetail.y + glassDetail.height);
  let maxSpace = layout.height - glassDetail.y - glassDetail.height;
  obstacles.forEach(obstacle => {
    if (obstacle.y > glassDetail.y + glassDetail.height &&
        obstacle.x <= glassDetail.x + glassDetail.width &&
@@ -1028,7 +1028,7 @@
      event.preventDefault();
      if (!moveInterval) {
        moveInterval = setInterval(() => {
          moveRect(layoutIndex, rectIndex, 'up');
          moveRect(layoutIndex, rectIndex, 'down');
        }, 50);
      }
      break;
@@ -1036,7 +1036,7 @@
      event.preventDefault();
      if (!moveInterval) {
        moveInterval = setInterval(() => {
          moveRect(layoutIndex, rectIndex, 'down');
          moveRect(layoutIndex, rectIndex, 'up');
        }, 50);
      }
      break;
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/RectRenderer.vue
@@ -197,7 +197,7 @@
  return {
    position: 'absolute',
    left: `${glassDetail.x * scale}px`,
    bottom: `${glassDetail.y * scale}px`,
    top: `${glassDetail.y * scale}px`,
    width: `${glassDetail.width * scale}px`,
    height: `${glassDetail.height * scale}px`,
    backgroundColor: glassDetail.isRemain ? '#f0f0f0' : '#a0d8ef',
north-glass-erp/northglass-erp/src/views/pp/glassOptimizeThirdParty/GlassComputed.vue
@@ -219,7 +219,7 @@
    };
    if (mockData.code === 200) {
    loading.close();
    ElMessage.success('模拟计算成功!');
    // ElMessage.success('模拟计算成功!');
    }
    // 更新computedData
    computedData.value = mockData;