| | |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmOutStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductSalesStatusEnum; |
| | | import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; |
| | | import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; |
| | | import cn.iocoder.yudao.module.crm.api.customer.CrmCustomerApi; |
| | | import cn.iocoder.yudao.module.erp.api.sale.ErpSaleOrderApi; |
| | | import cn.iocoder.yudao.module.erp.api.sale.dto.ErpSaleOrderItemRespDTO; |
| | | import cn.iocoder.yudao.module.erp.api.sale.dto.ErpSaleOrderRespDTO; |
| | |
| | | @Resource |
| | | private MesWmSalesNoticeLineService salesNoticeLineService; |
| | | @Resource |
| | | private MesMdClientService clientService; |
| | | private CrmCustomerApi customerApi; |
| | | |
| | | @Resource |
| | | private ErpSaleOrderApi saleOrderApi; |
| | |
| | | |
| | | @Override |
| | | public MesWmSalesNoticeDO getSalesNotice(Long id) { |
| | | return salesNoticeMapper.selectById(id); |
| | | MesWmSalesNoticeDO notice = salesNoticeMapper.selectById(id); |
| | | // 校验客户权限 |
| | | if (notice != null && notice.getClientId() != null) { |
| | | List<Long> permittedIds = customerApi.getPermittedCustomerIds(); |
| | | if (permittedIds != null && !permittedIds.contains(notice.getClientId())) { |
| | | return null; // 无权限则返回 null |
| | | } |
| | | } |
| | | return notice; |
| | | } |
| | | |
| | | @Override |
| | | public PageResult<MesWmSalesNoticeDO> getSalesNoticePage(MesWmSalesNoticePageReqVO pageReqVO) { |
| | | return salesNoticeMapper.selectPage(pageReqVO); |
| | | // 获取用户有权限的客户 ID 列表 |
| | | List<Long> permittedClientIds = customerApi.getPermittedCustomerIds(); |
| | | return salesNoticeMapper.selectPage(pageReqVO, permittedClientIds); |
| | | } |
| | | |
| | | @Override |
| | |
| | | validateNoticeCodeUnique(saveReqVO.getId(), saveReqVO.getCode()); |
| | | // 校验客户存在 |
| | | if (saveReqVO.getClientId() != null) { |
| | | clientService.validateClientExistsAndEnable(saveReqVO.getClientId()); |
| | | customerApi.validateCustomer(saveReqVO.getClientId()); |
| | | } |
| | | } |
| | | |