廖井涛
2024-12-11 ae4e89b09455affa0e3caf8756d0b3ac5be79784
新增按工程打印流程卡
6个文件已修改
342 ■■■■ 已修改文件
north-glass-erp/northglass-erp/src/components/pp/PrintProcess.vue 197 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/processCard/SelectPrintProject.vue 46 ●●●●● 补丁 | 查看 | 原始文档 | 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 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/components/pp/PrintProcess.vue
@@ -30,12 +30,14 @@
let props = defineProps({
  printList: null,
  printMerge: null,
  printLike: null
  printLike: null,
  printProject:null
})
const {currentRoute} = useRouter()
const route = currentRoute.value
const printMerge = props.printMerge
const printProject = props.printProject
//打印时间
const currentTime = new Date();
@@ -56,94 +58,28 @@
data.value.printList = JSON.parse(props.printList)
let flowCardCount = ''
onMounted(() => {
      request.post(`/processCard/getSelectPrinting/${merge}/${like}`, data.value).then((res) => {
        if (res.code == 200) {
          produceList.value = deepClone(res.data.data)
          //处理单片厚度
          for (let j = 0; j < produceList.value.length; j++) {
            let sumWeight = 0
            produceList.value[j].detailList.forEach((item, index) => {
              // 解析 separation 字段的 JSON 字符串
              let separationObj = JSON.parse(item.separation);
              // 获取 thickness 的原始值
              let thicknessValue = separationObj.thickness;
              // 去除 'mm' 单位
              let thicknessWithoutUnit = thicknessValue.replace('mm', '');
              item.separation = thicknessWithoutUnit
              sumWeight += item.width * item.height * item.quantity / 1000000 * item.separation * 2.5 * 1;
            });
            produceList.value[j].detail[0].weight = sumWeight
  console.log(printProject)
      if(props.printProject!=null){
        request.post(`/processCard/getSelectPrintProject/${printProject}`).then((res) => {
          if (res.code == 200) {
            console.log(res.data.data)
            load(res.data.data)
          } else {
            ElMessage.warning(res.msg)
            router.push("/login")
          }
          //处理合并打印
          if (printMerge !== null && printMerge !== undefined && printMerge !== "") {
            produceList.value.forEach(item => {
              item.detail[0].technologyNumber = printMerge;
            });
            //合并打印工艺流程处理
            if (like == null) {
              let process = produceList.value[0].detail[0].process
              let indexOfJiaJiao = process.indexOf('夹胶');
              if (indexOfJiaJiao !== -1) {
                // 使用 substring 截取 "夹胶" 后面的部分,包括 "夹胶" 本身
                let afterJiaJiao = process.substring(indexOfJiaJiao).trim();
                produceList.value.forEach(item => {
                  item.detail[0].process = afterJiaJiao
                })
              }
              let indexOfProceList = produceList.value[0].processList
              let getProceList = indexOfProceList.findIndex(item => item.process === '夹胶');
              if (getProceList !== -1) {
                // 使用 filter 方法过滤出 "夹胶" 及其之后的对象
                produceList.value[0].processList = indexOfProceList.filter((item, index) => index >= getProceList);
              }
            }
            }
          produceList.value.forEach(item => {
            let technologyNumberMerge = printMerge.split('').join(',');
            item.detail[0].technologyNumberMerge = technologyNumberMerge
          })
          //处理编号列
          //定义存放编号数组
          const s01Values = [];
          for (let i = 0; i < produceList.value.length; i++) {
            const s01Values = [];
            // 遍历 detailList 数组,提取 S01 值到 s01Values 数组
            if (produceList.value[i].detailList[0].other_columns != null
                || produceList.value[i].detailList[0].other_columns != undefined) {
              produceList.value[i].detailList.forEach(element => {
                const otherColumnsObject = JSON.parse(element.other_columns);
                const s01Value = otherColumnsObject.S01;
                s01Values.push(s01Value || ''); // 如果 S01 值为空,添加空字符串或者其他默认值
              });
              // 将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性
              produceList.value[i].detailList.forEach((detail, index) => {
                detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 赋值给 s01Value 属性
              });
            }
        })
      }else{
        request.post(`/processCard/getSelectPrinting/${merge}/${like}`, data.value).then((res) => {
          if (res.code == 200) {
            load(res.data.data)
          } else {
            ElMessage.warning(res.msg)
            router.push("/login")
          }
          //处理同配置打印
          handleGetQRCode()
          handleSummary()
          AreaQuantitySummary()
        } else {
          ElMessage.warning(res.msg)
          router.push("/login")
        }
      })
        })
      }
    }
)
@@ -209,6 +145,91 @@
  }
}
const load = (data) => {
  produceList.value = deepClone(data)
  //处理单片厚度
  for (let j = 0; j < produceList.value.length; j++) {
    let sumWeight = 0
    produceList.value[j].detailList.forEach((item, index) => {
      // 解析 separation 字段的 JSON 字符串
      let separationObj = JSON.parse(item.separation);
      // 获取 thickness 的原始值
      let thicknessValue = separationObj.thickness;
      // 去除 'mm' 单位
      let thicknessWithoutUnit = thicknessValue.replace('mm', '');
      item.separation = thicknessWithoutUnit
      sumWeight += item.width * item.height * item.quantity / 1000000 * item.separation * 2.5 * 1;
    });
    produceList.value[j].detail[0].weight = sumWeight
  }
  //处理合并打印
  if (printMerge !== null && printMerge !== undefined && printMerge !== "") {
    produceList.value.forEach(item => {
      item.detail[0].technologyNumber = printMerge;
    });
    //合并打印工艺流程处理
    if (like == null) {
      let process = produceList.value[0].detail[0].process
      let indexOfJiaJiao = process.indexOf('夹胶');
      if (indexOfJiaJiao !== -1) {
        // 使用 substring 截取 "夹胶" 后面的部分,包括 "夹胶" 本身
        let afterJiaJiao = process.substring(indexOfJiaJiao).trim();
        produceList.value.forEach(item => {
          item.detail[0].process = afterJiaJiao
        })
      }
      let indexOfProceList = produceList.value[0].processList
      let getProceList = indexOfProceList.findIndex(item => item.process === '夹胶');
      if (getProceList !== -1) {
        // 使用 filter 方法过滤出 "夹胶" 及其之后的对象
        produceList.value[0].processList = indexOfProceList.filter((item, index) => index >= getProceList);
      }
    }
  }
  produceList.value.forEach(item => {
    let technologyNumberMerge = printMerge.split('').join(',');
    item.detail[0].technologyNumberMerge = technologyNumberMerge
  })
  //处理编号列
  //定义存放编号数组
  const s01Values = [];
  for (let i = 0; i < produceList.value.length; i++) {
    const s01Values = [];
    // 遍历 detailList 数组,提取 S01 值到 s01Values 数组
    if (produceList.value[i].detailList[0].other_columns != null
        || produceList.value[i].detailList[0].other_columns != undefined) {
      produceList.value[i].detailList.forEach(element => {
        const otherColumnsObject = JSON.parse(element.other_columns);
        const s01Value = otherColumnsObject.S01;
        s01Values.push(s01Value || ''); // 如果 S01 值为空,添加空字符串或者其他默认值
      });
      // 将 s01Values 中的值赋给每个订单详情对象的 s01Value 属性
      produceList.value[i].detailList.forEach((detail, index) => {
        detail.s01Value = index < s01Values.length ? s01Values[index] : ''; // 赋值给 s01Value 属性
      });
    }
  }
  //处理同配置打印
  handleGetQRCode()
  handleSummary()
  AreaQuantitySummary()
}
const AreaQuantitySummary = () => {
  for (let i = 0; i < produceList.value.length; i++) {
@@ -234,7 +255,7 @@
          <div style="float: left;"><input style="border: none;font-size: 28px;width: 70px;margin: 5px  "/></div>
          <div id="bj" style="float: right;font-size: 28px">{{ id + 1 }}</div>
          <div>{{ company.companyName }}</div>
          <div>生产流程卡</div>
          <div>生产流程卡<span v-if="printProject!=null">({{ printProject }})</span></div>
          <div  style="font-weight: bolder;display: flex;justify-content:space-between">
            <div>
              打印人:{{user.user.userName}} &nbsp;&nbsp;
north-glass-erp/northglass-erp/src/views/pp/processCard/SelectPrintProject.vue
@@ -13,10 +13,12 @@
import {Printer} from "@element-plus/icons-vue/global";
import companyInfo from "@/stores/sd/companyInfo"
import {remove} from "xe-utils";
import PrintProcess from "@/components/pp/PrintProcess.vue";
//语言获取
const {t} = useI18n()
let router = useRouter()
const dialogTableVisible = ref(false)
const dialogTableVisibleLabelXJTwo = ref(false)
let rowClickIndex = ref(null)
@@ -44,6 +46,14 @@
  orderId: '',
  project: ''
})
//打印
let printRow = ref({
  list: null,
  printMergeVal: null,
  like: null,
  project:null
})
const getTableRow = (row, type) => {
  switch (type) {
    case 'edit' :{
@@ -62,6 +72,11 @@
    case 'edit2' :{
      router.push({path: '/main/processCard/PrintLabel', query: { projectNo: row.project_no,type:3 }})
      break
    }
    case 'edit3' :{
      printRow.value.project=row.project_no
      console.log(printRow.value.project)
      dialogTableVisible.value = true
    }
  }
}
@@ -188,7 +203,7 @@
  //表头参数
  columns: [
    {type: 'expand', fixed: "left", slots: {content: 'content'}, width: 50},
    {title: t('basicData.operate'), width: 140, slots: { default: 'button_slot' },fixed:"left"},
    {title: t('basicData.operate'), width: 240, slots: { default: 'button_slot' },fixed:"left"},
    {type: 'seq', fixed: "left", title: t('basicData.Number'), width: 50},
    {
      field: 'project_no',
@@ -295,6 +310,10 @@
    }
  })
}
const printContent = ref({
  id: 'child',
})
</script>
<template>
@@ -342,6 +361,7 @@
          <el-button @click="getTableRow(row,'edit')" link type="primary" size="small">{{$t('machine.cutting')}}</el-button>
          <el-button @click="getTableRow(row,'edit1')" link type="primary" size="small">{{$t('machine.tempering')}}</el-button>
          <el-button @click="getTableRow(row,'edit2')" link type="primary" size="small">{{$t('components.finishedProduct')}}</el-button>
          <el-button @click="getTableRow(row,'edit3')" link type="primary" size="small">{{$t('流程卡')}}</el-button>
        </template>
        <template #num1_filter="{ column, $panel }">
@@ -392,6 +412,24 @@
                                  :projectNo="labelRow.projectNo"
                                  style="width: 100%;height: 100%"/>
    </el-dialog>
    <el-dialog
        id="sizePrintCalrd"
        v-model="dialogTableVisible"
        :title="$t('processCard.print')"
        destroy-on-close
        style="width: 75%;height:75% ">
      <template #header="{ close, titleId, titleClass }">
        <el-button v-print="printContent" :icon="Printer" circle />
      </template>
      <print-process
          id="child"
          :printLike="printRow.like"
          :printList="printRow.list"
          :printMerge="printRow.printMergeVal"
          :printProject="printRow.project"
          style="width: 100%;height: 100%"/>
    </el-dialog>
  </div>
</template>
@@ -412,4 +450,10 @@
  width: 100%;
}
:deep(#sizePrintCalrd .el-dialog__body) {
  height: 85%;
  width: 100%;
  overflow-y: auto;
}
</style>
north-glass-erp/src/main/java/com/example/erp/controller/pp/ProcessCardController.java
@@ -189,6 +189,13 @@
        return Result.seccess(flowCardService.getSelectPrintingSv(object,printMerge,printLike));
    }
    @ApiOperation("工程打印流程卡数据查询接口")
    @PostMapping("/getSelectPrintProject/{printProject}")
    public Result getSelectPrintProject(
            @PathVariable String printProject) {
        return Result.seccess(flowCardService.getSelectPrintProject(printProject));
    }
    @ApiOperation("打印标签数据查询接口")
    @PostMapping("/getSelectPrintLabel/{projectNo}/{type}")
    public Result getSelectPrintLabel(@PathVariable String projectNo,@PathVariable String type) {
north-glass-erp/src/main/java/com/example/erp/mapper/pp/FlowCardMapper.java
@@ -196,4 +196,6 @@
    Boolean deleteProcessMp(String processId, String technologyNumber);
    Boolean updateOrderProcessMp(String orderId, String number, String technologyNumber, String orderprocess);
    List<FlowCard> getFlowCardListPrintProject(String printProject);
}
north-glass-erp/src/main/java/com/example/erp/service/pp/FlowCardService.java
@@ -362,6 +362,67 @@
        return map;
    }
    public Map<String, Object> getSelectPrintProject(String printProject) {
        Map<String, Object> map = new HashMap<>();
        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();//最终结果
        List<FlowCard> flowCardList = flowCardMapper.getFlowCardListPrintProject(printProject);
        if (!flowCardList.isEmpty()) {
            for (FlowCard flowCard : flowCardList) {
                Map<String, Object> itemmap = new HashMap<>();
                    //是否包含切割
                    //boolean containsCutting = flowCard.getProcess().contains("切割");
                    String processSub=flowCard.getProcess().substring(0, 2);
                    if(processSub.equals("夹胶") || processSub.equals("中空")){
                        itemmap.put("detail", flowCardMapper.getPrimaryListLimt(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getGlassChild(),flowCard.getProcess(),flowCard.getOrderId()));
                        List<Map<String, Object>> detailList = flowCardMapper.getDetailList(flowCard.getProcessId(), flowCard.getTechnologyNumber(),flowCard.getProcess());
                        itemmap.put("detailList", detailList);
                    }
                    else {
                        itemmap.put("detail", flowCardMapper.getPrimaryList(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getGlassChild(),flowCard.getProcess(),flowCard.getOrderId()));
                        List<Map<String, Object>> detailList = flowCardMapper.getDetailListLike(flowCard.getProcessId(), String.valueOf(flowCard.getTechnologyNumber()),flowCard.getProcess());
                        itemmap.put("detailList", detailList);
                    }
                //工艺流程
                //List<Map<String, Object>> processList = flowCardMapper.getProcessList(flowCard.getProcessId(), flowCard.getTechnologyNumber());
                String input = flowCard.getProcess();
                String delimiter = "->";
                // 分割字符串
                String[] parts = input.split(delimiter);
                // 创建 List<Map<String, Object>>
                List<Map<String, Object>> processList = new ArrayList<>();
                // 遍历分割后的部分并将其存入 List<Map<String, Object>>
                for (int i = 0; i < parts.length; i++) {
                    Map<String, Object> maps = new HashMap<>();
                    maps.put("id", i); // 添加一个索引字段
                    maps.put("process", parts[i]); // 添加实际的值
                    processList.add(maps);
                }
                itemmap.put("processList", processList);
                //  itemmap.put("numberList", numberList);
                itemmap.put("count", flowCardMapper.countFlowCard(flowCard.getOrderId()));
                itemmap.put("remarkList", flowCardMapper.remakList(flowCard.getProcessId()));
                list.add(itemmap);
            }
        }
        map.put("data", list);
        return map;
    }
    public Boolean updateComposingSv(Map<String, Object> object) {
        List<FlowCard> flowCardList = JSONArray.parseArray(JSONObject.toJSONString(object.get("composing")), FlowCard.class);
        if (!flowCardList.isEmpty()) {
north-glass-erp/src/main/resources/mapper/pp/FolwCard.xml
@@ -2509,4 +2509,33 @@
        update sd.order_glass_detail set process=#{orderprocess}
        where order_id=#{orderId} and order_number=#{number} and technology_number=#{technologyNumber}
    </update>
    <select id="getFlowCardListPrintProject">
        select fc.id,
               fc.order_id,
               fc.process_id,
               o.customer_name,
               o.project,
               fc.order_number,
               ogd.technology_number,
               ogd.glass_address,
               sum(fc.quantity)                                                          as quantity,
               round(sum(ogd.child_width * ogd.child_height * fc.quantity / 1000000), 2) as total_area,
               od.product_name,
               ogd.glass_child,
               fc.founder,
               date(fc.splitFrame_time) as splitFrame_time,
            /* if(fc.print_status=0,'未打印','已打印') as  print_status*/
               fc.print_status,
               ogd.process
        from pp.flow_card as fc
                 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` as o on o.order_id = fc.order_id
        where fc.project_no = #{printProject}
        GROUP BY fc.process_id, ogd.technology_number
        order by fc.process_id, ogd.technology_number
    </select>
</mapper>