chenlu
2025-11-28 189add7a28d273861f9e54c81fb0330da4327ca0
补片管理界面添加导出功能,补片、返工管理相关筛选调整
6个文件已修改
1个文件已添加
227 ■■■■■ 已修改文件
north-glass-erp/northglass-erp/src/views/pp/replenish/SelectReplenish.vue 60 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/controller/pp/ReplenishController.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/dto/pp/exportReplenishDTO.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/mapper/pp/PatchLogMapper.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/src/main/resources/mapper/pp/ReworkMapper.xml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
north-glass-erp/northglass-erp/src/views/pp/replenish/SelectReplenish.vue
@@ -190,6 +190,10 @@
        'code':'cancelReview'
      }
    ],
    slots: {
      tools: 'toolbar_buttons',
      buttons:'buttons'
    },
    /*import: false,
    export: true,
    print: true,*/
@@ -362,8 +366,53 @@
  reserve:true
}
const exportEvent = () => {
  const $table = xGrid.value
  if ($table) {
    $table.exportData({
      filename: 'order_export',
      sheetName: 'Sheet1',
      type: 'xlsx'
    })
  }
}
function exportExcel(url, fileName,date) {
  gridOptions.loading = true
  if(date===null){
    ElMessage.warning(t('report.pleaseSelectADateFirst'))
    return
  }
  const date1 = new Date(date[0]);
  const date2 = new Date(date[1]);
  const timeDiff = Math.abs(date2.getTime() - date1.getTime());
  const daysDiff = timeDiff / (1000 * 3600 * 24);
  if(Math.floor(daysDiff)>180){
    ElMessage.warning(t('report.theFilteringTimeForExportCannotExceed180Days'))
    return
  }
  let dataMp = ref({
    date: date,
  })
  request.post(url,date,{responseType :'blob'}).then(res => {
    const blob = new Blob([res])
    if ('download' in document.createElement('a')) { // 非IE下载
      const elink = document.createElement('a')
      elink.download = `${fileName}.xlsx`
      elink.style.display = 'none'
      elink.href = URL.createObjectURL(blob)
      document.body.appendChild(elink)
      elink.click()
      URL.revokeObjectURL(elink.href) // 释放URL 对象
      document.body.removeChild(elink)
      gridOptions.loading = false
    } else { // IE10+下载
      navigator.msSaveBlob(blob, fileName)
    }
  })
}
</script>
<template>
@@ -444,7 +493,18 @@
          >
          </vxe-pager>
        </template>
        <template #toolbar_buttons>
          <vxe-button icon="vxe-icon-download" circle
                      style="margin-right: 0.5rem"
                      @click="exportEvent" />
          <vxe-button icon="vxe-icon-cloud-download" style="margin-right: 0.5rem"
                      circle
                      @click="exportExcel('/Replenish/exportReplenish',
                                          t('replenish.patchManagement'),
                                          selectDate)" />
        </template>
      </vxe-grid>
    </div>
north-glass-erp/src/main/java/com/example/erp/controller/pp/ReplenishController.java
@@ -5,18 +5,24 @@
import com.example.erp.common.Result;
import com.example.erp.dto.pp.PatchLogAddDTO;
import com.example.erp.dto.pp.PatchLogDTO;
import com.example.erp.dto.pp.TeamOutputDTO;
import com.example.erp.dto.pp.exportReplenishDTO;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.pp.PatchLog;
import com.example.erp.entity.pp.Rework;
import com.example.erp.exception.ServiceException;
import com.example.erp.service.pp.ReplenishService;
import com.example.erp.service.pp.ReworkService;
import com.example.erp.tools.DownExcel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.sql.Date;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@@ -93,4 +99,13 @@
    public Result updateCancelReview( @RequestBody Map<String,Object> object){
        return Result.success(replenishService.updateCancelReviewSv(object));
    }
    @ApiOperation("补片信息导出")
    @PostMapping("/exportReplenish")
    public void exportReplenish(HttpServletResponse response,
                                 @RequestBody List<LocalDate> dates
    ) throws IOException, IllegalAccessException, InstantiationException {
        //参数:相应的数据,实体类信息,相应的方法(数据获取),生成的excel名字
        DownExcel.download(response, exportReplenishDTO.class, replenishService.exportReplenishSv(dates), "PatchLogAddDTO");
    }
}
north-glass-erp/src/main/java/com/example/erp/dto/pp/exportReplenishDTO.java
New file
@@ -0,0 +1,68 @@
package com.example.erp.dto.pp;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
public class exportReplenishDTO {
    @ExcelProperty("销售单号")
    private String orderId;
    @ExcelProperty("补片单号")
    private String patchId;
    @ExcelProperty("报工编号")
    private String reportingWorkId;
    @ExcelProperty("流程卡号")
    private String processId;
    @ExcelProperty("项目名称")
    private String project;
    @ExcelProperty("批次")
    private String batch;
    @ExcelProperty("审核人")
    private String reviewer;
    @ExcelProperty("编号")
    private String glassNumber;
    @ExcelProperty("订单序号")
    private Integer orderSort;
    @ExcelProperty("产品名称")
    private String productName;
    @ExcelProperty("层号")
    private Integer technologyNumber;
    @ExcelProperty("片标记")
    private String glassAddress;
    @ExcelProperty("单片名称")
    private String glassChild;
    @ExcelProperty("数量")
    private Integer patchNum;
    @ExcelProperty("宽")
    private Double width;
    @ExcelProperty("高")
    private Double height;
    @ExcelProperty("形状")
    private String shape;
    @ExcelProperty("报工工序")
    private String patchProcesses;
    @ExcelProperty("补片原因")
    private String patchReason;
    @ExcelProperty("补片类型")
    private String patchType;
    @ExcelProperty("责任信息")
    private String responsiblePersonnel;
    @ExcelProperty("责任设备")
    private String responsibleEquipment;
    @ExcelProperty("责任班组")
    private String responsibleTeam;
    @ExcelProperty("面积")
    private String patchArea;
    @ExcelProperty("制单时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    @ExcelProperty("审核时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime updateTime;
}
north-glass-erp/src/main/java/com/example/erp/mapper/pp/PatchLogMapper.java
@@ -2,12 +2,15 @@
import com.example.erp.dto.pp.PatchLogAddDTO;
import com.example.erp.dto.pp.PatchLogDTO;
import com.example.erp.dto.pp.exportReplenishDTO;
import com.example.erp.dto.sd.OrderDTO;
import com.example.erp.entity.pp.PatchLog;
import com.example.erp.entity.pp.ReportingWork;
import com.github.yulichang.base.MPJBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.time.LocalDate;
import java.util.List;
import java.util.Map;
@@ -50,5 +53,7 @@
    Boolean updateReplenishCancel(@Param("patchLog") PatchLog patchLog);
    Integer selectProjectCount(String processId, String patchId, Integer technologyNumber);
    List<exportReplenishDTO> exportReplenishMp(List<LocalDate> dates);
}
north-glass-erp/src/main/java/com/example/erp/service/pp/ReplenishService.java
@@ -7,6 +7,8 @@
import com.example.erp.common.AsyncQueryExecutor;
import com.example.erp.dto.pp.PatchLogAddDTO;
import com.example.erp.dto.pp.PatchLogDTO;
import com.example.erp.dto.pp.exportReplenishDTO;
import com.example.erp.dto.sd.OrderDTO;
import com.example.erp.entity.pp.FlowCard;
import com.example.erp.entity.pp.PatchLog;
import com.example.erp.entity.pp.ReportingWork;
@@ -340,6 +342,13 @@
                        reportingWorkMapper.updateRWDPatchNum(patchLog1.getReportingWorkId(),patchLog1.getOrderSort(),patchLog1.getTechnologyNumber(),patchLog1.getPatchNum());
                        //更新报工流程表数据
                        reportingWorkMapper.updateReplenishWorkProcess(patchLog1.getProcessId(),patchLog1.getOrderSort(),patchLog1.getTechnologyNumber(),patchLog1.getPatchNum(),patchLog1.getPatchProcesses());
                        Log log = new Log();
                        log.setContent(object.toString());
                        log.setFunction("deleteReplenishSv补片删除");
                        log.setOperatorId((String) object.get("userId"));
                        log.setOperator((String) object.get("userName"));
                        logService.saveLog(log);
                    }
                    else{
                        saveState = false;
@@ -417,5 +426,11 @@
        return saveState;
    }
//    public List exportReplenishSv(Map<String, Object> dates) {
//    }
    public List<exportReplenishDTO> exportReplenishSv(List<LocalDate> dates) {
        return patchMapper.exportReplenishMp(dates);
    }
}
north-glass-erp/src/main/resources/mapper/pp/PatchLogMapper.xml
@@ -100,7 +100,7 @@
                and ogd.glass_child regexp #{patchLog.glassChild}
            </if>
            <if test="patchLog.responsibleTeam != null and patchLog.responsibleTeam != ''">
                and r.responsible_team regexp #{patchLog.responsibleTeam}
                and r.responsible_team like concat('%', #{patchLog.responsibleTeam}, '%')
            </if>
            <if test="patchLog.responsibleEquipment != null and patchLog.responsibleEquipment != ''">
                and r.responsible_equipment regexp #{patchLog.responsibleEquipment}
@@ -124,7 +124,7 @@
                and r.patch_processes regexp #{patchLog.patchProcesses}
            </if>
            <if test="patchLog.reviewer != null and patchLog.reviewer != ''">
                and r.reviewer regexp #{patchLog.reviewer}
                and r.reviewer like concat('%', #{patchLog.reviewer}, '%')
            </if>
        </where>
         order by r.review_status,r.id desc
@@ -193,7 +193,7 @@
                and ogd.glass_child regexp #{patchLog.glassChild}
            </if>
            <if test="patchLog.responsibleTeam != null and patchLog.responsibleTeam != ''">
                and r.responsible_team regexp #{patchLog.responsibleTeam}
                and r.responsible_team like concat('%', #{patchLog.responsibleTeam}, '%')
            </if>
            <if test="patchLog.responsibleEquipment != null and patchLog.responsibleEquipment != ''">
                and r.responsible_equipment regexp #{patchLog.responsibleEquipment}
@@ -217,7 +217,7 @@
                and r.patch_processes regexp #{patchLog.patchProcesses}
            </if>
            <if test="patchLog.reviewer != null and patchLog.reviewer != ''">
                and r.reviewer regexp #{patchLog.reviewer}
                and r.reviewer like concat('%', #{patchLog.reviewer}, '%')
            </if>
        </where>
        ) as zu
@@ -368,7 +368,7 @@
                and ogd.glass_child regexp #{patchLogAddDTO.glassChild}
            </if>
            <if test="patchLogAddDTO.responsibleTeam != null and patchLogAddDTO.responsibleTeam != ''">
                and dd.responsible_team regexp #{patchLogAddDTO.responsibleTeam}
                and dd.responsible_team like concat('%', #{patchLogAddDTO.responsibleTeam}, '%')
            </if>
            <if test="patchLogAddDTO.responsibleEquipment != null and patchLogAddDTO.responsibleEquipment != ''">
                and dd.responsible_equipment regexp #{patchLogAddDTO.responsibleEquipment}
@@ -432,4 +432,46 @@
          and project_no IS not NULL;
    </select>
    <select id="exportReplenishMp">
        select
        r.id,
        r.review_status,
        r.reporting_work_id,
        r.patch_id,
        r.process_id,
        r.order_id,
        r.order_sort,
        o.project,
        o.batch,
        od.building_number,
        od.product_name,
        r.technology_number,
        ogd.glass_address,
        ogd.glass_child,
        r.patch_num,
        ogd.child_width as width,
        ogd.child_height as height,
        od.shape,
        r.patch_type,
        r.patch_reason,
        r.responsible_team,
        r.responsible_personnel,
        r.responsible_equipment,
        r.patch_area,
        r.quality_inspector,
        r.patch_processes,
        r.reviewer,
        r.create_time as create_time,
        date(r.update_time) as update_time,
        JSON_UNQUOTE( JSON_EXTRACT( od.other_columns, '$.S01' )) AS glassNumber
        from pp.patch_log r left join sd.order_detail od on r.order_id=od.order_id and r.order_sort=od.order_number
        left join sd.`order` o on r.order_id = o.order_id
        left join (select * from sd.order_glass_detail group by order_id,order_number,technology_number) as ogd
        on r.order_id = ogd.order_id and r.order_sort = ogd.order_number and r.technology_number=ogd.technology_number
        <where>
            date(r.create_time)>=#{dates[0]} and date(r.create_time) &lt;= #{dates[1]}
            and o.create_order>0
        </where>
        order by r.review_status,r.id desc
    </select>
</mapper>
north-glass-erp/src/main/resources/mapper/pp/ReworkMapper.xml
@@ -51,7 +51,7 @@
                and r.rework_id regexp #{rework.reworkId}
            </if>
            <if test="rework.reworkTeam != null and rework.reworkTeam != ''">
                and r.rework_team regexp #{rework.reworkTeam}
                and r.rework_team like concat('%', #{rework.reworkTeam}, '%')
            </if>
            <if test="rework.orderId != null and rework.orderId != ''">
                and r.order_id regexp #{rework.orderId}
@@ -99,7 +99,7 @@
                and ogd.glass_address regexp #{rework.glassAddress}
            </if>
            <if test="rework.responsibleTeam != null and rework.responsibleTeam != ''">
                and r.responsible_team regexp #{rework.responsibleTeam}
                and r.responsible_team like concat('%', #{rework.responsibleTeam}, '%')
            </if>
            <if test="rework.responsibleEquipment != null and rework.responsibleEquipment != ''">
                and r.responsible_equipment regexp #{rework.responsibleEquipment}
@@ -123,7 +123,7 @@
                and r.rework_processes regexp #{rework.reworkProcesses}
            </if>
            <if test="rework.reviewer != null and rework.reviewer != ''">
                and r.reviewer regexp #{rework.reviewer}
                and r.reviewer like concat('%', #{rework.reviewer}, '%')
            </if>
        </where>
         order by r.review_status,r.id desc limit #{offset},#{pageSize};
@@ -145,7 +145,7 @@
                and r.rework_id regexp #{rework.reworkId}
            </if>
            <if test="rework.reworkTeam != null and rework.reworkTeam != ''">
                and r.rework_team regexp #{rework.reworkTeam}
                and r.rework_team like concat('%', #{rework.reworkTeam}, '%')
            </if>
            <if test="rework.orderId != null and rework.orderId != ''">
                and r.order_id regexp #{rework.orderId}
@@ -193,7 +193,7 @@
                and ogd.glass_address regexp #{rework.glassAddress}
            </if>
            <if test="rework.responsibleTeam != null and rework.responsibleTeam != ''">
                and r.responsible_team regexp #{rework.responsibleTeam}
                and r.responsible_team like concat('%', #{rework.responsibleTeam}, '%')
            </if>
            <if test="rework.responsibleEquipment != null and rework.responsibleEquipment != ''">
                and r.responsible_equipment regexp #{rework.responsibleEquipment}
@@ -217,7 +217,7 @@
                and r.rework_processes regexp #{rework.reworkProcesses}
            </if>
            <if test="rework.reviewer != null and rework.reviewer != ''">
                and r.reviewer regexp #{rework.reviewer}
                and r.reviewer like concat('%', #{rework.reviewer}, '%')
            </if>
        </where>
        ) as zu;