优化库位点位处理逻辑
- 移除 HouseAreaDO 中的 areaId 字段 - 修改 WareHouseLocationDO 的处理方式,支持批量导入- 更新 NodeBaseDTO,增加 positionMapId 字段 -调整 PositionMapItemDO 和相关 VO 类,移除 objectId 字段 - 更新数据库映射文件,适应新的数据结构
This commit is contained in:
parent
1444a079de
commit
df480e1b90
@ -1,425 +0,0 @@
|
||||
<?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=".dao.WareHouseLocationDao">
|
||||
|
||||
<resultMap id="BaseResultMap" type=".entity.WareHouseLocation">
|
||||
<!--@Table ware_house_location-->
|
||||
<result property="id" column="id" jdbcType="INTEGER"/>
|
||||
<result property="laneId" column="lane_id" jdbcType="INTEGER"/>
|
||||
<result property="laneName" column="lane_name" jdbcType="VARCHAR"/>
|
||||
<result property="areaId" column="area_id" jdbcType="INTEGER"/>
|
||||
<result property="areaName" column="area_name" jdbcType="VARCHAR"/>
|
||||
<result property="locationNo" column="location_no" jdbcType="VARCHAR"/>
|
||||
<result property="locationYaw" column="location_yaw" jdbcType="VARCHAR"/>
|
||||
<result property="groupName" column="group_name" jdbcType="VARCHAR"/>
|
||||
<result property="skuInfo" column="sku_info" jdbcType="VARCHAR"/>
|
||||
<result property="skuBatch" column="sku_batch" jdbcType="VARCHAR"/>
|
||||
<result property="skuNumber" column="sku_number" jdbcType="INTEGER"/>
|
||||
<result property="trayInfo" column="tray_info" jdbcType="VARCHAR"/>
|
||||
<result property="locationEnable" column="location_enable" jdbcType="INTEGER"/>
|
||||
<result property="locationLock" column="location_lock" jdbcType="INTEGER"/>
|
||||
<result property="locationUseStatus" column="location_use_status" jdbcType="INTEGER"/>
|
||||
<result property="locationX" column="location_x" jdbcType="VARCHAR"/>
|
||||
<result property="locationY" column="location_y" jdbcType="VARCHAR"/>
|
||||
<result property="locationWide" column="location_wide" jdbcType="NUMERIC"/>
|
||||
<result property="locationDeep" column="location_deep" jdbcType="NUMERIC"/>
|
||||
<result property="locationHeight" column="location_height" jdbcType="NUMERIC"/>
|
||||
<result property="locationDefaultHeight" column="location_default_height" jdbcType="NUMERIC"/>
|
||||
<result property="locationTotalHeight" column="location_total_height" jdbcType="NUMERIC"/>
|
||||
<result property="locationTrayHeight" column="location_tray_height" jdbcType="NUMERIC"/>
|
||||
<result property="locationStorey" column="location_storey" jdbcType="INTEGER"/>
|
||||
<result property="locationType" column="location_type" jdbcType="INTEGER"/>
|
||||
<result property="locationNumber" column="location_number" jdbcType="INTEGER"/>
|
||||
<result property="creator" column="creator" jdbcType="VARCHAR"/>
|
||||
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="updater" column="updater" jdbcType="VARCHAR"/>
|
||||
<result property="updateTime" column="update_time" jdbcType="TIMESTAMP"/>
|
||||
<result property="deleted" column="deleted" jdbcType="INTEGER"/>
|
||||
<result property="tenantId" column="tenant_id" jdbcType="INTEGER"/>
|
||||
</resultMap>
|
||||
|
||||
<!--查询单个-->
|
||||
<select id="queryById" resultMap="BaseResultMap">
|
||||
select
|
||||
id, lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id
|
||||
from ware_house_location
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<!--查询指定行数据-->
|
||||
<select id="queryAllByLimit" resultMap="BaseResultMap">
|
||||
select
|
||||
id, lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id
|
||||
from ware_house_location
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="laneId != null">
|
||||
and lane_id = #{laneId}
|
||||
</if>
|
||||
<if test="laneName != null and laneName != ''">
|
||||
and lane_name = #{laneName}
|
||||
</if>
|
||||
<if test="areaId != null">
|
||||
and area_id = #{areaId}
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
and area_name = #{areaName}
|
||||
</if>
|
||||
<if test="locationNo != null and locationNo != ''">
|
||||
and location_no = #{locationNo}
|
||||
</if>
|
||||
<if test="locationYaw != null and locationYaw != ''">
|
||||
and location_yaw = #{locationYaw}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
and group_name = #{groupName}
|
||||
</if>
|
||||
<if test="skuInfo != null and skuInfo != ''">
|
||||
and sku_info = #{skuInfo}
|
||||
</if>
|
||||
<if test="skuBatch != null and skuBatch != ''">
|
||||
and sku_batch = #{skuBatch}
|
||||
</if>
|
||||
<if test="skuNumber != null">
|
||||
and sku_number = #{skuNumber}
|
||||
</if>
|
||||
<if test="trayInfo != null and trayInfo != ''">
|
||||
and tray_info = #{trayInfo}
|
||||
</if>
|
||||
<if test="locationEnable != null">
|
||||
and location_enable = #{locationEnable}
|
||||
</if>
|
||||
<if test="locationLock != null">
|
||||
and location_lock = #{locationLock}
|
||||
</if>
|
||||
<if test="locationUseStatus != null">
|
||||
and location_use_status = #{locationUseStatus}
|
||||
</if>
|
||||
<if test="locationX != null and locationX != ''">
|
||||
and location_x = #{locationX}
|
||||
</if>
|
||||
<if test="locationY != null and locationY != ''">
|
||||
and location_y = #{locationY}
|
||||
</if>
|
||||
<if test="locationWide != null">
|
||||
and location_wide = #{locationWide}
|
||||
</if>
|
||||
<if test="locationDeep != null">
|
||||
and location_deep = #{locationDeep}
|
||||
</if>
|
||||
<if test="locationHeight != null">
|
||||
and location_height = #{locationHeight}
|
||||
</if>
|
||||
<if test="locationDefaultHeight != null">
|
||||
and location_default_height = #{locationDefaultHeight}
|
||||
</if>
|
||||
<if test="locationTotalHeight != null">
|
||||
and location_total_height = #{locationTotalHeight}
|
||||
</if>
|
||||
<if test="locationTrayHeight != null">
|
||||
and location_tray_height = #{locationTrayHeight}
|
||||
</if>
|
||||
<if test="locationStorey != null">
|
||||
and location_storey = #{locationStorey}
|
||||
</if>
|
||||
<if test="locationType != null">
|
||||
and location_type = #{locationType}
|
||||
</if>
|
||||
<if test="locationNumber != null">
|
||||
and location_number = #{locationNumber}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
and creator = #{creator}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
and updater = #{updater}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
and deleted = #{deleted}
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
and tenant_id = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
limit #{pageable.offset}, #{pageable.pageSize}
|
||||
</select>
|
||||
|
||||
<!--通过实体作为筛选条件查询-->
|
||||
<select id="queryAll" resultMap="BaseResultMap">
|
||||
select
|
||||
id, lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id
|
||||
from zn_wcs.ware_house_location
|
||||
<!--统计总行数-->
|
||||
<select id="count" resultType="java.lang.Long">
|
||||
select count(1)
|
||||
from ware_house_location
|
||||
<where>
|
||||
<if test="id != null">
|
||||
and id = #{id}
|
||||
</if>
|
||||
<if test="laneId != null">
|
||||
and lane_id = #{laneId}
|
||||
</if>
|
||||
<if test="laneName != null and laneName != ''">
|
||||
and lane_name = #{laneName}
|
||||
</if>
|
||||
<if test="areaId != null">
|
||||
and area_id = #{areaId}
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
and area_name = #{areaName}
|
||||
</if>
|
||||
<if test="locationNo != null and locationNo != ''">
|
||||
and location_no = #{locationNo}
|
||||
</if>
|
||||
<if test="locationYaw != null and locationYaw != ''">
|
||||
and location_yaw = #{locationYaw}
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
and group_name = #{groupName}
|
||||
</if>
|
||||
<if test="skuInfo != null and skuInfo != ''">
|
||||
and sku_info = #{skuInfo}
|
||||
</if>
|
||||
<if test="skuBatch != null and skuBatch != ''">
|
||||
and sku_batch = #{skuBatch}
|
||||
</if>
|
||||
<if test="skuNumber != null">
|
||||
and sku_number = #{skuNumber}
|
||||
</if>
|
||||
<if test="trayInfo != null and trayInfo != ''">
|
||||
and tray_info = #{trayInfo}
|
||||
</if>
|
||||
<if test="locationEnable != null">
|
||||
and location_enable = #{locationEnable}
|
||||
</if>
|
||||
<if test="locationLock != null">
|
||||
and location_lock = #{locationLock}
|
||||
</if>
|
||||
<if test="locationUseStatus != null">
|
||||
and location_use_status = #{locationUseStatus}
|
||||
</if>
|
||||
<if test="locationX != null and locationX != ''">
|
||||
and location_x = #{locationX}
|
||||
</if>
|
||||
<if test="locationY != null and locationY != ''">
|
||||
and location_y = #{locationY}
|
||||
</if>
|
||||
<if test="locationWide != null">
|
||||
and location_wide = #{locationWide}
|
||||
</if>
|
||||
<if test="locationDeep != null">
|
||||
and location_deep = #{locationDeep}
|
||||
</if>
|
||||
<if test="locationHeight != null">
|
||||
and location_height = #{locationHeight}
|
||||
</if>
|
||||
<if test="locationDefaultHeight != null">
|
||||
and location_default_height = #{locationDefaultHeight}
|
||||
</if>
|
||||
<if test="locationTotalHeight != null">
|
||||
and location_total_height = #{locationTotalHeight}
|
||||
</if>
|
||||
<if test="locationTrayHeight != null">
|
||||
and location_tray_height = #{locationTrayHeight}
|
||||
</if>
|
||||
<if test="locationStorey != null">
|
||||
and location_storey = #{locationStorey}
|
||||
</if>
|
||||
<if test="locationType != null">
|
||||
and location_type = #{locationType}
|
||||
</if>
|
||||
<if test="locationNumber != null">
|
||||
and location_number = #{locationNumber}
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
and creator = #{creator}
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
and create_time = #{createTime}
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
and updater = #{updater}
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
and update_time = #{updateTime}
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
and deleted = #{deleted}
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
and tenant_id = #{tenantId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!--新增所有列-->
|
||||
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into ware_house_location(lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id)
|
||||
values (#{laneId}, #{laneName}, #{areaId}, #{areaName}, #{locationNo}, #{locationYaw}, #{groupName}, #{skuInfo}, #{skuBatch}, #{skuNumber}, #{trayInfo}, #{locationEnable}, #{locationLock}, #{locationUseStatus}, #{locationX}, #{locationY}, #{locationWide}, #{locationDeep}, #{locationHeight}, #{locationDefaultHeight}, #{locationTotalHeight}, #{locationTrayHeight}, #{locationStorey}, #{locationType}, #{locationNumber}, #{creator}, #{createTime}, #{updater}, #{updateTime}, #{deleted}, #{tenantId})
|
||||
</insert>
|
||||
|
||||
<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into ware_house_location(lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.laneId}, #{entity.laneName}, #{entity.areaId}, #{entity.areaName}, #{entity.locationNo}, #{entity.locationYaw}, #{entity.groupName}, #{entity.skuInfo}, #{entity.skuBatch}, #{entity.skuNumber}, #{entity.trayInfo}, #{entity.locationEnable}, #{entity.locationLock}, #{entity.locationUseStatus}, #{entity.locationX}, #{entity.locationY}, #{entity.locationWide}, #{entity.locationDeep}, #{entity.locationHeight}, #{entity.locationDefaultHeight}, #{entity.locationTotalHeight}, #{entity.locationTrayHeight}, #{entity.locationStorey}, #{entity.locationType}, #{entity.locationNumber}, #{entity.creator}, #{entity.createTime}, #{entity.updater}, #{entity.updateTime}, #{entity.deleted}, #{entity.tenantId})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
|
||||
insert into ware_house_location(lane_id, lane_name, area_id, area_name, location_no, location_yaw, group_name, sku_info, sku_batch, sku_number, tray_info, location_enable, location_lock, location_use_status, location_x, location_y, location_wide, location_deep, location_height, location_default_height, location_total_height, location_tray_height, location_storey, location_type, location_number, creator, create_time, updater, update_time, deleted, tenant_id)
|
||||
values
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(#{entity.laneId}, #{entity.laneName}, #{entity.areaId}, #{entity.areaName}, #{entity.locationNo}, #{entity.locationYaw}, #{entity.groupName}, #{entity.skuInfo}, #{entity.skuBatch}, #{entity.skuNumber}, #{entity.trayInfo}, #{entity.locationEnable}, #{entity.locationLock}, #{entity.locationUseStatus}, #{entity.locationX}, #{entity.locationY}, #{entity.locationWide}, #{entity.locationDeep}, #{entity.locationHeight}, #{entity.locationDefaultHeight}, #{entity.locationTotalHeight}, #{entity.locationTrayHeight}, #{entity.locationStorey}, #{entity.locationType}, #{entity.locationNumber}, #{entity.creator}, #{entity.createTime}, #{entity.updater}, #{entity.updateTime}, #{entity.deleted}, #{entity.tenantId})
|
||||
</foreach>
|
||||
on duplicate key update
|
||||
lane_id = values(lane_id),
|
||||
lane_name = values(lane_name),
|
||||
area_id = values(area_id),
|
||||
area_name = values(area_name),
|
||||
location_no = values(location_no),
|
||||
location_yaw = values(location_yaw),
|
||||
group_name = values(group_name),
|
||||
sku_info = values(sku_info),
|
||||
sku_batch = values(sku_batch),
|
||||
sku_number = values(sku_number),
|
||||
tray_info = values(tray_info),
|
||||
location_enable = values(location_enable),
|
||||
location_lock = values(location_lock),
|
||||
location_use_status = values(location_use_status),
|
||||
location_x = values(location_x),
|
||||
location_y = values(location_y),
|
||||
location_wide = values(location_wide),
|
||||
location_deep = values(location_deep),
|
||||
location_height = values(location_height),
|
||||
location_default_height = values(location_default_height),
|
||||
location_total_height = values(location_total_height),
|
||||
location_tray_height = values(location_tray_height),
|
||||
location_storey = values(location_storey),
|
||||
location_type = values(location_type),
|
||||
location_number = values(location_number),
|
||||
creator = values(creator),
|
||||
create_time = values(create_time),
|
||||
updater = values(updater),
|
||||
update_time = values(update_time),
|
||||
deleted = values(deleted),
|
||||
tenant_id = values(tenant_id)
|
||||
</insert>
|
||||
|
||||
<!--通过主键修改数据-->
|
||||
<update id="update">
|
||||
update ware_house_location
|
||||
<set>
|
||||
<if test="laneId != null">
|
||||
lane_id = #{laneId},
|
||||
</if>
|
||||
<if test="laneName != null and laneName != ''">
|
||||
lane_name = #{laneName},
|
||||
</if>
|
||||
<if test="areaId != null">
|
||||
area_id = #{areaId},
|
||||
</if>
|
||||
<if test="areaName != null and areaName != ''">
|
||||
area_name = #{areaName},
|
||||
</if>
|
||||
<if test="locationNo != null and locationNo != ''">
|
||||
location_no = #{locationNo},
|
||||
</if>
|
||||
<if test="locationYaw != null and locationYaw != ''">
|
||||
location_yaw = #{locationYaw},
|
||||
</if>
|
||||
<if test="groupName != null and groupName != ''">
|
||||
group_name = #{groupName},
|
||||
</if>
|
||||
<if test="skuInfo != null and skuInfo != ''">
|
||||
sku_info = #{skuInfo},
|
||||
</if>
|
||||
<if test="skuBatch != null and skuBatch != ''">
|
||||
sku_batch = #{skuBatch},
|
||||
</if>
|
||||
<if test="skuNumber != null">
|
||||
sku_number = #{skuNumber},
|
||||
</if>
|
||||
<if test="trayInfo != null and trayInfo != ''">
|
||||
tray_info = #{trayInfo},
|
||||
</if>
|
||||
<if test="locationEnable != null">
|
||||
location_enable = #{locationEnable},
|
||||
</if>
|
||||
<if test="locationLock != null">
|
||||
location_lock = #{locationLock},
|
||||
</if>
|
||||
<if test="locationUseStatus != null">
|
||||
location_use_status = #{locationUseStatus},
|
||||
</if>
|
||||
<if test="locationX != null and locationX != ''">
|
||||
location_x = #{locationX},
|
||||
</if>
|
||||
<if test="locationY != null and locationY != ''">
|
||||
location_y = #{locationY},
|
||||
</if>
|
||||
<if test="locationWide != null">
|
||||
location_wide = #{locationWide},
|
||||
</if>
|
||||
<if test="locationDeep != null">
|
||||
location_deep = #{locationDeep},
|
||||
</if>
|
||||
<if test="locationHeight != null">
|
||||
location_height = #{locationHeight},
|
||||
</if>
|
||||
<if test="locationDefaultHeight != null">
|
||||
location_default_height = #{locationDefaultHeight},
|
||||
</if>
|
||||
<if test="locationTotalHeight != null">
|
||||
location_total_height = #{locationTotalHeight},
|
||||
</if>
|
||||
<if test="locationTrayHeight != null">
|
||||
location_tray_height = #{locationTrayHeight},
|
||||
</if>
|
||||
<if test="locationStorey != null">
|
||||
location_storey = #{locationStorey},
|
||||
</if>
|
||||
<if test="locationType != null">
|
||||
location_type = #{locationType},
|
||||
</if>
|
||||
<if test="locationNumber != null">
|
||||
location_number = #{locationNumber},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
<if test="tenantId != null">
|
||||
tenant_id = #{tenantId},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<!--通过主键删除-->
|
||||
<delete id="deleteById">
|
||||
delete from ware_house_location where id = #{id}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
|
@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.framework.common.enums;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 通用状态枚举
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum NodeTypeEnum {
|
||||
ROUTE(1, "路径点位"),
|
||||
WARE(2, "库位点"),
|
||||
charging(3, "充电桩"),
|
||||
PARKING(4, "停车点"),
|
||||
CHANGE(5, "区域变更点"),
|
||||
WAIT(6, "等待点");
|
||||
|
||||
/**
|
||||
* 状态值
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 状态名
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
}
|
@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.system.controller.admin.positionmap;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapRespVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapDO;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -17,7 +16,6 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.annotation.Resource;
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -34,17 +32,6 @@ public class PositionMapController {
|
||||
@Resource
|
||||
private PositionMapService positionMapService;
|
||||
|
||||
private static final String UPLOAD_DIR = "/Users/aikai/project/";
|
||||
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新仓库点位地图")
|
||||
@PreAuthorize("@ss.hasPermission('system:position-map:update')")
|
||||
public CommonResult<Boolean> updatePositionMap(@Valid @RequestBody PositionMapSaveReqVO updateReqVO) {
|
||||
positionMapService.updatePositionMap(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除仓库点位地图")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
|
@ -1,6 +1,9 @@
|
||||
package cn.iocoder.yudao.module.system.controller.admin.positionmap;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
@ -43,9 +46,9 @@ public class PositionMapItemController {
|
||||
@Resource
|
||||
private NodeProcessingContext nodeProcessingContext;
|
||||
// -- 前端给所有的节点信息 -
|
||||
@PostMapping("/batchSaveOrEdit")
|
||||
@Operation(summary = "批量新增编辑节点")
|
||||
public CommonResult batchSaveOrEdit(@RequestParam Long positionMapId, @Valid @RequestBody List<NodeBaseDTO> nodeBaseDTOS) {
|
||||
@PostMapping("/batchSaveOrEditOrDel")
|
||||
@Operation(summary = "批量新增编辑删除节点")
|
||||
public CommonResult<Boolean> batchSaveOrEditOrDel(@RequestParam Long positionMapId, @Valid @RequestBody List<NodeBaseDTO> nodeBaseDTOS) {
|
||||
// -- 这里使用策略模式 - 根据各个类型区分 - 如果需要新增类型,新增策略实现类即可 - 如果不需要关联存储具体的表,直接将json存储到dataJson字段即可
|
||||
Map<Integer, List<NodeBaseDTO>> map = nodeBaseDTOS.stream().collect(Collectors.groupingBy(NodeBaseDTO::getType));
|
||||
// -- 获取到对应地图的所有点位
|
||||
|
@ -6,7 +6,6 @@ import lombok.ToString;
|
||||
|
||||
@Schema(description = "管理后台 - 仓库点位地图子表 - 节点基础属性")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class NodeBaseDTO {
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
@ -37,9 +37,6 @@ public class PositionMapItemPageReqVO extends PageParam {
|
||||
@Schema(description = "对应各个类型的独有属性Json格式 例如({库位长度:1,库位宽度:2,库位方向:单向})", example = "1")
|
||||
private String dataJson;
|
||||
|
||||
@Schema(description = "类型所对应表id(可空 - 不需要绑定具体表的话 存json即可)", example = "15418")
|
||||
private Long objectId;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
@ -43,10 +43,6 @@ public class PositionMapItemRespVO {
|
||||
@Schema(description = "对应各个类型的独有属性Json格式 例如({库位长度:1,库位宽度:2,库位方向:单向})", example = "1")
|
||||
private String dataJson;
|
||||
|
||||
@Schema(description = "类型所对应表id(可空 - 不需要绑定具体表的话 存json即可)", example = "15418")
|
||||
@ExcelProperty("类型所对应表id(可空 - 不需要绑定具体表的话 存json即可)")
|
||||
private Long objectId;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
@ -32,8 +32,4 @@ public class PositionMapItemSaveReqVO {
|
||||
|
||||
@Schema(description = "对应各个类型的独有属性Json格式 例如({库位长度:1,库位宽度:2,库位方向:单向})", example = "1")
|
||||
private String dataJson;
|
||||
|
||||
@Schema(description = "类型所对应表id(可空 - 不需要绑定具体表的话 存json即可)", example = "15418")
|
||||
private Long objectId;
|
||||
|
||||
}
|
||||
|
@ -24,10 +24,6 @@ public class HouseAreaDO extends BaseDO {
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 库区id(自定义)
|
||||
*/
|
||||
private Long areaId;
|
||||
/**
|
||||
* 库区名称
|
||||
*/
|
||||
@ -37,4 +33,4 @@ public class HouseAreaDO extends BaseDO {
|
||||
*/
|
||||
private String areaMsg;
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -56,9 +56,5 @@ public class PositionMapItemDO extends BaseDO {
|
||||
* 对应各个类型的独有属性Json格式 例如({库位长度:1,库位宽度:2,库位方向:单向})
|
||||
*/
|
||||
private String dataJson;
|
||||
/**
|
||||
* 类型所对应表id(可空 - 不需要绑定具体表的话 存json即可)
|
||||
*/
|
||||
private Long objectId;
|
||||
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ public interface PositionMapItemMapper extends BaseMapperX<PositionMapItemDO> {
|
||||
.eqIfPresent(PositionMapItemDO::getLocationX, reqVO.getLocationX())
|
||||
.eqIfPresent(PositionMapItemDO::getLocationY, reqVO.getLocationY())
|
||||
.eqIfPresent(PositionMapItemDO::getType, reqVO.getType())
|
||||
.eqIfPresent(PositionMapItemDO::getObjectId, reqVO.getObjectId())
|
||||
.betweenIfPresent(PositionMapItemDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PositionMapItemDO::getId));
|
||||
}
|
||||
|
@ -3,19 +3,25 @@ package cn.iocoder.yudao.module.system.handler.mapnode;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.enums.NodeTypeEnum;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.NodeBaseDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||
import cn.iocoder.yudao.module.system.handler.mapnode.strategy.HouseLocationStrategyImpl;
|
||||
import cn.iocoder.yudao.module.system.handler.mapnode.strategy.NodeProcessingStrategy;
|
||||
import cn.iocoder.yudao.module.system.service.positionmap.PositionMapItemService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import static com.baomidou.mybatisplus.core.toolkit.IdWorker.getId;
|
||||
|
||||
@ -38,13 +44,31 @@ public class NodeProcessingContext {
|
||||
// 节点
|
||||
// strategyMap.put(1, positionMapItemStrategyImpl);
|
||||
// 库位
|
||||
strategyMap.put(2, houseLocationStrategyImpl);
|
||||
strategyMap.put(NodeTypeEnum.WARE.getStatus(), houseLocationStrategyImpl);
|
||||
// todo 可以继续添加更多的策略
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void processNodesByStrategy(Long positionMapId, List<PositionMapItemDO> oldItemList, int key, List<NodeBaseDTO> nodeBaseDTOS) {
|
||||
// -- 这里处理节点 - 因为所有的类型都要建立在节点之上 - 把所有新增没有节点id的先分配id下 - 后续其他类型的需要绑定该id
|
||||
nodeBaseDTOS.forEach(a->{if (a.getId() == null) {a.setId(getId());}});
|
||||
nodeBaseDTOS.forEach(item -> {
|
||||
if (item.getId() == null) {
|
||||
item.setId(getId());
|
||||
}
|
||||
item.setPositionMapId(positionMapId);
|
||||
// -- 如果是库位点 - 可能是一对多情况 - 需要将多个库位点的id set进去
|
||||
if (Objects.equals(item.getType(), NodeTypeEnum.WARE.getStatus())) {
|
||||
List<WareHouseLocationDO> wareHouseLocationDOS = JSONUtil.toList(item.getDataJson(), WareHouseLocationDO.class);
|
||||
wareHouseLocationDOS.forEach(wareHouseLocationDO -> {
|
||||
wareHouseLocationDO.setLocationX(item.getLocationX());
|
||||
wareHouseLocationDO.setLocationY(item.getLocationY());
|
||||
if (wareHouseLocationDO.getId() == null) {
|
||||
wareHouseLocationDO.setId(IdWorker.getId());
|
||||
}
|
||||
});
|
||||
item.setDataJson(JSONUtil.toJsonStr(wareHouseLocationDOS));
|
||||
}
|
||||
});
|
||||
List<PositionMapItemDO> newList = BeanUtil.copyToList(nodeBaseDTOS, PositionMapItemDO.class);
|
||||
List<List<PositionMapItemDO>> list = CollectionUtils.diffList(oldItemList, newList,
|
||||
(oldVal, newVal) -> ObjectUtil.equal(oldVal.getId(), newVal.getId()));
|
||||
|
@ -1,12 +1,12 @@
|
||||
package cn.iocoder.yudao.module.system.handler.mapnode.strategy;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.dto.NodeBaseDTO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||
import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@ -22,12 +22,15 @@ public class HouseLocationStrategyImpl implements NodeProcessingStrategy {
|
||||
public void processNodes(Long positionMapId, List<NodeBaseDTO> nodeBaseDTOS) {
|
||||
// -- 策略1 处理库位点
|
||||
// -- 将data里面的json 数据转为实体类 - 再对比节点id - 然后做新增删除修改操作
|
||||
// --------------- dataJSON里面没有具体的类的id - 然后库位要根据层数添加 多个库位数据 即 一个点位 对应多个库位
|
||||
List<WareHouseLocationDO> newList = new ArrayList<>();
|
||||
for (NodeBaseDTO nodeBaseDTO : nodeBaseDTOS) {
|
||||
WareHouseLocationDO wareHouseLocationDO = JSONUtil.toBean(nodeBaseDTO.getDataJson(), WareHouseLocationDO.class);
|
||||
wareHouseLocationDO.setMapId(positionMapId);
|
||||
wareHouseLocationDO.setMapItemId(nodeBaseDTO.getId());
|
||||
newList.add(wareHouseLocationDO);
|
||||
List<WareHouseLocationDO> wareHouseLocationDOS = JSONUtil.toList(nodeBaseDTO.getDataJson(), WareHouseLocationDO.class);
|
||||
for (WareHouseLocationDO wareHouseLocationDO : wareHouseLocationDOS) {
|
||||
wareHouseLocationDO.setMapId(positionMapId);
|
||||
wareHouseLocationDO.setMapItemId(nodeBaseDTO.getId());
|
||||
newList.add(wareHouseLocationDO);
|
||||
}
|
||||
}
|
||||
|
||||
List<WareHouseLocationDO> oldList = houseLocationService.getByMapId(positionMapId);
|
||||
|
@ -1,10 +1,12 @@
|
||||
package cn.iocoder.yudao.module.system.service.positionmap;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemPageReqVO;
|
||||
import cn.iocoder.yudao.module.system.controller.admin.positionmap.vo.PositionMapItemSaveReqVO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
|
||||
import cn.iocoder.yudao.module.system.dal.dataobject.positionmap.PositionMapItemDO;
|
||||
import cn.iocoder.yudao.module.system.dal.mysql.positionmap.PositionMapItemMapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
@ -71,7 +73,6 @@ public class PositionMapItemServiceImpl implements PositionMapItemService {
|
||||
public void batchSaveOrEditOrDel(Long positionMapId, List<List<PositionMapItemDO>> list) {
|
||||
//批量添加、修改、删除
|
||||
if (isNotEmpty(list.get(0))) {
|
||||
list.get(0).forEach(item -> item.setPositionMapId(positionMapId));
|
||||
positionMapItemMapper.insertBatch(list.get(0));
|
||||
}
|
||||
if (isNotEmpty(list.get(1))) {
|
||||
|
@ -666,7 +666,7 @@
|
||||
</when>
|
||||
<when test="type == 2">
|
||||
select
|
||||
lane_id as id,
|
||||
id as id,
|
||||
lane_name as locationNo
|
||||
from
|
||||
ware_house_lane
|
||||
@ -675,7 +675,7 @@
|
||||
</when>
|
||||
<when test="type == 3">
|
||||
select
|
||||
area_id as id,
|
||||
id as id,
|
||||
area_name as locationNo
|
||||
from
|
||||
ware_house_area
|
||||
@ -685,4 +685,4 @@
|
||||
</choose>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user