库房、库位、库区管理查询方法修改

This commit is contained in:
star 2024-10-30 17:07:46 +08:00
parent b0de1e3f05
commit 0cb7c07dc7
11 changed files with 420 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.wm.domain.vo.AreaVo;
import com.ktg.mes.wm.utils.WmBarCodeUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
@ -47,7 +48,7 @@ public class WmStorageAreaController extends BaseController
public TableDataInfo list(WmStorageArea wmStorageArea)
{
startPage();
List<WmStorageArea> list = wmStorageAreaService.selectWmStorageAreaList(wmStorageArea);
List<AreaVo> list = wmStorageAreaService.selectWmStorageAreaListVo(wmStorageArea);
return getDataTable(list);
}
@ -71,7 +72,7 @@ public class WmStorageAreaController extends BaseController
@GetMapping(value = "/{areaId}")
public AjaxResult getInfo(@PathVariable("areaId") Long areaId)
{
return AjaxResult.success(wmStorageAreaService.selectWmStorageAreaByAreaId(areaId));
return AjaxResult.success(wmStorageAreaService.selectWmStorageAreaByAreaIdVo(areaId));
}
/**

View File

@ -4,6 +4,7 @@ import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import com.ktg.mes.wm.service.IWmStorageAreaService;
import com.ktg.mes.wm.utils.WmBarCodeUtil;
import org.springframework.security.access.prepost.PreAuthorize;
@ -52,7 +53,7 @@ public class WmStorageLocationController extends BaseController
public TableDataInfo list(WmStorageLocation wmStorageLocation)
{
startPage();
List<WmStorageLocation> list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation);
List<WmStorageLocationVo> list = wmStorageLocationService.selectWmStorageLocationListVo(wmStorageLocation);
return getDataTable(list);
}
@ -76,7 +77,7 @@ public class WmStorageLocationController extends BaseController
@GetMapping(value = "/{locationId}")
public AjaxResult getInfo(@PathVariable("locationId") Long locationId)
{
return AjaxResult.success(wmStorageLocationService.selectWmStorageLocationByLocationId(locationId));
return AjaxResult.success(wmStorageLocationService.selectWmStorageLocationVoByLocationId(locationId));
}
/**

View File

@ -0,0 +1,193 @@
package com.ktg.mes.wm.domain.vo;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
import com.ktg.mes.wm.domain.WmStorageArea;
import java.math.BigDecimal;
import java.util.List;
/**
* 库区返回结果集
*
*/
public class WmStorageLocationVo extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 库区ID */
private Long locationId;
/** 仓库名称*/
private String warehouseName;
/** 库区编码 */
@Excel(name = "库区编码")
private String locationCode;
/** 库区名称 */
@Excel(name = "库区名称")
private String locationName;
/** 仓库ID */
@Excel(name = "仓库ID")
private Long warehouseId;
/** 面积 */
@Excel(name = "面积")
private BigDecimal area;
/** 是否开启库位管理 */
@Excel(name = "是否开启库位管理")
private String areaFlag;
private String frozenFlag;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
private List<WmStorageArea> children;
public String getWarehouseName() {
return warehouseName;
}
public void setWarehouseName(String warehouseName) {
this.warehouseName = warehouseName;
}
public void setLocationId(Long locationId)
{
this.locationId = locationId;
}
public Long getLocationId()
{
return locationId;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setLocationName(String locationName)
{
this.locationName = locationName;
}
public String getLocationName()
{
return locationName;
}
public void setWarehouseId(Long warehouseId)
{
this.warehouseId = warehouseId;
}
public Long getWarehouseId()
{
return warehouseId;
}
public void setArea(BigDecimal area)
{
this.area = area;
}
public BigDecimal getArea()
{
return area;
}
public void setAreaFlag(String areaFlag)
{
this.areaFlag = areaFlag;
}
public String getAreaFlag()
{
return areaFlag;
}
public String getFrozenFlag() {
return frozenFlag;
}
public void setFrozenFlag(String frozenFlag) {
this.frozenFlag = frozenFlag;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(Long attr3)
{
this.attr3 = attr3;
}
public Long getAttr3()
{
return attr3;
}
public void setAttr4(Long attr4)
{
this.attr4 = attr4;
}
public Long getAttr4()
{
return attr4;
}
public List<WmStorageArea> getChildren() {
return children;
}
public void setChildren(List<WmStorageArea> children) {
this.children = children;
}
@Override
public String toString() {
return "WmStorageLocation{" +
"locationId=" + locationId +
", locationCode='" + locationCode + '\'' +
", locationName='" + locationName + '\'' +
", warehouseId=" + warehouseId +
", area=" + area +
", areaFlag='" + areaFlag + '\'' +
", attr1='" + attr1 + '\'' +
", attr2='" + attr2 + '\'' +
", attr3=" + attr3 +
", attr4=" + attr4 +
", children=" + children +
'}';
}
}

View File

@ -2,6 +2,8 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.vo.AreaVo;
import org.apache.ibatis.annotations.Select;
/**
* 库位设置Mapper接口
@ -9,8 +11,13 @@ import com.ktg.mes.wm.domain.WmStorageArea;
* @author yinjinlu
* @date 2022-05-08
*/
public interface WmStorageAreaMapper
public interface WmStorageAreaMapper
{
/**
* 获取所有库位
*/
public List<WmStorageArea> getAll();
/**
* 查询库位设置
*
@ -19,6 +26,14 @@ public interface WmStorageAreaMapper
*/
public WmStorageArea selectWmStorageAreaByAreaId(Long areaId);
/**
* 查询库位Vo设置
*
* @param areaId 库位设置主键
* @return 库位设置
*/
public AreaVo selectWmStorageAreaByAreaIdVo(Long areaId);
/**
* 根据库位编码查询库位
@ -35,6 +50,14 @@ public interface WmStorageAreaMapper
*/
public List<WmStorageArea> selectWmStorageAreaList(WmStorageArea wmStorageArea);
/**
* 查询库位vo设置列表
*
* @param wmStorageArea 库位设置
* @return 库位设置集合
*/
public List<AreaVo> selectWmStorageAreaListVo(WmStorageArea wmStorageArea);
/**
* 新增库位设置
*

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.mapper;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
/**
* 库区设置Mapper接口
@ -19,6 +20,14 @@ public interface WmStorageLocationMapper
*/
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId);
/**
* 查询库区设置
*
* @param locationId 库区设置主键
* @return 库区设置
*/
public WmStorageLocationVo selectWmStorageLocationByVoLocationId(Long locationId);
/**
* 根据库区编码查询库区
* @param locationCode
@ -34,6 +43,14 @@ public interface WmStorageLocationMapper
*/
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation);
/**
* 查询库区Vo设置列表
*
* @param wmStorageLocation 库区设置
* @return 库区设置集合
*/
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation);
public WmStorageLocation checkLocationCodeUnique(WmStorageLocation wmStorageLocation);
public WmStorageLocation checkLocationNameUnique(WmStorageLocation wmStorageLocation);

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.vo.AreaVo;
/**
* 库位设置Service接口
@ -19,6 +20,14 @@ public interface IWmStorageAreaService
*/
public WmStorageArea selectWmStorageAreaByAreaId(Long areaId);
/**
* 查询库位vo设置
*
* @param areaId 库位设置主键
* @return 库位设置
*/
public AreaVo selectWmStorageAreaByAreaIdVo(Long areaId);
/**
* 根据库位编码查询库位
@ -35,6 +44,14 @@ public interface IWmStorageAreaService
*/
public List<WmStorageArea> selectWmStorageAreaList(WmStorageArea wmStorageArea);
/**
* 查询库位Vo列表
*
* @param wmStorageArea 库位设置
* @return 库位设置集合
*/
public List<AreaVo> selectWmStorageAreaListVo(WmStorageArea wmStorageArea);
/**
* 新增库位设置
*

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.service;
import java.util.List;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
/**
* 库区设置Service接口
@ -19,6 +20,14 @@ public interface IWmStorageLocationService
*/
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId);
/**
* 查询库区
*
* @param locationId 库区设置主键
* @return 库区设置
*/
public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId);
/**
* 根据库区编码查询库区
@ -36,6 +45,13 @@ public interface IWmStorageLocationService
*/
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation);
/**
* 查询库区Vo设置列表
*
* @param wmStorageLocation 库区设置
* @return 库区设置集合
*/
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation);
/**
* 检查库区编码是否唯一

View File

@ -2,6 +2,7 @@ package com.ktg.mes.wm.service.impl;
import java.util.List;
import com.ktg.common.utils.DateUtils;
import com.ktg.mes.wm.domain.vo.AreaVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
@ -32,6 +33,21 @@ public class WmStorageAreaServiceImpl implements IWmStorageAreaService
return wmStorageAreaMapper.selectWmStorageAreaByAreaId(areaId);
}
/**
* 查询库位Vo设置
*
* @param areaId 库位设置主键
* @return 库位设置
*/
@Override
public AreaVo selectWmStorageAreaByAreaIdVo(Long areaId)
{
AreaVo areaVo = wmStorageAreaMapper.selectWmStorageAreaByAreaIdVo(areaId);
AreaVo areaVo1 = wmStorageAreaMapper.selectWmStorageAreaByAreaIdVo(Long.parseLong(areaVo.getAttr1()));
areaVo.setSuperiorName(areaVo1.getAreaName());
return areaVo;
}
@Override
public WmStorageArea selectWmStorageAreaByAreaCode(String areaCode) {
return wmStorageAreaMapper.selectWmStorageAreaByAreaCode(areaCode);
@ -49,6 +65,25 @@ public class WmStorageAreaServiceImpl implements IWmStorageAreaService
return wmStorageAreaMapper.selectWmStorageAreaList(wmStorageArea);
}
/**
* 查询库位Vo设置列表
*
* @param wmStorageArea 库位设置
* @return 库位设置
*/
@Override
public List<AreaVo> selectWmStorageAreaListVo(WmStorageArea wmStorageArea)
{
List<AreaVo> areaVos = wmStorageAreaMapper.selectWmStorageAreaListVo(wmStorageArea);
List<WmStorageArea> areaVos1 = wmStorageAreaMapper.getAll();
for (WmStorageArea vo : areaVos1) {
for (AreaVo vo1 : areaVos)
if (vo1.getAttr1().equals(vo.getAreaId().toString()))
vo1.setSuperiorName(vo.getAreaName());
}
return areaVos;
}
/**
* 新增库位设置
*

View File

@ -5,6 +5,7 @@ import java.util.List;
import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import org.apache.catalina.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -36,6 +37,17 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId);
}
/**
* 查询库区设置
*
* @param locationId 库区设置主键
* @return 库区设置
*/
@Override
public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId)
{
return wmStorageLocationMapper.selectWmStorageLocationByVoLocationId(locationId);
}
@Override
public WmStorageLocation selectWmStorageLocationByLocationCode(String locationCode) {
return wmStorageLocationMapper.selectWmStorageLocationByLocationCode(locationCode);
@ -53,6 +65,18 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation);
}
/**
* 查询库区Vo设置列表
*
* @param wmStorageLocation 库区设置
* @return 库区设置
*/
@Override
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation)
{
return wmStorageLocationMapper.selectWmStorageLocationListVo(wmStorageLocation);
}
@Override
public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation) {
WmStorageLocation location = wmStorageLocationMapper.checkLocationCodeUnique(wmStorageLocation);

View File

@ -27,6 +27,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap type="AreaVo" id="WmStorageAreaVoResult">
<result property="areaId" column="area_id" />
<result property="areaCode" column="area_code" />
<result property="locationName" column="location_name" />
<result property="areaName" column="area_name" />
<result property="locationId" column="location_id" />
<result property="area" column="area" />
<result property="maxLoa" column="max_loa" />
<result property="positionX" column="position_x" />
<result property="positionY" column="position_y" />
<result property="positionZ" column="position_z" />
<result property="enableFlag" column="enable_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<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="selectWmStorageAreaVo">
select area_id, area_code, area_name, location_id, area, max_loa, position_x, position_y, position_z, enable_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_area
</sql>
@ -45,17 +69,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
</where>
</select>
<select id="selectWmStorageAreaListVo" parameterType="AreaVo" resultMap="WmStorageAreaVoResult">
select w.*,l.location_name from wm_storage_area w join wm_storage_location l on w.location_id = l.location_id
<where>
<if test="areaCode != null and areaCode != ''"> and area_code = #{areaCode}</if>
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
<if test="locationId != null "> and w.location_id = #{locationId}</if>
<if test="area != null "> and area = #{area}</if>
<if test="maxLoa != null "> and max_loa = #{maxLoa}</if>
<if test="positionX != null and positionX !=0 "> and position_x = #{positionX}</if>
<if test="positionY != null and positionY !=0"> and position_y = #{positionY}</if>
<if test="positionZ != null and positionZ !=0"> and position_z = #{positionZ}</if>
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
</where>
</select>
<select id="selectWmStorageAreaByAreaId" parameterType="Long" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
where area_id = #{areaId}
</select>
<select id="selectWmStorageAreaByAreaIdVo" parameterType="Long" resultMap="WmStorageAreaVoResult">
select w.*,l.location_name from wm_storage_area w join wm_storage_location l on w.location_id = l.location_id
where area_id = #{areaId}
</select>
<select id="selectWmStorageAreaByAreaCode" parameterType="String" resultMap="WmStorageAreaResult">
<include refid="selectWmStorageAreaVo"/>
where area_code = #{areaCode}
</select>
<select id="getAll" resultType="com.ktg.mes.wm.domain.WmStorageArea" resultMap="WmStorageAreaResult">
SELECT * FROM wm_storage_area
</select>
<insert id="insertWmStorageArea" parameterType="WmStorageArea" useGeneratedKeys="true" keyProperty="areaId">
insert into wm_storage_area
<trim prefix="(" suffix=")" suffixOverrides=",">
@ -144,7 +191,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteByLocationId" parameterType="Long">
delete form wm_storage_area where location_id = #{locationId}
delete from wm_storage_area where location_id = #{locationId}
</delete>
</mapper>

View File

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ktg.mes.wm.mapper.WmStorageLocationMapper">
<resultMap type="WmStorageLocation" id="WmStorageLocationResult">
<result property="locationId" column="location_id" />
<result property="locationCode" column="location_code" />
@ -23,6 +23,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
</resultMap>
<resultMap type="WmStorageLocationVo" id="WmStorageLocationVoResult">
<result property="locationId" column="location_id" />
<result property="locationCode" column="location_code" />
<result property="locationName" column="location_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="area" column="area" />
<result property="areaFlag" column="area_flag" />
<result property="frozenFlag" column="frozen_flag" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="warehouseName" column="warehouse_name" />
</resultMap>
<sql id="selectWmStorageLocationVo">
select location_id, location_code, location_name, warehouse_id, area, area_flag, frozen_flag, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from wm_storage_location
</sql>
@ -37,11 +57,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="areaFlag != null and areaFlag != ''"> and area_flag = #{areaFlag}</if>
</where>
</select>
<select id="selectWmStorageLocationListVo" parameterType="WmStorageLocation" resultMap="WmStorageLocationVoResult">
SELECT l.*, w.warehouse_name
FROM wm_storage_location l
JOIN wm_warehouse w ON w.warehouse_id = l.warehouse_id
<where>
<if test="locationCode != null and locationCode != ''"> AND l.location_code = #{locationCode}</if>
<if test="locationName != null and locationName != ''"> AND l.location_name LIKE CONCAT('%', #{locationName}, '%')</if>
<if test="warehouseId != null"> AND l.warehouse_id = #{warehouseId}</if> <!-- 指定表别名 -->
<if test="area != null"> AND l.area = #{area}</if>
<if test="areaFlag != null and areaFlag != ''"> AND l.area_flag = #{areaFlag}</if>
</where>
</select>
<select id="selectWmStorageLocationByLocationId" parameterType="Long" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>
where location_id = #{locationId}
</select>
<select id="selectWmStorageLocationByVoLocationId" parameterType="Long" resultMap="WmStorageLocationVoResult">
select l.* ,w.warehouse_name from wm_storage_location l
join wm_warehouse w on w.warehouse_id = l.warehouse_id
where location_id = #{locationId}
</select>
<select id="selectWmStorageLocationByLocationCode" parameterType="String" resultMap="WmStorageLocationResult">
<include refid="selectWmStorageLocationVo"/>