食堂erp修复

This commit is contained in:
zjf committed 2025-05-22 23:22:04 +08:00
1 parent fbf3cb8346
commit 4094db8934
8 files changed
+34 -7

No files matched your search

@@ -37,4 +37,8 @@ public class CanteenErpMaterialSaveDTO {
*/
@Schema(description="库存下限")
private Integer inventoryLowerLimit;
@Schema(description="采购价格")
private Integer purchasePrice;
}
@@ -43,4 +43,8 @@ public class CanteenErpMaterialVO {
@Schema(description="当前总库存")
private Double currentStock;
@Schema(description="采购价格")
private Integer purchasePrice;
}
@@ -33,4 +33,8 @@ public class ErpMaterialPageVo {
*/
@Schema(description="当前库存数量")
private Double stock;
@Schema(description="采购价格")
private Integer purchasePrice;
}
@@ -22,6 +22,9 @@ public class InventoryRecordItemVo {
@Schema(description="食材id")
private Long erpMaterialId;
@Schema(description="食材名称")
private String name;
/**
* 主表id
*/
@@ -45,6 +48,12 @@ public class InventoryRecordItemVo {
@Schema(description="累计总金额")
private Integer totalAmount;
/**
* 累计数量
*/
@Schema(description="累计数量")
private Integer totalNumber;
/**
* 备注
*/
@@ -64,6 +64,7 @@ public class CanteenErpMaterialServiceImpl extends ServiceImpl<CanteenErpMateria
canteenErpMaterialEntity.setId(id);
canteenErpMaterialEntity.setName(canteenErpMaterialEditorDTO.getName());
canteenErpMaterialEntity.setUnit(canteenErpMaterialEditorDTO.getUnit());
canteenErpMaterialEntity.setPurchasePrice(canteenErpMaterialEditorDTO.getPurchasePrice());
LambdaQueryWrapper<CanteenStockEntity> canteenStockEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
canteenStockEntityLambdaQueryWrapper.eq(CanteenStockEntity::getItemId, id);
@@ -75,7 +76,6 @@ public class CanteenErpMaterialServiceImpl extends ServiceImpl<CanteenErpMateria
canteenStockEntity.setCurrentStock(canteenErpMaterialEditorDTO.getBaseStock()+(sourceCanteenStockEntity.getCurrentStock()-sourceCanteenStockEntity.getBaseStock()));
canteenStockEntity.setInventoryUpperLimit(canteenErpMaterialEditorDTO.getInventoryUpperLimit());
canteenStockEntity.setInventoryLowerLimit(canteenErpMaterialEditorDTO.getInventoryLowerLimit());
int i = baseMapper.updateById(canteenErpMaterialEntity);
canteenStockMapper.update(canteenStockEntity,
new LambdaQueryWrapper<CanteenStockEntity>().eq(CanteenStockEntity::getItemId, id));
@@ -103,6 +103,7 @@ public class CanteenErpMaterialServiceImpl extends ServiceImpl<CanteenErpMateria
canteenErpMaterialVO.setInventoryUpperLimit(sourceCanteenStockEntity.getInventoryUpperLimit());
canteenErpMaterialVO.setInventoryLowerLimit(sourceCanteenStockEntity.getInventoryLowerLimit());
canteenErpMaterialVO.setCurrentStock(sourceCanteenStockEntity.getCurrentStock());
canteenErpMaterialVO.setPurchasePrice(canteenErpMaterialEntity.getPurchasePrice());
return canteenErpMaterialVO;
}
@@ -5,13 +5,11 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.constant.OrderTypeEnum;
import com.bsd.pjcloud.canteen.dto.erp.*;
import com.bsd.pjcloud.canteen.entity.CanteenErpMaterialEntity;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsEntity;
import com.bsd.pjcloud.canteen.entity.CanteenInventoryRecordsItemEntity;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsItemMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenInventoryRecordsMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenProductionRecordItemMapper;
import com.bsd.pjcloud.canteen.mapper.CanteenStockMapper;
import com.bsd.pjcloud.canteen.mapper.*;
import com.bsd.pjcloud.canteen.service.CanteenInventoryRecordsService;
import com.bsd.pjcloud.canteen.service.CanteenStockService;
import com.bsd.pjcloud.canteen.vo.erp.CanteenProductionRecordPageVO;
@@ -47,6 +45,8 @@ public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInven
private final CanteenStockMapper canteenStockMapper;
private final CanteenStockService canteenStockService;
private final CanteenErpMaterialMapper canteenErpMaterialMapper;
@Override
@Transactional
public Object saveCanteenInventoryRecordsdDTO(CanteenInventoryRecordsdDTO canteenInventoryRecordsdDTO) {
@@ -185,6 +185,10 @@ public class CanteenInventoryRecordsServiceImpl extends ServiceImpl<CanteenInven
InventoryRecordVo bean = BeanUtils.toBean(smErpInventoryRecordsEntity, InventoryRecordVo.class, (source) -> {
List<InventoryRecordItemVo> smeErpCgPlanItemVos = BeanUtils.toBean(list, InventoryRecordItemVo.class);
smeErpCgPlanItemVos.stream().forEach(item -> {
CanteenErpMaterialEntity canteenErpMaterialEntity = canteenErpMaterialMapper.selectById(item.getErpMaterialId());
item.setName(canteenErpMaterialEntity.getName());
});
source.setItems(smeErpCgPlanItemVos);
});
@@ -47,7 +47,7 @@ public class CanteenStockServiceImpl extends ServiceImpl<CanteenStockMapper, Can
updateStockWithLockWrapper.eq(CanteenStockEntity::getVersion,smErpStockEntity.getVersion());
CanteenStockEntity updateSmErpStockEntity = new CanteenStockEntity();
Double currentStock = smErpStockEntity.getCurrentStock();
if (currentStock<Math.abs(item.getIncrCount())){
if (item.getIncrCount()<0 &&currentStock<Math.abs(item.getIncrCount())){
LambdaQueryWrapper<CanteenErpMaterialEntity> canteenErpMaterialEntityLambdaQueryWrapper = new LambdaQueryWrapper<>();
canteenErpMaterialEntityLambdaQueryWrapper.eq(CanteenErpMaterialEntity::getId,item.getId());
CanteenErpMaterialEntity canteenErpMaterialEntity = canteenErpMaterialMapper.selectOne(canteenErpMaterialEntityLambdaQueryWrapper);
@@ -48,6 +48,7 @@
and cpr.production_time = #{inventoryDate}
</if>
</where>
GROUP BY r.id;
GROUP BY r.id
order by r.create_time desc
</select>
</mapper>