下发搬运任务

This commit is contained in:
cbs 2025-01-08 10:46:50 +08:00
parent 84980c31f7
commit 9fe8245ed5
36 changed files with 1460 additions and 136 deletions

View File

@ -0,0 +1,425 @@
<?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>

View File

@ -3,6 +3,7 @@ package cn.iocoder.yudao.framework.common.util.date;
import cn.hutool.core.date.LocalDateTimeUtil;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.util.Calendar;
import java.util.Date;
@ -27,6 +28,11 @@ public class DateUtils {
public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss";
public static String getYearMonthDay() {
LocalDate currentDate = LocalDate.now();
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
return currentDate.format(formatter);
}
/**
* LocalDateTime 转换成 Date
*

View File

@ -185,6 +185,7 @@ public interface ErrorCodeConstants {
// ========== 机器人任务主表 1-002-035-000 ==========
ErrorCode TASK_NOT_EXISTS = new ErrorCode(1-002-035-001, "机器人任务主表不存在");
ErrorCode TASK_DATA_NOT_FULL = new ErrorCode(1-002-035-002, "任务数据不完整");
// ========== 机器人任务明细 1-002-036-000 ==========
ErrorCode TASK_DETAIL_NOT_EXISTS = new ErrorCode(1-002-036-001, "机器人任务明细不存在");

View File

@ -1,9 +1,9 @@
package cn.iocoder.yudao.module.system.controller.admin.houselocation;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.HouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.HouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.HouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.HouseLocationDO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationRespVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import cn.iocoder.yudao.module.system.service.houselocation.HouseLocationService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@ -13,7 +13,6 @@ import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
@ -35,7 +34,7 @@ import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@RestController
@RequestMapping("/system/ware/house-location")
@Validated
public class HouseLocationController {
public class WareHouseLocationController {
@Resource
private HouseLocationService houseLocationService;
@ -43,14 +42,14 @@ public class HouseLocationController {
@PostMapping("/create")
@Operation(summary = "创建库位")
@PreAuthorize("@ss.hasPermission('ware:house-location:create')")
public CommonResult<Long> createHouseLocation(@Valid @RequestBody HouseLocationSaveReqVO createReqVO) {
public CommonResult<Long> createHouseLocation(@Valid @RequestBody WareHouseLocationSaveReqVO createReqVO) {
return success(houseLocationService.createHouseLocation(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新库位")
@PreAuthorize("@ss.hasPermission('ware:house-location:update')")
public CommonResult<Boolean> updateHouseLocation(@Valid @RequestBody HouseLocationSaveReqVO updateReqVO) {
public CommonResult<Boolean> updateHouseLocation(@Valid @RequestBody WareHouseLocationSaveReqVO updateReqVO) {
houseLocationService.updateHouseLocation(updateReqVO);
return success(true);
}
@ -68,30 +67,30 @@ public class HouseLocationController {
@Operation(summary = "获得库位")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('ware:house-location:query')")
public CommonResult<HouseLocationRespVO> getHouseLocation(@RequestParam("id") Long id) {
HouseLocationDO houseLocation = houseLocationService.getHouseLocation(id);
return success(BeanUtils.toBean(houseLocation, HouseLocationRespVO.class));
public CommonResult<WareHouseLocationRespVO> getHouseLocation(@RequestParam("id") Long id) {
WareHouseLocationDO houseLocation = houseLocationService.getHouseLocation(id);
return success(BeanUtils.toBean(houseLocation, WareHouseLocationRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得库位分页")
@PreAuthorize("@ss.hasPermission('ware:house-location:query')")
public CommonResult<PageResult<HouseLocationRespVO>> getHouseLocationPage(@Valid HouseLocationPageReqVO pageReqVO) {
PageResult<HouseLocationDO> pageResult = houseLocationService.getHouseLocationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, HouseLocationRespVO.class));
public CommonResult<PageResult<WareHouseLocationRespVO>> getHouseLocationPage(@Valid WareHouseLocationPageReqVO pageReqVO) {
PageResult<WareHouseLocationDO> pageResult = houseLocationService.getHouseLocationPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, WareHouseLocationRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出库位 Excel")
@PreAuthorize("@ss.hasPermission('ware:house-location:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportHouseLocationExcel(@Valid HouseLocationPageReqVO pageReqVO,
public void exportHouseLocationExcel(@Valid WareHouseLocationPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<HouseLocationDO> list = houseLocationService.getHouseLocationPage(pageReqVO).getList();
List<WareHouseLocationDO> list = houseLocationService.getHouseLocationPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "库位.xls", "数据", HouseLocationRespVO.class,
BeanUtils.toBean(list, HouseLocationRespVO.class));
ExcelUtils.write(response, "库位.xls", "数据", WareHouseLocationRespVO.class,
BeanUtils.toBean(list, WareHouseLocationRespVO.class));
}
}

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.system.controller.admin.houselocation.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import java.math.BigDecimal;
@ -14,7 +13,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class HouseLocationPageReqVO extends PageParam {
public class WareHouseLocationPageReqVO extends PageParam {
@Schema(description = "巷道/线库id", example = "12101")
private Long laneId;
@ -89,4 +88,7 @@ public class HouseLocationPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
@Schema(description = "排序的位置,越大越优先堆放")
private Integer locationNumber;
}

View File

@ -2,16 +2,15 @@ package cn.iocoder.yudao.module.system.controller.admin.houselocation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 库位 Response VO")
@Data
@ExcelIgnoreUnannotated
public class HouseLocationRespVO {
public class WareHouseLocationRespVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31832")
@ExcelProperty("主键ID")
@ -112,4 +111,8 @@ public class HouseLocationRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
@Schema(description = "排序的位置,越大越优先堆放")
@ExcelProperty("排序的位置,越大越优先堆放")
private Integer locationNumber;
}

View File

@ -2,13 +2,12 @@ package cn.iocoder.yudao.module.system.controller.admin.houselocation.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
import java.math.BigDecimal;
@Schema(description = "管理后台 - 库位新增/修改 Request VO")
@Data
public class HouseLocationSaveReqVO {
public class WareHouseLocationSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "31832")
private Long id;
@ -82,4 +81,7 @@ public class HouseLocationSaveReqVO {
@Schema(description = "点位类型0库位、1等待点、2输送线取托盘点、3出库放托盘点", example = "2")
private Integer locationType;
@Schema(description = "排序的位置,越大越优先堆放")
private Integer locationNumber;
}

View File

@ -44,7 +44,7 @@ public class RobotTaskController {
@PostMapping("/create")
@Operation(summary = "创建机器人任务主表")
@PreAuthorize("@ss.hasPermission('robot:task:create')")
public CommonResult<Long> createTask(@Valid @RequestBody RobotTaskSaveReqVO createReqVO) {
public CommonResult<Long> createTask(@Valid @RequestBody RobotTaskSaveReqVO createReqVO) throws InterruptedException {
return success(taskService.createTask(createReqVO));
}

View File

@ -1,6 +1,7 @@
package cn.iocoder.yudao.module.system.controller.admin.robot.vo;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
@ -20,6 +21,9 @@ public class RobotModelPageReqVO extends PageParam {
@Schema(description = "车辆类型")
private String robotModelNumber;
@Schema(description = "偏移量")
private String robotOffset;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;

View File

@ -20,6 +20,10 @@ public class RobotModelRespVO {
@ExcelProperty("车辆类型")
private String robotModelNumber;
@Schema(description = "偏移量")
@ExcelProperty("偏移量")
private String robotOffset;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;

View File

@ -16,4 +16,7 @@ public class RobotModelSaveReqVO {
@NotEmpty(message = "车辆类型不能为空")
private String robotModelNumber;
@Schema(description = "偏移量")
private String robotOffset;
}

View File

@ -0,0 +1,42 @@
package cn.iocoder.yudao.module.system.controller.admin.robot.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Data
public class RobotTaskDetailAddVo {
@Schema(description = "任务类型1取放货、2停车、 3充电、4移动、5仅取货、6仅放货、7扫描码、8检测托盘类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "任务类型1取放货、2停车、 3充电、4移动、5仅取货、6仅放货、7扫描码、8检测托盘类型不能为空")
private Integer taskType;
@Schema(description = "放货类型1库位、2线库、 3区域", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "放货类型1库位、2线库、 3区域不能为空")
private Integer releaseType;
@Schema(description = "取货类型1库位、2线库、 3区域", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
@NotNull(message = "取货类型1库位、2线库、 3区域不能为空")
private Integer takeType;
@Schema(description = "放货库位/线库/区域", requiredMode = Schema.RequiredMode.REQUIRED, example = "6223")
@NotNull(message = "放货库位/线库/区域不能为空")
private Long releaseId;
@Schema(description = "取货库位/线库/区域", requiredMode = Schema.RequiredMode.REQUIRED, example = "24801")
@NotNull(message = "取货库位/线库/区域不能为空")
private Long takeId;
@Schema(description = "AGV编号")
private String robotNo;
@Schema(description = "计算后的来源库位编号(前端不用传此字段)")
private String fromLocationNo;
@Schema(description = "计算后的来源库位id(前端不用传此字段)")
private Long fromLocationId;
@Schema(description = "计算后的目标库位编号(前端不用传此字段)")
private String toLocationNo;
@Schema(description = "计算后的目标库位id(前端不用传此字段)")
private Long toLocationId;
}

View File

@ -32,6 +32,15 @@ public class RobotTaskDetailPageReqVO extends PageParam {
@Schema(description = "取货库位/线库/区域", example = "24801")
private Long takeId;
@Schema(description = "计算后的来源库位编号")
private String fromLocationNo;
@Schema(description = "计算后的来源库位id")
private Long fromLocationId;
@Schema(description = "计算后的目标库位编号")
private String toLocationNo;
@Schema(description = "计算后的目标库位id")
private Long toLocationId;
@Schema(description = "AGV编号")
private String robotNo;

View File

@ -39,6 +39,17 @@ public class RobotTaskDetailRespVO {
@ExcelProperty("取货库位/线库/区域")
private Long takeId;
@Schema(description = "计算后的来源库位编号")
@ExcelProperty("计算后的来源库位编号")
private String fromLocationNo;
@Schema(description = "计算后的来源库位id")
private Long fromLocationId;
@Schema(description = "计算后的目标库位编号")
@ExcelProperty("计算后的目标库位编号")
private String toLocationNo;
@Schema(description = "计算后的目标库位id")
private Long toLocationId;
@Schema(description = "AGV编号")
@ExcelProperty("AGV编号")
private String robotNo;

View File

@ -37,6 +37,15 @@ public class RobotTaskDetailSaveReqVO {
@NotNull(message = "取货库位/线库/区域不能为空")
private Long takeId;
@Schema(description = "计算后的来源库位编号")
private String fromLocationNo;
@Schema(description = "计算后的来源库位id")
private Long fromLocationId;
@Schema(description = "计算后的目标库位编号")
private String toLocationNo;
@Schema(description = "计算后的目标库位id")
private Long toLocationId;
@Schema(description = "AGV编号")
private String robotNo;

View File

@ -11,9 +11,6 @@ import java.time.LocalDateTime;
@Data
public class RobotTaskSaveReqVO {
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15306")
private Long id;
@Schema(description = "是否拼接任务0不拼接、1拼接", requiredMode = Schema.RequiredMode.REQUIRED)
@NotNull(message = "是否拼接任务0不拼接、1拼接不能为空")
private Integer montageTask;
@ -22,6 +19,9 @@ public class RobotTaskSaveReqVO {
@NotNull(message = "拼接任务数量不能为空")
private Integer montageNumber;
@Schema(description = "任务")
private List<RobotTaskDetailAddVo> taskDetailList;
@Schema(description = "物料信息")
private String skuInfo;
@ -43,6 +43,10 @@ public class RobotTaskSaveReqVO {
@Schema(description = "是否搬空所选线库/区域(0:不搬空、1搬空)")
private Long doMoveAll;
@Schema(description = "主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "15306")
private Long id;
@Schema(description = "循环次数")
private Long cycleNumber;

View File

@ -1,18 +1,9 @@
package cn.iocoder.yudao.module.system.dal.dataobject.houselocation;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@ -29,7 +20,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class HouseLocationDO extends BaseDO {
public class WareHouseLocationDO extends BaseDO {
/**
* 主键ID
@ -128,5 +119,9 @@ public class HouseLocationDO extends BaseDO {
* 点位类型0库位1等待点2输送线取托盘点3出库放托盘点
*/
private Integer locationType;
/**
* 排序的位置,越大越优先堆放
*/
private Integer locationNumber;
}

View File

@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import com.baomidou.mybatisplus.annotation.KeySequence;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
/**
@ -30,5 +31,9 @@ public class RobotModelDO extends BaseDO {
* 车辆类型
*/
private String robotModelNumber;
/**
* 偏移量
*/
private String robotOffset;
}

View File

@ -1,5 +1,6 @@
package cn.iocoder.yudao.module.system.dal.dataobject.robot;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.time.LocalDateTime;
@ -51,6 +52,22 @@ public class RobotTaskDetailDO extends BaseDO {
* 取货库位/线库/区域
*/
private Long takeId;
/**
* 计算后的来源库位编号
*/
private String fromLocationNo;
/**
* 计算后的来源库位id
*/
private Long fromLocationId;
/**
* 计算后的目标库位编号
*/
private String toLocationNo;
/**
* 计算后的目标库位id
*/
private Long toLocationId;
/**
* AGV编号
*/

View File

@ -1,49 +0,0 @@
package cn.iocoder.yudao.module.system.dal.mysql.houselocation;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.HouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.HouseLocationDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 库位 Mapper
*
* @author 陈宾顺
*/
@Mapper
public interface HouseLocationMapper extends BaseMapperX<HouseLocationDO> {
default PageResult<HouseLocationDO> selectPage(HouseLocationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<HouseLocationDO>()
.eqIfPresent(HouseLocationDO::getLaneId, reqVO.getLaneId())
.likeIfPresent(HouseLocationDO::getLaneName, reqVO.getLaneName())
.eqIfPresent(HouseLocationDO::getAreaId, reqVO.getAreaId())
.likeIfPresent(HouseLocationDO::getAreaName, reqVO.getAreaName())
.eqIfPresent(HouseLocationDO::getLocationNo, reqVO.getLocationNo())
.eqIfPresent(HouseLocationDO::getLocationYaw, reqVO.getLocationYaw())
.likeIfPresent(HouseLocationDO::getGroupName, reqVO.getGroupName())
.likeIfPresent(HouseLocationDO::getSkuInfo, reqVO.getSkuInfo())
.likeIfPresent(HouseLocationDO::getSkuBatch, reqVO.getSkuBatch())
.eqIfPresent(HouseLocationDO::getSkuNumber, reqVO.getSkuNumber())
.eqIfPresent(HouseLocationDO::getLocationEnable, reqVO.getLocationEnable())
.eqIfPresent(HouseLocationDO::getLocationLock, reqVO.getLocationLock())
.eqIfPresent(HouseLocationDO::getLocationUseStatus, reqVO.getLocationUseStatus())
.eqIfPresent(HouseLocationDO::getLocationX, reqVO.getLocationX())
.eqIfPresent(HouseLocationDO::getLocationY, reqVO.getLocationY())
.eqIfPresent(HouseLocationDO::getLocationWide, reqVO.getLocationWide())
.eqIfPresent(HouseLocationDO::getLocationDeep, reqVO.getLocationDeep())
.eqIfPresent(HouseLocationDO::getLocationHeight, reqVO.getLocationHeight())
.eqIfPresent(HouseLocationDO::getLocationDefaultHeight, reqVO.getLocationDefaultHeight())
.eqIfPresent(HouseLocationDO::getLocationTotalHeight, reqVO.getLocationTotalHeight())
.eqIfPresent(HouseLocationDO::getLocationTrayHeight, reqVO.getLocationTrayHeight())
.eqIfPresent(HouseLocationDO::getLocationStorey, reqVO.getLocationStorey())
.eqIfPresent(HouseLocationDO::getLocationType, reqVO.getLocationType())
.betweenIfPresent(HouseLocationDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(HouseLocationDO::getId));
}
}

View File

@ -0,0 +1,56 @@
package cn.iocoder.yudao.module.system.dal.mysql.houselocation;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* 库位 Mapper
*
* @author 陈宾顺
*/
@Mapper
public interface WareHouseLocationMapper extends BaseMapperX<WareHouseLocationDO> {
default PageResult<WareHouseLocationDO> selectPage(WareHouseLocationPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<WareHouseLocationDO>()
.eqIfPresent(WareHouseLocationDO::getLaneId, reqVO.getLaneId())
.likeIfPresent(WareHouseLocationDO::getLaneName, reqVO.getLaneName())
.eqIfPresent(WareHouseLocationDO::getAreaId, reqVO.getAreaId())
.likeIfPresent(WareHouseLocationDO::getAreaName, reqVO.getAreaName())
.eqIfPresent(WareHouseLocationDO::getLocationNo, reqVO.getLocationNo())
.eqIfPresent(WareHouseLocationDO::getLocationYaw, reqVO.getLocationYaw())
.likeIfPresent(WareHouseLocationDO::getGroupName, reqVO.getGroupName())
.likeIfPresent(WareHouseLocationDO::getSkuInfo, reqVO.getSkuInfo())
.likeIfPresent(WareHouseLocationDO::getSkuBatch, reqVO.getSkuBatch())
.eqIfPresent(WareHouseLocationDO::getSkuNumber, reqVO.getSkuNumber())
.eqIfPresent(WareHouseLocationDO::getLocationEnable, reqVO.getLocationEnable())
.eqIfPresent(WareHouseLocationDO::getLocationLock, reqVO.getLocationLock())
.eqIfPresent(WareHouseLocationDO::getLocationUseStatus, reqVO.getLocationUseStatus())
.eqIfPresent(WareHouseLocationDO::getLocationX, reqVO.getLocationX())
.eqIfPresent(WareHouseLocationDO::getLocationY, reqVO.getLocationY())
.eqIfPresent(WareHouseLocationDO::getLocationWide, reqVO.getLocationWide())
.eqIfPresent(WareHouseLocationDO::getLocationDeep, reqVO.getLocationDeep())
.eqIfPresent(WareHouseLocationDO::getLocationHeight, reqVO.getLocationHeight())
.eqIfPresent(WareHouseLocationDO::getLocationDefaultHeight, reqVO.getLocationDefaultHeight())
.eqIfPresent(WareHouseLocationDO::getLocationTotalHeight, reqVO.getLocationTotalHeight())
.eqIfPresent(WareHouseLocationDO::getLocationTrayHeight, reqVO.getLocationTrayHeight())
.eqIfPresent(WareHouseLocationDO::getLocationStorey, reqVO.getLocationStorey())
.eqIfPresent(WareHouseLocationDO::getLocationType, reqVO.getLocationType())
.betweenIfPresent(WareHouseLocationDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(WareHouseLocationDO::getId));
}
/**
* 查询空闲的库位id
* @param type 类型1库位2线库 3区域
* @param id 库位/线库/区域
* @return
*/
Long selectByTypeAndId(@Param("type") Integer type,
@Param("id") Long id);
}

View File

@ -18,6 +18,7 @@ public interface RobotModelMapper extends BaseMapperX<RobotModelDO> {
default PageResult<RobotModelDO> selectPage(RobotModelPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<RobotModelDO>()
.eqIfPresent(RobotModelDO::getRobotModelNumber, reqVO.getRobotModelNumber())
.eqIfPresent(RobotModelDO::getRobotOffset, reqVO.getRobotOffset())
.betweenIfPresent(RobotModelDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(RobotModelDO::getId));
}

View File

@ -23,6 +23,10 @@ public interface RobotTaskDetailMapper extends BaseMapperX<RobotTaskDetailDO> {
.eqIfPresent(RobotTaskDetailDO::getTakeType, reqVO.getTakeType())
.eqIfPresent(RobotTaskDetailDO::getReleaseId, reqVO.getReleaseId())
.eqIfPresent(RobotTaskDetailDO::getTakeId, reqVO.getTakeId())
.eqIfPresent(RobotTaskDetailDO::getFromLocationId, reqVO.getFromLocationId())
.eqIfPresent(RobotTaskDetailDO::getFromLocationNo, reqVO.getFromLocationNo())
.eqIfPresent(RobotTaskDetailDO::getToLocationId, reqVO.getToLocationId())
.eqIfPresent(RobotTaskDetailDO::getToLocationNo, reqVO.getToLocationNo())
.eqIfPresent(RobotTaskDetailDO::getRobotNo, reqVO.getRobotNo())
.eqIfPresent(RobotTaskDetailDO::getTaskStatus, reqVO.getTaskStatus())
.eqIfPresent(RobotTaskDetailDO::getTaskStage, reqVO.getTaskStage())

View File

@ -1,11 +1,11 @@
package cn.iocoder.yudao.module.system.enums;
package cn.iocoder.yudao.module.system.enums.device;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum DeviceInformationType {
public enum DeviceInformationEnum {
CHARGING_STATION(1, "充电桩"),
Conveyor_line(2, "输送线"),
@ -23,5 +23,5 @@ public enum DeviceInformationType {
/**
* 说明
*/
private final String source;
private final String msg;
}

View File

@ -0,0 +1,23 @@
package cn.iocoder.yudao.module.system.enums.redis;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter
@AllArgsConstructor
public enum RobotCacheTypeEnum {
TASK_NO("task:robot:no", "任务号"),
ROBOT_TASK_ADD_LOCK("robot:task:add:lock", "所有下发创建机器人任务的锁"),
ROBOT_TASK_LOCATION_LOCK("robot:task:location:lock", "库位取/放任务下发互斥锁(仅仅锁某个库位)"),
ROBOT_TASK_LANE_LOCK("robot:task:lane:lock", "线库/巷道, 取/放任务下发互斥锁(仅仅锁某个线库/巷道)"),
ROBOT_TASK_AREA_LOCK("robot:task:area:lock", "库区, 取/放任务下发互斥锁(仅仅锁某个库区)");
/**
* 类型
*/
private final String key;
/**
* 说明
*/
private final String msg;
}

View File

@ -0,0 +1,25 @@
package cn.iocoder.yudao.module.system.enums.robot;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 放货类型
*/
@Getter
@AllArgsConstructor
public enum ReleaseTakeEnum {
TO_LOCATION(1, "库位"),
TO_LANE(2, "线库"),
TO_AREA(3, "区域");
/**
* 类型
*/
private final Integer type;
/**
* 说明
*/
private final String msg;
}

View File

@ -1,11 +1,10 @@
package cn.iocoder.yudao.module.system.service.houselocation;
import java.util.*;
import javax.validation.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.HouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.HouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.HouseLocationDO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
/**
* 库位 Service 接口
@ -20,14 +19,14 @@ public interface HouseLocationService {
* @param createReqVO 创建信息
* @return 编号
*/
Long createHouseLocation(@Valid HouseLocationSaveReqVO createReqVO);
Long createHouseLocation(@Valid WareHouseLocationSaveReqVO createReqVO);
/**
* 更新库位
*
* @param updateReqVO 更新信息
*/
void updateHouseLocation(@Valid HouseLocationSaveReqVO updateReqVO);
void updateHouseLocation(@Valid WareHouseLocationSaveReqVO updateReqVO);
/**
* 删除库位
@ -42,7 +41,7 @@ public interface HouseLocationService {
* @param id 编号
* @return 库位
*/
HouseLocationDO getHouseLocation(Long id);
WareHouseLocationDO getHouseLocation(Long id);
/**
* 获得库位分页
@ -50,6 +49,6 @@ public interface HouseLocationService {
* @param pageReqVO 分页查询
* @return 库位分页
*/
PageResult<HouseLocationDO> getHouseLocationPage(HouseLocationPageReqVO pageReqVO);
PageResult<WareHouseLocationDO> getHouseLocationPage(WareHouseLocationPageReqVO pageReqVO);
}

View File

@ -1,14 +1,13 @@
package cn.iocoder.yudao.module.system.service.houselocation;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.HouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.HouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.HouseLocationDO;
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.HouseLocationMapper;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.houselocation.vo.WareHouseLocationSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
@ -26,23 +25,23 @@ import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.HOUSE_LOCA
public class HouseLocationServiceImpl implements HouseLocationService {
@Resource
private HouseLocationMapper houseLocationMapper;
private WareHouseLocationMapper houseLocationMapper;
@Override
public Long createHouseLocation(HouseLocationSaveReqVO createReqVO) {
public Long createHouseLocation(WareHouseLocationSaveReqVO createReqVO) {
// 插入
HouseLocationDO houseLocation = BeanUtils.toBean(createReqVO, HouseLocationDO.class);
WareHouseLocationDO houseLocation = BeanUtils.toBean(createReqVO, WareHouseLocationDO.class);
houseLocationMapper.insert(houseLocation);
// 返回
return houseLocation.getId();
}
@Override
public void updateHouseLocation(HouseLocationSaveReqVO updateReqVO) {
public void updateHouseLocation(WareHouseLocationSaveReqVO updateReqVO) {
// 校验存在
validateHouseLocationExists(updateReqVO.getId());
// 更新
HouseLocationDO updateObj = BeanUtils.toBean(updateReqVO, HouseLocationDO.class);
WareHouseLocationDO updateObj = BeanUtils.toBean(updateReqVO, WareHouseLocationDO.class);
houseLocationMapper.updateById(updateObj);
}
@ -61,12 +60,12 @@ public class HouseLocationServiceImpl implements HouseLocationService {
}
@Override
public HouseLocationDO getHouseLocation(Long id) {
public WareHouseLocationDO getHouseLocation(Long id) {
return houseLocationMapper.selectById(id);
}
@Override
public PageResult<HouseLocationDO> getHouseLocationPage(HouseLocationPageReqVO pageReqVO) {
public PageResult<WareHouseLocationDO> getHouseLocationPage(WareHouseLocationPageReqVO pageReqVO) {
return houseLocationMapper.selectPage(pageReqVO);
}

View File

@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInfo
import cn.iocoder.yudao.module.system.controller.admin.information.vo.DeviceInformationSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.information.DeviceInformationDO;
import cn.iocoder.yudao.module.system.dal.mysql.information.DeviceInformationMapper;
import cn.iocoder.yudao.module.system.enums.DeviceInformationType;
import cn.iocoder.yudao.module.system.enums.device.DeviceInformationEnum;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@ -46,11 +46,11 @@ public class DeviceInformationServiceImpl implements DeviceInformationService {
throw exception(INFORMATION_MAC_EXIST);
}
//AGV需要判断机车是否接收到此Mac地址
if(DeviceInformationType.PALLETIZER.getType().equals(createReqVO.getDeviceType())
if(DeviceInformationEnum.PALLETIZER.getType().equals(createReqVO.getDeviceType())
&& ObjectUtil.isEmpty(createReqVO.getMacAddress())){
throw exception(INFORMATION_MAC_INPUT);
}
if(DeviceInformationType.PALLETIZER.getType().equals(createReqVO.getDeviceType())){
if(DeviceInformationEnum.PALLETIZER.getType().equals(createReqVO.getDeviceType())){
// String jiCheResponse = grpcServiceApi.robotExecption();
}

View File

@ -21,7 +21,7 @@ public interface RobotTaskService {
* @param createReqVO 创建信息
* @return 编号
*/
Long createTask(@Valid RobotTaskSaveReqVO createReqVO);
Long createTask(@Valid RobotTaskSaveReqVO createReqVO) throws InterruptedException;
/**
* 更新机器人任务主表

View File

@ -1,42 +1,139 @@
package cn.iocoder.yudao.module.system.service.robot;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskDetailAddVo;
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskPageReqVO;
import cn.iocoder.yudao.module.system.controller.admin.robot.vo.RobotTaskSaveReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.houselocation.WareHouseLocationDO;
import cn.iocoder.yudao.module.system.dal.dataobject.robot.RobotTaskDO;
import cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper;
import cn.iocoder.yudao.module.system.dal.mysql.robot.RobotTaskMapper;
import cn.iocoder.yudao.module.system.enums.redis.RobotCacheTypeEnum;
import cn.iocoder.yudao.module.system.enums.robot.ReleaseTakeEnum;
import cn.iocoder.yudao.module.system.util.redis.RedisUtil;
import cn.iocoder.yudao.module.system.util.redis.RedissonUtils;
import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import java.util.*;
import java.util.concurrent.TimeUnit;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.TASK_NOT_EXISTS;
import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*;
/**
* 机器人任务主表 Service 实现类
*
* @author 陈宾顺
*/
@Slf4j
@Service
@Validated
public class RobotTaskServiceImpl implements RobotTaskService {
private final String RESULT = "SUCCESS";
@Resource
private RobotTaskMapper taskMapper;
@Resource
private WareHouseLocationMapper locationMapper;
@Resource
private RedisUtil redisUtil;
@Resource
private RedissonUtils redissonUtils;
@Value("${zn.task-no}")
private String taskNo;
@Override
public Long createTask(RobotTaskSaveReqVO createReqVO) {
@Transactional(rollbackFor = Exception.class)
public Long createTask(RobotTaskSaveReqVO createReqVO) throws InterruptedException {
if (ObjectUtil.isEmpty(createReqVO.getTaskDetailList())) {
throw exception(TASK_DATA_NOT_FULL);
}
//获取库位id
RLock lock = redissonUtils.getLock(RobotCacheTypeEnum.ROBOT_TASK_ADD_LOCK.getKey());
String addResult = "";
if (lock.tryLock(15l,TimeUnit.MINUTES)){
try {
addResult = addTask(createReqVO);
} catch (Exception e) {
log.info("下发任务出现异常 {}",e);
} finally {
lock.unlock();
}
}else {
throw new RuntimeException("有正在下发中的任务请稍后重试!");
}
if (!RESULT.equals(addResult)) {
throw new RuntimeException(addResult);
}
return 1l;
}
/**
* 添加任务
* @param createReqVO
*/
@Transactional(rollbackFor = Exception.class)
public String addTask(RobotTaskSaveReqVO createReqVO) {
//设置任务号
if (ObjectUtil.isEmpty(createReqVO.getTaskNo())) {
String incrementByKey = redisUtil.getIncrementByKey(RobotCacheTypeEnum.TASK_NO.getKey());
createReqVO.setTaskNo(taskNo+ DateUtils.getYearMonthDay()+incrementByKey);
}
//查找库位
// 插入
RobotTaskDO task = BeanUtils.toBean(createReqVO, RobotTaskDO.class);
taskMapper.insert(task);
// 返回
return task.getId();
return RESULT;
}
/**
* 设置放货和取货的id
* @param taskDetailList
* @return
*/
public void setLocationIdNo(List<RobotTaskDetailAddVo> taskDetailList){
List<Long> locationIds = new ArrayList<>();
for (RobotTaskDetailAddVo robotTaskVo : taskDetailList) {
if (ReleaseTakeEnum.TO_LOCATION.getType().equals(robotTaskVo.getReleaseType())) {
WareHouseLocationDO locationDO = locationMapper.selectById(robotTaskVo.getReleaseId());
robotTaskVo.setToLocationNo(locationDO.getLocationNo());
robotTaskVo.setToLocationId(robotTaskVo.getReleaseId());
locationIds.add(robotTaskVo.getReleaseId());
} else {
}
//库位
Long releaseId = locationMapper.selectByTypeAndId(robotTaskVo.getReleaseType(),robotTaskVo.getReleaseId());
if (ObjectUtil.isEmpty(releaseId)) {
throw new RuntimeException("放货库位为空或者已锁定 "+ robotTaskVo.getReleaseId());
}
Long takeId = locationMapper.selectByTypeAndId(robotTaskVo.getTakeType(),robotTaskVo.getTakeId());
if (ObjectUtil.isEmpty(takeId)) {
throw new RuntimeException("取货库位为空或者已锁定 "+ robotTaskVo.getTakeId());
}
}
}
@Override

View File

@ -0,0 +1,568 @@
package cn.iocoder.yudao.module.system.util.redis;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@Component
public final class RedisUtil {
@Resource
private RedisTemplate<String, Object> redisTemplate;
/**
* 获取自增
* @param key
* @return
*/
public String getIncrementByKey( String key) {
Long autoID = redisTemplate.opsForValue().increment(key, 1);
// 设置key过期时间, 保证每天的流水号从1开始
if (autoID == 1) {
// 获取当前时间
DateTime now = DateUtil.date();
// 获取明天的时间
String tomorrowZero = DateUtil.format(DateUtil.tomorrow(), DatePattern.NORM_DATE_PATTERN);
DateTime tomorrowZeroDate = DateUtil.parse(tomorrowZero);
// 计算两个时间的秒数作为当天的key的失效时间
long timeOut = DateUtil.between(now, tomorrowZeroDate, DateUnit.SECOND);
// 设置过期时间
redisTemplate.expire(key, timeOut, TimeUnit.SECONDS);
}
return String.format("%06d", autoID);
}
public Set<String> keys(String keys){
try {
return redisTemplate.keys(keys);
}catch (Exception e){
e.printStackTrace();
return null;
}
}
/**
* 指定缓存失效时间
* @param key
* @param time 时间()
* @return
*/
public boolean expire(String key, long time) {
try {
if (time > 0) {
redisTemplate.expire(key, time, TimeUnit.SECONDS);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 根据key 获取过期时间
* @param key 不能为null
* @return 时间() 返回0代表为永久有效
*/
public long getExpire(String key) {
return redisTemplate.getExpire(key, TimeUnit.SECONDS);
}
/**
* 判断key是否存在
* @param key
* @return true 存在 false不存在
*/
public boolean hasKey(String key) {
try {
return redisTemplate.hasKey(key);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 删除缓存
* @param key 可以传一个值 或多个
*/
@SuppressWarnings("unchecked")
public void del(String... key) {
if (key != null && key.length > 0) {
if (key.length == 1) {
redisTemplate.delete(key[0]);
} else {
redisTemplate.delete((Collection<String>) CollectionUtils.arrayToList(key));
}
}
}
/**
* 普通缓存获取
* @param key
* @return
*/
public Object get(String key) {
return key == null ? null : redisTemplate.opsForValue().get(key);
}
/**
* 普通缓存放入
* @param key
* @param value
* @return true成功 false失败
*/
public boolean set(String key, Object value) {
try {
redisTemplate.opsForValue().set(key, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 普通缓存放入, 不存在放入存在返回
* @param key
* @param value
* @return true成功 false失败
*/
public boolean setnx(String key, Object value) {
try {
redisTemplate.opsForValue().setIfAbsent(key,value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 普通缓存放入并设置时间
* @param key
* @param value
* @param time 时间() time要大于0 如果time小于等于0 将设置无限期
* @return true成功 false 失败
*/
public boolean set(String key, Object value, long time) {
try {
if (time > 0) {
redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
} else {
set(key, value);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 普通缓存放入并设置时间,不存在放入存在返回
* @param key
* @param value
* @param time 时间() time要大于0 如果time小于等于0 将设置无限期
* @return true成功 false 失败
*/
public boolean setnx(String key, Object value, long time) {
try {
if (time > 0) {
redisTemplate.opsForValue().setIfAbsent(key, value, time, TimeUnit.SECONDS);
} else {
set(key, value);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 递增
* @param key
* @param delta 要增加几(大于0)
* @return
*/
public long incr(String key, long delta) {
if (delta < 0) {
throw new RuntimeException("递增因子必须大于0");
}
return redisTemplate.opsForValue().increment(key, delta);
}
/**
* 递减
* @param key
* @param delta 要减少几(小于0)
* @return
*/
public long decr(String key, long delta) {
if (delta < 0) {
throw new RuntimeException("递减因子必须大于0");
}
return redisTemplate.opsForValue().increment(key, -delta);
}
/**
* HashGet
* @param key 不能为null
* @param item 不能为null
* @return
*/
public Object hget(String key, String item) {
return redisTemplate.opsForHash().get(key, item);
}
/**
* 获取hashKey对应的所有键值
* @param key
* @return 对应的多个键值
*/
public Map<Object, Object> hmget(String key) {
return redisTemplate.opsForHash().entries(key);
}
/**
* HashSet
* @param key
* @param map 对应多个键值
* @return true 成功 false 失败
*/
public boolean hmset(String key, Map<String, Object> map) {
try {
redisTemplate.opsForHash().putAll(key, map);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* HashSet 并设置时间
* @param key
* @param map 对应多个键值
* @param time 时间()
* @return true成功 false失败
*/
public boolean hmset(String key, Map<String, Object> map, long time) {
try {
redisTemplate.opsForHash().putAll(key, map);
if (time > 0) {
expire(key, time);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 向一张hash表中放入数据,如果不存在将创建
* @param key
* @param item
* @param value
* @return true 成功 false失败
*/
public boolean hset(String key, String item, Object value) {
try {
redisTemplate.opsForHash().put(key, item, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 向一张hash表中放入数据,如果不存在将创建
* @param key
* @param item
* @param value
* @param time 时间() 注意:如果已存在的hash表有时间,这里将会替换原有的时间
* @return true 成功 false失败
*/
public boolean hset(String key, String item, Object value, long time) {
try {
redisTemplate.opsForHash().put(key, item, value);
if (time > 0) {
expire(key, time);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 删除hash表中的值
* @param key 不能为null
* @param item 可以使多个 不能为null
*/
public void hdel(String key, Object... item) {
redisTemplate.opsForHash().delete(key, item);
}
/**
* 判断hash表中是否有该项的值
* @param key 不能为null
* @param item 不能为null
* @return true 存在 false不存在
*/
public boolean hHasKey(String key, String item) {
return redisTemplate.opsForHash().hasKey(key, item);
}
/**
* hash递增 如果不存在,就会创建一个 并把新增后的值返回
* @param key
* @param item
* @param by 要增加几(大于0)
* @return
*/
public double hincr(String key, String item, double by) {
return redisTemplate.opsForHash().increment(key, item, by);
}
/**
* hash递减
* @param key
* @param item
* @param by 要减少记(小于0)
* @return
*/
public double hdecr(String key, String item, double by) {
return redisTemplate.opsForHash().increment(key, item, -by);
}
/**
* 根据key获取Set中的所有值
* @param key
* @return
*/
public Set<Object> sGet(String key) {
try {
return redisTemplate.opsForSet().members(key);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 根据value从一个set中查询,是否存在
* @param key
* @param value
* @return true 存在 false不存在
*/
public boolean sHasKey(String key, Object value) {
try {
return redisTemplate.opsForSet().isMember(key, value);
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 将数据放入set缓存
* @param key
* @param values 可以是多个
* @return 成功个数
*/
public long sSet(String key, Object... values) {
try {
return redisTemplate.opsForSet().add(key, values);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* 将set数据放入缓存
* @param key
* @param time 时间()
* @param values 可以是多个
* @return 成功个数
*/
public long sSetAndTime(String key, long time, Object... values) {
try {
Long count = redisTemplate.opsForSet().add(key, values);
if (time > 0){
expire(key, time);
}
return count;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* 获取set缓存的长度
* @param key
* @return
*/
public long sGetSetSize(String key) {
try {
return redisTemplate.opsForSet().size(key);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* 移除值为value的
* @param key
* @param values 可以是多个
* @return 移除的个数
*/
public long setRemove(String key, Object... values) {
try {
Long count = redisTemplate.opsForSet().remove(key, values);
return count;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
// ===============================list=================================
/**
* 获取list缓存的内容
* @param key
* @param start 开始
* @param end 结束 0 -1代表所有值
* @return
*/
public List<Object> lGet(String key, long start, long end) {
try {
return redisTemplate.opsForList().range(key, start, end);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 获取list缓存的长度
* @param key
* @return
*/
public long lGetListSize(String key) {
try {
return redisTemplate.opsForList().size(key);
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
/**
* 通过索引 获取list中的值
* @param key
* @param index 索引 index>=0时 0 表头1 第二个元素依次类推index<0时-1表尾-2倒数第二个元素依次类推
* @return
*/
public Object lGetIndex(String key, long index) {
try {
return redisTemplate.opsForList().index(key, index);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 将list放入缓存
* @param key
* @param value
* @return
*/
public boolean lSet(String key, Object value) {
try {
redisTemplate.opsForList().rightPush(key, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 将list放入缓存
* @param key
* @param value
* @param time 时间()
* @return
*/
public boolean lSet(String key, Object value, long time) {
try {
redisTemplate.opsForList().rightPush(key, value);
if (time > 0){
expire(key, time);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 将list放入缓存
* @param key
* @param value
* @return
*/
public boolean lSet(String key, List<Object> value) {
try {
redisTemplate.opsForList().rightPushAll(key, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 将list放入缓存
*
* @param key
* @param value
* @param time 时间()
* @return
*/
public boolean lSet(String key, List<Object> value, long time) {
try {
redisTemplate.opsForList().rightPushAll(key, value);
if (time > 0){
expire(key, time);
}
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 根据索引修改list中的某条数据
* @param key
* @param index 索引
* @param value
* @return
*/
public boolean lUpdateIndex(String key, long index, Object value) {
try {
redisTemplate.opsForList().set(key, index, value);
return true;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* 移除N个值为value
* @param key
* @param count 移除多少个
* @param value
* @return 移除的个数
*/
public long lRemove(String key, long count, Object value) {
try {
Long remove = redisTemplate.opsForList().remove(key, count, value);
return remove;
} catch (Exception e) {
e.printStackTrace();
return 0;
}
}
}

View File

@ -0,0 +1,31 @@
package cn.iocoder.yudao.module.system.util.redis;
import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
import java.util.Set;
@Component
public class RedissonUtils {
@Resource
private RedissonClient redissonClient;
/**
* 获取redisson锁
* @param keys 同时锁多个key
* @return
*/
public RLock getLocks(Set<String> keys){
RLock[] lockArray = keys.stream().map(key -> redissonClient.getLock(key)).toArray(RLock[]::new);
return redissonClient.getMultiLock(lockArray);
}
public RLock getLock(String key){
return redissonClient.getLock(key);
}
}

View File

@ -206,3 +206,6 @@ yudao:
end-code: 9999 # 这里配置 9999 的原因是,测试方便。
debug: false
zn:
task-no: ZN #任务号开头

View File

@ -1,12 +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="cn.iocoder.yudao.module.system.dal.mysql.houselocation.HouseLocationMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>

View File

@ -0,0 +1,38 @@
<?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="cn.iocoder.yudao.module.system.dal.mysql.houselocation.WareHouseLocationMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见https://www.iocoder.cn/MyBatis/x-plugins/
-->
<select id="selectByTypeAndId" resultType="java.lang.Long">
select
id
from
ware_house_location
<where>
<choose>
<when test= " type != null and type == '1'">
AND id = #{id}
</when>
<when test= " type != null and type == '2'">
AND lane_id = #{id}
</when>
<when test= " type != null and type == '3'">
AND area_id = #{id}
</when>
<when test= "1==1">
AND location_enable = '1'
AND location_lock = '1'
AND location_use_status = '0'
</when>
</choose>
</where>
order by location_number desc , location_storey asc
limit 1
</select>
</mapper>