修正配件相关实际数据与显示数据不一致问题
This commit is contained in:
parent
b66eed3a37
commit
fd93a730be
@ -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.service.DlRepairSoiService;
|
||||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO;
|
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoReqVO;
|
||||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
|
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoRespVO;
|
||||||
|
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
|
||||||
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiRespVO;
|
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiRespVO;
|
||||||
import cn.iocoder.yudao.module.supplier.service.BaseSupplierService;
|
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.DeptApi;
|
||||||
@ -348,21 +349,17 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
|||||||
if (update == 0) {
|
if (update == 0) {
|
||||||
throw exception0(500, "该领料单已有其他人操作");
|
throw exception0(500, "该领料单已有其他人操作");
|
||||||
}
|
}
|
||||||
// DlRepairSo dlRepairSo = new DlRepairSo();
|
|
||||||
// dlRepairSo.setId(id);
|
|
||||||
// dlRepairSo.setSoStatus(SoStatusEnum.PICKED.getCode());
|
|
||||||
// baseMapper.u
|
|
||||||
|
|
||||||
// 查最新的子表信息
|
// 查最新的子表信息
|
||||||
DlRepairSo so = baseMapper.selectById(id);
|
DlRepairSo so = baseMapper.selectById(id);
|
||||||
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, so.getTwId()));
|
List<DlRepairSoi> sois = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, id));
|
||||||
// 判断是部分完成还是全部完成----不需要判断了
|
Set<String> waresIds = sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toSet());
|
||||||
// DlTicketWares dlTicketWares = new DlTicketWares();
|
List<RepairWares> repairWares = repairWaresService.listByIds(waresIds);
|
||||||
// dlTicketWares.setId(so.getTwId());
|
List<DlRepairSoiRespVO> list = sois.stream().map(item -> {
|
||||||
// List<DlTwItem> flag = list.stream().filter(item -> !item.getWaresStatus().equals("01")).collect(Collectors.toList());
|
DlRepairSoiRespVO bean = BeanUtil.toBean(item, DlRepairSoiRespVO.class);
|
||||||
// dlTicketWares.setStatus(CollectionUtil.isEmpty(flag) ? "03" : "04");
|
repairWares.stream().filter(i -> i.getId().equals(item.getGoodsId())).findFirst().ifPresent(bean::setWares);
|
||||||
// 更新主表的状态
|
return bean;
|
||||||
// ticketWaresService.updateById(dlTicketWares);
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
// 通知仓库
|
// 通知仓库
|
||||||
repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), so.getUserName() + "已确认领料单:" + so.getSoNo());
|
repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), so.getUserName() + "已确认领料单:" + so.getSoNo());
|
||||||
@ -371,20 +368,24 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
|||||||
// 查配件申请表
|
// 查配件申请表
|
||||||
DlTicketWares byId = ticketWaresService.getById(so.getTwId());
|
DlTicketWares byId = ticketWaresService.getById(so.getTwId());
|
||||||
// 取当前操作人的名称
|
// 取当前操作人的名称
|
||||||
String remark = SecurityFrameworkUtils.getLoginUserNickname();
|
StringBuilder remark = new StringBuilder("确认领料: ");
|
||||||
// 构建备注
|
// 构建备注
|
||||||
/*
|
/*
|
||||||
谁,领了什么配件,领了多少个
|
谁,领了什么配件,领了多少个
|
||||||
*/
|
*/
|
||||||
List<String> nameAndCount = list.stream().map(item -> item.getWaresName() + "x" + item.getWaresCount()).collect(Collectors.toList());
|
for (int i = 0; i < list.size(); i++) {
|
||||||
remark += "确认领料" + String.join(";", nameAndCount);
|
DlRepairSoiRespVO item = list.get(i);
|
||||||
|
if (ObjectUtil.isNotEmpty(item.getWares())) {
|
||||||
|
remark.append(i + 1).append(".").append(item.getWares().getName()).append("x").append(item.getGoodsCount()).append("; ");
|
||||||
|
}
|
||||||
|
}
|
||||||
// 记录日志
|
// 记录日志
|
||||||
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.LL.getCode(), remark, image);
|
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.LL.getCode(), remark.toString(), image);
|
||||||
|
|
||||||
// 更新工单主表时间
|
// 更新工单主表时间
|
||||||
if (ObjectUtil.isNotEmpty(so) && ObjectUtil.isNotEmpty(so.getTwId())){
|
if (ObjectUtil.isNotEmpty(so) && ObjectUtil.isNotEmpty(so.getTwId())) {
|
||||||
DlTicketWares ticketWares = ticketWaresService.getById(so.getTwId());
|
DlTicketWares ticketWares = ticketWaresService.getById(so.getTwId());
|
||||||
if (ObjectUtil.isNotEmpty(ticketWares) && ObjectUtil.isNotEmpty(ticketWares.getTicketId())){
|
if (ObjectUtil.isNotEmpty(ticketWares) && ObjectUtil.isNotEmpty(ticketWares.getTicketId())) {
|
||||||
ticketsService.refreshUpdateTime(ticketWares.getTicketId());
|
ticketsService.refreshUpdateTime(ticketWares.getTicketId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -407,7 +408,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
|||||||
.ne(DlRepairSo::getSoStatus, SoStatusEnum.RETURNED.getCode())
|
.ne(DlRepairSo::getSoStatus, SoStatusEnum.RETURNED.getCode())
|
||||||
.ne(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode()))
|
.ne(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode()))
|
||||||
);
|
);
|
||||||
if (update == 0){
|
if (update == 0) {
|
||||||
throw exception0(500, "该退料单已有其他人操作");
|
throw exception0(500, "该退料单已有其他人操作");
|
||||||
}
|
}
|
||||||
// 查主表
|
// 查主表
|
||||||
@ -416,24 +417,35 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
|||||||
repairWorkerService.sentMessage(Long.valueOf(newSo.getCreator()), newSo.getUserName() + "已确认退料单:" + newSo.getSoNo());
|
repairWorkerService.sentMessage(Long.valueOf(newSo.getCreator()), newSo.getUserName() + "已确认退料单:" + newSo.getSoNo());
|
||||||
// 记录日志
|
// 记录日志
|
||||||
// 查子表信息
|
// 查子表信息
|
||||||
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, newSo.getTwId()));
|
List<DlRepairSoi> sois = repairSoiService.list(new LambdaQueryWrapper<DlRepairSoi>().eq(DlRepairSoi::getSoId, id));
|
||||||
|
Set<String> waresIds = sois.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toSet());
|
||||||
|
List<RepairWares> repairWares = repairWaresService.listByIds(waresIds);
|
||||||
|
List<DlRepairSoiRespVO> list = sois.stream().map(item -> {
|
||||||
|
DlRepairSoiRespVO bean = BeanUtil.toBean(item, DlRepairSoiRespVO.class);
|
||||||
|
repairWares.stream().filter(i -> i.getId().equals(item.getGoodsId())).findFirst().ifPresent(bean::setWares);
|
||||||
|
return bean;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
// 查申请表
|
// 查申请表
|
||||||
DlTicketWares byId = ticketWaresService.getById(newSo.getTwId());
|
DlTicketWares byId = ticketWaresService.getById(newSo.getTwId());
|
||||||
// 取当前操作人的名称
|
// 取当前操作人的名称
|
||||||
String remark = SecurityFrameworkUtils.getLoginUserNickname();
|
StringBuilder remark = new StringBuilder("确认退料: ");
|
||||||
// 构建备注
|
// 构建备注
|
||||||
/*
|
/*
|
||||||
谁,退了什么配件,退了多少个
|
谁,退了什么配件,退了多少个
|
||||||
*/
|
*/
|
||||||
List<String> nameAndCount = list.stream().map(item -> item.getWaresName() + "(" + item.getWaresCount() + ")").collect(Collectors.toList());
|
for (int i = 0; i < list.size(); i++) {
|
||||||
remark += "确认退料" + String.join(",", nameAndCount);
|
DlRepairSoiRespVO item = list.get(i);
|
||||||
|
if (ObjectUtil.isNotEmpty(item.getWares())) {
|
||||||
|
remark.append(i + 1).append(".").append(item.getWares().getName()).append("x").append(item.getGoodsCount()).append("; ");
|
||||||
|
}
|
||||||
|
}
|
||||||
// 记录日志
|
// 记录日志
|
||||||
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.TL.getCode(), remark, image);
|
recordsService.saveRepairRecord(byId.getTicketId(), null, RecordTypeEnum.TL.getCode(), remark.toString(), image);
|
||||||
|
|
||||||
// 更新工单主表时间
|
// 更新工单主表时间
|
||||||
if (ObjectUtil.isNotEmpty(newSo) && ObjectUtil.isNotEmpty(newSo.getTwId())){
|
if (ObjectUtil.isNotEmpty(newSo) && ObjectUtil.isNotEmpty(newSo.getTwId())) {
|
||||||
DlTicketWares ticketWares = ticketWaresService.getById(newSo.getTwId());
|
DlTicketWares ticketWares = ticketWaresService.getById(newSo.getTwId());
|
||||||
if (ObjectUtil.isNotEmpty(ticketWares) && ObjectUtil.isNotEmpty(ticketWares.getTicketId())){
|
if (ObjectUtil.isNotEmpty(ticketWares) && ObjectUtil.isNotEmpty(ticketWares.getTicketId())) {
|
||||||
ticketsService.refreshUpdateTime(ticketWares.getTicketId());
|
ticketsService.refreshUpdateTime(ticketWares.getTicketId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -440,13 +440,10 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
// 要操作的库存数据
|
// 要操作的库存数据
|
||||||
List<RepairWares> wares = repairWaresService.list(new LambdaQueryWrapper<RepairWares>().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())));
|
List<RepairWares> wares = repairWaresService.list(new LambdaQueryWrapper<RepairWares>().in(RepairWares::getId, respVO.getRepairSois().stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList())));
|
||||||
Map<String, String> waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId, RepairWares::getName));
|
Map<String, String> waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId, RepairWares::getName));
|
||||||
String remarkStr = "";
|
StringBuilder remarkStr = new StringBuilder();
|
||||||
for (DlRepairSoi item : respVO.getRepairSois()) {
|
for (int i = 0; i < respVO.getRepairSois().size(); i++) {
|
||||||
//组装通知领取配件的文字
|
DlRepairSoi repairSoi = respVO.getRepairSois().get(i);
|
||||||
if (!"".equals(remarkStr)) {
|
remarkStr.append(i + 1).append(".").append(waresNameMap.get(repairSoi.getGoodsId())).append("x").append(repairSoi.getGoodsCount()).append("; ");
|
||||||
remarkStr += ";";
|
|
||||||
}
|
|
||||||
remarkStr += waresNameMap.get(item.getGoodsId()) + "x" + item.getGoodsCount();
|
|
||||||
}
|
}
|
||||||
if (type.equals("02")) { // 领料
|
if (type.equals("02")) { // 领料
|
||||||
// 构造新数据
|
// 构造新数据
|
||||||
@ -511,7 +508,7 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
|||||||
//插入记录
|
//插入记录
|
||||||
//最后记录操作日志--创建工单
|
//最后记录操作日志--创建工单
|
||||||
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, "02".equals(type) ? RecordTypeEnum.TZLL.getCode() : RecordTypeEnum.TZTL.getCode(),
|
repairRecordsService.saveRepairRecord(respVO.getTicketId(), null, "02".equals(type) ? RecordTypeEnum.TZLL.getCode() : RecordTypeEnum.TZTL.getCode(),
|
||||||
("02".equals(type) ? "通知领料" : "通知退料") + ",配件明细:" + remarkStr, respVO.getImages());
|
("02".equals(type) ? "通知领料" : "通知退料") + ": " + remarkStr.toString(), respVO.getImages());
|
||||||
// 通知维修工
|
// 通知维修工
|
||||||
// 查维修工的userId
|
// 查维修工的userId
|
||||||
repairWorkerService.sentMessage(respVO.getRepairId(), type.equals("02") ? "您有新的领料单需要确认" : "您有新的退料单需要确认");
|
repairWorkerService.sentMessage(respVO.getRepairId(), type.equals("02") ? "您有新的领料单需要确认" : "您有新的退料单需要确认");
|
||||||
|
Loading…
Reference in New Issue
Block a user