From d0575e41228e0336bbc628530481cfec3a1d578c Mon Sep 17 00:00:00 2001 From: luoyifan Date: Sun, 29 Jun 2025 18:42:48 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=BB=BA=E8=A1=A8=EF=BC=9A=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E4=BF=A1=E6=81=AF=20=E6=89=A7=E8=A1=8C=E5=99=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E5=BA=93=E5=AD=98=E4=BD=8D=E7=BD=AE=20?= =?UTF-8?q?=E5=BA=93=E5=AD=98=20=E5=BA=93=E5=AD=98=E8=B4=A6=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../galaxis/rcs/common/entity/LccBasContainer.java | 28 ++++++ .../galaxis/rcs/common/entity/LccBasExecutor.java | 32 ++++++ .../galaxis/rcs/common/entity/LccBasLocation.java | 42 ++++++++ .../galaxis/rcs/common/entity/LccInvLedger.java | 52 ++++++++++ .../com/galaxis/rcs/common/entity/LccInvLpn.java | 34 +++++++ .../galaxis/rcs/common/query/QLccBasContainer.java | 71 ++++++++++++++ .../galaxis/rcs/common/query/QLccBasExecutor.java | 77 +++++++++++++++ .../galaxis/rcs/common/query/QLccBasLocation.java | 92 ++++++++++++++++++ .../galaxis/rcs/common/query/QLccInvLedger.java | 107 +++++++++++++++++++++ .../com/galaxis/rcs/common/query/QLccInvLpn.java | 80 +++++++++++++++ .../test/java/com/yvan/workbench/CodegenTest.java | 6 +- 11 files changed, 620 insertions(+), 1 deletion(-) create mode 100644 servo/src/main/java/com/galaxis/rcs/common/entity/LccBasContainer.java create mode 100644 servo/src/main/java/com/galaxis/rcs/common/entity/LccBasExecutor.java create mode 100644 servo/src/main/java/com/galaxis/rcs/common/entity/LccBasLocation.java create mode 100644 servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLedger.java create mode 100644 servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLpn.java create mode 100644 servo/src/main/java/com/galaxis/rcs/common/query/QLccBasContainer.java create mode 100644 servo/src/main/java/com/galaxis/rcs/common/query/QLccBasExecutor.java create mode 100644 servo/src/main/java/com/galaxis/rcs/common/query/QLccBasLocation.java create mode 100644 servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLedger.java create mode 100644 servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLpn.java diff --git a/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasContainer.java b/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasContainer.java new file mode 100644 index 0000000..fb5f588 --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasContainer.java @@ -0,0 +1,28 @@ +package com.galaxis.rcs.common.entity; + +import lombok.Data; +import java.io.Serializable; +import java.util.Date; + +/** + * 容器信息(lcc_bas_container) + */ +@Data +public class LccBasContainer implements Serializable { + /** 环境ID */ + private Long envId; + /** 容器条码 */ + private String lpn; + /** 容器类型 */ + private String containerType; + /** 是否激活 */ + private Boolean isActive; + /** 创建时间 */ + private Date createAt; + /** 创建人 */ + private String createBy; + /** 更新时间 */ + private Date updateAt; + /** 更新人 */ + private String updateBy; +} diff --git a/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasExecutor.java b/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasExecutor.java new file mode 100644 index 0000000..ad65ae5 --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasExecutor.java @@ -0,0 +1,32 @@ +package com.galaxis.rcs.common.entity; + +import lombok.Data; +import java.io.Serializable; +import java.util.Date; + +/** + * 执行器信息(lcc_bas_executor) + */ +@Data +public class LccBasExecutor implements Serializable { + /** 环境ID */ + private Long envId; + /** 执行器ID */ + private String executorId; + /** 仿真车所在楼层 */ + private String virtualFloorCode; + /** 仿真车所在XYZ */ + private String virtualLocationAt; + /** 仿真车配置详情 */ + private String virtualExecutorPayload; + /** 是否激活 */ + private Boolean isActive; + /** 创建时间 */ + private Date createAt; + /** 创建人 */ + private String createBy; + /** 更新时间 */ + private Date updateAt; + /** 更新人 */ + private String updateBy; +} diff --git a/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasLocation.java b/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasLocation.java new file mode 100644 index 0000000..000493c --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasLocation.java @@ -0,0 +1,42 @@ +package com.galaxis.rcs.common.entity; + +import lombok.Data; +import java.io.Serializable; +import java.util.Date; + +/** + * 库存位置(lcc_bas_location) + */ +@Data +public class LccBasLocation implements Serializable { + /** 环境ID */ + private Long envId; + /** 位置编码 */ + private String locCode; + /** 位置类型_gstore_rack_executor */ + private String locType; + /** 路径点编码 */ + private String wayPoint; + /** 货位相对于路径方向 */ + private String locDirection; + /** 位置编码 */ + private String rack; + /** 货架列 */ + private Integer bay; + /** 货架层 */ + private Integer level; + /** 货架格 */ + private Integer cell; + /** 是否锁定 */ + private Integer isLock; + /** 是否冻结 */ + private Integer isFrozen; + /** 创建时间 */ + private Date createAt; + /** 创建人 */ + private String createBy; + /** 更新时间 */ + private Date updateAt; + /** 更新人 */ + private String updateBy; +} diff --git a/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLedger.java b/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLedger.java new file mode 100644 index 0000000..3a98dbc --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLedger.java @@ -0,0 +1,52 @@ +package com.galaxis.rcs.common.entity; + +import lombok.Data; +import java.io.Serializable; +import java.util.Date; + +/** + * 库存账页(lcc_inv_ledger) + */ +@Data +public class LccInvLedger implements Serializable { + /** 环境ID */ + private Long envId; + /** 业务单据ID */ + private Long bizTaskId; + /** 账页号 */ + private Long ledgerId; + /** 账页类型 */ + private String ledgerType; + /** 账页原因 */ + private String ledgerRemark; + /** 托盘条码 */ + private String lpn; + /** 改变前库存位置 */ + private String locCodeBefore; + /** 改变前堆叠层号从0开始 */ + private Integer layerIndexBefore; + /** 改变前库存数量 */ + private Integer qtyBefore; + /** 改变前入库占用数量 */ + private Integer qtyInBefore; + /** 改变前出库占用数量 */ + private Integer qtyOutBefore; + /** 改变后堆叠层号从0开始 */ + private Integer layerIndex; + /** 改变前库存位置 */ + private String locCode; + /** 改变后库存数量 */ + private Integer qty; + /** 改变后入库占用数量 */ + private Integer qtyIn; + /** 改变后出库占用数量 */ + private Integer qtyOut; + /** 创建时间 */ + private Date createAt; + /** 创建人 */ + private String createBy; + /** 更新时间 */ + private Date updateAt; + /** 更新人 */ + private String updateBy; +} diff --git a/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLpn.java b/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLpn.java new file mode 100644 index 0000000..a973cf8 --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLpn.java @@ -0,0 +1,34 @@ +package com.galaxis.rcs.common.entity; + +import lombok.Data; +import java.io.Serializable; +import java.util.Date; + +/** + * 库存(lcc_inv_lpn) + */ +@Data +public class LccInvLpn implements Serializable { + /** 环境ID */ + private Long envId; + /** 托盘条码 */ + private String lpn; + /** 库存位置 */ + private String locCode; + /** 堆叠层号从0开始 */ + private Integer layerIndex; + /** 库存数量 */ + private Integer qty; + /** 入库占用数量 */ + private Integer qtyIn; + /** 出库占用数量 */ + private Integer qtyOut; + /** 创建时间 */ + private Date createAt; + /** 创建人 */ + private String createBy; + /** 更新时间 */ + private Date updateAt; + /** 更新人 */ + private String updateBy; +} diff --git a/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasContainer.java b/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasContainer.java new file mode 100644 index 0000000..0e5e6d4 --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasContainer.java @@ -0,0 +1,71 @@ +package com.galaxis.rcs.common.query; + +import static com.querydsl.core.types.PathMetadataFactory.*; +import com.querydsl.core.types.dsl.*; +import com.querydsl.core.types.*; +import com.querydsl.sql.*; +import java.sql.Types; +import com.galaxis.rcs.common.entity.LccBasContainer; +import java.util.Date; + +/** + * 容器信息(lcc_bas_container) + */ +@SuppressWarnings("ALL") +public class QLccBasContainer extends RelationalPathBase { + /** lcc_bas_container表 */ + public static final QLccBasContainer lccBasContainer = new QLccBasContainer("lcc_bas_container"); + + /** 环境ID */ + public final NumberPath envId = createNumber("envId", Long.class); + /** 容器条码 */ + public final StringPath lpn = createString("lpn"); + /** 容器类型 */ + public final StringPath containerType = createString("containerType"); + /** 是否激活 */ + public final BooleanPath isActive = createBoolean("isActive"); + /** 创建时间 */ + public final DateTimePath createAt = createDateTime("createAt", Date.class); + /** 创建人 */ + public final StringPath createBy = createString("createBy"); + /** 更新时间 */ + public final DateTimePath updateAt = createDateTime("updateAt", Date.class); + /** 更新人 */ + public final StringPath updateBy = createString("updateBy"); + + public QLccBasContainer(String variable) { + super(LccBasContainer.class, forVariable(variable), "rcs2_tw_zhanghui", "lcc_bas_container"); + addMetadata(); + } + + public QLccBasContainer(String variable, String schema, String table) { + super(LccBasContainer.class, forVariable(variable), schema, table); + addMetadata(); + } + + public QLccBasContainer(String variable, String schema) { + super(LccBasContainer.class, forVariable(variable), schema, "lcc_bas_container"); + addMetadata(); + } + + public QLccBasContainer(Path path) { + super(path.getType(), path.getMetadata(), "rcs2_tw_zhanghui", "lcc_bas_container"); + addMetadata(); + } + + public QLccBasContainer(PathMetadata metadata) { + super(LccBasContainer.class, metadata, "rcs2_tw_zhanghui", "lcc_bas_container"); + addMetadata(); + } + + private void addMetadata() { + addMetadata(envId, ColumnMetadata.named("env_id").withIndex(1).ofType(Types.BIGINT).withSize(19)); + addMetadata(lpn, ColumnMetadata.named("lpn").withIndex(2).ofType(Types.VARCHAR).withSize(50)); + addMetadata(containerType, ColumnMetadata.named("container_type").withIndex(3).ofType(Types.VARCHAR).withSize(20)); + addMetadata(isActive, ColumnMetadata.named("is_active").withIndex(4).ofType(Types.BIT).withSize(3)); + addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(5).ofType(Types.TIMESTAMP)); + addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(6).ofType(Types.VARCHAR).withSize(50)); + addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(7).ofType(Types.TIMESTAMP)); + addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(8).ofType(Types.VARCHAR).withSize(50)); + } +} diff --git a/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasExecutor.java b/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasExecutor.java new file mode 100644 index 0000000..c38f6ed --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasExecutor.java @@ -0,0 +1,77 @@ +package com.galaxis.rcs.common.query; + +import static com.querydsl.core.types.PathMetadataFactory.*; +import com.querydsl.core.types.dsl.*; +import com.querydsl.core.types.*; +import com.querydsl.sql.*; +import java.sql.Types; +import com.galaxis.rcs.common.entity.LccBasExecutor; +import java.util.Date; + +/** + * 执行器信息(lcc_bas_executor) + */ +@SuppressWarnings("ALL") +public class QLccBasExecutor extends RelationalPathBase { + /** lcc_bas_executor表 */ + public static final QLccBasExecutor lccBasExecutor = new QLccBasExecutor("lcc_bas_executor"); + + /** 环境ID */ + public final NumberPath envId = createNumber("envId", Long.class); + /** 执行器ID */ + public final StringPath executorId = createString("executorId"); + /** 仿真车所在楼层 */ + public final StringPath virtualFloorCode = createString("virtualFloorCode"); + /** 仿真车所在XYZ */ + public final StringPath virtualLocationAt = createString("virtualLocationAt"); + /** 仿真车配置详情 */ + public final StringPath virtualExecutorPayload = createString("virtualExecutorPayload"); + /** 是否激活 */ + public final BooleanPath isActive = createBoolean("isActive"); + /** 创建时间 */ + public final DateTimePath createAt = createDateTime("createAt", Date.class); + /** 创建人 */ + public final StringPath createBy = createString("createBy"); + /** 更新时间 */ + public final DateTimePath updateAt = createDateTime("updateAt", Date.class); + /** 更新人 */ + public final StringPath updateBy = createString("updateBy"); + + public QLccBasExecutor(String variable) { + super(LccBasExecutor.class, forVariable(variable), "rcs2_tw_zhanghui", "lcc_bas_executor"); + addMetadata(); + } + + public QLccBasExecutor(String variable, String schema, String table) { + super(LccBasExecutor.class, forVariable(variable), schema, table); + addMetadata(); + } + + public QLccBasExecutor(String variable, String schema) { + super(LccBasExecutor.class, forVariable(variable), schema, "lcc_bas_executor"); + addMetadata(); + } + + public QLccBasExecutor(Path path) { + super(path.getType(), path.getMetadata(), "rcs2_tw_zhanghui", "lcc_bas_executor"); + addMetadata(); + } + + public QLccBasExecutor(PathMetadata metadata) { + super(LccBasExecutor.class, metadata, "rcs2_tw_zhanghui", "lcc_bas_executor"); + addMetadata(); + } + + private void addMetadata() { + addMetadata(envId, ColumnMetadata.named("env_id").withIndex(1).ofType(Types.BIGINT).withSize(19)); + addMetadata(executorId, ColumnMetadata.named("executor_id").withIndex(2).ofType(Types.VARCHAR).withSize(50)); + addMetadata(virtualFloorCode, ColumnMetadata.named("virtual_floor_code").withIndex(3).ofType(Types.VARCHAR).withSize(50)); + addMetadata(virtualLocationAt, ColumnMetadata.named("virtual_location_at").withIndex(4).ofType(Types.VARCHAR).withSize(50)); + addMetadata(virtualExecutorPayload, ColumnMetadata.named("virtual_executor_payload").withIndex(5).ofType(Types.VARCHAR).withSize(3000)); + addMetadata(isActive, ColumnMetadata.named("is_active").withIndex(6).ofType(Types.BIT).withSize(3)); + addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(7).ofType(Types.TIMESTAMP)); + addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(8).ofType(Types.VARCHAR).withSize(50)); + addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(9).ofType(Types.TIMESTAMP)); + addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(10).ofType(Types.VARCHAR).withSize(50)); + } +} diff --git a/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasLocation.java b/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasLocation.java new file mode 100644 index 0000000..b673c9a --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasLocation.java @@ -0,0 +1,92 @@ +package com.galaxis.rcs.common.query; + +import static com.querydsl.core.types.PathMetadataFactory.*; +import com.querydsl.core.types.dsl.*; +import com.querydsl.core.types.*; +import com.querydsl.sql.*; +import java.sql.Types; +import com.galaxis.rcs.common.entity.LccBasLocation; +import java.util.Date; + +/** + * 库存位置(lcc_bas_location) + */ +@SuppressWarnings("ALL") +public class QLccBasLocation extends RelationalPathBase { + /** lcc_bas_location表 */ + public static final QLccBasLocation lccBasLocation = new QLccBasLocation("lcc_bas_location"); + + /** 环境ID */ + public final NumberPath envId = createNumber("envId", Long.class); + /** 位置编码 */ + public final StringPath locCode = createString("locCode"); + /** 位置类型_gstore_rack_executor */ + public final StringPath locType = createString("locType"); + /** 路径点编码 */ + public final StringPath wayPoint = createString("wayPoint"); + /** 货位相对于路径方向 */ + public final StringPath locDirection = createString("locDirection"); + /** 位置编码 */ + public final StringPath rack = createString("rack"); + /** 货架列 */ + public final NumberPath bay = createNumber("bay", Integer.class); + /** 货架层 */ + public final NumberPath level = createNumber("level", Integer.class); + /** 货架格 */ + public final NumberPath cell = createNumber("cell", Integer.class); + /** 是否锁定 */ + public final NumberPath isLock = createNumber("isLock", Integer.class); + /** 是否冻结 */ + public final NumberPath isFrozen = createNumber("isFrozen", Integer.class); + /** 创建时间 */ + public final DateTimePath createAt = createDateTime("createAt", Date.class); + /** 创建人 */ + public final StringPath createBy = createString("createBy"); + /** 更新时间 */ + public final DateTimePath updateAt = createDateTime("updateAt", Date.class); + /** 更新人 */ + public final StringPath updateBy = createString("updateBy"); + + public QLccBasLocation(String variable) { + super(LccBasLocation.class, forVariable(variable), "rcs2_tw_zhanghui", "lcc_bas_location"); + addMetadata(); + } + + public QLccBasLocation(String variable, String schema, String table) { + super(LccBasLocation.class, forVariable(variable), schema, table); + addMetadata(); + } + + public QLccBasLocation(String variable, String schema) { + super(LccBasLocation.class, forVariable(variable), schema, "lcc_bas_location"); + addMetadata(); + } + + public QLccBasLocation(Path path) { + super(path.getType(), path.getMetadata(), "rcs2_tw_zhanghui", "lcc_bas_location"); + addMetadata(); + } + + public QLccBasLocation(PathMetadata metadata) { + super(LccBasLocation.class, metadata, "rcs2_tw_zhanghui", "lcc_bas_location"); + addMetadata(); + } + + private void addMetadata() { + addMetadata(envId, ColumnMetadata.named("env_id").withIndex(1).ofType(Types.BIGINT).withSize(19)); + addMetadata(locCode, ColumnMetadata.named("loc_code").withIndex(2).ofType(Types.VARCHAR).withSize(50)); + addMetadata(locType, ColumnMetadata.named("loc_type").withIndex(3).ofType(Types.VARCHAR).withSize(20)); + addMetadata(wayPoint, ColumnMetadata.named("way_point").withIndex(4).ofType(Types.VARCHAR).withSize(50)); + addMetadata(locDirection, ColumnMetadata.named("loc_direction").withIndex(5).ofType(Types.VARCHAR).withSize(10)); + addMetadata(rack, ColumnMetadata.named("rack").withIndex(6).ofType(Types.VARCHAR).withSize(50)); + addMetadata(bay, ColumnMetadata.named("bay").withIndex(7).ofType(Types.INTEGER).withSize(10)); + addMetadata(level, ColumnMetadata.named("level").withIndex(8).ofType(Types.INTEGER).withSize(10)); + addMetadata(cell, ColumnMetadata.named("cell").withIndex(9).ofType(Types.INTEGER).withSize(10)); + addMetadata(isLock, ColumnMetadata.named("is_lock").withIndex(10).ofType(Types.TINYINT).withSize(3)); + addMetadata(isFrozen, ColumnMetadata.named("is_frozen").withIndex(11).ofType(Types.TINYINT).withSize(3)); + addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(12).ofType(Types.TIMESTAMP)); + addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(13).ofType(Types.VARCHAR).withSize(50)); + addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(14).ofType(Types.TIMESTAMP)); + addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(15).ofType(Types.VARCHAR).withSize(50)); + } +} diff --git a/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLedger.java b/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLedger.java new file mode 100644 index 0000000..8757755 --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLedger.java @@ -0,0 +1,107 @@ +package com.galaxis.rcs.common.query; + +import static com.querydsl.core.types.PathMetadataFactory.*; +import com.querydsl.core.types.dsl.*; +import com.querydsl.core.types.*; +import com.querydsl.sql.*; +import java.sql.Types; +import com.galaxis.rcs.common.entity.LccInvLedger; +import java.util.Date; + +/** + * 库存账页(lcc_inv_ledger) + */ +@SuppressWarnings("ALL") +public class QLccInvLedger extends RelationalPathBase { + /** lcc_inv_ledger表 */ + public static final QLccInvLedger lccInvLedger = new QLccInvLedger("lcc_inv_ledger"); + + /** 环境ID */ + public final NumberPath envId = createNumber("envId", Long.class); + /** 业务单据ID */ + public final NumberPath bizTaskId = createNumber("bizTaskId", Long.class); + /** 账页号 */ + public final NumberPath ledgerId = createNumber("ledgerId", Long.class); + /** 账页类型 */ + public final StringPath ledgerType = createString("ledgerType"); + /** 账页原因 */ + public final StringPath ledgerRemark = createString("ledgerRemark"); + /** 托盘条码 */ + public final StringPath lpn = createString("lpn"); + /** 改变前库存位置 */ + public final StringPath locCodeBefore = createString("locCodeBefore"); + /** 改变前堆叠层号从0开始 */ + public final NumberPath layerIndexBefore = createNumber("layerIndexBefore", Integer.class); + /** 改变前库存数量 */ + public final NumberPath qtyBefore = createNumber("qtyBefore", Integer.class); + /** 改变前入库占用数量 */ + public final NumberPath qtyInBefore = createNumber("qtyInBefore", Integer.class); + /** 改变前出库占用数量 */ + public final NumberPath qtyOutBefore = createNumber("qtyOutBefore", Integer.class); + /** 改变后堆叠层号从0开始 */ + public final NumberPath layerIndex = createNumber("layerIndex", Integer.class); + /** 改变前库存位置 */ + public final StringPath locCode = createString("locCode"); + /** 改变后库存数量 */ + public final NumberPath qty = createNumber("qty", Integer.class); + /** 改变后入库占用数量 */ + public final NumberPath qtyIn = createNumber("qtyIn", Integer.class); + /** 改变后出库占用数量 */ + public final NumberPath qtyOut = createNumber("qtyOut", Integer.class); + /** 创建时间 */ + public final DateTimePath createAt = createDateTime("createAt", Date.class); + /** 创建人 */ + public final StringPath createBy = createString("createBy"); + /** 更新时间 */ + public final DateTimePath updateAt = createDateTime("updateAt", Date.class); + /** 更新人 */ + public final StringPath updateBy = createString("updateBy"); + + public QLccInvLedger(String variable) { + super(LccInvLedger.class, forVariable(variable), "rcs2_tw_zhanghui", "lcc_inv_ledger"); + addMetadata(); + } + + public QLccInvLedger(String variable, String schema, String table) { + super(LccInvLedger.class, forVariable(variable), schema, table); + addMetadata(); + } + + public QLccInvLedger(String variable, String schema) { + super(LccInvLedger.class, forVariable(variable), schema, "lcc_inv_ledger"); + addMetadata(); + } + + public QLccInvLedger(Path path) { + super(path.getType(), path.getMetadata(), "rcs2_tw_zhanghui", "lcc_inv_ledger"); + addMetadata(); + } + + public QLccInvLedger(PathMetadata metadata) { + super(LccInvLedger.class, metadata, "rcs2_tw_zhanghui", "lcc_inv_ledger"); + addMetadata(); + } + + private void addMetadata() { + addMetadata(envId, ColumnMetadata.named("env_id").withIndex(1).ofType(Types.BIGINT).withSize(19)); + addMetadata(bizTaskId, ColumnMetadata.named("biz_task_id").withIndex(2).ofType(Types.BIGINT).withSize(19)); + addMetadata(ledgerId, ColumnMetadata.named("ledger_id").withIndex(3).ofType(Types.BIGINT).withSize(19)); + addMetadata(ledgerType, ColumnMetadata.named("ledger_type").withIndex(4).ofType(Types.VARCHAR).withSize(20)); + addMetadata(ledgerRemark, ColumnMetadata.named("ledger_remark").withIndex(5).ofType(Types.VARCHAR).withSize(200)); + addMetadata(lpn, ColumnMetadata.named("lpn").withIndex(6).ofType(Types.VARCHAR).withSize(50)); + addMetadata(locCodeBefore, ColumnMetadata.named("loc_code_before").withIndex(7).ofType(Types.VARCHAR).withSize(50)); + addMetadata(layerIndexBefore, ColumnMetadata.named("layer_index_before").withIndex(8).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyBefore, ColumnMetadata.named("qty_before").withIndex(9).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyInBefore, ColumnMetadata.named("qty_in_before").withIndex(10).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyOutBefore, ColumnMetadata.named("qty_out_before").withIndex(11).ofType(Types.INTEGER).withSize(10)); + addMetadata(layerIndex, ColumnMetadata.named("layer_index").withIndex(12).ofType(Types.INTEGER).withSize(10)); + addMetadata(locCode, ColumnMetadata.named("loc_code").withIndex(13).ofType(Types.VARCHAR).withSize(50)); + addMetadata(qty, ColumnMetadata.named("qty").withIndex(14).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyIn, ColumnMetadata.named("qty_in").withIndex(15).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyOut, ColumnMetadata.named("qty_out").withIndex(16).ofType(Types.INTEGER).withSize(10)); + addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(17).ofType(Types.TIMESTAMP)); + addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(18).ofType(Types.VARCHAR).withSize(50)); + addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(19).ofType(Types.TIMESTAMP)); + addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(20).ofType(Types.VARCHAR).withSize(50)); + } +} diff --git a/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLpn.java b/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLpn.java new file mode 100644 index 0000000..a4537f7 --- /dev/null +++ b/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLpn.java @@ -0,0 +1,80 @@ +package com.galaxis.rcs.common.query; + +import static com.querydsl.core.types.PathMetadataFactory.*; +import com.querydsl.core.types.dsl.*; +import com.querydsl.core.types.*; +import com.querydsl.sql.*; +import java.sql.Types; +import com.galaxis.rcs.common.entity.LccInvLpn; +import java.util.Date; + +/** + * 库存(lcc_inv_lpn) + */ +@SuppressWarnings("ALL") +public class QLccInvLpn extends RelationalPathBase { + /** lcc_inv_lpn表 */ + public static final QLccInvLpn lccInvLpn = new QLccInvLpn("lcc_inv_lpn"); + + /** 环境ID */ + public final NumberPath envId = createNumber("envId", Long.class); + /** 托盘条码 */ + public final StringPath lpn = createString("lpn"); + /** 库存位置 */ + public final StringPath locCode = createString("locCode"); + /** 堆叠层号从0开始 */ + public final NumberPath layerIndex = createNumber("layerIndex", Integer.class); + /** 库存数量 */ + public final NumberPath qty = createNumber("qty", Integer.class); + /** 入库占用数量 */ + public final NumberPath qtyIn = createNumber("qtyIn", Integer.class); + /** 出库占用数量 */ + public final NumberPath qtyOut = createNumber("qtyOut", Integer.class); + /** 创建时间 */ + public final DateTimePath createAt = createDateTime("createAt", Date.class); + /** 创建人 */ + public final StringPath createBy = createString("createBy"); + /** 更新时间 */ + public final DateTimePath updateAt = createDateTime("updateAt", Date.class); + /** 更新人 */ + public final StringPath updateBy = createString("updateBy"); + + public QLccInvLpn(String variable) { + super(LccInvLpn.class, forVariable(variable), "rcs2_tw_zhanghui", "lcc_inv_lpn"); + addMetadata(); + } + + public QLccInvLpn(String variable, String schema, String table) { + super(LccInvLpn.class, forVariable(variable), schema, table); + addMetadata(); + } + + public QLccInvLpn(String variable, String schema) { + super(LccInvLpn.class, forVariable(variable), schema, "lcc_inv_lpn"); + addMetadata(); + } + + public QLccInvLpn(Path path) { + super(path.getType(), path.getMetadata(), "rcs2_tw_zhanghui", "lcc_inv_lpn"); + addMetadata(); + } + + public QLccInvLpn(PathMetadata metadata) { + super(LccInvLpn.class, metadata, "rcs2_tw_zhanghui", "lcc_inv_lpn"); + addMetadata(); + } + + private void addMetadata() { + addMetadata(envId, ColumnMetadata.named("env_id").withIndex(1).ofType(Types.BIGINT).withSize(19)); + addMetadata(lpn, ColumnMetadata.named("lpn").withIndex(2).ofType(Types.VARCHAR).withSize(50)); + addMetadata(locCode, ColumnMetadata.named("loc_code").withIndex(3).ofType(Types.VARCHAR).withSize(50)); + addMetadata(layerIndex, ColumnMetadata.named("layer_index").withIndex(4).ofType(Types.INTEGER).withSize(10)); + addMetadata(qty, ColumnMetadata.named("qty").withIndex(5).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyIn, ColumnMetadata.named("qty_in").withIndex(6).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyOut, ColumnMetadata.named("qty_out").withIndex(7).ofType(Types.INTEGER).withSize(10)); + addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(8).ofType(Types.TIMESTAMP)); + addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(9).ofType(Types.VARCHAR).withSize(50)); + addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(10).ofType(Types.TIMESTAMP)); + addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(11).ofType(Types.VARCHAR).withSize(50)); + } +} diff --git a/servo/src/test/java/com/yvan/workbench/CodegenTest.java b/servo/src/test/java/com/yvan/workbench/CodegenTest.java index 816112b..7e6db41 100644 --- a/servo/src/test/java/com/yvan/workbench/CodegenTest.java +++ b/servo/src/test/java/com/yvan/workbench/CodegenTest.java @@ -29,7 +29,11 @@ public class CodegenTest { // .addTable("rcs_task_biz") // .addTable("rcs_task_device") // .addTable("rcs_task_plan"); - .addTable("lcc_model_floor"); + .addTable("lcc_bas_container") + .addTable("lcc_bas_executor") + .addTable("lcc_bas_location") + .addTable("lcc_inv_lpn") + .addTable("lcc_inv_ledger"); CodegenUtils.genCode(jdbc, config); log.info("-->"); jdbc.close(); From 25e4a72e76d63a15dd2d2aa5c66cac0a4c71d26b Mon Sep 17 00:00:00 2001 From: luoyifan Date: Sun, 29 Jun 2025 20:02:38 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E5=BB=BA=E8=A1=A8=EF=BC=9A=E5=AE=B9?= =?UTF-8?q?=E5=99=A8=E4=BF=A1=E6=81=AF=20=E6=89=A7=E8=A1=8C=E5=99=A8?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=20=E5=BA=93=E5=AD=98=E4=BD=8D=E7=BD=AE=20?= =?UTF-8?q?=E5=BA=93=E5=AD=98=20=E5=BA=93=E5=AD=98=E8=B4=A6=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../galaxis/rcs/common/query/QLccInvLedger.java | 42 ++++++++++------------ .../yvan/workbench/model/query/QLccModelFloor.java | 17 +++++---- 2 files changed, 28 insertions(+), 31 deletions(-) diff --git a/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLedger.java b/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLedger.java index 8757755..a6fb522 100644 --- a/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLedger.java +++ b/servo/src/main/java/com/galaxis/rcs/common/query/QLccInvLedger.java @@ -28,16 +28,12 @@ public class QLccInvLedger extends RelationalPathBase { public final StringPath ledgerRemark = createString("ledgerRemark"); /** 托盘条码 */ public final StringPath lpn = createString("lpn"); - /** 改变前库存位置 */ - public final StringPath locCodeBefore = createString("locCodeBefore"); - /** 改变前堆叠层号从0开始 */ - public final NumberPath layerIndexBefore = createNumber("layerIndexBefore", Integer.class); - /** 改变前库存数量 */ - public final NumberPath qtyBefore = createNumber("qtyBefore", Integer.class); - /** 改变前入库占用数量 */ - public final NumberPath qtyInBefore = createNumber("qtyInBefore", Integer.class); - /** 改变前出库占用数量 */ - public final NumberPath qtyOutBefore = createNumber("qtyOutBefore", Integer.class); + /** 库存改变数量 */ + public final NumberPath qtyChange = createNumber("qtyChange", Integer.class); + /** 入库占用改变数量 */ + public final NumberPath qtyInChange = createNumber("qtyInChange", Integer.class); + /** 出库占用改变数量 */ + public final NumberPath qtyOutChange = createNumber("qtyOutChange", Integer.class); /** 改变后堆叠层号从0开始 */ public final NumberPath layerIndex = createNumber("layerIndex", Integer.class); /** 改变前库存位置 */ @@ -89,19 +85,17 @@ public class QLccInvLedger extends RelationalPathBase { addMetadata(ledgerType, ColumnMetadata.named("ledger_type").withIndex(4).ofType(Types.VARCHAR).withSize(20)); addMetadata(ledgerRemark, ColumnMetadata.named("ledger_remark").withIndex(5).ofType(Types.VARCHAR).withSize(200)); addMetadata(lpn, ColumnMetadata.named("lpn").withIndex(6).ofType(Types.VARCHAR).withSize(50)); - addMetadata(locCodeBefore, ColumnMetadata.named("loc_code_before").withIndex(7).ofType(Types.VARCHAR).withSize(50)); - addMetadata(layerIndexBefore, ColumnMetadata.named("layer_index_before").withIndex(8).ofType(Types.INTEGER).withSize(10)); - addMetadata(qtyBefore, ColumnMetadata.named("qty_before").withIndex(9).ofType(Types.INTEGER).withSize(10)); - addMetadata(qtyInBefore, ColumnMetadata.named("qty_in_before").withIndex(10).ofType(Types.INTEGER).withSize(10)); - addMetadata(qtyOutBefore, ColumnMetadata.named("qty_out_before").withIndex(11).ofType(Types.INTEGER).withSize(10)); - addMetadata(layerIndex, ColumnMetadata.named("layer_index").withIndex(12).ofType(Types.INTEGER).withSize(10)); - addMetadata(locCode, ColumnMetadata.named("loc_code").withIndex(13).ofType(Types.VARCHAR).withSize(50)); - addMetadata(qty, ColumnMetadata.named("qty").withIndex(14).ofType(Types.INTEGER).withSize(10)); - addMetadata(qtyIn, ColumnMetadata.named("qty_in").withIndex(15).ofType(Types.INTEGER).withSize(10)); - addMetadata(qtyOut, ColumnMetadata.named("qty_out").withIndex(16).ofType(Types.INTEGER).withSize(10)); - addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(17).ofType(Types.TIMESTAMP)); - addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(18).ofType(Types.VARCHAR).withSize(50)); - addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(19).ofType(Types.TIMESTAMP)); - addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(20).ofType(Types.VARCHAR).withSize(50)); + addMetadata(qtyChange, ColumnMetadata.named("qty_change").withIndex(7).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyInChange, ColumnMetadata.named("qty_in_change").withIndex(8).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyOutChange, ColumnMetadata.named("qty_out_change").withIndex(9).ofType(Types.INTEGER).withSize(10)); + addMetadata(layerIndex, ColumnMetadata.named("layer_index").withIndex(10).ofType(Types.INTEGER).withSize(10)); + addMetadata(locCode, ColumnMetadata.named("loc_code").withIndex(11).ofType(Types.VARCHAR).withSize(50)); + addMetadata(qty, ColumnMetadata.named("qty").withIndex(12).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyIn, ColumnMetadata.named("qty_in").withIndex(13).ofType(Types.INTEGER).withSize(10)); + addMetadata(qtyOut, ColumnMetadata.named("qty_out").withIndex(14).ofType(Types.INTEGER).withSize(10)); + addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(15).ofType(Types.TIMESTAMP)); + addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(16).ofType(Types.VARCHAR).withSize(50)); + addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(17).ofType(Types.TIMESTAMP)); + addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(18).ofType(Types.VARCHAR).withSize(50)); } } diff --git a/servo/src/main/java/com/yvan/workbench/model/query/QLccModelFloor.java b/servo/src/main/java/com/yvan/workbench/model/query/QLccModelFloor.java index 8643b25..19fa775 100644 --- a/servo/src/main/java/com/yvan/workbench/model/query/QLccModelFloor.java +++ b/servo/src/main/java/com/yvan/workbench/model/query/QLccModelFloor.java @@ -22,6 +22,8 @@ public class QLccModelFloor extends RelationalPathBase { public final StringPath projectUuid = createString("projectUuid"); /** 项目版本 */ public final NumberPath projectVersion = createNumber("projectVersion", Long.class); + /** 环境ID */ + public final NumberPath envId = createNumber("envId", Long.class); /** 楼层编号 */ public final StringPath catalogCode = createString("catalogCode"); /** 楼层数据 */ @@ -66,12 +68,13 @@ public class QLccModelFloor extends RelationalPathBase { addMetadata(id, ColumnMetadata.named("id").withIndex(1).ofType(Types.BIGINT).withSize(19)); addMetadata(projectUuid, ColumnMetadata.named("project_uuid").withIndex(2).ofType(Types.VARCHAR).withSize(36)); addMetadata(projectVersion, ColumnMetadata.named("project_version").withIndex(3).ofType(Types.BIGINT).withSize(19)); - addMetadata(catalogCode, ColumnMetadata.named("catalogCode").withIndex(4).ofType(Types.VARCHAR).withSize(255)); - addMetadata(items, ColumnMetadata.named("items").withIndex(5).ofType(Types.LONGVARCHAR).withSize(16777215)); - addMetadata(autoStart, ColumnMetadata.named("auto_start").withIndex(6).ofType(Types.BIT).withSize(3)); - addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(7).ofType(Types.TIMESTAMP)); - addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(8).ofType(Types.VARCHAR).withSize(255)); - addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(9).ofType(Types.TIMESTAMP)); - addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(10).ofType(Types.VARCHAR).withSize(255)); + addMetadata(envId, ColumnMetadata.named("env_id").withIndex(4).ofType(Types.BIGINT).withSize(19)); + addMetadata(catalogCode, ColumnMetadata.named("catalogCode").withIndex(5).ofType(Types.VARCHAR).withSize(255)); + addMetadata(items, ColumnMetadata.named("items").withIndex(6).ofType(Types.LONGVARCHAR).withSize(16777215)); + addMetadata(autoStart, ColumnMetadata.named("auto_start").withIndex(7).ofType(Types.BIT).withSize(3)); + addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(8).ofType(Types.TIMESTAMP)); + addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(9).ofType(Types.VARCHAR).withSize(255)); + addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(10).ofType(Types.TIMESTAMP)); + addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(11).ofType(Types.VARCHAR).withSize(255)); } } From 0d92fcd3ce9561c070a81ac02b6b26aa30366be4 Mon Sep 17 00:00:00 2001 From: yuliang <398780299@qq.com> Date: Sun, 29 Jun 2025 20:24:38 +0800 Subject: [PATCH 3/6] =?UTF-8?q?cl2=20=E5=9F=BA=E4=BA=8E=E8=AE=BE=E5=A4=87?= =?UTF-8?q?=E7=8A=B6=E6=80=81=E5=92=8C=E4=BB=BB=E5=8A=A1=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E5=88=86=E6=AD=A5=E7=94=9F=E6=88=90=E8=AE=BE=E5=A4=87=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/galaxis/rcs/inv/InvManager.java | 150 +++++++++++++++++++++ .../main/java/com/galaxis/rcs/ptr/PtrAgvItem.java | 22 ++- 2 files changed, 170 insertions(+), 2 deletions(-) diff --git a/servo/src/main/java/com/galaxis/rcs/inv/InvManager.java b/servo/src/main/java/com/galaxis/rcs/inv/InvManager.java index 819f617..ff0d6e9 100644 --- a/servo/src/main/java/com/galaxis/rcs/inv/InvManager.java +++ b/servo/src/main/java/com/galaxis/rcs/inv/InvManager.java @@ -1,4 +1,154 @@ package com.galaxis.rcs.inv; +import com.galaxis.rcs.common.entity.LccInvLpn; +import com.querydsl.core.util.StringUtils; +import org.clever.data.jdbc.DaoFactory; +import org.clever.data.jdbc.QueryDSL; + +import java.sql.Date; + +import static com.galaxis.rcs.common.query.QLccInvLpn.lccInvLpn; +import static com.galaxis.rcs.common.query.QLccInvLedger.lccInvLedger; + public class InvManager { + private static final QueryDSL queryDSL = DaoFactory.getQueryDSL(); + + /** + * 记录库存 + * @param envId 环境ID + * @param lpn 容器号 + * @param locCode 库位号 + * @param layerIndex 堆叠层 + * @param qty 数量 >0 增加数量 <0 减数量 + * @param qtyIn 入库数量 >0 减数量 <0 减数量 + * @param qtyOut 出库数量 >0 减数量 <0 减数量 + */ + public static void invSave(Long envId, String lpn, String locCode, Integer layerIndex, int qty, int qtyIn, int qtyOut) { + if (envId == null || envId <= 0 + || lpn == null || StringUtils.isNullOrEmpty(lpn) || lpn.equals("N/A") + || locCode == null || StringUtils.isNullOrEmpty(locCode) || locCode.equals("N/A") + || layerIndex == null || layerIndex < 0) { + throw new RuntimeException("库存记录时,关键参数值不对"); + } + if (qty == 0 && qtyIn == 0 && qtyOut == 0) { + throw new RuntimeException("库存记录时,变化数量不能都为0"); + } + if (qtyIn != 0 && qtyOut != 0) { + throw new RuntimeException("库存记录时,不能同时为入库和出库"); + } + if (qty > 1 || qty < -1) { + throw new RuntimeException("库存记录时,数量变化值只能为0、1、-1"); + } + if (qtyIn > 1 || qtyIn < -1) { + throw new RuntimeException("库存记录时,预占数量变化值只能为0、1、-1"); + } + if (qtyOut > 1 || qtyOut < -1) { + throw new RuntimeException("库存记录时,预扣数量变化值只能为0、1、-1"); + } + if (qty == 1 && qtyIn == 1) { + throw new RuntimeException("库存记录时,数量增加时不能增加预占数量"); + } + if (qty == -1 && qtyOut == 1) { + throw new RuntimeException("库存记录时,数量扣减时不能对其增加预扣"); + } + + LccInvLpn lccInvLpnData = queryDSL.select(lccInvLpn) + .from(lccInvLpn) + .where(lccInvLpn.envId.eq(envId).and(lccInvLpn.locCode.eq(locCode)).and(lccInvLpn.lpn.eq(lpn))) + .fetchFirst(); + + if (lccInvLpnData != null) { + if ((lccInvLpnData.getQty() == 1 && qtyIn > 0) || (lccInvLpnData.getQty() == 1 && qty > 0)) { + throw new RuntimeException("库存记录时,当前货位有货, 不能放货或者准备放货"); + } else if ((lccInvLpnData.getQty() == 0 && qtyOut > 0) || (lccInvLpnData.getQty() == 0 && qty < 0)) { + throw new RuntimeException("库存记录时,当前货位无货, 不能取货或者准备取货"); + } else if (lccInvLpnData.getQtyIn() > 0 && qtyIn > 0) { + throw new RuntimeException("库存记录时,当前货位有预占, 不能准备放货"); + } else if (lccInvLpnData.getQtyOut() > 0 && qtyOut > 0) { + throw new RuntimeException("库存记录时,当前货位有预扣, 不能准备取货"); + } + } else { + if (qty < 0 || qtyIn < 0 || qtyOut < 0) { + throw new RuntimeException("没有找到原始库存,不能扣减数量"); + } + } + + queryDSL.beginTX(status -> { + if (lccInvLpnData != null) { + queryDSL.update(lccInvLpn) + .set(lccInvLpn.qty, lccInvLpn.qty.add(qty)) + .set(lccInvLpn.qtyIn, lccInvLpn.qtyIn.add(qtyIn)) + .set(lccInvLpn.qtyOut, lccInvLpn.qtyOut.add(qtyOut)) + .set(lccInvLpn.layerIndex, layerIndex) +// .set(lccInvLpn.updateAt, ) + .where(lccInvLpn.envId.eq(envId).and(lccInvLpn.locCode.eq(locCode)).and(lccInvLpn.lpn.eq(lpn))) + .execute(); + } else { + queryDSL.insert(lccInvLpn) + .set(lccInvLpn.envId, envId) + .set(lccInvLpn.lpn, lpn) + .set(lccInvLpn.locCode, locCode) + .set(lccInvLpn.layerIndex, layerIndex) + .set(lccInvLpn.qty, qty) + .set(lccInvLpn.qtyIn, qtyIn) + .set(lccInvLpn.qtyOut, qtyOut) + .execute(); + } + + // 记录账页 + queryDSL.insert(lccInvLedger) + .set(lccInvLedger.envId, envId) + .set(lccInvLedger.lpn, lpn) + .set(lccInvLedger.locCode, locCode) + .set(lccInvLedger.layerIndex, layerIndex) + .set(lccInvLedger.qtyChange, qty) + .set(lccInvLedger.qtyInChange, qtyIn) + .set(lccInvLedger.qtyOutChange, qtyOut) + .set(lccInvLedger.ledgerType, "记账") + .set(lccInvLedger.ledgerRemark, "N/A") + .execute(); + + // 删除所有数量预占预扣都为0的库存 + queryDSL.delete(lccInvLpn).where(lccInvLpn.qty.eq(0).and(lccInvLpn.qtyIn.eq(0)).and(lccInvLpn.qtyOut.eq(0))).execute(); + }); + + } + + + /** + * 记录库存 + * @param envId 环境ID + * @param lpn 容器号 + * @param locCode 库位号 + * @param qty 数量 >0 减数量 <0 减数量 + * @param qtyIn 入库数量 >0 减数量 <0 减数量 + * @param qtyOut 出库数量 >0 减数量 <0 减数量 + */ + public static void invSave(Long envId, String lpn, String locCode, int qty, int qtyIn, int qtyOut) { + invSave(envId, lpn, locCode, 0, qty, qtyIn, qtyOut); + } + + /** + * 保存库存 + * @param envId 环境ID + * @param lpn 容器号 + * @param locCode 库位号 + * @param layerIndex 堆叠层 + * @param qty 数量 >0 减数量 <0 减数量 + */ + public static void invSave(Long envId, String lpn, String locCode, int layerIndex, int qty) { + invSave(envId, lpn, locCode, layerIndex, qty, 0, 0); + } + + /** + * 保存库存 + * @param envId 环境ID + * @param lpn 容器号 + * @param locCode 库位号 + * @param qty 数量 >0 减数量 <0 减数量 + */ + public static void invSave(Long envId, String lpn, String locCode, int qty) { + invSave(envId, lpn, locCode, 0, qty, 0, 0); + } + } diff --git a/servo/src/main/java/com/galaxis/rcs/ptr/PtrAgvItem.java b/servo/src/main/java/com/galaxis/rcs/ptr/PtrAgvItem.java index aa1c4df..bd5d7e7 100644 --- a/servo/src/main/java/com/galaxis/rcs/ptr/PtrAgvItem.java +++ b/servo/src/main/java/com/galaxis/rcs/ptr/PtrAgvItem.java @@ -723,8 +723,21 @@ public abstract class PtrAgvItem extends ExecutorItem { } - if (deviceTaskList.size() <= 0) { - return; + if (deviceTaskList.isEmpty()) { + PtrAgvDeviceTask deviceTask = new PtrAgvDeviceTask(); + deviceTask.x = startPoint.logicX; + deviceTask.y = startPoint.logicY; + deviceTask.speed = speed; + deviceTask.direction = direction; + deviceTask.pickMode = 0; + deviceTask.startPoint = startPoint; + deviceTask.endPoint = startPoint; + deviceTask.planTaskIdSet.addAll(rotationPlanTaskIdSet); + rotationPlanTaskIdSet.clear(); + // 行走任务完成后,检查用的字段 + deviceTask.checkLogicX = startPoint.logicX; + deviceTask.checkLogicY = startPoint.logicY; + deviceTaskList.add(deviceTask); } // 标记任务分组结束 @@ -734,8 +747,13 @@ public abstract class PtrAgvItem extends ExecutorItem { deviceTask.isGroupEnd = true; // 最后一个规划任务为旋转时需要添加一个endDirection if (rotationPlanTaskIdSet.size() > 0) { + deviceTask.operationType = COperationType.move; + deviceTask.pickMode = CPickMode.normal; deviceTask.endDirection = direction; deviceTask.planTaskIdSet.addAll(rotationPlanTaskIdSet); + if (deviceTask.movePlanTaskId == null) { + deviceTask.movePlanTaskId = 0L; + } rotationPlanTaskIdSet.clear(); } From 564356d3dc84b04f9e42dee8d9f8cd57cb41ccd0 Mon Sep 17 00:00:00 2001 From: luoyifan Date: Sun, 29 Jun 2025 21:05:50 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BF=9D=E5=AD=98=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E7=94=9F=E6=88=90=E8=B4=A7=E6=9E=B6=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../galaxis/rcs/common/entity/LccBasLocation.java | 2 + .../galaxis/rcs/common/entity/LccInvLedger.java | 16 +- .../galaxis/rcs/common/query/QLccBasLocation.java | 23 +- .../yvan/workbench/controller/LccModelManager.java | 368 ++++++++++++++++----- .../yvan/workbench/model/entity/LccModelFloor.java | 2 + 5 files changed, 310 insertions(+), 101 deletions(-) diff --git a/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasLocation.java b/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasLocation.java index 000493c..fe6dbd3 100644 --- a/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasLocation.java +++ b/servo/src/main/java/com/galaxis/rcs/common/entity/LccBasLocation.java @@ -19,6 +19,8 @@ public class LccBasLocation implements Serializable { private String wayPoint; /** 货位相对于路径方向 */ private String locDirection; + /** 楼层数据 */ + private String catalogCode; /** 位置编码 */ private String rack; /** 货架列 */ diff --git a/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLedger.java b/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLedger.java index 3a98dbc..fca6c22 100644 --- a/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLedger.java +++ b/servo/src/main/java/com/galaxis/rcs/common/entity/LccInvLedger.java @@ -21,16 +21,12 @@ public class LccInvLedger implements Serializable { private String ledgerRemark; /** 托盘条码 */ private String lpn; - /** 改变前库存位置 */ - private String locCodeBefore; - /** 改变前堆叠层号从0开始 */ - private Integer layerIndexBefore; - /** 改变前库存数量 */ - private Integer qtyBefore; - /** 改变前入库占用数量 */ - private Integer qtyInBefore; - /** 改变前出库占用数量 */ - private Integer qtyOutBefore; + /** 库存改变数量 */ + private Integer qtyChange; + /** 入库占用改变数量 */ + private Integer qtyInChange; + /** 出库占用改变数量 */ + private Integer qtyOutChange; /** 改变后堆叠层号从0开始 */ private Integer layerIndex; /** 改变前库存位置 */ diff --git a/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasLocation.java b/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasLocation.java index b673c9a..c4a5ce3 100644 --- a/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasLocation.java +++ b/servo/src/main/java/com/galaxis/rcs/common/query/QLccBasLocation.java @@ -26,6 +26,8 @@ public class QLccBasLocation extends RelationalPathBase { public final StringPath wayPoint = createString("wayPoint"); /** 货位相对于路径方向 */ public final StringPath locDirection = createString("locDirection"); + /** 楼层数据 */ + public final StringPath catalogCode = createString("catalogCode"); /** 位置编码 */ public final StringPath rack = createString("rack"); /** 货架列 */ @@ -78,15 +80,16 @@ public class QLccBasLocation extends RelationalPathBase { addMetadata(locType, ColumnMetadata.named("loc_type").withIndex(3).ofType(Types.VARCHAR).withSize(20)); addMetadata(wayPoint, ColumnMetadata.named("way_point").withIndex(4).ofType(Types.VARCHAR).withSize(50)); addMetadata(locDirection, ColumnMetadata.named("loc_direction").withIndex(5).ofType(Types.VARCHAR).withSize(10)); - addMetadata(rack, ColumnMetadata.named("rack").withIndex(6).ofType(Types.VARCHAR).withSize(50)); - addMetadata(bay, ColumnMetadata.named("bay").withIndex(7).ofType(Types.INTEGER).withSize(10)); - addMetadata(level, ColumnMetadata.named("level").withIndex(8).ofType(Types.INTEGER).withSize(10)); - addMetadata(cell, ColumnMetadata.named("cell").withIndex(9).ofType(Types.INTEGER).withSize(10)); - addMetadata(isLock, ColumnMetadata.named("is_lock").withIndex(10).ofType(Types.TINYINT).withSize(3)); - addMetadata(isFrozen, ColumnMetadata.named("is_frozen").withIndex(11).ofType(Types.TINYINT).withSize(3)); - addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(12).ofType(Types.TIMESTAMP)); - addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(13).ofType(Types.VARCHAR).withSize(50)); - addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(14).ofType(Types.TIMESTAMP)); - addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(15).ofType(Types.VARCHAR).withSize(50)); + addMetadata(catalogCode, ColumnMetadata.named("catalog_code").withIndex(6).ofType(Types.VARCHAR).withSize(50)); + addMetadata(rack, ColumnMetadata.named("rack").withIndex(7).ofType(Types.VARCHAR).withSize(50)); + addMetadata(bay, ColumnMetadata.named("bay").withIndex(8).ofType(Types.INTEGER).withSize(10)); + addMetadata(level, ColumnMetadata.named("level").withIndex(9).ofType(Types.INTEGER).withSize(10)); + addMetadata(cell, ColumnMetadata.named("cell").withIndex(10).ofType(Types.INTEGER).withSize(10)); + addMetadata(isLock, ColumnMetadata.named("is_lock").withIndex(11).ofType(Types.TINYINT).withSize(3)); + addMetadata(isFrozen, ColumnMetadata.named("is_frozen").withIndex(12).ofType(Types.TINYINT).withSize(3)); + addMetadata(createAt, ColumnMetadata.named("create_at").withIndex(13).ofType(Types.TIMESTAMP)); + addMetadata(createBy, ColumnMetadata.named("create_by").withIndex(14).ofType(Types.VARCHAR).withSize(50)); + addMetadata(updateAt, ColumnMetadata.named("update_at").withIndex(15).ofType(Types.TIMESTAMP)); + addMetadata(updateBy, ColumnMetadata.named("update_by").withIndex(16).ofType(Types.VARCHAR).withSize(50)); } } diff --git a/servo/src/main/java/com/yvan/workbench/controller/LccModelManager.java b/servo/src/main/java/com/yvan/workbench/controller/LccModelManager.java index 6ed4349..3a5c1ab 100644 --- a/servo/src/main/java/com/yvan/workbench/controller/LccModelManager.java +++ b/servo/src/main/java/com/yvan/workbench/controller/LccModelManager.java @@ -1,11 +1,16 @@ package com.yvan.workbench.controller; +import com.galaxis.rcs.common.entity.LccBasLocation; +import com.galaxis.rcs.common.entity.StoreLocation; +import com.galaxis.rcs.ptr.JacksonUtils; import com.yvan.workbench.model.entity.LccModelFloor; import com.yvan.workbench.model.entity.LccModelWorld; import org.apache.commons.lang3.StringUtils; import org.clever.core.Assert; import org.clever.core.Conv; import org.clever.core.id.SnowFlake; +import org.clever.core.json.JsonArrayWrapper; +import org.clever.core.json.JsonWrapper; import org.clever.core.mapper.JacksonMapper; import org.clever.core.model.request.QueryByPage; import org.clever.core.model.request.page.Page; @@ -17,8 +22,12 @@ import org.clever.web.mvc.annotation.RequestBody; import org.clever.web.mvc.annotation.RequestParam; import org.clever.web.mvc.annotation.Transactional; +import java.util.Date; +import java.util.HashMap; +import java.util.List; import java.util.Map; +import static com.galaxis.rcs.common.query.QLccBasLocation.lccBasLocation; import static com.yvan.workbench.model.query.QLccModelFloor.lccModelFloor; import static com.yvan.workbench.model.query.QLccModelWorld.lccModelWorld; @@ -27,60 +36,60 @@ public class LccModelManager { private static String getOtherData(String projectUuid, String projectLabel) { return StringUtils.trim(String.format(""" - { - "project_uuid": "%s", - "project_label": "%s", - "project_version": 0, - "server": "demo", - "Tool": { - "Group": [], - "GlobalVariables": [], - "UserCommand": [], - "Dashboard": [], - "DataTable": [], - "Trigger": [ - { - "name": "OnOpen", - "fn": "" - }, - { - "name": "OnReset", - "fn": "" - }, - { - "name": "OnStart", - "fn": "" - }, - { - "name": "OnStop", - "fn": "" - } - ], - "gridHelper": { - "axesEnabled": true, - "axesSize": 5, - "axesColor": 14540253, - "axesWidth": 2, - "gridEnabled": true, - "gridSize": 1000, - "gridDivisions": 1000, - "gridColor": 14540253, - "gridOpacity": 1, - "backgroundColor": 16119285, - "snapEnabled": true, - "snapDistance": 0.25 - } + { + "project_uuid": "%s", + "project_label": "%s", + "project_version": 0, + "server": "demo", + "Tool": { + "Group": [], + "GlobalVariables": [], + "UserCommand": [], + "Dashboard": [], + "DataTable": [], + "Trigger": [ + { + "name": "OnOpen", + "fn": "" + }, + { + "name": "OnReset", + "fn": "" + }, + { + "name": "OnStart", + "fn": "" }, - "elevator": [], - "wall": [], - "pillar": [] - }""".stripIndent(), projectUuid, projectLabel)); + { + "name": "OnStop", + "fn": "" + } + ], + "gridHelper": { + "axesEnabled": true, + "axesSize": 5, + "axesColor": 14540253, + "axesWidth": 2, + "gridEnabled": true, + "gridSize": 1000, + "gridDivisions": 1000, + "gridColor": 14540253, + "gridOpacity": 1, + "backgroundColor": 16119285, + "snapEnabled": true, + "snapDistance": 0.25 + } + }, + "elevator": [], + "wall": [], + "pillar": [] + }""".stripIndent(), projectUuid, projectLabel)); } public static Page projectList() { return QueryDslUtils.queryByPage( - QUERY_DSL.selectFrom(lccModelWorld), - QueryByPage.getCurrent() + QUERY_DSL.selectFrom(lccModelWorld), + QueryByPage.getCurrent() ); } @@ -89,24 +98,24 @@ public class LccModelManager { Assert.isNotBlank(project.getProjectUuid(), "项目编号必填"); Assert.isNotBlank(project.getProjectLabel(), "项目标题必填"); Assert.isTrue( - QUERY_DSL.selectFrom(lccModelWorld).where(lccModelWorld.projectUuid.eq(project.getProjectUuid())).fetchCount() <= 0, - "项目编号重复" + QUERY_DSL.selectFrom(lccModelWorld).where(lccModelWorld.projectUuid.eq(project.getProjectUuid())).fetchCount() <= 0, + "项目编号重复" ); project.setProjectVersion(1L); project.setId(SnowFlake.SNOW_FLAKE.nextId()); project.setDirectoryData(""" - [ + [ + { + "label": "仓库楼层", + "items": [ { - "label": "仓库楼层", - "items": [ - { - "catalogCode": "f1", - "label": "一楼 (f1)" - } - ] + "catalogCode": "f1", + "label": "一楼 (f1)" } ] - """.stripIndent()); + } + ] + """.stripIndent()); project.setOtherData(getOtherData(project.getProjectUuid(), project.getProjectLabel())); QUERY_DSL.insert(lccModelWorld).populate(project).execute(); return QUERY_DSL.selectFrom(lccModelWorld).where(lccModelWorld.id.eq(project.getId())).fetchOne(); @@ -116,16 +125,16 @@ public class LccModelManager { public static R addOrUpdateWorld(@RequestBody LccModelWorld params) { Assert.isNotBlank(params.getProjectUuid(), "项目编号必填"); long count = QUERY_DSL.selectFrom(lccModelWorld) - .where(lccModelWorld.projectUuid.eq(params.getProjectUuid())) - .where(lccModelWorld.projectVersion.eq(1L)) - .fetchCount(); + .where(lccModelWorld.projectUuid.eq(params.getProjectUuid())) + .where(lccModelWorld.projectVersion.eq(1L)) + .fetchCount(); if (count >= 1) { QUERY_DSL.update(lccModelWorld) - .set(lccModelWorld.otherData, params.getOtherData()) - .set(lccModelWorld.directoryData, params.getDirectoryData()) - .where(lccModelWorld.projectUuid.eq(params.getProjectUuid())) - .where(lccModelWorld.projectVersion.eq(1L)) - .execute(); + .set(lccModelWorld.otherData, params.getOtherData()) + .set(lccModelWorld.directoryData, params.getDirectoryData()) + .where(lccModelWorld.projectUuid.eq(params.getProjectUuid())) + .where(lccModelWorld.projectVersion.eq(1L)) + .execute(); } else { //noinspection unchecked Map map = JacksonMapper.getInstance().fromJson(params.getOtherData(), Map.class); @@ -143,35 +152,232 @@ public class LccModelManager { String catalogCode = Conv.asString(params.get("catalogCode")); String project_uuid = Conv.asString(params.get("project_uuid")); return QUERY_DSL.selectFrom(lccModelFloor) - .where(lccModelFloor.projectUuid.eq(project_uuid)) - .where(lccModelFloor.catalogCode.eq(catalogCode)) - .orderBy(lccModelFloor.projectVersion.desc()) - .fetchFirst(); + .where(lccModelFloor.projectUuid.eq(project_uuid)) + .where(lccModelFloor.catalogCode.eq(catalogCode)) + .orderBy(lccModelFloor.projectVersion.desc()) + .fetchFirst(); } @Transactional public static R addOrUpdateFloor(@RequestBody LccModelFloor params) { Assert.isNotBlank(params.getProjectUuid(), "项目编号必填"); Assert.isNotBlank(params.getCatalogCode(), "楼层编号必填"); + Assert.notNull(params.getEnvId(), "环境编号必填"); Assert.isNotBlank(params.getItems(), "楼层数据必填"); + if (params.getEnvId() == null || params.getEnvId() <= 0) { + throw new RuntimeException("环境编号必填"); + } long count = QUERY_DSL.selectFrom(lccModelFloor) - .where(lccModelFloor.projectUuid.eq(params.getProjectUuid())) - .where(lccModelFloor.projectVersion.eq(1L)) - .where(lccModelFloor.catalogCode.eq(params.getCatalogCode())) - .fetchCount(); + .where(lccModelFloor.projectUuid.eq(params.getProjectUuid())) + .where(lccModelFloor.envId.eq(params.getEnvId())) + .where(lccModelFloor.catalogCode.eq(params.getCatalogCode())) + .fetchCount(); + if (count >= 1) { QUERY_DSL.update(lccModelFloor) - .set(lccModelFloor.items, params.getItems()) - .where(lccModelFloor.projectUuid.eq(params.getProjectUuid())) - .where(lccModelFloor.projectVersion.eq(1L)) - .where(lccModelFloor.catalogCode.eq(params.getCatalogCode())) - .execute(); + .set(lccModelFloor.items, params.getItems()) + .set(lccModelFloor.projectVersion, lccModelFloor.projectVersion.add(1L)) + .where(lccModelFloor.projectUuid.eq(params.getProjectUuid())) + .where(lccModelFloor.envId.eq(params.getEnvId())) + .where(lccModelFloor.catalogCode.eq(params.getCatalogCode())) + .execute(); } else { params.setId(SnowFlake.SNOW_FLAKE.nextId()); params.setProjectVersion(1L); // params.setCreateBy(); QUERY_DSL.insert(lccModelFloor).populate(params).execute(); } + + batchSaveBasLocation(params); + return R.success(); } + + /** + * 保存库存货位数据 + */ + private static void batchSaveBasLocation(LccModelFloor params) { + // 删除旧的楼层数据 + QUERY_DSL.delete(lccBasLocation) + .where(lccBasLocation.envId.eq(params.getEnvId())) + .where(lccBasLocation.catalogCode.eq(params.getCatalogCode())) + .execute(); + + // ================================== 从 params.items 中解析出货位数据 + var items = JacksonUtils.parseList(params.getItems(), HashMap.class); + var storeMap = new HashMap(); + for (Map item : items) { + String type = Conv.asString(item.get("t")); + String id = Conv.asString(item.get("id")); + if ("rack".equals(type)) { + // 循环 bays / levelHeight 生成存储位 + List> bays = (List>) (((Map) item.get("dt")).get("bays")); + int bayIndex = 0; + for (Map bay : bays) { + List levelHeight = (List) bay.get("levelHeight"); + for (int level = 0; level < levelHeight.size(); level++) { + // 生成存储位 + var storeLoc = new StoreLocation(id, bayIndex, level, 0); + LccBasLocation basLocation = new LccBasLocation(); + storeMap.put(storeLoc.toString(), basLocation); + basLocation.setLocCode(storeLoc.toString()); + basLocation.setLocType(type); + basLocation.setWayPoint("N/A"); + basLocation.setLocDirection("N/A"); + basLocation.setRack(id); + basLocation.setBay(bayIndex); + basLocation.setLevel(level); + } + bayIndex++; + } + + } else if ("gstore".equals(type)) { + // 地堆存储位只有一个格子 + var storeLoc = new StoreLocation(id, 0, 0, 0); + LccBasLocation basLocation = new LccBasLocation(); + storeMap.put(storeLoc.toString(), basLocation); + basLocation.setLocCode(storeLoc.toString()); + basLocation.setLocType(type); + basLocation.setWayPoint("N/A"); + basLocation.setLocDirection("N/A"); + basLocation.setRack(id); + basLocation.setBay(0); + basLocation.setLevel(0); + } + } + + // ================================== 从 params.items 中解析出地标连接数据 + for (Map item : items) { + String type = Conv.asString(item.get("t")); + String id = Conv.asString(item.get("id")); + if (!"way".equals(type)) { + continue; + } + + // 解析 linkStore 数据 + List> linkStore = (List>) (((Map) item.get("dt")).get("linkStore")); + if (linkStore != null) { + for (Map link : linkStore) { + String rackId = Conv.asString(link.get("item")); + int bay = Conv.asInteger(link.get("bay")); + int level = Conv.asInteger(link.get("level")); + int cell = Conv.asInteger(link.get("cell")); + String direction = Conv.asString(link.get("direction")); + + // 生成存储位 + var storeLoc = new StoreLocation(rackId, bay, level, cell); + LccBasLocation basLocation = storeMap.get(storeLoc.toString()); + if (basLocation != null) { + basLocation.setWayPoint(id); + basLocation.setLocDirection(direction); + } + } + } + } + + // 全部写进数据库 + var action = QUERY_DSL.insert(lccBasLocation); + for (LccBasLocation basLocation : storeMap.values()) { + basLocation.setEnvId(params.getEnvId()); + basLocation.setCatalogCode(params.getCatalogCode()); + basLocation.setCell(0); + basLocation.setIsLock(0); + basLocation.setIsFrozen(0); + basLocation.setUpdateAt(new Date()); + basLocation.setCreateAt(new Date()); + basLocation.setCreateBy("yvan"); + basLocation.setUpdateBy("yvan"); + action.populate(basLocation).addBatch(); + } + if (action.getBatchCount() > 0) { + action.execute(); + } + + // ================= JSON 结构 + /* +提取货架信息: +1. t=rack 的情况下,读取 bays 数组,并且枚举里面的 levelHeight 数组,按数量生成 loc_code + +{ + "id": "rack1", + "t": "rack", + "v": true, + "dt": { + "bays": [ + { "levelHeight": [ 0.001, 1.21 ], }, + { "levelHeight": [ 0.001, 1.21 ], } + ], + }, +} + +2. t=gstore 的情况下 +{ + "id": "105_105", + "t": "gstore", +} + +提取路标信息 +{ + "id": "1_2", + "t": "way", + "dt": { + "linkStore": [ + { + "item": "rack1", + "bay": 0, "level": 0, "cell": 0, "direction": "up" + }, + { + "item": "rack1", + "bay": 0, "level": 1, "cell": 0, "direction": "up" + } + ] + } +} +{ + "id": "1_2", + "t": "way", + "dt": { + "linkStore": [ + { + "item": "rack1", + "bay": 0, "level": 0, "cell": 0, "direction": "up" + }, + { + "item": "rack1", + "bay": 0, "level": 1, "cell": 0, "direction": "up" + } + ] + } +} +{ + "id": "4_2", + "t": "way", + "dt": { + "linkStore": [ + { + "item": "105_105", + "bay": 0, + "level": 0, + "cell": 0, + "direction": "down" + } + ] + } +} +生成实体 + LccBasLocation basLocation = new LccBasLocation(); + basLocation.setEnvId(params.getEnvId()); + basLocation.setCatalogCode(params.getCatalogCode()); + basLocation.setLocType("t"); + basLocation.setWayPoint("way.id"); + basLocation.setLocDirection("linkStore.direction"); + basLocation.setRack("rack.id"); + basLocation.setBay("rack.id"); + basLocation.setLevel("rack.id"); + basLocation.setCell("rack.id"); + basLocation.setIsLock(0); + basLocation.setIsFrozen(0); + */ + + } } diff --git a/servo/src/main/java/com/yvan/workbench/model/entity/LccModelFloor.java b/servo/src/main/java/com/yvan/workbench/model/entity/LccModelFloor.java index 0903212..715d090 100644 --- a/servo/src/main/java/com/yvan/workbench/model/entity/LccModelFloor.java +++ b/servo/src/main/java/com/yvan/workbench/model/entity/LccModelFloor.java @@ -15,6 +15,8 @@ public class LccModelFloor implements Serializable { private String projectUuid; /** 项目版本 */ private Long projectVersion; + /** 环境ID */ + private Long envId; /** 楼层编号 */ private String catalogCode; /** 楼层数据 */ From 8ff2e4b9924a3c569867cbde5a4cf032e83f8b22 Mon Sep 17 00:00:00 2001 From: luoyifan Date: Mon, 30 Jun 2025 00:14:19 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E4=BB=BF=E7=9C=9F=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/galaxis/rcs/common/enums/BizTaskType.java | 4 +- .../com/galaxis/rcs/common/enums/PlanTaskType.java | 1 - .../yvan/workbench/controller/EnvController.java | 69 ++++++++++++++++++++++ 3 files changed, 72 insertions(+), 2 deletions(-) diff --git a/servo/src/main/java/com/galaxis/rcs/common/enums/BizTaskType.java b/servo/src/main/java/com/galaxis/rcs/common/enums/BizTaskType.java index f4568d1..2da8940 100644 --- a/servo/src/main/java/com/galaxis/rcs/common/enums/BizTaskType.java +++ b/servo/src/main/java/com/galaxis/rcs/common/enums/BizTaskType.java @@ -3,7 +3,9 @@ package com.galaxis.rcs.common.enums; public enum BizTaskType { MOVE, // 移动任务 CHARGE, // 充电任务 - CARRY; // 搬运任务 + CARRY, // 搬运任务 + LOAD, // 装载任务 + UNLOAD; // 卸载任务 public static BizTaskType fromString(String value) { if (value == null) diff --git a/servo/src/main/java/com/galaxis/rcs/common/enums/PlanTaskType.java b/servo/src/main/java/com/galaxis/rcs/common/enums/PlanTaskType.java index 8af44bb..1f17f35 100644 --- a/servo/src/main/java/com/galaxis/rcs/common/enums/PlanTaskType.java +++ b/servo/src/main/java/com/galaxis/rcs/common/enums/PlanTaskType.java @@ -11,5 +11,4 @@ public enum PlanTaskType { UNLOAD, // 装载任务 CHARGE, // 充电任务 FINISH // 完成任务 - } diff --git a/servo/src/main/java/com/yvan/workbench/controller/EnvController.java b/servo/src/main/java/com/yvan/workbench/controller/EnvController.java index b364375..f1ef15d 100644 --- a/servo/src/main/java/com/yvan/workbench/controller/EnvController.java +++ b/servo/src/main/java/com/yvan/workbench/controller/EnvController.java @@ -1,8 +1,10 @@ package com.yvan.workbench.controller; import com.galaxis.rcs.RCSService; +import com.google.common.base.Strings; import com.yvan.workbench.model.entity.Model; import org.clever.core.Conv; +import org.clever.core.model.response.R; import org.clever.data.jdbc.DaoFactory; import org.clever.data.jdbc.QueryDSL; import org.clever.data.jdbc.querydsl.utils.QueryDslUtils; @@ -12,7 +14,11 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import static com.galaxis.rcs.common.query.QLccBasContainer.lccBasContainer; +import static com.galaxis.rcs.common.query.QLccBasExecutor.lccBasExecutor; +import static com.galaxis.rcs.common.query.QLccBasLocation.lccBasLocation; import static com.galaxis.rcs.common.query.QLccEnvInfo.lccEnvInfo; +import static com.galaxis.rcs.common.query.QLccInvLpn.lccInvLpn; public class EnvController { static final QueryDSL queryDSL = DaoFactory.getQueryDSL(); @@ -25,4 +31,67 @@ public class EnvController { return Model.newSuccess(list); } + + public static R getAllInv(@RequestBody Map params) { + String catalogCode = Conv.asString(params.get("catalogCode")); + Long envId = Conv.asLong(params.get("envId")); + + if (Strings.isNullOrEmpty(catalogCode)) { + return R.fail("catalogCode must not be null"); + } + if (envId == null) { + return R.fail("envId must not be null"); + } + + var list = queryDSL.select(QueryDslUtils.linkedMap( + lccBasContainer.containerType, + lccInvLpn.lpn, + lccInvLpn.locCode, + lccBasLocation.rack, + lccBasLocation.bay, + lccBasLocation.level, + lccBasLocation.cell + )) + .from(lccInvLpn) + .innerJoin(lccBasLocation).on( + lccInvLpn.locCode.eq(lccBasLocation.locCode).and( + lccBasLocation.envId.eq(lccBasLocation.envId) + ) + ) + .innerJoin(lccBasContainer).on( + lccInvLpn.lpn.eq(lccInvLpn.lpn).and( + lccBasContainer.envId.eq(lccInvLpn.envId) + ) + ) + .where(lccInvLpn.envId.eq(envId)) + .where(lccBasLocation.catalogCode.eq(catalogCode)) + .fetch(); + + return R.success(list); + } + + public static R getAllExecutor(@RequestBody Map params) { + String catalogCode = Conv.asString(params.get("catalogCode")); + Long envId = Conv.asLong(params.get("envId")); + + if (Strings.isNullOrEmpty(catalogCode)) { + return R.fail("catalogCode must not be null"); + } + if (envId == null) { + return R.fail("envId must not be null"); + } + + var list = queryDSL.select(QueryDslUtils.linkedMap( + lccBasExecutor.executorId, + lccBasExecutor.virtualLocationAt, + lccBasExecutor.virtualExecutorPayload + )) + .from(lccBasExecutor) + .where(lccBasExecutor.envId.eq(envId)) + .where(lccBasExecutor.isActive.eq(true)) + .where(lccBasExecutor.virtualFloorCode.eq(catalogCode)) + .fetch(); + + return R.success(list); + } } From a2a70f271a407461ed2f95ca0a29a80beed97fe2 Mon Sep 17 00:00:00 2001 From: yuliang <398780299@qq.com> Date: Mon, 30 Jun 2025 08:45:49 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E8=AE=B0=E8=B4=A6=E9=A1=B5=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/galaxis/rcs/inv/InvManager.java | 44 +++++++++++++++------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/servo/src/main/java/com/galaxis/rcs/inv/InvManager.java b/servo/src/main/java/com/galaxis/rcs/inv/InvManager.java index ff0d6e9..6d52ec2 100644 --- a/servo/src/main/java/com/galaxis/rcs/inv/InvManager.java +++ b/servo/src/main/java/com/galaxis/rcs/inv/InvManager.java @@ -83,6 +83,21 @@ public class InvManager { // .set(lccInvLpn.updateAt, ) .where(lccInvLpn.envId.eq(envId).and(lccInvLpn.locCode.eq(locCode)).and(lccInvLpn.lpn.eq(lpn))) .execute(); + // 记录账页 + queryDSL.insert(lccInvLedger) + .set(lccInvLedger.envId, envId) + .set(lccInvLedger.lpn, lpn) + .set(lccInvLedger.locCode, locCode) + .set(lccInvLedger.layerIndex, layerIndex) + .set(lccInvLedger.qtyChange, qty) + .set(lccInvLedger.qtyInChange, qtyIn) + .set(lccInvLedger.qtyOutChange, qtyOut) + .set(lccInvLedger.qty, lccInvLpnData.getQty() + qty) + .set(lccInvLedger.qtyIn, lccInvLpnData.getQtyIn() + qtyIn) + .set(lccInvLedger.qtyOut, lccInvLpnData.getQtyOut() + qtyOut) + .set(lccInvLedger.ledgerType, "记账") + .set(lccInvLedger.ledgerRemark, "N/A") + .execute(); } else { queryDSL.insert(lccInvLpn) .set(lccInvLpn.envId, envId) @@ -93,21 +108,22 @@ public class InvManager { .set(lccInvLpn.qtyIn, qtyIn) .set(lccInvLpn.qtyOut, qtyOut) .execute(); + // 记录账页 + queryDSL.insert(lccInvLedger) + .set(lccInvLedger.envId, envId) + .set(lccInvLedger.lpn, lpn) + .set(lccInvLedger.locCode, locCode) + .set(lccInvLedger.layerIndex, layerIndex) + .set(lccInvLedger.qtyChange, qty) + .set(lccInvLedger.qtyInChange, qtyIn) + .set(lccInvLedger.qtyOutChange, qtyOut) + .set(lccInvLedger.qty, qty) + .set(lccInvLedger.qtyIn, qtyIn) + .set(lccInvLedger.qtyOut, qtyOut) + .set(lccInvLedger.ledgerType, "记账") + .set(lccInvLedger.ledgerRemark, "N/A") + .execute(); } - - // 记录账页 - queryDSL.insert(lccInvLedger) - .set(lccInvLedger.envId, envId) - .set(lccInvLedger.lpn, lpn) - .set(lccInvLedger.locCode, locCode) - .set(lccInvLedger.layerIndex, layerIndex) - .set(lccInvLedger.qtyChange, qty) - .set(lccInvLedger.qtyInChange, qtyIn) - .set(lccInvLedger.qtyOutChange, qtyOut) - .set(lccInvLedger.ledgerType, "记账") - .set(lccInvLedger.ledgerRemark, "N/A") - .execute(); - // 删除所有数量预占预扣都为0的库存 queryDSL.delete(lccInvLpn).where(lccInvLpn.qty.eq(0).and(lccInvLpn.qtyIn.eq(0)).and(lccInvLpn.qtyOut.eq(0))).execute(); });