Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system into dev
This commit is contained in:
commit
c146d42c8c
@ -44,4 +44,6 @@ public class CarMainRespVO extends CarMain {
|
||||
List<String> brandAndModel;
|
||||
/** 车辆类型 */
|
||||
private String brandType;
|
||||
/** 车辆logo */
|
||||
private String logoImg;
|
||||
}
|
@ -36,6 +36,7 @@
|
||||
SELECT
|
||||
<include refid="baseCarMainColumn"></include>,
|
||||
bcb.brand_name AS brandStr,
|
||||
bcb.logo_img AS logoImg,
|
||||
bcm.model_name AS modelStr
|
||||
FROM
|
||||
`base_car_main` tbcm
|
||||
@ -73,6 +74,9 @@
|
||||
<if test="dto.engineNumber != null and dto.engineNumber != ''">
|
||||
AND tbcm.engine_number LIKE CONCAT('%',#{dto.engineNumber},'%')
|
||||
</if>
|
||||
<if test="dto.userId != null and dto.userId != ''">
|
||||
AND tbcm.user_id = #{dto.userId}
|
||||
</if>
|
||||
ORDER BY
|
||||
tbcm.car_register_date DESC
|
||||
</select>
|
||||
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -207,7 +207,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairOrderInfo.setOrderTime(ticketsRespVO.getCreateTime());
|
||||
repairOrderInfo.setOrderStatus("0");
|
||||
repairOrderInfo.setPayMoney(ticketsRespVO.getTotalPrice());
|
||||
if (ObjectUtil.isNotEmpty(deptId)){
|
||||
repairOrderInfo.setDeptId(Integer.parseInt(deptId + ""));
|
||||
}
|
||||
|
||||
// 如果选择了预约还要更新预约记录
|
||||
if (ObjectUtil.isNotEmpty(ticketsRespVO.getBookingId())){
|
||||
|
@ -175,8 +175,8 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
.set(DlTicketWares::getStatus, respVO.getStatus())
|
||||
.eq(DlTicketWares::getId, respVO.getId())
|
||||
);
|
||||
// 如果是通过就还需要把配件信息加入到工单中
|
||||
if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02")){
|
||||
// 如果是通过并且是领料就还需要把配件信息加入到工单中
|
||||
if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02") && respVO.getType().equals("01")){
|
||||
// 更新维修工单
|
||||
// 计算配件的总价
|
||||
BigDecimal reduce = respVO.getWares().stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
@ -205,6 +205,49 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
|
||||
item.setItemStatus("08");
|
||||
});
|
||||
repairTitemService.saveBatch(respVO.getWares());
|
||||
}else if (ObjectUtil.isNotEmpty(respVO.getStatus()) && respVO.getStatus().equals("02") && respVO.getType().equals("02")){
|
||||
// 如果通过退料,也需要更新
|
||||
// 更新维修工单
|
||||
// 计算配件的总价
|
||||
BigDecimal reduce = respVO.getWares().stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
repairTicketsService.update(new LambdaUpdateWrapper<DlRepairTickets>()
|
||||
// 工单子项总数量增加上配件的数量
|
||||
.setSql("count = count - " + respVO.getWares().size())
|
||||
// 工单配件总价
|
||||
.setSql("part_price = part_price - " + reduce)
|
||||
// 工单总价
|
||||
.setSql("total_price = total_price - " + reduce)
|
||||
// 参考成本
|
||||
.setSql("cost = cost - " + reduce)
|
||||
// 参考毛利
|
||||
.setSql("profit = profit - " + reduce)
|
||||
// 领料状态
|
||||
.set(DlRepairTickets::getPartStatus, "02")
|
||||
.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());
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@ -257,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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user