库存记录报表

This commit is contained in:
sxu 2025-07-16 15:22:41 +08:00
parent e470a01f2c
commit c1c56d15f9
6 changed files with 651 additions and 0 deletions

View File

@ -0,0 +1,119 @@
package com.bonus.canteen.core.ims.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.bonus.common.log.enums.OperaType;
//import com.bonus.canteen.core.ims.common.annotation.PreventRepeatSubmit;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.bonus.common.log.annotation.SysLog;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.canteen.core.ims.domain.ReportInventoryBase;
import com.bonus.canteen.core.ims.service.IReportInventoryBaseService;
import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult;
import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.core.web.page.TableDataInfo;
/**
* 库存基础Controller
*
* @author xsheng
* @date 2025-07-16
*/
@Api(tags = "库存基础接口")
@RestController
@RequestMapping("/ims_report_inventory_base")
public class ReportInventoryBaseController extends BaseController {
@Autowired
private IReportInventoryBaseService reportInventoryBaseService;
/**
* 查询库存基础列表
*/
@ApiOperation(value = "查询库存基础列表")
//@RequiresPermissions("ims:base:list")
@GetMapping("/list")
public TableDataInfo list(ReportInventoryBase reportInventoryBase) {
startPage();
List<ReportInventoryBase> list = reportInventoryBaseService.selectReportInventoryBaseList(reportInventoryBase);
return getDataTable(list);
}
/**
* 导出库存基础列表
*/
@ApiOperation(value = "导出库存基础列表")
//@PreventRepeatSubmit
//@RequiresPermissions("ims:base:export")
@SysLog(title = "库存基础", businessType = OperaType.EXPORT, logType = 1,module = "仓储管理->导出库存基础")
@PostMapping("/export")
public void export(HttpServletResponse response, ReportInventoryBase reportInventoryBase) {
List<ReportInventoryBase> list = reportInventoryBaseService.selectReportInventoryBaseList(reportInventoryBase);
ExcelUtil<ReportInventoryBase> util = new ExcelUtil<ReportInventoryBase>(ReportInventoryBase.class);
util.exportExcel(response, list, "库存基础数据");
}
/**
* 获取库存基础详细信息
*/
@ApiOperation(value = "获取库存基础详细信息")
//@RequiresPermissions("ims:base:query")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id) {
return success(reportInventoryBaseService.selectReportInventoryBaseById(id));
}
/**
* 新增库存基础
*/
@ApiOperation(value = "新增库存基础")
//@PreventRepeatSubmit
//@RequiresPermissions("ims:base:add")
@SysLog(title = "库存基础", businessType = OperaType.INSERT, logType = 1,module = "仓储管理->新增库存基础")
@PostMapping
public AjaxResult add(@RequestBody ReportInventoryBase reportInventoryBase) {
try {
return toAjax(reportInventoryBaseService.insertReportInventoryBase(reportInventoryBase));
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 修改库存基础
*/
@ApiOperation(value = "修改库存基础")
//@PreventRepeatSubmit
//@RequiresPermissions("ims:base:edit")
@SysLog(title = "库存基础", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改库存基础")
@PostMapping("/edit")
public AjaxResult edit(@RequestBody ReportInventoryBase reportInventoryBase) {
try {
return toAjax(reportInventoryBaseService.updateReportInventoryBase(reportInventoryBase));
} catch (Exception e) {
return error(e.getMessage());
}
}
/**
* 删除库存基础
*/
@ApiOperation(value = "删除库存基础")
//@PreventRepeatSubmit
//@RequiresPermissions("ims:base:remove")
@SysLog(title = "库存基础", businessType = OperaType.DELETE, logType = 1,module = "仓储管理->删除库存基础")
@PostMapping("/del/{ids}")
public AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(reportInventoryBaseService.deleteReportInventoryBaseByIds(ids));
}
}

View File

@ -0,0 +1,139 @@
package com.bonus.canteen.core.ims.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.bonus.common.core.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import com.bonus.common.core.web.domain.BaseEntity;
/**
* 库存基础对象 ims_report_inventory_base
*
* @author xsheng
* @date 2025-07-16
*/
@Data
@ToString
public class ReportInventoryBase extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 主键id */
private Long id;
/** 出入库详情id */
@Excel(name = "出入库详情id")
@ApiModelProperty(value = "出入库详情id")
private Long detailId;
/** 出入库记录id */
@Excel(name = "出入库记录id")
@ApiModelProperty(value = "出入库记录id")
private String recordId;
/** 仓库id */
@Excel(name = "仓库id")
@ApiModelProperty(value = "仓库id")
private Long warehouseId;
/** 类型 1入库 2出库 */
@Excel(name = "类型 1入库 2出库")
@ApiModelProperty(value = "类型 1入库 2出库")
private Integer recordType;
/** 出入库日期 */
@ApiModelProperty(value = "出入库日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出入库日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date recordDate;
/** 出入库时间 */
@ApiModelProperty(value = "出入库时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出入库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date recordTime;
/** 入库类型(1-采购入库,2-退料入库,3-调拨入库) 出库类型(1-领取出库,2-报损出库,3-退货出库,4-调拨出库) */
@Excel(name = "入库类型(1-采购入库,2-退料入库,3-调拨入库) 出库类型(1-领取出库,2-报损出库,3-退货出库,4-调拨出库)")
@ApiModelProperty(value = "入库类型(1-采购入库,2-退料入库,3-调拨入库) 出库类型(1-领取出库,2-报损出库,3-退货出库,4-调拨出库)")
private Long outIntoType;
/** 原料id */
@Excel(name = "原料id")
@ApiModelProperty(value = "原料id")
private Long materialId;
/** 供应商id */
@Excel(name = "供应商id")
@ApiModelProperty(value = "供应商id")
private Long supplierId;
/** 计量单位id */
@Excel(name = "计量单位id")
@ApiModelProperty(value = "计量单位id")
private Long unitId;
/** 单价 */
@Excel(name = "单价")
@ApiModelProperty(value = "单价")
private Long unitPrice;
/** 出入库金额 */
@Excel(name = "出入库金额")
@ApiModelProperty(value = "出入库金额")
private Long outIntoAmount;
/** 出入库数量 */
@Excel(name = "出入库数量")
@ApiModelProperty(value = "出入库数量")
private BigDecimal outIntoNum;
/** 总库存数量 */
@Excel(name = "总库存数量")
@ApiModelProperty(value = "总库存数量")
private BigDecimal inventoryNum;
/** 总金额 */
@Excel(name = "总金额")
@ApiModelProperty(value = "总金额")
private Long totalAmount;
/** 生产日期 */
@ApiModelProperty(value = "生产日期")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "生产日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date productDate;
/** 到期时间(保质期) */
@ApiModelProperty(value = "到期时间(保质期)")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "到期时间(保质期)", width = 30, dateFormat = "yyyy-MM-dd")
private Date expireTime;
/** 领取人id */
@Excel(name = "领取人id")
@ApiModelProperty(value = "领取人id")
private Long fetchUserId;
/** 操作人id */
@Excel(name = "操作人id")
@ApiModelProperty(value = "操作人id")
private String operatorId;
/** 操作时间 */
@ApiModelProperty(value = "操作时间")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "操作时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date operateTime;
/** 状态: 0 未消费 1 已消费 */
@Excel(name = "状态: 0 未消费 1 已消费")
@ApiModelProperty(value = "状态: 0 未消费 1 已消费")
private Integer msgStatus;
}

View File

@ -0,0 +1,60 @@
package com.bonus.canteen.core.ims.mapper;
import java.util.List;
import com.bonus.canteen.core.ims.domain.ReportInventoryBase;
/**
* 库存基础Mapper接口
*
* @author xsheng
* @date 2025-07-16
*/
public interface ReportInventoryBaseMapper {
/**
* 查询库存基础
*
* @param id 库存基础主键
* @return 库存基础
*/
public ReportInventoryBase selectReportInventoryBaseById(Long id);
/**
* 查询库存基础列表
*
* @param reportInventoryBase 库存基础
* @return 库存基础集合
*/
public List<ReportInventoryBase> selectReportInventoryBaseList(ReportInventoryBase reportInventoryBase);
/**
* 新增库存基础
*
* @param reportInventoryBase 库存基础
* @return 结果
*/
public int insertReportInventoryBase(ReportInventoryBase reportInventoryBase);
/**
* 修改库存基础
*
* @param reportInventoryBase 库存基础
* @return 结果
*/
public int updateReportInventoryBase(ReportInventoryBase reportInventoryBase);
/**
* 删除库存基础
*
* @param id 库存基础主键
* @return 结果
*/
public int deleteReportInventoryBaseById(Long id);
/**
* 批量删除库存基础
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteReportInventoryBaseByIds(Long[] ids);
}

View File

@ -0,0 +1,60 @@
package com.bonus.canteen.core.ims.service;
import java.util.List;
import com.bonus.canteen.core.ims.domain.ReportInventoryBase;
/**
* 库存基础Service接口
*
* @author xsheng
* @date 2025-07-16
*/
public interface IReportInventoryBaseService {
/**
* 查询库存基础
*
* @param id 库存基础主键
* @return 库存基础
*/
public ReportInventoryBase selectReportInventoryBaseById(Long id);
/**
* 查询库存基础列表
*
* @param reportInventoryBase 库存基础
* @return 库存基础集合
*/
public List<ReportInventoryBase> selectReportInventoryBaseList(ReportInventoryBase reportInventoryBase);
/**
* 新增库存基础
*
* @param reportInventoryBase 库存基础
* @return 结果
*/
public int insertReportInventoryBase(ReportInventoryBase reportInventoryBase);
/**
* 修改库存基础
*
* @param reportInventoryBase 库存基础
* @return 结果
*/
public int updateReportInventoryBase(ReportInventoryBase reportInventoryBase);
/**
* 批量删除库存基础
*
* @param ids 需要删除的库存基础主键集合
* @return 结果
*/
public int deleteReportInventoryBaseByIds(Long[] ids);
/**
* 删除库存基础信息
*
* @param id 库存基础主键
* @return 结果
*/
public int deleteReportInventoryBaseById(Long id);
}

View File

@ -0,0 +1,98 @@
package com.bonus.canteen.core.ims.service.impl;
import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import com.bonus.common.core.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.ims.mapper.ReportInventoryBaseMapper;
import com.bonus.canteen.core.ims.domain.ReportInventoryBase;
import com.bonus.canteen.core.ims.service.IReportInventoryBaseService;
/**
* 库存基础Service业务层处理
*
* @author xsheng
* @date 2025-07-16
*/
@Service
public class ReportInventoryBaseServiceImpl implements IReportInventoryBaseService {
@Autowired
private ReportInventoryBaseMapper reportInventoryBaseMapper;
/**
* 查询库存基础
*
* @param id 库存基础主键
* @return 库存基础
*/
@Override
public ReportInventoryBase selectReportInventoryBaseById(Long id) {
return reportInventoryBaseMapper.selectReportInventoryBaseById(id);
}
/**
* 查询库存基础列表
*
* @param reportInventoryBase 库存基础
* @return 库存基础
*/
@Override
public List<ReportInventoryBase> selectReportInventoryBaseList(ReportInventoryBase reportInventoryBase) {
return reportInventoryBaseMapper.selectReportInventoryBaseList(reportInventoryBase);
}
/**
* 新增库存基础
*
* @param reportInventoryBase 库存基础
* @return 结果
*/
@Override
public int insertReportInventoryBase(ReportInventoryBase reportInventoryBase) {
reportInventoryBase.setCreateTime(DateUtils.getNowDate());
try {
return reportInventoryBaseMapper.insertReportInventoryBase(reportInventoryBase);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 修改库存基础
*
* @param reportInventoryBase 库存基础
* @return 结果
*/
@Override
public int updateReportInventoryBase(ReportInventoryBase reportInventoryBase) {
reportInventoryBase.setUpdateTime(DateUtils.getNowDate());
try {
return reportInventoryBaseMapper.updateReportInventoryBase(reportInventoryBase);
} catch (Exception e) {
throw new ServiceException(e.getMessage());
}
}
/**
* 批量删除库存基础
*
* @param ids 需要删除的库存基础主键
* @return 结果
*/
@Override
public int deleteReportInventoryBaseByIds(Long[] ids) {
return reportInventoryBaseMapper.deleteReportInventoryBaseByIds(ids);
}
/**
* 删除库存基础信息
*
* @param id 库存基础主键
* @return 结果
*/
@Override
public int deleteReportInventoryBaseById(Long id) {
return reportInventoryBaseMapper.deleteReportInventoryBaseById(id);
}
}

View File

@ -0,0 +1,175 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.canteen.core.ims.mapper.ReportInventoryBaseMapper">
<resultMap type="com.bonus.canteen.core.ims.domain.ReportInventoryBase" id="ReportInventoryBaseResult">
<result property="id" column="id" />
<result property="detailId" column="detail_id" />
<result property="recordId" column="record_id" />
<result property="warehouseId" column="warehouse_id" />
<result property="recordType" column="record_type" />
<result property="recordDate" column="record_date" />
<result property="recordTime" column="record_time" />
<result property="outIntoType" column="out_into_type" />
<result property="materialId" column="material_id" />
<result property="supplierId" column="supplier_id" />
<result property="unitId" column="unit_id" />
<result property="unitPrice" column="unit_price" />
<result property="outIntoAmount" column="out_into_amount" />
<result property="outIntoNum" column="out_into_num" />
<result property="inventoryNum" column="inventory_num" />
<result property="totalAmount" column="total_amount" />
<result property="productDate" column="product_date" />
<result property="expireTime" column="expire_time" />
<result property="fetchUserId" column="fetch_user_id" />
<result property="operatorId" column="operator_id" />
<result property="operateTime" column="operate_time" />
<result property="msgStatus" column="msg_status" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectReportInventoryBaseVo">
select id, detail_id, record_id, warehouse_id, record_type, record_date, record_time, out_into_type, material_id, supplier_id, unit_id, unit_price, out_into_amount, out_into_num, inventory_num, total_amount, product_date, expire_time, fetch_user_id, operator_id, operate_time, msg_status, remark, create_by, create_time, update_by, update_time from ims_report_inventory_base
</sql>
<select id="selectReportInventoryBaseList" parameterType="com.bonus.canteen.core.ims.domain.ReportInventoryBase" resultMap="ReportInventoryBaseResult">
<include refid="selectReportInventoryBaseVo"/>
<where>
<if test="detailId != null "> and detail_id = #{detailId}</if>
<if test="recordId != null and recordId != ''"> and record_id = #{recordId}</if>
<if test="warehouseId != null "> and warehouse_id = #{warehouseId}</if>
<if test="recordType != null "> and record_type = #{recordType}</if>
<if test="recordDate != null "> and record_date = #{recordDate}</if>
<if test="recordTime != null "> and record_time = #{recordTime}</if>
<if test="outIntoType != null "> and out_into_type = #{outIntoType}</if>
<if test="materialId != null "> and material_id = #{materialId}</if>
<if test="supplierId != null "> and supplier_id = #{supplierId}</if>
<if test="unitId != null "> and unit_id = #{unitId}</if>
<if test="unitPrice != null "> and unit_price = #{unitPrice}</if>
<if test="outIntoAmount != null "> and out_into_amount = #{outIntoAmount}</if>
<if test="outIntoNum != null "> and out_into_num = #{outIntoNum}</if>
<if test="inventoryNum != null "> and inventory_num = #{inventoryNum}</if>
<if test="totalAmount != null "> and total_amount = #{totalAmount}</if>
<if test="productDate != null "> and product_date = #{productDate}</if>
<if test="expireTime != null "> and expire_time = #{expireTime}</if>
<if test="fetchUserId != null "> and fetch_user_id = #{fetchUserId}</if>
<if test="operatorId != null and operatorId != ''"> and operator_id = #{operatorId}</if>
<if test="operateTime != null "> and operate_time = #{operateTime}</if>
<if test="msgStatus != null "> and msg_status = #{msgStatus}</if>
</where>
</select>
<select id="selectReportInventoryBaseById" parameterType="Long" resultMap="ReportInventoryBaseResult">
<include refid="selectReportInventoryBaseVo"/>
where id = #{id}
</select>
<insert id="insertReportInventoryBase" parameterType="com.bonus.canteen.core.ims.domain.ReportInventoryBase" useGeneratedKeys="true" keyProperty="id">
insert into ims_report_inventory_base
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="detailId != null">detail_id,</if>
<if test="recordId != null and recordId != ''">record_id,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="recordType != null">record_type,</if>
<if test="recordDate != null">record_date,</if>
<if test="recordTime != null">record_time,</if>
<if test="outIntoType != null">out_into_type,</if>
<if test="materialId != null">material_id,</if>
<if test="supplierId != null">supplier_id,</if>
<if test="unitId != null">unit_id,</if>
<if test="unitPrice != null">unit_price,</if>
<if test="outIntoAmount != null">out_into_amount,</if>
<if test="outIntoNum != null">out_into_num,</if>
<if test="inventoryNum != null">inventory_num,</if>
<if test="totalAmount != null">total_amount,</if>
<if test="productDate != null">product_date,</if>
<if test="expireTime != null">expire_time,</if>
<if test="fetchUserId != null">fetch_user_id,</if>
<if test="operatorId != null and operatorId != ''">operator_id,</if>
<if test="operateTime != null">operate_time,</if>
<if test="msgStatus != null">msg_status,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="detailId != null">#{detailId},</if>
<if test="recordId != null and recordId != ''">#{recordId},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="recordType != null">#{recordType},</if>
<if test="recordDate != null">#{recordDate},</if>
<if test="recordTime != null">#{recordTime},</if>
<if test="outIntoType != null">#{outIntoType},</if>
<if test="materialId != null">#{materialId},</if>
<if test="supplierId != null">#{supplierId},</if>
<if test="unitId != null">#{unitId},</if>
<if test="unitPrice != null">#{unitPrice},</if>
<if test="outIntoAmount != null">#{outIntoAmount},</if>
<if test="outIntoNum != null">#{outIntoNum},</if>
<if test="inventoryNum != null">#{inventoryNum},</if>
<if test="totalAmount != null">#{totalAmount},</if>
<if test="productDate != null">#{productDate},</if>
<if test="expireTime != null">#{expireTime},</if>
<if test="fetchUserId != null">#{fetchUserId},</if>
<if test="operatorId != null and operatorId != ''">#{operatorId},</if>
<if test="operateTime != null">#{operateTime},</if>
<if test="msgStatus != null">#{msgStatus},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateReportInventoryBase" parameterType="com.bonus.canteen.core.ims.domain.ReportInventoryBase">
update ims_report_inventory_base
<trim prefix="SET" suffixOverrides=",">
<if test="detailId != null">detail_id = #{detailId},</if>
<if test="recordId != null and recordId != ''">record_id = #{recordId},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="recordType != null">record_type = #{recordType},</if>
<if test="recordDate != null">record_date = #{recordDate},</if>
<if test="recordTime != null">record_time = #{recordTime},</if>
<if test="outIntoType != null">out_into_type = #{outIntoType},</if>
<if test="materialId != null">material_id = #{materialId},</if>
<if test="supplierId != null">supplier_id = #{supplierId},</if>
<if test="unitId != null">unit_id = #{unitId},</if>
<if test="unitPrice != null">unit_price = #{unitPrice},</if>
<if test="outIntoAmount != null">out_into_amount = #{outIntoAmount},</if>
<if test="outIntoNum != null">out_into_num = #{outIntoNum},</if>
<if test="inventoryNum != null">inventory_num = #{inventoryNum},</if>
<if test="totalAmount != null">total_amount = #{totalAmount},</if>
<if test="productDate != null">product_date = #{productDate},</if>
<if test="expireTime != null">expire_time = #{expireTime},</if>
<if test="fetchUserId != null">fetch_user_id = #{fetchUserId},</if>
<if test="operatorId != null and operatorId != ''">operator_id = #{operatorId},</if>
<if test="operateTime != null">operate_time = #{operateTime},</if>
<if test="msgStatus != null">msg_status = #{msgStatus},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteReportInventoryBaseById" parameterType="Long">
delete from ims_report_inventory_base where id = #{id}
</delete>
<delete id="deleteReportInventoryBaseByIds" parameterType="String">
delete from ims_report_inventory_base where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>