| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.enums.StockInQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockInUnQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.enums.StockOutQualifiedRecordTypeEnum; |
| | | import com.ruoyi.common.exception.base.BaseException; |
| | | import com.ruoyi.common.utils.EnumUtil; |
| | | import com.ruoyi.common.utils.OrderUtils; |
| | |
| | | |
| | | int insertRows = stockInRecordMapper.insert(stockInRecord); |
| | | |
| | | Long insertId = stockInRecord.getId(); // 替换为你的实际主键字段:getRecordId()/getInboundId() 等 |
| | | Long insertId = stockInRecord.getId(); |
| | | |
| | | return insertRows > 0 ? insertId : null; |
| | | } |
| | |
| | | for (Long id : ids) { |
| | | StockInRecord stockInRecord = stockInRecordMapper.selectById(id); |
| | | if (stockInRecord.getType().equals("0")) { |
| | | StockInventory stockInventory = stockInventoryMapper.selectOne(new LambdaQueryWrapper<StockInventory>().eq(StockInventory::getProductModelId, stockInRecord.getProductModelId())); |
| | | StockInventory stockInventory = stockInventoryMapper.selectOne( |
| | | new LambdaQueryWrapper<StockInventory>() |
| | | .eq(StockInventory::getProductModelId, stockInRecord.getProductModelId()) |
| | | .eq(StockInventory::getBatchNo, stockInRecord.getBatchNo()) |
| | | ); |
| | | if (stockInventory == null) { |
| | | throw new BaseException("库存记录中没有对应的产品,无法删除!!!"); |
| | | } else { |
| | |
| | | stockInventoryMapper.updateSubtractStockInventory(stockInRecordDto); |
| | | } |
| | | } else if (stockInRecord.getType().equals("1")) { |
| | | StockUninventory stockUninventory = stockUninventoryMapper.selectOne(new LambdaQueryWrapper<StockUninventory>().eq(StockUninventory::getProductModelId, stockInRecord.getProductModelId())); |
| | | StockUninventory stockUninventory = stockUninventoryMapper.selectOne( |
| | | new LambdaQueryWrapper<StockUninventory>() |
| | | .eq(StockUninventory::getProductModelId, stockInRecord.getProductModelId()) |
| | | .eq(StockUninventory::getBatchNo, stockInRecord.getBatchNo())); |
| | | if (stockUninventory == null) { |
| | | throw new BaseException("库存记录中没有对应的产品,无法删除!!!"); |
| | | } else { |
| | |
| | | List<StockInRecordExportData> list = stockInRecordMapper.listStockInRecordExportData(stockInRecordDto); |
| | | for (StockInRecordExportData stockInRecordExportData : list) { |
| | | if (stockInRecordExportData.getType().equals("0")) { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockOutQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | } else { |
| | | stockInRecordExportData.setRecordType(EnumUtil.fromCode(StockInUnQualifiedRecordTypeEnum.class, Integer.parseInt(stockInRecordExportData.getRecordType())).getValue()); |
| | | } |