chenlu
2025-08-05 69ce239949e32dd40ded422ea72987b4a9751add
Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override
8个文件已修改
275 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/components/sd/order/OrderProcess.vue 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/OptimizationRectPrint.vue 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/OptimizeControl.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ProjectDetail.vue 195 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/order/SelectOrder.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/pp/GlassOptimizeService.java 36 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/components/sd/order/OrderProcess.vue
@@ -35,11 +35,11 @@
  },
  columns:[
  ],
  mergeCells:[],
  toolbarConfig: {
    slots:{
      buttons: "title"
    },
    zoom: true,
    // custom: true
  },
@@ -66,7 +66,8 @@
const list = ref([])
let props = defineProps({
  orderId:null
  orderId:null,
  row: {}
})
const columns = [
  {field: 'order_number',fixed:"left", width: 90,title: t('order.OrderNum'),showOverflow:"ellipsis"},
@@ -174,12 +175,17 @@
      +')' )
  //return
}
let showTitle = ref(false)
const changeZoom = ()=> {
  showTitle.value = !showTitle.value
}
</script>
<template>
  <div style="width: 100%;height: 100%">
    <vxe-grid
        @filter-change ='filterChange'
        @zoom="changeZoom"
        height="100%"
        size="mini"
        class="mytable-scrollbar"
@@ -202,6 +208,15 @@
        <span>{{ quantitySum(row,column) }} </span>
      </template>
      <template #title>
        <span style="font-weight: bold" v-show="showTitle">
          {{ row.orderId }}
          {{ row.project?'--':'' }}
          {{row.project}}
          {{ row.batch?'--':'' }}
          {{row.batch}}
        </span>
      </template>
    </vxe-grid>
  </div>
</template>
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/OptimizationRectPrint.vue
@@ -1,6 +1,8 @@
<template>
  <div>
    <el-button id="button" type="primary" @click="handlePrint">打印</el-button>
    <el-button id="button" type="primary" @click="handlePrint" style="position: fixed; top: 90px; right: 20px; padding: 20px; background: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer;">
      打印
    </el-button>
    
    <div ref="printContainer" style="position: relative;">
      <RectRenderer 
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/OptimizeControl.vue
@@ -11,7 +11,7 @@
  
  
    </div>
    <button @click="submitLayouts" style="position: fixed; bottom: 20px; right: 20px; padding: 10px; background: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer;">
    <button @click="submitLayouts" style="position: fixed; top: 90px; right: 20px; padding: 10px; background: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer;">
      保存OPT
    </button>
  </template>
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
@@ -72,7 +72,7 @@
    </div>
    <!-- 提交按钮 -->
    <button @click="submitLayouts" style="position: fixed; bottom: 20px; right: 20px; padding: 10px; background: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer;">
    <button @click="submitLayouts" style="position: fixed; top: 90px; right: 20px; padding: 10px; background: #4CAF50; color: white; border: none; border-radius: 5px; cursor: pointer;">
      保存调整
    </button>
  </div>
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/ProjectDetail.vue
@@ -458,6 +458,7 @@
      return;
    }
    emit('getSmallPieceData', 1);
    optimizeData.value.glassDetails = [];
    xGrid.value.getTableData().fullData.forEach(items=>{
      let rackNoValue = 0;
      if (items.rackNo !== undefined && items.rackNo !== null && items.rackNo !== '') {
@@ -524,6 +525,7 @@
        dialogVisible.value[3] = newValue;
      }
      if (props.CheckboxChangeData!=null && props.CheckboxChangeData.length>0){
        optimizeData.value.materialDetails = [];
        props.CheckboxChangeData.forEach(items=>{
          const detail={
            width :null,
@@ -601,99 +603,81 @@
      const grindingTrimming = res.data.grindingTrimming;
      optimizeState.value=res.data.optimizeState;
      // 加载磨量配置
      loadGrindingConfiguration().then((grindConfig) => {
        console.log("加载的磨量配置:", grindConfig);
        data = data.map(item => {
          // 保留从后端返回的原始磨量值,如果存在的话
          const originalLongGrind1 = item.longGrind1;
          const originalLongGrind2 = item.longGrind2;
          const originalShortGrind1 = item.shortGrind1;
          const originalShortGrind2 = item.shortGrind2;
          // 如果没有原始磨量值,则初始化为0
          item.longGrind1 = originalLongGrind1 !== undefined && originalLongGrind1 !== null ?
              parseFloat(originalLongGrind1) : 0;
          item.longGrind2 = originalLongGrind2 !== undefined && originalLongGrind2 !== null ?
              parseFloat(originalLongGrind2) : 0;
          item.shortGrind1 = originalShortGrind1 !== undefined && originalShortGrind1 !== null ?
              parseFloat(originalShortGrind1) : 0;
          item.shortGrind2 = originalShortGrind2 !== undefined && originalShortGrind2 !== null ?
              parseFloat(originalShortGrind2) : 0;
          // 处理 grindingTrimming 数据(如果存在)
          if(grindingTrimming!==null && grindingTrimming.length > 0){
            const formattedData = grindingTrimming.map(item => {
              const formattedItem = {};
              for (const key in item) {
                if (typeof item[key] === 'string') {
                  //去除字符串属性值开头和结尾的双引号
                  formattedItem[key] = item[key].replace(/^\"|\"$/g, '');
                } else {
                  formattedItem[key] = item[key];
                }
              }
              return formattedItem;
            });
            // 如果有自动填充配置,使用它来设置磨量
            if(formattedData[0].autoFillEdge==="true"){
              const minAutoLenght = parseFloat(formattedData[0].minAutoLenght) || 0;
              const leftEdge = parseFloat(formattedData[0].leftEdge) || 0;
              const rightEdge = parseFloat(formattedData[0].rightEdge) || 0;
              const upEdge = parseFloat(formattedData[0].upEdge) || 0;
              const downEdge = parseFloat(formattedData[0].downEdge) || 0;
              if(item.width >= minAutoLenght){
                item.longGrind1 = leftEdge;
                item.longGrind2 = rightEdge;
              }
              if(item.height >= minAutoLenght){
                item.shortGrind1 = upEdge;
                item.shortGrind2 = downEdge;
              }
            }
          } else if(grindConfig) {
            // 使用从 getConfiguration 接口加载的配置
            if(grindConfig.autoFillEdge==="true"){
              const minAutoLenght = parseFloat(grindConfig.minAutoLenght) || 0;
              const leftEdge = parseFloat(grindConfig.leftEdge) || 0;
              const rightEdge = parseFloat(grindConfig.rightEdge) || 0;
              const upEdge = parseFloat(grindConfig.upEdge) || 0;
              const downEdge = parseFloat(grindConfig.downEdge) || 0;
              if(item.width >= minAutoLenght){
                item.longGrind1 = leftEdge;
                item.longGrind2 = rightEdge;
              }
              if(item.height >= minAutoLenght){
                item.shortGrind1 = upEdge;
                item.shortGrind2 = downEdge;
              }
            }else {
              // 即使没有启用自动填充,也应该应用默认的磨量值
              item.longGrind1 = parseFloat(grindConfig.leftEdge) || 0;
              item.longGrind2 = parseFloat(grindConfig.rightEdge) || 0;
              item.shortGrind1 = parseFloat(grindConfig.upEdge) || 0;
              item.shortGrind2 = parseFloat(grindConfig.downEdge) || 0;
      // 处理 grindingTrimming 数据(如果存在)
      let processedGrindConfig = null;
      if(grindingTrimming!==null && grindingTrimming.length > 0){
        // 处理 grindingTrimming 数据,去除双引号
        const formattedData = grindingTrimming.map(item => {
          const formattedItem = {};
          for (const key in item) {
            if (typeof item[key] === 'string') {
              //去除字符串属性值开头和结尾的双引号
              formattedItem[key] = item[key].replace(/^\"|\"$/g, '');
            } else {
              formattedItem[key] = item[key];
            }
          }
          item.height=parseFloat(item.height.toFixed(2))
          item.width=parseFloat(item.width.toFixed(2))
          return item;
          return formattedItem;
        });
        processedGrindConfig = formattedData[0];
      }
        console.log("处理后的数据:", data);
      data = data.map(item => {
        // 直接将 grindingTrimming 中的磨量信息写到表中
        if (processedGrindConfig) {
          // 使用 grindingTrimming 中的配置设置磨量
          const leftEdge = parseFloat(processedGrindConfig.leftEdge) || 0;
          const rightEdge = parseFloat(processedGrindConfig.rightEdge) || 0;
          const upEdge = parseFloat(processedGrindConfig.upEdge) || 0;
          const downEdge = parseFloat(processedGrindConfig.downEdge) || 0;
        xGrid.value.loadData(data);
        gridOptions.data = data;
        projectName.value = data[0].project_name;
        quantitys.value=res.data.project.glass_total
        areas.value=res.data.project.glass_total_area
          item.longGrind1 = leftEdge;   // 长磨1
          item.longGrind2 = rightEdge;  // 长磨2
          item.shortGrind1 = upEdge;    // 短磨1
          item.shortGrind2 = downEdge;  // 短磨2
          // 如果启用了自动填充功能,根据尺寸判断是否应用磨量
          if(processedGrindConfig.autoFillEdge === "true"){
            const minAutoLength = parseFloat(processedGrindConfig.minAutoLenght) || 0;
            // 如果宽度小于最小自动长度,不应用左右磨量
            if(item.width < minAutoLength){
              item.longGrind1 = 0;
              item.longGrind2 = 0;
            }
            // 如果高度小于最小自动长度,不应用上下磨量
            if(item.height < minAutoLength){
              item.shortGrind1 = 0;
              item.shortGrind2 = 0;
            }
          }
        } else {
          // 如果没有 grindingTrimming 数据,初始化为0
          item.longGrind1 = item.longGrind1 !== undefined && item.longGrind1 !== null ?
              parseFloat(item.longGrind1) : 0;
          item.longGrind2 = item.longGrind2 !== undefined && item.longGrind2 !== null ?
              parseFloat(item.longGrind2) : 0;
          item.shortGrind1 = item.shortGrind1 !== undefined && item.shortGrind1 !== null ?
              parseFloat(item.shortGrind1) : 0;
          item.shortGrind2 = item.shortGrind2 !== undefined && item.shortGrind2 !== null ?
              parseFloat(item.shortGrind2) : 0;
        }
        item.height=parseFloat(item.height.toFixed(2))
        item.width=parseFloat(item.width.toFixed(2))
        return item;
      });
      xGrid.value.loadData(data);
      gridOptions.data = data;
      projectName.value = data[0].project_name;
      quantitys.value=res.data.project.glass_total
      areas.value=res.data.project.glass_total_area
      // 更新 optimizeData 中的磨量配置
      updateOptimizeDataWithGrindingConfig(processedGrindConfig);
    } else {
      ElMessage.warning(res.msg);
    }
@@ -702,6 +686,19 @@
  });
};
const updateOptimizeDataWithGrindingConfig = (grindConfig) => {
  if (grindConfig) {
    // 更新 optimizeData 中的磨量配置
    optimizeData.value.grindingConfig = {
      leftEdge: parseFloat(grindConfig.leftEdge) || 0,
      upEdge: parseFloat(grindConfig.upEdge) || 0,
      rightEdge: parseFloat(grindConfig.rightEdge) || 0,
      downEdge: parseFloat(grindConfig.downEdge) || 0,
      autoFillEdge: grindConfig.autoFillEdge === "true",
      minAutoLength: parseFloat(grindConfig.minAutoLenght) || 0
    };
  }
};
const firstLoading = async() => {
  request.post(`/glassOptimize/selectOptimizeParms/${username}`).then((res) => {
@@ -798,6 +795,7 @@
  });*/
};
const grindingConfig = ref(null);
const loadGrindingConfiguration = async () => {
  return new Promise((resolve) => {
@@ -817,10 +815,11 @@
            }
            return formattedItem;
          });
          // 保存磨量配置
          grindingConfig.value = formattedData[0];
          resolve(formattedData[0]);
        } else {
          // 提供默认配置
          resolve({
          const defaultConfig = {
            leftEdge: '0',
            upEdge: '0',
            rightEdge: '0',
@@ -828,12 +827,13 @@
            quickEdge: '1',
            autoFillEdge: 'false',
            minAutoLenght: '0'
          });
          };
          grindingConfig.value = defaultConfig;
          resolve(defaultConfig);
        }
      } else {
        ElMessage.warning(res.msg);
        // 提供默认配置
        resolve({
        const defaultConfig = {
          leftEdge: '0',
          upEdge: '0',
          rightEdge: '0',
@@ -841,11 +841,12 @@
          quickEdge: '1',
          autoFillEdge: 'false',
          minAutoLenght: '0'
        });
        };
        grindingConfig.value = defaultConfig;
        resolve(defaultConfig);
      }
    }).catch(() => {
      // 提供默认配置
      resolve({
      const defaultConfig = {
        leftEdge: '0',
        upEdge: '0',
        rightEdge: '0',
@@ -853,7 +854,9 @@
        quickEdge: '1',
        autoFillEdge: 'false',
        minAutoLenght: '0'
      });
      };
      grindingConfig.value = defaultConfig;
      resolve(defaultConfig);
    });
  });
};
north-glass-erp/northglass-erp/src/views/sd/order/SelectOrder.vue
@@ -750,6 +750,7 @@
          <order-process
              v-if="tabsValue==='3'"
              :orderId="rowClickIndex===null?null:rowClickIndex.orderId"
              :row="rowClickIndex===null?{}:rowClickIndex"
          />
        </el-tab-pane>
      </el-tabs>
north-glass-erp/src/main/java/com/example/erp/service/pp/GlassOptimizeService.java
@@ -312,22 +312,26 @@
    public Map<String, Object> projectInfoSv(String projectNo,String username) {
        Map<String, Object> stringObjectMap = glassOptimizeMapper.selectProjectCount(projectNo);
        Map<String, Object> map = new HashMap<>();
        if(Integer.parseInt(stringObjectMap.get("optimize_state").toString())==1){
            map.put("optimizeState", Integer.parseInt(stringObjectMap.get("optimize_state").toString()));
            map.put("data", glassOptimizeMapper.getOptimizeDetail(projectNo));
            map.put("project", glassOptimizeMapper.selectProjectCount(projectNo));
            map.put("grindingTrimming", null);
        } else if (Integer.parseInt(stringObjectMap.get("tempering_state").toString())==1) {
            map.put("optimizeState", Integer.parseInt(stringObjectMap.get("optimize_state").toString()));
            map.put("data", glassOptimizeMapper.analogComputationOptimization(projectNo));
            map.put("project", glassOptimizeMapper.selectProjectCount(projectNo));
            map.put("grindingTrimming", glassOptimizeMapper.getGrindingTrimming(username));
        } else{
            map.put("optimizeState", Integer.parseInt(stringObjectMap.get("optimize_state").toString()));
            map.put("data", glassOptimizeMapper.firstOptimization(projectNo));
            map.put("project", glassOptimizeMapper.selectProjectCount(projectNo));
            map.put("grindingTrimming", glassOptimizeMapper.getGrindingTrimming(username));
        }
//        if(Integer.parseInt(stringObjectMap.get("optimize_state").toString())==1){
//            map.put("optimizeState", Integer.parseInt(stringObjectMap.get("optimize_state").toString()));
//            map.put("data", glassOptimizeMapper.getOptimizeDetail(projectNo));
//            map.put("project", glassOptimizeMapper.selectProjectCount(projectNo));
//            map.put("grindingTrimming", null);
//        } else if (Integer.parseInt(stringObjectMap.get("tempering_state").toString())==1) {
//            map.put("optimizeState", Integer.parseInt(stringObjectMap.get("optimize_state").toString()));
//            map.put("data", glassOptimizeMapper.analogComputationOptimization(projectNo));
//            map.put("project", glassOptimizeMapper.selectProjectCount(projectNo));
//            map.put("grindingTrimming", glassOptimizeMapper.getGrindingTrimming(username));
//        } else{
//            map.put("optimizeState", Integer.parseInt(stringObjectMap.get("optimize_state").toString()));
//            map.put("data", glassOptimizeMapper.firstOptimization(projectNo));
//            map.put("project", glassOptimizeMapper.selectProjectCount(projectNo));
//            map.put("grindingTrimming", glassOptimizeMapper.getGrindingTrimming(username));
//        }
        map.put("optimizeState", Integer.parseInt(stringObjectMap.get("optimize_state").toString()));
        map.put("data", glassOptimizeMapper.firstOptimization(projectNo));
        map.put("project", glassOptimizeMapper.selectProjectCount(projectNo));
        map.put("grindingTrimming", glassOptimizeMapper.getGrindingTrimming(username));
        return map;
    }
north-glass-erp/src/main/resources/mapper/pp/GlassOptimize.xml
@@ -243,7 +243,7 @@
    <select id="getOptimizeDetail">
        SELECT
            h.project_no,
            h.heat_layout_id as rackNo,
            h.rack_no as rackNo,
            h.o_width AS width,
            h.o_height AS height,
            (h.height-h.o_height)/2 as shortGrind1,
@@ -280,14 +280,14 @@
            h.project_no =#{projectNo}
        GROUP BY
            h.project_no,
            h.heat_layout_id,
            h.rack_no,
            h.width,
            h.height,
            h.process_id,
            h.layer,
            c.order_number
        ORDER BY
            h.heat_layout_id;
            h.rack_no;
    </select>
    <!--工程信息流程卡-->
@@ -1118,7 +1118,8 @@
            x_axis,
            y_axis,
            patch_state,
            mark_icon
            mark_icon,
            rack_no
            ) VALUES (
            #{projectId},
            #{glass.processId},
@@ -1134,7 +1135,8 @@
            #{glass.x},
            #{glass.y},
            #{glass.patchState},
            #{glass.markIcon}
            #{glass.markIcon},
            #{glass.rackNo}
            );
        </foreach>
    </insert>