From 0b64efc97ee0594a84f28d23c847f738d68eae6d Mon Sep 17 00:00:00 2001 From: lius <Lius2225@163.com> Date: 星期一, 17 七月 2023 17:09:55 +0800 Subject: [PATCH] 加工数量 --- lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcProcessQuantityMapper.java | 31 ++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java | 2 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcProcessQuantityController.java | 19 + lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcStandardProcessDurationController.java | 3 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java | 123 +++++++++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcProcessQuantityDto.java | 42 ++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProcessQuantityMapper.xml | 123 +++++++++++++++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcProcessQuantityService.java | 33 ++++ lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java | 32 ++++ 9 files changed, 398 insertions(+), 10 deletions(-) diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcProcessQuantityController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcProcessQuantityController.java index 2735266..1bd0fbe 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcProcessQuantityController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcProcessQuantityController.java @@ -9,13 +9,17 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.base.controller.JeecgController; import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.aspect.annotation.AutoLog; import lombok.extern.slf4j.Slf4j; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.mdc.dto.MdcProcessQuantityDto; import org.jeecg.modules.mdc.entity.MdcProcessQuantity; +import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; import org.jeecg.modules.mdc.service.IMdcProcessQuantityService; @@ -55,9 +59,10 @@ @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, HttpServletRequest req) { - QueryWrapper<MdcProcessQuantity> queryWrapper = QueryGenerator.initQueryWrapper(mdcProcessQuantity, req.getParameterMap()); - Page<MdcProcessQuantity> page = new Page<MdcProcessQuantity>(pageNo, pageSize); - IPage<MdcProcessQuantity> pageList = mdcProcessQuantityService.page(page, queryWrapper); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + Page<MdcProcessQuantityDto> page = new Page<MdcProcessQuantityDto>(pageNo, pageSize); + IPage<MdcProcessQuantityDto> pageList = mdcProcessQuantityService.pageList(userId, page, mdcProcessQuantity, req); return Result.OK(pageList); } @@ -127,8 +132,8 @@ @ApiOperation(value = "鍔犲伐鏁伴噺琛�-閫氳繃id鏌ヨ", notes = "鍔犲伐鏁伴噺琛�-閫氳繃id鏌ヨ") @GetMapping(value = "/queryById") public Result<?> queryById(@RequestParam(name = "id", required = true) String id) { - MdcProcessQuantity mdcProcessQuantity = mdcProcessQuantityService.getById(id); - return Result.OK(mdcProcessQuantity); + MdcProcessQuantityDto dto = mdcProcessQuantityService.findById(id); + return Result.OK(dto); } /** @@ -139,7 +144,9 @@ */ @RequestMapping(value = "/exportXls") public ModelAndView exportXls(HttpServletRequest request, MdcProcessQuantity mdcProcessQuantity) { - return super.exportXls(request, mdcProcessQuantity, MdcProcessQuantity.class, "鍔犲伐鏁伴噺琛�"); + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userId = user.getId(); + return mdcProcessQuantityService.exportXls(userId, mdcProcessQuantity); } /** diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcStandardProcessDurationController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcStandardProcessDurationController.java index c45e9cf..84adfeb 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcStandardProcessDurationController.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcStandardProcessDurationController.java @@ -6,19 +6,16 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.StringUtils; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.apache.shiro.SecurityUtils; import org.jeecg.common.api.vo.Result; import org.jeecg.common.system.base.controller.JeecgController; -import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.aspect.annotation.AutoLog; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.system.vo.LoginUser; -import org.jeecg.modules.mdc.entity.MdcNoplanClose; import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcProcessQuantityDto.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcProcessQuantityDto.java new file mode 100644 index 0000000..9d00348 --- /dev/null +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/dto/MdcProcessQuantityDto.java @@ -0,0 +1,42 @@ +package org.jeecg.modules.mdc.dto; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import org.jeecgframework.poi.excel.annotation.Excel; +import org.springframework.format.annotation.DateTimeFormat; + +import java.util.Date; + +/** + * @author: LiuS + * @create: 2023-07-17 15:08 + */ +@Data +public class MdcProcessQuantityDto { + private String id; + @Excel(name = "璁惧缂栧彿", width = 15) + private String equipmentId; + @Excel(name = "璁惧鍚嶇О", width = 15) + private String equipmentName; + @Excel(name = "闆朵欢鍙�", width = 15) + private String partsCode; + @Excel(name = "鎵规鍙�", width = 15) + private String batchCode; + @Excel(name = "绋嬪簭鍙�", width = 15) + private String sequenceNumber; + private String standardId; + @Excel(name = "鏃ユ湡", width = 15) + @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd") + @DateTimeFormat(pattern = "yyyy-MM-dd") + private Date efficientDate; + @Excel(name = "鍔犲伐鏁伴噺", width = 15) + private Integer processQuantity; + @Excel(name = "鏃堕暱锛堝垎閽燂級", width = 15) + private Integer duration; + @Excel(name = "澶囨敞", width = 15) + private String remark; + private String createBy; + private Date createTime; + private String updateBy; + private Date updateTime; +} diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java index c47a7dc..5f1cf2c 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcProcessQuantity.java @@ -2,8 +2,10 @@ import java.io.Serializable; import java.util.Date; +import java.util.List; import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import io.swagger.annotations.ApiModel; @@ -64,4 +66,34 @@ @ApiModelProperty(value = "澶囨敞") private String remark; + @TableField(exist = false) + private String equipmentId; + + @TableField(exist = false) + private String startTime; + + @TableField(exist = false) + private String endTime; + + /** + * 鍓嶅彴浼犲叆 鍒ゆ柇姣忎釜id + */ + @TableField(exist = false) + private String parentId; + + /** + * 鍓嶅彴浼犲叆 杞﹂棿灞傜骇:1 閮ㄩ棬灞傜骇:2 + */ + @TableField(exist = false) + private String typeTree; + + /** + * 閮ㄩ棬parentId 鍏宠仈瀛愰泦id + */ + @TableField(exist = false) + private List<String> mdcSectionIds; + + @TableField(exist = false) + private String equipmentIds; + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcProcessQuantityMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcProcessQuantityMapper.java index b667bc1..93e6343 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcProcessQuantityMapper.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcProcessQuantityMapper.java @@ -2,7 +2,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import org.apache.ibatis.annotations.Param; +import org.jeecg.modules.mdc.dto.MdcProcessQuantityDto; import org.jeecg.modules.mdc.entity.MdcProcessQuantity; + +import java.util.List; /** * @Description: 鍔犲伐鏁伴噺琛� @@ -12,4 +18,29 @@ */ public interface MdcProcessQuantityMapper extends BaseMapper<MdcProcessQuantity> { + /** + * 鍒嗛〉鏌ヨ + * + * @param page + * @param mdcProcessQuantity + * @return + */ + IPage<MdcProcessQuantityDto> pageList(Page<MdcProcessQuantityDto> page, @Param("mdcProcessQuantity") MdcProcessQuantity mdcProcessQuantity); + + /** + * 瀵煎嚭鏁版嵁 + * + * @param mdcProcessQuantity + * @return + */ + List<MdcProcessQuantityDto> list(@Param("mdcProcessQuantity") MdcProcessQuantity mdcProcessQuantity); + + /** + * 鏍规嵁id鏌ヨ + * + * @param id + * @return + */ + MdcProcessQuantityDto findById(@Param("id") String id); + } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProcessQuantityMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProcessQuantityMapper.xml index f5add50..f484955 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProcessQuantityMapper.xml +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcProcessQuantityMapper.xml @@ -2,4 +2,127 @@ <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.mdc.mapper.MdcProcessQuantityMapper"> + <!--鍒嗛〉鏌ヨ--> + <select id="pageList" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto"> + SELECT + mpq.id id, + mspd.equipment_id equipmentId, + mspd.equipment_name equipmentName, + mspd.parts_code partsCode, + mspd.batch_code batchCode, + mspd.sequence_number sequenceNumber, + mpq.standard_id standardId, + mpq.efficient_date efficientDate, + mpq.process_quantity processQuantity, + mspd.duration duration, + mpq.remark remark, + mpq.create_by createBy, + mpq.create_time createTime, + mpq.update_by updateBy, + mpq.update_time updateTime + FROM mdc_process_quantity mpq LEFT JOIN mdc_standard_process_duration mspd ON mpq.standard_id = mspd.id + <where> + <if test="mdcProcessQuantity.equipmentId != null and mdcProcessQuantity.equipmentId != ''"> + AND mspd.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%') + </if> + <if test="mdcProcessQuantity.equipmentName != null and mdcProcessQuantity.equipmentName != ''"> + AND mspd.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%') + </if> + <if test="mdcProcessQuantity.partsCode != null and mdcProcessQuantity.partsCode != ''"> + AND mspd.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%') + </if> + <if test="mdcProcessQuantity.batchCode != null and mdcProcessQuantity.batchCode != ''"> + AND mspd.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%') + </if> + <if test="mdcProcessQuantity.sequenceNumber != null and mdcProcessQuantity.sequenceNumber != ''"> + AND mspd.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%') + </if> + <if test="mdcProcessQuantity.startTime != null and mdcProcessQuantity.endTime != null"> + AND mpq.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime } + </if> + <if test="mdcProcessQuantity.processQuantity != null and mdcProcessQuantity.processQuantity != ''"> + AND mpq.process_quantity = #{ mdcProcessQuantity.processQuantity } + </if> + <if test="mdcProcessQuantity.mdcSectionIds != null and mdcProcessQuantity.mdcSectionIds.size() > 0 "> + AND mspd.equipment_id IN + <foreach collection="mdcProcessQuantity.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> + #{ id } + </foreach> + </if> + </where> + ORDER BY mspd.equipment_name ASC, mpq.efficient_date DESC + </select> + + <!--瀵煎嚭鏁版嵁鏌ヨ--> + <select id="list" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto"> + SELECT + mpq.id id, + mspd.equipment_id equipmentId, + mspd.equipment_name equipmentName, + mspd.parts_code partsCode, + mspd.batch_code batchCode, + mspd.sequence_number sequenceNumber, + mpq.standard_id standardId, + mpq.efficient_date efficientDate, + mpq.process_quantity processQuantity, + mspd.duration duration, + mpq.remark remark, + mpq.create_by createBy, + mpq.create_time createTime, + mpq.update_by updateBy, + mpq.update_time updateTime + FROM mdc_process_quantity mpq LEFT JOIN mdc_standard_process_duration mspd ON mpq.standard_id = mspd.id + <where> + <if test="mdcProcessQuantity.equipmentId != null and mdcProcessQuantity.equipmentId != ''"> + AND mspd.equipment_id LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentId }),'%') + </if> + <if test="mdcProcessQuantity.equipmentName != null and mdcProcessQuantity.equipmentName != ''"> + AND mspd.equipment_name LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.equipmentName }),'%') + </if> + <if test="mdcProcessQuantity.partsCode != null and mdcProcessQuantity.partsCode != ''"> + AND mspd.parts_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.partsCode }),'%') + </if> + <if test="mdcProcessQuantity.batchCode != null and mdcProcessQuantity.batchCode != ''"> + AND mspd.batch_code LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.batchCode }),'%') + </if> + <if test="mdcProcessQuantity.sequenceNumber != null and mdcProcessQuantity.sequenceNumber != ''"> + AND mspd.sequence_number LIKE CONCAT(CONCAT('%',#{ mdcProcessQuantity.sequenceNumber }),'%') + </if> + <if test="mdcProcessQuantity.startTime != null and mdcProcessQuantity.endTime != null"> + AND mpq.efficient_date BETWEEN #{ mdcProcessQuantity.startTime } AND #{ mdcProcessQuantity.endTime } + </if> + <if test="mdcProcessQuantity.processQuantity != null and mdcProcessQuantity.processQuantity != ''"> + AND mpq.process_quantity = #{ mdcProcessQuantity.processQuantity } + </if> + <if test="mdcProcessQuantity.mdcSectionIds != null and mdcProcessQuantity.mdcSectionIds.size() > 0 "> + AND mspd.equipment_id IN + <foreach collection="mdcProcessQuantity.mdcSectionIds" item="id" index="index" open="(" close=")" separator=","> + #{ id } + </foreach> + </if> + </where> + ORDER BY mspd.equipment_name ASC, mpq.efficient_date DESC + </select> + + <!--鏍规嵁id鏌ヨ--> + <select id="findById" resultType="org.jeecg.modules.mdc.dto.MdcProcessQuantityDto"> + SELECT + mpq.id id, + mspd.equipment_id equipmentId, + mspd.equipment_name equipmentName, + mspd.parts_code partsCode, + mspd.batch_code batchCode, + mspd.sequence_number sequenceNumber, + mpq.standard_id standardId, + mpq.efficient_date efficientDate, + mpq.process_quantity processQuantity, + mspd.duration duration, + mpq.remark remark, + mpq.create_by createBy, + mpq.create_time createTime, + mpq.update_by updateBy, + mpq.update_time updateTime + FROM mdc_process_quantity mpq LEFT JOIN mdc_standard_process_duration mspd ON mpq.standard_id = mspd.id + WHERE mpq.id = { id } + </select> </mapper> \ No newline at end of file diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcProcessQuantityService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcProcessQuantityService.java index 312d553..2409658 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcProcessQuantityService.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcProcessQuantityService.java @@ -1,8 +1,14 @@ package org.jeecg.modules.mdc.service; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; +import org.jeecg.modules.mdc.dto.MdcProcessQuantityDto; import org.jeecg.modules.mdc.entity.MdcProcessQuantity; +import org.springframework.web.servlet.ModelAndView; + +import javax.servlet.http.HttpServletRequest; /** * @Description: 鍔犲伐鏁伴噺琛� @@ -12,4 +18,31 @@ */ public interface IMdcProcessQuantityService extends IService<MdcProcessQuantity> { + /** + * 鍒嗛〉鏌ヨ + * + * @param userId + * @param page + * @param mdcProcessQuantity + * @param req + * @return + */ + IPage<MdcProcessQuantityDto> pageList(String userId, Page<MdcProcessQuantityDto> page, MdcProcessQuantity mdcProcessQuantity, HttpServletRequest req); + + /** + * 瀵煎嚭 + * + * @param userId + * @param mdcProcessQuantity + * @return + */ + ModelAndView exportXls(String userId, MdcProcessQuantity mdcProcessQuantity); + + /** + * 鏍规嵁id鏌ヨ + * + * @param id + * @return + */ + MdcProcessQuantityDto findById(String id); } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java index 02b0f8c..6cbc674 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcProcessQuantityServiceImpl.java @@ -1,11 +1,28 @@ package org.jeecg.modules.mdc.service.impl; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import org.apache.commons.lang.StringUtils; +import org.apache.shiro.SecurityUtils; +import org.jeecg.common.system.vo.LoginUser; +import org.jeecg.modules.mdc.dto.MdcProcessQuantityDto; import org.jeecg.modules.mdc.entity.MdcProcessQuantity; import org.jeecg.modules.mdc.mapper.MdcProcessQuantityMapper; +import org.jeecg.modules.mdc.service.IMdcEquipmentService; import org.jeecg.modules.mdc.service.IMdcProcessQuantityService; +import org.jeecgframework.poi.excel.def.NormalExcelConstants; +import org.jeecgframework.poi.excel.entity.ExportParams; +import org.jeecgframework.poi.excel.view.JeecgEntityExcelView; import org.springframework.stereotype.Service; +import org.springframework.web.servlet.ModelAndView; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; /** @@ -17,4 +34,110 @@ @Service public class MdcProcessQuantityServiceImpl extends ServiceImpl<MdcProcessQuantityMapper, MdcProcessQuantity> implements IMdcProcessQuantityService { + @Resource + private IMdcEquipmentService mdcEquipmentService; + + /** + * 鍒嗛〉鏌ヨ + * + * @param userId + * @param page + * @param mdcProcessQuantity + * @param req + * @return + */ + @Override + public IPage<MdcProcessQuantityDto> pageList(String userId, Page<MdcProcessQuantityDto> page, MdcProcessQuantity mdcProcessQuantity, HttpServletRequest req) { + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(mdcProcessQuantity.getParentId()) && StringUtils.isEmpty(mdcProcessQuantity.getEquipmentId())) { + if ("2".equals(mdcProcessQuantity.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcProcessQuantity.getParentId()); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcProcessQuantity.getParentId()); + } + } else if (StringUtils.isNotEmpty(mdcProcessQuantity.getEquipmentId())) { + //鍗曞彴璁惧淇℃伅 + mdcProcessQuantity.setMdcSectionIds(Collections.singletonList(mdcProcessQuantity.getEquipmentId())); + } else { + //鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(mdcProcessQuantity.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + + if (mdcProcessQuantity.getMdcSectionIds() == null || mdcProcessQuantity.getMdcSectionIds().isEmpty()) { + mdcProcessQuantity.setMdcSectionIds(equipmentIds); + } + + if (mdcProcessQuantity.getMdcSectionIds() == null || mdcProcessQuantity.getMdcSectionIds().isEmpty()) { + return null; + } + return this.baseMapper.pageList(page, mdcProcessQuantity); + } + + /** + * 瀵煎嚭 + * + * @param userId + * @param mdcProcessQuantity + * @return + */ + @Override + public ModelAndView exportXls(String userId, MdcProcessQuantity mdcProcessQuantity) { + List<String> equipmentIds = new ArrayList<>(); + if (StringUtils.isNotEmpty(mdcProcessQuantity.getParentId()) && StringUtils.isEmpty(mdcProcessQuantity.getEquipmentId())) { + if ("2".equals(mdcProcessQuantity.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, mdcProcessQuantity.getParentId()); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, mdcProcessQuantity.getParentId()); + } + } else if (StringUtils.isNotEmpty(mdcProcessQuantity.getEquipmentId())) { + //鍗曞彴璁惧淇℃伅 + mdcProcessQuantity.setMdcSectionIds(Collections.singletonList(mdcProcessQuantity.getEquipmentId())); + } else { + //鏌ヨ鐢ㄦ埛鎷ユ湁鐨勬墍鏈夎澶囦俊鎭� + if ("2".equals(mdcProcessQuantity.getTypeTree())) { + //閮ㄩ棬灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsByDepart(userId, null); + } else { + //浜х嚎灞傜骇 + equipmentIds = mdcEquipmentService.getEquipmentIdsProduction(userId, null); + } + } + if (mdcProcessQuantity.getMdcSectionIds() == null || mdcProcessQuantity.getMdcSectionIds().isEmpty()) { + mdcProcessQuantity.setMdcSectionIds(equipmentIds); + } + if (mdcProcessQuantity.getMdcSectionIds() == null || mdcProcessQuantity.getMdcSectionIds().isEmpty()) { + return null; + } + // Step.2 AutoPoi 瀵煎嚭Excel + ModelAndView mv = new ModelAndView(new JeecgEntityExcelView()); + List<MdcProcessQuantityDto> processQuantityDtos = this.baseMapper.list(mdcProcessQuantity); + // 瀵煎嚭鏂囦欢鍚嶇О + mv.addObject(NormalExcelConstants.FILE_NAME, "鍔犲伐鏁伴噺鍒楄〃"); + mv.addObject(NormalExcelConstants.CLASS, MdcProcessQuantityDto.class); + //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 + //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ + LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("鍔犲伐鏁伴噺鍒楄〃鏁版嵁", "瀵煎嚭浜�:" + user.getRealname(), "瀵煎嚭淇℃伅")); + //update-end---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ + mv.addObject(NormalExcelConstants.DATA_LIST, processQuantityDtos); + return mv; + } + + /** + * 鏍规嵁id鏌ヨ + */ + @Override + public MdcProcessQuantityDto findById(String id) { + return this.baseMapper.findById(id); + } } diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java index 1f4b016..10e4607 100644 --- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java +++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcStandardProcessDurationServiceImpl.java @@ -144,7 +144,7 @@ List<MdcStandardProcessDuration> mdcStandardProcessDurations = this.baseMapper.selectList(queryWrapper); // 瀵煎嚭鏂囦欢鍚嶇О mv.addObject(NormalExcelConstants.FILE_NAME, "鏍囧噯鍔犲伐鏃堕棿鍒楄〃"); - mv.addObject(NormalExcelConstants.CLASS, MdcNoplanClose.class); + mv.addObject(NormalExcelConstants.CLASS, MdcStandardProcessDuration.class); //鑾峰彇褰撳墠鐧诲綍鐢ㄦ埛 //update-begin---author:wangshuai ---date:20211227 for锛歔JTC-116]瀵煎嚭浜哄啓姝讳簡------------ LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); -- Gitblit v1.9.3