修正算法BUG
This commit is contained in:
parent
43bb62dbdc
commit
a17bd18444
@ -165,7 +165,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService {
|
||||
// 获取库位列表
|
||||
WmStorageArea wmStorageAreaQuery = new WmStorageArea();
|
||||
wmStorageAreaQuery.setLocationId(wmStorageLocationByCode.getLocationId());
|
||||
if (isBig) wmStorageAreaQuery.setAttr3(1L);
|
||||
wmStorageAreaQuery.setAttr3(isBig ? 1L : 0L);
|
||||
List<WmStorageArea> wmStorageAreaList = this.wmStorageAreaMapper.selectWmStorageAreaList(wmStorageAreaQuery).stream()
|
||||
// 过滤掉全部存在物品的库位
|
||||
.filter(it -> !selectNotEmptyAreaCodeList.contains(it.getAreaCode()))
|
||||
|
@ -3,7 +3,6 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ktg.mes.wm.mapper.WmStorageAreaMapper">
|
||||
|
||||
<resultMap type="WmStorageArea" id="WmStorageAreaResult">
|
||||
<result property="areaId" column="area_id"/>
|
||||
<result property="areaCode" column="area_code"/>
|
||||
@ -52,139 +51,323 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</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
|
||||
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>
|
||||
|
||||
<select id="selectWmStorageAreaList" parameterType="WmStorageArea" resultMap="WmStorageAreaResult">
|
||||
<include refid="selectWmStorageAreaVo"/>
|
||||
<where>
|
||||
<if test="areaCode != null and areaCode != ''"> and area_code like concat('%', #{areaCode}, '%') </if>
|
||||
<if test="areaName != null and areaName != ''"> and area_name like concat('%', #{areaName}, '%')</if>
|
||||
<if test="locationId != null "> and location_id like concat('%', #{locationId}, '%') </if>
|
||||
<if test="area != null "> and like concat('%',#{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>
|
||||
<if test="areaCode != null and areaCode != ''">
|
||||
and area_code like concat('%', #{areaCode}, '%')
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
and area_name like concat('%', #{areaName}, '%')
|
||||
</if>
|
||||
<if test="locationId != null">
|
||||
and location_id like concat('%', #{locationId}, '%')
|
||||
</if>
|
||||
<if test="area != null">
|
||||
and like concat('%', #{area}, '%')
|
||||
</if>
|
||||
<if test="maxLoa != null">
|
||||
and max_loa = #{maxLoa}
|
||||
</if>
|
||||
<if test="attr3 != null">
|
||||
and attr3 = #{attr3}
|
||||
</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>
|
||||
and IS_DELETE = 0
|
||||
</where>
|
||||
ORDER BY AREA_CODE ASC
|
||||
</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
|
||||
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 w.area_code like concat('%', #{areaCode}, '%') </if>
|
||||
<if test="areaName != null and areaName != ''"> and w.area_name like concat('%', #{areaName}, '%')</if>
|
||||
<if test="locationId != null "> and w.location_id like concat('%', #{locationId}, '%') </if>
|
||||
<if test="area != null "> and like concat('%',#{area}, '%') </if>
|
||||
<if test="maxLoa != null "> and max_loa = #{maxLoa}</if>
|
||||
<if test="positionX != null and positionX !=0 "> and w.position_x = #{positionX}</if>
|
||||
<if test="positionY != null and positionY !=0"> and w.position_y = #{positionY}</if>
|
||||
<if test="positionZ != null and positionZ !=0"> and w.position_z = #{positionZ}</if>
|
||||
<if test="enableFlag != null and enableFlag != ''"> and w.enable_flag = #{enableFlag}</if>
|
||||
<if test="areaCode != null and areaCode != ''">
|
||||
and w.area_code like concat('%', #{areaCode}, '%')
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
and w.area_name like concat('%', #{areaName}, '%')
|
||||
</if>
|
||||
<if test="locationId != null">
|
||||
and w.location_id like concat('%', #{locationId}, '%')
|
||||
</if>
|
||||
<if test="area != null">
|
||||
and like concat('%', #{area}, '%')
|
||||
</if>
|
||||
<if test="maxLoa != null">
|
||||
and max_loa = #{maxLoa}
|
||||
</if>
|
||||
<if test="positionX != null and positionX != 0">
|
||||
and w.position_x = #{positionX}
|
||||
</if>
|
||||
<if test="positionY != null and positionY != 0">
|
||||
and w.position_y = #{positionY}
|
||||
</if>
|
||||
<if test="positionZ != null and positionZ != 0">
|
||||
and w.position_z = #{positionZ}
|
||||
</if>
|
||||
<if test="enableFlag != null and enableFlag != ''">
|
||||
and w.enable_flag = #{enableFlag}
|
||||
</if>
|
||||
and w.IS_DELETE = 0
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectWmStorageAreaByAreaId" parameterType="Long" resultMap="WmStorageAreaResult">
|
||||
<include refid="selectWmStorageAreaVo"/>
|
||||
where area_id = #{areaId} and IS_DELETE = 0
|
||||
where area_id = #{areaId}
|
||||
and IS_DELETE = 0
|
||||
</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} and w.IS_DELETE = 0
|
||||
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}
|
||||
and w.IS_DELETE = 0
|
||||
</select>
|
||||
|
||||
<select id="selectWmStorageAreaByAreaCode" parameterType="String" resultMap="WmStorageAreaResult">
|
||||
<include refid="selectWmStorageAreaVo"/>
|
||||
where area_code = #{areaCode} and IS_DELETE = 0
|
||||
where area_code = #{areaCode}
|
||||
and IS_DELETE = 0
|
||||
</select>
|
||||
<select id="getAll" resultType="com.ktg.mes.wm.domain.WmStorageArea" resultMap="WmStorageAreaResult">
|
||||
SELECT * FROM wm_storage_area where IS_DELETE = 0
|
||||
SELECT *
|
||||
FROM wm_storage_area
|
||||
where IS_DELETE = 0
|
||||
</select>
|
||||
|
||||
<insert id="insertWmStorageArea" parameterType="WmStorageArea" useGeneratedKeys="true" keyProperty="areaId">
|
||||
insert into wm_storage_area
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="areaCode != null and areaCode != ''">area_code,</if>
|
||||
<if test="areaName != null and areaName != ''">area_name,</if>
|
||||
<if test="locationId != null">location_id,</if>
|
||||
<if test="area != null">area,</if>
|
||||
<if test="maxLoa != null">max_loa,</if>
|
||||
<if test="positionX != null">position_x,</if>
|
||||
<if test="positionY != null">position_y,</if>
|
||||
<if test="positionZ != null">position_z,</if>
|
||||
<if test="enableFlag != null">enable_flag,</if>
|
||||
<if test="frozenFlag != null">frozen_flag,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="attr1 != null">attr1,</if>
|
||||
<if test="attr2 != null">attr2,</if>
|
||||
<if test="attr3 != null">attr3,</if>
|
||||
<if test="attr4 != null">attr4,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="areaCode != null and areaCode != ''">
|
||||
area_code,
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
area_name,
|
||||
</if>
|
||||
<if test="locationId != null">
|
||||
location_id,
|
||||
</if>
|
||||
<if test="area != null">
|
||||
area,
|
||||
</if>
|
||||
<if test="maxLoa != null">
|
||||
max_loa,
|
||||
</if>
|
||||
<if test="positionX != null">
|
||||
position_x,
|
||||
</if>
|
||||
<if test="positionY != null">
|
||||
position_y,
|
||||
</if>
|
||||
<if test="positionZ != null">
|
||||
position_z,
|
||||
</if>
|
||||
<if test="enableFlag != null">
|
||||
enable_flag,
|
||||
</if>
|
||||
<if test="frozenFlag != null">
|
||||
frozen_flag,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
<if test="attr1 != null">
|
||||
attr1,
|
||||
</if>
|
||||
<if test="attr2 != null">
|
||||
attr2,
|
||||
</if>
|
||||
<if test="attr3 != null">
|
||||
attr3,
|
||||
</if>
|
||||
<if test="attr4 != null">
|
||||
attr4,
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="areaCode != null and areaCode != ''">#{areaCode},</if>
|
||||
<if test="areaName != null and areaName != ''">#{areaName},</if>
|
||||
<if test="locationId != null">#{locationId},</if>
|
||||
<if test="area != null">#{area},</if>
|
||||
<if test="maxLoa != null">#{maxLoa},</if>
|
||||
<if test="positionX != null">#{positionX},</if>
|
||||
<if test="positionY != null">#{positionY},</if>
|
||||
<if test="positionZ != null">#{positionZ},</if>
|
||||
<if test="enableFlag != null">#{enableFlag},</if>
|
||||
<if test="frozenFlag != null">#{frozenFlag},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="attr1 != null">#{attr1},</if>
|
||||
<if test="attr2 != null">#{attr2},</if>
|
||||
<if test="attr3 != null">#{attr3},</if>
|
||||
<if test="attr4 != null">#{attr4},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="areaCode != null and areaCode != ''">
|
||||
#{areaCode},
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
#{areaName},
|
||||
</if>
|
||||
<if test="locationId != null">
|
||||
#{locationId},
|
||||
</if>
|
||||
<if test="area != null">
|
||||
#{area},
|
||||
</if>
|
||||
<if test="maxLoa != null">
|
||||
#{maxLoa},
|
||||
</if>
|
||||
<if test="positionX != null">
|
||||
#{positionX},
|
||||
</if>
|
||||
<if test="positionY != null">
|
||||
#{positionY},
|
||||
</if>
|
||||
<if test="positionZ != null">
|
||||
#{positionZ},
|
||||
</if>
|
||||
<if test="enableFlag != null">
|
||||
#{enableFlag},
|
||||
</if>
|
||||
<if test="frozenFlag != null">
|
||||
#{frozenFlag},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="attr1 != null">
|
||||
#{attr1},
|
||||
</if>
|
||||
<if test="attr2 != null">
|
||||
#{attr2},
|
||||
</if>
|
||||
<if test="attr3 != null">
|
||||
#{attr3},
|
||||
</if>
|
||||
<if test="attr4 != null">
|
||||
#{attr4},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateWmStorageArea" parameterType="WmStorageArea">
|
||||
update wm_storage_area
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="areaCode != null and areaCode != ''">area_code = #{areaCode},</if>
|
||||
<if test="areaName != null and areaName != ''">area_name = #{areaName},</if>
|
||||
<if test="locationId != null">location_id = #{locationId},</if>
|
||||
<if test="area != null">area = #{area},</if>
|
||||
<if test="maxLoa != null">max_loa = #{maxLoa},</if>
|
||||
<if test="positionX != null">position_x = #{positionX},</if>
|
||||
<if test="positionY != null">position_y = #{positionY},</if>
|
||||
<if test="positionZ != null">position_z = #{positionZ},</if>
|
||||
<if test="enableFlag != null">enable_flag = #{enableFlag},</if>
|
||||
<if test="frozenFlag != null">frozen_flag = #{frozenFlag},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="attr1 != null">attr1 = #{attr1},</if>
|
||||
<if test="attr2 != null">attr2 = #{attr2},</if>
|
||||
<if test="attr3 != null">attr3 = #{attr3},</if>
|
||||
<if test="attr4 != null">attr4 = #{attr4},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="areaCode != null and areaCode != ''">
|
||||
area_code = #{areaCode},
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
area_name = #{areaName},
|
||||
</if>
|
||||
<if test="locationId != null">
|
||||
location_id = #{locationId},
|
||||
</if>
|
||||
<if test="area != null">
|
||||
area = #{area},
|
||||
</if>
|
||||
<if test="maxLoa != null">
|
||||
max_loa = #{maxLoa},
|
||||
</if>
|
||||
<if test="positionX != null">
|
||||
position_x = #{positionX},
|
||||
</if>
|
||||
<if test="positionY != null">
|
||||
position_y = #{positionY},
|
||||
</if>
|
||||
<if test="positionZ != null">
|
||||
position_z = #{positionZ},
|
||||
</if>
|
||||
<if test="enableFlag != null">
|
||||
enable_flag = #{enableFlag},
|
||||
</if>
|
||||
<if test="frozenFlag != null">
|
||||
frozen_flag = #{frozenFlag},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
<if test="attr1 != null">
|
||||
attr1 = #{attr1},
|
||||
</if>
|
||||
<if test="attr2 != null">
|
||||
attr2 = #{attr2},
|
||||
</if>
|
||||
<if test="attr3 != null">
|
||||
attr3 = #{attr3},
|
||||
</if>
|
||||
<if test="attr4 != null">
|
||||
attr4 = #{attr4},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</trim>
|
||||
where area_id = #{areaId}
|
||||
</update>
|
||||
|
||||
<update id="deleteWmStorageAreaByAreaId" parameterType="Long">
|
||||
update wm_storage_area set IS_DELETE =1
|
||||
update wm_storage_area
|
||||
set IS_DELETE =1
|
||||
where area_id = #{areaId}
|
||||
</update>
|
||||
|
||||
<update id="deleteWmStorageAreaByAreaIds" parameterType="String">
|
||||
update wm_storage_area set IS_DELETE = 1
|
||||
update wm_storage_area
|
||||
set IS_DELETE = 1
|
||||
where area_id in
|
||||
<foreach item="areaId" collection="array" open="(" separator="," close=")">
|
||||
#{areaId}
|
||||
@ -192,13 +375,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</update>
|
||||
|
||||
<update id="deleteByWarehouseId" parameterType="Long">
|
||||
update wm_storage_area set IS_DELETE =1
|
||||
update wm_storage_area
|
||||
set IS_DELETE =1
|
||||
where location_id in (select location_id from wm_storage_location where warehouse_id = #{warehouseId})
|
||||
</update>
|
||||
|
||||
<update id="deleteByLocationId" parameterType="Long">
|
||||
update wm_storage_area set IS_DELETE = 1
|
||||
update wm_storage_area
|
||||
set IS_DELETE = 1
|
||||
where location_id = #{locationId}
|
||||
</update>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue
Block a user