仓库处理申请、员工确认领料

This commit is contained in:
xiaofajia 2024-10-16 22:39:03 +08:00
parent b6b9395031
commit 51fad285f6
8 changed files with 142 additions and 0 deletions

View File

@ -16,4 +16,6 @@ public class RepairConstants {
public static final String REPAIR_STAFF = "维修工";
public static final String REPAIR_WAREHOUSE = "维修仓库管理员";
}

View File

@ -87,5 +87,33 @@ public class DlTicketWaresController {
dlTicketWaresService.auditTicketWares(respVO);
return CommonResult.ok();
}
/**
* 仓库通知领料
*
* @author 小李
* @date 20:45 2024/10/16
* @param respVO 请求对象
**/
@PostMapping("/pass")
@Operation(summary = "仓库通知领料")
public CommonResult<?> passTicketWares(@RequestBody DlTicketWaresRespVO respVO){
dlTicketWaresService.passTicketWares(respVO);
return CommonResult.ok();
}
/**
* 员工确认领料
*
* @author 小李
* @date 22:07 2024/10/16
* @param respVO 请求对象
**/
@PostMapping("/repairPass")
@Operation(summary = "员工确认领料")
public CommonResult<?> repairPassTicketWares(@RequestBody DlTicketWaresRespVO respVO){
dlTicketWaresService.repairPassTicketWares(respVO);
return CommonResult.ok();
}
}

View File

@ -50,4 +50,22 @@ public interface DlTicketWaresService extends IService<DlTicketWares> {
* @param respVO 请求对象
**/
void auditTicketWares(DlTicketWaresRespVO respVO);
/**
* 仓库通知领料
*
* @author 小李
* @date 20:45 2024/10/16
* @param respVO 请求对象
**/
void passTicketWares(DlTicketWaresRespVO respVO);
/**
* 员工确认领料
*
* @author 小李
* @date 22:07 2024/10/16
* @param respVO 请求对象
**/
void repairPassTicketWares(DlTicketWaresRespVO respVO);
}

View File

@ -452,6 +452,10 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
if (names.contains(RepairConstants.REPAIR_STAFF)){
return 4;
}
// 维修仓库管理员
if(names.contains(RepairConstants.REPAIR_WAREHOUSE)){
return 5;
}
// 啥也不是
return -1;
}

View File

@ -7,6 +7,9 @@ import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
import cn.iocoder.yudao.module.project.entity.RepairWares;
import cn.iocoder.yudao.module.project.service.RepairWaresService;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoService;
import cn.iocoder.yudao.module.stockOperate.service.DlRepairSoiService;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTickets;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
@ -61,6 +64,14 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
@Lazy
private DlRepairTitemService repairTitemService;
@Resource
@Lazy
private DlRepairSoService repairSoService;
@Resource
@Lazy
private DlRepairSoiService repairSoiService;
/**
* 分页查询
*
@ -95,6 +106,11 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
case 4:
reqVO.setUserIds(Collections.singletonList(SecurityFrameworkUtils.getLoginUserId()));
break;
// 维修仓库管理员
case 5:
reqVO.setStatus(null);
reqVO.setUserRole(5);
break;
}
return baseMapper.getPage(reqVO, page);
}
@ -186,6 +202,60 @@ public class DlTicketWaresServiceImpl extends ServiceImpl<DlTicketWaresMapper, D
repairTitemService.saveBatch(respVO.getWares());
}
}
/**
* 仓库通知领料
*
* @author 小李
* @date 20:45 2024/10/16
* @param respVO 请求对象
**/
@Override
@DSTransactional
public void passTicketWares(DlTicketWaresRespVO respVO){
// 查工单子表中的配件信息
List<DlRepairTitem> list = repairTitemService.list(new LambdaQueryWrapper<DlRepairTitem>()
.eq(DlRepairTitem::getTicketId, respVO.getTicketId())
.in(DlRepairTitem::getPartId, respVO.getRepairSois()
.stream()
.map(DlRepairSoi::getGoodsId)
.collect(Collectors.toList())));
// 计算总价
BigDecimal reduce = list.stream().map(DlRepairTitem::getItemMoney).reduce(BigDecimal.ZERO, BigDecimal::add);
respVO.getRepairSo().setItemCount(list.size());
respVO.getRepairSo().setTotalPrice(reduce);
// 生成领料单
repairSoService.save(respVO.getRepairSo());
// 生成领料单子表
respVO.getRepairSois().forEach(item -> {
item.setSoId(respVO.getRepairSo().getId());
DlRepairTitem titem = list.stream().filter(i -> i.getPartId().equals(item.getGoodsId())).collect(Collectors.toList()).get(0);
item.setGoodsPrice(titem.getItemPrice());
});
repairSoiService.saveBatch(respVO.getRepairSois());
// 更新领料申请子表
twItemService.updateBatchById(respVO.getItems());
}
/**
* 员工确认领料
*
* @author 小李
* @date 22:07 2024/10/16
* @param respVO 请求对象
**/
@Override
@DSTransactional
public void repairPassTicketWares(DlTicketWaresRespVO respVO){
// 更新领料申请子表
twItemService.updateBatchById(respVO.getItems());
// 更新领料申请表
// 判断是全部完成完成部分完成
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());
respVO.setStatus(list1.size() == list.size() ? "03" : "04");
baseMapper.updateById(respVO);
}
}

View File

@ -19,4 +19,7 @@ public class DlTicketWaresReqVO extends DlTicketWares {
/** 查询的时候用,班组长和维修工 */
private List<Long> userIds;
/** 角色 */
private Integer userRole;
}

View File

@ -1,5 +1,7 @@
package cn.iocoder.yudao.module.tickets.vo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSo;
import cn.iocoder.yudao.module.stockOperate.entity.DlRepairSoi;
import cn.iocoder.yudao.module.tickets.entity.DlRepairTitem;
import cn.iocoder.yudao.module.tickets.entity.DlTicketWares;
import cn.iocoder.yudao.module.tickets.entity.DlTwItem;
@ -21,4 +23,10 @@ public class DlTicketWaresRespVO extends DlTicketWares {
/** 工单子表需要的记录 */
private List<DlRepairTitem> wares;
/** 领料、采购单 */
private DlRepairSo repairSo;
/** 领料、采购单子表 */
private List<DlRepairSoi> repairSois;
}

View File

@ -56,6 +56,15 @@
</foreach>
)
</if>
<if test="map.userRole != null">
and (
<choose>
<when test="map.userRole == 5">
dtw.status not in ('01', '05', '03')
</when>
</choose>
)
</if>
<if test="map.adviserId != null and map.adviserId != ''">
and (dtw.adviser_id = #{map.adviserId})
</if>