1
This commit is contained in:
parent
43a059c63c
commit
fa45344904
@ -71,4 +71,13 @@ public interface RepairWaresService extends IService<RepairWares> {
|
||||
* @return java.util.List<java.util.Map<java.lang.String,java.lang.String>>
|
||||
**/
|
||||
List<Map<String,String>> getAllTypeList();
|
||||
|
||||
/**
|
||||
* 通过id查询集合
|
||||
* @author PQZ
|
||||
* @date 14:56 2024/10/24
|
||||
* @param idList waresId集合
|
||||
* @return java.util.List<cn.iocoder.yudao.module.project.entity.RepairWares>
|
||||
**/
|
||||
List<RepairWares> listByIds(List<String> idList);
|
||||
}
|
@ -114,4 +114,17 @@ public class RepairWaresServiceImpl extends ServiceImpl<RepairWaresMapper, Repai
|
||||
return waresMapper.selectAllType();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询集合
|
||||
*
|
||||
* @param idList waresId集合
|
||||
* @return java.util.List<cn.iocoder.yudao.module.project.entity.RepairWares>
|
||||
* @author PQZ
|
||||
* @date 14:56 2024/10/24
|
||||
**/
|
||||
@Override
|
||||
public List<RepairWares> listByIds(List<String> idList) {
|
||||
return baseMapper.selectBatchIds(idList);
|
||||
}
|
||||
|
||||
}
|
@ -112,6 +112,13 @@ public class DlRepairSo extends TenantBaseDO {
|
||||
/** 关联的配件申请单的id(dl_ticket_wares表的ID) */
|
||||
private String twId;
|
||||
|
||||
/** 关联主表id */
|
||||
private String mainId;
|
||||
|
||||
/** 关联主表名称 */
|
||||
private String mainTable;
|
||||
|
||||
|
||||
/**
|
||||
* 车牌号
|
||||
*/
|
||||
|
@ -31,7 +31,7 @@ public class DlRepairSoi extends TenantBaseDO {
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 采购单/领料单ID(dl_repair_so表的ID)
|
||||
* 采购单/领料单ID/入库单(dl_repair_so表的ID)
|
||||
*/
|
||||
private String soId;
|
||||
|
||||
@ -69,6 +69,14 @@ public class DlRepairSoi extends TenantBaseDO {
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 入库数量
|
||||
*/
|
||||
private Integer inCount;
|
||||
/**
|
||||
* 原始id
|
||||
*/
|
||||
private String rawId;
|
||||
|
||||
/**
|
||||
* 配件信息
|
||||
|
@ -1,6 +1,5 @@
|
||||
package cn.iocoder.yudao.module.stockOperate.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
|
||||
@ -10,16 +9,18 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_so(采购单领料单)】的数据库操作Service
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:09 2024/9/13
|
||||
**/
|
||||
**/
|
||||
public interface DlRepairSoService extends IService<DlRepairSo> {
|
||||
|
||||
/**
|
||||
* 采购单/领料单 新增
|
||||
*
|
||||
* @param repairSoRespVO 采购单对象
|
||||
* @author 小李
|
||||
* @date 10:49 2024/9/14
|
||||
* @param repairSoRespVO 采购单对象
|
||||
**/
|
||||
void createRepairSo(DlRepairSoRespVO repairSoRespVO);
|
||||
|
||||
@ -35,36 +36,45 @@ public interface DlRepairSoService extends IService<DlRepairSo> {
|
||||
/**
|
||||
* 采购单/领料单 作废
|
||||
*
|
||||
* @param repairSoReqVO 作废对象
|
||||
* @author 小李
|
||||
* @date 11:12 2024/9/18
|
||||
* @param repairSoReqVO 作废对象
|
||||
**/
|
||||
void voidRepairSo(DlRepairSoReqVO repairSoReqVO);
|
||||
|
||||
/**
|
||||
* 采购单/领料单 查看
|
||||
*
|
||||
* @param id 主键
|
||||
* @author 小李
|
||||
* @date 9:34 2024/9/22
|
||||
* @param id 主键
|
||||
**/
|
||||
DlRepairSoRespVO getRepairSoById(String id);
|
||||
|
||||
/**
|
||||
* 员工确认领料
|
||||
*
|
||||
* @param id 单据ID 领料单主表
|
||||
* @author 小李
|
||||
* @date 11:58 2024/10/21
|
||||
* @param id 单据ID 领料单主表
|
||||
**/
|
||||
void confirmGet(String id);
|
||||
|
||||
/**
|
||||
* 员工确认退料
|
||||
*
|
||||
* @param id 退料单主表ID
|
||||
* @author 小李
|
||||
* @date 19:41 2024/10/21
|
||||
* @param id 退料单主表ID
|
||||
**/
|
||||
void confirmBack(String id);
|
||||
|
||||
/**
|
||||
* 采购入库
|
||||
*
|
||||
* @param reqVO (接参实体中需传入:采购单id,子表中商品id,子表中入库数量inCount)
|
||||
* @author PQZ
|
||||
* @date 14:32 2024/10/24
|
||||
**/
|
||||
void inWare(DlRepairSoReqVO reqVO);
|
||||
}
|
||||
|
@ -11,35 +11,46 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 针对表【dl_repair_soi(采购单领料单子表)】的数据库操作Service
|
||||
*
|
||||
* @author 小李
|
||||
* @date 9:09 2024/9/13
|
||||
**/
|
||||
**/
|
||||
public interface DlRepairSoiService extends IService<DlRepairSoi> {
|
||||
|
||||
/**
|
||||
* 采购单领料单子表 分页
|
||||
*
|
||||
* @param repairSoiReqVO 查询对象
|
||||
* @author 小李
|
||||
* @date 10:44 2024/9/18
|
||||
* @param repairSoiReqVO 查询对象
|
||||
**/
|
||||
IPage<DlRepairSoi> getRepairSoiPage(DlRepairSoiReqVO repairSoiReqVO, Page<DlRepairSoi> page);
|
||||
|
||||
/**
|
||||
* 采购单领料单子表详细 按ID查
|
||||
*
|
||||
* @param ids ids
|
||||
* @author 小李
|
||||
* @date 11:24 2024/9/22
|
||||
* @param ids ids
|
||||
**/
|
||||
List<DlRepairSoiQueryRespVO> getRepairSoiByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 按主表ID查
|
||||
*
|
||||
* @param soId 主表ID
|
||||
* @author 小李
|
||||
* @date 11:22 2024/10/21
|
||||
* @param soId 主表ID
|
||||
**/
|
||||
List<DlRepairSoiQueryRespVO> getRepairSoiBySoId(String soId);
|
||||
|
||||
/**
|
||||
* 根据关联配件id查询关联配件
|
||||
*
|
||||
* @param ids 配件id集合
|
||||
* @return java.util.List<cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi>
|
||||
* @author PQZ
|
||||
* @date 14:39 2024/10/24
|
||||
**/
|
||||
List<DlRepairSoi> listByIds(List<String> ids);
|
||||
}
|
||||
|
@ -20,6 +20,8 @@ import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO;
|
||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
|
||||
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
|
||||
@ -39,10 +41,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ -90,6 +89,8 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
@Resource
|
||||
@Lazy
|
||||
private RepairWorkerService repairWorkerService;
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
/**
|
||||
* 采购单/领料单 新增
|
||||
@ -180,7 +181,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
|
||||
// 如果主表记录的领退料人与操作人一致,即是员工点击的作废,即需要通知仓库
|
||||
boolean flag = so.getUserId().equals(loginUserId);
|
||||
if (flag){
|
||||
if (flag) {
|
||||
repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), (so.getSoType().equals("02") ? "领料单:" : "退料单:") + so.getSoNo() + "已被" + so.getUserName() + "作废");
|
||||
}
|
||||
}
|
||||
@ -200,17 +201,17 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
|
||||
// 查子表
|
||||
List<DlRepairSoi> list = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, result.getId()));
|
||||
if(!list.isEmpty()){
|
||||
if (!list.isEmpty()) {
|
||||
//所有有配件的分类
|
||||
List<Map<String,String>> typeMapList = waresService.getAllTypeList();
|
||||
Map<String,String> typeMap = new HashMap<>();
|
||||
for(Map<String,String> map:typeMapList){
|
||||
typeMap.put(map.get("id"),map.get("name"));
|
||||
List<Map<String, String>> typeMapList = waresService.getAllTypeList();
|
||||
Map<String, String> typeMap = new HashMap<>();
|
||||
for (Map<String, String> map : typeMapList) {
|
||||
typeMap.put(map.get("id"), map.get("name"));
|
||||
}
|
||||
//关联查配件信息
|
||||
List<RepairWares> repairWaresList = waresService.listByIds(list.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList()));
|
||||
Map<String,RepairWares> waresMap = repairWaresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity()));
|
||||
list.forEach(item->{
|
||||
Map<String, RepairWares> waresMap = repairWaresList.stream().collect(Collectors.toMap(RepairWares::getId, Function.identity()));
|
||||
list.forEach(item -> {
|
||||
item.setWares(waresMap.get(item.getGoodsId()));
|
||||
item.setTypeName(typeMap.get(item.getWares().getType()));
|
||||
});
|
||||
@ -371,7 +372,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
if (CollectionUtil.isEmpty(updateTitems)) {
|
||||
titemService.updateBatchById(updateTitems);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
// 更新维修工单
|
||||
DlRepairTickets tickets = ticketsService.getOne(new LambdaQueryWrapper<DlRepairTickets>().eq(DlRepairTickets::getId, ticketWares.getTicketId()));
|
||||
@ -396,6 +397,83 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
// 通知仓库
|
||||
repairWorkerService.sentMessage(Long.valueOf(newSo.getCreator()), newSo.getUserName() + "已确认退料单:" + newSo.getSoNo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 采购入库
|
||||
*
|
||||
* @param reqVO (接参实体中需传入:采购单id,单据编号soNo,备注remark,入库总价totalPrice,子表中商品id,子表中入库数量inCount)
|
||||
* @author PQZ
|
||||
* @date 14:32 2024/10/24
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void inWare(DlRepairSoReqVO reqVO) {
|
||||
/*1、基础数据准备*/
|
||||
//获取当前登录用户
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
AdminUserRespDTO user = userApi.getUser(userId);
|
||||
//采购单
|
||||
DlRepairSo dlRepairSo = getById(reqVO.getId());
|
||||
//需要保存的入库单
|
||||
DlRepairSo inSo = new DlRepairSo();
|
||||
//过滤掉入库数量为null或0的情况(此为无效数据)
|
||||
List<DlRepairSoi> filterWare = reqVO.getSoiList().stream().filter(item -> item.getInCount() != null && item.getInCount() > 0).collect(Collectors.toList());
|
||||
//即将入库采购品
|
||||
List<DlRepairSoi> pmsWaresList = repairSoiService.listByIds(filterWare.stream().map(DlRepairSoi::getId).collect(Collectors.toList()));
|
||||
//初始化本次入库采购品
|
||||
List<DlRepairSoi> inWaresList = new ArrayList<>();
|
||||
//原始配件库相关配件
|
||||
List<RepairWares> waresList = waresService.listByIds(pmsWaresList.stream().map(DlRepairSoi::getWareId).collect(Collectors.toList()));
|
||||
|
||||
/*2、采购单转入库单*/
|
||||
//入库单关联采购单
|
||||
inSo.setMainId(dlRepairSo.getId());
|
||||
inSo.setMainTable("dl_repair_so");
|
||||
//05表示入库单
|
||||
inSo.setSoType("05");
|
||||
//入库单号
|
||||
inSo.setSoNo(reqVO.getSoNo());
|
||||
//入库人
|
||||
inSo.setUserId(userId);
|
||||
inSo.setUserName(user.getNickname());
|
||||
//入库时间
|
||||
inSo.setSoTime(new Date());
|
||||
//入库商品总价
|
||||
inSo.setTotalPrice(reqVO.getTotalPrice());
|
||||
save(inSo);
|
||||
|
||||
/*3、入库配件处理*/
|
||||
Map<String, DlRepairSoi> filterWareMap = filterWare.stream().collect(Collectors.toMap(DlRepairSoi::getId, soi -> soi));
|
||||
pmsWaresList.forEach(item -> {
|
||||
DlRepairSoi filterSoi = filterWareMap.get(item.getId());
|
||||
DlRepairSoi inWares = item;
|
||||
//采购单id
|
||||
inWares.setSoId(inSo.getId());
|
||||
//采购品原始id
|
||||
inWares.setRawId(item.getId());
|
||||
//入库数量
|
||||
inWares.setInCount(filterSoi.getInCount());
|
||||
inWares.setId(null);
|
||||
//采购品中入库数量字段累加
|
||||
item.setInCount(item.getInCount() == null?0:item.getInCount()+filterSoi.getInCount());
|
||||
inWaresList.add(inWares);
|
||||
});
|
||||
//更新采购品
|
||||
repairSoiService.updateBatchById(pmsWaresList);
|
||||
//新增入库采购品
|
||||
repairSoiService.saveBatch(inWaresList);
|
||||
|
||||
/*4、原始配件库处理*/
|
||||
Map<String, DlRepairSoi> wareMap = filterWare.stream().collect(Collectors.toMap(DlRepairSoi::getWareId, soi -> soi));
|
||||
waresList.forEach(item -> {
|
||||
DlRepairSoi filterSoi = wareMap.get(item.getId());
|
||||
item.setStock((item.getStock()==null?new BigDecimal(0):item.getStock()).add(new BigDecimal(filterSoi.getInCount())));
|
||||
});
|
||||
waresService.updateBatchById(waresList);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -107,6 +107,19 @@ public class DlRepairSoiServiceImpl extends ServiceImpl<DlRepairSoiMapper, DlRep
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关联配件id查询关联配件
|
||||
*
|
||||
* @param ids 配件id集合
|
||||
* @return java.util.List<cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi>
|
||||
* @author PQZ
|
||||
* @date 14:39 2024/10/24
|
||||
**/
|
||||
@Override
|
||||
public List<DlRepairSoi> listByIds(List<String> ids) {
|
||||
return baseMapper.selectBatchIds(ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
package cn.iocoder.yudao.module.stockOperate.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
|
||||
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@ -20,4 +22,7 @@ public class DlRepairSoReqVO extends DlRepairSo {
|
||||
@Schema(description = "时间区间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private Date[] searchTimeArray;
|
||||
|
||||
/**关联商品*/
|
||||
List<DlRepairSoi> soiList;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user