This commit is contained in:
xiaofajia 2024-10-17 23:40:19 +08:00
parent fd4e95a52c
commit 99cd47d28e
4 changed files with 61 additions and 4 deletions

View File

@ -115,5 +115,19 @@ public class DlTicketWaresController {
dlTicketWaresService.repairPassTicketWares(respVO);
return CommonResult.ok();
}
/**
* 仓库确认退料
*
* @author 小李
* @date 22:03 2024/10/17
* @param respVO 请求对象
**/
@PostMapping("/passBack")
@Operation(summary = "仓库确认退料")
public CommonResult<?> passBackTicketWares(@RequestBody DlTicketWaresRespVO respVO){
dlTicketWaresService.passBackTicketWares(respVO);
return CommonResult.ok();
}
}

View File

@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.tickets.vo.DlTwItemReqVO;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;

View File

@ -68,4 +68,13 @@ public interface DlTicketWaresService extends IService<DlTicketWares> {
* @param respVO 请求对象
**/
void repairPassTicketWares(DlTicketWaresRespVO respVO);
/**
* 仓库确认退料
*
* @author 小李
* @date 22:03 2024/10/17
* @param respVO 请求对象
**/
void passBackTicketWares(DlTicketWaresRespVO respVO);
}

View File

@ -226,8 +226,28 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
.eq(DlRepairTickets::getId, respVO.getTicketId())
);
// 维修工单子表对应的数据更新
// 先查数据出来
List<DlRepairTitem> list = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>().and(i -> {
i.eq(DlRepairTitem::getTicketId, respVO.getTicketId())
.in(DlRepairTitem::getPartId, respVO.getWares().stream().map(DlRepairTitem::getPartId).collect(Collectors.toList()));
}));
list.forEach(item -> {
respVO.getWares().stream().filter(i -> i.getPartId().equals(item.getPartId())).findFirst().ifPresent(i -> {
// 如果只是退部分就减少数量
if (!i.getItemCount().equals(item.getItemCount())){
repairTitemService.update(new LambdaUpdateWrapper<DlRepairTitem>()
.setSql("item_count = item_count - " + i.getItemCount())
.setSql("item_money = item_money - " + i.getItemMoney())
.and(x -> {
x.eq(DlRepairTitem::getTicketId, respVO.getTicketId()).eq(DlRepairTitem::getPartId, item.getPartId());
})
);
}else {
// 如果是全部退了就直接删掉数据
repairTitemService.removeById(item.getId());
}
});
});
}
}
@ -280,17 +300,30 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
// 更新领料申请表
// 判断是全部完成完成部分完成
List<DlTwItem> list = twItemService.list(new LambdaQueryWrapper<DlTwItem>().eq(DlTwItem::getTwId, respVO.getId()));
List<DlTwItem> list1 = list.stream().filter(item -> item.getWaresStatus().equals("01")).collect(Collectors.toList());
List<DlTwItem> list1 = list.stream().filter(item -> item.getWaresStatus().equals(respVO.getType().equals("01") ? "01" : "03")).collect(Collectors.toList());
respVO.setStatus(list1.size() == list.size() ? "03" : "04");
baseMapper.updateById(respVO);
// 操作库存
list.forEach(item -> {
repairWaresService.update(new LambdaUpdateWrapper<RepairWares>()
.setSql("stock = stock - " + item.getWaresCount())
.setSql("stock = stock" + (respVO.getType().equals("01") ? "-" : "+") + item.getWaresCount())
.eq(RepairWares::getId, item.getWaresId())
);
});
}
/**
* 仓库确认退料
*
* @author 小李
* @date 22:03 2024/10/17
* @param respVO 请求对象
**/
@Override
public void passBackTicketWares(DlTicketWaresRespVO respVO){
// 更新申请单子表状态
twItemService.updateBatchById(respVO.getItems());
}
}