库存维护记录

This commit is contained in:
liuhanqing
2025-05-26 17:49:00 +08:00
parent 32d8fc7641
commit ff6f0cb1f2
8 changed files with 1250 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
package com.ruoyi.stock.maintain.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
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.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.stock.maintain.domain.BasStockMaintainRecord;
import com.ruoyi.stock.maintain.service.IBasStockMaintainRecordService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 库存操作记录Controller
*
* @author ruoyi
* @date 2025-05-26
*/
@RestController
@RequestMapping("/stock/record")
public class BasStockMaintainRecordController extends BaseController
{
@Autowired
private IBasStockMaintainRecordService basStockMaintainRecordService;
/**
* 查询库存操作记录列表
*/
@PreAuthorize("@ss.hasPermi('stock:record:list')")
@GetMapping("/list")
public TableDataInfo list(BasStockMaintainRecord basStockMaintainRecord)
{
startPage();
List<BasStockMaintainRecord> list = basStockMaintainRecordService.selectBasStockMaintainRecordList(basStockMaintainRecord);
return getDataTable(list);
}
/**
* 导出库存操作记录列表
*/
@PreAuthorize("@ss.hasPermi('stock:record:export')")
@Log(title = "库存操作记录", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BasStockMaintainRecord basStockMaintainRecord)
{
List<BasStockMaintainRecord> list = basStockMaintainRecordService.selectBasStockMaintainRecordList(basStockMaintainRecord);
ExcelUtil<BasStockMaintainRecord> util = new ExcelUtil<BasStockMaintainRecord>(BasStockMaintainRecord.class);
util.exportExcel(response, list, "库存操作记录数据");
}
/**
* 获取库存操作记录详细信息
*/
@PreAuthorize("@ss.hasPermi('stock:record:query')")
@GetMapping(value = "/{whGuid}")
public AjaxResult getInfo(@PathVariable("whGuid") String whGuid)
{
return success(basStockMaintainRecordService.selectBasStockMaintainRecordByWhGuid(whGuid));
}
/**
* 新增库存操作记录
*/
@PreAuthorize("@ss.hasPermi('stock:record:add')")
@Log(title = "库存操作记录", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody BasStockMaintainRecord basStockMaintainRecord)
{
return toAjax(basStockMaintainRecordService.insertBasStockMaintainRecord(basStockMaintainRecord));
}
/**
* 修改库存操作记录
*/
@PreAuthorize("@ss.hasPermi('stock:record:edit')")
@Log(title = "库存操作记录", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody BasStockMaintainRecord basStockMaintainRecord)
{
return toAjax(basStockMaintainRecordService.updateBasStockMaintainRecord(basStockMaintainRecord));
}
/**
* 删除库存操作记录
*/
@PreAuthorize("@ss.hasPermi('stock:record:remove')")
@Log(title = "库存操作记录", businessType = BusinessType.DELETE)
@DeleteMapping("/{whGuids}")
public AjaxResult remove(@PathVariable String[] whGuids)
{
return toAjax(basStockMaintainRecordService.deleteBasStockMaintainRecordByWhGuids(whGuids));
}
}

View File

@@ -0,0 +1,278 @@
package com.ruoyi.stock.maintain.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 库存操作记录对象 bas_stock_maintain_record
*
* @author ruoyi
* @date 2025-05-26
*/
public class BasStockMaintainRecord extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** guid */
private String whGuid;
/** 库存编码 */
@Excel(name = "库存编码")
private String stockId;
/** 货位编码 */
@Excel(name = "货位编码")
private String cargoSpaceId;
/** 托盘条码 */
@Excel(name = "托盘条码")
private String trayCode;
/** 物品编码 */
@Excel(name = "物品编码")
private String productId;
/** 物品名称 */
@Excel(name = "物品名称")
private String productName;
/** 生产日期 */
@Excel(name = "生产日期")
private String printDate;
/** 批号 */
@Excel(name = "批号")
private String lotNo;
/** 初始数量 */
@Excel(name = "初始数量")
private String oldQuantity;
/** 操作后数量 */
@Excel(name = "操作后数量")
private String quantity;
/** 操作 */
@Excel(name = "操作")
private String method;
/** 仓库 */
@Excel(name = "仓库")
private String warehouseId;
/** 库存字表id */
@Excel(name = "库存字表id")
private String stockDetailId;
/** 操作目标 */
@Excel(name = "操作目标")
private String operatingTarget;
/** 条码数量(旧) */
@Excel(name = "条码数量", readConverterExp = "旧=")
private String barCodeOldQuantity;
/** 条码数量(新) */
@Excel(name = "条码数量", readConverterExp = "新=")
private String barCodeQuantity;
/** 物料guid */
@Excel(name = "物料guid")
private String productGuid;
public void setWhGuid(String whGuid)
{
this.whGuid = whGuid;
}
public String getWhGuid()
{
return whGuid;
}
public void setStockId(String stockId)
{
this.stockId = stockId;
}
public String getStockId()
{
return stockId;
}
public void setCargoSpaceId(String cargoSpaceId)
{
this.cargoSpaceId = cargoSpaceId;
}
public String getCargoSpaceId()
{
return cargoSpaceId;
}
public void setTrayCode(String trayCode)
{
this.trayCode = trayCode;
}
public String getTrayCode()
{
return trayCode;
}
public void setProductId(String productId)
{
this.productId = productId;
}
public String getProductId()
{
return productId;
}
public void setProductName(String productName)
{
this.productName = productName;
}
public String getProductName()
{
return productName;
}
public void setPrintDate(String printDate)
{
this.printDate = printDate;
}
public String getPrintDate()
{
return printDate;
}
public void setLotNo(String lotNo)
{
this.lotNo = lotNo;
}
public String getLotNo()
{
return lotNo;
}
public void setOldQuantity(String oldQuantity)
{
this.oldQuantity = oldQuantity;
}
public String getOldQuantity()
{
return oldQuantity;
}
public void setQuantity(String quantity)
{
this.quantity = quantity;
}
public String getQuantity()
{
return quantity;
}
public void setMethod(String method)
{
this.method = method;
}
public String getMethod()
{
return method;
}
public void setWarehouseId(String warehouseId)
{
this.warehouseId = warehouseId;
}
public String getWarehouseId()
{
return warehouseId;
}
public void setStockDetailId(String stockDetailId)
{
this.stockDetailId = stockDetailId;
}
public String getStockDetailId()
{
return stockDetailId;
}
public void setOperatingTarget(String operatingTarget)
{
this.operatingTarget = operatingTarget;
}
public String getOperatingTarget()
{
return operatingTarget;
}
public void setBarCodeOldQuantity(String barCodeOldQuantity)
{
this.barCodeOldQuantity = barCodeOldQuantity;
}
public String getBarCodeOldQuantity()
{
return barCodeOldQuantity;
}
public void setBarCodeQuantity(String barCodeQuantity)
{
this.barCodeQuantity = barCodeQuantity;
}
public String getBarCodeQuantity()
{
return barCodeQuantity;
}
public void setProductGuid(String productGuid)
{
this.productGuid = productGuid;
}
public String getProductGuid()
{
return productGuid;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("whGuid", getWhGuid())
.append("stockId", getStockId())
.append("cargoSpaceId", getCargoSpaceId())
.append("trayCode", getTrayCode())
.append("productId", getProductId())
.append("productName", getProductName())
.append("printDate", getPrintDate())
.append("lotNo", getLotNo())
.append("oldQuantity", getOldQuantity())
.append("quantity", getQuantity())
.append("method", getMethod())
.append("warehouseId", getWarehouseId())
.append("createTime", getCreateTime())
.append("stockDetailId", getStockDetailId())
.append("operatingTarget", getOperatingTarget())
.append("barCodeOldQuantity", getBarCodeOldQuantity())
.append("barCodeQuantity", getBarCodeQuantity())
.append("productGuid", getProductGuid())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.stock.maintain.mapper;
import java.util.List;
import com.ruoyi.stock.maintain.domain.BasStockMaintainRecord;
/**
* 库存操作记录Mapper接口
*
* @author ruoyi
* @date 2025-05-26
*/
public interface BasStockMaintainRecordMapper
{
/**
* 查询库存操作记录
*
* @param whGuid 库存操作记录主键
* @return 库存操作记录
*/
public BasStockMaintainRecord selectBasStockMaintainRecordByWhGuid(String whGuid);
/**
* 查询库存操作记录列表
*
* @param basStockMaintainRecord 库存操作记录
* @return 库存操作记录集合
*/
public List<BasStockMaintainRecord> selectBasStockMaintainRecordList(BasStockMaintainRecord basStockMaintainRecord);
/**
* 新增库存操作记录
*
* @param basStockMaintainRecord 库存操作记录
* @return 结果
*/
public int insertBasStockMaintainRecord(BasStockMaintainRecord basStockMaintainRecord);
/**
* 修改库存操作记录
*
* @param basStockMaintainRecord 库存操作记录
* @return 结果
*/
public int updateBasStockMaintainRecord(BasStockMaintainRecord basStockMaintainRecord);
/**
* 删除库存操作记录
*
* @param whGuid 库存操作记录主键
* @return 结果
*/
public int deleteBasStockMaintainRecordByWhGuid(String whGuid);
/**
* 批量删除库存操作记录
*
* @param whGuids 需要删除的数据主键集合
* @return 结果
*/
public int deleteBasStockMaintainRecordByWhGuids(String[] whGuids);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.stock.maintain.service;
import java.util.List;
import com.ruoyi.stock.maintain.domain.BasStockMaintainRecord;
/**
* 库存操作记录Service接口
*
* @author ruoyi
* @date 2025-05-26
*/
public interface IBasStockMaintainRecordService
{
/**
* 查询库存操作记录
*
* @param whGuid 库存操作记录主键
* @return 库存操作记录
*/
public BasStockMaintainRecord selectBasStockMaintainRecordByWhGuid(String whGuid);
/**
* 查询库存操作记录列表
*
* @param basStockMaintainRecord 库存操作记录
* @return 库存操作记录集合
*/
public List<BasStockMaintainRecord> selectBasStockMaintainRecordList(BasStockMaintainRecord basStockMaintainRecord);
/**
* 新增库存操作记录
*
* @param basStockMaintainRecord 库存操作记录
* @return 结果
*/
public int insertBasStockMaintainRecord(BasStockMaintainRecord basStockMaintainRecord);
/**
* 修改库存操作记录
*
* @param basStockMaintainRecord 库存操作记录
* @return 结果
*/
public int updateBasStockMaintainRecord(BasStockMaintainRecord basStockMaintainRecord);
/**
* 批量删除库存操作记录
*
* @param whGuids 需要删除的库存操作记录主键集合
* @return 结果
*/
public int deleteBasStockMaintainRecordByWhGuids(String[] whGuids);
/**
* 删除库存操作记录信息
*
* @param whGuid 库存操作记录主键
* @return 结果
*/
public int deleteBasStockMaintainRecordByWhGuid(String whGuid);
}

View File

@@ -0,0 +1,95 @@
package com.ruoyi.stock.maintain.service.impl;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.stock.maintain.mapper.BasStockMaintainRecordMapper;
import com.ruoyi.stock.maintain.domain.BasStockMaintainRecord;
import com.ruoyi.stock.maintain.service.IBasStockMaintainRecordService;
/**
* 库存操作记录Service业务层处理
*
* @author ruoyi
* @date 2025-05-26
*/
@Service
public class BasStockMaintainRecordServiceImpl implements IBasStockMaintainRecordService
{
@Autowired
private BasStockMaintainRecordMapper basStockMaintainRecordMapper;
/**
* 查询库存操作记录
*
* @param whGuid 库存操作记录主键
* @return 库存操作记录
*/
@Override
public BasStockMaintainRecord selectBasStockMaintainRecordByWhGuid(String whGuid)
{
return basStockMaintainRecordMapper.selectBasStockMaintainRecordByWhGuid(whGuid);
}
/**
* 查询库存操作记录列表
*
* @param basStockMaintainRecord 库存操作记录
* @return 库存操作记录
*/
@Override
public List<BasStockMaintainRecord> selectBasStockMaintainRecordList(BasStockMaintainRecord basStockMaintainRecord)
{
return basStockMaintainRecordMapper.selectBasStockMaintainRecordList(basStockMaintainRecord);
}
/**
* 新增库存操作记录
*
* @param basStockMaintainRecord 库存操作记录
* @return 结果
*/
@Override
public int insertBasStockMaintainRecord(BasStockMaintainRecord basStockMaintainRecord)
{
basStockMaintainRecord.setCreateTime(DateUtils.getNowDate());
return basStockMaintainRecordMapper.insertBasStockMaintainRecord(basStockMaintainRecord);
}
/**
* 修改库存操作记录
*
* @param basStockMaintainRecord 库存操作记录
* @return 结果
*/
@Override
public int updateBasStockMaintainRecord(BasStockMaintainRecord basStockMaintainRecord)
{
return basStockMaintainRecordMapper.updateBasStockMaintainRecord(basStockMaintainRecord);
}
/**
* 批量删除库存操作记录
*
* @param whGuids 需要删除的库存操作记录主键
* @return 结果
*/
@Override
public int deleteBasStockMaintainRecordByWhGuids(String[] whGuids)
{
return basStockMaintainRecordMapper.deleteBasStockMaintainRecordByWhGuids(whGuids);
}
/**
* 删除库存操作记录信息
*
* @param whGuid 库存操作记录主键
* @return 结果
*/
@Override
public int deleteBasStockMaintainRecordByWhGuid(String whGuid)
{
return basStockMaintainRecordMapper.deleteBasStockMaintainRecordByWhGuid(whGuid);
}
}

View File

@@ -0,0 +1,137 @@
<?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.ruoyi.stock.maintain.mapper.BasStockMaintainRecordMapper">
<resultMap type="BasStockMaintainRecord" id="BasStockMaintainRecordResult">
<result property="whGuid" column="wh_guid" />
<result property="stockId" column="stock_id" />
<result property="cargoSpaceId" column="cargo_space_id" />
<result property="trayCode" column="tray_code" />
<result property="productId" column="product_id" />
<result property="productName" column="product_name" />
<result property="printDate" column="print_date" />
<result property="lotNo" column="lot_no" />
<result property="oldQuantity" column="old_quantity" />
<result property="quantity" column="quantity" />
<result property="method" column="method" />
<result property="warehouseId" column="warehouse_id" />
<result property="createTime" column="create_time" />
<result property="stockDetailId" column="stock_detail_id" />
<result property="operatingTarget" column="operating_target" />
<result property="barCodeOldQuantity" column="bar_code_old_quantity" />
<result property="barCodeQuantity" column="bar_code_quantity" />
<result property="productGuid" column="product_guid" />
</resultMap>
<sql id="selectBasStockMaintainRecordVo">
select wh_guid, stock_id, cargo_space_id, tray_code, product_id, product_name, print_date, lot_no, old_quantity, quantity, method, warehouse_id, create_time, stock_detail_id, operating_target, bar_code_old_quantity, bar_code_quantity, product_guid from bas_stock_maintain_record
</sql>
<select id="selectBasStockMaintainRecordList" parameterType="BasStockMaintainRecord" resultMap="BasStockMaintainRecordResult">
<include refid="selectBasStockMaintainRecordVo"/>
<where>
<if test="stockId != null and stockId != ''"> and stock_id = #{stockId}</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and cargo_space_id = #{cargoSpaceId}</if>
<if test="trayCode != null and trayCode != ''"> and tray_code = #{trayCode}</if>
<if test="productId != null and productId != ''"> and product_id = #{productId}</if>
<if test="productName != null and productName != ''"> and product_name like concat('%', #{productName}, '%')</if>
<if test="printDate != null and printDate != ''"> and print_date = #{printDate}</if>
<if test="lotNo != null and lotNo != ''"> and lot_no = #{lotNo}</if>
<if test="oldQuantity != null and oldQuantity != ''"> and old_quantity = #{oldQuantity}</if>
<if test="quantity != null and quantity != ''"> and quantity = #{quantity}</if>
<if test="method != null and method != ''"> and method = #{method}</if>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="stockDetailId != null and stockDetailId != ''"> and stock_detail_id = #{stockDetailId}</if>
<if test="operatingTarget != null and operatingTarget != ''"> and operating_target = #{operatingTarget}</if>
<if test="barCodeOldQuantity != null and barCodeOldQuantity != ''"> and bar_code_old_quantity = #{barCodeOldQuantity}</if>
<if test="barCodeQuantity != null and barCodeQuantity != ''"> and bar_code_quantity = #{barCodeQuantity}</if>
<if test="productGuid != null and productGuid != ''"> and product_guid = #{productGuid}</if>
</where>
</select>
<select id="selectBasStockMaintainRecordByWhGuid" parameterType="String" resultMap="BasStockMaintainRecordResult">
<include refid="selectBasStockMaintainRecordVo"/>
where wh_guid = #{whGuid}
</select>
<insert id="insertBasStockMaintainRecord" parameterType="BasStockMaintainRecord">
insert into bas_stock_maintain_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="whGuid != null">wh_guid,</if>
<if test="stockId != null">stock_id,</if>
<if test="cargoSpaceId != null">cargo_space_id,</if>
<if test="trayCode != null">tray_code,</if>
<if test="productId != null">product_id,</if>
<if test="productName != null">product_name,</if>
<if test="printDate != null">print_date,</if>
<if test="lotNo != null">lot_no,</if>
<if test="oldQuantity != null">old_quantity,</if>
<if test="quantity != null">quantity,</if>
<if test="method != null">method,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="createTime != null">create_time,</if>
<if test="stockDetailId != null">stock_detail_id,</if>
<if test="operatingTarget != null">operating_target,</if>
<if test="barCodeOldQuantity != null">bar_code_old_quantity,</if>
<if test="barCodeQuantity != null">bar_code_quantity,</if>
<if test="productGuid != null">product_guid,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="whGuid != null">#{whGuid},</if>
<if test="stockId != null">#{stockId},</if>
<if test="cargoSpaceId != null">#{cargoSpaceId},</if>
<if test="trayCode != null">#{trayCode},</if>
<if test="productId != null">#{productId},</if>
<if test="productName != null">#{productName},</if>
<if test="printDate != null">#{printDate},</if>
<if test="lotNo != null">#{lotNo},</if>
<if test="oldQuantity != null">#{oldQuantity},</if>
<if test="quantity != null">#{quantity},</if>
<if test="method != null">#{method},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="stockDetailId != null">#{stockDetailId},</if>
<if test="operatingTarget != null">#{operatingTarget},</if>
<if test="barCodeOldQuantity != null">#{barCodeOldQuantity},</if>
<if test="barCodeQuantity != null">#{barCodeQuantity},</if>
<if test="productGuid != null">#{productGuid},</if>
</trim>
</insert>
<update id="updateBasStockMaintainRecord" parameterType="BasStockMaintainRecord">
update bas_stock_maintain_record
<trim prefix="SET" suffixOverrides=",">
<if test="stockId != null">stock_id = #{stockId},</if>
<if test="cargoSpaceId != null">cargo_space_id = #{cargoSpaceId},</if>
<if test="trayCode != null">tray_code = #{trayCode},</if>
<if test="productId != null">product_id = #{productId},</if>
<if test="productName != null">product_name = #{productName},</if>
<if test="printDate != null">print_date = #{printDate},</if>
<if test="lotNo != null">lot_no = #{lotNo},</if>
<if test="oldQuantity != null">old_quantity = #{oldQuantity},</if>
<if test="quantity != null">quantity = #{quantity},</if>
<if test="method != null">method = #{method},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="stockDetailId != null">stock_detail_id = #{stockDetailId},</if>
<if test="operatingTarget != null">operating_target = #{operatingTarget},</if>
<if test="barCodeOldQuantity != null">bar_code_old_quantity = #{barCodeOldQuantity},</if>
<if test="barCodeQuantity != null">bar_code_quantity = #{barCodeQuantity},</if>
<if test="productGuid != null">product_guid = #{productGuid},</if>
</trim>
where wh_guid = #{whGuid}
</update>
<delete id="deleteBasStockMaintainRecordByWhGuid" parameterType="String">
delete from bas_stock_maintain_record where wh_guid = #{whGuid}
</delete>
<delete id="deleteBasStockMaintainRecordByWhGuids" parameterType="String">
delete from bas_stock_maintain_record where wh_guid in
<foreach item="whGuid" collection="array" open="(" separator="," close=")">
#{whGuid}
</foreach>
</delete>
</mapper>