| | |
| | | import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockQualifiedRecordTypeEnum; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | | import com.ruoyi.procurementrecord.utils.StockUtils; |
| | | import com.ruoyi.sales.dto.ShippingInfoDto; |
| | |
| | | import com.ruoyi.sales.mapper.ShippingInfoMapper; |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.pojo.ShippingInfo; |
| | | import com.ruoyi.sales.service.ICommonFileService; |
| | | import com.ruoyi.sales.service.ShippingInfoService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | |
| | | private ApproveProcessServiceImpl approveProcessService; |
| | | |
| | | @Override |
| | | public IPage<ShippingInfo> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfo> listPage = shippingInfoMapper.listPage(page, req); |
| | | |
| | | public IPage<ShippingInfoDto> listPage(Page page, ShippingInfo req) { |
| | | IPage<ShippingInfoDto> listPage = shippingInfoMapper.listPage(page, req); |
| | | listPage.getRecords().forEach(item ->{ |
| | | item.setCommonFileList(commonFileService.getFileListByBusinessId(item.getId(), FileNameType.SHIP.getValue())); |
| | | }); |
| | | return listPage; |
| | | } |
| | | |
| | |
| | | if (byId == null) { |
| | | throw new RuntimeException("发货信息不存在"); |
| | | } |
| | | //扣减库存 |
| | | if(!"已发货".equals(byId.getStatus())){ |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(byId.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); |
| | | } |
| | | byId.setExpressNumber(req.getExpressNumber()); |
| | | byId.setExpressCompany(req.getExpressCompany()); |
| | | byId.setStatus("已发货"); |
| | | byId.setShippingCarNumber(req.getShippingCarNumber()); |
| | | boolean update = this.updateById(req); |
| | | //扣减库存 |
| | | SalesLedgerProduct salesLedgerProduct = salesLedgerProductMapper.selectById(req.getSalesLedgerProductId()); |
| | | stockUtils.substractStock(salesLedgerProduct.getProductModelId(), salesLedgerProduct.getQuantity(), StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode(), req.getId()); |
| | | boolean update = this.updateById(byId); |
| | | // 迁移文件 |
| | | if(CollectionUtils.isNotEmpty(req.getTempFileIds())){ |
| | | tempFileService.migrateTempFilesToFormal(req.getId(), req.getTempFileIds(), FileNameType.SHIP.getValue()); |
| | |
| | | public boolean delete(List<Long> ids) { |
| | | List<ShippingInfo> shippingInfos = shippingInfoMapper.selectList(new LambdaQueryWrapper<ShippingInfo>() |
| | | .in(ShippingInfo::getId, ids)); |
| | | if(CollectionUtils.isEmpty(shippingInfos)) return false; |
| | | // 删除附件 |
| | | commonFileService.deleteByBusinessIds(ids, FileNameType.SHIP.getValue()); |
| | | // 扣库存 |
| | | for (Long id : ids) { |
| | | stockUtils.deleteStockRecord(id, StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode()); |
| | | // 扣已发货库存 |
| | | for (ShippingInfo shippingInfo : shippingInfos) { |
| | | if("已发货".equals(shippingInfo.getStatus())) { |
| | | stockUtils.deleteStockOutRecord(shippingInfo.getId(), StockQualifiedRecordTypeEnum.SALE_SHIP_STOCK_OUT.getCode()); |
| | | } |
| | | } |
| | | // 删除发货审批 |
| | | if(CollectionUtils.isNotEmpty(shippingInfos)){ |