| | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.approve.pojo.ApproveProcess; |
| | | import com.ruoyi.approve.service.impl.ApproveProcessServiceImpl; |
| | | import com.ruoyi.basic.enums.ApplicationTypeEnum; |
| | | import com.ruoyi.basic.enums.RecordTypeEnum; |
| | | import com.ruoyi.basic.utils.FileUtil; |
| | | import com.ruoyi.common.enums.FileNameType; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.other.service.impl.TempFileServiceImpl; |
| | |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.io.IOException; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | |
| | |
| | | private final StockUtils stockUtils; |
| | | private final CommonFileServiceImpl commonFileService; |
| | | private final ApproveProcessServiceImpl approveProcessService; |
| | | private final FileUtil fileUtil; |
| | | |
| | | @Override |
| | | 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())); |
| | | item.setStorageBlobVOs(fileUtil.getStorageBlobDTOsByApplicationAndRecordTypeAndRecordId(ApplicationTypeEnum.IMAGE, RecordTypeEnum.ShippingInfo, item.getId())); |
| | | }); |
| | | return listPage; |
| | | } |
| | | |
| | | @Override |
| | | public boolean deductStock(ShippingInfoDto req) throws IOException { |
| | | public boolean deductStock(ShippingInfoDto req) { |
| | | ShippingInfo byId = this.getById(req.getId()); |
| | | if (byId == null) { |
| | | throw new RuntimeException("发货信息不存在"); |
| | |
| | | byId.setShippingCarNumber(req.getShippingCarNumber()); |
| | | byId.setShippingDate(req.getShippingDate()); |
| | | boolean update = this.updateById(byId); |
| | | // 迁移文件 |
| | | if(CollectionUtils.isNotEmpty(req.getTempFileIds())){ |
| | | tempFileService.migrateTempFilesToFormal(req.getId(), req.getTempFileIds(), FileNameType.SHIP.getValue()); |
| | | } |
| | | // 保存文件 |
| | | fileUtil.saveStorageAttachment(ApplicationTypeEnum.IMAGE, RecordTypeEnum.ShippingInfo, req.getId(), req.getStorageBlobDTOs()); |
| | | return update ; |
| | | } |
| | | |