修正配件相关实际数据与显示数据不一致问题
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.vo.DlRepairSoReqVO;
|
||||
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.supplier.service.BaseSupplierService;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
@ -348,21 +349,17 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
if (update == 0) {
|
||||
throw exception0(500, "该领料单已有其他人操作");
|
||||
}
|
||||
// DlRepairSo dlRepairSo = new DlRepairSo();
|
||||
// dlRepairSo.setId(id);
|
||||
// dlRepairSo.setSoStatus(SoStatusEnum.PICKED.getCode());
|
||||
// baseMapper.u
|
||||
|
||||
// 查最新的子表信息
|
||||
DlRepairSo so = baseMapper.selectById(id);
|
||||
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, so.getTwId()));
|
||||
// 判断是部分完成还是全部完成----不需要判断了
|
||||
// DlTicketWares dlTicketWares = new DlTicketWares();
|
||||
// dlTicketWares.setId(so.getTwId());
|
||||
// List<DlTwItem> flag = list.stream().filter(item -> !item.getWaresStatus().equals("01")).collect(Collectors.toList());
|
||||
// dlTicketWares.setStatus(CollectionUtil.isEmpty(flag) ? "03" : "04");
|
||||
// 更新主表的状态
|
||||
// ticketWaresService.updateById(dlTicketWares);
|
||||
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());
|
||||
|
||||
// 通知仓库
|
||||
repairWorkerService.sentMessage(Long.valueOf(so.getCreator()), so.getUserName() + "已确认领料单:" + so.getSoNo());
|
||||
@ -371,15 +368,19 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
// 查配件申请表
|
||||
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());
|
||||
remark += "确认领料" + String.join(";", nameAndCount);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
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())) {
|
||||
@ -416,19 +417,30 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
|
||||
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());
|
||||
// 取当前操作人的名称
|
||||
String remark = SecurityFrameworkUtils.getLoginUserNickname();
|
||||
StringBuilder remark = new StringBuilder("确认退料: ");
|
||||
// 构建备注
|
||||
/*
|
||||
谁,退了什么配件,退了多少个
|
||||
*/
|
||||
List<String> nameAndCount = list.stream().map(item -> item.getWaresName() + "(" + item.getWaresCount() + ")").collect(Collectors.toList());
|
||||
remark += "确认退料" + String.join(",", nameAndCount);
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
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())) {
|
||||
|
@ -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())));
|
||||
Map<String, String> waresNameMap = wares.stream().collect(Collectors.toMap(RepairWares::getId, RepairWares::getName));
|
||||
String remarkStr = "";
|
||||
for (DlRepairSoi item : respVO.getRepairSois()) {
|
||||
//组装通知领取配件的文字
|
||||
if (!"".equals(remarkStr)) {
|
||||
remarkStr += ";";
|
||||
}
|
||||
remarkStr += waresNameMap.get(item.getGoodsId()) + "x" + item.getGoodsCount();
|
||||
StringBuilder remarkStr = new StringBuilder();
|
||||
for (int i = 0; i < respVO.getRepairSois().size(); i++) {
|
||||
DlRepairSoi repairSoi = respVO.getRepairSois().get(i);
|
||||
remarkStr.append(i + 1).append(".").append(waresNameMap.get(repairSoi.getGoodsId())).append("x").append(repairSoi.getGoodsCount()).append("; ");
|
||||
}
|
||||
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(),
|
||||
("02".equals(type) ? "通知领料" : "通知退料") + ",配件明细:" + remarkStr, respVO.getImages());
|
||||
("02".equals(type) ? "通知领料" : "通知退料") + ": " + remarkStr.toString(), respVO.getImages());
|
||||
// 通知维修工
|
||||
// 查维修工的userId
|
||||
repairWorkerService.sentMessage(respVO.getRepairId(), type.equals("02") ? "您有新的领料单需要确认" : "您有新的退料单需要确认");
|
||||
|
Loading…
Reference in New Issue
Block a user