This commit is contained in:
Vinjor 2024-11-21 11:52:47 +08:00
parent 977fb20920
commit 8138a6f536
9 changed files with 154 additions and 10 deletions

View File

@ -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));
}
/**
* 员工确认领料
*

View File

@ -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<DlRepairSo> {
* @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<cn.iocoder.yudao.module.tickets.vo.AppWaresGroupVO>
**/
List<DlRepairSoiRespVO> selectByIdGroup(@Param("id")String id);
}

View File

@ -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<DlRepairSo> {
* @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);
}

View File

@ -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<DlRepairSoMapper, DlRepairSo>
implements DlRepairSoService {
@Resource
private DlRepairSoMapper dlRepairSoMapper;
@Resource
private DlRepairSoiService repairSoiService;
@ -508,6 +511,42 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
}).collect(Collectors.toList());
waresService.updateBatchById(newWares);
}
/**
* 领料单退料单APP查看
*
* @param id 单据id
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
* @author vinjor-M
* @date 11:10 2024/11/21
**/
@Override
public Object getApp(String id) {
List<DlRepairSoiRespVO> dlRepairSoiRespVOList = dlRepairSoMapper.selectByIdGroup(id);
List<AppWaresGroupVO> waresGroupList = new ArrayList<>();
if (CollectionUtil.isNotEmpty(dlRepairSoiRespVOList)) {
//先过滤出itenTypeId为null或空或者itemTypeName为null或空的为单独一个组
List<DlRepairSoiRespVO> 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<String,List<DlRepairSoiRespVO>> 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;
}
}

View File

@ -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;
}

View File

@ -137,31 +137,59 @@ public class DlTwItemServiceImpl extends ServiceImpl<DlTwItemMapper, DlTwItem>
List<DlTwItemRespVO> 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<String,List<DlTwItemRespVO>> 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);
}
}

View File

@ -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<DlRepairTitemReqVO> wares;
/** 配件申请单配件明细 */
private List<DlTwItemRespVO> twItemList;
/** 领料、退料单配件明细 */
private List<DlRepairSoiRespVO> soiRespVOList;
/** 审核通过数量-- */
private Integer allowNum;
/** 待审核数量-- */
private Integer waitingNum;
/** 审核不通过数量-- */
private Integer noNum;
}

View File

@ -101,4 +101,33 @@
AND so_status = #{status}
AND deleted = 0
</select>
<select id="selectByIdGroup" resultType="cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiRespVO">
SELECT
drs.id,
drs.so_id,
drs.raw_id,
drs.soi_type,
drs.goods_id,
drs.goods_type,
drs.ware_id,
drs.goods_count,
drs.in_count,
drs.goods_price,
drs.remark,
drw.type AS type_id,
drw.name AS goods_name,
dbt.`name` AS type_name,
drw.price AS sale_price,
drw.stock AS stock,
sdd.label AS unit_text
FROM
dl_repair_soi drs
LEFT JOIN dl_repair_wares drw ON drs.goods_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'
WHERE
drs.deleted = '0'
AND drs.so_id=#{id}
</select>
</mapper>

View File

@ -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'
<if test="map.twId != null and map.twId != ''">