食堂进销

This commit is contained in:
zjf committed 2025-05-13 21:50:36 +08:00
1 parent 441134bde8
commit b6aed9f9d2
7 files changed
+171 -1

No files matched your search

@@ -0,0 +1,43 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class ProductionRecordDTO {
/**
* id
*/
@Schema(description="id")
private Long id;
/**
* 加工日期
*/
@Schema(description="加工日期")
private LocalDateTime productionTime;
/**
* 加工人
*/
@Schema(description="加工人")
private String handlerUser;
/**
* 加工批次号
*/
@Schema(description="加工批次号")
private String recordCode;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
}
@@ -0,0 +1,105 @@
package com.bsd.pjcloud.canteen.vo.erp;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Data
public class ProductionRecordItemDTO {
/**
* id
*/
@Schema(description="id")
private Long id;
/**
* 单据类型(字典inventory_type)
*/
@Schema(description="单据类型(字典inventory_type)")
private String inventoryType;
/**
* 原料id
*/
@Schema(description="原料id")
private Long erpMaterialId;
/**
* 商户编号
*/
@Schema(description="商户编号")
private Long merchantId;
/**
* 出入库数量
*/
@Schema(description="出入库数量")
private Double quantity;
/**
* 单价
*/
@Schema(description="单价")
private Integer unitPrice;
/**
* 总金额
*/
@Schema(description="总金额")
private Integer totalAmount;
/**
* 税率%
*/
@Schema(description="税率%")
private Integer taxRate;
/**
* 税前金额
*/
@Schema(description="税前金额")
private Integer taxAmount;
/**
* 货商
*/
@Schema(description="货商")
private Long supplierId;
/**
* 备注
*/
@Schema(description="备注")
private String remark;
/**
* 总数
*/
@Schema(description="总数")
private Integer totalNumber;
/**
* 账面数量
*/
@Schema(description="账面数量")
private Integer accountNumber;
/**
* 实际数量
*/
@Schema(description="实际数量")
private Integer realNumber;
/**
* 实际单价
*/
@Schema(description="实际单价")
private Integer realPrice;
}
@@ -56,4 +56,7 @@ public class ProductionTemplateDetailVO{
@Schema(description="食材名称")
private String materialName;
@Schema(description="单位")
private String unit;
}
@@ -51,7 +51,7 @@ public class CanteenProductionRecordController {
LambdaQueryWrapper<CanteenProductionRecordEntity> wrapper = Wrappers.lambdaQuery();
wrapper.eq(Objects.nonNull(canteenProductionRecord.getProductionTime()),CanteenProductionRecordEntity::getProductionTime,canteenProductionRecord.getProductionTime());
wrapper.eq(StrUtil.isNotBlank(canteenProductionRecord.getRecordCode()),CanteenProductionRecordEntity::getRecordCode,canteenProductionRecord.getRecordCode());
return R.ok(canteenProductionRecordService.page(page, wrapper));
return R.ok(canteenProductionRecordService.pageScope(page, wrapper));
}
@@ -1,8 +1,18 @@
package com.bsd.pjcloud.canteen.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
public interface CanteenProductionRecordService extends IService<CanteenProductionRecordEntity> {
/**
* 分页
* @param page
* @param wrapper
* @return
*/
Object pageScope(Page page, LambdaQueryWrapper<CanteenProductionRecordEntity> wrapper);
}
@@ -1,9 +1,12 @@
package com.bsd.pjcloud.canteen.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.bsd.pjcloud.canteen.entity.CanteenProductionRecordEntity;
import com.bsd.pjcloud.canteen.mapper.CanteenProductionRecordMapper;
import com.bsd.pjcloud.canteen.service.CanteenProductionRecordService;
import com.bsd.pjcloud.common.data.datascope.DataScope;
import org.springframework.stereotype.Service;
/**
* 食材加工记录表
@@ -13,4 +16,8 @@ import org.springframework.stereotype.Service;
*/
@Service
public class CanteenProductionRecordServiceImpl extends ServiceImpl<CanteenProductionRecordMapper, CanteenProductionRecordEntity> implements CanteenProductionRecordService {
@Override
public Object pageScope(Page page, LambdaQueryWrapper<CanteenProductionRecordEntity> wrapper) {
return baseMapper.selectPageByScope(page, wrapper, DataScope.of());
}
}
@@ -97,6 +97,7 @@ public class CanteenProductionTemplateServiceImpl extends ServiceImpl<CanteenPro
Long materialId = productionTemplateDetailVO.getMaterialId();
CanteenErpMaterialEntity canteenErpMaterialEntity = canteenErpMaterialMapper.selectById(materialId);
productionTemplateDetailVO.setMaterialName(canteenErpMaterialEntity.getName());
productionTemplateDetailVO.setUnit(canteenErpMaterialEntity.getUnit());
}
bean.setCanteenProductionTemplateDetailList(productionTemplateDetailVOList);
return bean;
@@ -136,6 +137,7 @@ public class CanteenProductionTemplateServiceImpl extends ServiceImpl<CanteenPro
List<ProductionTemplateDetailVO> productionTemplateDetailVOList = BeanUtils.toBean(canteenProductionTemplateDetailEntities, ProductionTemplateDetailVO.class);
productionTemplateDetailVOList.forEach(item->{
item.setMaterialName(materialMap.getOrDefault(item.getMaterialId(), new CanteenErpMaterialEntity()).getName());
item.setUnit(materialMap.getOrDefault(item.getMaterialId(), new CanteenErpMaterialEntity()).getUnit());
});
Map<Long, List<ProductionTemplateDetailVO>> detailMap = productionTemplateDetailVOList.stream()
.collect(Collectors.groupingBy(ProductionTemplateDetailVO::getTemplateId));