销售发货单出库控制

jg-waiwang-pro
vayne 5 months ago
parent 4782827871
commit 3fa2bf52ef

@ -96,6 +96,8 @@ public class DeliveryOrderController {
private BusinessCargoService businessCargoService;
@Autowired
private ReturnCargoOrderService returnCargoOrderService;
@Autowired
private InventoryService inventoryService;
/**
*
@ -162,6 +164,20 @@ public class DeliveryOrderController {
if (StringUtil.isNotEmpty(b)){
return ActionResult.fail(b );
}
for (DeliveryProductRelationModel model : deliveryOrderForm.getDeliveryProductRelationList()){
QueryWrapper<InventoryEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().eq(InventoryEntity::getProductId,model.getProductId());
queryWrapper.lambda().eq(InventoryEntity::getBatchNumber,model.getBatchNo());
queryWrapper.lambda().isNull(InventoryEntity::getDeleteMark);
InventoryEntity inventoryEntity = inventoryService.getOne(queryWrapper);
if (ObjectUtil.isNotEmpty(inventoryEntity)) {
if (inventoryEntity.getInventoryNumber().compareTo(model.getDeliveryNum()) == -1){
return ActionResult.fail("库存数量不足");
}
}else{
return ActionResult.fail("库区不存在");
}
}
try{
deliveryOrderService.saveOrUpdate(deliveryOrderForm, id ,true);
}catch(Exception e){

Loading…
Cancel
Save