|
|
|
|
@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.Wrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import jakarta.annotation.Resource; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
import org.springblade.core.secure.BladeUser; |
|
|
|
|
@ -32,6 +33,7 @@ import java.util.*; |
|
|
|
|
**/ |
|
|
|
|
|
|
|
|
|
@Service |
|
|
|
|
@Slf4j |
|
|
|
|
public class StGraphiteMoldOutServiceImpl extends BaseServiceImpl<StGraphiteMoldOutMapper, StGraphiteMoldOut> implements IStGraphiteMoldOutService { |
|
|
|
|
@Resource |
|
|
|
|
StRealtimeStockMapper stRealtimeStockMapper; |
|
|
|
|
@ -75,7 +77,8 @@ public class StGraphiteMoldOutServiceImpl extends BaseServiceImpl<StGraphiteMold |
|
|
|
|
List<StRealtimeStock> allUsableStockList = stRealtimeStockMapper.selectMaxUsableStockByMoldAttr(goodsCode); |
|
|
|
|
|
|
|
|
|
if (allUsableStockList == null || allUsableStockList.isEmpty()) { |
|
|
|
|
throw new ServiceException("石墨模【" + goodsCode + "】库存不足,无法生成!需求数量:" + requireQty); |
|
|
|
|
log.info("石墨模【{}】库存不足,无法生成!需求数量:{}", goodsCode, requireQty); |
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
} |
|
|
|
|
for (StRealtimeStock stock : allUsableStockList) { |
|
|
|
|
double occupy = Optional.ofNullable(stock.getOccupyQuantity()).orElse(0D); |
|
|
|
|
@ -96,7 +99,8 @@ public class StGraphiteMoldOutServiceImpl extends BaseServiceImpl<StGraphiteMold |
|
|
|
|
// throw new ServiceException("石墨模【" + goodsCode + "】库存不足,无法生成!需求数量:" + requireQty + ",可用库存:" + totalUsable);
|
|
|
|
|
// }
|
|
|
|
|
if (candidateStockList.isEmpty()) { |
|
|
|
|
throw new ServiceException("石墨模【" + goodsCode + "】库存不足,无法生成!需求数量:" + requireQty); |
|
|
|
|
log.info("石墨模【{}】库存不足,无法生成!需求数量:{}", goodsCode, requireQty); |
|
|
|
|
return Collections.emptyList(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
double remainingQty = requireQty; |
|
|
|
|
@ -318,6 +322,8 @@ public class StGraphiteMoldOutServiceImpl extends BaseServiceImpl<StGraphiteMold |
|
|
|
|
inoutRecord.setInOutDate(nowDate); |
|
|
|
|
|
|
|
|
|
inoutRecord.setUserId(param.getPicker()); |
|
|
|
|
String pickerTeamSet = stStockInoutRecordService.getTeamSetByUserId(param.getPicker()); |
|
|
|
|
inoutRecord.setPickerTeamSet(pickerTeamSet); |
|
|
|
|
inoutRecord.setCreateUser(userId); |
|
|
|
|
inoutRecord.setCreateTime(nowDate); |
|
|
|
|
inoutRecord.setUpdateUser(userId); |
|
|
|
|
|