Compare commits

..

3 Commits

Author SHA1 Message Date
xiaofajia
0797e13704 11.22所提PC新功能暂不可用 2024-11-28 17:23:17 +08:00
xiaofajia
fd93a730be 修正配件相关实际数据与显示数据不一致问题 2024-11-28 14:30:00 +08:00
xiaofajia
b66eed3a37 暂提 2024-11-28 13:34:37 +08:00
8 changed files with 137 additions and 67 deletions

View File

@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiReqVO;
import cn.iocoder.yudao.module.stockOperate.vo.DlRepairSoiRespVO;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.GetMapping;
@ -88,5 +89,23 @@ public class DlRepairSoiController{
public CommonResult<?> getMapBySoIdAndQuery(@RequestParam("id") String id, @RequestParam("query") String query) {
return success(dlRepairSoiService.getMapBySoIdAndQuery(id, query));
}
/**
* 根据供应商查询该供应商采购过的配件 分页
*
* @author 小李
* @date 11:49 2024/11/28
* @param reqVO 查询对象
* @param pageNo 页码
* @param pageSize 条数
**/
@GetMapping("/getSoBySupplier")
@Operation(summary = "根据供应商查询该供应商采购过的配件 分页")
public CommonResult<?> getSoBySupplier(DlRepairSoiReqVO reqVO,
@RequestParam(value = "pageNo", defaultValue = "1")Integer pageNo,
@RequestParam(value = "pageSize", defaultValue = "10")Integer pageSize){
Page<DlRepairSoiRespVO> page = new Page<>(pageNo, pageSize);
return success(dlRepairSoiService.getSoBySupplier(reqVO, page));
}
}

View File

@ -36,6 +36,15 @@ public interface DlRepairSoiMapper extends BaseMapper<DlRepairSoi> {
* @param id id
**/
List<DlRepairSoiRespVO> getMapBySoIdAndQuery(@Param("id") String id, @Param("query") String query);
/**
* 根据供应商查询该供应商采购过的配件
*
* @author 小李
* @date 11:49 2024/11/28
* @param reqVO 查询对象
**/
IPage<DlRepairSoiRespVO> getSoBySupplier(@Param("map") DlRepairSoiReqVO reqVO, Page<DlRepairSoiRespVO> page);
}

View File

@ -64,4 +64,13 @@ public interface DlRepairSoiService extends IService<DlRepairSoi> {
* @param id id
**/
Map<String, List<DlRepairSoiRespVO>> getMapBySoIdAndQuery(String id, String query);
/**
* 根据供应商查询该供应商采购过的配件
*
* @author 小李
* @date 11:49 2024/11/28
* @param reqVO 查询对象
**/
IPage<DlRepairSoiRespVO> getSoBySupplier(DlRepairSoiReqVO reqVO, Page<DlRepairSoiRespVO> page);
}

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.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;
@ -120,14 +121,6 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
@Override
public void createRepairSo(DlRepairSoRespVO repairSoRespVO) {
repairSoRespVO.setSoTime(new Date());
// 加个判断可能出现没有设置价格的情况----需求说了非必填注掉
// if (repairSoRespVO.getGoodsList() != null){
// repairSoRespVO.getGoodsList().forEach(item -> {
// if (item.getGoodsPrice() == null){
// throw exception0(500, "有配件未设置进价");
// }
// });
// }
//保存供应商
if (StringUtils.isEmpty(repairSoRespVO.getSupplierId())) {
//采购单中录入供应商或无供应商情况
@ -163,7 +156,6 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
}
repairSoRespVO.getGoodsList().forEach(item -> {
item.setSoId(repairSoRespVO.getId());
// item.setSoiType(repairSoRespVO.getSoType());
});
repairSoiService.saveBatch(repairSoRespVO.getGoodsList());
@ -171,30 +163,6 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
// 前端选择了配件生成采购单的时候可能会改配件的一些信息但不知道会改什么直接拿到全部重新更新
List<RepairWares> waresList = repairSoRespVO.getWaresList();
waresService.updateBatchById(waresList);
// 操作配件库存表---应该是弃用了
// 获取所有需要操作的数据----生成采购单的时候不直接操作库存放到下面的inWares方法去操作
// if (repairSoRespVO.getSoType() != null && !repairSoRespVO.getSoType().equals("01")){
// List<DlRepairSoi> goodsList = repairSoRespVO.getGoodsList();
// List<String> ids = goodsList.stream().map(DlRepairSoi::getGoodsId).collect(Collectors.toList());
// List<RepairWares> repairWares = waresService.listByIds(ids);
// // 更新库存和进价
// List<RepairWares> newWares = repairWares.stream().map(item -> {
// // 取数据
// DlRepairSoi repairSoi = goodsList.stream().filter(i -> i.getGoodsId().equals(item.getId())).collect(Collectors.toList()).get(0);
// // 设置新值
// // 如果是采购入库数量+如果是领料出库数量-
// // 01, 03 是采购 02 是领料
// BigDecimal count = new BigDecimal(repairSoi.getGoodsCount());
// RepairWares wares = new RepairWares();
// wares.setId(item.getId());
// wares.setStock("02".equals(repairSoRespVO.getSoType()) ? item.getStock().subtract(count) : item.getStock().add(count));
// // 更新进价
// wares.setPurPrice(repairSoi.getGoodsPrice());
// return wares;
// }).collect(Collectors.toList());
// waresService.updateBatchById(newWares);
// }
}
/**
@ -348,21 +316,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,20 +335,24 @@ 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())){
if (ObjectUtil.isNotEmpty(so) && ObjectUtil.isNotEmpty(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());
}
}
@ -407,7 +375,7 @@ public class DlRepairSoServiceImpl extends ServiceImpl<DlRepairSoMapper, DlRepai
.ne(DlRepairSo::getSoStatus, SoStatusEnum.RETURNED.getCode())
.ne(DlRepairSo::getSoStatus, SoStatusEnum.DEPRECATED.getCode()))
);
if (update == 0){
if (update == 0) {
throw exception0(500, "该退料单已有其他人操作");
}
// 查主表
@ -416,24 +384,35 @@ 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())){
if (ObjectUtil.isNotEmpty(newSo) && ObjectUtil.isNotEmpty(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());
}
}

View File

@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sun.xml.bind.v2.TODO;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -166,6 +167,18 @@ public class DlRepairSoiServiceImpl extends ServiceImpl<DlRepairSoiMapper, DlRep
}
return result;
}
/**
* 根据供应商查询该供应商采购过的配件
*
* @author 小李
* @date 11:49 2024/11/28
* @param reqVO 查询对象
**/
@Override
public IPage<DlRepairSoiRespVO> getSoBySupplier(DlRepairSoiReqVO reqVO, Page<DlRepairSoiRespVO> page){
return baseMapper.getSoBySupplier(reqVO, page);
}
}

View File

@ -29,4 +29,7 @@ public class DlRepairSoiReqVO extends DlRepairSoi {
@Schema(pattern = "查询关键字")
private String query;
/** 供应商ID */
private String supplierId;
}

View File

@ -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") ? "您有新的领料单需要确认" : "您有新的退料单需要确认");

View File

@ -148,4 +148,45 @@
)
</if>
</select>
<select id="getSoBySupplier" resultMap="SoiAndWares">
select drsi.*,
drw.id AS wares_id,
drw.bar_code,
drw.code,
drw.name,
drw.model,
drw.price,
drw.pur_price,
drw.type,
drw.unit,
drw.warehouse,
drw.mini_stock,
drw.max_stock,
drw.stock,
drw.img,
drw.attribute,
drw.corp_id,
drw.cover_img,
drw.car_model,
drw.remark AS wares_remark,
drw.status,
drw.data_form
from dl_repair_soi drsi
join dl_repair_so drs on drsi.so_id = drs.id
join dl_repair_wares drw on drsi.goods_id = drw.id
where drs.so_type = '02'
<if test="map.supplierId != null and map.supplierId != ''">
and drs.supplier_id = #{map.supplierId}
</if>
<if test="map.query != null and map.query != ''">
and (
drw.name like concat('%', #{map.query}, '%')
or
drw.code like concat('%', #{map.query}, '%')
or
drw.model like concat('%', #{map.query}, '%')
)
</if>
</select>
</mapper>