库存维护记录

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>

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询库存操作记录列表
export function listRecord(query) {
return request({
url: '/stock/record/list',
method: 'get',
params: query
})
}
// 查询库存操作记录详细
export function getRecord(whGuid) {
return request({
url: '/stock/record/' + whGuid,
method: 'get'
})
}
// 新增库存操作记录
export function addRecord(data) {
return request({
url: '/stock/record',
method: 'post',
data: data
})
}
// 修改库存操作记录
export function updateRecord(data) {
return request({
url: '/stock/record',
method: 'put',
data: data
})
}
// 删除库存操作记录
export function delRecord(whGuid) {
return request({
url: '/stock/record/' + whGuid,
method: 'delete'
})
}

View File

@@ -0,0 +1,470 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="库存编码" prop="stockId">
<el-input
v-model="queryParams.stockId"
placeholder="请输入库存编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="货位编码" prop="cargoSpaceId">
<el-input
v-model="queryParams.cargoSpaceId"
placeholder="请输入货位编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="托盘条码" prop="trayCode">
<el-input
v-model="queryParams.trayCode"
placeholder="请输入托盘条码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="物品编码" prop="productId">
<el-input
v-model="queryParams.productId"
placeholder="请输入物品编码"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="物品名称" prop="productName">
<el-input
v-model="queryParams.productName"
placeholder="请输入物品名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="生产日期" prop="printDate">
<el-input
v-model="queryParams.printDate"
placeholder="请输入生产日期"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="批号" prop="lotNo">
<el-input
v-model="queryParams.lotNo"
placeholder="请输入批号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="初始数量" prop="oldQuantity">
<el-input
v-model="queryParams.oldQuantity"
placeholder="请输入初始数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="操作后数量" prop="quantity">
<el-input
v-model="queryParams.quantity"
placeholder="请输入操作后数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item label="操作" prop="method">
<el-select v-model="queryParams.method" placeholder="请选择操作" clearable>
<el-option
v-for="dict in dict.type.stock_maintain_method"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-input
v-model="queryParams.warehouseId"
placeholder="请输入仓库"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="库存字表id" prop="stockDetailId">
<el-input
v-model="queryParams.stockDetailId"
placeholder="请输入库存字表id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="操作目标" prop="operatingTarget">
<el-input
v-model="queryParams.operatingTarget"
placeholder="请输入操作目标"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="条码数量" prop="barCodeOldQuantity">
<el-input
v-model="queryParams.barCodeOldQuantity"
placeholder="请输入条码数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="条码数量" prop="barCodeQuantity">
<el-input
v-model="queryParams.barCodeQuantity"
placeholder="请输入条码数量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="物料guid" prop="productGuid">
<el-input
v-model="queryParams.productGuid"
placeholder="请输入物料guid"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['stock:record:add']"
>新增</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['stock:record:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['stock:record:remove']"
>删除</el-button>
</el-col>-->
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['stock:record:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="recordList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="guid" align="center" prop="whGuid" />
<el-table-column label="库存编码" align="center" prop="stockId" />
<el-table-column label="货位编码" align="center" prop="cargoSpaceId" />
<el-table-column label="托盘条码" align="center" prop="trayCode" />
<el-table-column label="物品编码" align="center" prop="productId" />
<el-table-column label="物品名称" align="center" prop="productName" />
<el-table-column label="生产日期" align="center" prop="printDate" />
<el-table-column label="批号" align="center" prop="lotNo" />
<el-table-column label="初始数量" align="center" prop="oldQuantity" />
<el-table-column label="操作后数量" align="center" prop="quantity" />
<el-table-column label="操作" align="center" prop="method">
<template slot-scope="scope">
<dict-tag :options="dict.type.stock_maintain_method" :value="scope.row.method"/>
</template>
</el-table-column>
<el-table-column label="仓库" align="center" prop="warehouseId" />
<el-table-column label="库存字表id" align="center" prop="stockDetailId" />
<el-table-column label="操作目标" align="center" prop="operatingTarget" />
<el-table-column label="条码数量" align="center" prop="barCodeOldQuantity" />
<el-table-column label="条码数量" align="center" prop="barCodeQuantity" />
<el-table-column label="物料guid" align="center" prop="productGuid" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['stock:record:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['stock:record:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改库存操作记录对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="库存编码" prop="stockId">
<el-input v-model="form.stockId" placeholder="请输入库存编码" />
</el-form-item>
<el-form-item label="货位编码" prop="cargoSpaceId">
<el-input v-model="form.cargoSpaceId" placeholder="请输入货位编码" />
</el-form-item>
<el-form-item label="托盘条码" prop="trayCode">
<el-input v-model="form.trayCode" placeholder="请输入托盘条码" />
</el-form-item>
<el-form-item label="物品编码" prop="productId">
<el-input v-model="form.productId" placeholder="请输入物品编码" />
</el-form-item>
<el-form-item label="物品名称" prop="productName">
<el-input v-model="form.productName" placeholder="请输入物品名称" />
</el-form-item>
<el-form-item label="生产日期" prop="printDate">
<el-input v-model="form.printDate" placeholder="请输入生产日期" />
</el-form-item>
<el-form-item label="批号" prop="lotNo">
<el-input v-model="form.lotNo" placeholder="请输入批号" />
</el-form-item>
<el-form-item label="初始数量" prop="oldQuantity">
<el-input v-model="form.oldQuantity" placeholder="请输入初始数量" />
</el-form-item>
<el-form-item label="操作后数量" prop="quantity">
<el-input v-model="form.quantity" placeholder="请输入操作后数量" />
</el-form-item>
<el-form-item label="操作" prop="method">
<el-select v-model="form.method" placeholder="请选择操作">
<el-option
v-for="dict in dict.type.stock_maintain_method"
:key="dict.value"
:label="dict.label"
:value="dict.value"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="仓库" prop="warehouseId">
<el-input v-model="form.warehouseId" placeholder="请输入仓库" />
</el-form-item>
<el-form-item label="库存字表id" prop="stockDetailId">
<el-input v-model="form.stockDetailId" placeholder="请输入库存字表id" />
</el-form-item>
<el-form-item label="操作目标" prop="operatingTarget">
<el-input v-model="form.operatingTarget" placeholder="请输入操作目标" />
</el-form-item>
<el-form-item label="条码数量" prop="barCodeOldQuantity">
<el-input v-model="form.barCodeOldQuantity" placeholder="请输入条码数量" />
</el-form-item>
<el-form-item label="条码数量" prop="barCodeQuantity">
<el-input v-model="form.barCodeQuantity" placeholder="请输入条码数量" />
</el-form-item>
<el-form-item label="物料guid" prop="productGuid">
<el-input v-model="form.productGuid" placeholder="请输入物料guid" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listRecord, getRecord, delRecord, addRecord, updateRecord } from "@/api/stock/record"
export default {
name: "Record",
dicts: ['stock_maintain_method'],
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 库存操作记录表格数据
recordList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
stockId: null,
cargoSpaceId: null,
trayCode: null,
productId: null,
productName: null,
printDate: null,
lotNo: null,
oldQuantity: null,
quantity: null,
method: null,
warehouseId: null,
stockDetailId: null,
operatingTarget: null,
barCodeOldQuantity: null,
barCodeQuantity: null,
productGuid: null
},
// 表单参数
form: {},
// 表单校验
rules: {
}
}
},
created() {
this.getList()
},
methods: {
/** 查询库存操作记录列表 */
getList() {
this.loading = true
listRecord(this.queryParams).then(response => {
this.recordList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
whGuid: null,
stockId: null,
cargoSpaceId: null,
trayCode: null,
productId: null,
productName: null,
printDate: null,
lotNo: null,
oldQuantity: null,
quantity: null,
method: null,
warehouseId: null,
createTime: null,
stockDetailId: null,
operatingTarget: null,
barCodeOldQuantity: null,
barCodeQuantity: null,
productGuid: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.whGuid)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加库存操作记录"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const whGuid = row.whGuid || this.ids
getRecord(whGuid).then(response => {
this.form = response.data
this.open = true
this.title = "修改库存操作记录"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.whGuid != null) {
updateRecord(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addRecord(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const whGuids = row.whGuid || this.ids
this.$modal.confirm('是否确认删除库存操作记录编号为"' + whGuids + '"的数据项?').then(function() {
return delRecord(whGuids)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('stock/record/export', {
...this.queryParams
}, `record_${new Date().getTime()}.xlsx`)
}
}
}
</script>