chenlu
2025-08-28 c754cdc85ec5b551f8b5c911a7b5730286388c6a
Merge branch 'master' of http://10.153.19.25:10105/r/ERP_override
8个文件已修改
1个文件已添加
180 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/hook/createTemplateTag.js 103 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/mm/basicData/WarehouseSearchBasicData.vue 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/sd/glassPrice/ProducePriceCompute.vue 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/mm/BasicWarehouseTypeController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/mm/BasicWarehouseTypeMapper.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/mm/BasicWarehouseTypeService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/sd/GlassPriceBasicService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/mm/BasicWarehouseType.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/hook/createTemplateTag.js
New file
@@ -0,0 +1,103 @@
function createTemplate(hiprintTemplateMap,dataList,pageWidth,pageHeight){
    // A4纸张大小
    const { height, width } = {
        width: pageWidth,
        height: pageHeight
    }
// 70:小模板的高 105:小模板的宽
// 垂直方向, 可以容纳多少个模板
    const ver = parseInt(height / hiprintTemplateMap.panels[0].height);
// 水平方向, 可以容纳多少个模板
    const hor = parseInt(width / hiprintTemplateMap.panels[0].width);
// 新的模板,宽高单位是 mm
    let template = {
        panels: [
            {
                index: 0,
                width,
                height,
                // 我们实际需要打印的元素,都存放在这个数组里
                printElements: [],
            },
        ],
    }
// 记录整体个数
    let limitCount = 0;
// top: 记录 打印元素 top值(注意单位); 提示:相当于记录上次填充到哪儿了
    for (let v = 1, top = 0; v <= ver; v++) {
        // left: 记录 打印元素 left值
        for (let h = 1, left = 0; h <= hor; h++) {
            // 这里就需要获取到小模板内的所有打印元素了,然后更新它的定位
            // 为了更好理解, 我这里拆分来写
            // 获取 模板 的 打印元素
            let printElements1 = hiprintTemplateMap.panels[0].printElements;
            const printElements2 = printElements1.map((items) => {
                const item = JSON.parse(JSON.stringify(items))
                // 偏移量计算
                item.options.top += top
                item.options.left += left
                // !! 元素的字段名 肯定不能重复呀! 所以需要特殊处理!!!
                if (item.options.field) {
                    // 及变成 字段名 + 第 v 行 第 h 列
                    // 如: qrcode 变成 qrcode_1_1 (第 1 行 的 第 1 列)
                    item.options.field += `_${v}_${h}`
                }
                return item;
            })
            template.panels[0].printElements = template.panels[0].printElements.concat(printElements2)
            // 3.3. 计算 下一列 模板的 left 值 (单位转换)
            left += hinnn.mm.toPt(hiprintTemplateMap.panels[0].width)
            // 记录整体个数
            limitCount++
        }
        // 3.4 计算下一行 模板的 top 值 (单位转换)
        top += hinnn.mm.toPt(hiprintTemplateMap.panels[0].height)
    }
    //打印data生成
    let printData = []; // 清空数据
    const len = dataList.length;
    let keys = Object.keys(dataList[0]); // 这里假设 每个模板数据格式一样, 取对象的 key
// 需要多少个这样的面板(批量打印), 才能打印全部的数据
    let needPanel = Math.ceil(len / limitCount);
// curIndex:记录已经处理了多少数据
    for (let p = 0, curIndex = 0; p < needPanel; p++) {
        // 当前面板的打印数据
        const panelPrintData = {}
        for (let v = 1; v <= ver; v++) {
            for (let h = 1; h <= hor; h++) {
                // 数据已处理完
                if (curIndex >= len) {
                    break;
                }
                keys.forEach((key) => {
                    panelPrintData[`${key}_${v}_${h}`] = dataList[curIndex][key];
                });
                curIndex++;
            }
        }
        printData.push(panelPrintData);
    }
    return {
        template,
        printData
    }
}
export  {createTemplate}
north-glass-erp/northglass-erp/src/views/mm/basicData/WarehouseSearchBasicData.vue
@@ -107,7 +107,13 @@
  }
}
request.get('/BasicWarehouse/getBasicWarehouse').then(res => {
const options = ref({
      originalFilm: t('ingredients.originalFilm'),
      accessories: t('ingredients.accessories')
    })
request.post(`/BasicWarehouse/getBasicWarehouse`,options.value).then(res => {
  if(res.code==='200'){
    xGrid.value.reloadData(res.data)
  }
north-glass-erp/northglass-erp/src/views/pp/glassOptimize/page/OptimizationRect.vue
@@ -1,15 +1,15 @@
<template>
  <div style="display: flex; height: 90vh;">
    <!-- Sidebar -->
    <div class="sidebar" style="width: 200px; background: #f4f4f4; padding: 10px;">
    <div class="sidebar" style="width: 200px; background: #f4f4f4; padding: 10px; height: 93%; overflow-y: auto; max-height: 90vh; border-radius: 8px;">
      <div
        v-for="(layout, layoutIndex) in layouts"
        :key="layoutIndex"
        class="sidebar-item"
        @click="selectLayout(layoutIndex)"
        :class="{ 'selected': selectedLayoutIndex === layoutIndex }"
          v-for="(layout, layoutIndex) in layouts"
          :key="layoutIndex"
          class="sidebar-item"
          @click="selectLayout(layoutIndex)"
          :class="{ 'selected': selectedLayoutIndex === layoutIndex }"    style="margin-bottom: 5px;"
      >
        {{ layout.realWidth }} × {{ layout.realHeight }} × {{ layout.quantity  }}
        {{ layout.realWidth }} × {{ layout.realHeight }} × {{ layout.quantity }}
      </div>
    </div>
north-glass-erp/northglass-erp/src/views/sd/glassPrice/ProducePriceCompute.vue
@@ -7,6 +7,8 @@
import {ElMessage} from "element-plus";
import request from "@/utils/request";
import router from "@/router";
import {multiply,multiplyAuto,divideAuto} from '@/utils/decimal'
import footSum from "@/hook/footSum";
const { t } = useI18n()
let dialogVisible = ref(false)
const xGrid = ref()
@@ -20,11 +22,12 @@
  stripe:true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true,height: 30},//鼠标移动或选择高亮
  //virtualScroll: true, // 开启虚拟滚动功能
  id: 'CreateOrder123',
  id: 'producePriceCompute1',
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  showOverflow:true,
  showFooter: true,
  columnConfig: {
    resizable: true,
    useKey: true
@@ -58,6 +61,9 @@
    {field: 'width',  title: t('order.width') ,editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged},
    {field: 'height',  title: t('order.height'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged},
    {field: 'quantity', title: t('order.quantity'),editRender: { name: 'input'},filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged},
    {field: 'area', title: t('order.area'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged},
    {field: 'grossArea', title: t('order.grossArea'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged},
    {field: 'grossAmount', title: t('order.grossAmount'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, sortable: true,filterMethod:filterChanged},
  ],
@@ -70,6 +76,21 @@
    ],
    zoom: true,
    custom: true
  },
  //table body实际数据
  footerMethod ({ columns, data }) {//页脚函数
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return t('basicData.total')+':'
        }
        const List = ["quantity",'grossAmount','grossArea']
        if (List.includes(column.field)) {
          return footSum(data, column.field)
        }
        return ''
      })
    ]
  }
@@ -108,10 +129,25 @@
  request.post(`/glassPriceBasic/glassPriceComputed/${product.id}`).then(res => {
    if (res.code === '200' ) {
      data.price = res.data
      data.area = divideAuto(multiplyAuto(data.width,data.height,2),1000000,2)
      data.grossArea = multiplyAuto(data.area,data.quantity,2)
      data.grossAmount = multiplyAuto(data.price,data.grossArea,2)
      xGrid.value.insertAt(data)
      dialogVisible.value = false
    }
  })
}
const editClosedEvent = ({ row, column }) => {
  //判断修改相应的数值修改面积与金额
  if (['width', 'height', 'quantity', 'price'].includes(column.property)) {
    row.area = divideAuto(multiplyAuto(row.width,row.height,2),1000000,2)
    row.grossArea = multiplyAuto(row.area,row.quantity,2)
    row.grossAmount = multiplyAuto(row.price,row.grossArea,2)
  }
  xGrid.value.updateFooter()
}
</script>
@@ -124,6 +160,7 @@
        ref="xGrid"
        v-bind="gridOptions"
        v-on="gridEvents"
        @edit-closed="editClosedEvent"
    >
      <template #num1_filter="{ column, $panel }">
north-glass-erp/src/main/java/com/example/erp/controller/mm/BasicWarehouseTypeController.java
@@ -31,9 +31,9 @@
    @ApiOperation("基础数据查询")
    @SaCheckPermission("warehouseSearchBasicData.search")
    @GetMapping("/getBasicWarehouse")
    public Result getBasicWarehouse(){
        return Result.seccess(basicWarehouseTypeService.getBasicWarehouse());
    @PostMapping("/getBasicWarehouse")
    public Result getBasicWarehouse(@RequestBody Map<String,Object> map){
        return Result.seccess(basicWarehouseTypeService.getBasicWarehouse(map));
    }
    @ApiOperation("基础数据新增")
north-glass-erp/src/main/java/com/example/erp/mapper/mm/BasicWarehouseTypeMapper.java
@@ -20,7 +20,7 @@
    List<String> getBasicWarehouse(String type);
    List<BasicWarehouseType> getBasicWarehouseTypeAll();
    List<BasicWarehouseType> getBasicWarehouseTypeAll(String originalFilm,String accessories);
    Boolean insertBasicWarehouse(@Param("operateTypeName") String operateTypeName,
                                 @Param("operateType") String operateType,
north-glass-erp/src/main/java/com/example/erp/service/mm/BasicWarehouseTypeService.java
@@ -60,8 +60,8 @@
        return BasicDataMap;
    }
    public List<BasicWarehouseType> getBasicWarehouse() {
        return basicWarehouseTypeMapper.getBasicWarehouseTypeAll();
    public List<BasicWarehouseType> getBasicWarehouse(Map<String, Object> map) {
        return basicWarehouseTypeMapper.getBasicWarehouseTypeAll(map.get("originalFilm").toString(),map.get("accessories").toString());
    }
north-glass-erp/src/main/java/com/example/erp/service/sd/GlassPriceBasicService.java
@@ -83,7 +83,7 @@
                                new QueryWrapper<GlassPriceBasic>()
                                        .eq("name", name+s));
                        if(glassPriceBasic == null) {
                            return 0.0;
                            money[0] += 0.0;
                        }else{
                            money[0] += glassPriceBasic.getPrice();
                        }
north-glass-erp/src/main/resources/mapper/mm/BasicWarehouseType.xml
@@ -21,7 +21,7 @@
    </select>
    <select id="getBasicWarehouseTypeAll" >
        select * from mm.basic_warehouse_type where type!='原片' and type!='辅料'  order by id desc;
        select * from mm.basic_warehouse_type where type!=#{originalFilm} and type!=#{accessories}  order by id desc;
    </select>
    <insert id="insertBasicWarehouse"  useGeneratedKeys="true"  >