| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.stock.dto.StockInRecordDto; |
| | | import com.ruoyi.stock.dto.StockInventoryDto; |
| | | import com.ruoyi.stock.dto.StockOutRecordDto; |
| | | import com.ruoyi.stock.dto.StockUninventoryDto; |
| | | import com.ruoyi.stock.execl.StockInventoryExportData; |
| | | import com.ruoyi.stock.pojo.StockInventory; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.mapper.StockUninventoryMapper; |
| | | import com.ruoyi.stock.pojo.StockUninventory; |
| | | import com.ruoyi.stock.service.StockInRecordService; |
| | | import com.ruoyi.stock.service.StockOutRecordService; |
| | | import com.ruoyi.stock.service.StockUninventoryService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class); |
| | | util.exportExcel(response,list, "不合格库存信息"); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean frozenStock(StockInventoryDto stockInventoryDto) { |
| | | StockUninventory stockUninventory = stockUninventoryMapper.selectById(stockInventoryDto.getId()); |
| | | if (stockUninventory.getQualitity().compareTo(stockInventoryDto.getLockedQuantity())<0) { |
| | | throw new RuntimeException("冻结数量不能超过库存数量"); |
| | | } |
| | | if (ObjectUtils.isEmpty(stockUninventory.getLockedQuantity())) { |
| | | stockUninventory.setLockedQuantity(stockInventoryDto.getLockedQuantity()); |
| | | }else { |
| | | stockUninventory.setLockedQuantity(stockUninventory.getLockedQuantity().add(stockInventoryDto.getLockedQuantity())); |
| | | } |
| | | return this.updateById(stockUninventory); |
| | | } |
| | | |
| | | @Override |
| | | public Boolean thawStock(StockInventoryDto stockInventoryDto) { |
| | | StockUninventory stockUninventory = stockUninventoryMapper.selectById(stockInventoryDto.getId()); |
| | | if (stockUninventory.getLockedQuantity().compareTo(stockInventoryDto.getLockedQuantity())<0) { |
| | | throw new RuntimeException("解冻数量不能超过冻结数量"); |
| | | } |
| | | stockUninventory.setLockedQuantity(stockUninventory.getLockedQuantity().subtract(stockInventoryDto.getLockedQuantity())); |
| | | return this.updateById(stockUninventory); |
| | | } |
| | | } |