From 8138a6f536b3f7a7156099f1dd82411598201c8f Mon Sep 17 00:00:00 2001 From: Vinjor Date: Thu, 21 Nov 2024 11:52:47 +0800 Subject: [PATCH] 1 --- .../admin/DlRepairSoController.java | 13 ++++++ .../stockOperate/mapper/DlRepairSoMapper.java | 10 +++++ .../service/DlRepairSoService.java | 11 +++-- .../service/impl/DlRepairSoServiceImpl.java | 41 ++++++++++++++++++- .../stockOperate/vo/DlRepairSoiRespVO.java | 14 +++++++ .../service/impl/DlTwItemServiceImpl.java | 28 +++++++++++++ .../module/tickets/vo/AppWaresGroupVO.java | 13 +++++- .../mapper/stockOperate/DlRepairSoMapper.xml | 29 +++++++++++++ .../mapper/tickets/DlTwItemMapper.xml | 5 +-- 9 files changed, 154 insertions(+), 10 deletions(-) diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java index 1ba3deef..0185b5be 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/controller/admin/DlRepairSoController.java @@ -88,6 +88,19 @@ public class DlRepairSoController { return success(dlRepairSoService.getRepairSoById(id)); } + /** + * 领料单、退料单APP查看 + * @author vinjor-M + * @date 11:10 2024/11/21 + * @param id 单据id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + @GetMapping("/getApp") + @Operation(summary = "采购单/领料单 查看") + public CommonResult getApp(@RequestParam("id") String id) { + return success(dlRepairSoService.getApp(id)); + } + /** * 员工确认领料 * diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/mapper/DlRepairSoMapper.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/mapper/DlRepairSoMapper.java index ed9ded4a..05bde9ad 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/mapper/DlRepairSoMapper.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/mapper/DlRepairSoMapper.java @@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.stockOperate.mapper; import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo; import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO; +import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiRespVO; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -30,6 +31,15 @@ public interface DlRepairSoMapper extends BaseMapper { * @return java.lang.Integer **/ Integer selectCountNum(@Param("type") String type,@Param("userId") Long userId,@Param("status") String status); + + /** + * 查单据配件明细 + * @author vinjor-M + * @date 11:13 2024/11/21 + * @param id 单据id + * @return java.util.List + **/ + List selectByIdGroup(@Param("id")String id); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/DlRepairSoService.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/DlRepairSoService.java index 91abf4fd..1d4f2f04 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/DlRepairSoService.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/DlRepairSoService.java @@ -7,9 +7,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.IService; -import java.util.List; -import java.util.Map; - /** * 针对表【dl_repair_so(采购单领料单)】的数据库操作Service * @@ -80,4 +77,12 @@ public interface DlRepairSoService extends IService { * @date 14:32 2024/10/24 **/ void inWare(DlRepairSoRespVO repairSoRespVO); + /** + * 领料单、退料单APP查看 + * @author vinjor-M + * @date 11:10 2024/11/21 + * @param id 单据id + * @return cn.iocoder.yudao.framework.common.pojo.CommonResult + **/ + Object getApp(String id); } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java index b9e6b85c..2d3c7f4d 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/service/impl/DlRepairSoServiceImpl.java @@ -20,6 +20,7 @@ import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService; import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService; import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO; import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO; +import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiRespVO; import cn.iocoder.yudao.module.supplier.service.BaseSupplierService; import cn.iocoder.yudao.module.system.api.dept.DeptApi; import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO; @@ -31,6 +32,7 @@ import cn.iocoder.yudao.module.tickets.service.DlRepairTicketsService; import cn.iocoder.yudao.module.tickets.service.DlRepairTitemService; import cn.iocoder.yudao.module.tickets.service.DlTicketWaresService; import cn.iocoder.yudao.module.tickets.service.DlTwItemService; +import cn.iocoder.yudao.module.tickets.vo.AppWaresGroupVO; import com.baomidou.dynamic.datasource.annotation.DSTransactional; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -48,7 +50,6 @@ import java.util.function.Function; import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0; /** * 针对表【dl_repair_so(采购单领料单)】的数据库操作Service实现 @@ -60,6 +61,8 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU public class DlRepairSoServiceImpl extends ServiceImpl implements DlRepairSoService { + @Resource + private DlRepairSoMapper dlRepairSoMapper; @Resource private DlRepairSoiService repairSoiService; @@ -508,6 +511,42 @@ public class DlRepairSoServiceImpl extends ServiceImpl + * @author vinjor-M + * @date 11:10 2024/11/21 + **/ + @Override + public Object getApp(String id) { + List dlRepairSoiRespVOList = dlRepairSoMapper.selectByIdGroup(id); + List waresGroupList = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(dlRepairSoiRespVOList)) { + //先过滤出itenTypeId为null或空,或者itemTypeName为null或空的,为单独一个组 + List nullList = dlRepairSoiRespVOList.stream().filter(item-> StringUtils.isEmpty(item.getTypeId()) || StringUtils.isEmpty(item.getTypeName())).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(nullList)) { + AppWaresGroupVO waresGroupVO = new AppWaresGroupVO(); + waresGroupVO.setSoiRespVOList(nullList); + waresGroupVO.setGroupName("未知分组"); + waresGroupVO.setNums(nullList.size()); + waresGroupList.add(waresGroupVO); + } + //过滤出有分类的进行分组 + Map> groupListMap = dlRepairSoiRespVOList.stream().filter(item->StringUtils.isNotEmpty(item.getTypeId()) && StringUtils.isNotEmpty(item.getTypeName())).collect(Collectors.groupingBy(DlRepairSoiRespVO::getTypeId)); + for (String key:groupListMap.keySet()){ + AppWaresGroupVO waresGroupVO = new AppWaresGroupVO(); + waresGroupVO.setSoiRespVOList(groupListMap.get(key)); + waresGroupVO.setGroupName(groupListMap.get(key).get(0).getTypeName()); + waresGroupVO.setGroupId(key); + waresGroupVO.setNums(groupListMap.get(key).size()); + waresGroupList.add(waresGroupVO); + } + } + return waresGroupList; + } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/vo/DlRepairSoiRespVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/vo/DlRepairSoiRespVO.java index 6c420e9d..fba22ccc 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/vo/DlRepairSoiRespVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/stockOperate/vo/DlRepairSoiRespVO.java @@ -4,6 +4,8 @@ import cn.iocoder.yudao.module.project.entity.RepairWares; import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi; import lombok.Data; +import java.math.BigDecimal; + /** * 采购单/领料单子表 响应VO * @author 小李 @@ -14,4 +16,16 @@ public class DlRepairSoiRespVO extends DlRepairSoi { /** 对应的配件信息 */ private RepairWares wares; + /** 配件分类id */ + private String typeId; + /** 配件分类名称 */ + private String typeName; + /** 配件名称 */ + private String goodsName; + /** 配件计量单位名称 */ + private String unitText; + /** 售价 */ + private BigDecimal salePrice; + /** 库存 */ + private Integer stock; } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTwItemServiceImpl.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTwItemServiceImpl.java index ca30ae54..ce56b33a 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTwItemServiceImpl.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/service/impl/DlTwItemServiceImpl.java @@ -137,31 +137,59 @@ public class DlTwItemServiceImpl extends ServiceImpl List nullList = dlTwItemRespVOList.stream().filter(item-> StringUtils.isEmpty(item.getTypeId()) || StringUtils.isEmpty(item.getTypeName())).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(nullList)) { AppWaresGroupVO waresGroupVO = new AppWaresGroupVO(); + //审核通过数量、不通过数量、待审核数量 + final int[] numArray= {0,0,0}; waresGroupVO.setTwItemList(nullList.stream().peek(item->{ if(StringUtils.isEmpty(item.getWaresStatus())){ + //待审核 + numArray[2]++; item.setSelected(false); }else{ + if("1".equals(item.getWaresStatus())){ + //通过 + numArray[0]++; + }else{ + //不通过 + numArray[1]++; + } item.setApprovalTime(item.getUpdateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); } }).collect(Collectors.toList())); waresGroupVO.setGroupName("未知分组"); waresGroupVO.setNums(nullList.size()); + waresGroupVO.setAllowNum(numArray[0]); + waresGroupVO.setNoNum(numArray[1]); + waresGroupVO.setWaitingNum(numArray[2]); waresGroupList.add(waresGroupVO); } //过滤出有分类的进行分组 Map> groupListMap = dlTwItemRespVOList.stream().filter(item->StringUtils.isNotEmpty(item.getTypeId()) && StringUtils.isNotEmpty(item.getTypeName())).collect(Collectors.groupingBy(DlTwItemRespVO::getTypeId)); for (String key:groupListMap.keySet()){ AppWaresGroupVO waresGroupVO = new AppWaresGroupVO(); + //审核通过数量、不通过数量、待审核数量 + final int[] numArray= {0,0,0}; waresGroupVO.setTwItemList(groupListMap.get(key).stream().peek(item->{ if(StringUtils.isEmpty(item.getWaresStatus())){ + //待审核 + numArray[2]++; item.setSelected(false); }else{ + if("1".equals(item.getWaresStatus())){ + //通过 + numArray[0]++; + }else{ + //不通过 + numArray[1]++; + } item.setApprovalTime(item.getUpdateTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); } }).collect(Collectors.toList())); waresGroupVO.setGroupName(groupListMap.get(key).get(0).getTypeName()); waresGroupVO.setGroupId(key); waresGroupVO.setNums(groupListMap.get(key).size()); + waresGroupVO.setAllowNum(numArray[0]); + waresGroupVO.setNoNum(numArray[1]); + waresGroupVO.setWaitingNum(numArray[2]); waresGroupList.add(waresGroupVO); } } diff --git a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AppWaresGroupVO.java b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AppWaresGroupVO.java index c6d0be4d..9f3b04ce 100644 --- a/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AppWaresGroupVO.java +++ b/dl-module-repair/src/main/java/cn/iocoder/yudao/module/tickets/vo/AppWaresGroupVO.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.tickets.vo; +import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiRespVO; import lombok.Data; import java.math.BigDecimal; @@ -16,13 +17,21 @@ public class AppWaresGroupVO { private String groupId; /** 分组名称(分类名称) */ private String groupName; - /** 数量--兼容待审核的配件数量 */ + /** 配件总数量 */ private Integer nums; /** 总价 */ private BigDecimal totalAmount; /** 配件明细 */ private List wares; - /** 配件申请单配件明细 */ private List twItemList; + /** 领料、退料单配件明细 */ + private List soiRespVOList; + + /** 审核通过数量-- */ + private Integer allowNum; + /** 待审核数量-- */ + private Integer waitingNum; + /** 审核不通过数量-- */ + private Integer noNum; } diff --git a/dl-module-repair/src/main/resources/mapper/stockOperate/DlRepairSoMapper.xml b/dl-module-repair/src/main/resources/mapper/stockOperate/DlRepairSoMapper.xml index 3f1476ad..e3efa60c 100644 --- a/dl-module-repair/src/main/resources/mapper/stockOperate/DlRepairSoMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/stockOperate/DlRepairSoMapper.xml @@ -101,4 +101,33 @@ AND so_status = #{status} AND deleted = 0 + diff --git a/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml b/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml index 2bbf3b12..1bd01b6f 100644 --- a/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml +++ b/dl-module-repair/src/main/resources/mapper/tickets/DlTwItemMapper.xml @@ -69,10 +69,7 @@ dl_tw_item dti LEFT JOIN dl_repair_wares drw ON dti.wares_id = drw.id LEFT JOIN dl_base_type dbt ON drw.type = dbt.id - LEFT JOIN system_dict_data sdd ON drw.unit = sdd. - VALUE - - AND sdd.dict_type = 'repair_unit' + LEFT JOIN system_dict_data sdd ON drw.unit = sdd.`value` AND sdd.dict_type = 'repair_unit' WHERE dti.deleted = '0'