Commit 0f399e4c authored by 耿迪迪's avatar 耿迪迪

智能货架

parent a9275db4
package com.zehong.web.controller.shelf;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.shelf.TShelfInfo;
import com.zehong.system.service.shelf.ITShelfInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 料架信息Controller
*
* @author zehong
* @date 2025-09-20
*/
@RestController
@RequestMapping("/shelf/info")
public class TShelfInfoController extends BaseController
{
@Autowired
private ITShelfInfoService tShelfInfoService;
/**
* 查询料架信息列表
*/
@GetMapping("/list")
public TableDataInfo list(TShelfInfo tShelfInfo)
{
startPage();
List<TShelfInfo> list = tShelfInfoService.selectTShelfInfoList(tShelfInfo);
return getDataTable(list);
}
/**
* 查询料架信息列表
*/
@GetMapping("/shelfListInfo")
public AjaxResult shelfListInfo(TShelfInfo tShelfInfo)
{
List<TShelfInfo> list = tShelfInfoService.selectTShelfInfoList(tShelfInfo);
return AjaxResult.success(list);
}
/**
* 导出料架信息列表
*/
@Log(title = "料架信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TShelfInfo tShelfInfo)
{
List<TShelfInfo> list = tShelfInfoService.selectTShelfInfoList(tShelfInfo);
ExcelUtil<TShelfInfo> util = new ExcelUtil<TShelfInfo>(TShelfInfo.class);
return util.exportExcel(list, "料架信息数据");
}
/**
* 获取料架信息详细信息
*/
@GetMapping(value = "/{fShelfId}")
public AjaxResult getInfo(@PathVariable("fShelfId") Long fShelfId)
{
return AjaxResult.success(tShelfInfoService.selectTShelfInfoById(fShelfId));
}
/**
* 新增料架信息
*/
@Log(title = "料架信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TShelfInfo tShelfInfo)
{
return toAjax(tShelfInfoService.insertTShelfInfo(tShelfInfo));
}
/**
* 修改料架信息
*/
@Log(title = "料架信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TShelfInfo tShelfInfo)
{
return toAjax(tShelfInfoService.updateTShelfInfo(tShelfInfo));
}
/**
* 删除料架信息
*/
@Log(title = "料架信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{fShelfIds}")
public AjaxResult remove(@PathVariable Long[] fShelfIds)
{
return toAjax(tShelfInfoService.deleteTShelfInfoByIds(fShelfIds));
}
}
package com.zehong.web.controller.shelf;
import com.zehong.common.annotation.Log;
import com.zehong.common.core.controller.BaseController;
import com.zehong.common.core.domain.AjaxResult;
import com.zehong.common.core.page.TableDataInfo;
import com.zehong.common.enums.BusinessType;
import com.zehong.common.utils.poi.ExcelUtil;
import com.zehong.system.domain.shelf.TShelfStorageLocation;
import com.zehong.system.service.shelf.ITShelfStorageLocationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 储位信息Controller
*
* @author zehong
* @date 2025-09-20
*/
@RestController
@RequestMapping("/shelf/location")
public class TShelfStorageLocationController extends BaseController
{
@Autowired
private ITShelfStorageLocationService tShelfStorageLocationService;
/**
* 查询储位信息列表
*/
@GetMapping("/list")
public TableDataInfo list(TShelfStorageLocation tShelfStorageLocation)
{
startPage();
List<TShelfStorageLocation> list = tShelfStorageLocationService.selectTShelfStorageLocationList(tShelfStorageLocation);
return getDataTable(list);
}
/**
* 查询料架信息列表
*/
@GetMapping("/locationListInfo")
public AjaxResult locationListInfo(TShelfStorageLocation tShelfStorageLocation) {
List<TShelfStorageLocation> list = tShelfStorageLocationService.selectTShelfStorageLocationList(tShelfStorageLocation);
return AjaxResult.success(list);
}
/**
* 导出储位信息列表
*/
@Log(title = "储位信息", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public AjaxResult export(TShelfStorageLocation tShelfStorageLocation)
{
List<TShelfStorageLocation> list = tShelfStorageLocationService.selectTShelfStorageLocationList(tShelfStorageLocation);
ExcelUtil<TShelfStorageLocation> util = new ExcelUtil<TShelfStorageLocation>(TShelfStorageLocation.class);
return util.exportExcel(list, "储位信息数据");
}
/**
* 获取储位信息详细信息
*/
@GetMapping(value = "/{fShelfStorageLocationId}")
public AjaxResult getInfo(@PathVariable("fShelfStorageLocationId") Long fShelfStorageLocationId)
{
return AjaxResult.success(tShelfStorageLocationService.selectTShelfStorageLocationById(fShelfStorageLocationId));
}
/**
* 新增储位信息
*/
@Log(title = "储位信息", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody TShelfStorageLocation tShelfStorageLocation)
{
return toAjax(tShelfStorageLocationService.insertTShelfStorageLocation(tShelfStorageLocation));
}
/**
* 修改储位信息
*/
@Log(title = "储位信息", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody TShelfStorageLocation tShelfStorageLocation)
{
return toAjax(tShelfStorageLocationService.updateTShelfStorageLocation(tShelfStorageLocation));
}
/**
* 删除储位信息
*/
@Log(title = "储位信息", businessType = BusinessType.DELETE)
@DeleteMapping("/{fShelfStorageLocationIds}")
public AjaxResult remove(@PathVariable Long[] fShelfStorageLocationIds)
{
return toAjax(tShelfStorageLocationService.deleteTShelfStorageLocationByIds(fShelfStorageLocationIds));
}
}
......@@ -58,13 +58,13 @@ spring:
# redis 配置
redis:
# 地址
host: 36.138.180.82
host: 127.0.01
# 端口,默认为6379
port: 63798
port: 6379
# 数据库索引
database: 0
# 密码
password: 1qaz2wsx3edc@
password:
# 连接超时时间
timeout: 10s
lettuce:
......
package com.zehong.system.domain.shelf;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 料架信息对象 t_shelf_info
*
* @author zehong
* @date 2025-09-20
*/
public class TShelfInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 料架记录唯一ID */
private Long fShelfId;
/** 料架类型:0-pcba,1-仓库 */
@Excel(name = "料架类型:0-pcba,1-仓库")
private Integer fType;
/** 料架编号 */
@Excel(name = "料架编号")
private String fShelf;
/** 状态 */
@Excel(name = "状态")
private Integer fStatus;
public void setfShelfId(Long fShelfId)
{
this.fShelfId = fShelfId;
}
public Long getfShelfId()
{
return fShelfId;
}
public void setfType(Integer fType)
{
this.fType = fType;
}
public Integer getfType()
{
return fType;
}
public void setfShelf(String fShelf)
{
this.fShelf = fShelf;
}
public String getfShelf()
{
return fShelf;
}
public void setfStatus(Integer fStatus)
{
this.fStatus = fStatus;
}
public Integer getfStatus()
{
return fStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("fShelfId", getfShelfId())
.append("fType", getfType())
.append("fShelf", getfShelf())
.append("fStatus", getfStatus())
.toString();
}
}
package com.zehong.system.domain.shelf;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.zehong.common.annotation.Excel;
import com.zehong.common.core.domain.BaseEntity;
/**
* 储位信息对象 t_shelf_storage_location
*
* @author zehong
* @date 2025-09-20
*/
public class TShelfStorageLocation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 储位记录唯一ID */
private Long shelfStorageLocationId;
/** 关联的料架ID,关联料架表的f_id */
@Excel(name = "关联的料架ID,关联料架表的f_id")
private Long shelfId;
/** 储位标签 */
@Excel(name = "储位标签")
private String label;
/** 储位编号 */
@Excel(name = "储位编号")
private String location;
/** 排序位置 */
@Excel(name = "排序位置")
private Long index;
/** 料盘唯一码 */
@Excel(name = "料盘唯一码")
private String rid;
/** 入库时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "入库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date inboundTime;
/** 出库时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "出库时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date outboundTime;
public Long getShelfStorageLocationId() {
return shelfStorageLocationId;
}
public void setShelfStorageLocationId(Long shelfStorageLocationId) {
this.shelfStorageLocationId = shelfStorageLocationId;
}
public Long getShelfId() {
return shelfId;
}
public void setShelfId(Long shelfId) {
this.shelfId = shelfId;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getLocation() {
return location;
}
public void setLocation(String location) {
this.location = location;
}
public Long getIndex() {
return index;
}
public void setIndex(Long index) {
this.index = index;
}
public String getRid() {
return rid;
}
public void setRid(String rid) {
this.rid = rid;
}
public Date getInboundTime() {
return inboundTime;
}
public void setInboundTime(Date inboundTime) {
this.inboundTime = inboundTime;
}
public Date getOutboundTime() {
return outboundTime;
}
public void setOutboundTime(Date outboundTime) {
this.outboundTime = outboundTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("fShelfStorageLocationId", getShelfStorageLocationId())
.append("fShelfId", getShelfId())
.append("fLabel", getLabel())
.append("fLocation", getLocation())
.append("fIndex", getIndex())
.append("fRid", getRid())
.append("fInboundTime", getInboundTime())
.append("fOutboundTime", getOutboundTime())
.toString();
}
}
package com.zehong.system.mapper.shelf;
import java.util.List;
import com.zehong.system.domain.shelf.TShelfInfo;
/**
* 料架信息Mapper接口
*
* @author zehong
* @date 2025-09-20
*/
public interface TShelfInfoMapper
{
/**
* 查询料架信息
*
* @param fShelfId 料架信息ID
* @return 料架信息
*/
public TShelfInfo selectTShelfInfoById(Long fShelfId);
/**
* 查询料架信息列表
*
* @param tShelfInfo 料架信息
* @return 料架信息集合
*/
public List<TShelfInfo> selectTShelfInfoList(TShelfInfo tShelfInfo);
/**
* 新增料架信息
*
* @param tShelfInfo 料架信息
* @return 结果
*/
public int insertTShelfInfo(TShelfInfo tShelfInfo);
/**
* 修改料架信息
*
* @param tShelfInfo 料架信息
* @return 结果
*/
public int updateTShelfInfo(TShelfInfo tShelfInfo);
/**
* 删除料架信息
*
* @param fShelfId 料架信息ID
* @return 结果
*/
public int deleteTShelfInfoById(Long fShelfId);
/**
* 批量删除料架信息
*
* @param fShelfIds 需要删除的数据ID
* @return 结果
*/
public int deleteTShelfInfoByIds(Long[] fShelfIds);
}
package com.zehong.system.mapper.shelf;
import java.util.List;
import com.zehong.system.domain.shelf.TShelfStorageLocation;
/**
* 储位信息Mapper接口
*
* @author zehong
* @date 2025-09-20
*/
public interface TShelfStorageLocationMapper
{
/**
* 查询储位信息
*
* @param fShelfStorageLocationId 储位信息ID
* @return 储位信息
*/
public TShelfStorageLocation selectTShelfStorageLocationById(Long fShelfStorageLocationId);
/**
* 查询储位信息列表
*
* @param tShelfStorageLocation 储位信息
* @return 储位信息集合
*/
public List<TShelfStorageLocation> selectTShelfStorageLocationList(TShelfStorageLocation tShelfStorageLocation);
/**
* 新增储位信息
*
* @param tShelfStorageLocation 储位信息
* @return 结果
*/
public int insertTShelfStorageLocation(TShelfStorageLocation tShelfStorageLocation);
/**
* 修改储位信息
*
* @param tShelfStorageLocation 储位信息
* @return 结果
*/
public int updateTShelfStorageLocation(TShelfStorageLocation tShelfStorageLocation);
/**
* 删除储位信息
*
* @param fShelfStorageLocationId 储位信息ID
* @return 结果
*/
public int deleteTShelfStorageLocationById(Long fShelfStorageLocationId);
/**
* 批量删除储位信息
*
* @param fShelfStorageLocationIds 需要删除的数据ID
* @return 结果
*/
public int deleteTShelfStorageLocationByIds(Long[] fShelfStorageLocationIds);
}
package com.zehong.system.service.impl.shelf;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.shelf.TShelfInfoMapper;
import com.zehong.system.domain.shelf.TShelfInfo;
import com.zehong.system.service.shelf.ITShelfInfoService;
/**
* 料架信息Service业务层处理
*
* @author zehong
* @date 2025-09-20
*/
@Service
public class TShelfInfoServiceImpl implements ITShelfInfoService
{
@Autowired
private TShelfInfoMapper tShelfInfoMapper;
/**
* 查询料架信息
*
* @param fShelfId 料架信息ID
* @return 料架信息
*/
@Override
public TShelfInfo selectTShelfInfoById(Long fShelfId)
{
return tShelfInfoMapper.selectTShelfInfoById(fShelfId);
}
/**
* 查询料架信息列表
*
* @param tShelfInfo 料架信息
* @return 料架信息
*/
@Override
public List<TShelfInfo> selectTShelfInfoList(TShelfInfo tShelfInfo)
{
return tShelfInfoMapper.selectTShelfInfoList(tShelfInfo);
}
/**
* 新增料架信息
*
* @param tShelfInfo 料架信息
* @return 结果
*/
@Override
public int insertTShelfInfo(TShelfInfo tShelfInfo)
{
return tShelfInfoMapper.insertTShelfInfo(tShelfInfo);
}
/**
* 修改料架信息
*
* @param tShelfInfo 料架信息
* @return 结果
*/
@Override
public int updateTShelfInfo(TShelfInfo tShelfInfo)
{
return tShelfInfoMapper.updateTShelfInfo(tShelfInfo);
}
/**
* 批量删除料架信息
*
* @param fShelfIds 需要删除的料架信息ID
* @return 结果
*/
@Override
public int deleteTShelfInfoByIds(Long[] fShelfIds)
{
return tShelfInfoMapper.deleteTShelfInfoByIds(fShelfIds);
}
/**
* 删除料架信息信息
*
* @param fShelfId 料架信息ID
* @return 结果
*/
@Override
public int deleteTShelfInfoById(Long fShelfId)
{
return tShelfInfoMapper.deleteTShelfInfoById(fShelfId);
}
}
package com.zehong.system.service.impl.shelf;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zehong.system.mapper.shelf.TShelfStorageLocationMapper;
import com.zehong.system.domain.shelf.TShelfStorageLocation;
import com.zehong.system.service.shelf.ITShelfStorageLocationService;
/**
* 储位信息Service业务层处理
*
* @author zehong
* @date 2025-09-20
*/
@Service
public class TShelfStorageLocationServiceImpl implements ITShelfStorageLocationService
{
@Autowired
private TShelfStorageLocationMapper tShelfStorageLocationMapper;
/**
* 查询储位信息
*
* @param fShelfStorageLocationId 储位信息ID
* @return 储位信息
*/
@Override
public TShelfStorageLocation selectTShelfStorageLocationById(Long fShelfStorageLocationId)
{
return tShelfStorageLocationMapper.selectTShelfStorageLocationById(fShelfStorageLocationId);
}
/**
* 查询储位信息列表
*
* @param tShelfStorageLocation 储位信息
* @return 储位信息
*/
@Override
public List<TShelfStorageLocation> selectTShelfStorageLocationList(TShelfStorageLocation tShelfStorageLocation)
{
return tShelfStorageLocationMapper.selectTShelfStorageLocationList(tShelfStorageLocation);
}
/**
* 新增储位信息
*
* @param tShelfStorageLocation 储位信息
* @return 结果
*/
@Override
public int insertTShelfStorageLocation(TShelfStorageLocation tShelfStorageLocation)
{
return tShelfStorageLocationMapper.insertTShelfStorageLocation(tShelfStorageLocation);
}
/**
* 修改储位信息
*
* @param tShelfStorageLocation 储位信息
* @return 结果
*/
@Override
public int updateTShelfStorageLocation(TShelfStorageLocation tShelfStorageLocation)
{
return tShelfStorageLocationMapper.updateTShelfStorageLocation(tShelfStorageLocation);
}
/**
* 批量删除储位信息
*
* @param fShelfStorageLocationIds 需要删除的储位信息ID
* @return 结果
*/
@Override
public int deleteTShelfStorageLocationByIds(Long[] fShelfStorageLocationIds)
{
return tShelfStorageLocationMapper.deleteTShelfStorageLocationByIds(fShelfStorageLocationIds);
}
/**
* 删除储位信息信息
*
* @param fShelfStorageLocationId 储位信息ID
* @return 结果
*/
@Override
public int deleteTShelfStorageLocationById(Long fShelfStorageLocationId)
{
return tShelfStorageLocationMapper.deleteTShelfStorageLocationById(fShelfStorageLocationId);
}
}
package com.zehong.system.service.shelf;
import java.util.List;
import com.zehong.system.domain.shelf.TShelfInfo;
/**
* 料架信息Service接口
*
* @author zehong
* @date 2025-09-20
*/
public interface ITShelfInfoService
{
/**
* 查询料架信息
*
* @param fShelfId 料架信息ID
* @return 料架信息
*/
public TShelfInfo selectTShelfInfoById(Long fShelfId);
/**
* 查询料架信息列表
*
* @param tShelfInfo 料架信息
* @return 料架信息集合
*/
public List<TShelfInfo> selectTShelfInfoList(TShelfInfo tShelfInfo);
/**
* 新增料架信息
*
* @param tShelfInfo 料架信息
* @return 结果
*/
public int insertTShelfInfo(TShelfInfo tShelfInfo);
/**
* 修改料架信息
*
* @param tShelfInfo 料架信息
* @return 结果
*/
public int updateTShelfInfo(TShelfInfo tShelfInfo);
/**
* 批量删除料架信息
*
* @param fShelfIds 需要删除的料架信息ID
* @return 结果
*/
public int deleteTShelfInfoByIds(Long[] fShelfIds);
/**
* 删除料架信息信息
*
* @param fShelfId 料架信息ID
* @return 结果
*/
public int deleteTShelfInfoById(Long fShelfId);
}
package com.zehong.system.service.shelf;
import java.util.List;
import com.zehong.system.domain.shelf.TShelfStorageLocation;
/**
* 储位信息Service接口
*
* @author zehong
* @date 2025-09-20
*/
public interface ITShelfStorageLocationService
{
/**
* 查询储位信息
*
* @param fShelfStorageLocationId 储位信息ID
* @return 储位信息
*/
public TShelfStorageLocation selectTShelfStorageLocationById(Long fShelfStorageLocationId);
/**
* 查询储位信息列表
*
* @param tShelfStorageLocation 储位信息
* @return 储位信息集合
*/
public List<TShelfStorageLocation> selectTShelfStorageLocationList(TShelfStorageLocation tShelfStorageLocation);
/**
* 新增储位信息
*
* @param tShelfStorageLocation 储位信息
* @return 结果
*/
public int insertTShelfStorageLocation(TShelfStorageLocation tShelfStorageLocation);
/**
* 修改储位信息
*
* @param tShelfStorageLocation 储位信息
* @return 结果
*/
public int updateTShelfStorageLocation(TShelfStorageLocation tShelfStorageLocation);
/**
* 批量删除储位信息
*
* @param fShelfStorageLocationIds 需要删除的储位信息ID
* @return 结果
*/
public int deleteTShelfStorageLocationByIds(Long[] fShelfStorageLocationIds);
/**
* 删除储位信息信息
*
* @param fShelfStorageLocationId 储位信息ID
* @return 结果
*/
public int deleteTShelfStorageLocationById(Long fShelfStorageLocationId);
}
<?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.zehong.system.mapper.shelf.TShelfInfoMapper">
<resultMap type="TShelfInfo" id="TShelfInfoResult">
<result property="fShelfId" column="f_shelf_id" />
<result property="fType" column="f_type" />
<result property="fShelf" column="f_shelf" />
<result property="fStatus" column="f_status" />
</resultMap>
<sql id="selectTShelfInfoVo">
select f_shelf_id, f_type, f_shelf, f_status from t_shelf_info
</sql>
<select id="selectTShelfInfoList" parameterType="TShelfInfo" resultMap="TShelfInfoResult">
<include refid="selectTShelfInfoVo"/>
<where>
<if test="fType != null "> and f_type = #{fType}</if>
<if test="fShelf != null and fShelf != ''"> and f_shelf = #{fShelf}</if>
<if test="fStatus != null "> and f_status = #{fStatus}</if>
</where>
</select>
<select id="selectTShelfInfoById" parameterType="Long" resultMap="TShelfInfoResult">
<include refid="selectTShelfInfoVo"/>
where f_shelf_id = #{fShelfId}
</select>
<insert id="insertTShelfInfo" parameterType="TShelfInfo" useGeneratedKeys="true" keyProperty="fShelfId">
insert into t_shelf_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="fType != null">f_type,</if>
<if test="fShelf != null and fShelf != ''">f_shelf,</if>
<if test="fStatus != null">f_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="fType != null">#{fType},</if>
<if test="fShelf != null and fShelf != ''">#{fShelf},</if>
<if test="fStatus != null">#{fStatus},</if>
</trim>
</insert>
<update id="updateTShelfInfo" parameterType="TShelfInfo">
update t_shelf_info
<trim prefix="SET" suffixOverrides=",">
<if test="fType != null">f_type = #{fType},</if>
<if test="fShelf != null and fShelf != ''">f_shelf = #{fShelf},</if>
<if test="fStatus != null">f_status = #{fStatus},</if>
</trim>
where f_shelf_id = #{fShelfId}
</update>
<delete id="deleteTShelfInfoById" parameterType="Long">
delete from t_shelf_info where f_shelf_id = #{fShelfId}
</delete>
<delete id="deleteTShelfInfoByIds" parameterType="String">
delete from t_shelf_info where f_shelf_id in
<foreach item="fShelfId" collection="array" open="(" separator="," close=")">
#{fShelfId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
<?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.zehong.system.mapper.shelf.TShelfStorageLocationMapper">
<resultMap type="TShelfStorageLocation" id="TShelfStorageLocationResult">
<result property="shelfStorageLocationId" column="f_shelf_storage_location_id" />
<result property="shelfId" column="f_shelf_id" />
<result property="label" column="f_label" />
<result property="location" column="f_location" />
<result property="index" column="f_index" />
<result property="rid" column="f_rid" />
<result property="inboundTime" column="f_inbound_time" />
<result property="outboundTime" column="f_outbound_time" />
</resultMap>
<sql id="selectTShelfStorageLocationVo">
select f_shelf_storage_location_id, f_shelf_id, f_label, f_location, f_index, f_rid, f_inbound_time, f_outbound_time from t_shelf_storage_location
</sql>
<select id="selectTShelfStorageLocationList" parameterType="TShelfStorageLocation" resultMap="TShelfStorageLocationResult">
<include refid="selectTShelfStorageLocationVo"/>
<where>
<if test="shelfId != null "> and f_shelf_id = #{shelfId}</if>
<if test="label != null and label != ''"> and f_label = #{label}</if>
<if test="location != null and location != ''"> and f_location = #{location}</if>
<if test="index != null "> and f_index = #{index}</if>
<if test="rid != null and rid != ''"> and f_rid = #{rid}</if>
<if test="inboundTime != null "> and f_inbound_time = #{inboundTime}</if>
<if test="outboundTime != null "> and f_outbound_time = #{outboundTime}</if>
</where>
ORDER BY f_index
</select>
<select id="selectTShelfStorageLocationById" parameterType="Long" resultMap="TShelfStorageLocationResult">
<include refid="selectTShelfStorageLocationVo"/>
where f_shelf_storage_location_id = #{shelfStorageLocationId}
</select>
<insert id="insertTShelfStorageLocation" parameterType="TShelfStorageLocation" useGeneratedKeys="true" keyProperty="fShelfStorageLocationId">
insert into t_shelf_storage_location
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="shelfId != null">f_shelf_id,</if>
<if test="label != null">f_label,</if>
<if test="location != null and fLocation != ''">f_location,</if>
<if test="index != null">f_index,</if>
<if test="rid != null">f_rid,</if>
<if test="inboundTime != null">f_inbound_time,</if>
<if test="outboundTime != null">f_outbound_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="shelfId != null">#{shelfId},</if>
<if test="label != null">#{label},</if>
<if test="location != null and location != ''">#{location},</if>
<if test="index != null">#{index},</if>
<if test="rid != null">#{rid},</if>
<if test="inboundTime != null">#{inboundTime},</if>
<if test="outboundTime != null">#{outboundTime},</if>
</trim>
</insert>
<update id="updateTShelfStorageLocation" parameterType="TShelfStorageLocation">
update t_shelf_storage_location
<trim prefix="SET" suffixOverrides=",">
<if test="shelfId != null">f_shelf_id = #{shelfId},</if>
<if test="label != null">f_label = #{label},</if>
<if test="location != null and location != ''">f_location = #{location},</if>
<if test="index != null">f_index = #{index},</if>
<if test="rid != null">f_rid = #{rid},</if>
<if test="inboundTime != null">f_inbound_time = #{inboundTime},</if>
<if test="outboundTime != null">f_outbound_time = #{outboundTime},</if>
</trim>
where f_shelf_storage_location_id = #{fShelfStorageLocationId}
</update>
<delete id="deleteTShelfStorageLocationById" parameterType="Long">
delete from t_shelf_storage_location where f_shelf_storage_location_id = #{shelfStorageLocationId}
</delete>
<delete id="deleteTShelfStorageLocationByIds" parameterType="String">
delete from t_shelf_storage_location where f_shelf_storage_location_id in
<foreach item="fShelfStorageLocationId" collection="array" open="(" separator="," close=")">
#{shelfStorageLocationId}
</foreach>
</delete>
</mapper>
\ No newline at end of file
import request from '@/utils/request'
// 查询料架信息列表
export function listInfo(query) {
return request({
url: '/shelf/info/list',
method: 'get',
params: query
})
}
//查询所有货架
export function shelfListInfo(query) {
return request({
url: '/shelf/info/shelfListInfo',
method: 'get',
params: query
})
}
// 查询料架信息详细
export function getInfo(fShelfId) {
return request({
url: '/shelf/info/' + fShelfId,
method: 'get'
})
}
// 新增料架信息
export function addInfo(data) {
return request({
url: '/shelf/info',
method: 'post',
data: data
})
}
// 修改料架信息
export function updateInfo(data) {
return request({
url: '/shelf/info',
method: 'put',
data: data
})
}
// 删除料架信息
export function delInfo(fShelfId) {
return request({
url: '/shelf/info/' + fShelfId,
method: 'delete'
})
}
// 导出料架信息
export function exportInfo(query) {
return request({
url: '/shelf/info/export',
method: 'get',
params: query
})
}
import request from '@/utils/request'
// 查询储位信息列表
export function listLocation(query) {
return request({
url: '/shelf/location/list',
method: 'get',
params: query
})
}
// 查询储位信息列表
export function locationListInfo(query) {
return request({
url: '/shelf/location/locationListInfo',
method: 'get',
params: query
})
}
// 查询储位信息详细
export function getLocation(fShelfStorageLocationId) {
return request({
url: '/shelf/location/' + fShelfStorageLocationId,
method: 'get'
})
}
// 新增储位信息
export function addLocation(data) {
return request({
url: '/shelf/location',
method: 'post',
data: data
})
}
// 修改储位信息
export function updateLocation(data) {
return request({
url: '/shelf/location',
method: 'put',
data: data
})
}
// 删除储位信息
export function delLocation(fShelfStorageLocationId) {
return request({
url: '/shelf/location/' + fShelfStorageLocationId,
method: 'delete'
})
}
// 导出储位信息
export function exportLocation(query) {
return request({
url: '/shelf/location/export',
method: 'get',
params: query
})
}
<template>
<div class="app-container">
<el-button
style="float: right"
type="primary"
icon="el-icon-back"
@click="$router.go(-1)"
>
返回
</el-button>
<div class="location-operate">
<div class="scanner-input">
<span>料盘码:</span>
<el-input ref="barCode" placeholder="扫描料盘条形码..." v-model="barCode" clearable/>
</div>
<div class="operate">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleIn"
>入库</el-button>
<el-button
type="primary"
plain
icon="el-icon-minus"
size="mini"
@click="handleOut"
>出库</el-button>
</div>
</div>
<div class="location-list">
<div :class="['grid-row', index < 6 ? 'top-rows' : 'bottom-rows']" v-for="(layout,index) in shelfLayoutList">
<div class="row-title">{{ storey[index] }}</div>
<div
:id="'item-'+ location.index"
:data-index="location.index"
:class="[location.rid ? 'used' : 'grid-item']"
v-for="location in layout"
@click="checkedLocation($event)"
>
<el-tooltip
effect="light"
v-if="location.rid"
:content="location.rid"
placement="top"
>
<span>{{ location.label }}</span>
</el-tooltip>
<span v-else>{{ location.label }}</span>
</div>
</div>
</div>
</div>
</template>
<script>
import { locationListInfo,listLocation, getLocation, delLocation, addLocation, updateLocation, exportLocation } from "@/api/shelf/location";
export default {
name: "shelf-location",
data(){
return{
barCode: null,
shelfInfo: [],
shelfLayoutList: [],
storey:{
0: "一层正面",
1: "一层反面",
2: "二层正面",
3: "二层反面",
4: "三层正面",
5: "三层反面",
6: "四层正面",
7: "五层正面",
},
lastSelectedItem: null,
lastCtrlSelectedItem: null,
selectedItems: new Set(),
// 查询参数
queryParams: {
shelfId: null,
},
}
},
created(){
this.queryParams.shelfId = this.$route.query.shelfId;
this.getList();
this.$nextTick(() => {
this.$refs.barCode.focus();
})
},
methods:{
getList(){
locationListInfo(this.queryParams).then(res => {
// 1 正 1-80 反 241-320
// 2 正 81-160 反 321-400
// 3 正 161-240 反 401-480
// 4 正 481-428
// 5 正 529-576
this.shelfInfo = res.data;
this.shelfLayoutList.push(this.shelfInfo.slice(0,80));
this.shelfLayoutList.push(this.shelfInfo.slice(240,320));
this.shelfLayoutList.push(this.shelfInfo.slice(80,160));
this.shelfLayoutList.push(this.shelfInfo.slice(320,400));
this.shelfLayoutList.push(this.shelfInfo.slice(160,240));
this.shelfLayoutList.push(this.shelfInfo.slice(400,480));
this.shelfLayoutList.push(this.shelfInfo.slice(480,528));
this.shelfLayoutList.push(this.shelfInfo.slice(528));
});
},
//选中位置
checkedLocation(event){
if(event.ctrlKey){
if(!this.lastCtrlSelected){
this.lastCtrlSelected = event.currentTarget.id;
if(this.selectedItems.has(event.currentTarget.id)){
this.selectedItems.delete(event.currentTarget.id);
}else{
this.selectedItems.add(event.currentTarget.id);
}
event.currentTarget.classList.toggle('checked');
return;
}
this.breakSelected(this.lastCtrlSelected,event.currentTarget.id);
}else if (event.shiftKey && this.lastSelectedItem){
this.keepSelected(this.lastSelectedItem,event.currentTarget.id);
}else{
const location = this.shelfInfo[event.currentTarget.dataset.index - 1];
console.log(event.currentTarget.dataset,"================",location)
if(!location.rid){
this.clearSelection();
this.selectedItems.add(event.currentTarget.id);
event.currentTarget.classList.add('checked');
this.lastSelectedItem = event.currentTarget.id;
}
}
},
// 连续选中
keepSelected(startId, endId) {
this.clearSelection();
const allItems = Array.from(document.querySelectorAll('.grid-item'));
const startIndex = allItems.findIndex(item => item.id == startId);
const endIndex = allItems.findIndex(item => item.id == endId);
if (startIndex === -1 || endIndex === -1) return;
const minIndex = Math.min(startIndex, endIndex);
const maxIndex = Math.max(startIndex, endIndex);
for (let i = minIndex; i <= maxIndex; i++) {
const itemId = allItems[i].id;
this.selectedItems.add(itemId);
allItems[i].classList.toggle('checked');
}
this.lastSelectedItem = endId;
},
// 断续选中
breakSelected(startId, endId) {
const allItems = Array.from(document.querySelectorAll('.grid-item'));
const startIndex = allItems.findIndex(item => item.id == startId);
const endIndex = allItems.findIndex(item => item.id == endId);
if (startIndex === -1 || endIndex === -1) return;
const minIndex = Math.min(startIndex, endIndex);
const maxIndex = Math.max(startIndex, endIndex);
for (let i = minIndex + 1; i <= maxIndex; i++) {
const itemId = allItems[i].id;
if(this.selectedItems.has(itemId)){
this.selectedItems.delete(itemId);
}else{
this.selectedItems.add(itemId);
}
allItems[i].classList.toggle('checked');
}
this.lastCtrlSelected = null;
},
// 清除所有选择
clearSelection() {
this.selectedItems.forEach(itemId => {
const item = document.getElementById(itemId);
if (item) {
item.classList.remove('checked');
}
});
this.selectedItems.clear();
},
// 入库操作需要扫码不需要选位置
handleIn(){
if(!this.barCode){
this.$message.error("请扫描或输入料盘条形码");
return
}
},
// 出库操作需要选择位置可多选不需要扫码
handleOut(){
if(this.selectedItems.size == 0){
this.$message.error("请选择出库位置");
return;
}
},
}
}
</script>
<style scoped lang="scss">
.location-operate{
width: 100%;
margin-top: 15px;
span{
margin-right: 20px;
font-size: 18px;
font-weight: 600;
}
}
.scanner-input{
width: 100%;
.el-input{
width: 350px;
}
}
.operate{
margin-top: 20px;
}
.location-list{
display: grid;
grid-template-rows: repeat(5, 1fr);
gap: 12px;
margin-top: 15px;
}
.grid-item {
background: rgba(255, 255, 255, 0.1);
border-radius: 8px;
padding: 15px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.2);
transition: transform 0.3s ease, box-shadow 0.3s ease;
cursor: pointer;
overflow: hidden;
position: relative;
aspect-ratio: 1/1;
margin-bottom: 10px;
user-select: none;
}
.grid-item::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), transparent);
}
.grid-row {
display: grid;
gap: 3px;
//height: 120px;
overflow-x: scroll;
white-space: nowrap;
}
/* 简约风格滚动条 */
.grid-row::-webkit-scrollbar {
height: 6px;
}
.grid-row::-webkit-scrollbar-track {
background: transparent;
}
.grid-row::-webkit-scrollbar-thumb {
background: #ccc;
border-radius: 4px;
}
.grid-row::-webkit-scrollbar-thumb:hover {
background: #aaa;
}
.top-rows{
grid-template-columns: 110px repeat(80, minmax(30px, 1fr));
}
.bottom-rows {
grid-template-columns: 110px repeat(48, minmax(30px, 1fr));
}
.row-title {
display: flex;
align-items: center;
justify-content: center;
font-weight: 600;
font-size: 1.2rem;
user-select: none;
}
.free{
background-color: #FFFFFF;
}
.used{
background: #2ca72d;
border-radius: 8px;
padding: 15px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
box-shadow: 0 4px 4px rgba(0, 0, 0, 0.2);
transition: transform 0.3s ease, box-shadow 0.3s ease;
cursor: pointer;
overflow: hidden;
position: relative;
aspect-ratio: 1/1;
margin-bottom: 10px;
}
.checked {
background: rgba(24, 144, 255, 1);
border: 1px solid rgb(24, 112, 214);
}
</style>
<template>
<div class="app-container">
<h1 style="text-align: center">智能货架列表</h1>
<div class="shelves-list">
<div :class="['shelves-info',statusInfo[shelves.fStatus]&&statusInfo[shelves.fStatus].style]" v-for="shelves in shelvesList">
<el-tooltip effect="light" :content="statusInfo[shelves.fStatus]&&statusInfo[shelves.fStatus].name" placement="top">
<div
class="content"
@click="toStorage(shelves)"
>
{{ shelves.fShelf }}
</div>
</el-tooltip>
</div>
</div>
</div>
</template>
<script>
import { shelfListInfo,listInfo, getInfo, delInfo, addInfo, updateInfo, exportInfo } from "@/api/shelf/info";
export default {
name: "produce-manage-index",
data(){
return{
shelvesList: [
{shelf: "001",status: 1},
{shelf: "002",status: 0},
{shelf: "003",status: 1},
{shelf: "004",status: 0},
{shelf: "005",status: 1},
{shelf: "006",status: 0},
{shelf: "007",status: 1},
],
statusInfo:{
0: {
name: "离线",
style: "leave"
},
1: {
name: "就绪",
style: "ready"
}
},
// 查询参数
queryParams: {
fType: 1,
fShelf: null,
fStatus: null
},
}
},
created(){
this.getList();
},
methods:{
getList() {
shelfListInfo(this.queryParams).then(res => {
this.shelvesList = res.data;
});
},
toStorage(shelves){
if(shelves.fStatus == 1){
this.$router.push({ path: "/producemange/shelfLocation",query: { shelfId: shelves.fShelfId } });
}
}
}
}
</script>
<style scoped lang="scss">
.app-container{
padding: 30px;
}
.shelves-list{
display: grid;
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
gap: 25px;
}
.shelves-info {
background: white;
border-radius: 12px;
overflow: hidden;
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
transition: transform 0.3s, box-shadow 0.3s;
aspect-ratio: 1/1;
}
.content{
width: 100%;
height: 100%;
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
.leave{
background-color: #cccccc;
color: white;
}
.ready{
background-color: #13ce66;
color: white;
}
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment