chenlu
2024-08-14 ec49ea0aa44ebbbe2faea2894539ac4ca515bd6b
添加流程排序汇总查询,修改报工查询流程卡显示层
9个文件已修改
1个文件已添加
409 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/components/pp/SelectSortTable.vue 283 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/router/index.js 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCard.vue 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/pp/ProcessCardController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml 60 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/components/pp/SelectSortTable.vue
New file
@@ -0,0 +1,283 @@
<script setup>
import request from "@/utils/request"
import deepClone from "@/utils/deepClone"
import {ElDatePicker, ElMessage} from "element-plus"
import useProductGlassTypeStore from "@/stores/sd/product/productGlassType"
import footSum from "@/hook/footSum"
import {nextTick, onMounted, onUnmounted, reactive, ref, watch} from "vue"
import {Search} from "@element-plus/icons-vue"
import GlassType from "@/components/sd/product/GlassType.vue"
import {useRouter} from 'vue-router'
import Sortable from 'sortablejs'
import BasicTable from '@/components/sd/product/BasicTable.vue'
import {VXETable} from "vxe-table";
import  useUserInfoStore from '@/stores/userInfo'
import {useI18n} from "vue-i18n";
import {filterChanged} from "@/hook";
import {addListener, toolbarButtonClickEvent} from "@/hook/mouseMove"
import domZindex from 'dom-zindex'
import { VxeUI } from 'vxe-pc-ui'
const { t } = useI18n()
const userStore = useUserInfoStore()
let selectRecords = ref(null)
let router = useRouter()
const data = ref({
  printList: []
})
let props = defineProps({
  orderId:null,
})
domZindex.setCurrent(3000)
//定义数据返回结果
let produceDetailList = ref([])
//表尾求和
const sumNum = (list, field) => {
  let count = 0
  list.forEach(item => {
    count += Number(item[field])
  })
  return count.toFixed(2)
}
const {currentRoute} = useRouter()
const route = currentRoute.value
onMounted(() => {
  //启用表格拖动选中
  addListener(xGridDetail.value, detailGridOptions)
})
data.value.printList = JSON.parse(props.orderId)
//第一次加载数据
request.post(`/processCard/selectSortTable`,data.value).then((res) => {
  if (res.code == 200) {
    produceDetailList.value = (res.data.data[0].data)
    xGridDetail.value.reloadData(produceDetailList.value)
  } else {
    ElMessage.warning(res.msg)
  }
})
/*使用筛选,后端获取数据*/
const changeFilterEvent = (event, option, $panel,) => {
  // 手动触发筛选
  $panel.changeOption(event, !!option.data, option)
}
/*后端返回结果多层嵌套展示*/
const hasDecimal = (value) => {
  const regex = /\./; // 定义正则表达式,查找小数点
  return regex.test(value); // 返回true/false
}
//子组件接收参数
const xGridDetail = ref()
const detailGridOptions = reactive({
  border: "full",//表格加边框
  keepSource: true,//保持源数据
  align: 'center',//文字居中
  stripe: true,//斑马纹
  rowConfig: {isCurrent: true, isHover: true, height: 30},//鼠标移动或选择高亮
  id: 'printFlowCard_2',
  showFooter: true,//显示脚
  printConfig: {},
  importConfig: {},
  exportConfig: {},
  scrollX: {enabled: true},
  scrollY: {enabled: true, gt: 0},//开启虚拟滚动
  showOverflow: true,
  columnConfig: {
    resizable: true,
    useKey: true
  },
  filterConfig: {   //筛选配置项
    // remote: true
  },
  customConfig: {
    storage: true
  },
  mouseConfig:{selected: true},//鼠标选中
  keyboardConfig:{
    isArrow: true,
    isDel: true,
    isEnter: true,
    isTab: true,
    isEdit: true,
    isChecked: true
  },
  editConfig: {
    trigger: 'dblclick',
    mode: 'row',
    showStatus: true
  },//表头参数
  //右键菜单
  menuConfig: {
    className: 'my-menus',
    body: {
      options: [
      ]
    }
  },
  columns: [
    {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50},
    {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50},
    {
      field: 'sort',
      width: 70,
      title: t('processCard.sorting'),
    },
    {
      field: 'process_id',
      title: t('processCard.processId'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged,width: 130
    },
    {
      field: 'order_number',
      title: t('order.OrderNum'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged,width: 100
    },
    {
      field: 'technology_number',
      title: t('processCard.technologyNumber'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged,width: 100
    },
    {
      field: 'glassNumber',
      title: t('reportingWorks.glassNumber'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged,width: 100
    },
    {
      field: 'process',
      title: t('craft.process'),
      filters: [{data: ''}],
      slots: {filter: 'num1_filter'},
      filterMethod: filterChanged,width: 120
    },
  ],
  //表单验证
  editRules: {
    sort: [
      //type: 'number', min: 0, message: '请输入大于等于0的数值' ,
      {
        validator ({ cellValue }) {
          const regex = /^[1-9]\d*$/
          if (!regex.test(cellValue)) {
            return new Error(t('basicData.msg.greater0'))
          }
        }}
    ],
  },
  //表头按钮
  toolbarConfig: {
    buttons: [
    ],
    // import: false,
    // export: true,
    //print: true,
    zoom: true,
    custom: true
  },
  data: null,//表格数据
  //脚部求和
  footerMethod ({ columns, data }) {//页脚函数
    return[
      columns.map((column, columnIndex) => {
        if (columnIndex === 0) {
          return t('basicData.total')
        }
        const List = ["quantity",'area',]
        if (List.includes(column.field)) {
          return footSum(data, column.field)
        }
        return ''
      })
    ]
  }
})
const handleCellDblClick = ({ row, column, cell, $event }) => {
  VxeUI.clipboard.copy(row[column.property])
}
</script>
<template>
  <div class="main-div-customer" style="width: 100%;height: 100%">
    <vxe-grid
        ref="xGridDetail"
        class="mytable-scrollbar"
        height="100%"
        size="small"
        v-bind="detailGridOptions"
        @cell-dblclick="handleCellDblClick"
    >
      <template #content="{ row }">
        <ul class="expand-wrapper">
          <li v-for="(item,index) in detailGridOptions.columns" v-show="item.field!=undefined ">
            <span style="font-weight: bold">{{ item.title + ':  ' }}</span>
            <span v-if="hasDecimal(item.field)">{{ row[item.field.split('.')[0]][item.field.split('.')[1]] }}</span>
            <span v-else>{{ row[item.field] }}</span>
          </li>
        </ul>
      </template>
      <template #num1_filter="{ column, $panel }">
        <div>
          <div v-for="(option, index) in column.filters" :key="index">
            <input type="text"
                   v-model="option.data"
                   @input="changeFilterEvent($event, option, $panel)"/>
          </div>
        </div>
      </template>
    </vxe-grid>
  </div>
</template>
<style scoped>
.main-div-customer{
  width: 99%;
  height: 100%;
}
#selectForm {
  width: 40%;
  text-align: center;
}
.vxe-grid {
  /* 禁用浏览器默认选中 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
:deep(.my-menus)  {
  z-index: 9999 !important;
}
</style>
north-glass-erp/northglass-erp/src/router/index.js
@@ -429,6 +429,11 @@
              component: () => import('../components/pp/PrintCustomLabelDetails.vue'),
            },
            {
              path: 'selectSortTable',
              name: 'selectSortTable',
              component: () => import('../components/pp/SelectSortTable.vue'),
            },
            {
              path: '',
              redirect:'/main/processCard/SelectProcessCard'
            }
north-glass-erp/northglass-erp/src/views/pp/processCard/PrintFlowCard.vue
@@ -14,6 +14,7 @@
import PrintCustomLabel from '@/components/pp/PrintCustomLabel.vue'
import PrintCustomLabelSemi from '@/components/pp/PrintCustomLabelSemi.vue'
import SortDetail from '@/components/pp/SelectSortDetailProcessCard.vue'
import SelectSortTable from '@/components/pp/SelectSortTable.vue'
import footSum from "@/hook/footSum"
import companyInfo from "@/stores/sd/companyInfo"
import {CircleCheck, Download, Printer} from "@element-plus/icons-vue/global";
@@ -24,6 +25,7 @@
//语言获取
const {t} = useI18n()
let router = useRouter()
const dialogSortTable = ref(false)
const dialogTableVisible = ref(false)
const dialogTableVisibleLabel = ref(false)
const dialogTableVisibleCustomLabel = ref(false)
@@ -36,6 +38,11 @@
const xGrid = ref(null)
const xGridDetail = ref(null)
//排序
let tableRow = ref({
  orderId: null,
})
//排序
let editRow = ref({
@@ -322,6 +329,7 @@
      {code: 'customLabel', name: t('processCard.customLabelPrinting'), status: 'primary'},
      {code: 'printLabel', name: t('processCard.labelPrinting'), status: 'primary'},
      {code: 'printLabel2', name: t('processCard.labelPrinting2'), status: 'primary'},
      {code: 'sortTable', name: "排序汇总", status: 'primary'},
      // {code: 'printLike', name: "同配置打印", status: 'primary'},
    ],
    // import: false,
@@ -549,6 +557,13 @@
          dialogTableVisible.value = true
          break
        }
        case 'sortTable': {
          tableRow.value.orderId=JSON.stringify(data.value.printList)
          // router.push({path: '/main/processCard/printProcess', query: {printList: JSON.stringify(selectRecords),printMerge:printMergeVal}})
          dialogSortTable.value = true
          break
        }
      }
    }
  },
@@ -735,6 +750,16 @@
      <sort-detail id="child" :processId="editRow.processId" :technologyNumber="editRow.technologyNumber" :process="editRow.process"/>
    </el-dialog>
    <!--    排序汇总查询-->
    <el-dialog
        id="sizeCheck"
        v-model="dialogSortTable"
        title="排序汇总"
        destroy-on-close
        style="width: 80%;height:75% ">
      <select-sort-table id="child" :orderId="tableRow.orderId"/>
    </el-dialog>
  </div>
</template>
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/AddReportingWork.vue
@@ -889,7 +889,7 @@
      ElMessage.error(msg)
    }
  }).catch(err =>{
    ElMessage.error(err.message)
    ElMessage.error('提交失败,请刷新后重试')
  }).finally(()=>{
    gridOptions.toolbarConfig.buttons[0].disabled=false
north-glass-erp/northglass-erp/src/views/pp/reportingWorks/SelectReportingWorks.vue
@@ -324,8 +324,8 @@
    {field: 'reportingWorkId', width: 120, title: t('reportingWorks.reportingWorkId'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, },
    {field: 'reportingWorkTime',width: 120, title: t('reportingWorks.reportingWorkTime') ,showOverflow:"ellipsis" ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'orderId', width: 130,title:  t('order.orderId') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'processId', width: 130,title: t('processCard.processId') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'order.project',width: 120, title: t('order.project'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, },
    {field: 'processId', width: 160,title: t('processCard.processId') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'order.project',width: 150, title: t('order.project'),filters:[{ data: '' }],slots: { filter: 'num1_filter' }, },
    {field: 'order.batch', width: 100,title: t('order.batch') ,filters:[{ data: '' }],slots: { filter: 'num1_filter' }},
    {field: 'thisProcess',width: 100, title: t('reportingWorks.thisProcess'),filters:[{ data: '' }],slots: { filter: 'num1_filter' } },
    {field: 'thisCompletedQuantity',width: 120, title: t('reportingWorks.thisCompletedQuantity') },
north-glass-erp/src/main/java/com/example/erp/controller/pp/ProcessCardController.java
@@ -321,4 +321,11 @@
        return Result.seccess(flowCardService.getSelectPrintCustomLabelDetailsSv(type,lableType,object));
    }
    @ApiOperation("排序汇总查询接口")
    @PostMapping("/selectSortTable")
    public Result selectSortTable(
                                  @RequestBody Map<String, Object> object) {
        return Result.seccess(flowCardService.selectSortTableSv(object));
    }
}
north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
@@ -161,4 +161,6 @@
    List<Map<String, Object>> getPrintCustomDataDetails(String processId, Integer orderNumber);
    String selectUserMp(String userId);
    List<Map<String, Object>> selectSortTableMp(String orderId);
}
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -621,6 +621,25 @@
        map.put("title", flowCardMapper.getPrintTitle(type));
        return map;
    }
    public Object selectSortTableSv(Map<String, Object> object) {
        Map<String, Object> map = new HashMap<>();
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果
        List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("printList")), FlowCard.class);
        if (!flowCardList.isEmpty()) {
            for (FlowCard flowCard : flowCardList) {
                Map<String, Object> itemmap = new HashMap<>();
                itemmap.put("data", flowCardMapper.selectSortTableMp(flowCard.getOrderId()));
                list.add(itemmap);
            }
        }
        map.put("data", list);
        return map;
    }
}
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -472,9 +472,7 @@
    <select id="selectPrintMp">
        select *
        from (
        (select fc.id,
        from ((select fc.id,
                      fc.order_id,
                      fc.process_id,
                      o.customer_name,
@@ -507,10 +505,12 @@
                                          ogds.child_height
                                   from sd.order_glass_detail as ogds
                                   where ogds.order_id = #{orderId}
                                   GROUP BY order_id, order_number, ogds.glass_child,process,ogds.child_width,ogds.child_height) as ogdss
                                   GROUP BY order_id, order_number, ogds.glass_child, process, ogds.child_width,
                                            ogds.child_height) as ogdss
                                  on fc.order_id = ogdss.order_id and ogdss.order_number = fc.order_number
               where fc.order_id = #{orderId}
               GROUP BY fc.process_id, ogdss.concatenated_glass_child,ogdss.processed_part,ogdss.child_width,ogdss.child_height
               GROUP BY fc.process_id, ogdss.concatenated_glass_child, ogdss.processed_part, ogdss.child_width,
                        ogdss.child_height
               order by fc.process_id, ogdss.technology_number)
              UNION
@@ -660,7 +660,9 @@
                 left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
                 left join sd.product_detail as pd
                           on pd.prod_id = od.product_id and pd.glass_sort = ogd.technology_number
                 left join flow_card_sort as fcs on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and fcs.technology_number = fc.technology_number
                 left join flow_card_sort as fcs
                           on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and
                              fcs.technology_number = fc.technology_number
            and fcs.process=#{process}
        where fc.process_id = #{processId}
          and position(fc.technology_number in #{technologyNumber})
@@ -798,7 +800,9 @@
                 LEFT JOIN sd.order_glass_detail AS ogd ON fc.order_id = ogd.order_id
            AND fc.order_number = ogd.order_number
            AND fc.technology_number = ogd.technology_number
        left join flow_card_sort as fcs on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and fcs.technology_number = fc.technology_number
                 left join flow_card_sort as fcs
                           on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and
                              fcs.technology_number = fc.technology_number
            and fcs.process=#{process}
        left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
        where fc.process_id = #{processId}
@@ -1156,7 +1160,9 @@
                 left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
                 left join sd.product_detail as pd
                           on pd.prod_id = od.product_id and pd.glass_sort = ogd.technology_number
                 left join flow_card_sort as fcs on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and fcs.technology_number = fc.technology_number
                 left join flow_card_sort as fcs
                           on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and
                              fcs.technology_number = fc.technology_number
            and fcs.process=#{process}
        where fc.process_id = #{processId}
          and position(fc.technology_number in #{technologyNumber})
@@ -1514,7 +1520,9 @@
                 left join sd.order_glass_detail ogd
                           on ogd.order_id = o.order_id and ogd.order_number = od.order_number and
                              ogd.technology_number = fc.technology_number
                 left join flow_card_sort as fcs on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and fcs.technology_number = fc.technology_number
                 left join flow_card_sort as fcs
                           on fcs.process_id = fc.process_id and fcs.order_number = fc.order_number and
                              fcs.technology_number = fc.technology_number
            and fcs.process=#{process}
        where fc.process_id = #{processId}
          and position(fc.technology_number in #{technologyNumber})
@@ -1752,7 +1760,8 @@
                         left join sd.order_glass_detail as ogd
                                   on ogd.order_id = fc.order_id and ogd.order_number = fc.order_number and
                                      ogd.technology_number = fc.technology_number
                         left join sd.order_detail as od on od.order_id = fc.order_id and od.order_number = fc.order_number
                        left join sd.order_detail as od
                                  on od.order_id = fc.order_id and od.order_number = fc.order_number
                         left join sd.`order` as o on o.order_id = fc.order_id
                where fc.order_id = #{orderId}
                GROUP BY fc.process_id, ogd.technology_number
@@ -1851,8 +1860,7 @@
        values (#{processId},#{orderNumber},#{technologyNumber},#{process},#{sort},now())
    </insert>
    <select id="printAddSortCountMp">
        select
        count(*)
        select count(*)
        from flow_card_sort
        where process_id = #{processId}
          and order_number = #{orderNumber}
@@ -1904,7 +1912,8 @@
                              ogdc.technology_number = ogd.technology_number
        where fc.process_id = #{processId}
          and position(fc.technology_number in #{technologyNumber})
        group by fc.process_id limit 1
        group by fc.process_id
        limit 1
    </select>
    <select id="selectPrintDetailsMp">
@@ -2000,8 +2009,29 @@
    </select>
    <select id="selectUserMp">
        select role_id from
            erp_user_info.`user` as u left join erp_user_info.user_role as ur on u.id=ur.user_id
        select role_id
        from erp_user_info.`user` as u
                 left join erp_user_info.user_role as ur on u.id = ur.user_id
        where u.login_name=#{userId}
    </select>
    <select id="selectSortTableMp">
        select fcs.sort,
               process_id,
               fcs.order_number,
               fcs.technology_number,
               JSON_UNQUOTE(JSON_EXTRACT(od.other_columns, '$.S01')) AS glassNumber,
               fcs.process
        from flow_card_sort as fcs
                 left join sd.order_detail as od
                           on od.order_id = left(fcs.process_id, 10) and od.order_number = fcs.order_number
        where LEFT(fcs.process_id, 10) = #{orderId}
        GROUP BY process_id,
                 fcs.order_number,
                 fcs.technology_number,
                 fcs.process
        ORDER BY fcs.sort,process_id,
                 fcs.order_number,
                 fcs.technology_number
    </select>
</mapper>
north-glass-erp/src/main/resources/mapper/pp/ReportingWork.xml
@@ -501,7 +501,7 @@
        select rw.reporting_work_id,
               (rw.reporting_work_time) as reporting_work_time,
               o.order_id,
               rw.process_id,
               CONCAT(rw.process_id,'/',GROUP_CONCAT(distinct rwd.technology_number SEPARATOR '')) as process_id,
               o.project,
               o.batch,
               rw.this_process,