package com.ruoyi.business.service.impl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.ruoyi.business.dto.OfficialInventoryDto;
|
import com.ruoyi.business.dto.PendingInventoryDto;
|
import com.ruoyi.business.entity.InputInventoryRecord;
|
import com.ruoyi.business.mapper.InputInventoryRecordMapper;
|
import com.ruoyi.business.service.InputInventoryRecordService;
|
import lombok.RequiredArgsConstructor;
|
import org.springframework.stereotype.Service;
|
|
import java.math.BigDecimal;
|
|
import static com.ruoyi.business.constant.InventoryRecordConstant.OFFICIAL_INVENTORY;
|
import static com.ruoyi.business.constant.InventoryRecordConstant.PENDING_INVENTORY;
|
|
/**
|
* <p>
|
* 入库记录表 服务实现类
|
* </p>
|
*
|
* @author chenhj
|
* @since 2025-06-14
|
*/
|
@Service
|
@RequiredArgsConstructor
|
public class InputInventoryRecordServiceImpl extends ServiceImpl<InputInventoryRecordMapper, InputInventoryRecord> implements InputInventoryRecordService {
|
private final InputInventoryRecordMapper inputInventoryRecordMapper;
|
|
@Override
|
public int insertInputInventoryRecord(PendingInventoryDto pendingInventoryDto, OfficialInventoryDto officialInventoryDto, BigDecimal quantity) {
|
if ((pendingInventoryDto != null && officialInventoryDto != null) || (pendingInventoryDto == null && officialInventoryDto == null)) {
|
throw new RuntimeException("库存记录异常");
|
}
|
|
InputInventoryRecord inputInventoryRecord = new InputInventoryRecord();
|
if (officialInventoryDto != null) {
|
inputInventoryRecord.setInventoryType(OFFICIAL_INVENTORY);
|
inputInventoryRecord.setId(officialInventoryDto.getId());
|
} else {
|
inputInventoryRecord.setInventoryType(PENDING_INVENTORY);
|
inputInventoryRecord.setId(pendingInventoryDto.getId());
|
}
|
inputInventoryRecord.setQuantity(quantity);
|
|
return inputInventoryRecordMapper.insert(inputInventoryRecord);
|
|
// 更新库存
|
// inventorySummaryService.updateInventory(pendingInventoryDto, officialInventoryDto);
|
}
|
|
@Override
|
public int deleteInputInventoryRecord(Long[] ids) {
|
|
|
|
|
return 0;
|
}
|
}
|