发布采购、拼车、预约及匹配端侧修复至灰度 #26

Merged
admin merged 45 commits from test into main 2026-10-12 10:19:14 +08:00
370 changed files with 22261 additions and 2604 deletions
@@ -56,6 +56,7 @@ public record BusinessFeeSourceChangedV1(
String reviewStatus, String reviewStatus,
String publicationStatus, String publicationStatus,
String sourceStatus, String sourceStatus,
String sourceHash String sourceHash,
WalletSettlementReference walletSettlement
) { ) {
} }
@@ -15,7 +15,9 @@ public record WalletCommandCompletedV1(
BigDecimal amount, BigDecimal amount,
String errorCode, String errorCode,
String errorMessage, String errorMessage,
Instant completedAt Instant completedAt,
String walletHoldId,
String walletLedgerId
) { ) {
public static final int VERSION = 1; public static final int VERSION = 1;
} }
@@ -3,7 +3,13 @@ package com.baiyue.common.event;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.time.Instant; import java.time.Instant;
/** 海外业务向国内 Finance 发起的客户资金冻结、结算或释放指令。 */ /**
* 海外业务向 Finance 发起的客户资金指令。
* FREEZE 的 amount 为预留金额;SETTLE 全额结算;RELEASE 释放原冻结。
* SETTLE_ACTUAL 的 amount 为最终正额 CNY 实扣,原子补差或释放余款,原冻结金额保留。
* 实际零元使用 RELEASE,不发送零元结算。结算和释放按原业务冻结身份关联。
* REFUND 使用独立业务退款号并携带 originalLedgerId,关联原成功消费,不创建充值。
*/
public record WalletCommandRequestedV1( public record WalletCommandRequestedV1(
String operation, String operation,
long customerId, long customerId,
@@ -12,7 +18,8 @@ public record WalletCommandRequestedV1(
BigDecimal amount, BigDecimal amount,
String remark, String remark,
String idempotencyKey, String idempotencyKey,
Instant requestedAt Instant requestedAt,
String originalLedgerId
) { ) {
public static final int VERSION = 1; public static final int VERSION = 1;
} }
@@ -0,0 +1,4 @@
package com.baiyue.common.event;
/** Finance-issued identity of a successful consumption, carried by its immutable fee source. */
public record WalletSettlementReference(String commandEventId, String holdId, String ledgerId) { }
+17 -3
View File
@@ -1,6 +1,20 @@
# 单测试环境数据库空库初始化 # 单测试环境数据库空库初始化
`reset-test-fba-appointments.sql` 仅用于明确授权的 TEST 预约模型重建:删除并按当前基线重建 `ll_inbound_fba_appointment`、`ll_inbound_fba_appointment_item`。它会丢弃旧预约及关联明细,但不修改订单、入仓计划、库存和排车。调用者必须核对测试连接并取得对这两张表的具体重置授权;不得作为自动启动脚本或用于生产。结构必须与匹配的 Lastleg 新版一同发布,失败立即停止,不对旧数据回填。权限从 IAM 种子核对;本文件存在不表示已执行。 `migrations/overseas/baiyue_lastleg/V21__procurement_fee_confirmation_origin.sql` 增加采购费用核定入口,区分业务节点与财务操作,用于独立新增费用、替代核定及其重试权限。同步源基线和海外统一空库基线;不回填测试存量,不表示已执行。
`migrations/overseas/baiyue_lastleg/V20__procurement_exception_control.sql` 增加采购事实更正/阻断说明、异常关闭及逐来源最终去向三表。服务端保持原收货和发运记录,关闭不产生库存、退款或退货运输;需与采购详情聚合和节点阻断校验的匹配版本发布。源基线和海外统一基线同步,本文件存在不表示已执行。
`migrations/overseas/baiyue_lastleg/V19__procurement_fee_correction.sql` 保存费用链修正目标、原汇率及确认前净实扣,并关联逐笔正差额/退款费用。同步进入 Lastleg 源基线与海外统一空库基线,不新增资金账本,不重算或回填旧消费;只有匹配版本能够发送本次费用链请求。本文件存在不代表已执行。
采购实物与运输结构分别见 `migrations/overseas/baiyue_lastleg/V17__procurement_physical_facts.sql` 和 `V18__procurement_transport_facts.sql`:V17 保存分次实收、差异、装箱及两段整批交寄七表;V18 保存面单版本、逐箱贴单、预估核对和一对一换包装四表,并补齐采购附件的 LABEL/PURCHASE/BUDGET/EXCEPTION 分类约束。源基线及海外统一空库基线同步,节点权限统一维护于采购 V5 权限脚本。File 同时发布对应文件类型约束;不补写历史收货、装箱或发运事实,不代表已执行或已验收。
采购购买节点结构使用 `migrations/overseas/baiyue_lastleg/V16__procurement_purchase_facts.sql`,新增单批履约事实、节点幂等审计及预算授权历史三表。独立购买/取消权限使用 `migrations/cn/baiyue_iam/V5__procurement_node_permissions.sql`,源种子为 IAM `procurement-permissions.sql`,同步进入国内统一空库基线;只给现有平台管理员角色默认授权,不新增岗位。上述结构与权限必须随采购节点匹配版本发布,不补造旧订单购买事实,不代表已执行或已验收。
`migrations/overseas/baiyue_lastleg/V15__procurement_fee_versions.sql` 为采购费用增加用途、确认版本、原币汇率、原冻结及实际流水引用,并建立 `ll_procurement_wallet_attempt` 保存每次资金请求及最终结果。零元费用可以落核定事实但不生成资金命令;字段和约束与源基线、海外统一空库基线同步。执行前核对新增列、索引和表均未存在,先发布准备完整匹配版本;不回填旧费用、不释放或重扣测试存量。该脚本仅完成费用结构,后续履约表按相应变更单独核对。
`migrations/overseas/baiyue_lastleg/V14__procurement_wallet_reference.sql` 为采购已实扣费用来源新增 `wallet_settlement` JSON 引用,保存 Finance 原资金命令、冻结及消费流水身份。源基线与海外统一空库基线同步维护;指定测试环境执行前核对列不存在,不回填历史费用,不重新收费。需与 Finance 资金回执、费用关联及 Lastleg 采购生产端的匹配版本一起发布;本文件存在不表示已经执行。
`reset-test-fba-appointments.sql` 仅用于明确授权的 TEST 预约模型重建:删除并按当前基线重建 `ll_inbound_fba_appointment`、`ll_inbound_fba_appointment_item`,并首次创建 `ll_fba_appointment_command` 保存同事务幂等结果与历史。执行任何DROP前必须确认命令表尚不存在;若已存在,先核对上次执行结果,本脚本不清空命令历史、不支持盲目重试。它会丢弃旧预约及关联明细,但不修改订单、入仓计划、库存和排车。调用者必须核对测试连接及两张表的具体重置授权;不得作为自动启动脚本或用于生产。主单区分计划日期/时段、系统单号、外部确认号和确认UTC/IANA时区;明细按稳定货源占用,不再依赖入仓计划明细。结构必须与匹配Lastleg和Admin一同发布,失败立即停止,不回填旧数据。权限从IAM种子核对;文件存在不表示已执行。
`migrations/overseas/baiyue_lastleg/V13__widen_inbound_plan_creation_mode.sql` 仅将 `ll_inbound_plan.creation_mode` 从旧统一基线的 `VARCHAR(16)` 扩至模块基线已有的 `VARCHAR(32)`,容纳实际来货审核写入的 `WAREHOUSE_TRANSFER`(18字符)。保留 `utf8mb4_unicode_ci`、非空及 `AUTO` 默认值;不更新已有计划或状态。执行前核对目标库该列的长度、排序规则、可空性和默认值,已符合最终定义则核对后跳过;执行结果不确定时先只读复查,不盲目重试。统一空库基线同步最终定义,不重放模块历史初始化脚本。 `migrations/overseas/baiyue_lastleg/V13__widen_inbound_plan_creation_mode.sql` 仅将 `ll_inbound_plan.creation_mode` 从旧统一基线的 `VARCHAR(16)` 扩至模块基线已有的 `VARCHAR(32)`,容纳实际来货审核写入的 `WAREHOUSE_TRANSFER`(18字符)。保留 `utf8mb4_unicode_ci`、非空及 `AUTO` 默认值;不更新已有计划或状态。执行前核对目标库该列的长度、排序规则、可空性和默认值,已符合最终定义则核对后跳过;执行结果不确定时先只读复查,不盲目重试。统一空库基线同步最终定义,不重放模块历史初始化脚本。
@@ -15,7 +29,7 @@
| 区域 | 完整入口 | 服务 schema | 表数 | | 区域 | 完整入口 | 服务 schema | 表数 |
|---|---|---|---:| |---|---|---|---:|
| 国内 | `头程数据库统一增量-MySQL8.sql` | `baiyue_auth`、`baiyue_iam`、`baiyue_order`、`baiyue_warehouse`、`baiyue_firstleg`、`baiyue_file`、`baiyue_audit`、`baiyue_finance` | 226 | | 国内 | `头程数据库统一增量-MySQL8.sql` | `baiyue_auth`、`baiyue_iam`、`baiyue_order`、`baiyue_warehouse`、`baiyue_firstleg`、`baiyue_file`、`baiyue_audit`、`baiyue_finance` | 226 |
| 海外 | `海外区域统一增量-MySQL8.sql` | `baiyue_lastleg`、`baiyue_lastlag_warehouse` | 159 | | 海外 | `海外区域统一增量-MySQL8.sql` | `baiyue_lastleg`、`baiyue_lastlag_warehouse` | 181 |
- 所有服务位于同一测试环境;两份文件只分组组织服务 schema,不代表两个部署区域。`baiyue_lastlag_warehouse` 保留当前正式的 `lastlag` 拼写。 - 所有服务位于同一测试环境;两份文件只分组组织服务 schema,不代表两个部署区域。`baiyue_lastlag_warehouse` 保留当前正式的 `lastlag` 拼写。
- 两份文件必须在同一测试数据库实例中完成初始化;业务服务仍只访问本服务 schema,经内部接口访问 IAM/Warehouse。已移除事件桥两个 schema 的创建,不对已有数据库执行 DROP。 - 两份文件必须在同一测试数据库实例中完成初始化;业务服务仍只访问本服务 schema,经内部接口访问 IAM/Warehouse。已移除事件桥两个 schema 的创建,不对已有数据库执行 DROP。
@@ -37,7 +51,7 @@
5. DDL 隐式提交,不可整体回滚。失败后停止并保留错误;经另行授权准备空库后从头执行,不针对半初始化库追加迁移或从失败行续跑。 5. DDL 隐式提交,不可整体回滚。失败后停止并保留错误;经另行授权准备空库后从头执行,不针对半初始化库追加迁移或从失败行续跑。
6. Firstleg 测量项与拆分项互为外键:建空表期间暂设会话 `foreign_key_checks=0`,随后立即恢复 `1`,再插入种子。失败时关闭连接。两边外键完整保留在 CREATE TABLE 内。 6. Firstleg 测量项与拆分项互为外键:建空表期间暂设会话 `foreign_key_checks=0`,随后立即恢复 `1`,再插入种子。失败时关闭连接。两边外键完整保留在 CREATE TABLE 内。
成功时只在最末输出一行 `initialization_status=PASS`,并带 `region=CN/OVERSEAS`、`initialized_tables=226/157`。必须同时确认客户端退出码 0;忽略错误后出现的 PASS 不算成功。 成功时只在最末输出一行 `initialization_status=PASS`,并带 `region=CN/OVERSEAS`、`initialized_tables=226/181`。必须同时确认客户端退出码 0;忽略错误后出现的 PASS 不算成功。
## 平台管理员密码 ## 平台管理员密码
@@ -0,0 +1,28 @@
-- 采购节点动作独立授权;不新建岗位,不以通用编辑权限代替购买与取消。
INSERT INTO iam_permission(id,tenant_id,app_code,permission_type,parent_id,permission_code,permission_name,route_path,http_method,sort_no,status,built_in,deleted)
VALUES
(5117103,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:buy','采购购买及货款核定',NULL,'POST',803,'ACTIVE',1,0),
(5117104,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:cancel','购买前取消采购订单',NULL,'POST',804,'ACTIVE',1,0),
(5117105,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:receive-overseas','采购海外收货',NULL,'POST',805,'ACTIVE',1,0),
(5117106,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:receive-domestic','采购国内收货',NULL,'POST',806,'ACTIVE',1,0),
(5117107,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:pack','采购装箱与确认',NULL,'POST',807,'ACTIVE',1,0),
(5117108,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:manage','采购差异处置与事实更正',NULL,'POST',808,'ACTIVE',1,0),
(5117109,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:label','采购面单维护',NULL,'POST',809,'ACTIVE',1,0),
(5117110,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:charge','采购国内核费',NULL,'POST',810,'ACTIVE',1,0),
(5117111,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:finance-adjust','采购财务调整',NULL,'POST',811,'ACTIVE',1,0),
(5117112,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:estimate','采购预估运费核对',NULL,'POST',812,'ACTIVE',1,0),
(5117113,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:apply-label','采购逐箱贴单',NULL,'POST',813,'ACTIVE',1,0),
(5117114,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:ship-overseas','采购海外整批交寄',NULL,'POST',814,'ACTIVE',1,0),
(5117115,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:ship-customer','采购国内寄客户',NULL,'POST',815,'ACTIVE',1,0)
ON DUPLICATE KEY UPDATE permission_name=VALUES(permission_name),status='ACTIVE',deleted=0;
INSERT IGNORE INTO iam_role_permission(tenant_id,role_id,permission_id,created_at)
SELECT 0,r.id,p.id,NOW(3) FROM iam_role r JOIN iam_permission p
ON p.tenant_id=0 AND p.app_code='PLATFORM' AND p.permission_code IN
('platform:overseas-business:purchase:buy','platform:overseas-business:purchase:cancel',
'platform:overseas-business:purchase:receive-overseas','platform:overseas-business:purchase:receive-domestic',
'platform:overseas-business:purchase:pack','platform:overseas-business:purchase:manage',
'platform:overseas-business:purchase:label','platform:overseas-business:purchase:charge','platform:overseas-business:purchase:finance-adjust',
'platform:overseas-business:purchase:estimate','platform:overseas-business:purchase:apply-label',
'platform:overseas-business:purchase:ship-overseas','platform:overseas-business:purchase:ship-customer')
WHERE r.tenant_id=0 AND r.app_code='PLATFORM' AND UPPER(r.role_code) IN('PLATFORM_ADMIN','PLATFORM_CUSTOM_ADMIN')
AND r.status='ACTIVE' AND r.deleted=0;
@@ -0,0 +1,5 @@
-- 采购实扣费用来源关联;仅补充结构,不回填历史费用,不修改资金或业务记录。
-- 执行前核对指定测试环境、baiyue_lastleg schema 与该列尚不存在。
ALTER TABLE ll_finance_fee_source
ADD COLUMN wallet_settlement JSON NULL COMMENT '已实扣应收的Finance资金命令、冻结和消费流水引用'
AFTER payment_voucher_file_ids;
@@ -0,0 +1,48 @@
-- 采购费用确认版本及资金尝试。仅变更结构,不回填、重扣或清理测试存量。
ALTER TABLE ll_overseas_procurement_fee
ADD COLUMN purpose VARCHAR(32) NULL COMMENT '费用业务用途;由履约节点确定',
ADD COLUMN fee_version INT NULL COMMENT '同用途费用确认版本',
ADD COLUMN active TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否当前有效版本',
ADD COLUMN determination VARCHAR(24) NULL COMMENT 'POSITIVE正额、ZERO零元、NOT_APPLICABLE不适用',
ADD COLUMN original_currency CHAR(3) NULL COMMENT '核定原币CNY或USD',
ADD COLUMN original_amount DECIMAL(20,2) NULL COMMENT '核定原币金额',
ADD COLUMN exchange_rate DECIMAL(20,6) NULL COMMENT '已确认汇率快照',
ADD COLUMN exchange_rate_month CHAR(7) NULL COMMENT '已确认汇率所属月份',
ADD COLUMN business_date DATE NULL COMMENT '实际费用业务日期',
ADD COLUMN wallet_business_id BIGINT NULL COMMENT '资金冻结对应采购费用记录',
ADD COLUMN wallet_business_no VARCHAR(128) NULL COMMENT '资金冻结业务号;实际国际运费引用原预估',
ADD COLUMN wallet_hold_id VARCHAR(64) NULL COMMENT 'Finance冻结引用',
ADD COLUMN wallet_ledger_id VARCHAR(64) NULL COMMENT 'Finance实际处理流水引用',
ADD COLUMN settled_command_event_id VARCHAR(64) NULL COMMENT '成功实扣或退款的资金命令事件',
ADD COLUMN source_fee_id BIGINT NULL COMMENT '已实扣费用来源ID',
ADD COLUMN parent_fee_id BIGINT NULL COMMENT '原费用或预估引用',
ADD COLUMN request_hash CHAR(64) NULL COMMENT '确认请求摘要',
MODIFY COLUMN voucher_file_id BIGINT NULL COMMENT '凭证文件ID;零元可空',
MODIFY COLUMN voucher_file_name VARCHAR(255) NULL COMMENT '凭证文件名;零元可空',
DROP CHECK chk_ll_procurement_fee_amount,
ADD CONSTRAINT chk_ll_procurement_fee_amount CHECK(amount>=0),
ADD UNIQUE KEY uk_ll_procurement_fee_version(order_id,purpose,fee_item_code,fee_version);
CREATE TABLE ll_procurement_wallet_attempt (
id BIGINT NOT NULL COMMENT '请求尝试ID',
order_id BIGINT NOT NULL COMMENT '采购订单ID',
customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
fee_id BIGINT NOT NULL COMMENT '不可变费用版本ID',
attempt_no BIGINT NOT NULL COMMENT '费用版本内请求序号',
operation VARCHAR(32) NOT NULL COMMENT '资金操作:FREEZE冻结、SETTLE结算、SETTLE_ACTUAL实际结算、RELEASE释放、REFUND退款',
business_no VARCHAR(128) NOT NULL COMMENT 'Finance资金业务号',
amount DECIMAL(20,2) NULL COMMENT '请求金额;全额结算或释放可空',
command_event_id VARCHAR(64) NOT NULL COMMENT '资金指令事件唯一引用',
status VARCHAR(16) NOT NULL COMMENT '资金请求结果:PENDING未决、SUCCEEDED成功、FAILED明确失败',
result_hash CHAR(64) NULL COMMENT '原业务回执摘要',
wallet_hold_id VARCHAR(64) NULL COMMENT 'Finance冻结引用',
wallet_ledger_id VARCHAR(64) NULL COMMENT 'Finance处理流水引用',
error_code VARCHAR(64) NULL COMMENT '业务失败码',
error_message VARCHAR(500) NULL COMMENT '内部失败诊断,不直接对客展示',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '请求时间',
completed_at DATETIME(3) NULL COMMENT '最终结果时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_attempt_event(command_event_id),
UNIQUE KEY uk_procurement_attempt_number(fee_id,attempt_no),
KEY idx_procurement_attempt_order(customer_id,order_id,status),
CONSTRAINT chk_procurement_attempt_status CHECK(status IN('PENDING','SUCCEEDED','FAILED'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购费用资金命令尝试与不可变结果';
@@ -0,0 +1,57 @@
-- 采购节点事实与操作幂等;不补写历史订单的购买、授权或收货事实。
CREATE TABLE ll_procurement_flow (
order_id BIGINT NOT NULL COMMENT '采购订单ID,一单一个履约批次',
customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
purchased_at DATETIME(3) NULL COMMENT '真实购买时间',
purchased_product_name VARCHAR(255) NULL COMMENT '实际购买商品',
purchased_specification VARCHAR(500) NULL COMMENT '实际购买规格',
purchased_quantity BIGINT NULL COMMENT '实际购买件数',
purchase_amount DECIMAL(20,2) NULL COMMENT '供应商实付原币金额',
purchase_currency CHAR(3) NULL COMMENT '供应商实付原币CNY或USD',
purchase_voucher_id BIGINT NULL COMMENT '购买凭证引用',
purchase_issue VARCHAR(500) NULL COMMENT '购买未核定或异常说明',
purchase_confirmed_at DATETIME(3) NULL COMMENT '货款核定时间,不代表扣费成功',
actual_warehouse_id BIGINT NULL COMMENT '首次实际收货冻结的仓库ID',
actual_warehouse_code VARCHAR(128) NULL COMMENT '实际收货仓编码快照',
actual_warehouse_name VARCHAR(255) NULL COMMENT '实际收货仓名称快照',
overseas_received_at DATETIME(3) NULL COMMENT '海外整批收货完成时间',
packing_version INT NULL COMMENT '当前确认装箱清单版本',
overseas_shipped_at DATETIME(3) NULL COMMENT '国际段整批实际交寄时间',
domestic_received_at DATETIME(3) NULL COMMENT '国内整批收货完成时间',
charges_confirmed_at DATETIME(3) NULL COMMENT '国内整单费用核定时间',
customer_shipped_at DATETIME(3) NULL COMMENT '国内寄客户实际交寄时间',
domestic_receiver_name VARCHAR(128) NULL COMMENT '国际段国内收件人',
domestic_receiver_phone VARCHAR(64) NULL COMMENT '国际段国内收件电话',
domestic_receiver_address VARCHAR(1000) NULL COMMENT '国际段国内接收地址',
cancelled_at DATETIME(3) NULL COMMENT '购买前取消时间',
closed_at DATETIME(3) NULL COMMENT '异常关闭时间',
control_reason VARCHAR(1000) NULL COMMENT '取消或关闭原因',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
PRIMARY KEY(order_id), KEY idx_procurement_flow_customer(customer_id,order_id),
CONSTRAINT chk_procurement_purchase_quantity CHECK(purchased_quantity IS NULL OR purchased_quantity>0),
CONSTRAINT chk_procurement_purchase_amount CHECK(purchase_amount IS NULL OR purchase_amount>=0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购单一批次履约事实';
CREATE TABLE ll_procurement_command (
id BIGINT NOT NULL COMMENT '操作记录ID', order_id BIGINT NOT NULL COMMENT '采购订单ID',
customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键', action VARCHAR(48) NOT NULL COMMENT '采购节点动作',
idempotency_key VARCHAR(128) NOT NULL COMMENT '操作幂等键', request_hash CHAR(64) NOT NULL COMMENT '请求摘要',
operator_id VARCHAR(128) NOT NULL COMMENT '执行人', reason VARCHAR(1000) NOT NULL COMMENT '操作依据',
detail_json JSON NOT NULL COMMENT '内部操作及更正依据快照,不直接对客展示',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '执行时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_command(order_id,action,idempotency_key),
KEY idx_procurement_command_customer(customer_id,order_id,created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购节点幂等与不可变审计';
CREATE TABLE ll_procurement_budget_authorization (
id BIGINT NOT NULL COMMENT '预算授权ID', order_id BIGINT NOT NULL COMMENT '采购订单ID',
customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
previous_amount DECIMAL(20,2) NULL COMMENT '原货款预算总上限;未授权保持空', previous_currency CHAR(3) NOT NULL COMMENT '原预算币种',
authorized_amount DECIMAL(20,2) NOT NULL COMMENT '客户授权的新货款总上限', currency CHAR(3) NOT NULL COMMENT '客户授权币种',
voucher_file_id BIGINT NOT NULL COMMENT '客户确认书面或聊天凭证', reason VARCHAR(1000) NOT NULL COMMENT '授权依据',
reviewed_by VARCHAR(128) NOT NULL COMMENT '核验人员', reviewed_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '核验时间',
PRIMARY KEY(id), KEY idx_procurement_budget_order(customer_id,order_id,id),
CONSTRAINT chk_procurement_budget_amount CHECK(authorized_amount>=0 AND previous_amount>=0),
CONSTRAINT chk_procurement_budget_currency CHECK(currency IN('CNY','USD') AND previous_currency IN('CNY','USD'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购货款预算授权核验历史';
@@ -0,0 +1,65 @@
-- 采购实收、差异、装箱和两段整批发运事实。不产生WMS库存流水,不回填历史采购数量。
CREATE TABLE ll_procurement_receipt (
id BIGINT NOT NULL COMMENT '实收明细ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
receipt_no VARCHAR(64) NOT NULL COMMENT '采购收货业务编号', leg VARCHAR(16) NOT NULL COMMENT 'OVERSEAS海外或DOMESTIC国内',
source_carton_id BIGINT NULL COMMENT '国内实收关联原国际交寄箱,海外为空', warehouse_id BIGINT NULL COMMENT '海外实际收货仓',
good_quantity BIGINT NOT NULL COMMENT '可发合格件数', damaged_quantity BIGINT NOT NULL COMMENT '破损待处置件数', extra_quantity BIGINT NOT NULL COMMENT '多到件数,不增加可发数量',
received_at DATETIME(3) NOT NULL COMMENT '实际收货时间', active TINYINT(1) NOT NULL DEFAULT 1 COMMENT '当前有效实收事实',
supersedes_id BIGINT NULL COMMENT '受控更正所替代的原实收记录', created_by VARCHAR(128) NOT NULL COMMENT '登记人员',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '登记时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_receipt_no(receipt_no), KEY idx_procurement_receipt_source(order_id,leg,source_carton_id,active),
CONSTRAINT chk_procurement_receipt_quantity CHECK(good_quantity>=0 AND damaged_quantity>=0 AND extra_quantity>=0 AND good_quantity+damaged_quantity+extra_quantity>0),
CONSTRAINT chk_procurement_receipt_leg CHECK((leg='OVERSEAS' AND source_carton_id IS NULL) OR (leg='DOMESTIC' AND source_carton_id IS NOT NULL))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购分次实收与受控更正事实';
CREATE TABLE ll_procurement_disposition (
id BIGINT NOT NULL COMMENT '差异处理ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
leg VARCHAR(16) NOT NULL COMMENT 'OVERSEAS海外或DOMESTIC国内', source_carton_id BIGINT NULL COMMENT '国内原交寄箱来源',
receipt_id BIGINT NULL COMMENT '破损或多货对应实收记录,短少为空', kind VARCHAR(24) NOT NULL COMMENT 'SHORTAGE短少、DAMAGED破损、EXTRA多货',
quantity BIGINT NOT NULL COMMENT '已批准处置件数', decision VARCHAR(32) NOT NULL COMMENT 'ACCEPT_SHORTAGE确认短少、DISPOSE_DAMAGED拒收或处置、RETURN_EXTRA退回多货',
active TINYINT(1) NOT NULL DEFAULT 1 COMMENT '当前有效处置;撤销只改变有效性并保留原事实',
voucher_file_id BIGINT NOT NULL COMMENT '本单客户确认或实际处置凭证', reason VARCHAR(1000) NOT NULL COMMENT '处置依据',
created_by VARCHAR(128) NOT NULL COMMENT '采购管理人员', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '确认时间',
PRIMARY KEY(id), KEY idx_procurement_disposition_source(order_id,leg,source_carton_id,receipt_id,kind),
CONSTRAINT chk_procurement_disposition_quantity CHECK(quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购单内差异处置,不自动退款';
CREATE TABLE ll_procurement_manifest (
id BIGINT NOT NULL COMMENT '装箱清单ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
version INT NOT NULL COMMENT '订单内装箱版本', status VARCHAR(16) NOT NULL COMMENT 'DRAFT草稿、CONFIRMED已确认、SUPERSEDED已替代',
confirmed_at DATETIME(3) NULL COMMENT '确认时间', created_by VARCHAR(128) NOT NULL COMMENT '制单人',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '版本保存时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_manifest_version(order_id,version),
CONSTRAINT chk_procurement_manifest_status CHECK(status IN('DRAFT','CONFIRMED','SUPERSEDED'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购装箱清单不可变版本';
CREATE TABLE ll_procurement_carton (
id BIGINT NOT NULL COMMENT '版本内箱记录ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', manifest_id BIGINT NOT NULL COMMENT '装箱清单版本',
carton_no VARCHAR(64) NOT NULL COMMENT '采购订单内业务箱号', length_cm DECIMAL(12,2) NOT NULL COMMENT '外箱长厘米',
width_cm DECIMAL(12,2) NOT NULL COMMENT '外箱宽厘米', height_cm DECIMAL(12,2) NOT NULL COMMENT '外箱高厘米',
gross_weight_kg DECIMAL(12,3) NOT NULL COMMENT '封箱毛重千克', quantity BIGINT NOT NULL COMMENT '本箱合格商品总件数',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_carton_version(manifest_id,carton_no), KEY idx_procurement_carton_order(order_id,manifest_id),
CONSTRAINT chk_procurement_carton_measurement CHECK(length_cm>0 AND width_cm>0 AND height_cm>0 AND gross_weight_kg>0 AND quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购版本化逐箱实测与件数';
CREATE TABLE ll_procurement_carton_source (
carton_id BIGINT NOT NULL COMMENT '版本内箱ID', receipt_id BIGINT NOT NULL COMMENT '海外实收明细来源', quantity BIGINT NOT NULL COMMENT '从该实收装入本箱的件数',
PRIMARY KEY(carton_id,receipt_id), KEY idx_procurement_carton_receipt(receipt_id), CONSTRAINT chk_procurement_carton_source_quantity CHECK(quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购箱内货物的实收来源与数量';
CREATE TABLE ll_procurement_shipment (
id BIGINT NOT NULL COMMENT '采购交寄ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
shipment_no VARCHAR(64) NOT NULL COMMENT '交寄业务编号', leg VARCHAR(16) NOT NULL COMMENT 'OVERSEAS国际交寄或DOMESTIC寄客户',
manifest_id BIGINT NOT NULL COMMENT '原海外装箱清单版本', shipped_at DATETIME(3) NOT NULL COMMENT '整批真实交承运方时间',
address_snapshot JSON NOT NULL COMMENT '本段交寄时的收寄姓名电话地址快照', created_by VARCHAR(128) NOT NULL COMMENT '交寄确认人',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '确认时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_shipment_leg(order_id,leg), UNIQUE KEY uk_procurement_shipment_no(shipment_no),
CONSTRAINT chk_procurement_shipment_leg CHECK(leg IN('OVERSEAS','DOMESTIC'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购两段各一次整批真实交寄';
CREATE TABLE ll_procurement_shipment_item (
shipment_id BIGINT NOT NULL COMMENT '采购交寄ID', carton_id BIGINT NOT NULL COMMENT '原海外装箱版本内箱ID', quantity BIGINT NOT NULL COMMENT '本次实际交寄件数',
carrier VARCHAR(128) NOT NULL COMMENT '承运商快照', tracking_no VARCHAR(128) NOT NULL COMMENT '运单号快照',
label_snapshot JSON NOT NULL COMMENT '当次箱规、面单及货物来源快照',
PRIMARY KEY(shipment_id,carton_id), CONSTRAINT chk_procurement_shipment_item_quantity CHECK(quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购整批交寄逐箱事实';
@@ -0,0 +1,40 @@
-- 采购面单、逐箱贴单、预估核对与国内一对一换包装;不重建历史发运事实。
CREATE TABLE ll_procurement_label_set (
id BIGINT NOT NULL COMMENT '面单批版本ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
leg VARCHAR(16) NOT NULL COMMENT 'OVERSEAS国际段或DOMESTIC寄客户段', version INT NOT NULL COMMENT '订单段内面单版本',
manifest_id BIGINT NOT NULL COMMENT '原海外确认装箱版本', cargo_hash CHAR(64) NOT NULL COMMENT '箱规及有效货物来源摘要',
sender_snapshot JSON NOT NULL COMMENT '寄件人姓名电话地址快照', receiver_snapshot JSON NOT NULL COMMENT '收件人姓名电话地址快照',
created_by VARCHAR(128) NOT NULL COMMENT '制单操作人', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '上传确认时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_label_version(order_id,leg,version),
CONSTRAINT chk_procurement_label_leg CHECK(leg IN('OVERSEAS','DOMESTIC'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购两段面单不可变版本和地址快照';
CREATE TABLE ll_procurement_label_item (
label_set_id BIGINT NOT NULL COMMENT '面单批版本ID', carton_id BIGINT NOT NULL COMMENT '原海外清单箱ID',
file_id BIGINT NOT NULL COMMENT '本采购订单面单文件', page_no INT NOT NULL COMMENT '该箱对应文件页码,从1开始',
carrier VARCHAR(128) NOT NULL COMMENT '承运商', tracking_no VARCHAR(128) NOT NULL COMMENT '箱主或子运单号',
applied_at DATETIME(3) NULL COMMENT '真实贴单时间', applied_by VARCHAR(128) NULL COMMENT '贴单确认人',
PRIMARY KEY(label_set_id,carton_id), CONSTRAINT chk_procurement_label_page CHECK(page_no>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购逐箱文件页关联及贴单事实';
CREATE TABLE ll_procurement_estimate_review (
id BIGINT NOT NULL COMMENT '预估核对ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', label_set_id BIGINT NOT NULL COMMENT '已核对国际面单版本',
fee_id BIGINT NOT NULL COMMENT '唯一有效预估费用版本', reviewed_by VARCHAR(128) NOT NULL COMMENT '核价人员',
reviewed_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '核对时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_estimate_review(label_set_id,fee_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='面单清单与预估冻结的显式核对关联';
CREATE TABLE ll_procurement_repack (
id BIGINT NOT NULL COMMENT '换包装版本ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', carton_id BIGINT NOT NULL COMMENT '原国际交寄箱ID,保持一对一来源',
length_cm DECIMAL(12,2) NOT NULL COMMENT '新外箱长厘米', width_cm DECIMAL(12,2) NOT NULL COMMENT '新外箱宽厘米',
height_cm DECIMAL(12,2) NOT NULL COMMENT '新外箱高厘米', gross_weight_kg DECIMAL(12,3) NOT NULL COMMENT '新封箱毛重千克',
voucher_file_id BIGINT NOT NULL COMMENT '本单换包装证据', reason VARCHAR(1000) NOT NULL COMMENT '换包装依据',
created_by VARCHAR(128) NOT NULL COMMENT '国内作业人员', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '登记时间',
PRIMARY KEY(id), KEY idx_procurement_repack_carton(order_id,carton_id,id),
CONSTRAINT chk_procurement_repack_measurement CHECK(length_cm>0 AND width_cm>0 AND height_cm>0 AND gross_weight_kg>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购国内原箱一对一换包装不可变历史';
ALTER TABLE ll_overseas_procurement_file
DROP CHECK chk_ll_procurement_file_category,
MODIFY COLUMN category VARCHAR(16) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'RECEIPT实收、VOUCHER费用、LABEL面单、PURCHASE采购、BUDGET预算、EXCEPTION异常凭证',
ADD CONSTRAINT chk_ll_procurement_file_category CHECK(category IN ('RECEIPT','VOUCHER','LABEL','PURCHASE','BUDGET','EXCEPTION'));
@@ -0,0 +1,20 @@
-- 费用链目标更正快照与关联;资金流水仍唯一归Finance,不回填旧费用。
CREATE TABLE ll_procurement_fee_correction (
id BIGINT NOT NULL COMMENT '费用链更正ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
correction_no VARCHAR(64) NOT NULL COMMENT '财务更正业务号', root_fee_id BIGINT NOT NULL COMMENT '原实际费用链根',
idempotency_key VARCHAR(128) NOT NULL COMMENT '本单更正请求幂等键', request_hash CHAR(64) NOT NULL COMMENT '更正目标及凭证请求摘要',
target_original_amount DECIMAL(20,2) NOT NULL COMMENT '本次正确原币总额', original_currency CHAR(3) NOT NULL COMMENT '沿用原费用币种',
exchange_rate DECIMAL(20,6) NOT NULL COMMENT '沿用原费用汇率快照', exchange_rate_month CHAR(7) NOT NULL COMMENT '原汇率月份,不取本次操作月份',
target_amount DECIMAL(20,2) NOT NULL COMMENT '正确总额折算CNY', previous_net_amount DECIMAL(20,2) NOT NULL COMMENT '确认前整链净实扣CNY',
difference_amount DECIMAL(20,2) NOT NULL COMMENT 'CNY正差额追加、负差额退款、零差额仅留核对记录',
voucher_file_id BIGINT NOT NULL COMMENT '本订单财务更正凭证', reason VARCHAR(500) NOT NULL COMMENT '更正依据',
created_by VARCHAR(128) NOT NULL COMMENT '授权财务操作人', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '确认时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_correction_no(correction_no), UNIQUE KEY uk_procurement_correction_request(order_id,idempotency_key),
KEY idx_procurement_correction_root(order_id,root_fee_id,id),
CONSTRAINT chk_procurement_correction_amount CHECK(target_original_amount>=0 AND target_amount>=0 AND previous_net_amount>=0 AND exchange_rate>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购费用链更正目标与原汇率快照';
CREATE TABLE ll_procurement_fee_correction_item (
correction_id BIGINT NOT NULL COMMENT '本次费用链更正ID', fee_id BIGINT NOT NULL COMMENT '本次产生的独立正差额或退款费用ID',
PRIMARY KEY(correction_id,fee_id), UNIQUE KEY uk_procurement_correction_fee(fee_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购费用目标更正与逐笔资金事实关联';
@@ -0,0 +1,31 @@
-- 单采购订单内的更正说明、阻断异常与关闭证据。不生成WMS库存或退货运输任务。
CREATE TABLE ll_procurement_control_note (
id BIGINT NOT NULL COMMENT '采购更正说明ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
note_no VARCHAR(64) NOT NULL COMMENT '更正说明业务号', target_type VARCHAR(24) NOT NULL COMMENT '购买、仓库、实收或交寄事实类型',
target_id BIGINT NULL COMMENT '本单事实对象引用,购买为空', blocking TINYINT(1) NOT NULL COMMENT '是否阻断后续计划履约',
voucher_file_id BIGINT NOT NULL COMMENT '本单内部事实更正凭证', reason VARCHAR(1000) NOT NULL COMMENT '内部更正说明',
client_summary VARCHAR(500) NULL COMMENT '人工确认的对客摘要,不复制内部原始内容',
original_value_json JSON NULL COMMENT '服务端记录的原事实快照', corrected_value_json JSON NULL COMMENT '服务端记录的更正事实快照',
created_by VARCHAR(128) NOT NULL COMMENT '采购管理操作人', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '登记时间',
resolved_by VARCHAR(128) NULL COMMENT '处理确认人', resolved_at DATETIME(3) NULL COMMENT '阻断解除时间',
resolution_reason VARCHAR(1000) NULL COMMENT '内部处理结果', resolution_voucher_id BIGINT NULL COMMENT '本单处理凭证',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_note_no(note_no), KEY idx_procurement_note_block(order_id,blocking,resolved_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购不可覆盖事实的更正说明及阻断异常';
CREATE TABLE ll_procurement_closure (
id BIGINT NOT NULL COMMENT '采购异常关闭ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
closure_no VARCHAR(64) NOT NULL COMMENT '异常关闭业务号', customer_voucher_file_id BIGINT NOT NULL COMMENT '客户同意停止履约凭证',
financial_conclusion VARCHAR(1000) NOT NULL COMMENT '已知费用及后续无需收费的处理结论,不改变资金事实',
reason VARCHAR(1000) NOT NULL COMMENT '内部关闭原因', client_summary VARCHAR(500) NOT NULL COMMENT '人工确认的对客关闭摘要',
created_by VARCHAR(128) NOT NULL COMMENT '采购管理确认人', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '关闭确认时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_closure_order(order_id), UNIQUE KEY uk_procurement_closure_no(closure_no)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购实物资金收口后的异常关闭事实';
CREATE TABLE ll_procurement_closure_item (
id BIGINT NOT NULL COMMENT '关闭货物处置ID', closure_id BIGINT NOT NULL COMMENT '采购关闭ID',
source_kind VARCHAR(32) NOT NULL COMMENT '购买未达、在途未达、合格、破损或多货来源', source_id BIGINT NULL COMMENT '原实收或国际交寄箱,购买未达为空',
quantity BIGINT NOT NULL COMMENT '本来源最终明确去向件数', decision VARCHAR(40) NOT NULL COMMENT '供应商保管、退还、报失、客户授权保管或处置',
destination VARCHAR(500) NOT NULL COMMENT '实际去向及接收方说明', voucher_file_id BIGINT NOT NULL COMMENT '本单实物处置证明',
PRIMARY KEY(id), KEY idx_procurement_closure_source(closure_id,source_kind,source_id),
CONSTRAINT chk_procurement_closure_quantity CHECK(quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='异常关闭逐来源剩余货物最终去向,不产生新发运';
@@ -0,0 +1,4 @@
-- 采购费用核定入口。仅结构变更,不回填旧财务事实,不重试或补扣测试存量。
ALTER TABLE ll_overseas_procurement_fee
ADD COLUMN confirmation_origin VARCHAR(16) NOT NULL DEFAULT 'BUSINESS' COMMENT '核定入口:BUSINESS业务节点、FINANCIAL财务操作',
ADD CONSTRAINT chk_procurement_confirmation_origin CHECK(confirmation_origin IN('BUSINESS','FINANCIAL'));
+56 -28
View File
@@ -1,4 +1,6 @@
-- TEST ONLY. Destructive reset of the two disposable appointment tables. -- TEST ONLY. Rebuild the explicitly authorized appointment header and item tables.
-- The new command-history table MUST NOT already exist; check this before executing any DROP.
-- If it exists, stop and inspect the prior outcome. Do not clear command history or blindly retry.
-- Requires explicit approval; never run against production or as automatic startup SQL. -- Requires explicit approval; never run against production or as automatic startup SQL.
-- Caller must verify the TEST connection before executing. -- Caller must verify the TEST connection before executing.
USE baiyue_lastleg; USE baiyue_lastleg;
@@ -6,36 +8,62 @@ DROP TABLE ll_inbound_fba_appointment_item;
DROP TABLE ll_inbound_fba_appointment; DROP TABLE ll_inbound_fba_appointment;
CREATE TABLE ll_inbound_fba_appointment ( CREATE TABLE ll_inbound_fba_appointment (
id BIGINT NOT NULL COMMENT '主键ID', id BIGINT NOT NULL COMMENT '主键ID',
appointment_no VARCHAR(64) NOT NULL COMMENT '预约单号', appointment_no VARCHAR(64) NOT NULL COMMENT '系统预约业务单号,不是外部约号',
appointment_at DATETIME(3) NOT NULL COMMENT '预约时间', confirmation_no VARCHAR(128) NULL COMMENT '收货方正式外部确认号',
appointment_end_at DATETIME(3) NULL COMMENT '预约结束时间,未明确时为空', planned_date DATE NULL COMMENT '计划当地日期,可只有日期而无时段',
planned_at DATETIME(3) NULL COMMENT '计划开始当地时间,待定可空',
planned_end_at DATETIME(3) NULL COMMENT '计划结束当地时间',
appointment_at DATETIME(3) NULL COMMENT '对方确认开始当地时间',
appointment_end_at DATETIME(3) NULL COMMENT '对方确认结束当地时间',
appointment_start_utc DATETIME(3) NULL COMMENT '确认开始UTC时间点',
appointment_end_utc DATETIME(3) NULL COMMENT '确认结束UTC时间点',
timezone VARCHAR(64) NULL COMMENT '目的仓权威IANA时区,未维护不得确认',
origin_warehouse_id VARCHAR(64) NOT NULL COMMENT '实际起运仓',
version INT NOT NULL DEFAULT 0 COMMENT '并发版本', version INT NOT NULL DEFAULT 0 COMMENT '并发版本',
expected_loading_at DATETIME(3) NOT NULL COMMENT '预计装车时间', appointment_status VARCHAR(32) NOT NULL DEFAULT 'PENDING' COMMENT 'PENDING安排/SUCCESS对方确认/FAILED/CANCELLED',
appointment_status VARCHAR(32) NOT NULL DEFAULT 'PENDING' COMMENT '预约状态', appointment_remark VARCHAR(1000) NULL COMMENT '备注或取消原因',
appointment_remark VARCHAR(1000) NULL COMMENT '预约备注', fba_warehouse_code VARCHAR(128) NOT NULL COMMENT 'FBA目的仓编码',
fba_warehouse_code VARCHAR(128) NOT NULL COMMENT 'FBA仓库编码', selected_count INT NOT NULL DEFAULT 0 COMMENT '真实货源票数',
selected_count INT NOT NULL DEFAULT 0 COMMENT '已选明细数量', created_by VARCHAR(128) NOT NULL COMMENT '登录操作人',
created_by VARCHAR(128) NULL COMMENT '创建人ID', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建UTC时间',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间', updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '更新UTC时间',
updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE KEY uk_ll_fba_appointment_no (appointment_no), UNIQUE KEY uk_ll_fba_appointment_no (appointment_no),
KEY idx_ll_fba_appointment_list (appointment_at, appointment_status, fba_warehouse_code) UNIQUE KEY uk_ll_fba_external_confirmation (fba_warehouse_code,confirmation_no),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='FBA入仓预约单'; KEY idx_ll_fba_appointment_list (appointment_at,appointment_status,fba_warehouse_code),
KEY idx_ll_fba_appointment_planned (planned_at,appointment_status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='FBA预约安排与正式确认唯一主记录';
CREATE TABLE ll_inbound_fba_appointment_item ( CREATE TABLE ll_inbound_fba_appointment_item (
id BIGINT NOT NULL COMMENT '主键ID', id BIGINT NOT NULL COMMENT '记录主键',
appointment_id BIGINT NOT NULL COMMENT '预约单ID', appointment_id BIGINT NOT NULL COMMENT '预约主记录标识',
customer_id VARCHAR(128) NOT NULL COMMENT '本票货物客户ID', source_key VARCHAR(160) NOT NULL COMMENT '稳定ORDER或BOOKING货源键',
plan_id BIGINT NOT NULL COMMENT '入仓计划ID', source_version VARCHAR(160) NULL COMMENT '保存时核实的来源版本',
line_id BIGINT NOT NULL COMMENT '入仓计划明细ID', customer_id VARCHAR(128) NOT NULL COMMENT '本票所属客户',
order_id BIGINT NOT NULL COMMENT '订单ID', order_id BIGINT NULL COMMENT '尚未形成尾程订单时为空',
inbound_code VARCHAR(128) NOT NULL COMMENT '入仓单号快照', inbound_code VARCHAR(128) NULL COMMENT '真实入仓码,不伪造',
fba_warehouse_code VARCHAR(128) NOT NULL COMMENT 'FBA仓库编码', fba_warehouse_code VARCHAR(128) NOT NULL COMMENT '目的FBA仓编码',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间', package_count INT NULL COMMENT '所选整票预报箱数,未知保持空',
active TINYINT(1) NOT NULL DEFAULT 1 COMMENT '取消或失败后释放货源占用',
active_source_key VARCHAR(160) GENERATED ALWAYS AS (CASE WHEN active=1 THEN source_key ELSE NULL END) STORED COMMENT '有效货源唯一占用键',
active_order_id BIGINT GENERATED ALWAYS AS (CASE WHEN active=1 THEN order_id ELSE NULL END) STORED COMMENT '有效订单唯一占用键',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建UTC时间',
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE KEY uk_ll_fba_appointment_item_line (appointment_id, line_id), UNIQUE KEY uk_ll_fba_item_source (appointment_id,source_key),
KEY idx_ll_fba_appointment_item_cargo (line_id,appointment_id), UNIQUE KEY uk_ll_fba_active_source (active_source_key),
KEY idx_ll_fba_appointment_item_plan (plan_id), UNIQUE KEY uk_ll_fba_active_order (active_order_id),
KEY idx_ll_fba_appointment_item_order (order_id) KEY idx_ll_fba_item_source_lookup (source_key,customer_id),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='FBA入仓预约明细'; KEY idx_ll_fba_item_customer_order (customer_id,order_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='入仓前后共用的预约真实货源';
CREATE TABLE ll_fba_appointment_command (
command_key VARCHAR(128) NOT NULL COMMENT '持久化幂等键',
request_hash CHAR(64) NOT NULL COMMENT '操作、操作者和请求摘要',
operation VARCHAR(96) NOT NULL COMMENT '操作类型及目标业务号',
operator_id VARCHAR(128) NOT NULL COMMENT '登录操作人',
appointment_no VARCHAR(64) NULL COMMENT '系统预约业务单号',
response_json LONGTEXT NULL COMMENT '原命令返回快照,与业务写入同事务',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建UTC时间',
PRIMARY KEY(command_key),
KEY idx_ll_fba_command_appointment(appointment_no,created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='预约命令与变更历史';
+336 -303
View File
@@ -466,6 +466,8 @@ CREATE TABLE sys_audit_outbox (
-- 服务 schema:baiyue_order -- 服务 schema:baiyue_order
CREATE DATABASE IF NOT EXISTS baiyue_order DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci; CREATE DATABASE IF NOT EXISTS baiyue_order DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci;
USE baiyue_order; USE baiyue_order;
CREATE TABLE ord_customer_address ( CREATE TABLE ord_customer_address (
@@ -1130,7 +1132,7 @@ CREATE TABLE wh_warehouse (
warehouse_name varchar(120) NOT NULL COMMENT '仓库名称', warehouse_name varchar(120) NOT NULL COMMENT '仓库名称',
warehouse_type varchar(32) NOT NULL DEFAULT 'DOMESTIC' COMMENT '公共仓库类型:DOMESTIC国内仓、FBA亚马逊仓、OVERSEAS普通海外仓、OVERSEAS_PARTNER海外合作仓', warehouse_type varchar(32) NOT NULL DEFAULT 'DOMESTIC' COMMENT '公共仓库类型:DOMESTIC国内仓、FBA亚马逊仓、OVERSEAS普通海外仓、OVERSEAS_PARTNER海外合作仓',
country_code char(2) NOT NULL COMMENT '所在国家二字码', country_code char(2) NOT NULL COMMENT '所在国家二字码',
timezone varchar(64) NOT NULL COMMENT '仓库所在地UTC偏移量', timezone varchar(64) NOT NULL COMMENT '仓库所在地IANA时区,待核实为空',
contact_name varchar(64) DEFAULT NULL COMMENT '仓库联系人', contact_name varchar(64) DEFAULT NULL COMMENT '仓库联系人',
contact_phone varchar(32) DEFAULT NULL COMMENT '联系电话', contact_phone varchar(32) DEFAULT NULL COMMENT '联系电话',
contact_email varchar(128) DEFAULT NULL COMMENT '联系邮箱', contact_email varchar(128) DEFAULT NULL COMMENT '联系邮箱',
@@ -6710,6 +6712,8 @@ INSERT INTO iam_permission (id, tenant_id, app_code, permission_type, parent_id,
INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107280,0,CURRENT_TIMESTAMP(3)); INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107280,0,CURRENT_TIMESTAMP(3));
INSERT INTO iam_permission (id, tenant_id, app_code, permission_type, parent_id, permission_code, permission_name, route_path, http_method, sort_no, status, built_in, created_at, updated_at, deleted) VALUES (5107281,0,'PLATFORM','BUTTON',5107280,'platform:appointment:delete','删除预约',NULL,'DELETE',741,'ACTIVE',1,CURRENT_TIMESTAMP(3),CURRENT_TIMESTAMP(3),0); INSERT INTO iam_permission (id, tenant_id, app_code, permission_type, parent_id, permission_code, permission_name, route_path, http_method, sort_no, status, built_in, created_at, updated_at, deleted) VALUES (5107281,0,'PLATFORM','BUTTON',5107280,'platform:appointment:delete','删除预约',NULL,'DELETE',741,'ACTIVE',1,CURRENT_TIMESTAMP(3),CURRENT_TIMESTAMP(3),0);
INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107281,0,CURRENT_TIMESTAMP(3)); INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107281,0,CURRENT_TIMESTAMP(3));
INSERT INTO iam_permission (id, tenant_id, app_code, permission_type, parent_id, permission_code, permission_name, route_path, http_method, sort_no, status, built_in, created_at, updated_at, deleted) VALUES (5107282,0,'PLATFORM','BUTTON',5107280,'platform:appointment:followup','记录预约跟进',NULL,'POST',742,'ACTIVE',1,CURRENT_TIMESTAMP(3),CURRENT_TIMESTAMP(3),0);
INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107282,0,CURRENT_TIMESTAMP(3));
INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107010,0,CURRENT_TIMESTAMP(3)); INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107010,0,CURRENT_TIMESTAMP(3));
INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107011,0,CURRENT_TIMESTAMP(3)); INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107011,0,CURRENT_TIMESTAMP(3));
INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107012,0,CURRENT_TIMESTAMP(3)); INSERT INTO iam_role_permission (role_id, permission_id, tenant_id, created_at) VALUES (4000001,5107012,0,CURRENT_TIMESTAMP(3));
@@ -7139,324 +7143,324 @@ INSERT INTO wh_service_capability (id, tenant_id, warehouse_id, capability_code,
INSERT INTO wh_service_capability (id, tenant_id, warehouse_id, capability_code, capability_name, enabled, cutoff_time, description, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000400004,0,193000000000200004,'RECEIVING','海外收货',1,'16:00:00','纽约仓海外接柜入仓收货能力',NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_service_capability (id, tenant_id, warehouse_id, capability_code, capability_name, enabled, cutoff_time, description, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000400004,0,193000000000200004,'RECEIVING','海外收货',1,'16:00:00','纽约仓海外接柜入仓收货能力',NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
-- 系统基线 wh_warehouse:318 行。 -- 系统基线 wh_warehouse:318 行。
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000001,0,'ABE2',NULL,'ABE2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000001,0,'ABE2',NULL,'ABE2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000002,0,'ABE3',NULL,'ABE3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000002,0,'ABE3',NULL,'ABE3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000003,0,'ABE4','126','ABE4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000003,0,'ABE4','126','ABE4','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000004,0,'ABE5',NULL,'ABE5','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000004,0,'ABE5',NULL,'ABE5','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000005,0,'ABE8','39','ABE8','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000005,0,'ABE8','39','ABE8','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000006,0,'ABQ2','76','ABQ2','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000006,0,'ABQ2','76','ABQ2','FBA','US','America/Denver',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000007,0,'ACY2','101','ACY2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000007,0,'ACY2','101','ACY2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000008,0,'AFW1',NULL,'AFW1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000008,0,'AFW1',NULL,'AFW1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000009,0,'AFW5','181','AFW5','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000009,0,'AFW5','181','AFW5','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000010,0,'AKR1','153','AKR1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000010,0,'AKR1','153','AKR1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000011,0,'ALB1','102','ALB1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000011,0,'ALB1','102','ALB1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000012,0,'AMA1','132','AMA1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000012,0,'AMA1','132','AMA1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000013,0,'ATL2N','157','ATL2N','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000013,0,'ATL2N','157','ATL2N','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000014,0,'ATL3',NULL,'ATL3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000014,0,'ATL3',NULL,'ATL3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000015,0,'ATL6',NULL,'ATL6','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000015,0,'ATL6',NULL,'ATL6','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000016,0,'AVP1','70','AVP1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000016,0,'AVP1','70','AVP1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000017,0,'AVP3',NULL,'AVP3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000017,0,'AVP3',NULL,'AVP3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000018,0,'BDL1',NULL,'BDL1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000018,0,'BDL1',NULL,'BDL1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000019,0,'BFI1',NULL,'BFI1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000019,0,'BFI1',NULL,'BFI1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000020,0,'BFI3','34','BFI3','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000020,0,'BFI3','34','BFI3','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000021,0,'BFI7',NULL,'BFI7','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000021,0,'BFI7',NULL,'BFI7','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000022,0,'BJC1','186','BJC1','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000022,0,'BJC1','186','BJC1','FBA','US','America/Denver',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000023,0,'BNA1',NULL,'BNA1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000023,0,'BNA1',NULL,'BNA1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000024,0,'BNA2','37','BNA2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000024,0,'BNA2','37','BNA2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000025,0,'BNA3',NULL,'BNA3','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000025,0,'BNA3',NULL,'BNA3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000026,0,'BNA4',NULL,'BNA4','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000026,0,'BNA4',NULL,'BNA4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000027,0,'BNA6','99','BNA6','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000027,0,'BNA6','99','BNA6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000028,0,'BOS1',NULL,'BOS1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000028,0,'BOS1',NULL,'BOS1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000029,0,'BOS2',NULL,'BOS2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000029,0,'BOS2',NULL,'BOS2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000030,0,'BOS7','103','BOS7','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000030,0,'BOS7','103','BOS7','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000031,0,'BWI1',NULL,'BWI1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000031,0,'BWI1',NULL,'BWI1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000032,0,'BWI2',NULL,'BWI2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000032,0,'BWI2',NULL,'BWI2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000033,0,'BWI4','150','BWI4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000033,0,'BWI4','150','BWI4','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000034,0,'CAE1',NULL,'CAE1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000034,0,'CAE1',NULL,'CAE1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000035,0,'CHA1',NULL,'CHA1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000035,0,'CHA1',NULL,'CHA1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000036,0,'CHA2','66','CHA2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000036,0,'CHA2','66','CHA2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000037,0,'CHO1','120','CHO1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000037,0,'CHO1','120','CHO1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000038,0,'CLT2','59','CLT2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000038,0,'CLT2','59','CLT2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000039,0,'CLT3','104','CLT3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000039,0,'CLT3','104','CLT3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000040,0,'CMH2','123','CMH2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000040,0,'CMH2','123','CMH2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000041,0,'CMH3','32','CMH3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000041,0,'CMH3','32','CMH3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000042,0,'CVG1',NULL,'CVG1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000042,0,'CVG1',NULL,'CVG1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000043,0,'CVG2',NULL,'CVG2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000043,0,'CVG2',NULL,'CVG2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000044,0,'CVG3',NULL,'CVG3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000044,0,'CVG3',NULL,'CVG3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000045,0,'CVG5',NULL,'CVG5','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000045,0,'CVG5',NULL,'CVG5','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000046,0,'DCA6','135','DCA6','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000046,0,'DCA6','135','DCA6','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000047,0,'DEN2','107','DEN2','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000047,0,'DEN2','107','DEN2','FBA','US','America/Denver',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000048,0,'DEN8','73','DEN8','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000048,0,'DEN8','73','DEN8','FBA','US','America/Denver',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000049,0,'DET1','118','DET1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000049,0,'DET1','118','DET1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000050,0,'DET2','136','DET2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000050,0,'DET2','136','DET2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000051,0,'DFW5S',NULL,'DFW5S','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000051,0,'DFW5S',NULL,'DFW5S','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000052,0,'DFW6','105','DFW6','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000052,0,'DFW6','105','DFW6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000053,0,'DFW8',NULL,'DFW8','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000053,0,'DFW8',NULL,'DFW8','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000054,0,'EWR4',NULL,'EWR4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000054,0,'EWR4',NULL,'EWR4','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000055,0,'EWR5',NULL,'EWR5','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000055,0,'EWR5',NULL,'EWR5','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000056,0,'EWR7',NULL,'EWR7','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000056,0,'EWR7',NULL,'EWR7','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000057,0,'EWR9',NULL,'EWR9','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000057,0,'EWR9',NULL,'EWR9','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000058,0,'FAT2','43','FAT2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000058,0,'FAT2','43','FAT2','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000059,0,'FOE1','117','FOE1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000059,0,'FOE1','117','FOE1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000060,0,'FTW1','24','FTW1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000060,0,'FTW1','24','FTW1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000061,0,'FTW2',NULL,'FTW2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000061,0,'FTW2',NULL,'FTW2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000062,0,'FTW3',NULL,'FTW3','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000062,0,'FTW3',NULL,'FTW3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000063,0,'FTW5','48','FTW5','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000063,0,'FTW5','48','FTW5','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000064,0,'FWA4','58','FWA4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000064,0,'FWA4','58','FWA4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000065,0,'GEG2','108','GEG2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000065,0,'GEG2','108','GEG2','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000066,0,'GEU2','97','GEU2','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000066,0,'GEU2','97','GEU2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000067,0,'GEU3','81','GEU3','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000067,0,'GEU3','81','GEU3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000068,0,'GEU5','100','GEU5','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000068,0,'GEU5','100','GEU5','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000069,0,'GSO1','131','GSO1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000069,0,'GSO1','131','GSO1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000070,0,'GSP1','90','GSP1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000070,0,'GSP1','90','GSP1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000071,0,'GYR2','7','GYR2','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000071,0,'GYR2','7','GYR2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000072,0,'GYR3','8','GYR3','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000072,0,'GYR3','8','GYR3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000073,0,'HGR6','130','HGR6','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000073,0,'HGR6','130','HGR6','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000074,0,'HIA1','148','HIA1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000074,0,'HIA1','148','HIA1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000075,0,'HLI2','137','HLI2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000075,0,'HLI2','137','HLI2','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000076,0,'HOU1',NULL,'HOU1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000076,0,'HOU1',NULL,'HOU1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000077,0,'HOU2',NULL,'HOU2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000077,0,'HOU2',NULL,'HOU2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000078,0,'HOU3',NULL,'HOU3','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000078,0,'HOU3',NULL,'HOU3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000079,0,'HOU8','49','HOU8','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000079,0,'HOU8','49','HOU8','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000080,0,'HSV1','80','HSV1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000080,0,'HSV1','80','HSV1','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000081,0,'HSV2',NULL,'HSV2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000081,0,'HSV2',NULL,'HSV2','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000082,0,'IAH3','57','IAH3','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000082,0,'IAH3','57','IAH3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000083,0,'IAZ1','179','IAZ1','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000083,0,'IAZ1','179','IAZ1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000084,0,'ICT2','109','ICT2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000084,0,'ICT2','109','ICT2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000085,0,'IGA3','197','IGA3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000085,0,'IGA3','197','IGA3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000086,0,'IGQ2','110','IGQ2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000086,0,'IGQ2','110','IGQ2','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000087,0,'ILG1','35','ILG1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000087,0,'ILG1','35','ILG1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000088,0,'IMO1','178','IMO1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000088,0,'IMO1','178','IMO1','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000089,0,'IMS1','189','IMS1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000089,0,'IMS1','189','IMS1','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000090,0,'INC1','190','INC1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000090,0,'INC1','190','INC1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000091,0,'IND2','127','IND2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000091,0,'IND2','127','IND2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000092,0,'IND4',NULL,'IND4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000092,0,'IND4',NULL,'IND4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000093,0,'IND5','140','IND5','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000093,0,'IND5','140','IND5','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000094,0,'IND6',NULL,'IND6','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000094,0,'IND6',NULL,'IND6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000095,0,'IND9','17','IND9','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000095,0,'IND9','17','IND9','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000096,0,'ITX3','187','ITX3','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000096,0,'ITX3','187','ITX3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000097,0,'IUSF','169','IUSF','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000097,0,'IUSF','169','IUSF','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000098,0,'IUSJ','98','IUSJ','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000098,0,'IUSJ','98','IUSJ','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000099,0,'IUSP','83','IUSP','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000099,0,'IUSP','83','IUSP','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000100,0,'IUSQ','95','IUSQ','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000100,0,'IUSQ','95','IUSQ','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000101,0,'IUSR','158','IUSR','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000101,0,'IUSR','158','IUSR','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000102,0,'IUST','149','IUST','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000102,0,'IUST','149','IUST','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000103,0,'IUSW','156','IUSW','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000103,0,'IUSW','156','IUSW','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000104,0,'IUTE','170','IUTE','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000104,0,'IUTE','170','IUTE','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000105,0,'IUTJ','177','IUTJ','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000105,0,'IUTJ','177','IUTJ','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000106,0,'IUTL','188','IUTL','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000106,0,'IUTL','188','IUTL','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000107,0,'IWA6','191','IWA6','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000107,0,'IWA6','191','IWA6','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000108,0,'JOT1','93','JOT1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000108,0,'JOT1','93','JOT1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000109,0,'JVL1','125','JVL1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000109,0,'JVL1','125','JVL1','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000110,0,'KRB4',NULL,'KRB4','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000110,0,'KRB4',NULL,'KRB4','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000111,0,'KY1','60','KY1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000111,0,'KY1','60','KY1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000112,0,'LAN2','96','LAN2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000112,0,'LAN2','96','LAN2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000113,0,'LAS1','5','LAS1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000113,0,'LAS1','5','LAS1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000114,0,'LAS2',NULL,'LAS2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000114,0,'LAS2',NULL,'LAS2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000115,0,'LAS6','50','LAS6','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000115,0,'LAS6','50','LAS6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000116,0,'LAX2T','19','LAX2T','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000116,0,'LAX2T','19','LAX2T','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000117,0,'LAX9','3','LAX9','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000117,0,'LAX9','3','LAX9','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000118,0,'LBE1','112','LBE1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000118,0,'LBE1','112','LBE1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000119,0,'LEX1',NULL,'LEX1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000119,0,'LEX1',NULL,'LEX1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000120,0,'LEX2',NULL,'LEX2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000120,0,'LEX2',NULL,'LEX2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000121,0,'LFT1','31','LFT1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000121,0,'LFT1','31','LFT1','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000122,0,'LGB3',NULL,'LGB3','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000122,0,'LGB3',NULL,'LGB3','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000123,0,'LGB4','45','LGB4','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000123,0,'LGB4','45','LGB4','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000124,0,'LGB6','26','LGB6','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000124,0,'LGB6','26','LGB6','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000125,0,'LGB8','2','LGB8','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000125,0,'LGB8','2','LGB8','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000126,0,'LIT2','159','LIT2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000126,0,'LIT2','159','LIT2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000127,0,'MCC1','161','MCC1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000127,0,'MCC1','161','MCC1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000128,0,'MCE1','65','MCE1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000128,0,'MCE1','65','MCE1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000129,0,'MCI1',NULL,'MCI1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000129,0,'MCI1',NULL,'MCI1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000130,0,'MCI4','176','MCI4','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000130,0,'MCI4','176','MCI4','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000131,0,'MCO2','106','MCO2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000131,0,'MCO2','106','MCO2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000132,0,'MDT1','121','MDT1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000132,0,'MDT1','121','MDT1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000133,0,'MDT4','144','MDT4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000133,0,'MDT4','144','MDT4','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000134,0,'MDW2','46','MDW2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000134,0,'MDW2','46','MDW2','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000135,0,'MDW6','143','MDW6','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000135,0,'MDW6','143','MDW6','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000136,0,'MDW7',NULL,'MDW7','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000136,0,'MDW7',NULL,'MDW7','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000137,0,'MDW8',NULL,'MDW8','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000137,0,'MDW8',NULL,'MDW8','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000138,0,'MDW9','36','MDW9','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000138,0,'MDW9','36','MDW9','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000139,0,'MEM1','85','MEM1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000139,0,'MEM1','85','MEM1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000140,0,'MEM6','51','MEM6','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000140,0,'MEM6','51','MEM6','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000141,0,'MGE3','133','MGE3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000141,0,'MGE3','133','MGE3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000142,0,'MIT2','82','MIT2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000142,0,'MIT2','82','MIT2','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000143,0,'MKC4','67','MKC4','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000143,0,'MKC4','67','MKC4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000144,0,'MKC6',NULL,'MKC6','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000144,0,'MKC6',NULL,'MKC6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000145,0,'MKE1',NULL,'MKE1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000145,0,'MKE1',NULL,'MKE1','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000146,0,'MQJ1','88','MQJ1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000146,0,'MQJ1','88','MQJ1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000147,0,'MSP1',NULL,'MSP1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000147,0,'MSP1',NULL,'MSP1','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000148,0,'NJ3','175','NJ3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000148,0,'NJ3','175','NJ3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000149,0,'OAK3','41','OAK3','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000149,0,'OAK3','41','OAK3','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000150,0,'OAK4',NULL,'OAK4','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000150,0,'OAK4',NULL,'OAK4','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000151,0,'OKC2','33','OKC2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000151,0,'OKC2','33','OKC2','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000152,0,'OLM1','172','OLM1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000152,0,'OLM1','172','OLM1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000153,0,'ONT2',NULL,'ONT2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000153,0,'ONT2',NULL,'ONT2','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000154,0,'ONT6',NULL,'ONT6','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000154,0,'ONT6',NULL,'ONT6','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000155,0,'ONT8','1','ONT8','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000155,0,'ONT8','1','ONT8','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000156,0,'ONT9','25','ONT9','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000156,0,'ONT9','25','ONT9','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000157,0,'ORD2','21','ORD2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000157,0,'ORD2','21','ORD2','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000158,0,'ORD6',NULL,'ORD6','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000158,0,'ORD6',NULL,'ORD6','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000159,0,'ORF2','38','ORF2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000159,0,'ORF2','38','ORF2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000160,0,'PBI3','113','PBI3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000160,0,'PBI3','113','PBI3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000161,0,'PDX7','68','PDX7','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000161,0,'PDX7','68','PDX7','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000162,0,'PHL1',NULL,'PHL1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000162,0,'PHL1',NULL,'PHL1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000163,0,'PHL3',NULL,'PHL3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000163,0,'PHL3',NULL,'PHL3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000164,0,'PHL4','52','PHL4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000164,0,'PHL4','52','PHL4','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000165,0,'PHL5',NULL,'PHL5','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000165,0,'PHL5',NULL,'PHL5','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000166,0,'PHL5S','171','PHL5S','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000166,0,'PHL5S','171','PHL5S','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000167,0,'PHL6','69','PHL6','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000167,0,'PHL6','69','PHL6','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000168,0,'PHL7',NULL,'PHL7','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000168,0,'PHL7',NULL,'PHL7','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000169,0,'PHL8',NULL,'PHL8','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000169,0,'PHL8',NULL,'PHL8','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000170,0,'PHX3',NULL,'PHX3','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000170,0,'PHX3',NULL,'PHX3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000171,0,'PHX5','72','PHX5','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000171,0,'PHX5','72','PHX5','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000172,0,'PHX6',NULL,'PHX6','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000172,0,'PHX6',NULL,'PHX6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000173,0,'PHX7','74','PHX7','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000173,0,'PHX7','74','PHX7','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000174,0,'PIT1',NULL,'PIT1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000174,0,'PIT1',NULL,'PIT1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000175,0,'PIT2','78','PIT2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000175,0,'PIT2','78','PIT2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000176,0,'POC1','128','POC1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000176,0,'POC1','128','POC1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000177,0,'POC2','151','POC2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000177,0,'POC2','151','POC2','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000178,0,'POC3','129','POC3','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000178,0,'POC3','129','POC3','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000179,0,'PPO4','122','PPO4','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000179,0,'PPO4','122','PPO4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000180,0,'PSC2','75','PSC2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000180,0,'PSC2','75','PSC2','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000181,0,'PSP3','162','PSP3','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000181,0,'PSP3','162','PSP3','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000182,0,'QXY5','92','QXY5','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000182,0,'QXY5','92','QXY5','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000183,0,'QXY8','154','QXY8','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000183,0,'QXY8','154','QXY8','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000184,0,'QZZ7','184','QZZ7','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000184,0,'QZZ7','184','QZZ7','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000185,0,'RDU2','56','RDU2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000185,0,'RDU2','56','RDU2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000186,0,'RDU4','145','RDU4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000186,0,'RDU4','145','RDU4','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000187,0,'RFD2','71','RFD2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000187,0,'RFD2','71','RFD2','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000188,0,'RFD4','174','RFD4','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000188,0,'RFD4','174','RFD4','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000189,0,'RIC1','142','RIC1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000189,0,'RIC1','142','RIC1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000190,0,'RIC2',NULL,'RIC2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000190,0,'RIC2',NULL,'RIC2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000191,0,'RMN3','84','RMN3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000191,0,'RMN3','84','RMN3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000192,0,'RNO1',NULL,'RNO1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000192,0,'RNO1',NULL,'RNO1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000193,0,'RNO2',NULL,'RNO2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000193,0,'RNO2',NULL,'RNO2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000194,0,'RNO4',NULL,'RNO4','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000194,0,'RNO4',NULL,'RNO4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000195,0,'RYY2','94','RYY2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000195,0,'RYY2','94','RYY2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000196,0,'SAT1','23','SAT1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000196,0,'SAT1','23','SAT1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000197,0,'SAT4','61','SAT4','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000197,0,'SAT4','61','SAT4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000198,0,'SAT6','183','SAT6','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000198,0,'SAT6','183','SAT6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000199,0,'SAV3','124','SAV3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000199,0,'SAV3','124','SAV3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000200,0,'SBD1','4','SBD1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000200,0,'SBD1','4','SBD1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000201,0,'SBD2','15','SBD2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000201,0,'SBD2','15','SBD2','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000202,0,'SCK1','20','SCK1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000202,0,'SCK1','20','SCK1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000203,0,'SCK3','54','SCK3','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000203,0,'SCK3','54','SCK3','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000204,0,'SCK4','10','SCK4','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000204,0,'SCK4','10','SCK4','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000205,0,'SCK8','141','SCK8','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000205,0,'SCK8','141','SCK8','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000206,0,'SDF1',NULL,'SDF1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000206,0,'SDF1',NULL,'SDF1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000207,0,'SDF2',NULL,'SDF2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000207,0,'SDF2',NULL,'SDF2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000208,0,'SDF4',NULL,'SDF4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000208,0,'SDF4',NULL,'SDF4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000209,0,'SDF6',NULL,'SDF6','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000209,0,'SDF6',NULL,'SDF6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000210,0,'SDF7',NULL,'SDF7','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000210,0,'SDF7',NULL,'SDF7','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000211,0,'SDF8',NULL,'SDF8','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000211,0,'SDF8',NULL,'SDF8','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000212,0,'SDF9',NULL,'SDF9','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000212,0,'SDF9',NULL,'SDF9','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000213,0,'SEA6',NULL,'SEA6','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000213,0,'SEA6',NULL,'SEA6','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000214,0,'SEA8',NULL,'SEA8','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000214,0,'SEA8',NULL,'SEA8','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000215,0,'SJC7','30','SJC7','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000215,0,'SJC7','30','SJC7','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000216,0,'SLC2','86','SLC2','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000216,0,'SLC2','86','SLC2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000217,0,'SLC3','185','SLC3','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000217,0,'SLC3','185','SLC3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000218,0,'SMF3','9','SMF3','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000218,0,'SMF3','9','SMF3','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000219,0,'SMF6','28','SMF6','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000219,0,'SMF6','28','SMF6','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000220,0,'SNA4','18','SNA4','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000220,0,'SNA4','18','SNA4','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000221,0,'STL3','152','STL3','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000221,0,'STL3','152','STL3','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000222,0,'STL4','115','STL4','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000222,0,'STL4','115','STL4','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000223,0,'SWF1','134','SWF1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000223,0,'SWF1','134','SWF1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000224,0,'SWF2','62','SWF2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000224,0,'SWF2','62','SWF2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000225,0,'TCY1','139','TCY1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000225,0,'TCY1','139','TCY1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000226,0,'TCY2','138','TCY2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000226,0,'TCY2','138','TCY2','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000227,0,'TEB3','47','TEB3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000227,0,'TEB3','47','TEB3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000228,0,'TEB4','55','TEB4','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000228,0,'TEB4','55','TEB4','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000229,0,'TEB6','114','TEB6','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000229,0,'TEB6','114','TEB6','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000230,0,'TEB9','40','TEB9','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000230,0,'TEB9','40','TEB9','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000231,0,'TMB8','116','TMB8','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000231,0,'TMB8','116','TMB8','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000232,0,'TOL3','173','TOL3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000232,0,'TOL3','173','TOL3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000233,0,'TPA1',NULL,'TPA1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000233,0,'TPA1',NULL,'TPA1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000234,0,'TPA2','22','TPA2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000234,0,'TPA2','22','TPA2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000235,0,'TPA3','146','TPA3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000235,0,'TPA3','146','TPA3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000236,0,'TUL1',NULL,'TUL1','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000236,0,'TUL1',NULL,'TUL1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000237,0,'VGT2','6','VGT2','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000237,0,'VGT2','6','VGT2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000238,0,'VUBA',NULL,'VUBA','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000238,0,'VUBA',NULL,'VUBA','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000239,0,'VUGA',NULL,'VUGA','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000239,0,'VUGA',NULL,'VUGA','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000240,0,'WBW2','119','WBW2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000240,0,'WBW2','119','WBW2','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000241,0,'XAV3','180','XAV3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000241,0,'XAV3','180','XAV3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000242,0,'XEW5','163','XEW5','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000242,0,'XEW5','163','XEW5','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000243,0,'XIN5','182','XIN5','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000243,0,'XIN5','182','XIN5','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000244,0,'XLX1','160','XLX1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000244,0,'XLX1','160','XLX1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000245,0,'XLX6','166','XLX6','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000245,0,'XLX6','166','XLX6','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000246,0,'XLX7','27','XLX7','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000246,0,'XLX7','27','XLX7','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000247,0,'XPB2','165','XPB2','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000247,0,'XPB2','165','XPB2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000248,0,'XRI3','167','XRI3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000248,0,'XRI3','167','XRI3','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000249,0,'XUSB',NULL,'XUSB','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000249,0,'XUSB',NULL,'XUSB','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000250,0,'XUSC',NULL,'XUSC','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000250,0,'XUSC',NULL,'XUSC','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000251,0,'XUSD',NULL,'XUSD','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000251,0,'XUSD',NULL,'XUSD','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000252,0,'XUSE',NULL,'XUSE','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000252,0,'XUSE',NULL,'XUSE','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000253,0,'ABE8-309',NULL,'ABE8-309','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000253,0,'ABE8-309',NULL,'ABE8-309','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000254,0,'ABE8-401',NULL,'ABE8-401','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000254,0,'ABE8-401',NULL,'ABE8-401','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000255,0,'ABQ2-UPS',NULL,'ABQ2-UPS','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000255,0,'ABQ2-UPS',NULL,'ABQ2-UPS','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000256,0,'ATL1','200','ATL1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000256,0,'ATL1','200','ATL1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000257,0,'ATL1-WALMART',NULL,'ATL1-WALMART','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000257,0,'ATL1-WALMART',NULL,'ATL1-WALMART','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000258,0,'AZA4','16','AZA4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000258,0,'AZA4','16','AZA4','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000259,0,'CEG2','79','CEG2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000259,0,'CEG2','79','CEG2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000260,0,'CMH1-11999',NULL,'CMH1-11999','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000260,0,'CMH1-11999',NULL,'CMH1-11999','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000261,0,'FEDEX','12','FEDEX','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000261,0,'FEDEX','12','FEDEX','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000262,0,'HEA2','77','HEA2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000262,0,'HEA2','77','HEA2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000263,0,'HOU7','63','HOU7','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000263,0,'HOU7','63','HOU7','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000264,0,'IAK3','44','IAK3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000264,0,'IAK3','44','IAK3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000265,0,'IMI1','199','IMI1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000265,0,'IMI1','199','IMI1','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000266,0,'IND1-AMAZON',NULL,'IND1-AMAZON','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000266,0,'IND1-AMAZON',NULL,'IND1-AMAZON','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000267,0,'IND1-WALMART',NULL,'IND1-WALMART','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000267,0,'IND1-WALMART',NULL,'IND1-WALMART','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000268,0,'IND2-AMAZON',NULL,'IND2-AMAZON','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000268,0,'IND2-AMAZON',NULL,'IND2-AMAZON','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000269,0,'IND2-WALMART',NULL,'IND2-WALMART','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000269,0,'IND2-WALMART',NULL,'IND2-WALMART','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000270,0,'IND3','198','IND3','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000270,0,'IND3','198','IND3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000271,0,'IND3-亚马逊',NULL,'IND3-亚马逊','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000271,0,'IND3-亚马逊',NULL,'IND3-亚马逊','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000272,0,'IND3-沃尔玛',NULL,'IND3-沃尔玛','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000272,0,'IND3-沃尔玛',NULL,'IND3-沃尔玛','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000273,0,'IPA1','194','IPA1','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000273,0,'IPA1','194','IPA1','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000274,0,'IUSP-AWD','83','IUSP-AWD','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000274,0,'IUSP-AWD','83','IUSP-AWD','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000275,0,'JAX3','111','JAX3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000275,0,'JAX3','111','JAX3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000276,0,'JAX3-32210','111','JAX3-32210','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000276,0,'JAX3-32210','111','JAX3-32210','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000277,0,'JAX3-32221',NULL,'JAX3-32221','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000277,0,'JAX3-32221',NULL,'JAX3-32221','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000278,0,'LAN2-48917',NULL,'LAN2-48917','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000278,0,'LAN2-48917',NULL,'LAN2-48917','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000279,0,'LAX1','192','LAX1','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000279,0,'LAX1','192','LAX1','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000280,0,'LAX1-WALMART',NULL,'LAX1-WALMART','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000280,0,'LAX1-WALMART',NULL,'LAX1-WALMART','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000281,0,'LAX2T-WALMART',NULL,'LAX2T-WALMART','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000281,0,'LAX2T-WALMART',NULL,'LAX2T-WALMART','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000282,0,'LBE1-UPS',NULL,'LBE1-UPS','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000282,0,'LBE1-UPS',NULL,'LBE1-UPS','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000283,0,'MCO1-WALMART',NULL,'MCO1-WALMART','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000283,0,'MCO1-WALMART',NULL,'MCO1-WALMART','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000284,0,'MDW2-60433-3280',NULL,'MDW2-60433-3280','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000284,0,'MDW2-60433-3280',NULL,'MDW2-60433-3280','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000285,0,'MEM1S-WALMART',NULL,'MEM1S-WALMART','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000285,0,'MEM1S-WALMART',NULL,'MEM1S-WALMART','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000286,0,'MIA1-33054',NULL,'MIA1-33054','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000286,0,'MIA1-33054',NULL,'MIA1-33054','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000287,0,'MIA1-33182',NULL,'MIA1-33182','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000287,0,'MIA1-33182',NULL,'MIA1-33182','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000288,0,'MQY2','193','MQY2','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000288,0,'MQY2','193','MQY2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000289,0,'NJ3-WALMART',NULL,'NJ3-WALMART','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000289,0,'NJ3-WALMART',NULL,'NJ3-WALMART','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000290,0,'NJ3T','195','NJ3T','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000290,0,'NJ3T','195','NJ3T','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000291,0,'ORD1S-WALMART',NULL,'ORD1S-WALMART','FBA','US','UTC-6',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000291,0,'ORD1S-WALMART',NULL,'ORD1S-WALMART','FBA','US','America/Chicago',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000292,0,'ORF2-FEDEX',NULL,'ORF2-FEDEX','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000292,0,'ORF2-FEDEX',NULL,'ORF2-FEDEX','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000293,0,'ORF2-UPS',NULL,'ORF2-UPS','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000293,0,'ORF2-UPS',NULL,'ORF2-UPS','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000294,0,'PHL5S-WALMART',NULL,'PHL5S-WALMART','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000294,0,'PHL5S-WALMART',NULL,'PHL5S-WALMART','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000295,0,'PSC2-UPS',NULL,'PSC2-UPS','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000295,0,'PSC2-UPS',NULL,'PSC2-UPS','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000296,0,'SLC1N','196','SLC1N','FBA','US','UTC-7',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000296,0,'SLC1N','196','SLC1N','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000297,0,'SMF1-AMAZON',NULL,'SMF1-AMAZON','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000297,0,'SMF1-AMAZON',NULL,'SMF1-AMAZON','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000298,0,'SMF1-WALMART',NULL,'SMF1-WALMART','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000298,0,'SMF1-WALMART',NULL,'SMF1-WALMART','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000299,0,'SMF7','53','SMF7','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000299,0,'SMF7','53','SMF7','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000300,0,'STL6','64','STL6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000300,0,'STL6','64','STL6','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000301,0,'SWF2-10710',NULL,'SWF2-10710','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000301,0,'SWF2-10710',NULL,'SWF2-10710','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000302,0,'SWF2-12533',NULL,'SWF2-12533','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000302,0,'SWF2-12533',NULL,'SWF2-12533','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000303,0,'TMB8-UPS',NULL,'TMB8-UPS','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000303,0,'TMB8-UPS',NULL,'TMB8-UPS','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000304,0,'UPS','11','UPS','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000304,0,'UPS','11','UPS','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000305,0,'VGT2-FEDEX',NULL,'VGT2-FEDEX','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000305,0,'VGT2-FEDEX',NULL,'VGT2-FEDEX','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000306,0,'VGT2-UPS',NULL,'VGT2-UPS','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000306,0,'VGT2-UPS',NULL,'VGT2-UPS','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000307,0,'XBN3','91','XBN3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000307,0,'XBN3','91','XBN3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000308,0,'XCH2','87','XCH2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000308,0,'XCH2','87','XCH2','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000309,0,'XMI3','89','XMI3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000309,0,'XMI3','89','XMI3','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000310,0,'洛杉矶仓一件代发','CADF','洛杉矶仓一件代发','FBA','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000310,0,'洛杉矶仓一件代发','CADF','洛杉矶仓一件代发','FBA','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000311,0,'海外仓打托','13','海外仓打托','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000311,0,'海外仓打托','13','海外仓打托','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000312,0,'私人仓','14','私人仓','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000312,0,'私人仓','14','私人仓','FBA','US','',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000313,0,'纽约仓',NULL,'纽约仓','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000313,0,'纽约仓',NULL,'纽约仓','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000314,0,'纽约仓一件代发','NJDF','纽约仓一件代发','FBA','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000000314,0,'纽约仓一件代发','NJDF','纽约仓一件代发','FBA','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000200001,0,'CN-YIWU-01',NULL,'义乌仓','DOMESTIC','CN','UTC+8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000200001,0,'CN-YIWU-01',NULL,'义乌仓','DOMESTIC','CN','Asia/Shanghai',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000200002,0,'CN-DONGGUAN-01',NULL,'东莞仓','DOMESTIC','CN','UTC+8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000200002,0,'CN-DONGGUAN-01',NULL,'东莞仓','DOMESTIC','CN','Asia/Shanghai',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000200003,0,'US-LAX-01',NULL,'洛杉矶仓','OVERSEAS','US','UTC-8',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000200003,0,'US-LAX-01',NULL,'洛杉矶仓','OVERSEAS','US','America/Los_Angeles',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000200004,0,'US-NYC-01',NULL,'纽约仓','OVERSEAS','US','UTC-5',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse (id, tenant_id, warehouse_code, internal_code, warehouse_name, warehouse_type, country_code, timezone, contact_name, contact_phone, contact_email, status, remark, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000200004,0,'US-NYC-01',NULL,'纽约仓','OVERSEAS','US','America/New_York',NULL,NULL,NULL,'ACTIVE',NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
-- 系统基线 wh_warehouse_address:318 行。 -- 系统基线 wh_warehouse_address:318 行。
INSERT INTO wh_warehouse_address (id, tenant_id, warehouse_id, address_type, country_code, state_province, city, district, postal_code, address_line1, address_line2, latitude, longitude, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000100001,0,193000000000000001,'OPERATING','US','PA','Breinigsville',NULL,'18031','705 Boulder Drive',NULL,NULL,NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0); INSERT INTO wh_warehouse_address (id, tenant_id, warehouse_id, address_type, country_code, state_province, city, district, postal_code, address_line1, address_line2, latitude, longitude, created_by, created_at, updated_by, updated_at, deleted, version) VALUES (193000000000100001,0,193000000000000001,'OPERATING','US','PA','Breinigsville',NULL,'18031','705 Boulder Drive',NULL,NULL,NULL,NULL,CURRENT_TIMESTAMP(3),NULL,CURRENT_TIMESTAMP(3),0,0);
@@ -8282,4 +8286,33 @@ CREATE TABLE event_delivery_attempt (
KEY idx_delivery_attempt_outcome (outcome,started_at) KEY idx_delivery_attempt_outcome (outcome,started_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='本服务业务事件逐次投递审计'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='本服务业务事件逐次投递审计';
USE baiyue_iam;
-- 采购节点动作独立授权;不新建岗位,不以通用编辑权限代替购买与取消。
INSERT INTO iam_permission(id,tenant_id,app_code,permission_type,parent_id,permission_code,permission_name,route_path,http_method,sort_no,status,built_in,deleted)
VALUES
(5117103,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:buy','采购购买及货款核定',NULL,'POST',803,'ACTIVE',1,0),
(5117104,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:cancel','购买前取消采购订单',NULL,'POST',804,'ACTIVE',1,0),
(5117105,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:receive-overseas','采购海外收货',NULL,'POST',805,'ACTIVE',1,0),
(5117106,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:receive-domestic','采购国内收货',NULL,'POST',806,'ACTIVE',1,0),
(5117107,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:pack','采购装箱与确认',NULL,'POST',807,'ACTIVE',1,0),
(5117108,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:manage','采购差异处置与事实更正',NULL,'POST',808,'ACTIVE',1,0),
(5117109,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:label','采购面单维护',NULL,'POST',809,'ACTIVE',1,0),
(5117110,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:charge','采购国内核费',NULL,'POST',810,'ACTIVE',1,0),
(5117111,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:finance-adjust','采购财务调整',NULL,'POST',811,'ACTIVE',1,0),
(5117112,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:estimate','采购预估运费核对',NULL,'POST',812,'ACTIVE',1,0),
(5117113,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:apply-label','采购逐箱贴单',NULL,'POST',813,'ACTIVE',1,0),
(5117114,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:ship-overseas','采购海外整批交寄',NULL,'POST',814,'ACTIVE',1,0),
(5117115,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:ship-customer','采购国内寄客户',NULL,'POST',815,'ACTIVE',1,0);
INSERT INTO iam_role_permission(tenant_id,role_id,permission_id,created_at)
SELECT 0,r.id,p.id,NOW(3) FROM iam_role r JOIN iam_permission p
ON p.tenant_id=0 AND p.app_code='PLATFORM' AND p.permission_code IN
('platform:overseas-business:purchase:buy','platform:overseas-business:purchase:cancel',
'platform:overseas-business:purchase:receive-overseas','platform:overseas-business:purchase:receive-domestic',
'platform:overseas-business:purchase:pack','platform:overseas-business:purchase:manage',
'platform:overseas-business:purchase:label','platform:overseas-business:purchase:charge','platform:overseas-business:purchase:finance-adjust',
'platform:overseas-business:purchase:estimate','platform:overseas-business:purchase:apply-label',
'platform:overseas-business:purchase:ship-overseas','platform:overseas-business:purchase:ship-customer')
WHERE r.tenant_id=0 AND r.app_code='PLATFORM' AND UPPER(r.role_code) IN('PLATFORM_ADMIN','PLATFORM_CUSTOM_ADMIN')
AND r.status='ACTIVE' AND r.deleted=0;
SELECT 'PASS' AS initialization_status, 'CN' AS region, 226 AS initialized_tables; SELECT 'PASS' AS initialization_status, 'CN' AS region, 226 AS initialized_tables;
+403 -42
View File
@@ -805,6 +805,7 @@ CREATE TABLE ll_finance_fee_source (
paid_at datetime(3) DEFAULT NULL COMMENT '直接已付时间', paid_at datetime(3) DEFAULT NULL COMMENT '直接已付时间',
payment_method varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '直接已付方式', payment_method varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '直接已付方式',
payment_reference_no varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '直接已付流水号', payment_reference_no varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '直接已付流水号',
wallet_settlement json DEFAULT NULL COMMENT '已实扣应收的Finance资金命令、冻结和消费流水引用',
payment_voucher_file_ids json DEFAULT NULL COMMENT '直接已付凭证文件ID快照', payment_voucher_file_ids json DEFAULT NULL COMMENT '直接已付凭证文件ID快照',
business_date date NOT NULL COMMENT '费用业务日期', business_date date NOT NULL COMMENT '费用业务日期',
currency char(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CNY' COMMENT '财务结算币种,固定CNY', currency char(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CNY' COMMENT '财务结算币种,固定CNY',
@@ -844,40 +845,66 @@ CREATE TABLE ll_finance_fee_source (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='海外业务不可变费用来源版本;发布后经跨区事件进入Finance'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='海外业务不可变费用来源版本;发布后经跨区事件进入Finance';
CREATE TABLE ll_inbound_fba_appointment ( CREATE TABLE ll_inbound_fba_appointment (
id bigint NOT NULL COMMENT '主键ID', id BIGINT NOT NULL COMMENT '主键ID',
appointment_no varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '预约单号', appointment_no VARCHAR(64) NOT NULL COMMENT '系统预约业务单号,不是外部约号',
appointment_at datetime(3) NOT NULL COMMENT '预约时间', confirmation_no VARCHAR(128) NULL COMMENT '收货方正式外部确认号',
appointment_end_at DATETIME(3) NULL COMMENT '预约结束时间,未明确时为空', planned_date DATE NULL COMMENT '计划当地日期,可只有日期而无时段',
planned_at DATETIME(3) NULL COMMENT '计划开始当地时间,待定可空',
planned_end_at DATETIME(3) NULL COMMENT '计划结束当地时间',
appointment_at DATETIME(3) NULL COMMENT '对方确认开始当地时间',
appointment_end_at DATETIME(3) NULL COMMENT '对方确认结束当地时间',
appointment_start_utc DATETIME(3) NULL COMMENT '确认开始UTC时间点',
appointment_end_utc DATETIME(3) NULL COMMENT '确认结束UTC时间点',
timezone VARCHAR(64) NULL COMMENT '目的仓权威IANA时区,未维护不得确认',
origin_warehouse_id VARCHAR(64) NOT NULL COMMENT '实际起运仓',
version INT NOT NULL DEFAULT 0 COMMENT '并发版本', version INT NOT NULL DEFAULT 0 COMMENT '并发版本',
expected_loading_at datetime(3) NOT NULL COMMENT '预计装车时间', appointment_status VARCHAR(32) NOT NULL DEFAULT 'PENDING' COMMENT 'PENDING安排/SUCCESS对方确认/FAILED/CANCELLED',
appointment_status varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING' COMMENT '预约状态', appointment_remark VARCHAR(1000) NULL COMMENT '备注或取消原因',
appointment_remark varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '预约备注', fba_warehouse_code VARCHAR(128) NOT NULL COMMENT 'FBA目的仓编码',
fba_warehouse_code varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'FBA仓库编码', selected_count INT NOT NULL DEFAULT 0 COMMENT '真实货源票数',
selected_count int NOT NULL DEFAULT '0' COMMENT '已选明细数量', created_by VARCHAR(128) NOT NULL COMMENT '登录操作人',
created_by varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '创建人ID', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建UTC时间',
created_at datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间', updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '更新UTC时间',
updated_at datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE KEY uk_ll_fba_appointment_no (appointment_no), UNIQUE KEY uk_ll_fba_appointment_no (appointment_no),
KEY idx_ll_fba_appointment_list (appointment_at,appointment_status,fba_warehouse_code) UNIQUE KEY uk_ll_fba_external_confirmation (fba_warehouse_code,confirmation_no),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='FBA入仓预约单'; KEY idx_ll_fba_appointment_list (appointment_at,appointment_status,fba_warehouse_code),
KEY idx_ll_fba_appointment_planned (planned_at,appointment_status)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='FBA预约安排与正式确认唯一主记录';
CREATE TABLE ll_inbound_fba_appointment_item ( CREATE TABLE ll_inbound_fba_appointment_item (
id bigint NOT NULL COMMENT '主键ID', id BIGINT NOT NULL COMMENT '记录主键',
appointment_id bigint NOT NULL COMMENT '预约单ID', appointment_id BIGINT NOT NULL COMMENT '预约主记录标识',
customer_id varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '本票货物客户ID', source_key VARCHAR(160) NOT NULL COMMENT '稳定ORDER或BOOKING货源键',
plan_id bigint NOT NULL COMMENT '入仓计划ID', source_version VARCHAR(160) NULL COMMENT '保存时核实的来源版本',
line_id bigint NOT NULL COMMENT '入仓计划明细ID', customer_id VARCHAR(128) NOT NULL COMMENT '本票所属客户',
order_id bigint NOT NULL COMMENT '订单ID', order_id BIGINT NULL COMMENT '尚未形成尾程订单时为空',
inbound_code varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '入仓单号快照', inbound_code VARCHAR(128) NULL COMMENT '真实入仓码,不伪造',
fba_warehouse_code varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'FBA仓库编码', fba_warehouse_code VARCHAR(128) NOT NULL COMMENT '目的FBA仓编码',
created_at datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间', package_count INT NULL COMMENT '所选整票预报箱数,未知保持空',
active TINYINT(1) NOT NULL DEFAULT 1 COMMENT '取消或失败后释放货源占用',
active_source_key VARCHAR(160) GENERATED ALWAYS AS (CASE WHEN active=1 THEN source_key ELSE NULL END) STORED COMMENT '有效货源唯一占用键',
active_order_id BIGINT GENERATED ALWAYS AS (CASE WHEN active=1 THEN order_id ELSE NULL END) STORED COMMENT '有效订单唯一占用键',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建UTC时间',
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE KEY uk_ll_fba_appointment_item_line (appointment_id,line_id), UNIQUE KEY uk_ll_fba_item_source (appointment_id,source_key),
KEY idx_ll_fba_appointment_item_cargo (line_id,appointment_id), UNIQUE KEY uk_ll_fba_active_source (active_source_key),
KEY idx_ll_fba_appointment_item_plan (plan_id), UNIQUE KEY uk_ll_fba_active_order (active_order_id),
KEY idx_ll_fba_appointment_item_order (order_id) KEY idx_ll_fba_item_source_lookup (source_key,customer_id),
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='FBA入仓预约明细'; KEY idx_ll_fba_item_customer_order (customer_id,order_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='入仓前后共用的预约真实货源';
CREATE TABLE ll_fba_appointment_command (
command_key VARCHAR(128) NOT NULL COMMENT '持久化幂等键',
request_hash CHAR(64) NOT NULL COMMENT '操作、操作者和请求摘要',
operation VARCHAR(96) NOT NULL COMMENT '操作类型及目标业务号',
operator_id VARCHAR(128) NOT NULL COMMENT '登录操作人',
appointment_no VARCHAR(64) NULL COMMENT '系统预约业务单号',
response_json LONGTEXT NULL COMMENT '原命令返回快照,与业务写入同事务',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建UTC时间',
PRIMARY KEY(command_key),
KEY idx_ll_fba_command_appointment(appointment_no,created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='预约命令与变更历史';
CREATE TABLE ll_inbound_order ( CREATE TABLE ll_inbound_order (
id bigint NOT NULL COMMENT '入仓单主键', id bigint NOT NULL COMMENT '入仓单主键',
@@ -1479,6 +1506,30 @@ CREATE TABLE ll_order (
KEY idx_ll_order_container_progress (source_container_booking_id,estimated_warehouse_at,created_at,id) KEY idx_ll_order_container_progress (source_container_booking_id,estimated_warehouse_at,created_at,id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='尾程订单主表'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='尾程订单主表';
CREATE TABLE ll_appointment_followup (
id BIGINT NOT NULL COMMENT '预约筹划跟进记录ID',
source_key VARCHAR(160) NOT NULL COMMENT '稳定ORDER、BOOKING或CONTAINER及接仓点来源键',
customer_id VARCHAR(128) NOT NULL COMMENT '货源客户;整柜共享记录由服务端固定为平台作用域0',
source_order_id BIGINT NULL COMMENT '已形成的真实尾程货源ID,尚未生成时为空',
stage VARCHAR(32) NOT NULL COMMENT '跟进对象:DRAYAGE_CONTACT/TERMINAL_APPOINTMENT/WAREHOUSE_RECEIVING/FBA_RECEIVING',
version INT NOT NULL COMMENT '同一货源及跟进对象的记录版本',
contacted_party VARCHAR(200) NULL COMMENT '本次联系对象,不替代承运主档',
result VARCHAR(1000) NOT NULL COMMENT '本次反馈事实,不自动确认预约或推进实物作业',
next_action VARCHAR(500) NULL COMMENT '下一步安排',
followup_date DATE NULL COMMENT '按业务地点当地日期记录的下次跟进日',
operator_id VARCHAR(128) NOT NULL COMMENT '登录平台操作者ID',
operator_name VARCHAR(200) NULL COMMENT '操作人姓名快照',
command_key VARCHAR(64) NOT NULL COMMENT '持久幂等键',
request_hash CHAR(64) NOT NULL COMMENT '含操作者身份的请求SHA256摘要',
created_at DATETIME(3) NOT NULL COMMENT 'UTC记录时间',
PRIMARY KEY (id),
UNIQUE KEY uk_appointment_followup_version (source_key,stage,version),
UNIQUE KEY uk_appointment_followup_command (source_key,stage,command_key),
KEY idx_appointment_followup_date (followup_date,source_order_id),
CONSTRAINT fk_appointment_followup_order FOREIGN KEY (source_order_id) REFERENCES ll_order(id),
CONSTRAINT chk_appointment_followup_stage CHECK (stage IN ('DRAYAGE_CONTACT','TERMINAL_APPOINTMENT','WAREHOUSE_RECEIVING','FBA_RECEIVING'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='真实在途货源的预约筹划联系记录,追加留痕';
CREATE TABLE ll_order_command_record ( CREATE TABLE ll_order_command_record (
id bigint NOT NULL COMMENT '尾程订单命令幂等记录ID', id bigint NOT NULL COMMENT '尾程订单命令幂等记录ID',
customer_id varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户数据隔离键', customer_id varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户数据隔离键',
@@ -1716,6 +1767,24 @@ CREATE TABLE ll_outbound_pda_task (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='一件代发出库PDA拣货任务'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='一件代发出库PDA拣货任务';
CREATE TABLE ll_overseas_procurement_fee ( CREATE TABLE ll_overseas_procurement_fee (
purpose VARCHAR(32) NULL COMMENT '费用业务用途;由履约节点确定',
confirmation_origin VARCHAR(16) NOT NULL DEFAULT 'BUSINESS' COMMENT '核定入口:BUSINESS业务节点、FINANCIAL财务操作',
fee_version INT NULL COMMENT '同用途费用确认版本',
active TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否当前有效版本',
determination VARCHAR(24) NULL COMMENT 'POSITIVE正额、ZERO零元、NOT_APPLICABLE不适用',
original_currency CHAR(3) NULL COMMENT '核定原币CNY或USD',
original_amount DECIMAL(20,2) NULL COMMENT '核定原币金额',
exchange_rate DECIMAL(20,6) NULL COMMENT '已确认汇率快照',
exchange_rate_month CHAR(7) NULL COMMENT '已确认汇率所属月份',
business_date DATE NULL COMMENT '实际费用业务日期',
wallet_business_id BIGINT NULL COMMENT '资金冻结对应采购费用记录',
wallet_business_no VARCHAR(128) NULL COMMENT '资金冻结业务号;实际国际运费引用原预估',
wallet_hold_id VARCHAR(64) NULL COMMENT 'Finance冻结引用',
wallet_ledger_id VARCHAR(64) NULL COMMENT 'Finance实际处理流水引用',
settled_command_event_id VARCHAR(64) NULL COMMENT '成功实扣或退款的资金命令事件',
source_fee_id BIGINT NULL COMMENT '已实扣费用来源ID',
parent_fee_id BIGINT NULL COMMENT '原费用或预估引用',
request_hash CHAR(64) NULL COMMENT '确认请求摘要',
id bigint NOT NULL COMMENT '主键ID', id bigint NOT NULL COMMENT '主键ID',
order_id bigint NOT NULL COMMENT '采购订单ID', order_id bigint NOT NULL COMMENT '采购订单ID',
customer_id varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户ID', customer_id varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户ID',
@@ -1724,8 +1793,8 @@ CREATE TABLE ll_overseas_procurement_fee (
fee_item_name varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '费用项名称', fee_item_name varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '费用项名称',
amount decimal(20,2) NOT NULL COMMENT 'CNY金额', amount decimal(20,2) NOT NULL COMMENT 'CNY金额',
currency char(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CNY' COMMENT '费用币种', currency char(3) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'CNY' COMMENT '费用币种',
voucher_file_id bigint NOT NULL COMMENT '凭证文件ID', voucher_file_id bigint NULL COMMENT '凭证文件ID',
voucher_file_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '凭证文件名', voucher_file_name varchar(255) COLLATE utf8mb4_unicode_ci NULL COMMENT '凭证文件名',
remark varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '说明', remark varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '说明',
wallet_status varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '资金状态', wallet_status varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '资金状态',
wallet_error_code varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '资金错误码', wallet_error_code varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '资金错误码',
@@ -1734,10 +1803,12 @@ CREATE TABLE ll_overseas_procurement_fee (
created_by varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '登记人', created_by varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '登记人',
created_at datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间', created_at datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
updated_at datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间', updated_at datetime(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
CONSTRAINT chk_procurement_confirmation_origin CHECK(confirmation_origin IN('BUSINESS','FINANCIAL')),
UNIQUE KEY uk_ll_procurement_fee_version(order_id,purpose,fee_item_code,fee_version),
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE KEY uk_ll_procurement_fee_no (fee_no), UNIQUE KEY uk_ll_procurement_fee_no (fee_no),
KEY idx_ll_procurement_fee_order (customer_id,order_id,created_at), KEY idx_ll_procurement_fee_order (customer_id,order_id,created_at),
CONSTRAINT chk_ll_procurement_fee_amount CHECK ((amount > 0)), CONSTRAINT chk_ll_procurement_fee_amount CHECK ((amount >= 0)),
CONSTRAINT chk_ll_procurement_fee_currency CHECK ((currency = _utf8mb4'CNY')) CONSTRAINT chk_ll_procurement_fee_currency CHECK ((currency = _utf8mb4'CNY'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='海外采购费用明细及资金生命周期'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='海外采购费用明细及资金生命周期';
@@ -1745,7 +1816,7 @@ CREATE TABLE ll_overseas_procurement_file (
id bigint NOT NULL COMMENT '主键ID', id bigint NOT NULL COMMENT '主键ID',
order_id bigint NOT NULL COMMENT '采购订单ID', order_id bigint NOT NULL COMMENT '采购订单ID',
customer_id varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户ID', customer_id varchar(128) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '客户ID',
category varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'RECEIPT签收文件或VOUCHER费用凭证', category varchar(16) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'RECEIPT实收、VOUCHER费用、LABEL面单、PURCHASE采购、BUDGET预算、EXCEPTION异常凭证',
file_id bigint NOT NULL COMMENT 'File服务文件ID', file_id bigint NOT NULL COMMENT 'File服务文件ID',
file_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件名快照', file_name varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '文件名快照',
content_type varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '媒体类型', content_type varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '媒体类型',
@@ -1755,7 +1826,7 @@ CREATE TABLE ll_overseas_procurement_file (
PRIMARY KEY (id), PRIMARY KEY (id),
UNIQUE KEY uk_ll_procurement_file (order_id,file_id), UNIQUE KEY uk_ll_procurement_file (order_id,file_id),
KEY idx_ll_procurement_file_order (customer_id,order_id,category,created_at), KEY idx_ll_procurement_file_order (customer_id,order_id,category,created_at),
CONSTRAINT chk_ll_procurement_file_category CHECK ((category in (_utf8mb4'RECEIPT',_utf8mb4'VOUCHER'))) CONSTRAINT chk_ll_procurement_file_category CHECK (category IN ('RECEIPT','VOUCHER','LABEL','PURCHASE','BUDGET','EXCEPTION'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='海外采购签收文件及费用凭证'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='海外采购签收文件及费用凭证';
CREATE TABLE ll_overseas_procurement_order ( CREATE TABLE ll_overseas_procurement_order (
@@ -1775,12 +1846,7 @@ CREATE TABLE ll_overseas_procurement_order (
contact_phone varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '联系人电话', contact_phone varchar(64) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '联系人电话',
purchase_warehouse_id varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '采购入仓仓库ID', purchase_warehouse_id varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '采购入仓仓库ID',
purchase_warehouse_name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '采购入仓仓库名称', purchase_warehouse_name varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '采购入仓仓库名称',
outbound_details json DEFAULT NULL COMMENT '出库明细',
inbound_quantity bigint NOT NULL DEFAULT '0' COMMENT '采购单据累计入库数量', inbound_quantity bigint NOT NULL DEFAULT '0' COMMENT '采购单据累计入库数量',
domestic_carrier varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '境内承运商',
domestic_tracking_no varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '境内物流单号',
overseas_carrier varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '海外承运商',
overseas_tracking_no varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '海外物流单号',
estimated_arrival_at datetime(3) DEFAULT NULL COMMENT '预计到达时间', estimated_arrival_at datetime(3) DEFAULT NULL COMMENT '预计到达时间',
status varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING_REVIEW' COMMENT '业务状态', status varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'PENDING_REVIEW' COMMENT '业务状态',
remark varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注', remark varchar(1000) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '备注',
@@ -2312,7 +2378,7 @@ CREATE TABLE ll_return_inventory_outbound_movement (
carton_id BIGINT NOT NULL COMMENT '真实退货库存箱ID', carton_id BIGINT NOT NULL COMMENT '真实退货库存箱ID',
carton_mark VARCHAR(128) NOT NULL COMMENT '冻结的真实退货箱业务码', carton_mark VARCHAR(128) NOT NULL COMMENT '冻结的真实退货箱业务码',
outbound_no VARCHAR(64) NOT NULL COMMENT '本次退货出库业务单号', outbound_no VARCHAR(64) NOT NULL COMMENT '本次退货出库业务单号',
sku_code VARCHAR(128) NOT NULL COMMENT '本次出库SKU编码快照', sku_code VARCHAR(128) NOT NULL COMMENT '本次出库SKU编码快照', return_sku_quantity BIGINT NULL COMMENT '退货单SKU本来源计划出库件数快照,NULL为历史整箱出库',
product_name_zh VARCHAR(255) NULL COMMENT '中文品名快照', product_name_zh VARCHAR(255) NULL COMMENT '中文品名快照',
quantity BIGINT NOT NULL COMMENT '本箱该SKU实际出库件数,始终为正', quantity BIGINT NOT NULL COMMENT '本箱该SKU实际出库件数,始终为正',
total_before BIGINT NOT NULL COMMENT '客户仓SKU出库前实物总数量', total_before BIGINT NOT NULL COMMENT '客户仓SKU出库前实物总数量',
@@ -2324,11 +2390,11 @@ CREATE TABLE ll_return_inventory_outbound_movement (
occurred_at DATETIME(3) NOT NULL COMMENT '出库记账时间', occurred_at DATETIME(3) NOT NULL COMMENT '出库记账时间',
PRIMARY KEY(id), PRIMARY KEY(id),
UNIQUE KEY uk_ll_return_outbound_pick_sku(outbound_pick_id,sku_code), UNIQUE KEY uk_ll_return_outbound_pick_sku(outbound_pick_id,sku_code),
UNIQUE KEY uk_ll_return_outbound_carton_sku(customer_id,carton_id,sku_code), KEY idx_ll_return_outbound_carton_sku(customer_id,carton_id,sku_code),
KEY idx_ll_return_outbound_movement_query(customer_id,overseas_warehouse_id,sku_code,occurred_at), KEY idx_ll_return_outbound_movement_query(customer_id,overseas_warehouse_id,sku_code,occurred_at),
CONSTRAINT chk_ll_return_outbound_movement_delta CHECK(quantity>0 AND total_after>=0 AND available_after>=0 CONSTRAINT chk_ll_return_outbound_movement_delta CHECK(quantity>0 AND total_after>=0 AND available_after>=0
AND total_before-total_after=quantity AND available_before-available_after=quantity AND total_before-total_after=quantity AND available_before-available_after=quantity
AND cartons_after>=0 AND cartons_before-cartons_after=1 AND total_after>=available_after) AND cartons_after>=0 AND cartons_before-cartons_after IN (0,1) AND total_after>=available_after)
) ENGINE=InnoDB COMMENT='不可变退货出库SKU库存流水'; ) ENGINE=InnoDB COMMENT='不可变退货出库SKU库存流水';
CREATE TABLE ll_return_inventory_balance ( CREATE TABLE ll_return_inventory_balance (
@@ -2365,6 +2431,9 @@ CREATE TABLE ll_return_inventory_carton (
relabel_status varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '换标状态', relabel_status varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '换标状态',
relabel_completed_at datetime(3) DEFAULT NULL COMMENT '换标完成时间', relabel_completed_at datetime(3) DEFAULT NULL COMMENT '换标完成时间',
status varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'AVAILABLE可用或MERGED已合箱', status varchar(32) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'AVAILABLE可用或MERGED已合箱',
count_status VARCHAR(16) NOT NULL DEFAULT 'CONFIRMED' COMMENT '箱内清点状态 PENDING待清点 CONFIRMED已确认',
counted_at DATETIME(3) NULL COMMENT '箱内清点确认时间',
counted_by VARCHAR(128) NULL COMMENT '箱内清点确认操作人',
sku_types int NOT NULL COMMENT '箱内SKU种类数', sku_types int NOT NULL COMMENT '箱内SKU种类数',
total_quantity bigint NOT NULL COMMENT '箱内总件数', total_quantity bigint NOT NULL COMMENT '箱内总件数',
length decimal(12,3) DEFAULT NULL COMMENT '箱长CM', length decimal(12,3) DEFAULT NULL COMMENT '箱长CM',
@@ -2375,6 +2444,7 @@ CREATE TABLE ll_return_inventory_carton (
updated_at datetime(3) NOT NULL COMMENT '最后更新时间', updated_at datetime(3) NOT NULL COMMENT '最后更新时间',
merged_at datetime(3) DEFAULT NULL COMMENT '合箱完成时间', merged_at datetime(3) DEFAULT NULL COMMENT '合箱完成时间',
PRIMARY KEY (id), PRIMARY KEY (id),
KEY idx_ll_return_count (overseas_warehouse_id,count_status,status,source_receipt_id),
UNIQUE KEY uk_ll_return_inventory_carton_mark (carton_mark), UNIQUE KEY uk_ll_return_inventory_carton_mark (carton_mark),
KEY idx_ll_return_inventory_carton_customer (customer_id,overseas_warehouse_id,status,created_at), KEY idx_ll_return_inventory_carton_customer (customer_id,overseas_warehouse_id,status,created_at),
CONSTRAINT chk_ll_return_inventory_carton_quantity CHECK((status IN('AVAILABLE','PACKING_RESERVED','RELABEL_PENDING','OUTBOUND_PENDING','OUTBOUNDED','DISCARD_PENDING') AND sku_types>0 AND total_quantity>0) OR (status IN('MERGED','DISCARDED') AND sku_types=0 AND total_quantity=0)), CONSTRAINT chk_ll_return_inventory_carton_quantity CHECK((status IN('AVAILABLE','PACKING_RESERVED','RELABEL_PENDING','OUTBOUND_PENDING','OUTBOUNDED','DISCARD_PENDING') AND sku_types>0 AND total_quantity>0) OR (status IN('MERGED','DISCARDED') AND sku_types=0 AND total_quantity=0)),
@@ -3586,4 +3656,295 @@ CREATE TABLE event_delivery_attempt (
KEY idx_delivery_attempt_outcome (outcome,started_at) KEY idx_delivery_attempt_outcome (outcome,started_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='本服务业务事件逐次投递审计'; ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='本服务业务事件逐次投递审计';
SELECT 'PASS' AS initialization_status, 'OVERSEAS' AS region, 159 AS initialized_tables; CREATE TABLE ll_return_carton_count_session (
operator_id VARCHAR(128) NOT NULL COMMENT '平台PDA操作员标识',
warehouse_id VARCHAR(128) NOT NULL COMMENT '认领时绑定海外仓标识',
receipt_id BIGINT NULL COMMENT '正在清点的签收批次,完成后释放为NULL',
started_at DATETIME(3) NULL COMMENT '本次开始清点时间',
created_at DATETIME(3) NOT NULL COMMENT '会话创建时间',
updated_at DATETIME(3) NOT NULL COMMENT '会话更新时间',
PRIMARY KEY(operator_id),
UNIQUE KEY uk_ll_return_count_session_receipt(receipt_id)
) ENGINE=InnoDB COMMENT='退货箱内清点单人单任务持久会话';
CREATE TABLE ll_procurement_wallet_attempt (
id BIGINT NOT NULL COMMENT '请求尝试ID',
order_id BIGINT NOT NULL COMMENT '采购订单ID',
customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
fee_id BIGINT NOT NULL COMMENT '不可变费用版本ID',
attempt_no BIGINT NOT NULL COMMENT '费用版本内请求序号',
operation VARCHAR(32) NOT NULL COMMENT '资金操作:FREEZE冻结、SETTLE结算、SETTLE_ACTUAL实际结算、RELEASE释放、REFUND退款',
business_no VARCHAR(128) NOT NULL COMMENT 'Finance资金业务号',
amount DECIMAL(20,2) NULL COMMENT '请求金额;全额结算或释放可空',
command_event_id VARCHAR(64) NOT NULL COMMENT '资金指令事件唯一引用',
status VARCHAR(16) NOT NULL COMMENT '资金请求结果:PENDING未决、SUCCEEDED成功、FAILED明确失败',
result_hash CHAR(64) NULL COMMENT '原业务回执摘要',
wallet_hold_id VARCHAR(64) NULL COMMENT 'Finance冻结引用',
wallet_ledger_id VARCHAR(64) NULL COMMENT 'Finance处理流水引用',
error_code VARCHAR(64) NULL COMMENT '业务失败码',
error_message VARCHAR(500) NULL COMMENT '内部失败诊断,不直接对客展示',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '请求时间',
completed_at DATETIME(3) NULL COMMENT '最终结果时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_attempt_event(command_event_id),
UNIQUE KEY uk_procurement_attempt_number(fee_id,attempt_no),
KEY idx_procurement_attempt_order(customer_id,order_id,status),
CONSTRAINT chk_procurement_attempt_status CHECK(status IN('PENDING','SUCCEEDED','FAILED'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购费用资金命令尝试与不可变结果';
-- 采购节点事实与操作幂等;不补写历史订单的购买、授权或收货事实。
CREATE TABLE ll_procurement_flow (
order_id BIGINT NOT NULL COMMENT '采购订单ID,一单一个履约批次',
customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
purchased_at DATETIME(3) NULL COMMENT '真实购买时间',
purchased_product_name VARCHAR(255) NULL COMMENT '实际购买商品',
purchased_specification VARCHAR(500) NULL COMMENT '实际购买规格',
purchased_quantity BIGINT NULL COMMENT '实际购买件数',
purchase_amount DECIMAL(20,2) NULL COMMENT '供应商实付原币金额',
purchase_currency CHAR(3) NULL COMMENT '供应商实付原币CNY或USD',
purchase_voucher_id BIGINT NULL COMMENT '购买凭证引用',
purchase_issue VARCHAR(500) NULL COMMENT '购买未核定或异常说明',
purchase_confirmed_at DATETIME(3) NULL COMMENT '货款核定时间,不代表扣费成功',
actual_warehouse_id BIGINT NULL COMMENT '首次实际收货冻结的仓库ID',
actual_warehouse_code VARCHAR(128) NULL COMMENT '实际收货仓编码快照',
actual_warehouse_name VARCHAR(255) NULL COMMENT '实际收货仓名称快照',
overseas_received_at DATETIME(3) NULL COMMENT '海外整批收货完成时间',
packing_version INT NULL COMMENT '当前确认装箱清单版本',
overseas_shipped_at DATETIME(3) NULL COMMENT '国际段整批实际交寄时间',
domestic_received_at DATETIME(3) NULL COMMENT '国内整批收货完成时间',
charges_confirmed_at DATETIME(3) NULL COMMENT '国内整单费用核定时间',
customer_shipped_at DATETIME(3) NULL COMMENT '国内寄客户实际交寄时间',
domestic_receiver_name VARCHAR(128) NULL COMMENT '国际段国内收件人',
domestic_receiver_phone VARCHAR(64) NULL COMMENT '国际段国内收件电话',
domestic_receiver_address VARCHAR(1000) NULL COMMENT '国际段国内接收地址',
cancelled_at DATETIME(3) NULL COMMENT '购买前取消时间',
closed_at DATETIME(3) NULL COMMENT '异常关闭时间',
control_reason VARCHAR(1000) NULL COMMENT '取消或关闭原因',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '创建时间',
updated_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) ON UPDATE CURRENT_TIMESTAMP(3) COMMENT '更新时间',
PRIMARY KEY(order_id), KEY idx_procurement_flow_customer(customer_id,order_id),
CONSTRAINT chk_procurement_purchase_quantity CHECK(purchased_quantity IS NULL OR purchased_quantity>0),
CONSTRAINT chk_procurement_purchase_amount CHECK(purchase_amount IS NULL OR purchase_amount>=0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购单一批次履约事实';
CREATE TABLE ll_procurement_command (
id BIGINT NOT NULL COMMENT '操作记录ID', order_id BIGINT NOT NULL COMMENT '采购订单ID',
customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键', action VARCHAR(48) NOT NULL COMMENT '采购节点动作',
idempotency_key VARCHAR(128) NOT NULL COMMENT '操作幂等键', request_hash CHAR(64) NOT NULL COMMENT '请求摘要',
operator_id VARCHAR(128) NOT NULL COMMENT '执行人', reason VARCHAR(1000) NOT NULL COMMENT '操作依据',
detail_json JSON NOT NULL COMMENT '内部操作及更正依据快照,不直接对客展示',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '执行时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_command(order_id,action,idempotency_key),
KEY idx_procurement_command_customer(customer_id,order_id,created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购节点幂等与不可变审计';
CREATE TABLE ll_procurement_budget_authorization (
id BIGINT NOT NULL COMMENT '预算授权ID', order_id BIGINT NOT NULL COMMENT '采购订单ID',
customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
previous_amount DECIMAL(20,2) NULL COMMENT '原货款预算总上限;未授权保持空', previous_currency CHAR(3) NOT NULL COMMENT '原预算币种',
authorized_amount DECIMAL(20,2) NOT NULL COMMENT '客户授权的新货款总上限', currency CHAR(3) NOT NULL COMMENT '客户授权币种',
voucher_file_id BIGINT NOT NULL COMMENT '客户确认书面或聊天凭证', reason VARCHAR(1000) NOT NULL COMMENT '授权依据',
reviewed_by VARCHAR(128) NOT NULL COMMENT '核验人员', reviewed_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '核验时间',
PRIMARY KEY(id), KEY idx_procurement_budget_order(customer_id,order_id,id),
CONSTRAINT chk_procurement_budget_amount CHECK(authorized_amount>=0 AND previous_amount>=0),
CONSTRAINT chk_procurement_budget_currency CHECK(currency IN('CNY','USD') AND previous_currency IN('CNY','USD'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购货款预算授权核验历史';
-- 采购实收、差异、装箱和两段整批发运事实。不产生WMS库存流水,不回填历史采购数量。
CREATE TABLE ll_procurement_receipt (
id BIGINT NOT NULL COMMENT '实收明细ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
receipt_no VARCHAR(64) NOT NULL COMMENT '采购收货业务编号', leg VARCHAR(16) NOT NULL COMMENT 'OVERSEAS海外或DOMESTIC国内',
source_carton_id BIGINT NULL COMMENT '国内实收关联原国际交寄箱,海外为空', warehouse_id BIGINT NULL COMMENT '海外实际收货仓',
good_quantity BIGINT NOT NULL COMMENT '可发合格件数', damaged_quantity BIGINT NOT NULL COMMENT '破损待处置件数', extra_quantity BIGINT NOT NULL COMMENT '多到件数,不增加可发数量',
received_at DATETIME(3) NOT NULL COMMENT '实际收货时间', active TINYINT(1) NOT NULL DEFAULT 1 COMMENT '当前有效实收事实',
supersedes_id BIGINT NULL COMMENT '受控更正所替代的原实收记录', created_by VARCHAR(128) NOT NULL COMMENT '登记人员',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '登记时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_receipt_no(receipt_no), KEY idx_procurement_receipt_source(order_id,leg,source_carton_id,active),
CONSTRAINT chk_procurement_receipt_quantity CHECK(good_quantity>=0 AND damaged_quantity>=0 AND extra_quantity>=0 AND good_quantity+damaged_quantity+extra_quantity>0),
CONSTRAINT chk_procurement_receipt_leg CHECK((leg='OVERSEAS' AND source_carton_id IS NULL) OR (leg='DOMESTIC' AND source_carton_id IS NOT NULL))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购分次实收与受控更正事实';
CREATE TABLE ll_procurement_disposition (
id BIGINT NOT NULL COMMENT '差异处理ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
leg VARCHAR(16) NOT NULL COMMENT 'OVERSEAS海外或DOMESTIC国内', source_carton_id BIGINT NULL COMMENT '国内原交寄箱来源',
receipt_id BIGINT NULL COMMENT '破损或多货对应实收记录,短少为空', kind VARCHAR(24) NOT NULL COMMENT 'SHORTAGE短少、DAMAGED破损、EXTRA多货',
quantity BIGINT NOT NULL COMMENT '已批准处置件数', decision VARCHAR(32) NOT NULL COMMENT 'ACCEPT_SHORTAGE确认短少、DISPOSE_DAMAGED拒收或处置、RETURN_EXTRA退回多货',
active TINYINT(1) NOT NULL DEFAULT 1 COMMENT '当前有效处置;撤销只改变有效性并保留原事实',
voucher_file_id BIGINT NOT NULL COMMENT '本单客户确认或实际处置凭证', reason VARCHAR(1000) NOT NULL COMMENT '处置依据',
created_by VARCHAR(128) NOT NULL COMMENT '采购管理人员', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '确认时间',
PRIMARY KEY(id), KEY idx_procurement_disposition_source(order_id,leg,source_carton_id,receipt_id,kind),
CONSTRAINT chk_procurement_disposition_quantity CHECK(quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购单内差异处置,不自动退款';
CREATE TABLE ll_procurement_manifest (
id BIGINT NOT NULL COMMENT '装箱清单ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
version INT NOT NULL COMMENT '订单内装箱版本', status VARCHAR(16) NOT NULL COMMENT 'DRAFT草稿、CONFIRMED已确认、SUPERSEDED已替代',
confirmed_at DATETIME(3) NULL COMMENT '确认时间', created_by VARCHAR(128) NOT NULL COMMENT '制单人',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '版本保存时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_manifest_version(order_id,version),
CONSTRAINT chk_procurement_manifest_status CHECK(status IN('DRAFT','CONFIRMED','SUPERSEDED'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购装箱清单不可变版本';
CREATE TABLE ll_procurement_carton (
id BIGINT NOT NULL COMMENT '版本内箱记录ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', manifest_id BIGINT NOT NULL COMMENT '装箱清单版本',
carton_no VARCHAR(64) NOT NULL COMMENT '采购订单内业务箱号', length_cm DECIMAL(12,2) NOT NULL COMMENT '外箱长厘米',
width_cm DECIMAL(12,2) NOT NULL COMMENT '外箱宽厘米', height_cm DECIMAL(12,2) NOT NULL COMMENT '外箱高厘米',
gross_weight_kg DECIMAL(12,3) NOT NULL COMMENT '封箱毛重千克', quantity BIGINT NOT NULL COMMENT '本箱合格商品总件数',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_carton_version(manifest_id,carton_no), KEY idx_procurement_carton_order(order_id,manifest_id),
CONSTRAINT chk_procurement_carton_measurement CHECK(length_cm>0 AND width_cm>0 AND height_cm>0 AND gross_weight_kg>0 AND quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购版本化逐箱实测与件数';
CREATE TABLE ll_procurement_carton_source (
carton_id BIGINT NOT NULL COMMENT '版本内箱ID', receipt_id BIGINT NOT NULL COMMENT '海外实收明细来源', quantity BIGINT NOT NULL COMMENT '从该实收装入本箱的件数',
PRIMARY KEY(carton_id,receipt_id), KEY idx_procurement_carton_receipt(receipt_id), CONSTRAINT chk_procurement_carton_source_quantity CHECK(quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购箱内货物的实收来源与数量';
CREATE TABLE ll_procurement_shipment (
id BIGINT NOT NULL COMMENT '采购交寄ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
shipment_no VARCHAR(64) NOT NULL COMMENT '交寄业务编号', leg VARCHAR(16) NOT NULL COMMENT 'OVERSEAS国际交寄或DOMESTIC寄客户',
manifest_id BIGINT NOT NULL COMMENT '原海外装箱清单版本', shipped_at DATETIME(3) NOT NULL COMMENT '整批真实交承运方时间',
address_snapshot JSON NOT NULL COMMENT '本段交寄时的收寄姓名电话地址快照', created_by VARCHAR(128) NOT NULL COMMENT '交寄确认人',
created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '确认时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_shipment_leg(order_id,leg), UNIQUE KEY uk_procurement_shipment_no(shipment_no),
CONSTRAINT chk_procurement_shipment_leg CHECK(leg IN('OVERSEAS','DOMESTIC'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购两段各一次整批真实交寄';
CREATE TABLE ll_procurement_shipment_item (
shipment_id BIGINT NOT NULL COMMENT '采购交寄ID', carton_id BIGINT NOT NULL COMMENT '原海外装箱版本内箱ID', quantity BIGINT NOT NULL COMMENT '本次实际交寄件数',
carrier VARCHAR(128) NOT NULL COMMENT '承运商快照', tracking_no VARCHAR(128) NOT NULL COMMENT '运单号快照',
label_snapshot JSON NOT NULL COMMENT '当次箱规、面单及货物来源快照',
PRIMARY KEY(shipment_id,carton_id), CONSTRAINT chk_procurement_shipment_item_quantity CHECK(quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购整批交寄逐箱事实';
USE baiyue_lastleg;
-- 采购面单、逐箱贴单、预估核对与国内一对一换包装;不重建历史发运事实。
CREATE TABLE ll_procurement_label_set (
id BIGINT NOT NULL COMMENT '面单批版本ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
leg VARCHAR(16) NOT NULL COMMENT 'OVERSEAS国际段或DOMESTIC寄客户段', version INT NOT NULL COMMENT '订单段内面单版本',
manifest_id BIGINT NOT NULL COMMENT '原海外确认装箱版本', cargo_hash CHAR(64) NOT NULL COMMENT '箱规及有效货物来源摘要',
sender_snapshot JSON NOT NULL COMMENT '寄件人姓名电话地址快照', receiver_snapshot JSON NOT NULL COMMENT '收件人姓名电话地址快照',
created_by VARCHAR(128) NOT NULL COMMENT '制单操作人', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '上传确认时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_label_version(order_id,leg,version),
CONSTRAINT chk_procurement_label_leg CHECK(leg IN('OVERSEAS','DOMESTIC'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购两段面单不可变版本和地址快照';
CREATE TABLE ll_procurement_label_item (
label_set_id BIGINT NOT NULL COMMENT '面单批版本ID', carton_id BIGINT NOT NULL COMMENT '原海外清单箱ID',
file_id BIGINT NOT NULL COMMENT '本采购订单面单文件', page_no INT NOT NULL COMMENT '该箱对应文件页码,从1开始',
carrier VARCHAR(128) NOT NULL COMMENT '承运商', tracking_no VARCHAR(128) NOT NULL COMMENT '箱主或子运单号',
applied_at DATETIME(3) NULL COMMENT '真实贴单时间', applied_by VARCHAR(128) NULL COMMENT '贴单确认人',
PRIMARY KEY(label_set_id,carton_id), CONSTRAINT chk_procurement_label_page CHECK(page_no>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购逐箱文件页关联及贴单事实';
CREATE TABLE ll_procurement_estimate_review (
id BIGINT NOT NULL COMMENT '预估核对ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', label_set_id BIGINT NOT NULL COMMENT '已核对国际面单版本',
fee_id BIGINT NOT NULL COMMENT '唯一有效预估费用版本', reviewed_by VARCHAR(128) NOT NULL COMMENT '核价人员',
reviewed_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '核对时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_estimate_review(label_set_id,fee_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='面单清单与预估冻结的显式核对关联';
CREATE TABLE ll_procurement_repack (
id BIGINT NOT NULL COMMENT '换包装版本ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', carton_id BIGINT NOT NULL COMMENT '原国际交寄箱ID,保持一对一来源',
length_cm DECIMAL(12,2) NOT NULL COMMENT '新外箱长厘米', width_cm DECIMAL(12,2) NOT NULL COMMENT '新外箱宽厘米',
height_cm DECIMAL(12,2) NOT NULL COMMENT '新外箱高厘米', gross_weight_kg DECIMAL(12,3) NOT NULL COMMENT '新封箱毛重千克',
voucher_file_id BIGINT NOT NULL COMMENT '本单换包装证据', reason VARCHAR(1000) NOT NULL COMMENT '换包装依据',
created_by VARCHAR(128) NOT NULL COMMENT '国内作业人员', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '登记时间',
PRIMARY KEY(id), KEY idx_procurement_repack_carton(order_id,carton_id,id),
CONSTRAINT chk_procurement_repack_measurement CHECK(length_cm>0 AND width_cm>0 AND height_cm>0 AND gross_weight_kg>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购国内原箱一对一换包装不可变历史';
USE baiyue_lastleg;
-- 费用链目标更正快照与关联;资金流水仍唯一归Finance,不回填旧费用。
CREATE TABLE ll_procurement_fee_correction (
id BIGINT NOT NULL COMMENT '费用链更正ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
correction_no VARCHAR(64) NOT NULL COMMENT '财务更正业务号', root_fee_id BIGINT NOT NULL COMMENT '原实际费用链根',
idempotency_key VARCHAR(128) NOT NULL COMMENT '本单更正请求幂等键', request_hash CHAR(64) NOT NULL COMMENT '更正目标及凭证请求摘要',
target_original_amount DECIMAL(20,2) NOT NULL COMMENT '本次正确原币总额', original_currency CHAR(3) NOT NULL COMMENT '沿用原费用币种',
exchange_rate DECIMAL(20,6) NOT NULL COMMENT '沿用原费用汇率快照', exchange_rate_month CHAR(7) NOT NULL COMMENT '原汇率月份,不取本次操作月份',
target_amount DECIMAL(20,2) NOT NULL COMMENT '正确总额折算CNY', previous_net_amount DECIMAL(20,2) NOT NULL COMMENT '确认前整链净实扣CNY',
difference_amount DECIMAL(20,2) NOT NULL COMMENT 'CNY正差额追加、负差额退款、零差额仅留核对记录',
voucher_file_id BIGINT NOT NULL COMMENT '本订单财务更正凭证', reason VARCHAR(500) NOT NULL COMMENT '更正依据',
created_by VARCHAR(128) NOT NULL COMMENT '授权财务操作人', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '确认时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_correction_no(correction_no), UNIQUE KEY uk_procurement_correction_request(order_id,idempotency_key),
KEY idx_procurement_correction_root(order_id,root_fee_id,id),
CONSTRAINT chk_procurement_correction_amount CHECK(target_original_amount>=0 AND target_amount>=0 AND previous_net_amount>=0 AND exchange_rate>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购费用链更正目标与原汇率快照';
CREATE TABLE ll_procurement_fee_correction_item (
correction_id BIGINT NOT NULL COMMENT '本次费用链更正ID', fee_id BIGINT NOT NULL COMMENT '本次产生的独立正差额或退款费用ID',
PRIMARY KEY(correction_id,fee_id), UNIQUE KEY uk_procurement_correction_fee(fee_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购费用目标更正与逐笔资金事实关联';
USE baiyue_lastleg;
-- 单采购订单内的更正说明、阻断异常与关闭证据。不生成WMS库存或退货运输任务。
CREATE TABLE ll_procurement_control_note (
id BIGINT NOT NULL COMMENT '采购更正说明ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
note_no VARCHAR(64) NOT NULL COMMENT '更正说明业务号', target_type VARCHAR(24) NOT NULL COMMENT '购买、仓库、实收或交寄事实类型',
target_id BIGINT NULL COMMENT '本单事实对象引用,购买为空', blocking TINYINT(1) NOT NULL COMMENT '是否阻断后续计划履约',
voucher_file_id BIGINT NOT NULL COMMENT '本单内部事实更正凭证', reason VARCHAR(1000) NOT NULL COMMENT '内部更正说明',
client_summary VARCHAR(500) NULL COMMENT '人工确认的对客摘要,不复制内部原始内容',
original_value_json JSON NULL COMMENT '服务端记录的原事实快照', corrected_value_json JSON NULL COMMENT '服务端记录的更正事实快照',
created_by VARCHAR(128) NOT NULL COMMENT '采购管理操作人', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '登记时间',
resolved_by VARCHAR(128) NULL COMMENT '处理确认人', resolved_at DATETIME(3) NULL COMMENT '阻断解除时间',
resolution_reason VARCHAR(1000) NULL COMMENT '内部处理结果', resolution_voucher_id BIGINT NULL COMMENT '本单处理凭证',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_note_no(note_no), KEY idx_procurement_note_block(order_id,blocking,resolved_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购不可覆盖事实的更正说明及阻断异常';
CREATE TABLE ll_procurement_closure (
id BIGINT NOT NULL COMMENT '采购异常关闭ID', order_id BIGINT NOT NULL COMMENT '采购订单ID', customer_id VARCHAR(128) NOT NULL COMMENT '客户隔离键',
closure_no VARCHAR(64) NOT NULL COMMENT '异常关闭业务号', customer_voucher_file_id BIGINT NOT NULL COMMENT '客户同意停止履约凭证',
financial_conclusion VARCHAR(1000) NOT NULL COMMENT '已知费用及后续无需收费的处理结论,不改变资金事实',
reason VARCHAR(1000) NOT NULL COMMENT '内部关闭原因', client_summary VARCHAR(500) NOT NULL COMMENT '人工确认的对客关闭摘要',
created_by VARCHAR(128) NOT NULL COMMENT '采购管理确认人', created_at DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3) COMMENT '关闭确认时间',
PRIMARY KEY(id), UNIQUE KEY uk_procurement_closure_order(order_id), UNIQUE KEY uk_procurement_closure_no(closure_no)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='采购实物资金收口后的异常关闭事实';
CREATE TABLE ll_procurement_closure_item (
id BIGINT NOT NULL COMMENT '关闭货物处置ID', closure_id BIGINT NOT NULL COMMENT '采购关闭ID',
source_kind VARCHAR(32) NOT NULL COMMENT '购买未达、在途未达、合格、破损或多货来源', source_id BIGINT NULL COMMENT '原实收或国际交寄箱,购买未达为空',
quantity BIGINT NOT NULL COMMENT '本来源最终明确去向件数', decision VARCHAR(40) NOT NULL COMMENT '供应商保管、退还、报失、客户授权保管或处置',
destination VARCHAR(500) NOT NULL COMMENT '实际去向及接收方说明', voucher_file_id BIGINT NOT NULL COMMENT '本单实物处置证明',
PRIMARY KEY(id), KEY idx_procurement_closure_source(closure_id,source_kind,source_id),
CONSTRAINT chk_procurement_closure_quantity CHECK(quantity>0)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='异常关闭逐来源剩余货物最终去向,不产生新发运';
SELECT 'PASS' AS initialization_status, 'OVERSEAS' AS region, 181 AS initialized_tables;
CREATE TABLE IF NOT EXISTS ll_appointment_impact (
container_booking_id VARCHAR(64) NOT NULL COMMENT '稳定柜次关联键,不作业务编号展示',
impact_no VARCHAR(40) NOT NULL COMMENT '船期核对事项业务号',
baseline_json LONGTEXT NOT NULL COMMENT '已核对基准或首次变化前观察,原来源时间口径',
latest_json LONGTEXT NOT NULL COMMENT '最新已读取观察,未知可为JSON null',
forecast_token CHAR(64) NOT NULL COMMENT '最新观察摘要,处理时防止旧预测结案',
status VARCHAR(20) NOT NULL COMMENT '事项状态:MONITORING监测/OPEN待处理/RESOLVED已完成',
reason VARCHAR(64) NULL COMMENT '预测变化或资料待核实原因',
owner_id VARCHAR(128) NULL COMMENT '认领平台人员ID',
owner_name VARCHAR(200) NULL COMMENT '负责人姓名快照',
version INT NOT NULL COMMENT '观察及人工处理共同版本',
updated_at DATETIME(3) NOT NULL COMMENT 'UTC更新时间',
PRIMARY KEY (container_booking_id),
UNIQUE KEY uk_appointment_impact_no (impact_no),
KEY idx_appointment_impact_work (status,updated_at),
CONSTRAINT chk_appointment_impact_status CHECK (status IN ('MONITORING','OPEN','RESOLVED'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='一柜一个稳定船期变化核对事项,不改写预约或运输';
CREATE TABLE IF NOT EXISTS ll_appointment_impact_history (
id BIGINT NOT NULL COMMENT '历史记录标识',
container_booking_id VARCHAR(64) NOT NULL COMMENT '关联柜次标识',
version INT NOT NULL COMMENT '记录版本',
action VARCHAR(20) NOT NULL COMMENT '操作类型:OBSERVED观察/CLAIM认领/RECORD记录/RESOLVE完成',
operator_id VARCHAR(128) NOT NULL COMMENT '操作人标识',
operator_name VARCHAR(200) NULL COMMENT '操作人姓名',
result VARCHAR(1000) NULL COMMENT '人工处理结果;观察记录为空',
next_action VARCHAR(500) NULL COMMENT '下一步处理事项',
followup_date DATE NULL COMMENT '业务跟进日期',
command_key VARCHAR(64) NULL COMMENT '人工命令幂等键;观察记录为空',
request_hash CHAR(64) NULL COMMENT '请求内容摘要',
response_json LONGTEXT NOT NULL COMMENT '该版本完整响应快照,支持精确重放',
created_at DATETIME(3) NOT NULL COMMENT 'UTC记录时间',
PRIMARY KEY (id),
UNIQUE KEY uk_appointment_impact_version (container_booking_id,version),
UNIQUE KEY uk_appointment_impact_command (container_booking_id,operator_id,command_key),
CONSTRAINT fk_appointment_impact_history FOREIGN KEY (container_booking_id) REFERENCES ll_appointment_impact(container_booking_id),
CONSTRAINT chk_appointment_impact_action CHECK (action IN ('OBSERVED','CLAIM','RECORD','RESOLVE'))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='船期观察及人工处理追加历史';
@@ -22,6 +22,10 @@ enum BusinessFileCategory {
INBOUND_HOLD_EVIDENCE(true, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG), INBOUND_HOLD_EVIDENCE(true, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
OVERSEAS_PROCUREMENT_RECEIPT(true, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG), OVERSEAS_PROCUREMENT_RECEIPT(true, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
OVERSEAS_PROCUREMENT_VOUCHER(true, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG), OVERSEAS_PROCUREMENT_VOUCHER(true, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
OVERSEAS_PROCUREMENT_LABEL(true, FormatPolicy.PDF_IMAGE, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
OVERSEAS_PROCUREMENT_PURCHASE(true, FormatPolicy.PDF_IMAGE, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
OVERSEAS_PROCUREMENT_BUDGET(true, FormatPolicy.PDF_IMAGE, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
OVERSEAS_PROCUREMENT_EXCEPTION(true, FormatPolicy.PDF_IMAGE, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
CONTAINER_CLEARANCE_DOCUMENT(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG), CONTAINER_CLEARANCE_DOCUMENT(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
LOADING_CUSTOMS_DECLARATION(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG), LOADING_CUSTOMS_DECLARATION(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
CONTAINER_DELIVERY_ORDER(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG), CONTAINER_DELIVERY_ORDER(false, FormatPolicy.STANDARD, Limits.STANDARD, BusinessIdPolicy.POSITIVE_LONG),
@@ -0,0 +1,36 @@
package com.baiyue.file.service;
import com.baiyue.common.core.exception.BizException;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.io.TempDir;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.util.ReflectionTestUtils;
import org.springframework.web.multipart.MultipartFile;
import java.nio.file.Path;
import java.util.List;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
class ProcurementFilePolicyTest {
@TempDir Path root;
@Test void procurementLabelAndPrivateProofUsePdfImagesAndPositiveCustomerOwnership() {
var storage=new BusinessFileStorage();ReflectionTestUtils.setField(storage,"configuredRoot",root);storage.initializeRoot();
for(var category:List.of(BusinessFileCategory.OVERSEAS_PROCUREMENT_LABEL,BusinessFileCategory.OVERSEAS_PROCUREMENT_PURCHASE,
BusinessFileCategory.OVERSEAS_PROCUREMENT_BUDGET,BusinessFileCategory.OVERSEAS_PROCUREMENT_EXCEPTION)) {
category.validateOwner(9);
assertThatThrownBy(()->category.validateOwner(0)).isInstanceOf(BizException.class);
assertThatThrownBy(()->category.storageBusinessId("0")).isInstanceOf(BizException.class);
byte[] pdf="%PDF-1.4\nprocurement test".getBytes(java.nio.charset.StandardCharsets.UTF_8);
var saved=storage.store(9,"11",new MockMultipartFile("file","label.pdf","application/pdf",pdf),category);
assertThat(storage.read(saved.objectKey())).isEqualTo(pdf);
assertThatThrownBy(()->storage.store(9,"11",new MockMultipartFile("file","fake.pdf","application/pdf","<html>fake</html>".getBytes()),category)).isInstanceOf(BizException.class);
assertThatThrownBy(()->storage.store(9,"11",new MockMultipartFile("file","notes.txt","text/plain","notes".getBytes()),category)).isInstanceOf(BizException.class);
}
}
@Test void labelOverTenMibIsRejectedBeforeReadingBody()throws Exception {
var storage=new BusinessFileStorage();ReflectionTestUtils.setField(storage,"configuredRoot",root);storage.initializeRoot();
MultipartFile file=mock(MultipartFile.class);when(file.isEmpty()).thenReturn(false);when(file.getSize()).thenReturn(10L*1024*1024+1);
assertThatThrownBy(()->storage.store(9,"11",file,BusinessFileCategory.OVERSEAS_PROCUREMENT_LABEL)).isInstanceOf(BizException.class);
verify(file,never()).getBytes();verify(file,never()).getInputStream();
}
}
@@ -130,6 +130,14 @@ public class BusinessFeeSourceEventService {
} }
positive(value.sourceFeeId(), "sourceFeeId"); positive(value.sourceFeeId(), "sourceFeeId");
positive(value.customerId(), "customerId"); positive(value.customerId(), "customerId");
if (value.walletSettlement() != null) {
if (!"RECEIVABLE".equals(value.direction())) throw error("FIN-EVT-012", "钱包消费只能关联应收费用");
positive(value.walletSettlement().holdId(), "walletSettlement.holdId");
positive(value.walletSettlement().ledgerId(), "walletSettlement.ledgerId");
if (blank(value.walletSettlement().commandEventId())) throw error("FIN-EVT-012", "缺少原资金命令引用");
} else if ("OVERSEAS_PROCUREMENT_FEE".equals(value.sourceType()) && "RECEIVABLE".equals(value.direction())) {
throw error("FIN-EVT-012", "采购应收必须引用成功实扣资金,不能进入待收费池");
}
if ("OVERSEAS_CONTAINER_FEE".equals(value.sourceType())) { if ("OVERSEAS_CONTAINER_FEE".equals(value.sourceType())) {
if (!"LASTLEG".equals(value.sourceSystem()) || !"OVERSEAS_CONTAINER".equals(value.businessType())) if (!"LASTLEG".equals(value.sourceSystem()) || !"OVERSEAS_CONTAINER".equals(value.businessType()))
throw error("FIN-EVT-012", "海外柜费来源不一致"); throw error("FIN-EVT-012", "海外柜费来源不一致");
@@ -160,7 +168,7 @@ public class BusinessFeeSourceEventService {
value.paymentReferenceNo(), value.paymentVoucherFileIds(), value.businessDate(), value.currency(), value.paymentReferenceNo(), value.paymentVoucherFileIds(), value.businessDate(), value.currency(),
value.totalAmount(), value.originalCurrency(), value.originalAmount(), value.exchangeRate(), value.totalAmount(), value.originalCurrency(), value.originalAmount(), value.exchangeRate(),
value.exchangeRateMonth(), value.chargeableQuantity(), value.quantityUnit(), value.unitPrice(), value.exchangeRateMonth(), value.chargeableQuantity(), value.quantityUnit(), value.unitPrice(),
value.periodStart(), value.periodEnd(), value.reviewStatus(), "PUBLISHED", "ACTIVE", null); value.periodStart(), value.periodEnd(), value.reviewStatus(), "PUBLISHED", "ACTIVE", null, value.walletSettlement());
String expected = EventPayloadHash.sha256(EventPayloadCanonicalizer.canonicalize(objectMapper.valueToTree(unsigned))); String expected = EventPayloadHash.sha256(EventPayloadCanonicalizer.canonicalize(objectMapper.valueToTree(unsigned)));
if (!expected.equals(value.sourceHash())) throw error("FIN-EVT-004", "费用来源快照哈希不一致"); if (!expected.equals(value.sourceHash())) throw error("FIN-EVT-004", "费用来源快照哈希不一致");
} }
@@ -189,7 +197,40 @@ public class BusinessFeeSourceEventService {
private void linkSettledWalletHold(long feeSourceId, BusinessFeeSourceChangedV1 source) { private void linkSettledWalletHold(long feeSourceId, BusinessFeeSourceChangedV1 source) {
if (!"RECEIVABLE".equals(source.direction())) return; if (!"RECEIVABLE".equals(source.direction())) return;
jdbc.update("UPDATE fin_fee_source f JOIN fin_wallet_hold h ON h.customer_id=f.customer_id AND h.business_type=f.business_type AND h.business_no=f.business_no SET f.wallet_hold_id=h.id,f.status='SETTLED' WHERE f.id=? AND f.status='AVAILABLE' AND h.status='SETTLED' AND h.amount=f.amount", if (source.walletSettlement() != null) {
var reference = source.walletSettlement();
long customerId = positive(source.customerId(), "customerId");
long holdId = positive(reference.holdId(), "holdId");
long ledgerId = positive(reference.ledgerId(), "ledgerId");
List<Map<String, Object>> rows = jdbc.queryForList(
"SELECT l.amount,c.result_json FROM fin_wallet_hold h JOIN fin_wallet_ledger l ON l.id=h.action_ledger_id AND l.customer_id=h.customer_id JOIN fin_wallet_command_inbox c ON c.event_id=? AND c.status='SUCCEEDED' WHERE h.id=? AND l.id=? AND h.customer_id=? AND h.business_type=? AND h.business_no=? AND h.status='SETTLED' AND l.change_type='CONSUMPTION' FOR UPDATE",
reference.commandEventId(), holdId, ledgerId, customerId, source.businessType(), source.businessNo());
if (rows.size() != 1 || !(rows.get(0).get("amount") instanceof java.math.BigDecimal amount)
|| amount.negate().compareTo(source.totalAmount()) != 0) {
throw error("FIN-EVT-017", "费用来源与成功扣款的客户、业务或金额不匹配");
}
com.fasterxml.jackson.databind.JsonNode result;
try { result = objectMapper.readTree(String.valueOf(rows.get(0).get("result_json"))); }
catch (JsonProcessingException exception) { throw error("FIN-EVT-017", "原资金结果无法核对"); }
if (!"SUCCEEDED".equals(result.path("result").asText())
|| !Set.of("SETTLE", "SETTLE_ACTUAL").contains(result.path("operation").asText())
|| !reference.commandEventId().equals(result.path("commandEventId").asText())
|| !reference.holdId().equals(result.path("walletHoldId").asText())
|| !reference.ledgerId().equals(result.path("walletLedgerId").asText())
|| result.path("customerId").asLong() != customerId
|| !source.businessType().equals(result.path("businessType").asText())
|| !source.businessNo().equals(result.path("businessNo").asText())
|| result.path("amount").decimalValue().compareTo(source.totalAmount()) != 0) {
throw error("FIN-EVT-017", "费用来源引用的资金结果不匹配");
}
List<Long> used = jdbc.queryForList("SELECT id FROM fin_fee_source WHERE wallet_hold_id=? AND id<>? FOR UPDATE",
Long.class, holdId, feeSourceId);
if (!used.isEmpty()) throw error("FIN-EVT-017", "同一成功扣款已关联其他费用来源");
jdbc.update("UPDATE fin_fee_source SET wallet_hold_id=?,status='SETTLED' WHERE id=? AND customer_id=? AND status='AVAILABLE'",
holdId, feeSourceId, customerId);
return;
}
jdbc.update("UPDATE fin_fee_source f JOIN fin_wallet_hold h ON h.customer_id=f.customer_id AND h.business_type=f.business_type AND h.business_no=f.business_no JOIN fin_wallet_ledger l ON l.id=h.action_ledger_id AND l.customer_id=h.customer_id AND l.change_type='CONSUMPTION' SET f.wallet_hold_id=h.id,f.status='SETTLED' WHERE f.id=? AND f.status='AVAILABLE' AND h.status='SETTLED' AND f.amount=-l.amount",
feeSourceId); feeSourceId);
} }
@@ -300,6 +300,113 @@ public class FinanceWalletService {
return completeHold(customerId, businessType, businessNo, idempotencyKey, request, false); return completeHold(customerId, businessType, businessNo, idempotencyKey, request, false);
} }
/** Settles one estimate without releasing its protection before checking any shortfall. */
@Transactional
public WalletHold settleActual(long customerId, String rawBusinessType, String rawBusinessNo,
String idempotencyKey, BigDecimal actualAmount, String remark) {
requirePositive(customerId, "客户");
BigDecimal amount = money(actualAmount);
String businessType = businessType(rawBusinessType);
String businessNo = businessNo(rawBusinessNo);
String operation = "WALLET_HOLD_SETTLE_ACTUAL";
String requestHash = hash(Map.of("customerId", customerId, "businessType", businessType,
"businessNo", businessNo, "amount", amount, "remark", String.valueOf(remark)));
Long replay = reserve(customerId, 0, operation, idempotencyKey, requestHash);
if (replay != null) return requiredHold(replay, customerId);
WalletAccount before = accountForUpdate(customerId);
WalletHold hold = findHold(customerId, businessType, businessNo, true);
if (hold == null) throw error("FIN-WALLET-HOLD-404", "资金冻结记录不存在");
if (!"FROZEN".equals(hold.status())) throw error("FIN-WALLET-HOLD-409", "资金冻结记录已处理");
WalletAccount after = settleActualAccount(before, hold, amount);
updateAccount(customerId, after, before.version(), 0);
WalletLedgerEntry ledger = insertLedger(customerId, "CONSUMPTION", amount.negate(), after,
businessType, businessNo, LocalDate.now(), null, businessNo, 0, "业务系统", remark);
// The hold retains the original estimate; its action ledger records the actual charge.
int updated = jdbc.update("UPDATE fin_wallet_hold SET status='SETTLED',action_ledger_id=?,completed_at=CURRENT_TIMESTAMP(3) WHERE id=? AND status='FROZEN'",
ledger.ledgerId(), hold.holdId());
if (updated != 1) throw error("FIN-WALLET-HOLD-409", "资金冻结记录已处理");
audit(customerId, "WALLET_HOLD", hold.holdId(), "SETTLE_ACTUAL", remark, before, after, 0, "业务系统");
complete(customerId, 0, operation, idempotencyKey, hold.holdId());
return requiredHold(hold.holdId(), customerId);
}
/** Refunds a successful consumption; recharge allocation rules apply without creating a recharge. */
@Transactional
public WalletLedgerEntry refundConsumption(long customerId, long originalLedgerId, String refundNo,
String idempotencyKey, BigDecimal refundAmount,
long operatorId, String operatorName, String remark) {
requirePositive(customerId, "客户");
requirePositive(originalLedgerId, "原扣款流水");
String reference = businessNo(refundNo);
BigDecimal amount = money(refundAmount);
if (!StringUtils.hasText(remark)) throw bad("退款原因不能为空");
String requestHash = hash(Map.of("customerId", customerId, "originalLedgerId", originalLedgerId,
"refundNo", reference, "amount", amount, "remark", remark));
Long replay = reserve(customerId, 0, "WALLET_BUSINESS_REFUND", idempotencyKey, requestHash);
if (replay != null) return requiredLedger(replay, customerId);
WalletAccount before = accountForUpdate(customerId);
List<WalletLedgerEntry> originals = jdbc.query(
"SELECT * FROM fin_wallet_ledger WHERE id=? AND customer_id=? FOR UPDATE",
(rs, n) -> ledgerRow(rs), originalLedgerId, customerId);
if (originals.isEmpty()) throw error("FIN-WALLET-404", "原扣款流水不存在");
WalletLedgerEntry original = originals.get(0);
if (!"CONSUMPTION".equals(original.changeType()) || original.amount().signum() >= 0) {
throw bad("仅可对成功业务扣款发起关联退款");
}
List<WalletLedgerEntry> existing = jdbc.query(
"SELECT * FROM fin_wallet_ledger WHERE customer_id=? AND source_type='BUSINESS_REFUND' AND source_no=? FOR UPDATE",
(rs, n) -> ledgerRow(rs), customerId, reference);
if (!existing.isEmpty()) {
WalletLedgerEntry refunded = existing.get(0);
if (refunded.amount().compareTo(amount) != 0 || !original.businessNo().equals(refunded.referenceNo())) {
throw error("FIN-IDEMPOTENCY-CONFLICT", "同一退款单对应的原扣款或金额不一致");
}
complete(customerId, 0, "WALLET_BUSINESS_REFUND", idempotencyKey, refunded.ledgerId());
return refunded;
}
// Locking reads see refunds committed while this transaction waited for the account lock,
// even under MySQL REPEATABLE READ after the idempotency lookup established a snapshot.
BigDecimal refunded = jdbc.queryForList(
"SELECT amount FROM fin_wallet_ledger WHERE customer_id=? AND source_type='BUSINESS_REFUND' AND reference_no=? FOR UPDATE",
BigDecimal.class, customerId, original.businessNo()).stream().reduce(BigDecimal.ZERO, BigDecimal::add);
if (refunded.add(amount).compareTo(original.amount().negate()) > 0) {
throw error("FIN-WALLET-REFUND-EXCEEDED", "退款金额超过原扣款剩余可退金额");
}
WalletAccount after = rechargeAccount(before, amount);
updateAccount(customerId, after, before.version(), operatorId);
WalletLedgerEntry result = insertLedger(customerId, "REFUND", amount, after,
"BUSINESS_REFUND", reference, LocalDate.now(), null, original.businessNo(),
operatorId, operatorName, remark);
audit(customerId, "WALLET_LEDGER", originalLedgerId, "REFUND", remark, before, after, operatorId, operatorName);
complete(customerId, 0, "WALLET_BUSINESS_REFUND", idempotencyKey, result.ledgerId());
return result;
}
WalletAccount settleActualAccount(WalletAccount before, WalletHold hold, BigDecimal actualAmount) {
BigDecimal amount = money(actualAmount);
BigDecimal extra = amount.subtract(hold.amount()).max(BigDecimal.ZERO);
if (extra.signum() > 0 && before.availableBalance().compareTo(extra) < 0) {
throw error("FIN-WALLET-INSUFFICIENT", "实际费用补差所需的可用余额和授信额度不足");
}
BigDecimal actual = before.actualBalance();
BigDecimal creditUsed = before.creditUsed();
if (before.creditActive()) {
BigDecimal reservedCharge = amount.min(hold.amount());
BigDecimal cashCharge = reservedCharge.min(hold.actualFrozenAmount());
BigDecimal freeCash = actual.subtract(before.frozenBalance().subtract(before.creditFrozen()))
.max(BigDecimal.ZERO);
cashCharge = cashCharge.add(extra.min(freeCash));
actual = actual.subtract(cashCharge);
creditUsed = creditUsed.add(amount.subtract(cashCharge));
} else {
// Previously reserved credit still settles after expiry, without granting new credit.
actual = actual.subtract(amount);
}
return accountState(actual, before.frozenBalance().subtract(hold.amount()), before.creditLimit(),
creditUsed, before.creditFrozen().subtract(hold.creditFrozenAmount()),
before.creditExpiresOn(), before.version());
}
private WalletHold completeHold(long customerId, String rawBusinessType, String rawBusinessNo, private WalletHold completeHold(long customerId, String rawBusinessType, String rawBusinessNo,
String idempotencyKey, WalletHoldActionRequest request, boolean settle) { String idempotencyKey, WalletHoldActionRequest request, boolean settle) {
requirePositive(customerId, "客户"); requirePositive(customerId, "客户");
@@ -29,9 +29,10 @@ import java.util.Set;
@Service @Service
public class WalletCommandEventService { public class WalletCommandEventService {
private static final Set<String> OPERATIONS = Set.of("FREEZE", "SETTLE", "RELEASE"); private static final Set<String> OPERATIONS = Set.of("FREEZE", "SETTLE", "SETTLE_ACTUAL", "RELEASE", "REFUND");
private static final Set<String> FINAL_REJECTIONS = Set.of( private static final Set<String> FINAL_REJECTIONS = Set.of(
"FIN-WALLET-INSUFFICIENT", "FIN-WALLET-HOLD-409", "FIN-IDEMPOTENCY-CONFLICT", "FIN-REQ-400"); "FIN-WALLET-INSUFFICIENT", "FIN-WALLET-HOLD-409", "FIN-IDEMPOTENCY-CONFLICT", "FIN-REQ-400",
"FIN-WALLET-REFUND-EXCEEDED", "FIN-WALLET-404");
private final JdbcTemplate jdbc; private final JdbcTemplate jdbc;
private final ObjectMapper objectMapper; private final ObjectMapper objectMapper;
private final FinanceWalletService walletService; private final FinanceWalletService walletService;
@@ -56,10 +57,9 @@ public class WalletCommandEventService {
if (resultExists(envelope.eventId())) return DeliveryAck.of(envelope, DeliveryAck.Outcome.DUPLICATE); if (resultExists(envelope.eventId())) return DeliveryAck.of(envelope, DeliveryAck.Outcome.DUPLICATE);
// Wallet methods join this transaction: money, the Inbox outcome and // Wallet methods join this transaction: money, the Inbox outcome and
// the result Outbox commit together, or all roll back. // the result Outbox commit together, or all roll back.
WalletHold hold = execute(command); ExecutionResult execution = execute(command);
if (hold == null) throw new IllegalStateException("资金操作未返回处理结果");
finalizeResult(envelope, completed(envelope.eventId(), command, "SUCCEEDED", finalizeResult(envelope, completed(envelope.eventId(), command, "SUCCEEDED",
hold.status(), hold.amount(), null, null)); execution.status(), execution.amount(), null, null, execution.holdId(), execution.ledgerId()));
return DeliveryAck.of(envelope, DeliveryAck.Outcome.APPLIED); return DeliveryAck.of(envelope, DeliveryAck.Outcome.APPLIED);
}); });
} catch (FinanceEventException exception) { } catch (FinanceEventException exception) {
@@ -70,7 +70,7 @@ public class WalletCommandEventService {
requireLockedIdentity(envelope); requireLockedIdentity(envelope);
if (resultExists(envelope.eventId())) return DeliveryAck.of(envelope, DeliveryAck.Outcome.DUPLICATE); if (resultExists(envelope.eventId())) return DeliveryAck.of(envelope, DeliveryAck.Outcome.DUPLICATE);
finalizeResult(envelope, completed(envelope.eventId(), command, "FAILED", finalizeResult(envelope, completed(envelope.eventId(), command, "FAILED",
null, command.amount(), exception.code(), exception.getMessage())); null, command.amount(), exception.code(), exception.getMessage(), null, null));
return DeliveryAck.of(envelope, DeliveryAck.Outcome.APPLIED); return DeliveryAck.of(envelope, DeliveryAck.Outcome.APPLIED);
}); });
} }
@@ -86,21 +86,33 @@ public class WalletCommandEventService {
} }
} }
private WalletHold execute(WalletCommandRequestedV1 command) { private record ExecutionResult(String status, BigDecimal amount, String holdId, String ledgerId) { }
private ExecutionResult execute(WalletCommandRequestedV1 command) {
if ("REFUND".equals(command.operation())) {
var refund = walletService.refundConsumption(command.customerId(), Long.parseLong(command.originalLedgerId()),
command.businessNo(), command.idempotencyKey(), command.amount(), 0, "业务系统", command.remark());
return new ExecutionResult("REFUNDED", refund.amount(), null, String.valueOf(refund.ledgerId()));
}
WalletHold hold = switch (command.operation()) { WalletHold hold = switch (command.operation()) {
case "FREEZE" -> walletService.freeze(command.customerId(), command.idempotencyKey(), case "FREEZE" -> walletService.freeze(command.customerId(), command.idempotencyKey(),
new WalletFreezeRequest(command.amount(), command.businessType(), command.businessNo(), command.remark())); new WalletFreezeRequest(command.amount(), command.businessType(), command.businessNo(), command.remark()));
case "SETTLE" -> walletService.settle(command.customerId(), command.businessType(), command.businessNo(), case "SETTLE" -> walletService.settle(command.customerId(), command.businessType(), command.businessNo(),
command.idempotencyKey(), new WalletHoldActionRequest(command.remark())); command.idempotencyKey(), new WalletHoldActionRequest(command.remark()));
case "SETTLE_ACTUAL" -> walletService.settleActual(command.customerId(), command.businessType(), command.businessNo(),
command.idempotencyKey(), command.amount(), command.remark());
case "RELEASE" -> walletService.release(command.customerId(), command.businessType(), command.businessNo(), case "RELEASE" -> walletService.release(command.customerId(), command.businessType(), command.businessNo(),
command.idempotencyKey(), new WalletHoldActionRequest(command.remark())); command.idempotencyKey(), new WalletHoldActionRequest(command.remark()));
default -> throw new FinanceEventException("FIN-EVT-001", "资金指令操作无效"); default -> throw new FinanceEventException("FIN-EVT-001", "资金指令操作无效");
}; };
if ("SETTLE".equals(command.operation())) { if (hold == null) throw new IllegalStateException("资金操作未返回处理结果");
jdbc.update("UPDATE fin_fee_source f JOIN fin_wallet_hold h ON h.customer_id=f.customer_id AND h.business_type=f.business_type AND h.business_no=f.business_no SET f.wallet_hold_id=h.id,f.status='SETTLED' WHERE h.id=? AND f.direction='RECEIVABLE' AND f.status='AVAILABLE' AND f.amount=h.amount", if (Set.of("SETTLE", "SETTLE_ACTUAL").contains(command.operation())) {
jdbc.update("UPDATE fin_fee_source f JOIN fin_wallet_hold h ON h.customer_id=f.customer_id AND h.business_type=f.business_type AND h.business_no=f.business_no JOIN fin_wallet_ledger l ON l.id=h.action_ledger_id AND l.customer_id=h.customer_id AND l.change_type='CONSUMPTION' SET f.wallet_hold_id=h.id,f.status='SETTLED' WHERE h.id=? AND f.direction='RECEIVABLE' AND f.status='AVAILABLE' AND f.amount=-l.amount",
hold.holdId()); hold.holdId());
} }
return hold; Long ledgerId = "FREEZE".equals(command.operation()) ? hold.freezeLedgerId() : hold.actionLedgerId();
return new ExecutionResult(hold.status(), "SETTLE_ACTUAL".equals(command.operation()) ? command.amount() : hold.amount(),
String.valueOf(hold.holdId()), ledgerId == null ? null : String.valueOf(ledgerId));
} }
private WalletCommandRequestedV1 validate(EventEnvelope envelope) { private WalletCommandRequestedV1 validate(EventEnvelope envelope) {
@@ -118,14 +130,22 @@ public class WalletCommandEventService {
String operation = value.operation() == null ? "" : value.operation().trim().toUpperCase(Locale.ROOT); String operation = value.operation() == null ? "" : value.operation().trim().toUpperCase(Locale.ROOT);
if (!OPERATIONS.contains(operation) || value.customerId() <= 0 || blank(value.businessType()) if (!OPERATIONS.contains(operation) || value.customerId() <= 0 || blank(value.businessType())
|| blank(value.businessNo()) || blank(value.idempotencyKey()) || blank(value.businessNo()) || blank(value.idempotencyKey())
|| ("FREEZE".equals(operation) && (value.amount() == null || value.amount().signum() <= 0))) { || (Set.of("FREEZE", "SETTLE_ACTUAL", "REFUND").contains(operation)
&& (value.amount() == null || value.amount().signum() <= 0 || value.amount().scale() > 2))) {
throw new FinanceEventException("FIN-EVT-001", "资金指令字段无效"); throw new FinanceEventException("FIN-EVT-001", "资金指令字段无效");
} }
if ("REFUND".equals(operation)) {
if (blank(value.originalLedgerId()) || Long.parseLong(value.originalLedgerId()) <= 0 || blank(value.remark())) {
throw new FinanceEventException("FIN-EVT-001", "退款必须关联原扣款并填写原因");
}
} else if (value.originalLedgerId() != null) {
throw new FinanceEventException("FIN-EVT-001", "非退款指令不能指定原扣款");
}
if (!String.valueOf(value.customerId()).equals(envelope.tenantId())) { if (!String.valueOf(value.customerId()).equals(envelope.tenantId())) {
throw new FinanceEventException("FIN-EVT-007", "资金指令客户归属不一致"); throw new FinanceEventException("FIN-EVT-007", "资金指令客户归属不一致");
} }
return new WalletCommandRequestedV1(operation, value.customerId(), value.businessType(), value.businessNo(), return new WalletCommandRequestedV1(operation, value.customerId(), value.businessType(), value.businessNo(),
value.amount(), value.remark(), value.idempotencyKey(), value.requestedAt()); value.amount(), value.remark(), value.idempotencyKey(), value.requestedAt(), value.originalLedgerId());
} catch (FinanceEventException exception) { throw exception; } } catch (FinanceEventException exception) { throw exception; }
catch (Exception exception) { throw new FinanceEventException("FIN-EVT-001", "资金指令载荷无法解析"); } catch (Exception exception) { throw new FinanceEventException("FIN-EVT-001", "资金指令载荷无法解析"); }
} }
@@ -159,9 +179,10 @@ public class WalletCommandEventService {
return count != null && count > 0; return count != null && count > 0;
} }
private WalletCommandCompletedV1 completed(String eventId, WalletCommandRequestedV1 command, String result, private WalletCommandCompletedV1 completed(String eventId, WalletCommandRequestedV1 command, String result,
String holdStatus, BigDecimal amount, String errorCode, String errorMessage) { String holdStatus, BigDecimal amount, String errorCode, String errorMessage,
String holdId, String ledgerId) {
return new WalletCommandCompletedV1(eventId, command.operation(), command.customerId(), command.businessType(), return new WalletCommandCompletedV1(eventId, command.operation(), command.customerId(), command.businessType(),
command.businessNo(), result, holdStatus, amount, errorCode, errorMessage, Instant.now()); command.businessNo(), result, holdStatus, amount, errorCode, errorMessage, Instant.now(), holdId, ledgerId);
} }
private String json(Object value) { private String json(Object value) {
try { return objectMapper.writeValueAsString(value); } try { return objectMapper.writeValueAsString(value); }
@@ -45,11 +45,11 @@ class BusinessFeeSourceEventServiceTest {
when(jdbc.queryForList(startsWith("SELECT payload_hash,status,result_resource_id"), when(jdbc.queryForList(startsWith("SELECT payload_hash,status,result_resource_id"),
eq("LASTLEG"), eq(event.eventId()))).thenReturn(List.of()); eq("LASTLEG"), eq(event.eventId()))).thenReturn(List.of());
when(jdbc.queryForList(startsWith("SELECT id,source_hash,status FROM fin_fee_source"), when(jdbc.queryForList(startsWith("SELECT id,source_hash,status FROM fin_fee_source"),
eq("LASTLEG"), eq("OVERSEAS_PROCUREMENT_FEE"), eq(701L), eq(1))).thenReturn(List.of()); eq("LASTLEG"), eq("OVERSEAS_WAREHOUSE_FEE"), eq(701L), eq(1))).thenReturn(List.of());
when(jdbc.queryForObject(startsWith("SELECT COUNT(*) FROM fin_fee_source f WHERE f.source_system=?"), when(jdbc.queryForObject(startsWith("SELECT COUNT(*) FROM fin_fee_source f WHERE f.source_system=?"),
eq(Integer.class), eq("LASTLEG"), eq("OVERSEAS_PROCUREMENT_FEE"), eq(701L))).thenReturn(0); eq(Integer.class), eq("LASTLEG"), eq("OVERSEAS_WAREHOUSE_FEE"), eq(701L))).thenReturn(0);
when(jdbc.queryForObject(startsWith("SELECT id FROM fin_fee_source"), eq(Long.class), when(jdbc.queryForObject(startsWith("SELECT id FROM fin_fee_source"), eq(Long.class),
eq("LASTLEG"), eq("OVERSEAS_PROCUREMENT_FEE"), eq(701L), eq(1))).thenReturn(901L); eq("LASTLEG"), eq("OVERSEAS_WAREHOUSE_FEE"), eq(701L), eq(1))).thenReturn(901L);
assertThat(service.consume(event).eventId()).isEqualTo(event.eventId()); assertThat(service.consume(event).eventId()).isEqualTo(event.eventId());
@@ -65,21 +65,21 @@ class BusinessFeeSourceEventServiceTest {
private EventEnvelope eventWithoutInbound() { private EventEnvelope eventWithoutInbound() {
BusinessFeeSourceChangedV1 unsigned = new BusinessFeeSourceChangedV1(null, "LASTLEG", BusinessFeeSourceChangedV1 unsigned = new BusinessFeeSourceChangedV1(null, "LASTLEG",
"OVERSEAS_PROCUREMENT_FEE", "701", 1, "10001", "客户A", "PO-US-001", "OVERSEAS_WAREHOUSE_FEE", "701", 1, "10001", "客户A", "PO-US-001",
"OVERSEAS_PROCUREMENT", "801", "PO-US-001", null, null, null, null, null, "WAREHOUSE_SERVICE", "801", "PO-US-001", null, null, null, null, null,
null, "91", "PROCUREMENT_SERVICE", "采购服务费", "RECEIVABLE", null, null, null, "91", "PROCUREMENT_SERVICE", "采购服务费", "RECEIVABLE", null, null,
null, null, null, null, null, List.of(), LocalDate.of(2026, 9, 2), "CNY", null, null, null, null, null, List.of(), LocalDate.of(2026, 9, 2), "CNY",
new BigDecimal("120.00"), "CNY", new BigDecimal("120.00"), BigDecimal.ONE, new BigDecimal("120.00"), "CNY", new BigDecimal("120.00"), BigDecimal.ONE,
"2026-09", null, null, null, null, null, "APPROVED", "PUBLISHED", "ACTIVE", null); "2026-09", null, null, null, null, null, "APPROVED", "PUBLISHED", "ACTIVE", null, null);
String sourceHash = EventPayloadHash.sha256( String sourceHash = EventPayloadHash.sha256(
EventPayloadCanonicalizer.canonicalize(json.valueToTree(unsigned))); EventPayloadCanonicalizer.canonicalize(json.valueToTree(unsigned)));
BusinessFeeSourceChangedV1 payload = new BusinessFeeSourceChangedV1("PUBLISHED", "LASTLEG", BusinessFeeSourceChangedV1 payload = new BusinessFeeSourceChangedV1("PUBLISHED", "LASTLEG",
"OVERSEAS_PROCUREMENT_FEE", "701", 1, "10001", "客户A", "PO-US-001", "OVERSEAS_WAREHOUSE_FEE", "701", 1, "10001", "客户A", "PO-US-001",
"OVERSEAS_PROCUREMENT", "801", "PO-US-001", null, null, null, null, null, "WAREHOUSE_SERVICE", "801", "PO-US-001", null, null, null, null, null,
null, "91", "PROCUREMENT_SERVICE", "采购服务费", "RECEIVABLE", null, null, null, "91", "PROCUREMENT_SERVICE", "采购服务费", "RECEIVABLE", null, null,
null, null, null, null, null, List.of(), LocalDate.of(2026, 9, 2), "CNY", null, null, null, null, null, List.of(), LocalDate.of(2026, 9, 2), "CNY",
new BigDecimal("120.00"), "CNY", new BigDecimal("120.00"), BigDecimal.ONE, new BigDecimal("120.00"), "CNY", new BigDecimal("120.00"), BigDecimal.ONE,
"2026-09", null, null, null, null, null, "APPROVED", "PUBLISHED", "ACTIVE", sourceHash); "2026-09", null, null, null, null, null, "APPROVED", "PUBLISHED", "ACTIVE", sourceHash, null);
JsonNode node = json.valueToTree(payload); JsonNode node = json.valueToTree(payload);
String payloadHash = EventPayloadHash.sha256(EventPayloadCanonicalizer.canonicalize(node)); String payloadHash = EventPayloadHash.sha256(EventPayloadCanonicalizer.canonicalize(node));
return new EventEnvelope("123e4567-e89b-12d3-a456-426614174701", return new EventEnvelope("123e4567-e89b-12d3-a456-426614174701",
@@ -237,4 +237,53 @@ class BusinessFeeSourceEventServiceTest {
verify(jdbc, never()).update(startsWith("INSERT INTO fin_cost"), any(Object[].class)); verify(jdbc, never()).update(startsWith("INSERT INTO fin_cost"), any(Object[].class));
verify(jdbc, never()).update(startsWith("UPDATE fin_cost"), any(Object[].class)); verify(jdbc, never()).update(startsWith("UPDATE fin_cost"), any(Object[].class));
} }
@Test
void procurementWithoutConsumptionReferenceNeverEntersReceivablePool() {
EventEnvelope event = procurementEvent(false);
assertThatThrownBy(() -> service.consume(event)).hasMessageContaining("必须引用成功实扣");
noFinancialWrites();
}
@Test
void settledProcurementUsesVerifiedActualConsumptionAndNeverOriginalEstimate() {
EventEnvelope event = procurementEvent(true);
when(jdbc.queryForObject(startsWith("SELECT id FROM fin_fee_source"), eq(Long.class),
eq("LASTLEG"), eq("OVERSEAS_PROCUREMENT_FEE"), eq(701L), eq(1))).thenReturn(901L);
when(jdbc.queryForList(startsWith("SELECT l.amount,c.result_json"), eq("command-1"), eq(9L), eq(72L),
eq(10001L), eq("PROCUREMENT_FEE"), eq("PO-US-001"))).thenReturn(List.of(Map.of(
"amount", new BigDecimal("-120.00"), "result_json", """
{"result":"SUCCEEDED","operation":"SETTLE_ACTUAL","commandEventId":"command-1",
"walletHoldId":"9","walletLedgerId":"72","customerId":10001,
"businessType":"PROCUREMENT_FEE","businessNo":"PO-US-001","amount":120.00}
""")));
service.consume(event);
verify(jdbc).update(startsWith("UPDATE fin_fee_source SET wallet_hold_id="), eq(9L), eq(901L), eq(10001L));
verify(jdbc, never()).update(startsWith("UPDATE fin_fee_source f JOIN fin_wallet_hold"), any(Object[].class));
}
@Test
void incorrectOrCrossCustomerConsumptionIsRejectedInsteadOfBecomingAvailable() {
EventEnvelope event = procurementEvent(true);
when(jdbc.queryForObject(startsWith("SELECT id FROM fin_fee_source"), eq(Long.class),
eq("LASTLEG"), eq("OVERSEAS_PROCUREMENT_FEE"), eq(701L), eq(1))).thenReturn(901L);
assertThatThrownBy(() -> service.consume(event)).hasMessageContaining("不匹配");
verify(jdbc, never()).update(startsWith("UPDATE fin_fee_source SET wallet_hold_id="), any(Object[].class));
}
private EventEnvelope procurementEvent(boolean reference) {
EventEnvelope base = eventWithoutInbound();
ObjectNode payload = (ObjectNode) base.payload().deepCopy();
payload.put("sourceType", "OVERSEAS_PROCUREMENT_FEE");
payload.put("businessType", "PROCUREMENT_FEE");
if (reference) {
payload.putObject("walletSettlement").put("commandEventId", "command-1").put("holdId", "9").put("ledgerId", "72");
}
payload.putNull("action"); payload.putNull("sourceHash");
payload.put("sourceHash", EventPayloadHash.sha256(EventPayloadCanonicalizer.canonicalize(payload)));
payload.put("action", "PUBLISHED");
return new EventEnvelope(base.eventId(), base.eventType(), base.eventVersion(), base.occurredAt(), base.tenantId(),
base.aggregateType(), base.aggregateId(), base.aggregateVersion(), null, base.traceId(), base.correlationId(), null,
payload, EventPayloadHash.sha256(EventPayloadCanonicalizer.canonicalize(payload)));
}
} }
@@ -101,6 +101,38 @@ class WalletCommandEventServiceTest {
verify(jdbc, never()).update(startsWith("INSERT INTO fin_wallet_event_outbox"), any(Object[].class)); verify(jdbc, never()).update(startsWith("INSERT INTO fin_wallet_event_outbox"), any(Object[].class));
} }
@Test
void actualSettlementReportsActualChargeInsteadOfOriginalEstimate() throws Exception {
EventEnvelope event = envelope("SETTLE_ACTUAL", 31L, new BigDecimal("60.00"));
when(jdbc.queryForList(startsWith("SELECT payload_hash"), eq(String.class), eq(event.eventId())))
.thenReturn(List.of(event.payloadHash()));
when(jdbc.queryForObject(startsWith("SELECT COUNT(*)"), eq(Integer.class), anyString())).thenReturn(0);
when(wallet.settleActual(eq(31L), eq("OVERSEAS_PROCUREMENT_FEE"), eq("PO-1"),
eq("freeze-procurement-1"), argThat((BigDecimal amount) -> amount.compareTo(new BigDecimal("60.00")) == 0), any())).thenReturn(
new WalletHold(9L, 31L, "OVERSEAS_PROCUREMENT_FEE", "PO-1", new BigDecimal("100.00"),
new BigDecimal("100.00"), BigDecimal.ZERO, "SETTLED", 71L, 72L, null, null, null));
service.consume(event);
var resultJson = org.mockito.ArgumentCaptor.forClass(String.class);
verify(jdbc).update(startsWith("UPDATE fin_wallet_command_inbox SET status="), eq("SUCCEEDED"),
resultJson.capture(), eq(event.eventId()));
JsonNode result = mapper.readTree(resultJson.getValue());
assertThat(result.path("amount").decimalValue()).isEqualByComparingTo("60.00");
assertThat(result.path("holdStatus").asText()).isEqualTo("SETTLED");
assertThat(result.path("walletHoldId").asText()).isEqualTo("9");
assertThat(result.path("walletLedgerId").asText()).isEqualTo("72");
verify(jdbc).update(contains("f.amount=-l.amount"), eq(9L));
verify(wallet, never()).release(anyLong(), anyString(), anyString(), anyString(), any());
}
@Test
void actualSettlementRejectsZeroAndMissingAmountsBeforeOpeningTransaction() {
for (BigDecimal amount : new BigDecimal[]{null, BigDecimal.ZERO, new BigDecimal("0.001")}) {
assertThatThrownBy(() -> service.consume(envelope("SETTLE_ACTUAL", 31L, amount)))
.isInstanceOf(FinanceEventException.class);
}
verifyNoInteractions(jdbc, wallet, transactions);
}
@Test @Test
void losingInboxInsertMustRecheckThePersistedHash() { void losingInboxInsertMustRecheckThePersistedHash() {
EventEnvelope event = envelope("FREEZE", 31L, new BigDecimal("10.00")); EventEnvelope event = envelope("FREEZE", 31L, new BigDecimal("10.00"));
@@ -133,9 +165,44 @@ class WalletCommandEventServiceTest {
} }
private EventEnvelope envelope(String operation, long customerId, BigDecimal amount) { private EventEnvelope envelope(String operation, long customerId, BigDecimal amount) {
return envelope(operation, customerId, amount, null);
}
@Test
void refundRequiresOriginalConsumptionBeforeAnyWalletCall() {
assertThatThrownBy(() -> service.consume(envelope("REFUND", 31L, BigDecimal.TEN)))
.isInstanceOf(FinanceEventException.class);
verifyNoInteractions(jdbc, wallet);
}
@Test
void refundHasItsOwnLedgerReferenceAndNeverPretendsToSettleAHold() throws Exception {
EventEnvelope event = envelope("REFUND", 31L, BigDecimal.TEN, "72");
when(jdbc.queryForList(startsWith("SELECT payload_hash"), eq(String.class), eq(event.eventId())))
.thenReturn(List.of(event.payloadHash()));
when(jdbc.queryForObject(startsWith("SELECT COUNT(*)"), eq(Integer.class), anyString())).thenReturn(0);
var refunded = new com.baiyue.finance.dto.FinanceWalletDtos.WalletLedgerEntry(73L, "AC-TEST", "REFUND",
BigDecimal.TEN, BigDecimal.TEN, BigDecimal.ZERO, BigDecimal.TEN, BigDecimal.ZERO, BigDecimal.ZERO,
BigDecimal.ZERO, null, "BUSINESS_REFUND", "PO-1", java.time.LocalDate.now(), null,
"AC-ORIGINAL", "业务系统", "采购快递费", null);
when(wallet.refundConsumption(eq(31L), eq(72L), eq("PO-1"), eq("freeze-procurement-1"),
any(), eq(0L), anyString(), anyString())).thenReturn(refunded);
service.consume(event);
var capture = org.mockito.ArgumentCaptor.forClass(String.class);
verify(jdbc).update(startsWith("UPDATE fin_wallet_command_inbox SET status="), eq("SUCCEEDED"),
capture.capture(), eq(event.eventId()));
JsonNode result = mapper.readTree(capture.getValue());
assertThat(result.path("walletLedgerId").asText()).isEqualTo("73");
assertThat(result.path("walletHoldId").isNull()).isTrue();
assertThat(result.path("holdStatus").asText()).isEqualTo("REFUNDED");
verify(wallet, never()).settle(anyLong(), anyString(), anyString(), anyString(), any());
verify(jdbc, never()).update(startsWith("UPDATE fin_fee_source"), any(Object[].class));
}
private EventEnvelope envelope(String operation, long customerId, BigDecimal amount, String originalLedgerId) {
WalletCommandRequestedV1 command = new WalletCommandRequestedV1(operation, customerId, WalletCommandRequestedV1 command = new WalletCommandRequestedV1(operation, customerId,
"OVERSEAS_PROCUREMENT_FEE", "PO-1", amount, "采购快递费", "OVERSEAS_PROCUREMENT_FEE", "PO-1", amount, "采购快递费",
"freeze-procurement-1", Instant.parse("2026-09-05T01:00:00Z")); "freeze-procurement-1", Instant.parse("2026-09-05T01:00:00Z"), originalLedgerId);
JsonNode payload = mapper.valueToTree(command); JsonNode payload = mapper.valueToTree(command);
return new EventEnvelope(UUID.randomUUID().toString(), EventTypes.WALLET_COMMAND_REQUESTED, return new EventEnvelope(UUID.randomUUID().toString(), EventTypes.WALLET_COMMAND_REQUESTED,
WalletCommandRequestedV1.VERSION, Instant.parse("2026-09-05T01:00:00Z"), String.valueOf(customerId), "WALLET_HOLD", "PO-1", 1, WalletCommandRequestedV1.VERSION, Instant.parse("2026-09-05T01:00:00Z"), String.valueOf(customerId), "WALLET_HOLD", "PO-1", 1,
@@ -190,7 +190,7 @@ class WalletCommandTransactionTest {
private EventEnvelope event(String id, String amount) { private EventEnvelope event(String id, String amount) {
var command = new WalletCommandRequestedV1("FREEZE", 31L, "OVERSEAS_PROCUREMENT_FEE", "PO-1", var command = new WalletCommandRequestedV1("FREEZE", 31L, "OVERSEAS_PROCUREMENT_FEE", "PO-1",
new BigDecimal(amount), "fee", "freeze-1", Instant.parse("2026-09-05T01:00:00Z")); new BigDecimal(amount), "fee", "freeze-1", Instant.parse("2026-09-05T01:00:00Z"), null);
var payload = mapper.valueToTree(command); var payload = mapper.valueToTree(command);
return new EventEnvelope(id, EventTypes.WALLET_COMMAND_REQUESTED, WalletCommandRequestedV1.VERSION, return new EventEnvelope(id, EventTypes.WALLET_COMMAND_REQUESTED, WalletCommandRequestedV1.VERSION,
Instant.now(), "31", "WALLET_HOLD", "PO-1", 1, Instant.now(), "31", "WALLET_HOLD", "PO-1", 1,
@@ -0,0 +1,91 @@
package com.baiyue.finance.service;
import com.baiyue.finance.client.FinanceFileClient;
import com.baiyue.finance.dto.FinanceWalletDtos.WalletAccount;
import com.baiyue.finance.dto.FinanceWalletDtos.WalletHold;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.Test;
import org.springframework.jdbc.core.JdbcTemplate;
import java.math.BigDecimal;
import java.time.LocalDate;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.mock;
class ProcurementActualSettlementTest {
private final FinanceWalletService service = new FinanceWalletService(mock(JdbcTemplate.class),
new ObjectMapper().findAndRegisterModules(), mock(FinanceFileClient.class),
mock(FinanceDocumentNumberGenerator.class), "token", "", "test", "test");
@Test
void smallerActualChargeReleasesRemainderAndKeepsOtherReservations() {
WalletAccount before = account("200", "150", "0", "0", "0", null);
WalletAccount after = service.settleActualAccount(before, hold("100", "100", "0"), n("60"));
assertThat(after.actualBalance()).isEqualByComparingTo("140");
assertThat(after.frozenBalance()).isEqualByComparingTo("50");
assertThat(after.availableBalance()).isEqualByComparingTo("90");
}
@Test
void excessUsesAvailableCashThenActiveCreditWithoutTouchingOtherHolds() {
WalletAccount before = account("120", "130", "100", "0", "30", LocalDate.now().plusDays(1));
WalletAccount after = service.settleActualAccount(before, hold("100", "70", "30"), n("150"));
assertThat(after.actualBalance()).isEqualByComparingTo("30");
assertThat(after.creditUsed()).isEqualByComparingTo("60");
assertThat(after.frozenBalance()).isEqualByComparingTo("30");
assertThat(after.creditFrozen()).isZero();
assertThat(after.availableBalance()).isEqualByComparingTo("40");
}
@Test
void insufficientExcessRejectsWithoutChangingOriginalAccount() {
WalletAccount before = account("120", "100", "0", "0", "0", null);
assertThatThrownBy(() -> service.settleActualAccount(before, hold("100", "100", "0"), n("120.01")))
.isInstanceOf(FinanceEventException.class)
.extracting(e -> ((FinanceEventException) e).code()).isEqualTo("FIN-WALLET-INSUFFICIENT");
assertThat(before.actualBalance()).isEqualByComparingTo("120");
assertThat(before.frozenBalance()).isEqualByComparingTo("100");
}
@Test
void partialChargeUsesReservedCashBeforeCredit() {
WalletAccount before = account("70", "100", "100", "0", "30", LocalDate.now().plusDays(1));
WalletAccount after = service.settleActualAccount(before, hold("100", "70", "30"), n("60"));
assertThat(after.actualBalance()).isEqualByComparingTo("10");
assertThat(after.creditUsed()).isZero();
assertThat(after.creditFrozen()).isZero();
assertThat(after.frozenBalance()).isZero();
}
@Test
void expiredCreditAllowsOriginalReservationButNeverNewCredit() {
WalletAccount before = account("20", "100", "100", "0", "80", LocalDate.now().minusDays(1));
WalletAccount after = service.settleActualAccount(before, hold("100", "20", "80"), n("100"));
assertThat(after.actualBalance()).isEqualByComparingTo("-80");
assertThat(after.creditUsed()).isZero();
assertThat(after.frozenBalance()).isZero();
assertThatThrownBy(() -> service.settleActualAccount(before, hold("100", "20", "80"), n("100.01")))
.isInstanceOf(FinanceEventException.class);
}
@Test
void invalidActualAmountMustUseReleaseOrCorrectPrecision() {
WalletAccount before = account("200", "100", "0", "0", "0", null);
for (String value : new String[]{"0", "-1", "0.001"}) {
assertThatThrownBy(() -> service.settleActualAccount(before, hold("100", "100", "0"), n(value)))
.isInstanceOf(FinanceEventException.class);
}
}
private WalletAccount account(String actual, String frozen, String limit, String used, String creditFrozen, LocalDate expiry) {
return service.accountState(n(actual), n(frozen), n(limit), n(used), n(creditFrozen), expiry, 1);
}
private WalletHold hold(String amount, String cash, String credit) {
return new WalletHold(1L, 9L, "PROCUREMENT_FEE", "PF-TEST", n(amount), n(cash), n(credit),
"FROZEN", 1L, null, null, null, null);
}
private static BigDecimal n(String value) { return new BigDecimal(value); }
}
@@ -0,0 +1,200 @@
package com.baiyue.finance.service;
import com.baiyue.finance.client.FinanceFileClient;
import com.baiyue.finance.dto.FinanceWalletDtos.WalletHold;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.h2.jdbcx.JdbcDataSource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.dao.TransientDataAccessResourceException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.transaction.support.TransactionTemplate;
import java.math.BigDecimal;
import java.util.UUID;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
/** Executes the real wallet service against transactional JDBC; no mocked money mutations. */
class ProcurementSettlementTransactionTest {
private JdbcTemplate jdbc;
private TransactionTemplate tx;
private FinanceWalletService wallet;
@BeforeEach
void setup() {
JdbcDataSource source = new JdbcDataSource();
source.setURL("jdbc:h2:mem:" + UUID.randomUUID() + ";MODE=MySQL;DATABASE_TO_LOWER=TRUE;DB_CLOSE_DELAY=-1;LOCK_TIMEOUT=5000");
jdbc = spy(new JdbcTemplate(source));
tx = new TransactionTemplate(new DataSourceTransactionManager(source));
jdbc.execute("CREATE TABLE fin_wallet_account(customer_id BIGINT PRIMARY KEY,currency_code VARCHAR(3),actual_balance DECIMAL(18,2),frozen_balance DECIMAL(18,2),available_balance DECIMAL(18,2),credit_limit DECIMAL(18,2),credit_used DECIMAL(18,2),credit_frozen DECIMAL(18,2),credit_expires_on DATE,version INT,created_by BIGINT,updated_by BIGINT,updated_at TIMESTAMP)");
jdbc.execute("CREATE TABLE fin_wallet_hold(id BIGINT AUTO_INCREMENT PRIMARY KEY,customer_id BIGINT,business_type VARCHAR(32),business_no VARCHAR(128),amount DECIMAL(18,2),actual_frozen_amount DECIMAL(18,2),credit_frozen_amount DECIMAL(18,2),status VARCHAR(32),freeze_ledger_id BIGINT,action_ledger_id BIGINT,created_at TIMESTAMP,completed_at TIMESTAMP,remark VARCHAR(500),UNIQUE(customer_id,business_type,business_no))");
jdbc.execute("CREATE TABLE fin_idempotency_record(tenant_id BIGINT,operator_id BIGINT,operation VARCHAR(64),idempotency_key VARCHAR(128),request_hash VARCHAR(128),status VARCHAR(32),result_resource_id BIGINT,error_code VARCHAR(128),UNIQUE(tenant_id,operator_id,operation,idempotency_key))");
jdbc.execute("CREATE TABLE fin_wallet_ledger(id BIGINT AUTO_INCREMENT PRIMARY KEY,customer_id BIGINT,business_no VARCHAR(128),change_type VARCHAR(32),amount DECIMAL(18,2),actual_balance_after DECIMAL(18,2),frozen_balance_after DECIMAL(18,2),available_balance_after DECIMAL(18,2),credit_limit_after DECIMAL(18,2),credit_used_after DECIMAL(18,2),available_credit_after DECIMAL(18,2),credit_expires_on_after DATE,source_type VARCHAR(32),source_no VARCHAR(128),occurred_date DATE,payment_method VARCHAR(32),reference_no VARCHAR(128),operator_id BIGINT,operator_name VARCHAR(128),remark VARCHAR(500),created_at TIMESTAMP)");
jdbc.execute("CREATE TABLE fin_audit_log(tenant_id BIGINT,resource_type VARCHAR(64),resource_id BIGINT,action VARCHAR(64),reason VARCHAR(500),before_data TEXT,after_data TEXT,operator_id BIGINT,operator_name_snapshot VARCHAR(128),request_id VARCHAR(128),trace_id VARCHAR(128))");
jdbc.update("INSERT INTO fin_wallet_account VALUES(9,'CNY',200,100,100,0,0,0,NULL,0,0,0,CURRENT_TIMESTAMP)");
jdbc.update("INSERT INTO fin_wallet_hold(id,customer_id,business_type,business_no,amount,actual_frozen_amount,credit_frozen_amount,status) VALUES(1,9,'PROCUREMENT_FEE','PF-1',100,100,0,'FROZEN')");
FinanceDocumentNumberGenerator numbers = mock(FinanceDocumentNumberGenerator.class);
AtomicInteger sequence = new AtomicInteger();
when(numbers.next("AC")).thenAnswer(i -> "AC-TEST-" + sequence.incrementAndGet());
wallet = new FinanceWalletService(jdbc, new ObjectMapper().findAndRegisterModules(),
mock(FinanceFileClient.class), numbers, "token", "", "test", "test");
}
@Test
void partialSettlementKeepsEstimateAndRecordsActualExactlyOnce() {
WalletHold first = settle("request-1", "60");
WalletHold replay = settle("request-1", "60");
assertThat(replay.actionLedgerId()).isEqualTo(first.actionLedgerId());
assertThat(first.amount()).isEqualByComparingTo("100");
assertThat(first.account().actualBalance()).isEqualByComparingTo("140");
assertThat(first.account().frozenBalance()).isZero();
assertThat(jdbc.queryForObject("SELECT amount FROM fin_wallet_ledger", BigDecimal.class)).isEqualByComparingTo("-60");
assertThatThrownBy(() -> settle("different-request", "60")).isInstanceOf(FinanceEventException.class);
assertThat(jdbc.queryForObject("SELECT COUNT(*) FROM fin_wallet_ledger", Integer.class)).isEqualTo(1);
}
@Test
void sameKeyWithDifferentAmountCannotChangeCharge() {
settle("request-1", "60");
assertThatThrownBy(() -> settle("request-1", "70")).isInstanceOf(FinanceEventException.class)
.extracting(e -> ((FinanceEventException) e).code()).isEqualTo("FIN-IDEMPOTENCY-CONFLICT");
assertThat(wallet.account(9).actualBalance()).isEqualByComparingTo("140");
}
@Test
void insufficientDifferenceLeavesOriginalHoldAndAccountUntouched() {
assertThatThrownBy(() -> settle("request-1", "201")).isInstanceOf(FinanceEventException.class);
assertUntouched();
assertThat(jdbc.queryForObject("SELECT COUNT(*) FROM fin_idempotency_record", Integer.class)).isZero();
}
@Test
void auditFailureRollsBackDebitLedgerHoldAndIdempotencyReservation() {
doThrow(new TransientDataAccessResourceException("audit storage unavailable"))
.when(jdbc).update(startsWith("INSERT INTO fin_audit_log"), any(Object[].class));
assertThatThrownBy(() -> settle("request-1", "150"))
.isInstanceOf(TransientDataAccessResourceException.class);
assertUntouched();
assertThat(jdbc.queryForObject("SELECT COUNT(*) FROM fin_idempotency_record", Integer.class)).isZero();
}
@Test
void concurrentDifferentRequestsCannotSettleTheSameGoodsTwice() throws Exception {
ExecutorService executor = Executors.newFixedThreadPool(2);
CountDownLatch start = new CountDownLatch(1);
try {
Future<Boolean> one = executor.submit(() -> attempt(start, "one"));
Future<Boolean> two = executor.submit(() -> attempt(start, "two"));
start.countDown();
assertThat((one.get(10, TimeUnit.SECONDS) ? 1 : 0) + (two.get(10, TimeUnit.SECONDS) ? 1 : 0)).isEqualTo(1);
assertThat(wallet.account(9).actualBalance()).isEqualByComparingTo("50");
assertThat(jdbc.queryForObject("SELECT COUNT(*) FROM fin_wallet_ledger", Integer.class)).isEqualTo(1);
} finally {
executor.shutdownNow();
assertThat(executor.awaitTermination(5, TimeUnit.SECONDS)).isTrue();
}
}
private boolean attempt(CountDownLatch start, String key) throws InterruptedException {
if (!start.await(5, TimeUnit.SECONDS)) throw new AssertionError("start timeout");
try { settle(key, "150"); return true; }
catch (FinanceEventException expected) {
assertThat(expected.code()).isEqualTo("FIN-WALLET-HOLD-409");
return false;
}
}
@Test
void refundsAreBoundedByOriginalConsumptionAndCannotReplayWithNewKey() {
WalletHold settled = settle("settle", "60");
var refund = tx.execute(s -> wallet.refundConsumption(9, settled.actionLedgerId(), "RF-1", "refund-1",
new BigDecimal("40"), 7, "finance", "confirmed correction"));
var replay = tx.execute(s -> wallet.refundConsumption(9, settled.actionLedgerId(), "RF-1", "new-key",
new BigDecimal("40"), 7, "finance", "confirmed correction"));
assertThat(replay.ledgerId()).isEqualTo(refund.ledgerId());
assertThat(wallet.account(9).actualBalance()).isEqualByComparingTo("180");
assertThatThrownBy(() -> tx.execute(s -> wallet.refundConsumption(9, settled.actionLedgerId(), "RF-2", "refund-2",
new BigDecimal("20.01"), 7, "finance", "too much")))
.isInstanceOf(FinanceEventException.class)
.extracting(e -> ((FinanceEventException) e).code()).isEqualTo("FIN-WALLET-REFUND-EXCEEDED");
tx.execute(s -> wallet.refundConsumption(9, settled.actionLedgerId(), "RF-2", "refund-2",
new BigDecimal("20"), 7, "finance", "remaining refund"));
assertThat(wallet.account(9).actualBalance()).isEqualByComparingTo("200");
assertThat(jdbc.queryForObject("SELECT status FROM fin_wallet_hold", String.class)).isEqualTo("SETTLED");
assertThat(jdbc.queryForObject("SELECT SUM(amount) FROM fin_wallet_ledger WHERE source_type='BUSINESS_REFUND'", BigDecimal.class))
.isEqualByComparingTo("60");
}
@Test
void refundCannotReferenceAnotherCustomerOrAnUnsettledReservation() {
WalletHold settled = settle("settle", "60");
assertThatThrownBy(() -> tx.execute(s -> wallet.refundConsumption(10, settled.actionLedgerId(), "RF-1", "refund-1",
BigDecimal.ONE, 7, "finance", "wrong customer"))).isInstanceOf(FinanceEventException.class);
assertThatThrownBy(() -> tx.execute(s -> wallet.refundConsumption(9, settled.actionLedgerId(), "RF-1", "refund-1",
BigDecimal.ZERO, 7, "finance", "zero refund"))).isInstanceOf(FinanceEventException.class);
assertThat(wallet.account(9).actualBalance()).isEqualByComparingTo("140");
}
@Test
void refundFailureRollsBackBalanceAndCanRetryOriginalRequest() {
WalletHold settled = settle("settle", "60");
doThrow(new TransientDataAccessResourceException("audit unavailable"))
.when(jdbc).update(startsWith("INSERT INTO fin_audit_log"), any(Object[].class));
assertThatThrownBy(() -> tx.execute(s -> wallet.refundConsumption(9, settled.actionLedgerId(), "RF-1", "refund-1",
new BigDecimal("20"), 7, "finance", "correction"))).isInstanceOf(TransientDataAccessResourceException.class);
assertThat(wallet.account(9).actualBalance()).isEqualByComparingTo("140");
assertThat(jdbc.queryForObject("SELECT COUNT(*) FROM fin_wallet_ledger WHERE change_type='REFUND'", Integer.class)).isZero();
doCallRealMethod().when(jdbc).update(startsWith("INSERT INTO fin_audit_log"), any(Object[].class));
tx.execute(s -> wallet.refundConsumption(9, settled.actionLedgerId(), "RF-1", "refund-1",
new BigDecimal("20"), 7, "finance", "correction"));
assertThat(wallet.account(9).actualBalance()).isEqualByComparingTo("160");
}
private WalletHold settle(String key, String amount) {
return tx.execute(s -> wallet.settleActual(9, "PROCUREMENT_FEE", "PF-1", key, new BigDecimal(amount), "actual freight"));
}
@Test
void concurrentRefundsCannotExceedTheOriginalConsumption() throws Exception {
WalletHold original = settle("settle", "60");
ExecutorService executor = Executors.newFixedThreadPool(2);
CountDownLatch start = new CountDownLatch(1);
try {
Future<Boolean> one = executor.submit(() -> refundAttempt(start, original.actionLedgerId(), "RF-A"));
Future<Boolean> two = executor.submit(() -> refundAttempt(start, original.actionLedgerId(), "RF-B"));
start.countDown();
assertThat((one.get(10, TimeUnit.SECONDS) ? 1 : 0) + (two.get(10, TimeUnit.SECONDS) ? 1 : 0)).isEqualTo(1);
assertThat(wallet.account(9).actualBalance()).isEqualByComparingTo("180");
assertThat(jdbc.queryForObject("SELECT SUM(amount) FROM fin_wallet_ledger WHERE change_type='REFUND'", BigDecimal.class))
.isEqualByComparingTo("40");
} finally {
executor.shutdownNow();
assertThat(executor.awaitTermination(5, TimeUnit.SECONDS)).isTrue();
}
}
private boolean refundAttempt(CountDownLatch start, long originalId, String number) throws InterruptedException {
if (!start.await(5, TimeUnit.SECONDS)) throw new AssertionError("start timeout");
try {
tx.execute(s -> wallet.refundConsumption(9, originalId, number, number, new BigDecimal("40"),
7, "finance", "correction"));
return true;
} catch (FinanceEventException expected) {
assertThat(expected.code()).isEqualTo("FIN-WALLET-REFUND-EXCEEDED");
return false;
}
}
private void assertUntouched() {
assertThat(wallet.account(9).actualBalance()).isEqualByComparingTo("200");
assertThat(wallet.account(9).frozenBalance()).isEqualByComparingTo("100");
assertThat(jdbc.queryForObject("SELECT status FROM fin_wallet_hold", String.class)).isEqualTo("FROZEN");
assertThat(jdbc.queryForObject("SELECT COUNT(*) FROM fin_wallet_ledger", Integer.class)).isZero();
}
}
@@ -12,6 +12,11 @@ import java.util.List;
@FeignClient(name = "warehouse-service", contextId = "firstlegWarehouseMasterDataClient", @FeignClient(name = "warehouse-service", contextId = "firstlegWarehouseMasterDataClient",
url = "${baiyue.clients.warehouse.url:}", path = "/internal/warehouses") url = "${baiyue.clients.warehouse.url:}", path = "/internal/warehouses")
public interface WarehouseMasterDataClient { public interface WarehouseMasterDataClient {
@GetMapping("/order-catalog")
ApiResponse<List<CatalogWarehouse>> catalog(@RequestHeader("X-Internal-Service-Token") String token);
record CatalogWarehouse(Long id, String warehouseCode, String warehouseName, String warehouseType, String countryCode) { }
@GetMapping("/{tenantId}/{warehouseId}/active") @GetMapping("/{tenantId}/{warehouseId}/active")
ApiResponse<Detail> active(@RequestHeader("X-Internal-Service-Token") String token, ApiResponse<Detail> active(@RequestHeader("X-Internal-Service-Token") String token,
@PathVariable long tenantId, @PathVariable long tenantId,
@@ -26,6 +26,12 @@ import java.util.List;
public class MerchantContainerCustomsController { public class MerchantContainerCustomsController {
@Resource private ContainerCustomsService service; @Resource private ContainerCustomsService service;
@GetMapping("/pending-summary")
@PreAuthorize("hasAuthority('merchant:order:view')")
public ApiResponse<PendingSummary> pendingSummary(@AuthenticationPrincipal AuthenticatedUser user) {
return ApiResponse.success(service.merchantPendingSummary(FirstlegScopeGuard.merchant(user)));
}
@GetMapping("/orders/{orderId}") @GetMapping("/orders/{orderId}")
@PreAuthorize("hasAuthority('merchant:order:view')") @PreAuthorize("hasAuthority('merchant:order:view')")
public ApiResponse<ContainerView> order(@AuthenticationPrincipal AuthenticatedUser user, public ApiResponse<ContainerView> order(@AuthenticationPrincipal AuthenticatedUser user,
@@ -74,4 +74,5 @@ public final class ContainerCustomsDtos {
@Size(max = 1000) String resolution) {} @Size(max = 1000) String resolution) {}
public record Download(String fileName, String contentType, byte[] content) {} public record Download(String fileName, String contentType, byte[] content) {}
public record PendingSummary(long pendingCount) {}
} }
@@ -87,6 +87,42 @@ public interface ContainerCustomsMapper {
""") """)
Long completedPlanForOrder(@Param("tenantId") long tenantId, @Param("orderId") long orderId); Long completedPlanForOrder(@Param("tenantId") long tenantId, @Param("orderId") long orderId);
/** One customer action badge per actual loaded cabinet, including receipt confirmation. */
@Select("""
SELECT COUNT(DISTINCT p.container_booking_id)
FROM fl_loading_plan p
JOIN fl_container_booking b ON b.id=p.container_booking_id AND b.record_status='ACTIVE'
JOIN fl_loading_plan_item item ON item.loading_plan_id=p.id AND item.deleted=0
JOIN fl_inbound_order i ON i.id=item.inbound_id AND i.tenant_id=item.account_id AND i.deleted=0
LEFT JOIN fl_customs_container c ON c.loading_plan_id=p.id
WHERE p.plan_status='COMPLETED' AND i.tenant_id=#{tenantId} AND i.tax_mode='TAX_REFUND'
AND
""" + ACTUAL_ITEM_SCOPE + """
AND p.id=(
SELECT latest.id FROM fl_loading_plan latest
JOIN fl_loading_plan_item item ON item.loading_plan_id=latest.id AND item.deleted=0
JOIN fl_inbound_order own ON own.id=item.inbound_id AND own.tenant_id=item.account_id AND own.deleted=0
WHERE latest.plan_status='COMPLETED' AND own.tenant_id=i.tenant_id AND own.order_id=i.order_id
AND own.tax_mode='TAX_REFUND' AND
""" + ACTUAL_ITEM_SCOPE + """
ORDER BY COALESCE(latest.confirmed_at,latest.updated_at) DESC,latest.id DESC LIMIT 1
)
AND (
((c.id IS NULL OR c.status IN ('WAITING_CUSTOMER_DOCUMENTS','READY_TO_START')) AND NOT EXISTS (
SELECT 1 FROM fl_customs_customer_document_inbound scope
JOIN fl_customs_customer_document d ON d.id=scope.document_id AND d.status='ACTIVE'
WHERE d.customs_container_id=c.id AND d.tenant_id=i.tenant_id
AND scope.tenant_id=i.tenant_id AND scope.inbound_id=i.id))
OR (c.status='DECLARING' AND EXISTS (
SELECT 1 FROM fl_customs_customer_document d
JOIN fl_customs_customer_document_inbound scope ON scope.document_id=d.id AND scope.tenant_id=d.tenant_id
JOIN fl_customs_completion_document receipt ON receipt.source_document_id=d.id
WHERE d.customs_container_id=c.id AND d.tenant_id=i.tenant_id AND d.status='ACTIVE'
AND d.frozen_at IS NOT NULL AND scope.inbound_id=i.id AND receipt.customer_confirm_status='PENDING'))
)
""")
long merchantPendingCount(@Param("tenantId") long tenantId);
@Insert(""" @Insert("""
INSERT INTO fl_customs_container INSERT INTO fl_customs_container
(id,loading_plan_id,container_booking_id,status,created_at,updated_at,version) (id,loading_plan_id,container_booking_id,status,created_at,updated_at,version)
@@ -44,6 +44,11 @@ public class ContainerCustomsService {
@Resource private ApplicationEventPublisher events; @Resource private ApplicationEventPublisher events;
@Value("${baiyue.security.internal-service-token}") private String internalToken; @Value("${baiyue.security.internal-service-token}") private String internalToken;
@Transactional(readOnly = true)
public PendingSummary merchantPendingSummary(long tenantId) {
return new PendingSummary(mapper.merchantPendingCount(tenantId));
}
@Transactional @Transactional
public ContainerView platformView(long planId) { public ContainerView platformView(long planId) {
List<InboundRow> rows = actualPlanRows(planId); List<InboundRow> rows = actualPlanRows(planId);
@@ -13,5 +13,8 @@ public final class MerchantWorkbenchFilters {
@Pattern(regexp = "WAIT_MEASURE|WAIT_PALLETIZE|WAIT_SPLIT|LOADING|LOADED|DELIVERED") String mainStatus) {} @Pattern(regexp = "WAIT_MEASURE|WAIT_PALLETIZE|WAIT_SPLIT|LOADING|LOADED|DELIVERED") String mainStatus) {}
public record Response(List<Long> matchingStatusOrderIds, List<Long> feeOrderIds, public record Response(List<Long> matchingStatusOrderIds, List<Long> feeOrderIds,
List<Long> customsOrderIds) {} List<Long> customsOrderIds, List<Progress> progress) {}
public record Progress(long orderId, String stage, boolean partial) {}
public record Fragment(long orderId, int stage) {}
} }
@@ -63,4 +63,29 @@ public interface MerchantWorkbenchFilterMapper {
ORDER BY i.order_id ORDER BY i.order_id
""") """)
List<Long> pendingCustoms(@Param("tenantId") long tenantId); List<Long> pendingCustoms(@Param("tenantId") long tenantId);
/** Only physically loaded fragments can expose container milestones to the customer. */
@Select("""
SELECT o.order_id, CASE WHEN owned.container_booking_id IS NULL THEN 0
WHEN EXISTS (SELECT 1 FROM fl_carrier_schedule_node_fact n
WHERE n.container_booking_id=owned.container_booking_id
AND n.standard_node='PICKUP_READY' AND n.actual_at IS NOT NULL) THEN 3
WHEN EXISTS (SELECT 1 FROM fl_customs_container c
WHERE c.loading_plan_id=owned.loading_plan_id AND c.status='COMPLETED') THEN 2
ELSE 1 END AS stage
FROM fl_inbound_order o
LEFT JOIN (
SELECT DISTINCT i.inbound_id, i.account_id, p.id AS loading_plan_id, p.container_booking_id
FROM fl_loading_plan_item i
JOIN fl_loading_plan p ON p.id=i.loading_plan_id AND p.plan_status='COMPLETED'
JOIN fl_loading_pick_task t ON t.loading_plan_id=p.id AND t.task_status='COMPLETED'
JOIN fl_loading_pick_item picked ON picked.pick_task_id=t.id AND picked.loading_plan_item_id=i.id
JOIN fl_container_booking b ON b.id=p.container_booking_id AND b.record_status='ACTIVE'
WHERE i.account_id=#{tenantId} AND i.deleted=0
AND picked.item_status IN ('PICKED','PARTIAL') AND picked.picked_package_count>0
) owned ON owned.inbound_id=o.id AND owned.account_id=o.tenant_id
WHERE o.tenant_id=#{tenantId} AND o.deleted=0 AND o.order_id IS NOT NULL
AND o.process_status <> 'CANCELLED'
ORDER BY o.order_id
""")
List<com.baiyue.firstleg.dto.MerchantWorkbenchFilters.Fragment> progressFragments(@Param("tenantId") long tenantId);
} }
@@ -0,0 +1,28 @@
package com.baiyue.firstleg.portschedule.controller;
import com.baiyue.common.core.api.ApiResponse;
import com.baiyue.firstleg.portschedule.service.AppointmentForecastService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.http.HttpStatus;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.List;
@RestController
@RequestMapping("/internal/firstleg/appointment-forecasts")
public class InternalAppointmentForecastController {
public record Request(List<Long> containerBookingIds) { }
private final AppointmentForecastService service;
private final String token;
public InternalAppointmentForecastController(AppointmentForecastService service,
@Value("${baiyue.security.internal-service-token:}") String token){this.service=service;this.token=token;}
@PostMapping("/batch")
public ApiResponse<List<AppointmentForecastService.Forecast>> batch(
@RequestHeader(value="X-Internal-Service-Token",required=false) String supplied,@RequestBody Request request) {
if(token==null || token.isBlank() || supplied==null || !MessageDigest.isEqual(token.getBytes(StandardCharsets.UTF_8),supplied.getBytes(StandardCharsets.UTF_8)))
throw new ResponseStatusException(HttpStatus.UNAUTHORIZED,"内部身份无效");
return ApiResponse.success(service.batch(request==null?null:request.containerBookingIds()));
}
}
@@ -0,0 +1,26 @@
package com.baiyue.firstleg.portschedule.mapper;
import org.apache.ibatis.annotations.*;
import java.time.LocalDateTime;
import java.util.List;
@Mapper
public interface AppointmentForecastMapper {
record Fact(Long containerBookingId,Long factId,String providerCode,String sourceReference,
LocalDateTime observedAt,LocalDateTime estimatedAt,LocalDateTime actualAt) { }
@Select("""
<script>
SELECT container_booking_id,fact_id,provider_code,source_reference,observed_at,estimated_at,actual_at
FROM (
SELECT f.container_booking_id,f.id AS fact_id,f.provider_code,f.source_reference,
f.observed_at,f.estimated_at,f.actual_at,
ROW_NUMBER() OVER (PARTITION BY f.container_booking_id ORDER BY f.observed_at DESC,f.id DESC) AS position
FROM fl_carrier_schedule_node_fact f JOIN fl_container_booking c ON c.id=f.container_booking_id
WHERE c.record_status='ACTIVE' AND f.standard_node='ARRIVED_DESTINATION_PORT'
AND f.container_booking_id IN
<foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach>
) ranked WHERE position&lt;=2 ORDER BY container_booking_id,position
</script>
""")
List<Fact> latest(@Param("ids") List<Long> containerIds);
}
@@ -0,0 +1,26 @@
package com.baiyue.firstleg.portschedule.service;
import com.baiyue.firstleg.portschedule.mapper.AppointmentForecastMapper;
import org.springframework.stereotype.Service;
import org.springframework.http.HttpStatus;
import org.springframework.web.server.ResponseStatusException;
import java.util.*;
import java.util.stream.Collectors;
/** Forecast facts are read from their owning service, never inferred from an order snapshot. */
@Service
public class AppointmentForecastService {
public record Forecast(Long containerBookingId,AppointmentForecastMapper.Fact latest,
AppointmentForecastMapper.Fact previous,String timeBasis) { }
private final AppointmentForecastMapper mapper;
public AppointmentForecastService(AppointmentForecastMapper mapper){this.mapper=mapper;}
public List<Forecast> batch(List<Long> ids) {
if(ids==null || ids.isEmpty() || ids.size()>200 || ids.stream().anyMatch(id->id==null || id<=0)
|| new HashSet<>(ids).size()!=ids.size()) throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"每批须提供1至200个不重复的柜次");
var facts=mapper.latest(ids).stream().collect(Collectors.groupingBy(AppointmentForecastMapper.Fact::containerBookingId));
return ids.stream().map(id->{
var rows=facts.getOrDefault(id,List.of());
return new Forecast(id,rows.isEmpty()?null:rows.get(0),rows.size()<2?null:rows.get(1),"SOURCE_LOCAL_UNSPECIFIED");
}).toList();
}
}
@@ -10,10 +10,22 @@ public class MerchantWorkbenchFilterService {
@Resource private MerchantWorkbenchFilterMapper mapper; @Resource private MerchantWorkbenchFilterMapper mapper;
@Resource private UnifiedInboundQueryService unified; @Resource private UnifiedInboundQueryService unified;
@org.springframework.transaction.annotation.Transactional(readOnly=true)
public MerchantWorkbenchFilters.Response read(MerchantWorkbenchFilters.Request request) { public MerchantWorkbenchFilters.Response read(MerchantWorkbenchFilters.Request request) {
return new MerchantWorkbenchFilters.Response( return new MerchantWorkbenchFilters.Response(
request.mainStatus() == null ? null : mapper.byProcessStatuses(request.tenantId(), request.mainStatus() == null ? null : mapper.byProcessStatuses(request.tenantId(),
unified.internalStatuses(request.mainStatus())), unified.internalStatuses(request.mainStatus())),
mapper.pendingFees(request.tenantId()), mapper.pendingCustoms(request.tenantId())); mapper.pendingFees(request.tenantId()), mapper.pendingCustoms(request.tenantId()),
progress(mapper.progressFragments(request.tenantId())));
}
static java.util.List<MerchantWorkbenchFilters.Progress> progress(java.util.List<MerchantWorkbenchFilters.Fragment> facts) {
var grouped = facts.stream().collect(java.util.stream.Collectors.groupingBy(MerchantWorkbenchFilters.Fragment::orderId));
return grouped.entrySet().stream().sorted(java.util.Map.Entry.comparingByKey()).map(entry -> {
int max = entry.getValue().stream().mapToInt(MerchantWorkbenchFilters.Fragment::stage).max().orElse(0);
boolean partial = entry.getValue().stream().anyMatch(fragment -> fragment.stage() < max);
return new MerchantWorkbenchFilters.Progress(entry.getKey(),
switch(max) { case 1 -> "loaded"; case 2 -> "declared"; case 3 -> "cleared"; default -> "none"; }, partial);
}).filter(fact -> !"none".equals(fact.stage())).toList();
} }
} }
@@ -41,6 +41,17 @@ import java.util.List;
@RequestMapping("/api/platform/v1/terminal-drayages") @RequestMapping("/api/platform/v1/terminal-drayages")
public class PlatformTerminalDrayageController { public class PlatformTerminalDrayageController {
@Resource private TerminalDrayageMailService mails; @Resource private TerminalDrayageMailService mails;
@Resource private com.baiyue.firstleg.terminaldrayage.service.TerminalDrayageCalendarService calendar;
@GetMapping("/calendar")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:firstleg:terminal-drayage:list')")
public ApiResponse<com.baiyue.firstleg.terminaldrayage.service.TerminalDrayageCalendarService.Calendar> calendar(
@AuthenticationPrincipal AuthenticatedUser user,
@RequestParam @org.springframework.format.annotation.DateTimeFormat(iso=org.springframework.format.annotation.DateTimeFormat.ISO.DATE) java.time.LocalDate from,
@RequestParam @org.springframework.format.annotation.DateTimeFormat(iso=org.springframework.format.annotation.DateTimeFormat.ISO.DATE) java.time.LocalDate to) {
FirstlegScopeGuard.platform(user);
return ApiResponse.success(calendar.calendar(from,to));
}
@PostMapping("/{containerBookingId}/pickup-email") @PostMapping("/{containerBookingId}/pickup-email")
@PreAuthorize("hasAuthority('platform:firstleg:terminal-drayage:fleet:edit')") @PreAuthorize("hasAuthority('platform:firstleg:terminal-drayage:fleet:edit')")
@@ -0,0 +1,8 @@
package com.baiyue.firstleg.terminaldrayage.dto;
import java.time.LocalDateTime;
/** Original pickup appointment wall time; the source does not establish a port time zone. */
public record PickupCalendarEntry(Long containerBookingId, String bookingNo, String containerNo,
String destinationPortName, String destinationWarehouseCode, String fleetSupplierName,
LocalDateTime pickupAppointmentAt, LocalDateTime actualPickupAt) { }
@@ -14,6 +14,19 @@ import java.util.List;
@Mapper @Mapper
public interface TerminalDrayageMapper extends BaseMapper<TerminalDrayageEntity> { public interface TerminalDrayageMapper extends BaseMapper<TerminalDrayageEntity> {
@Select("""
SELECT c.id containerBookingId,c.booking_no bookingNo,c.container_no containerNo,
c.destination_port_name destinationPortName,c.destination_warehouse_code destinationWarehouseCode,
t.fleet_supplier_name fleetSupplierName,t.pickup_appointment_at pickupAppointmentAt,NULL actualPickupAt
FROM fl_terminal_drayage t JOIN fl_container_booking c ON c.id=t.container_booking_id
WHERE c.record_status='ACTIVE' AND t.pickup_appointment_at>=#{from} AND t.pickup_appointment_at<#{to}
AND EXISTS(SELECT 1 FROM fl_outbound_dispatch d WHERE d.container_booking_id=c.id
AND d.confirmed_at IS NOT NULL AND d.reversed_at IS NULL AND d.status='WAITING_FOR_LOADING')
ORDER BY t.pickup_appointment_at,c.id LIMIT #{limit}
""")
List<com.baiyue.firstleg.terminaldrayage.dto.PickupCalendarEntry> calendar(
@Param("from") LocalDateTime from,@Param("to") LocalDateTime to,@Param("limit") int limit);
@Select(""" @Select("""
SELECT b.id AS containerBookingId,b.container_no AS containerNo,b.ocean_booking_id AS oceanBookingId, SELECT b.id AS containerBookingId,b.container_no AS containerNo,b.ocean_booking_id AS oceanBookingId,
b.record_status AS recordStatus,b.unloading_completed_at AS unloadingCompletedAt b.record_status AS recordStatus,b.unloading_completed_at AS unloadingCompletedAt
@@ -0,0 +1,57 @@
package com.baiyue.firstleg.terminaldrayage.service;
import com.baiyue.firstleg.client.WarehouseMasterDataClient;
import com.baiyue.firstleg.terminaldrayage.dto.PickupCalendarEntry;
import com.baiyue.firstleg.terminaldrayage.mapper.TerminalDrayageMapper;
import com.baiyue.firstleg.portschedule.service.CarrierScheduleQueryService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ResponseStatusException;
import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.*;
@Service
public class TerminalDrayageCalendarService {
private final TerminalDrayageMapper mapper;
private final WarehouseMasterDataClient warehouses;
private final String token;
private final CarrierScheduleQueryService shipping;
public TerminalDrayageCalendarService(TerminalDrayageMapper mapper,WarehouseMasterDataClient warehouses,
CarrierScheduleQueryService shipping,
@Value("${baiyue.security.internal-service-token}") String token) {this.mapper=mapper;this.warehouses=warehouses;this.shipping=shipping;this.token=token;}
public record Calendar(List<PickupCalendarEntry> records,boolean truncated,int unclassifiedCount,
String scopeBasis,String timeBasis) { }
public Calendar calendar(LocalDate from,LocalDate to) {
if(from==null || to==null || !to.isAfter(from) || ChronoUnit.DAYS.between(from,to)>42)
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"日历查询范围必须为1至42天");
var rows=mapper.calendar(from.atStartOfDay(),to.atStartOfDay(),1001);
if(rows.isEmpty()) return result(List.of(),false,0);
final Map<String,String> countries=new HashMap<>();
try {
var response=warehouses.catalog(token);
if(response==null || !response.successful() || response.data()==null) throw new IllegalStateException();
for(var warehouse:response.data()) if(warehouse!=null && warehouse.warehouseCode()!=null && warehouse.countryCode()!=null)
countries.put(warehouse.warehouseCode(),warehouse.countryCode());
} catch(RuntimeException error) {throw new ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE,"提柜目的仓范围暂不可核实",error);}
var records=new ArrayList<PickupCalendarEntry>();int unknown=0;
for(var row:rows.stream().limit(1000).toList()) {
var country=countries.get(row.destinationWarehouseCode());
if(country==null || country.isBlank()) unknown++;
else if("US".equals(country)) records.add(row);
}
var actual=new HashMap<Long,java.time.LocalDateTime>();
var ids=records.stream().map(PickupCalendarEntry::containerBookingId).distinct().toList();
for(int start=0;start<ids.size();start+=200) {
for(var fact:shipping.containerActualFacts(ids.subList(start,Math.min(start+200,ids.size()))))
if(fact.pickedUpAt()!=null) actual.put(fact.containerBookingId(),fact.pickedUpAt());
}
var enriched=records.stream().map(row->new PickupCalendarEntry(row.containerBookingId(),row.bookingNo(),row.containerNo(),
row.destinationPortName(),row.destinationWarehouseCode(),row.fleetSupplierName(),row.pickupAppointmentAt(),actual.get(row.containerBookingId()))).toList();
return result(enriched,rows.size()>1000,unknown);
}
private Calendar result(List<PickupCalendarEntry> records,boolean truncated,int unknown) {
return new Calendar(List.copyOf(records),truncated,unknown,"US_DESTINATION_WAREHOUSE","SOURCE_LOCAL_UNSPECIFIED");
}
}
@@ -0,0 +1,54 @@
openapi: 3.0.3
info:
title: 预约筹划船期事实内部查询
version: 1.0.0
paths:
/internal/firstleg/appointment-forecasts/batch:
post:
operationId: readAppointmentForecastFacts
summary: 批量读取有效柜次最新两个到港船节点观察
description: 仅内部服务令牌,不开放公网。最多200个不重复柜次,一次批量读取;按照观察时间及事实ID降序。最新观察没有预计时间时保持空,不沿用旧ETA;实际到港单独返回。缺失或非有效柜次返回空latest/previous。原来源时间没有可靠时区,明确SOURCE_LOCAL_UNSPECIFIED,不转成UTC或伪造备妥时间。
security: [{internalToken: []}]
requestBody:
required: true
content:
application/json:
schema:
type: object
required: [containerBookingIds]
properties:
containerBookingIds: {type: array, minItems: 1, maxItems: 200, uniqueItems: true, items: {type: integer, format: int64, minimum: 1}}
responses:
'200':
description: ApiResponse;每个请求柜次恰好一行,按请求顺序
content:
application/json:
schema:
type: object
properties:
code: {type: string}
data:
type: array
items:
type: object
properties:
containerBookingId: {type: string}
timeBasis: {type: string, enum: [SOURCE_LOCAL_UNSPECIFIED]}
latest: {$ref: '#/components/schemas/Fact'}
previous: {$ref: '#/components/schemas/Fact'}
'401': {description: 内部身份缺失、错误或服务端未配置}
components:
securitySchemes:
internalToken: {type: apiKey, in: header, name: X-Internal-Service-Token}
schemas:
Fact:
type: object
nullable: true
properties:
containerBookingId: {type: string}
factId: {type: string, description: 技术关联标识,不展示为业务编号}
providerCode: {type: string, nullable: true}
sourceReference: {type: string, nullable: true}
observedAt: {type: string, nullable: true, description: 来源观察时间}
estimatedAt: {type: string, nullable: true, description: 来源当地预计到港时间,时区未核实}
actualAt: {type: string, nullable: true, description: 来源实际到港时间,与预测分开}
@@ -1,6 +1,28 @@
openapi: 3.0.3 openapi: 3.0.3
info: {title: Firstleg Container Customs API, version: 2.0.0} info: {title: Firstleg Container Customs API, version: 2.0.0}
paths: paths:
/api/merchant/v1/customs/pending-summary:
get:
summary: 当前客户报关资料待处理柜次数量
description: >-
权限merchant:order:view,客户范围仅来自认证上下文。只读COUNT,不创建报关记录。
最新实际已装柜的退税货物尚未被本客户有效资料覆盖,或DECLARING阶段本客户冻结资料的当前回执为PENDING,均计入。
同柜多票、多份资料只计一次;已打回等待平台重做、已确认、已完成及其他客户的待办不计入。
x-permission: merchant:order:view
responses:
'200':
description: ApiResponse,code为200时才成功;失败不能解释为零待办
content:
application/json:
schema:
type: object
properties:
code: {type: string}
data:
type: object
required: [pendingCount]
properties:
pendingCount: {type: string, pattern: '^[0-9]+$'}
/api/platform/v1/customs/loading-plans/{planId}: /api/platform/v1/customs/loading-plans/{planId}:
get: get:
summary: 查询整柜报关状态、缺资料票及文件映射 summary: 查询整柜报关状态、缺资料票及文件映射
@@ -378,11 +378,22 @@ paths:
code: {type: string} code: {type: string}
data: data:
type: object type: object
required: [feeOrderIds, customsOrderIds] required: [feeOrderIds, customsOrderIds, progress]
properties: properties:
matchingStatusOrderIds: {type: array, nullable: true, items: {type: integer, format: int64}} matchingStatusOrderIds: {type: array, nullable: true, items: {type: integer, format: int64}}
feeOrderIds: {type: array, items: {type: integer, format: int64}} feeOrderIds: {type: array, items: {type: integer, format: int64}}
customsOrderIds: {type: array, items: {type: integer, format: int64}} customsOrderIds: {type: array, items: {type: integer, format: int64}}
progress:
type: array
description: 实际装载片段投影;报关要求COMPLETED,目的港清关要求PICKUP_READY实际时间,缺失节点不推测。
items:
type: object
required: [orderId, stage, partial]
properties:
orderId: {type: integer, format: int64}
stage: {type: string, enum: [loaded, declared, cleared]}
partial: {type: boolean}
/internal/firstleg/v1/inbounds/unified-orders/query: /internal/firstleg/v1/inbounds/unified-orders/query:
post: post:
summary: 按统一订单条件分页查询履约摘要(Order 内部) summary: 按统一订单条件分页查询履约摘要(Order 内部)
@@ -1,6 +1,48 @@
openapi: 3.0.3 openapi: 3.0.3
info: {title: Firstleg Terminal Drayage API, version: 1.0.0} info: {title: Firstleg Terminal Drayage API, version: 1.0.0}
paths: paths:
/api/platform/v1/terminal-drayages/calendar:
get:
summary: 美国目的仓相关的提柜预约日历
description: 平台身份,同时要求预约列表和码头拖车列表权限。按原业务预约提柜日期查询,不将实际提柜或预计到仓替代预约时间。美国范围按启用目的仓国家确认,不代表已确认港口所在国。原字段未提供港口时区,timeBasis明确待核实,禁止当作UTC或套用收货仓时区。最多42天、读取1001条以检测截断;返回最多1000条中的美国范围记录,未知目的仓计入unclassifiedCount,不能将缺失数据当零。
x-permissions: [platform:appointment:list, 'platform:firstleg:terminal-drayage:list']
parameters:
- {name: from, in: query, required: true, schema: {type: string, format: date}, description: 包含的原业务当地日期}
- {name: to, in: query, required: true, schema: {type: string, format: date}, description: 不包含的原业务当地日期}
responses:
'200':
description: 业务响应,code为200;仓库目录不可用则返回错误,不假装空列表
content:
application/json:
schema:
type: object
properties:
code: {type: string}
data:
type: object
required: [records, truncated, unclassifiedCount, scopeBasis, timeBasis]
properties:
truncated: {type: boolean}
unclassifiedCount: {type: integer, minimum: 0}
scopeBasis: {type: string, enum: [US_DESTINATION_WAREHOUSE]}
timeBasis: {type: string, enum: [SOURCE_LOCAL_UNSPECIFIED]}
records:
type: array
maxItems: 1000
items:
type: object
properties:
containerBookingId: {type: string, description: 仅用于来源详情定位}
bookingNo: {type: string}
containerNo: {type: string, nullable: true}
destinationPortName: {type: string, nullable: true}
destinationWarehouseCode: {type: string, nullable: true}
fleetSupplierName: {type: string, nullable: true}
pickupAppointmentAt: {type: string, description: 原业务当地时间,无时区偏移,不是UTC时间点}
actualPickupAt: {type: string, nullable: true}
'400': {description: 日期范围非法}
'403': {description: 非平台身份或权限不足}
'503': {description: 无法核对仓库范围}
/api/platform/v1/terminal-drayages: /api/platform/v1/terminal-drayages:
get: get:
summary: 批量查询货柜码头拖车及服务端报空预警 summary: 批量查询货柜码头拖车及服务端报空预警
@@ -49,7 +49,7 @@ class InternalInboundOrderReferenceControllerTest {
assertThatThrownBy(() -> controller.workbenchFilters(null, request)).isInstanceOf(BizException.class); assertThatThrownBy(() -> controller.workbenchFilters(null, request)).isInstanceOf(BizException.class);
assertThatThrownBy(() -> controller.workbenchFilters("wrong", request)).isInstanceOf(BizException.class); assertThatThrownBy(() -> controller.workbenchFilters("wrong", request)).isInstanceOf(BizException.class);
org.mockito.Mockito.verifyNoInteractions(workbenchFilters); org.mockito.Mockito.verifyNoInteractions(workbenchFilters);
var response = new com.baiyue.firstleg.dto.MerchantWorkbenchFilters.Response(List.of(1L), List.of(), List.of()); var response = new com.baiyue.firstleg.dto.MerchantWorkbenchFilters.Response(List.of(1L), List.of(), List.of(), List.of());
when(workbenchFilters.read(request)).thenReturn(response); when(workbenchFilters.read(request)).thenReturn(response);
assertThat(controller.workbenchFilters("internal-token", request).data()).isEqualTo(response); assertThat(controller.workbenchFilters("internal-token", request).data()).isEqualTo(response);
} }
@@ -30,6 +30,7 @@ class ContainerCustomsControllerContractTest {
@Test void merchantUsesOrderViewAndEditWithoutTrustingTenantInput() { @Test void merchantUsesOrderViewAndEditWithoutTrustingTenantInput() {
assertThat(MerchantContainerCustomsController.class.getAnnotation(RequestMapping.class).value()) assertThat(MerchantContainerCustomsController.class.getAnnotation(RequestMapping.class).value())
.containsExactly("/api/merchant/v1/customs"); .containsExactly("/api/merchant/v1/customs");
assertPermission(MerchantContainerCustomsController.class,"pendingSummary","merchant:order:view");
assertPermission(MerchantContainerCustomsController.class,"order","merchant:order:view"); assertPermission(MerchantContainerCustomsController.class,"order","merchant:order:view");
assertPermission(MerchantContainerCustomsController.class,"upload","merchant:order:edit"); assertPermission(MerchantContainerCustomsController.class,"upload","merchant:order:edit");
assertPermission(MerchantContainerCustomsController.class,"replace","merchant:order:edit"); assertPermission(MerchantContainerCustomsController.class,"replace","merchant:order:edit");
@@ -47,6 +48,18 @@ class ContainerCustomsControllerContractTest {
.contains("LOADING_LIST_BUY_DECLARATION_ITEMS") .contains("LOADING_LIST_BUY_DECLARATION_ITEMS")
.doesNotContain("/cases/","CUSTOMS_DECLARATION"); .doesNotContain("/cases/","CUSTOMS_DECLARATION");
} }
@Test void badgeUsesAuthenticatedCustomerAndRejectsMissingIdentity() {
var service=org.mockito.Mockito.mock(com.baiyue.firstleg.customs.container.service.ContainerCustomsService.class);
var controller=new MerchantContainerCustomsController();
org.springframework.test.util.ReflectionTestUtils.setField(controller,"service",service);
org.assertj.core.api.Assertions.assertThatThrownBy(()->controller.pendingSummary(null))
.isInstanceOf(com.baiyue.common.core.exception.BizException.class);
org.mockito.Mockito.verifyNoInteractions(service);
var user=new com.baiyue.common.security.AuthenticatedUser(1L,11L,null,1L,"customer","MERCHANT","WEB",java.util.Set.of("merchant:order:view"));
controller.pendingSummary(user);
org.mockito.Mockito.verify(service).merchantPendingSummary(11L);
}
private static void assertPermission(Class<?> type,String method,String permission) { private static void assertPermission(Class<?> type,String method,String permission) {
Method value=java.util.Arrays.stream(type.getDeclaredMethods()).filter(m->m.getName().equals(method)).findFirst().orElseThrow(); Method value=java.util.Arrays.stream(type.getDeclaredMethods()).filter(m->m.getName().equals(method)).findFirst().orElseThrow();
assertThat(value.getAnnotation(PreAuthorize.class).value()).contains(permission); assertThat(value.getAnnotation(PreAuthorize.class).value()).contains(permission);
@@ -0,0 +1,78 @@
package com.baiyue.firstleg.customs.container;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
import com.baiyue.firstleg.customs.container.mapper.ContainerCustomsMapper;
import org.h2.jdbcx.JdbcDataSource;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.UUID;
import static org.assertj.core.api.Assertions.*;
class ContainerCustomsPendingCountTest {
private JdbcTemplate jdbc;
private ContainerCustomsMapper mapper;
@BeforeEach void setup() throws Exception {
var ds=new JdbcDataSource();ds.setURL("jdbc:h2:mem:customs-badge-"+UUID.randomUUID()+";MODE=MySQL;DB_CLOSE_DELAY=-1");
jdbc=new JdbcTemplate(ds);
jdbc.execute("CREATE TABLE fl_loading_plan(id BIGINT,container_booking_id BIGINT,plan_status VARCHAR,confirmed_at TIMESTAMP,updated_at TIMESTAMP)");
jdbc.execute("CREATE TABLE fl_container_booking(id BIGINT,record_status VARCHAR)");
jdbc.execute("CREATE TABLE fl_loading_plan_item(id BIGINT,loading_plan_id BIGINT,inbound_id BIGINT,account_id BIGINT,deleted INT,package_count INT)");
jdbc.execute("CREATE TABLE fl_inbound_order(id BIGINT,tenant_id BIGINT,order_id BIGINT,tax_mode VARCHAR,deleted INT)");
jdbc.execute("CREATE TABLE fl_loading_pick_task(id BIGINT,loading_plan_id BIGINT)");
jdbc.execute("CREATE TABLE fl_loading_pick_item(loading_plan_item_id BIGINT,pick_task_id BIGINT,item_status VARCHAR,picked_package_count INT)");
jdbc.execute("CREATE TABLE fl_customs_container(id BIGINT,loading_plan_id BIGINT,status VARCHAR)");
jdbc.execute("CREATE TABLE fl_customs_customer_document(id BIGINT,customs_container_id BIGINT,tenant_id BIGINT,status VARCHAR,frozen_at TIMESTAMP)");
jdbc.execute("CREATE TABLE fl_customs_customer_document_inbound(document_id BIGINT,inbound_id BIGINT,tenant_id BIGINT)");
jdbc.execute("CREATE TABLE fl_customs_completion_document(source_document_id BIGINT,customer_confirm_status VARCHAR)");
jdbc.update("INSERT INTO fl_loading_plan VALUES(1,10,'COMPLETED',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)");
jdbc.update("INSERT INTO fl_container_booking VALUES(10,'ACTIVE')");
jdbc.update("INSERT INTO fl_inbound_order VALUES(1,11,101,'TAX_REFUND',0),(2,11,102,'TAX_REFUND',0),(3,22,103,'TAX_REFUND',0)");
jdbc.update("INSERT INTO fl_loading_plan_item VALUES(1,1,1,11,0,2),(2,1,2,11,0,2),(3,1,3,22,0,2)");
jdbc.update("INSERT INTO fl_loading_pick_task VALUES(100,1)");
jdbc.update("INSERT INTO fl_loading_pick_item VALUES(1,100,'PICKED',2),(2,100,'PICKED',2),(3,100,'PICKED',2)");
var config=new MybatisConfiguration();config.setMapUnderscoreToCamelCase(true);config.addMapper(ContainerCustomsMapper.class);
var factory=new MybatisSqlSessionFactoryBean();factory.setDataSource(ds);factory.setConfiguration(config);
mapper=new SqlSessionTemplate(factory.getObject()).getMapper(ContainerCustomsMapper.class);
}
@Test void countsCabinetsOnceAndDoesNotCreateMissingCustomsRecords() {
assertThat(mapper.merchantPendingCount(11)).isEqualTo(1);
assertThat(mapper.merchantPendingCount(22)).isEqualTo(1);
assertThat(mapper.merchantPendingCount(33)).isZero();
assertThat(jdbc.queryForObject("SELECT COUNT(*) FROM fl_customs_container",Integer.class)).isZero();
jdbc.update("UPDATE fl_loading_pick_item SET item_status='SKIPPED',picked_package_count=0 WHERE loading_plan_item_id IN (1,2)");
assertThat(mapper.merchantPendingCount(11)).isZero();
assertThat(mapper.merchantPendingCount(22)).isEqualTo(1);
}
@Test void uploadAndConfirmationOnlyCountOwnActionableDocuments() {
jdbc.update("INSERT INTO fl_customs_container VALUES(90,1,'WAITING_CUSTOMER_DOCUMENTS')");
jdbc.update("INSERT INTO fl_customs_customer_document VALUES(91,90,11,'ACTIVE',NULL),(92,90,22,'ACTIVE',NULL)");
jdbc.update("INSERT INTO fl_customs_customer_document_inbound VALUES(91,1,11),(91,2,11),(92,3,22)");
assertThat(mapper.merchantPendingCount(11)).isZero();
jdbc.update("UPDATE fl_customs_container SET status='DECLARING'");
jdbc.update("UPDATE fl_customs_customer_document SET frozen_at=CURRENT_TIMESTAMP");
jdbc.update("INSERT INTO fl_customs_completion_document VALUES(91,'PENDING'),(92,'PENDING')");
assertThat(mapper.merchantPendingCount(11)).isEqualTo(1);
jdbc.update("UPDATE fl_customs_completion_document SET customer_confirm_status='CONFIRMED' WHERE source_document_id=91");
assertThat(mapper.merchantPendingCount(11)).isZero();assertThat(mapper.merchantPendingCount(22)).isEqualTo(1);
jdbc.update("UPDATE fl_customs_completion_document SET customer_confirm_status='REJECTED'");
assertThat(mapper.merchantPendingCount(22)).isZero();
jdbc.update("UPDATE fl_customs_completion_document SET customer_confirm_status='PENDING'");
assertThat(mapper.merchantPendingCount(11)).isEqualTo(1);
jdbc.update("UPDATE fl_customs_container SET status='COMPLETED'");
assertThat(mapper.merchantPendingCount(11)).isZero();
}
@Test void completedLatestPlanAndInactiveCabinetsDoNotLeaveStaleReminders() {
jdbc.update("INSERT INTO fl_loading_plan VALUES(2,20,'COMPLETED',TIMESTAMP '2099-01-01 00:00:00',CURRENT_TIMESTAMP)");
jdbc.update("INSERT INTO fl_container_booking VALUES(20,'ACTIVE')");
jdbc.update("INSERT INTO fl_loading_plan_item VALUES(4,2,1,11,0,2),(5,2,2,11,0,2)");
jdbc.update("INSERT INTO fl_loading_pick_task VALUES(200,2)");
jdbc.update("INSERT INTO fl_loading_pick_item VALUES(4,200,'PICKED',2),(5,200,'PICKED',2)");
jdbc.update("INSERT INTO fl_customs_container VALUES(95,2,'COMPLETED')");
assertThat(mapper.merchantPendingCount(11)).isZero();
jdbc.update("UPDATE fl_container_booking SET record_status='CANCELLED'");
assertThat(mapper.merchantPendingCount(22)).isZero();
}
}
@@ -0,0 +1,31 @@
package com.baiyue.firstleg.portschedule.mapper;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
import org.h2.jdbcx.JdbcDataSource;
import org.junit.jupiter.api.Test;
import java.util.*;
import static org.assertj.core.api.Assertions.*;
class AppointmentForecastMapperTest {
@Test void keepsNewestTwoObservationsIncludingWithdrawnEtaAndExcludesOtherNodes() throws Exception {
var ds=new JdbcDataSource();ds.setURL("jdbc:h2:mem:"+UUID.randomUUID()+";MODE=MySQL;DB_CLOSE_DELAY=-1");
try(var c=ds.getConnection();var s=c.createStatement()) {
s.execute("CREATE TABLE fl_container_booking(id BIGINT PRIMARY KEY,record_status VARCHAR(32))");
s.execute("CREATE TABLE fl_carrier_schedule_node_fact(id BIGINT PRIMARY KEY,container_booking_id BIGINT,standard_node VARCHAR(64),provider_code VARCHAR(64),source_reference VARCHAR(128),observed_at TIMESTAMP,estimated_at TIMESTAMP,actual_at TIMESTAMP)");
s.execute("INSERT INTO fl_container_booking VALUES(1,'ACTIVE'),(2,'CANCELLED'),(3,'ACTIVE')");
for(int id=1;id<=3;id++) s.execute("INSERT INTO fl_carrier_schedule_node_fact VALUES("+id+",1,'ARRIVED_DESTINATION_PORT','carrier','REF','2026-10-10 12:00:00',"+(id==3?"NULL":"'2026-10-15 09:00:00'")+",NULL)");
s.execute("INSERT INTO fl_carrier_schedule_node_fact VALUES(4,1,'DEPARTED_ORIGIN_PORT','carrier','OTHER','2026-10-11',NULL,NULL),(5,2,'ARRIVED_DESTINATION_PORT','carrier','REF','2026-10-11','2026-10-15',NULL),(6,3,'ARRIVED_DESTINATION_PORT','carrier','REF','2026-10-11',NULL,'2026-10-11')");
}
var config=new MybatisConfiguration();config.setMapUnderscoreToCamelCase(true);
config.setEnvironment(new Environment("test",new JdbcTransactionFactory(),ds));config.addMapper(AppointmentForecastMapper.class);
try(var session=new MybatisSqlSessionFactoryBuilder().build(config).openSession()) {
var rows=session.getMapper(AppointmentForecastMapper.class).latest(List.of(1L,2L,3L));
assertThat(rows).extracting(AppointmentForecastMapper.Fact::factId).containsExactly(3L,2L,6L);
assertThat(rows.get(0).estimatedAt()).isNull();assertThat(rows.get(1).estimatedAt()).isNotNull();
assertThat(rows.get(2).actualAt()).isNotNull();
}
}
}
@@ -0,0 +1,34 @@
package com.baiyue.firstleg.portschedule.service;
import com.baiyue.firstleg.portschedule.mapper.AppointmentForecastMapper;
import com.baiyue.firstleg.portschedule.controller.InternalAppointmentForecastController;
import org.junit.jupiter.api.Test;
import java.time.LocalDateTime;
import java.util.*;
import static org.assertj.core.api.Assertions.*;
import static org.mockito.Mockito.*;
class AppointmentForecastServiceTest {
@Test void preservesMissingForecastAndSourceLocalTimesWithoutSynthesizingEta() {
var mapper=mock(AppointmentForecastMapper.class);var service=new AppointmentForecastService(mapper);
var observed=LocalDateTime.of(2026,10,10,12,0);
var latest=new AppointmentForecastMapper.Fact(1L,20L,"carrier","REF",observed,null,null);
var previous=new AppointmentForecastMapper.Fact(1L,10L,"carrier","REF-OLD",observed.minusDays(1),observed.plusDays(5),null);
when(mapper.latest(List.of(1L,2L))).thenReturn(List.of(latest,previous));
var result=service.batch(List.of(1L,2L));
assertThat(result.get(0).latest()).isSameAs(latest);assertThat(result.get(0).previous()).isSameAs(previous);
assertThat(result.get(1).latest()).isNull();assertThat(result.get(1).timeBasis()).isEqualTo("SOURCE_LOCAL_UNSPECIFIED");
verify(mapper).latest(List.of(1L,2L));verifyNoMoreInteractions(mapper);
}
@Test void rejectsInvalidBatchesAndMissingOrBlankInternalCredentials() {
var mapper=mock(AppointmentForecastMapper.class);var service=new AppointmentForecastService(mapper);
for(var ids:List.of(List.<Long>of(),List.of(1L,1L),List.of(-1L),Collections.nCopies(201,1L)))
assertThatThrownBy(()->service.batch(ids)).isInstanceOf(org.springframework.web.server.ResponseStatusException.class);
assertThatThrownBy(()->service.batch(null)).isInstanceOf(org.springframework.web.server.ResponseStatusException.class);
var controller=new InternalAppointmentForecastController(service,"expected");
assertThatThrownBy(()->controller.batch(null,new InternalAppointmentForecastController.Request(List.of(1L)))).isInstanceOf(org.springframework.web.server.ResponseStatusException.class);
assertThatThrownBy(()->controller.batch("wrong",new InternalAppointmentForecastController.Request(List.of(1L)))).isInstanceOf(org.springframework.web.server.ResponseStatusException.class);
assertThatThrownBy(()->new InternalAppointmentForecastController(service,"").batch("",new InternalAppointmentForecastController.Request(List.of(1L)))).isInstanceOf(org.springframework.web.server.ResponseStatusException.class);
verifyNoInteractions(mapper);
}
}
@@ -26,13 +26,17 @@ class MerchantWorkbenchFilterMapperTest {
jdbc.execute("CREATE TABLE fl_customs_container(id BIGINT PRIMARY KEY,loading_plan_id BIGINT,status VARCHAR(40))"); jdbc.execute("CREATE TABLE fl_customs_container(id BIGINT PRIMARY KEY,loading_plan_id BIGINT,status VARCHAR(40))");
jdbc.execute("CREATE TABLE fl_customs_customer_document(id BIGINT PRIMARY KEY,customs_container_id BIGINT,tenant_id BIGINT,status VARCHAR(32))"); jdbc.execute("CREATE TABLE fl_customs_customer_document(id BIGINT PRIMARY KEY,customs_container_id BIGINT,tenant_id BIGINT,status VARCHAR(32))");
jdbc.execute("CREATE TABLE fl_customs_customer_document_inbound(document_id BIGINT,inbound_id BIGINT,tenant_id BIGINT)"); jdbc.execute("CREATE TABLE fl_customs_customer_document_inbound(document_id BIGINT,inbound_id BIGINT,tenant_id BIGINT)");
jdbc.execute("ALTER TABLE fl_loading_plan_item ADD id BIGINT GENERATED BY DEFAULT AS IDENTITY");
jdbc.execute("CREATE TABLE fl_loading_pick_task(id BIGINT,loading_plan_id BIGINT,task_status VARCHAR(32))");
jdbc.execute("CREATE TABLE fl_loading_pick_item(pick_task_id BIGINT,loading_plan_item_id BIGINT,item_status VARCHAR(32),picked_package_count INT)");
jdbc.execute("CREATE TABLE fl_carrier_schedule_node_fact(container_booking_id BIGINT,standard_node VARCHAR(64),actual_at TIMESTAMP)");
var config=new MybatisConfiguration();config.setMapUnderscoreToCamelCase(true);config.addMapper(MerchantWorkbenchFilterMapper.class); var config=new MybatisConfiguration();config.setMapUnderscoreToCamelCase(true);config.addMapper(MerchantWorkbenchFilterMapper.class);
var factory=new MybatisSqlSessionFactoryBean();factory.setDataSource(ds);factory.setConfiguration(config); var factory=new MybatisSqlSessionFactoryBean();factory.setDataSource(ds);factory.setConfiguration(config);
mapper=new SqlSessionTemplate(factory.getObject()).getMapper(MerchantWorkbenchFilterMapper.class); mapper=new SqlSessionTemplate(factory.getObject()).getMapper(MerchantWorkbenchFilterMapper.class);
jdbc.update("INSERT INTO fl_inbound_order VALUES(1,11,101,0,'TAX_REFUND','LOADED'),(2,11,102,0,'TAX_REFUND','DELIVERED'),(3,22,103,0,'TAX_REFUND','LOADED'),(4,11,104,1,'TAX_REFUND','LOADED'),(5,11,105,0,'BUY_DECLARATION','LOADED')"); jdbc.update("INSERT INTO fl_inbound_order VALUES(1,11,101,0,'TAX_REFUND','LOADED'),(2,11,102,0,'TAX_REFUND','DELIVERED'),(3,22,103,0,'TAX_REFUND','LOADED'),(4,11,104,1,'TAX_REFUND','LOADED'),(5,11,105,0,'BUY_DECLARATION','LOADED')");
jdbc.update("INSERT INTO fl_container_booking VALUES(100,'ACTIVE')"); jdbc.update("INSERT INTO fl_container_booking VALUES(100,'ACTIVE')");
jdbc.update("INSERT INTO fl_loading_plan VALUES(100,100,'COMPLETED',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)"); jdbc.update("INSERT INTO fl_loading_plan VALUES(100,100,'COMPLETED',CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)");
jdbc.update("INSERT INTO fl_loading_plan_item VALUES(100,1,11,0),(100,1,11,0),(100,2,11,0),(100,3,22,0),(100,4,11,0),(100,5,11,0)"); jdbc.update("INSERT INTO fl_loading_plan_item(loading_plan_id,inbound_id,account_id,deleted) VALUES(100,1,11,0),(100,1,11,0),(100,2,11,0),(100,3,22,0),(100,4,11,0),(100,5,11,0)");
} }
@Test void latestFeeVersionAndCustomerScopeDetermineConfirmationQueue() { @Test void latestFeeVersionAndCustomerScopeDetermineConfirmationQueue() {
@@ -71,10 +75,27 @@ class MerchantWorkbenchFilterMapperTest {
jdbc.update("INSERT INTO fl_customs_container VALUES(200,100,'WAITING_CUSTOMER_DOCUMENTS')"); jdbc.update("INSERT INTO fl_customs_container VALUES(200,100,'WAITING_CUSTOMER_DOCUMENTS')");
jdbc.update("INSERT INTO fl_container_booking VALUES(101,'ACTIVE')"); jdbc.update("INSERT INTO fl_container_booking VALUES(101,'ACTIVE')");
jdbc.update("INSERT INTO fl_loading_plan VALUES(101,101,'COMPLETED',TIMESTAMP '2099-01-01 00:00:00',CURRENT_TIMESTAMP)"); jdbc.update("INSERT INTO fl_loading_plan VALUES(101,101,'COMPLETED',TIMESTAMP '2099-01-01 00:00:00',CURRENT_TIMESTAMP)");
jdbc.update("INSERT INTO fl_loading_plan_item VALUES(101,1,11,0)"); jdbc.update("INSERT INTO fl_loading_plan_item(loading_plan_id,inbound_id,account_id,deleted) VALUES(101,1,11,0)");
jdbc.update("INSERT INTO fl_customs_container VALUES(201,101,'COMPLETED')"); jdbc.update("INSERT INTO fl_customs_container VALUES(201,101,'COMPLETED')");
assertThat(mapper.pendingCustoms(11)).containsExactly(102L); assertThat(mapper.pendingCustoms(11)).containsExactly(102L);
jdbc.update("UPDATE fl_container_booking SET record_status='CANCELLED' WHERE id=100"); jdbc.update("UPDATE fl_container_booking SET record_status='CANCELLED' WHERE id=100");
assertThat(mapper.pendingCustoms(11)).isEmpty(); assertThat(mapper.pendingCustoms(11)).isEmpty();
} }
@Test void onlyActualLoadedOwnedFragmentsAndActualClearanceAdvanceProgress() {
assertThat(mapper.progressFragments(11)).allMatch(f->f.stage()==0);
jdbc.update("INSERT INTO fl_loading_pick_task VALUES(900,100,'COMPLETED')");
jdbc.update("INSERT INTO fl_loading_pick_item SELECT 900,id,'PICKED',2 FROM fl_loading_plan_item");
assertThat(mapper.progressFragments(11)).allMatch(f->f.stage()==1).noneMatch(f->f.orderId()==103||f.orderId()==104);
jdbc.update("INSERT INTO fl_customs_container VALUES(200,100,'DECLARING')");
assertThat(mapper.progressFragments(11)).allMatch(f->f.stage()==1);
jdbc.update("UPDATE fl_customs_container SET status='COMPLETED'");
assertThat(mapper.progressFragments(11)).allMatch(f->f.stage()==2);
jdbc.update("INSERT INTO fl_carrier_schedule_node_fact VALUES(100,'PICKUP_READY',NULL)");
assertThat(mapper.progressFragments(11)).allMatch(f->f.stage()==2);
jdbc.update("UPDATE fl_carrier_schedule_node_fact SET actual_at=CURRENT_TIMESTAMP");
assertThat(mapper.progressFragments(11)).allMatch(f->f.stage()==3);
jdbc.update("UPDATE fl_container_booking SET record_status='CANCELLED'");
assertThat(mapper.progressFragments(11)).allMatch(f->f.stage()==0);
}
} }
@@ -0,0 +1,17 @@
package com.baiyue.firstleg.service;
import com.baiyue.firstleg.dto.MerchantWorkbenchFilters.Fragment;
import org.junit.jupiter.api.Test;
import java.util.List;
import static org.assertj.core.api.Assertions.*;
class MerchantWorkbenchProgressTest {
@Test void unstartedFragmentsPreventWholeOrderProgressAndLatestFactsWinWithoutInventingHistory() {
var facts=List.of(new Fragment(1,0),new Fragment(1,1),new Fragment(2,2),new Fragment(2,3),new Fragment(3,3),new Fragment(4,0));
var projected=MerchantWorkbenchFilterService.progress(facts);
assertThat(projected).hasSize(3);
assertThat(projected.get(0).stage()).isEqualTo("loaded");assertThat(projected.get(0).partial()).isTrue();
assertThat(projected.get(1).stage()).isEqualTo("cleared");assertThat(projected.get(1).partial()).isTrue();
assertThat(projected.get(2).partial()).isFalse();
}
}
@@ -0,0 +1,49 @@
package com.baiyue.firstleg.terminaldrayage.controller;
import com.baiyue.common.core.exception.BizException;
import com.baiyue.common.security.AuthenticatedUser;
import com.baiyue.firstleg.terminaldrayage.service.*;
import org.junit.jupiter.api.Test;
import org.springframework.context.annotation.*;
import org.springframework.core.env.MapPropertySource;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import java.time.LocalDate;
import java.util.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
class TerminalDrayageCalendarAuthorizationTest {
static final String APPOINTMENT="platform:appointment:list",PICKUP="platform:firstleg:terminal-drayage:list";
@Test void bothReadPermissionsAndPlatformIdentityAreRequiredBeforeReadingAnyCalendar() {
try(var context=new AnnotationConfigApplicationContext()) {
context.getEnvironment().getPropertySources().addFirst(new MapPropertySource("test",Map.of("baiyue.security.internal-service-token","test")));
context.register(Config.class);context.refresh();
var controller=context.getBean(PlatformTerminalDrayageController.class);
var service=context.getBean(TerminalDrayageCalendarService.class);
var from=LocalDate.of(2026,10,1);var to=from.plusDays(31);
for(var permission:List.of(APPOINTMENT,PICKUP)) {
login(permission);assertThrows(AccessDeniedException.class,()->controller.calendar(user(0L,"PLATFORM"),from,to));
}
login(APPOINTMENT,PICKUP);
assertThrows(BizException.class,()->controller.calendar(user(1L,"MERCHANT"),from,to));
assertThrows(BizException.class,()->controller.calendar(null,from,to));
verifyNoInteractions(service);
controller.calendar(user(0L,"PLATFORM"),from,to);verify(service).calendar(from,to);
} finally {SecurityContextHolder.clearContext();}
}
static void login(String... permissions) {
SecurityContextHolder.getContext().setAuthentication(new UsernamePasswordAuthenticationToken("operator","unused",
Arrays.stream(permissions).map(SimpleGrantedAuthority::new).toList()));
}
static AuthenticatedUser user(long customer,String app) {return new AuthenticatedUser(7L,customer,0L,8L,"operator",app,"WEB",Set.of());}
@Configuration @EnableMethodSecurity
static class Config {
@Bean TerminalDrayageMailService mails(){return mock(TerminalDrayageMailService.class);}
@Bean TerminalDrayageCalendarService calendar(){return mock(TerminalDrayageCalendarService.class);}
@Bean PlatformTerminalDrayageController controller(){return new PlatformTerminalDrayageController(mock(TerminalDrayageService.class));}
}
}
@@ -0,0 +1,33 @@
package com.baiyue.firstleg.terminaldrayage.mapper;
import com.baomidou.mybatisplus.core.MybatisConfiguration;
import com.baomidou.mybatisplus.core.MybatisSqlSessionFactoryBuilder;
import org.apache.ibatis.mapping.Environment;
import org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory;
import org.h2.jdbcx.JdbcDataSource;
import org.junit.jupiter.api.Test;
import java.time.LocalDateTime;
import java.util.List;
import static org.junit.jupiter.api.Assertions.*;
class TerminalDrayageCalendarMapperTest {
@Test void respectsExclusiveRangeActiveDepartureWithoutDuplicatingContainersOrOwningShippingFacts() throws Exception {
var ds=new JdbcDataSource();ds.setURL("jdbc:h2:mem:pickup-calendar;MODE=MySQL;DB_CLOSE_DELAY=-1");
try(var c=ds.getConnection();var s=c.createStatement()) {
s.execute("CREATE TABLE fl_container_booking(id BIGINT,booking_no VARCHAR,container_no VARCHAR,destination_port_name VARCHAR,destination_warehouse_code VARCHAR,record_status VARCHAR)");
s.execute("CREATE TABLE fl_terminal_drayage(container_booking_id BIGINT,fleet_supplier_name VARCHAR,pickup_appointment_at TIMESTAMP)");
s.execute("CREATE TABLE fl_outbound_dispatch(container_booking_id BIGINT,confirmed_at TIMESTAMP,reversed_at TIMESTAMP,status VARCHAR)");
for(int id=1;id<=5;id++) {
s.execute("INSERT INTO fl_container_booking VALUES("+id+",'CB','CONT','Port','US-W','"+(id==4?"CANCELLED":"ACTIVE")+"')");
s.execute("INSERT INTO fl_terminal_drayage VALUES("+id+",'Fleet','"+(id==3?"2026-11-01 00:00:00":"2026-10-01 09:00:00")+"')");
s.execute("INSERT INTO fl_outbound_dispatch VALUES("+id+",'2026-09-01',"+(id==5?"'2026-09-02'":"NULL")+",'WAITING_FOR_LOADING')");
}
s.execute("INSERT INTO fl_outbound_dispatch VALUES(1,'2026-09-01',NULL,'WAITING_FOR_LOADING')");
}
var config=new MybatisConfiguration();config.setEnvironment(new Environment("test",new JdbcTransactionFactory(),ds));config.addMapper(TerminalDrayageMapper.class);
try(var session=new MybatisSqlSessionFactoryBuilder().build(config).openSession()) {
var rows=session.getMapper(TerminalDrayageMapper.class).calendar(LocalDateTime.parse("2026-10-01T00:00:00"),LocalDateTime.parse("2026-11-01T00:00:00"),1001);
assertEquals(List.of(1L,2L),rows.stream().map(r->r.containerBookingId()).toList());assertNull(rows.get(0).actualPickupAt());
}
}
}
@@ -0,0 +1,53 @@
package com.baiyue.firstleg.terminaldrayage.service;
import com.baiyue.common.core.api.ApiResponse;
import com.baiyue.firstleg.client.WarehouseMasterDataClient;
import com.baiyue.firstleg.terminaldrayage.dto.PickupCalendarEntry;
import com.baiyue.firstleg.terminaldrayage.mapper.TerminalDrayageMapper;
import org.junit.jupiter.api.Test;
import org.springframework.web.server.ResponseStatusException;
import java.time.LocalDate;
import java.util.*;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
import static org.mockito.ArgumentMatchers.*;
class TerminalDrayageCalendarServiceTest {
final TerminalDrayageMapper mapper=mock(TerminalDrayageMapper.class);
final WarehouseMasterDataClient warehouses=mock(WarehouseMasterDataClient.class);
final com.baiyue.firstleg.portschedule.service.CarrierScheduleQueryService shipping=mock(com.baiyue.firstleg.portschedule.service.CarrierScheduleQueryService.class);
final TerminalDrayageCalendarService service=new TerminalDrayageCalendarService(mapper,warehouses,shipping,"test");
final LocalDate from=LocalDate.of(2026,10,1),to=from.plusDays(31);
PickupCalendarEntry row(long id,String code) {return new PickupCalendarEntry(id,"CB-"+id,"TEST-CONT","Port",code,"Fleet",from.atTime(9,0),null);}
@Test void batchesTheCatalogAndKeepsUnknownScopeVisibleWithoutGuessingPortTimeZone() {
when(mapper.calendar(any(),any(),eq(1001))).thenReturn(List.of(row(1,"US-W"),row(2,"CA-W"),row(3,"UNKNOWN")));
when(warehouses.catalog("test")).thenReturn(ApiResponse.success(List.of(
new WarehouseMasterDataClient.CatalogWarehouse(1L,"US-W","US","OVERSEAS","US"),
new WarehouseMasterDataClient.CatalogWarehouse(2L,"CA-W","CA","OVERSEAS","CA"))));
var pickedUp=from.atTime(10,30);
when(shipping.containerActualFacts(List.of(1L))).thenReturn(List.of(new com.baiyue.firstleg.portschedule.dto.CarrierScheduleQueryDtos.ContainerActualFacts(
1L,null,null,null,null,null,null,null,null,null,pickedUp,null)));
var result=service.calendar(from,to);
assertEquals(List.of(1L),result.records().stream().map(PickupCalendarEntry::containerBookingId).toList());
assertEquals(1,result.unclassifiedCount());assertFalse(result.truncated());assertEquals("SOURCE_LOCAL_UNSPECIFIED",result.timeBasis());
assertEquals(pickedUp,result.records().get(0).actualPickupAt());
assertEquals(from.atTime(9,0),result.records().get(0).pickupAppointmentAt());
verify(shipping,times(1)).containerActualFacts(List.of(1L));
verify(warehouses,times(1)).catalog("test");verify(mapper,times(1)).calendar(from.atStartOfDay(),to.atStartOfDay(),1001);
}
@Test void catalogFailureDoesNotMasqueradeAsAnEmptyCalendar() {
when(mapper.calendar(any(),any(),anyInt())).thenReturn(List.of(row(1,"US-W")));
when(warehouses.catalog("test")).thenThrow(new IllegalStateException());
assertEquals(503,assertThrows(ResponseStatusException.class,()->service.calendar(from,to)).getStatusCode().value());
}
@Test void boundedRangeAndEmptyCalendarAvoidUnnecessaryRequests() {
assertThrows(ResponseStatusException.class,()->service.calendar(from,from.plusDays(43)));
assertThrows(ResponseStatusException.class,()->service.calendar(from,from));verifyNoInteractions(mapper,warehouses);
when(mapper.calendar(any(),any(),anyInt())).thenReturn(List.of());assertTrue(service.calendar(from,to).records().isEmpty());verifyNoInteractions(warehouses);
}
@Test void reportsTruncationInsteadOfClaimingCompleteResults() {
when(mapper.calendar(any(),any(),anyInt())).thenReturn(Collections.nCopies(1001,row(1,"US-W")));
when(warehouses.catalog("test")).thenReturn(ApiResponse.success(List.of(new WarehouseMasterDataClient.CatalogWarehouse(1L,"US-W","US","OVERSEAS","US"))));
var result=service.calendar(from,to);assertTrue(result.truncated());assertEquals(1000,result.records().size());
}
}
@@ -20,6 +20,7 @@ INSERT INTO iam_permission
VALUES VALUES
(5107280,0,'PLATFORM','MENU',0,'platform:appointment:list','预约列表','/appointment-calendar','GET',740,'ACTIVE',1,0), (5107280,0,'PLATFORM','MENU',0,'platform:appointment:list','预约列表','/appointment-calendar','GET',740,'ACTIVE',1,0),
(5107281,0,'PLATFORM','BUTTON',5107280,'platform:appointment:delete','删除预约',NULL,'DELETE',741,'ACTIVE',1,0), (5107281,0,'PLATFORM','BUTTON',5107280,'platform:appointment:delete','删除预约',NULL,'DELETE',741,'ACTIVE',1,0),
(5107282,0,'PLATFORM','BUTTON',5107280,'platform:appointment:followup','记录预约跟进',NULL,'POST',742,'ACTIVE',1,0),
(5107000,0,'PLATFORM','MENU',0,'platform:overseas-warehouse:last-mile-order:list','海外尾程订单','/overseas-warehouse/last-mile-orders','GET',700,'ACTIVE',1,0), (5107000,0,'PLATFORM','MENU',0,'platform:overseas-warehouse:last-mile-order:list','海外尾程订单','/overseas-warehouse/last-mile-orders','GET',700,'ACTIVE',1,0),
(5107001,0,'PLATFORM','BUTTON',5107000,'platform:overseas-warehouse:last-mile-order:edit','编辑海外尾程订单',NULL,'PUT',701,'ACTIVE',1,0), (5107001,0,'PLATFORM','BUTTON',5107000,'platform:overseas-warehouse:last-mile-order:edit','编辑海外尾程订单',NULL,'PUT',701,'ACTIVE',1,0),
(5107002,0,'PLATFORM','BUTTON',5107000,'platform:overseas-warehouse:last-mile-order:export','导出海外尾程订单',NULL,'GET',702,'ACTIVE',1,0), (5107002,0,'PLATFORM','BUTTON',5107000,'platform:overseas-warehouse:last-mile-order:export','导出海外尾程订单',NULL,'GET',702,'ACTIVE',1,0),
@@ -0,0 +1,28 @@
-- 采购节点动作独立授权;不新建岗位,不以通用编辑权限代替购买与取消。
INSERT INTO iam_permission(id,tenant_id,app_code,permission_type,parent_id,permission_code,permission_name,route_path,http_method,sort_no,status,built_in,deleted)
VALUES
(5117103,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:buy','采购购买及货款核定',NULL,'POST',803,'ACTIVE',1,0),
(5117104,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:cancel','购买前取消采购订单',NULL,'POST',804,'ACTIVE',1,0),
(5117105,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:receive-overseas','采购海外收货',NULL,'POST',805,'ACTIVE',1,0),
(5117106,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:receive-domestic','采购国内收货',NULL,'POST',806,'ACTIVE',1,0),
(5117107,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:pack','采购装箱与确认',NULL,'POST',807,'ACTIVE',1,0),
(5117108,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:manage','采购差异处置与事实更正',NULL,'POST',808,'ACTIVE',1,0),
(5117109,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:label','采购面单维护',NULL,'POST',809,'ACTIVE',1,0),
(5117110,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:charge','采购国内核费',NULL,'POST',810,'ACTIVE',1,0),
(5117111,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:finance-adjust','采购财务调整',NULL,'POST',811,'ACTIVE',1,0),
(5117112,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:estimate','采购预估运费核对',NULL,'POST',812,'ACTIVE',1,0),
(5117113,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:apply-label','采购逐箱贴单',NULL,'POST',813,'ACTIVE',1,0),
(5117114,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:ship-overseas','采购海外整批交寄',NULL,'POST',814,'ACTIVE',1,0),
(5117115,0,'PLATFORM','BUTTON',5107100,'platform:overseas-business:purchase:ship-customer','采购国内寄客户',NULL,'POST',815,'ACTIVE',1,0)
ON DUPLICATE KEY UPDATE permission_name=VALUES(permission_name),status='ACTIVE',deleted=0;
INSERT IGNORE INTO iam_role_permission(tenant_id,role_id,permission_id,created_at)
SELECT 0,r.id,p.id,NOW(3) FROM iam_role r JOIN iam_permission p
ON p.tenant_id=0 AND p.app_code='PLATFORM' AND p.permission_code IN
('platform:overseas-business:purchase:buy','platform:overseas-business:purchase:cancel',
'platform:overseas-business:purchase:receive-overseas','platform:overseas-business:purchase:receive-domestic',
'platform:overseas-business:purchase:pack','platform:overseas-business:purchase:manage',
'platform:overseas-business:purchase:label','platform:overseas-business:purchase:charge','platform:overseas-business:purchase:finance-adjust',
'platform:overseas-business:purchase:estimate','platform:overseas-business:purchase:apply-label',
'platform:overseas-business:purchase:ship-overseas','platform:overseas-business:purchase:ship-customer')
WHERE r.tenant_id=0 AND r.app_code='PLATFORM' AND UPPER(r.role_code) IN('PLATFORM_ADMIN','PLATFORM_CUSTOM_ADMIN')
AND r.status='ACTIVE' AND r.deleted=0;
+3 -3
View File
@@ -11,7 +11,7 @@
业务包相对 `src/main/java/com/baiyue/lastleg/`;`src/`、`docs/`、`scripts/`、`../` 相对服务目录。裸类名在指定包内检索。 业务包相对 `src/main/java/com/baiyue/lastleg/`;`src/`、`docs/`、`scripts/`、`../` 相对服务目录。裸类名在指定包内检索。
拼车需求池:`fleet/trip/FleetCapacityOfferService.java`、`fleet/business/FleetPoolOrderBridge.java`;流程见 `../../docs/海外仓业务/内部拼车需求池首版开发契约.md`。 拼车接货与车次准备:`fleet/trip/`、`fleet/business/`;合同`fleet-preparation-v1.yaml`,流程见 `../../docs/海外仓业务/内部拼车需求池首版开发契约.md`。
事件重试:`controller/EventOperationsController.java`,内部 `/internal/lastleg/event-operations/{entryId}` 查询、`/retry` 写入;仅卸柜、派送、暂扣、资金及费用事件,以 `EVENT_OPERATIONS_TOKEN` 保护。原事件不可改,DEAD→PENDING 与 `event_delivery_retry_audit` 同事务;脚本 `scripts/event-outbox-operations.mjs`。 事件重试:`controller/EventOperationsController.java`,内部 `/internal/lastleg/event-operations/{entryId}` 查询、`/retry` 写入;仅卸柜、派送、暂扣、资金及费用事件,以 `EVENT_OPERATIONS_TOKEN` 保护。原事件不可改,DEAD→PENDING 与 `event_delivery_retry_audit` 同事务;脚本 `scripts/event-outbox-operations.mjs`。
@@ -36,7 +36,7 @@
| 入仓计划分页、柜级预览、转换与详情 | `inboundplan/controller/InboundPlanController.java` | | 入仓计划分页、柜级预览、转换与详情 | `inboundplan/controller/InboundPlanController.java` |
| 自动生成托盘、资源生成失败与重试 | `inboundplan/service/ContainerInboundPlanConversionCoordinator.java` 的 `convertManualAndAutoMaterialize`;详细规则定向查 `docs/business-index.md` 的“人工计划自动生成托盘与资源重试” | | 自动生成托盘、资源生成失败与重试 | `inboundplan/service/ContainerInboundPlanConversionCoordinator.java` 的 `convertManualAndAutoMaterialize`;详细规则定向查 `docs/business-index.md` 的“人工计划自动生成托盘与资源重试” |
| 托盘分配算法 | `inboundplan/service/PalletAllocator.java` | | 托盘分配算法 | `inboundplan/service/PalletAllocator.java` |
| 跨客户同仓预约、日历、增删改查 | `InboundPlanController.java` | | 跨客户同仓预约、日历 | `InboundPlanController.java`;在途/外接货跟进与覆盖见`appointmentplanning/` |
| PDA 入仓、柜号签收、实收、上架与完成 | `inboundplan/pda/controller/ReceivingContainerController.java` → `inboundplan/pda/service/ReceivingContainerService.java`;门禁与状态定向查 `docs/business-index.md` 的“PDA 入仓、实收、上架与完成” | | PDA 入仓、柜号签收、实收、上架与完成 | `inboundplan/pda/controller/ReceivingContainerController.java` → `inboundplan/pda/service/ReceivingContainerService.java`;门禁与状态定向查 `docs/business-index.md` 的“PDA 入仓、实收、上架与完成” |
| PDA 卸柜照片上传、归属校验与预览 | `ReceivingContainerController.java` | | PDA 卸柜照片上传、归属校验与预览 | `ReceivingContainerController.java` |
| PDA 国内装柜照片对照 | `ReceivingContainerController.java` | | PDA 国内装柜照片对照 | `ReceivingContainerController.java` |
@@ -146,7 +146,7 @@
- 列表、详情、导出和更新必须使用同一租户边界,不能仅在列表过滤而让详情或更新越权。 - 列表、详情、导出和更新必须使用同一租户边界,不能仅在列表过滤而让详情或更新越权。
- 目的仓变更必须写状态/操作历史或审计证据,并使用版本控制防止并发覆盖。 - 目的仓变更必须写状态/操作历史或审计证据,并使用版本控制防止并发覆盖。
- 一件代发废弃:申请只锁箱 `AVAILABLE→DISCARD_PENDING`;平台批准(`lastleg:cargo-discard:approve`)只授权。绑定仓的海外 PDA(`lastleg:pda:operate`)实际确认时,同事务调用 discard adjustment,扣 SKU 件数及库存余额/位置,实际箱转 `DISCARDED` 并写唯一逐箱流水,数量须守恒;未废弃预留箱释放,失败整体回滚。按实际数量汇总费用,平台结案不再扣减。终态同完整载荷重放不新增流水/历史,异数量拒绝;驳回只释放锁箱。完整流程见 `../../docs/头程到尾程分阶段流程/阶段五-海外接柜库存与库内服务.md` 第9.5节。 - 一件代发废弃:申请只锁箱 `AVAILABLE→DISCARD_PENDING`;平台批准(`lastleg:cargo-discard:approve`)只授权。绑定仓的海外 PDA(`lastleg:pda:operate`)实际确认时,同事务调用 discard adjustment,扣 SKU 件数及库存余额/位置,实际箱转 `DISCARDED` 并写唯一逐箱流水,数量须守恒;未废弃预留箱释放,失败整体回滚。按实际数量汇总费用,平台结案不再扣减。终态同完整载荷重放不新增流水/历史,异数量拒绝;驳回只释放锁箱。完整流程见 `../../docs/头程到尾程分阶段流程/阶段五-海外接柜库存与库内服务.md` 第9.5节。
- 海外采购客户下单固定进入 `PENDING_REVIEW`;采购编辑可维护入库数量和采购出库明细,出库量为明细数量汇总,审核通过且有入库量后按 `PENDING_OUTBOUND`、`PARTIALLY_OUTBOUND`、`OUTBOUNDED` 派生展示状态。采购出库只记录采购单据流转,不得写入或冒充 `available_packages`;只有海外仓 PDA 完成实收后,`InboundStockReceiptService` 才能以 `PDA_STOCK_IN:{taskId}:{allocationId}` 幂等键调用库存 `stockIn` 转入可用库存。禁止通过通用平台接口绕过 PDA 入可用库存。 - 海外采购样品履约按 `../../docs/海外仓业务/采购订单样品履约流程变更需求.md` 执行:通用编辑仅限内部备注,实收、装箱、面单、两段交寄和资金走独立节点。采购使用 Admin 履约台账,不接入 PDA、不写 WMS 可用库存。
- 派车状态只允许 PDA 拣货、完成和出库动作推进,普通派车编辑接口不得修改状态。PDA 写操作要求 `lastleg:pda:operate`;后台库存表单操作要求 `lastleg:inventory:manage`,盘点调整另要求 `lastleg:inventory:adjust`,转仓库存操作要求 `lastleg:warehouse-transfer:manage`。 - 派车状态只允许 PDA 拣货、完成和出库动作推进,普通派车编辑接口不得修改状态。PDA 写操作要求 `lastleg:pda:operate`;后台库存表单操作要求 `lastleg:inventory:manage`,盘点调整另要求 `lastleg:inventory:adjust`,转仓库存操作要求 `lastleg:warehouse-transfer:manage`。
- `ll_order.current_status` 只保存尾程主流程状态;换标、转仓、出库和派送等子单精确状态保存到各自单据并汇总到 `sub_order_status`,不得再用子单状态覆盖主流程状态。PDA 入仓及库存落账完成后,主流程状态固定推进为 `INBOUND_COMPLETED`。 - `ll_order.current_status` 只保存尾程主流程状态;换标、转仓、出库和派送等子单精确状态保存到各自单据并汇总到 `sub_order_status`,不得再用子单状态覆盖主流程状态。PDA 入仓及库存落账完成后,主流程状态固定推进为 `INBOUND_COMPLETED`。
@@ -0,0 +1,25 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.ApiResponse;
import com.baiyue.common.security.AuthenticatedUser;
import org.springframework.web.bind.annotation.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import java.util.List;
import com.baiyue.lastleg.appointmentplanning.AppointmentCoverageService.SourceRef;
@RestController
@RequestMapping("/api/platform/v1/last-leg/appointment-planning/batches")
public class AppointmentBatchPreviewController {
private final AppointmentBatchPreviewService service;
public AppointmentBatchPreviewController(AppointmentBatchPreviewService service) { this.service=service; }
public record Request(@NotEmpty @Size(max=100) List<@NotNull SourceRef> sources) { }
@PostMapping("/preview")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<AppointmentBatchPreviewService.Preview> preview(@AuthenticationPrincipal AuthenticatedUser user,@Valid @RequestBody Request request) {
AppointmentPlanningController.requirePlatform(user);
return ApiResponse.success(service.preview(request.sources()));
}
}
@@ -0,0 +1,21 @@
package com.baiyue.lastleg.appointmentplanning;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface AppointmentBatchPreviewMapper {
record Flags(Long orderId, boolean detained, boolean mixedDestinations, boolean activeAppointment) { }
@Select("<script>" + """
SELECT o.id AS orderId,o.detained,
EXISTS(SELECT 1 FROM ll_order_detail d WHERE d.order_id=o.id AND d.customer_id=o.customer_id
AND d.destination_warehouse_code IS NOT NULL AND d.destination_warehouse_code&lt;&gt;o.fba_warehouse_code) AS mixedDestinations,
EXISTS(SELECT 1 FROM ll_inbound_fba_appointment_item i JOIN ll_inbound_fba_appointment a ON a.id=i.appointment_id
WHERE i.order_id=o.id AND i.customer_id=o.customer_id AND a.appointment_status NOT IN ('CANCELLED','FAILED')) AS activeAppointment
FROM ll_order o WHERE o.id IN
<foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach>
""" + "</script>")
List<Flags> flags(@Param("ids") List<Long> ids);
}
@@ -0,0 +1,48 @@
package com.baiyue.lastleg.appointmentplanning;
import org.springframework.stereotype.Service;
import org.springframework.http.HttpStatus;
import org.springframework.web.server.ResponseStatusException;
import java.util.List;
import java.util.Objects;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class AppointmentBatchPreviewService {
private final AppointmentSourceService sources;
private final AppointmentBatchPreviewMapper mapper;
public AppointmentBatchPreviewService(AppointmentSourceService sources,AppointmentBatchPreviewMapper mapper) {
this.sources=sources;this.mapper=mapper;
}
public record Preview(AppointmentPlanningPolicy.Group group,String originWarehouseName,
String destinationWarehouseCode,String destinationTimezone,List<AppointmentSourceService.Source> sources,
List<String> missingFields) { }
public Preview preview(List<AppointmentCoverageService.SourceRef> refs) {
var resolved=sources.resolveBatch(refs);
var ids=resolved.stream().map(AppointmentSourceService.Source::orderId).filter(Objects::nonNull).distinct().toList();
var flags=ids.isEmpty()?java.util.Map.<Long,AppointmentBatchPreviewMapper.Flags>of():mapper.flags(ids).stream()
.collect(Collectors.toMap(AppointmentBatchPreviewMapper.Flags::orderId,Function.identity()));
var cargo=resolved.stream().map(source->{
String reason=source.canFollowup()?null:String.join(";",source.blockReasons());
var state=source.orderId()==null?null:flags.get(source.orderId());
if(source.orderId()!=null && state==null) reason="货源已变化,请重新查询";
else if(state!=null) {
if(state.detained()) reason="货物暂扣,请先处理后再合批";
else if(state.mixedDestinations()) reason="货物含多个目的地,请先核对明细";
else if(state.activeAppointment()) reason="货物已有有效预约,请编辑原预约";
}
// Arrival/warehouse ETA is not a cargo-ready window. Until an authoritative producer exists it stays unknown.
return new AppointmentPlanningPolicy.Cargo(source.sourceKey(),source.customerId(),source.originWarehouseId(),
source.destinationKey(),"US","US",source.packages(),null,null,reason==null,reason);
}).toList();
try {
var group=AppointmentPlanningPolicy.group(cargo);
return new Preview(group,resolved.get(0).originWarehouseName(),resolved.get(0).destinationWarehouseCode(),
sources.destinationTimezone(resolved.get(0).destinationWarehouseCode()),resolved,
group.unknownQuantitySources()>0?List.of("READY_WINDOW_UNVERIFIED","CARGO_QUANTITY_REVIEW"):List.of("READY_WINDOW_UNVERIFIED"));
} catch(IllegalArgumentException error) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,error.getMessage(),error);
}
}
}
@@ -0,0 +1,37 @@
package com.baiyue.lastleg.appointmentplanning;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/** Read-only loaded cargo, independent of inbound-plan materialization. */
@Data
public class AppointmentCargo {
private String sourceKey;
private Long orderId;
private String customerId;
private String customerName;
private String inboundCode;
private String containerBookingId;
private String containerNo;
private String originWarehouseId;
private String originWarehouseCode;
private String originWarehouseName;
private String destinationWarehouseCode;
private Integer packages;
private Integer receivedPackages;
private Integer shippedPackages;
private Integer sourcePalletCount;
private BigDecimal volumeCbm;
private LocalDateTime estimatedArrivalAt;
private LocalDateTime estimatedWarehouseAt;
private Integer orderVersion;
private String standardNode;
private Long shippingVersion;
private LocalDateTime shippingObservedAt;
private String shippingProvider;
private boolean hasInboundPlan;
private boolean hasActiveAppointment;
private boolean detained;
private boolean mixedDestinations;
}
@@ -0,0 +1,45 @@
package com.baiyue.lastleg.appointmentplanning;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface AppointmentCargoMapper {
String FILTER = """
FROM ll_order o JOIN ll_container_shipping_gate g ON g.container_booking_id=o.source_container_booking_id
WHERE o.order_type='FIRST_LEG' AND o.destination_type='FBA' AND g.node_sequence &gt;=40
AND o.current_status NOT IN ('CANCELLED','COMPLETED')
AND o.overseas_warehouse_id IN
<foreach collection='origins' item='id' open='(' separator=',' close=')'>#{id}</foreach>
AND o.fba_warehouse_code IN
<foreach collection='destinations' item='code' open='(' separator=',' close=')'>#{code}</foreach>
<if test='warehouseId != null'>AND o.overseas_warehouse_id=#{warehouseId}</if>
<if test='destination != null'>AND o.fba_warehouse_code=#{destination}</if>
<if test='keyword != null'>AND (o.inbound_code LIKE CONCAT('%',#{keyword},'%') OR o.container_no LIKE CONCAT('%',#{keyword},'%') OR o.customer_name LIKE CONCAT('%',#{keyword},'%'))</if>
""";
@Select("<script>SELECT COUNT(*) " + FILTER + "</script>")
long count(@Param("origins") List<String> origins, @Param("destinations") List<String> destinations,
@Param("warehouseId") String warehouseId, @Param("destination") String destination, @Param("keyword") String keyword);
@Select("<script>" + """
SELECT CONCAT('ORDER:',o.id) AS source_key,o.id AS order_id,o.customer_id,o.customer_name,o.inbound_code,
o.source_container_booking_id AS container_booking_id,o.container_no,
o.overseas_warehouse_id AS origin_warehouse_id,o.overseas_warehouse_code AS origin_warehouse_code,
o.overseas_warehouse_name AS origin_warehouse_name,o.fba_warehouse_code AS destination_warehouse_code,
o.package_count AS packages,o.received_package_count AS received_packages,o.shipped_package_count AS shipped_packages,
o.pallet_count AS source_pallet_count,o.volume_cbm,o.estimated_arrival_at,o.estimated_warehouse_at,
o.version AS order_version,g.standard_node,g.aggregate_version AS shipping_version,
g.observed_at AS shipping_observed_at,g.provider_code AS shipping_provider,o.detained,
EXISTS(SELECT 1 FROM ll_inbound_plan p WHERE p.source_order_id=o.id AND p.customer_id=o.customer_id) AS has_inbound_plan,
EXISTS(SELECT 1 FROM ll_inbound_fba_appointment_item i JOIN ll_inbound_fba_appointment a ON a.id=i.appointment_id
WHERE i.order_id=o.id AND i.customer_id=o.customer_id AND a.appointment_status NOT IN ('CANCELLED','FAILED')) AS has_active_appointment,
EXISTS(SELECT 1 FROM ll_order_detail d WHERE d.order_id=o.id AND d.customer_id=o.customer_id
AND d.destination_warehouse_code IS NOT NULL AND d.destination_warehouse_code&lt;&gt;o.fba_warehouse_code) AS mixed_destinations
""" + FILTER + " ORDER BY o.created_at DESC,o.id DESC LIMIT #{size} OFFSET #{offset}</script>")
List<AppointmentCargo> page(@Param("origins") List<String> origins, @Param("destinations") List<String> destinations,
@Param("warehouseId") String warehouseId, @Param("destination") String destination,
@Param("keyword") String keyword, @Param("size") int size, @Param("offset") long offset);
}
@@ -0,0 +1,57 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.PageResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ResponseStatusException;
import java.util.List;
import java.util.Set;
@Service
public class AppointmentCargoService {
private final AppointmentCargoMapper mapper;
private final AppointmentWarehouseClient warehouses;
private final String token;
public AppointmentCargoService(AppointmentCargoMapper mapper, AppointmentWarehouseClient warehouses,
@Value("${baiyue.security.internal-service-token:}") String token) {
this.mapper = mapper; this.warehouses = warehouses; this.token = token;
}
public PageResult<AppointmentCargo> page(int page, int size, String warehouseId, String destination, String keyword) {
if (page < 1 || size < 1 || size > 100) throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "每页数量必须为1至100");
if (keyword != null && keyword.length() > 128) throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "搜索词过长");
var scope = scope();
var origins = scope.origins();
var destinations = scope.destinations();
warehouseId = clean(warehouseId); destination = clean(destination); keyword = clean(keyword);
if (warehouseId != null && !origins.contains(warehouseId) || destination != null && !destinations.contains(destination)) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, "请选择已启用的美国接仓点及FBA目的仓");
}
if (origins.isEmpty() || destinations.isEmpty()) return new PageResult<>(List.of(), page, size, 0, 0);
long total = mapper.count(origins, destinations, warehouseId, destination, keyword);
var rows = mapper.page(origins, destinations, warehouseId, destination, keyword, size, (long) (page - 1) * size);
return new PageResult<>(rows, page, size, total, (total + size - 1) / size);
}
private record Scope(List<String> origins, List<String> destinations) { }
private Scope scope() {
final List<AppointmentWarehouseClient.Warehouse> catalog;
try {
var result = warehouses.catalog(token);
if (result == null || !result.successful() || result.data() == null) throw new IllegalStateException();
catalog = result.data();
} catch (RuntimeException error) {
throw new ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE, "仓库目录暂不可用,无法核实美国货物范围", error);
}
var us = catalog.stream().filter(w -> w != null && w.id() != null && w.id() > 0 && "US".equals(w.countryCode())).toList();
var origins = us.stream().filter(w -> Set.of("OVERSEAS", "OVERSEAS_PARTNER").contains(w.warehouseType() == null ? "" : w.warehouseType()))
.map(w -> w.id().toString()).distinct().toList();
var destinations = us.stream().filter(w -> "FBA".equals(w.warehouseType()) && clean(w.warehouseCode()) != null)
.map(AppointmentWarehouseClient.Warehouse::warehouseCode).distinct().toList();
return new Scope(origins, destinations);
}
private static String clean(String value) { return value == null || value.isBlank() ? null : value.trim(); }
}
@@ -0,0 +1,25 @@
package com.baiyue.lastleg.appointmentplanning;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Data
public class AppointmentContainer {
private String containerBookingId;
private String containerNo;
private long orderCount;
private long customerCount;
private Long packages;
private long unknownPackageOrders;
private LocalDateTime earliestArrivalAt;
private LocalDateTime latestArrivalAt;
private String standardNode;
private Long sourceVersion;
private boolean incompleteScope;
private List<Warehouse> warehouses = List.of();
public record Warehouse(String containerBookingId, String warehouseId, String warehouseName,
long orderCount, long customerCount) { }
public record Context(String containerBookingId, String containerNo, String warehouseId,
String warehouseName, boolean canFollowup, List<String> blockReasons) { }
}
@@ -0,0 +1,49 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.ApiResponse;
import com.baiyue.common.core.api.PageResult;
import com.baiyue.common.security.AuthenticatedUser;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/platform/v1/last-leg/appointment-planning/containers")
public class AppointmentContainerController {
private final AppointmentContainerService containers;
private final AppointmentFollowupService followups;
public AppointmentContainerController(AppointmentContainerService containers,AppointmentFollowupService followups) {
this.containers=containers; this.followups=followups;
}
@GetMapping
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<PageResult<AppointmentContainer>> page(@AuthenticationPrincipal AuthenticatedUser user,
@RequestParam(defaultValue="1") int page,@RequestParam(defaultValue="20") int size,@RequestParam(required=false) String keyword) {
AppointmentPlanningController.requirePlatform(user);
return ApiResponse.success(containers.page(page,size,keyword));
}
@GetMapping("/{containerId}")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<AppointmentContainer.Context> context(@AuthenticationPrincipal AuthenticatedUser user,
@PathVariable String containerId,@RequestParam(required=false) String warehouseId) {
AppointmentPlanningController.requirePlatform(user);
return ApiResponse.success(containers.context(containerId,warehouseId));
}
@GetMapping("/{containerId}/follow-ups")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<AppointmentFollowupService.History> history(@AuthenticationPrincipal AuthenticatedUser user,
@PathVariable String containerId,@RequestParam(required=false) String warehouseId,
@RequestParam(defaultValue="1") int page,@RequestParam(defaultValue="20") int size) {
AppointmentPlanningController.requirePlatform(user);
return ApiResponse.success(followups.containerHistory(containerId,warehouseId,page,size));
}
@PostMapping("/{containerId}/follow-ups")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list') and hasAuthority('platform:appointment:followup')")
public ApiResponse<AppointmentFollowupService.Record> save(@AuthenticationPrincipal AuthenticatedUser user,
@PathVariable String containerId,@RequestParam(required=false) String warehouseId,
@Valid @RequestBody AppointmentFollowupService.Save request) {
AppointmentPlanningController.requirePlatform(user);
return ApiResponse.success(followups.saveContainer(containerId,warehouseId,request,user.userId().toString(),user.displayName()==null?user.username():user.displayName()));
}
}
@@ -0,0 +1,51 @@
package com.baiyue.lastleg.appointmentplanning;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface AppointmentContainerMapper {
String FILTER = """
FROM ll_order o JOIN ll_container_shipping_gate g ON g.container_booking_id=o.source_container_booking_id
WHERE o.order_type='FIRST_LEG' AND o.current_status NOT IN ('CANCELLED','COMPLETED') AND g.node_sequence &gt;=40
AND o.overseas_warehouse_id IN <foreach collection='origins' item='id' open='(' separator=',' close=')'>#{id}</foreach>
<if test='containerId != null'>AND o.source_container_booking_id=#{containerId}</if>
<if test='keyword != null'>AND EXISTS(SELECT 1 FROM ll_order search_o
WHERE search_o.source_container_booking_id=o.source_container_booking_id AND search_o.order_type='FIRST_LEG'
AND search_o.current_status NOT IN ('CANCELLED','COMPLETED') AND search_o.overseas_warehouse_id IN
<foreach collection='origins' item='id' open='(' separator=',' close=')'>#{id}</foreach>
AND (search_o.container_no LIKE CONCAT('%',#{keyword},'%') OR search_o.inbound_code LIKE CONCAT('%',#{keyword},'%')))</if>
""";
String GROUP = " GROUP BY o.source_container_booking_id,g.container_no,g.standard_node,g.aggregate_version ";
@Select("<script>SELECT COUNT(*) FROM (SELECT o.source_container_booking_id " + FILTER + GROUP + ") counted</script>")
long count(@Param("origins") List<String> origins, @Param("keyword") String keyword, @Param("containerId") String containerId);
@Select("<script>" + """
SELECT o.source_container_booking_id AS container_booking_id,g.container_no,
COUNT(*) AS order_count,COUNT(DISTINCT o.customer_id) AS customer_count,
SUM(CASE WHEN o.package_count IS NULL OR o.package_count&lt;=0 THEN 1 ELSE 0 END) AS unknown_package_orders,
CASE WHEN SUM(CASE WHEN o.package_count IS NULL OR o.package_count&lt;=0 THEN 1 ELSE 0 END)&gt;0
THEN NULL ELSE SUM(o.package_count) END AS packages,
MIN(o.estimated_arrival_at) AS earliest_arrival_at,MAX(o.estimated_arrival_at) AS latest_arrival_at,
g.standard_node,g.aggregate_version AS source_version,
EXISTS(SELECT 1 FROM ll_order other_o WHERE other_o.source_container_booking_id=o.source_container_booking_id
AND other_o.order_type='FIRST_LEG' AND other_o.current_status NOT IN ('CANCELLED','COMPLETED')
AND (other_o.overseas_warehouse_id IS NULL OR other_o.overseas_warehouse_id NOT IN
<foreach collection='origins' item='id' open='(' separator=',' close=')'>#{id}</foreach>)) AS incomplete_scope
""" + FILTER + GROUP + " ORDER BY MAX(o.created_at) DESC,o.source_container_booking_id LIMIT #{size} OFFSET #{offset}</script>")
List<AppointmentContainer> page(@Param("origins") List<String> origins, @Param("keyword") String keyword,
@Param("containerId") String containerId, @Param("size") int size, @Param("offset") long offset);
@Select("<script>" + """
SELECT o.source_container_booking_id AS containerBookingId,o.overseas_warehouse_id AS warehouseId,
COUNT(*) AS orderCount,COUNT(DISTINCT o.customer_id) AS customerCount
FROM ll_order o WHERE o.order_type='FIRST_LEG' AND o.current_status NOT IN ('CANCELLED','COMPLETED')
AND o.source_container_booking_id IN <foreach collection='containers' item='id' open='(' separator=',' close=')'>#{id}</foreach>
AND o.overseas_warehouse_id IN <foreach collection='origins' item='id' open='(' separator=',' close=')'>#{id}</foreach>
GROUP BY o.source_container_booking_id,o.overseas_warehouse_id ORDER BY o.source_container_booking_id,o.overseas_warehouse_id
""" + "</script>")
List<WarehouseCount> warehouses(@Param("origins") List<String> origins, @Param("containers") List<String> containers);
record WarehouseCount(String containerBookingId, String warehouseId, long orderCount, long customerCount) { }
}
@@ -0,0 +1,66 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.PageResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ResponseStatusException;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class AppointmentContainerService {
private final AppointmentContainerMapper mapper;
private final AppointmentWarehouseClient warehouses;
private final String token;
public AppointmentContainerService(AppointmentContainerMapper mapper, AppointmentWarehouseClient warehouses,
@Value("${baiyue.security.internal-service-token:}") String token) {
this.mapper=mapper; this.warehouses=warehouses; this.token=token;
}
public PageResult<AppointmentContainer> page(int page,int size,String keyword) {
if(page<1 || size<1 || size>100 || keyword!=null && keyword.length()>128) throw bad("分页或搜索条件无效");
var catalog=catalog();
if(catalog.isEmpty()) return new PageResult<>(List.of(),page,size,0,0);
var origins=List.copyOf(catalog.keySet());
keyword=clean(keyword);
long total=mapper.count(origins,keyword,null);
var rows=total==0 ? List.<AppointmentContainer>of() : mapper.page(origins,keyword,null,size,(long)(page-1)*size);
attachWarehouses(rows,catalog);
return new PageResult<>(rows,page,size,total,(total+size-1)/size);
}
public AppointmentContainer.Context context(String containerId,String warehouseId) {
subjectKey(containerId,warehouseId);
var catalog=catalog();
var rows=catalog.isEmpty() ? List.<AppointmentContainer>of() : mapper.page(List.copyOf(catalog.keySet()),null,containerId,1,0);
if(rows.isEmpty()) throw new ResponseStatusException(HttpStatus.NOT_FOUND,"未找到美国范围内已开船的有效柜次");
attachWarehouses(rows,catalog);
var row=rows.get(0);
String warehouseName=null;
if(warehouseId!=null) warehouseName=row.getWarehouses().stream().filter(w->w.warehouseId().equals(warehouseId))
.map(AppointmentContainer.Warehouse::warehouseName).findFirst().orElseThrow(()->bad("该接仓点不属于当前柜次"));
return new AppointmentContainer.Context(containerId,row.getContainerNo(),warehouseId,warehouseName,
!row.isIncompleteScope(),row.isIncompleteScope()?List.of("同柜仍有未明确或非美国接仓点,请先核对整柜范围"):List.of());
}
public static String subjectKey(String containerId,String warehouseId) {
if(containerId==null || !containerId.matches("[A-Za-z0-9_-]{1,64}") || warehouseId!=null && !warehouseId.matches("[0-9]{1,20}")) throw bad("柜次或接仓点标识无效");
return "CONTAINER:"+containerId+(warehouseId==null?"":":WAREHOUSE:"+warehouseId);
}
private void attachWarehouses(List<AppointmentContainer> rows,Map<String,AppointmentWarehouseClient.Warehouse> catalog) {
if(rows.isEmpty()) return;
var groups=mapper.warehouses(List.copyOf(catalog.keySet()),rows.stream().map(AppointmentContainer::getContainerBookingId).toList()).stream()
.collect(Collectors.groupingBy(AppointmentContainerMapper.WarehouseCount::containerBookingId));
for(var row:rows) row.setWarehouses(groups.getOrDefault(row.getContainerBookingId(),List.of()).stream()
.map(w->new AppointmentContainer.Warehouse(w.containerBookingId(),w.warehouseId(),catalog.get(w.warehouseId()).warehouseName(),w.orderCount(),w.customerCount())).toList());
}
private Map<String,AppointmentWarehouseClient.Warehouse> catalog() {
try {
var response=warehouses.catalog(token);
if(response==null || !response.successful() || response.data()==null) throw new IllegalStateException();
var result=new LinkedHashMap<String,AppointmentWarehouseClient.Warehouse>();
for(var w:response.data()) if(w!=null && w.id()!=null && w.id()>0 && "US".equals(w.countryCode()) && Set.of("OVERSEAS","OVERSEAS_PARTNER").contains(Objects.toString(w.warehouseType(),""))) result.put(w.id().toString(),w);
return result;
} catch(RuntimeException error) { throw new ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE,"仓库目录暂不可用,无法核对美国整柜范围",error); }
}
private static String clean(String value) { return value==null || value.isBlank()?null:value.trim(); }
private static ResponseStatusException bad(String message) { return new ResponseStatusException(HttpStatus.BAD_REQUEST,message); }
}
@@ -0,0 +1,41 @@
package com.baiyue.lastleg.appointmentplanning;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.time.LocalDateTime;
import java.util.List;
@Mapper
public interface AppointmentCoverageMapper {
String DESTINATION_TYPE="CASE WHEN o.order_type='WAREHOUSE_TRANSFER' THEN wt.destination_type ELSE o.destination_type END";
String DESTINATION_CODE="CASE WHEN o.order_type='WAREHOUSE_TRANSFER' THEN wt.destination_warehouse_code ELSE o.fba_warehouse_code END";
String SHIPMENT_MISSING="CASE WHEN o.order_type='WAREHOUSE_TRANSFER' THEN (wt.id IS NULL OR ((wt.fba_shipment_no IS NULL OR TRIM(wt.fba_shipment_no)='') AND (wt.tracking_no IS NULL OR TRIM(wt.tracking_no)=''))) ELSE " +
"(NOT EXISTS(SELECT 1 FROM ll_order_detail d WHERE d.order_id=o.id AND d.customer_id=o.customer_id) OR EXISTS(SELECT 1 FROM ll_order_detail d WHERE d.order_id=o.id AND d.customer_id=o.customer_id AND (d.shipment_no IS NULL OR TRIM(d.shipment_no)='') AND (d.fba_tracking_no IS NULL OR TRIM(d.fba_tracking_no)=''))) END";
String TRANSFER_JOIN=" LEFT JOIN ll_warehouse_transfer_order wt ON o.order_type='WAREHOUSE_TRANSFER' AND wt.lastleg_order_id=o.id AND wt.customer_id=o.customer_id ";
record OrderRef(String customerId, Long orderId) { }
record Source(Long orderId, String customerId, String destinationType, String fbaWarehouseCode,
Integer packages, Integer version, LocalDateTime updatedAt, boolean shipmentReferencesMissing) { }
record Fact(Long orderId, String customerId, String appointmentNo, String status,
LocalDateTime appointmentAt, LocalDateTime appointmentEndAt, LocalDateTime updatedAt,
Long itemId, Integer packages, String warehouseCode,String sourceKey,String sourceVersion,
String confirmationNo,String timezone) { }
@Select({"<script>SELECT o.id AS orderId,o.customer_id AS customerId,"+DESTINATION_TYPE+" AS destinationType,",
DESTINATION_CODE+" AS fbaWarehouseCode,o.package_count AS packages,o.version,o.updated_at AS updatedAt, ",
SHIPMENT_MISSING+" AS shipmentReferencesMissing ",
"FROM ll_order o "+TRANSFER_JOIN+" WHERE <foreach collection='sources' item='s' open='(' separator=' OR ' close=')'>",
"(o.id=#{s.orderId} AND o.customer_id=#{s.customerId})</foreach></script>"})
List<Source> sources(@Param("sources") List<OrderRef> sources);
@Select({"<script>SELECT i.order_id AS orderId,i.customer_id AS customerId,a.appointment_no AS appointmentNo,",
"a.appointment_status AS status,a.appointment_at AS appointmentAt,a.appointment_end_at AS appointmentEndAt,",
"a.updated_at AS updatedAt,i.id AS itemId,i.package_count AS packages,i.fba_warehouse_code AS warehouseCode, ",
"i.source_key AS sourceKey,i.source_version AS sourceVersion,a.confirmation_no AS confirmationNo,a.timezone ",
"FROM ll_inbound_fba_appointment_item i JOIN ll_inbound_fba_appointment a ON a.id=i.appointment_id ",
"WHERE i.active=1 AND a.appointment_status NOT IN ('FAILED','CANCELLED') AND ",
"<foreach collection='sources' item='s' open='(' separator=' OR ' close=')'>",
"(i.source_key=#{s.sourceKey} AND i.customer_id=#{s.customerId})</foreach>",
" ORDER BY a.appointment_at,a.id,i.id</script>"})
List<Fact> appointments(@Param("sources") List<AppointmentCoverageService.SourceRef> sources);
}
@@ -0,0 +1,109 @@
package com.baiyue.lastleg.appointmentplanning;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
/** Shared read projection. Callers authorize the customer/source before invoking; never confirms bookings. */
@Service
public class AppointmentCoverageService {
public record SourceRef(String customerId, String sourceKey, String destinationKey) { }
public record Appointment(String appointmentNo, String confirmationNo, String status,
LocalDateTime confirmedAt, LocalDateTime confirmedEndAt, String timezone) { }
public record Coverage(String customerId, String sourceKey, String destinationKey, String status,
List<Appointment> appointments, List<String> missingFields,
String sourceVersion, boolean changeReviewRequired) { }
private final AppointmentCoverageMapper mapper;
private final AppointmentExternalSourceGateway external;
public AppointmentCoverageService(AppointmentCoverageMapper mapper, AppointmentExternalSourceGateway external) {
this.mapper=mapper; this.external=external;
}
public List<Coverage> query(List<SourceRef> input) {
if (input==null || input.isEmpty()) return List.of();
if (input.size()>100 || input.stream().anyMatch(s -> s==null || blank(s.customerId()) || blank(s.sourceKey()) || blank(s.destinationKey()))) {
throw new IllegalArgumentException("每次最多核对100个完整的预约来源");
}
var requested=input.stream().distinct().toList();
var externalRefs=requested.stream().filter(s -> s.sourceKey().startsWith("BOOKING:"))
.map(s -> new AppointmentExternalSourceGateway.SourceRef(s.customerId(),s.sourceKey().substring(8))).toList();
var bookings=externalRefs.isEmpty() ? List.<AppointmentExternalSourceGateway.Source>of() : external.resolve(externalRefs);
var bookingMap=bookings.stream().collect(Collectors.toMap(s -> key(s.customerId(),"BOOKING:"+s.bookingNo()),s -> s));
var refs=new LinkedHashMap<SourceRef,AppointmentCoverageMapper.OrderRef>();
for (var source:requested) {
if (source.sourceKey().startsWith("ORDER:")) {
try {
long id=Long.parseLong(source.sourceKey().substring(6));
if (id>0) refs.put(source,new AppointmentCoverageMapper.OrderRef(source.customerId(),id));
} catch (NumberFormatException ignored) { /* Invalid source is returned explicitly below. */ }
} else if (source.sourceKey().startsWith("BOOKING:")) {
var booking=bookingMap.get(key(source.customerId(),source.sourceKey()));
if (booking!=null && booking.orderId()!=null && Objects.equals(source.destinationKey(),booking.destinationKey())) {
refs.put(source,new AppointmentCoverageMapper.OrderRef(source.customerId(),booking.orderId()));
}
}
}
var unique=refs.values().stream().distinct().toList();
if (unique.size()!=refs.size()) throw new IllegalArgumentException("同一货物存在重复来源,请保留原外接登记来源后再核对");
var orders=unique.isEmpty() ? List.<AppointmentCoverageMapper.Source>of() : mapper.sources(unique);
var orderMap=orders.stream().collect(Collectors.toMap(s -> new AppointmentCoverageMapper.OrderRef(s.customerId(),s.orderId()),s -> s));
var facts=mapper.appointments(requested);
var bySource=facts.stream().collect(Collectors.groupingBy(f -> key(f.customerId(),f.sourceKey())));
var output=new ArrayList<Coverage>();
for (var source:requested) {
var booking=bookingMap.get(key(source.customerId(),source.sourceKey()));
if (booking!=null && !source.destinationKey().equals(booking.destinationKey())) {
output.add(empty(source,"DESTINATION_MISMATCH","DESTINATION",version(booking.recordVersion()),true)); continue;
}
if (booking!=null && !Set.of("CONFIRMED","RECEIVED","BOUND").contains(booking.bookingStatus()==null ? "" : booking.bookingStatus())) {
output.add(empty(source,"SOURCE_NOT_READY","CARRIER_CONFIRMATION",version(booking.recordVersion()),false)); continue;
}
var order=orderMap.get(refs.get(source));
var relevant=bySource.getOrDefault(key(source.customerId(),source.sourceKey()),List.of());
if (order==null) {
if(booking!=null && !relevant.isEmpty()) {
var planned=relevant.stream().map(f->new Appointment(f.appointmentNo(),null,f.status(),null,null,f.timezone())).distinct().toList();
output.add(new Coverage(source.customerId(),source.sourceKey(),source.destinationKey(),"PENDING",planned,List.of("REAL_CARGO_MATERIALS","RECEIVING_CONFIRMATION"),version(booking.recordVersion()),false));continue;
}
output.add(empty(source,booking==null ? "SOURCE_NOT_FOUND" : "SOURCE_NOT_MATERIALIZED","REAL_CARGO_MATERIALS",booking==null ? null : version(booking.recordVersion()),false)); continue;
}
if(blank(order.destinationType()) || blank(order.fbaWarehouseCode())) {
output.add(empty(source,"SOURCE_NOT_READY","DESTINATION_UNVERIFIED",version(order.version()),false));continue;
}
if (!"FBA".equals(order.destinationType()) || !source.destinationKey().equals("FBA:"+order.fbaWarehouseCode())) {
output.add(empty(source,"DESTINATION_MISMATCH","DESTINATION",version(order.version()),true)); continue;
}
var distinct=new LinkedHashMap<String,Appointment>();
var seen=new HashSet<Long>(); long confirmed=0, covered=0; boolean invalid=false, changed=false;
for (var fact:relevant) {
if (fact.orderId()!=null && !Objects.equals(order.orderId(),fact.orderId()) || !Objects.equals(order.fbaWarehouseCode(),fact.warehouseCode()) || fact.packages()==null || fact.packages()<=0 || !seen.add(fact.itemId())) { invalid=true; continue; }
covered+=fact.packages();
boolean success="SUCCESS".equals(fact.status()) && fact.appointmentAt()!=null && !blank(fact.confirmationNo()) && !blank(fact.timezone());
if (success) confirmed+=fact.packages();
distinct.putIfAbsent(fact.appointmentNo(),new Appointment(fact.appointmentNo(),success ? fact.confirmationNo() : null,fact.status(),success ? fact.appointmentAt() : null,success ? fact.appointmentEndAt() : null,fact.timezone()));
String currentVersion=(booking==null?"":"BOOKING:"+version(booking.recordVersion())+"/")+"ORDER:"+version(order.version());
changed|=!Objects.equals(currentVersion,fact.sourceVersion());
}
var missing=new ArrayList<String>();
String status;
if (invalid || order.packages()==null || order.packages()<=0 || covered>order.packages()) { status="REVIEW_REQUIRED"; missing.add("CARGO_QUANTITY_REVIEW"); }
else if (covered==0) { status="UNASSIGNED"; missing.add("RECEIVING_APPOINTMENT"); }
else if (covered<order.packages()) { status="PARTIAL"; missing.add("UNCOVERED_CARGO"); }
else if (confirmed<order.packages()) { status="PENDING"; missing.add("RECEIVING_CONFIRMATION"); }
else { status="CONFIRMED"; }
if (relevant.stream().anyMatch(f->"SUCCESS".equals(f.status()) && blank(f.timezone()))) missing.add("APPOINTMENT_TIMEZONE_UNVERIFIED");
if (order.shipmentReferencesMissing()) missing.add("FBA_SHIPMENT_REFERENCES");
if (changed) missing.add("SOURCE_CHANGED_REVIEW");
output.add(new Coverage(source.customerId(),source.sourceKey(),source.destinationKey(),status,List.copyOf(distinct.values()),List.copyOf(missing),
(booking==null ? "" : "BOOKING:"+version(booking.recordVersion())+"/")+"ORDER:"+version(order.version()),changed || invalid));
}
return List.copyOf(output);
}
private static Coverage empty(SourceRef s,String status,String missing,String version,boolean review) {
return new Coverage(s.customerId(),s.sourceKey(),s.destinationKey(),status,List.of(),List.of(missing),version,review);
}
private static String key(String customerId,String sourceKey) { return customerId+"\n"+sourceKey; }
private static String version(Number version) { return version==null ? null : version.toString(); }
private static boolean blank(String value) { return value==null || value.isBlank(); }
}
@@ -0,0 +1,22 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.*;
import com.baiyue.common.security.AuthenticatedUser;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/platform/v1/last-leg/appointment-planning/external-candidates")
public class AppointmentExternalCandidateController {
private final AppointmentExternalCandidateService service;
public AppointmentExternalCandidateController(AppointmentExternalCandidateService service){this.service=service;}
@GetMapping
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<PageResult<AppointmentExternalCandidateService.Row>> page(@AuthenticationPrincipal AuthenticatedUser user,
@RequestParam(defaultValue="1") int page,@RequestParam(defaultValue="20") int size,
@RequestParam(required=false) String warehouseId,@RequestParam(required=false) String destination,@RequestParam(required=false) String keyword) {
AppointmentPlanningController.requirePlatform(user);
return ApiResponse.success(service.page(page,size,warehouseId,destination,keyword));
}
}
@@ -0,0 +1,53 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.PageResult;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ResponseStatusException;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class AppointmentExternalCandidateService {
public record Row(String customerName,String tripNo,AppointmentSourceService.Source source,
AppointmentCoverageService.Coverage coverage) { }
private final AppointmentExternalSourceGateway external;
private final AppointmentWarehouseClient warehouses;
private final AppointmentSourceService sources;
private final AppointmentCoverageService coverage;
private final String token;
public AppointmentExternalCandidateService(AppointmentExternalSourceGateway external,AppointmentWarehouseClient warehouses,
AppointmentSourceService sources,AppointmentCoverageService coverage,
@Value("${baiyue.security.internal-service-token:}") String token) {
this.external=external;this.warehouses=warehouses;this.sources=sources;this.coverage=coverage;this.token=token;
}
public PageResult<Row> page(int page,int size,String warehouseId,String destination,String keyword) {
if(page<1 || size<1 || size>100 || keyword!=null && keyword.length()>128) throw bad("候选分页或关键词无效");
warehouseId=clean(warehouseId);destination=clean(destination);keyword=clean(keyword);
List<AppointmentWarehouseClient.Warehouse> catalog;
try {
var response=warehouses.catalog(token);
if(response==null || !response.successful() || response.data()==null) throw new IllegalStateException();
catalog=response.data();
} catch(RuntimeException error) {throw new ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE,"仓库目录暂不可用,无法核实外接货范围",error);}
var us=catalog.stream().filter(w->w!=null && w.id()!=null && w.id()>0 && "US".equals(w.countryCode())).toList();
var origins=us.stream().filter(w->Set.of("OVERSEAS","OVERSEAS_PARTNER").contains(Objects.toString(w.warehouseType(),""))).map(w->w.id().toString()).distinct().toList();
var destinations=us.stream().filter(w->"FBA".equals(w.warehouseType()) && clean(w.warehouseCode())!=null).map(AppointmentWarehouseClient.Warehouse::warehouseCode).distinct().toList();
if(warehouseId!=null && !origins.contains(warehouseId) || destination!=null && !destinations.contains(destination)) throw bad("请选择已启用的美国接仓点及FBA目的仓");
if(origins.isEmpty() || destinations.isEmpty()) return new PageResult<>(List.of(),page,size,0,0);
var found=external.candidates(new AppointmentExternalSourceGateway.CandidateQuery(page,size,origins,destinations,warehouseId,destination,keyword));
if(found.records().isEmpty()) return new PageResult<>(List.of(),page,size,found.total(),found.pages());
var refs=found.records().stream().map(r->new AppointmentCoverageService.SourceRef(r.customerId(),"BOOKING:"+r.bookingNo(),r.destinationKey())).toList();
var resolved=sources.resolveBatch(refs).stream().collect(Collectors.toMap(r->r.customerId()+"\n"+r.sourceKey(),Function.identity()));
var covered=coverage.query(refs).stream().collect(Collectors.toMap(r->r.customerId()+"\n"+r.sourceKey(),Function.identity()));
var rows=found.records().stream().map(r->{
String key=r.customerId()+"\nBOOKING:"+r.bookingNo();
return new Row(r.customerName(),r.tripNo(),Objects.requireNonNull(resolved.get(key)),Objects.requireNonNull(covered.get(key)));
}).toList();
return new PageResult<>(rows,page,size,found.total(),found.pages());
}
private static String clean(String value){return value==null || value.isBlank()?null:value.trim();}
private static ResponseStatusException bad(String message){return new ResponseStatusException(HttpStatus.BAD_REQUEST,message);}
}
@@ -0,0 +1,20 @@
package com.baiyue.lastleg.appointmentplanning;
import java.util.List;
/** Implemented by the external-booking owner; planning must not query Fleet's persistence directly. */
public interface AppointmentExternalSourceGateway {
record Candidate(String customerId, String customerName, String bookingNo, String tripNo, String destinationKey) { }
record CandidateQuery(int page, int size, List<String> originIds, List<String> destinationCodes,
String warehouseId, String destination, String keyword) { }
com.baiyue.common.core.api.PageResult<Candidate> candidates(CandidateQuery query);
record SourceRef(String customerId, String bookingNo) { }
record OrderRef(String customerId, Long orderId) { }
record Source(String customerId, String bookingNo, String tripNo, String bookingStatus,
String warehouseId, String destinationKey, Long orderId, Integer packageCount, Long recordVersion) { }
List<Source> resolve(List<SourceRef> sources);
/** Returns existing original bookings only, for canonicalizing post-receipt selections. Never creates a booking. */
List<Source> resolveOrders(List<OrderRef> orders);
/** Inside the caller transaction, lock original booking rows in stable order before validating an appointment write. */
void lockForAppointment(List<SourceRef> sources);
}
@@ -0,0 +1,28 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data
@TableName("ll_appointment_followup")
public class AppointmentFollowup {
@TableId(type = IdType.INPUT) private Long id;
private Long sourceOrderId;
private String sourceKey;
private String customerId;
private String stage;
private Integer version;
private String contactedParty;
private String result;
private String nextAction;
private LocalDate followupDate;
private String operatorId;
private String operatorName;
private String commandKey;
private String requestHash;
private LocalDateTime createdAt;
}
@@ -0,0 +1,19 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import java.util.List;
@Mapper
public interface AppointmentFollowupMapper extends BaseMapper<AppointmentFollowup> {
@Select("SELECT * FROM ll_appointment_followup WHERE source_key=#{sourceKey} AND customer_id=#{customerId} AND stage=#{stage} AND command_key=#{key}")
AppointmentFollowup command(@Param("sourceKey") String sourceKey, @Param("customerId") String customerId, @Param("stage") String stage, @Param("key") String key);
@Select("SELECT COALESCE(MAX(version),0) FROM ll_appointment_followup WHERE source_key=#{sourceKey} AND customer_id=#{customerId} AND stage=#{stage}")
int version(@Param("sourceKey") String sourceKey, @Param("customerId") String customerId, @Param("stage") String stage);
@Select("SELECT * FROM ll_appointment_followup WHERE source_key=#{sourceKey} AND customer_id=#{customerId} ORDER BY created_at DESC,id DESC LIMIT #{size} OFFSET #{offset}")
List<AppointmentFollowup> page(@Param("sourceKey") String sourceKey, @Param("customerId") String customerId, @Param("size") int size, @Param("offset") long offset);
@Select("SELECT COUNT(*) FROM ll_appointment_followup WHERE source_key=#{sourceKey} AND customer_id=#{customerId}")
long count(@Param("sourceKey") String sourceKey, @Param("customerId") String customerId);
}
@@ -0,0 +1,118 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.baiyue.common.core.api.PageResult;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.validation.constraints.*;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.server.ResponseStatusException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.HexFormat;
import java.nio.charset.StandardCharsets;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.Instant;
import java.util.Set;
@Service
public class AppointmentFollowupService {
private final AppointmentSourceService sources;
private final AppointmentFollowupMapper mapper;
private final ObjectMapper json;
private final AppointmentContainerService containers;
public AppointmentFollowupService(AppointmentSourceService sources, AppointmentFollowupMapper mapper, ObjectMapper json,
AppointmentContainerService containers) {
this.sources = sources; this.mapper = mapper; this.json = json; this.containers = containers;
}
public record Save(@NotBlank @Size(max=32) String stage, @Min(0) int expectedVersion,
@NotBlank @Size(max=64) String idempotencyKey,
@Size(max=200) String contactedParty, @NotBlank @Size(max=1000) String result,
@Size(max=500) String nextAction, LocalDate followupDate) { }
public record Record(String stage, int version, String contactedParty, String result, String nextAction,
LocalDate followupDate, String operatorName, Instant createdAt) { }
public record History(PageResult<Record> history, java.util.Map<String,Integer> versions) { }
private static final Set<String> STAGES = Set.of("DRAYAGE_CONTACT", "TERMINAL_APPOINTMENT", "WAREHOUSE_RECEIVING", "FBA_RECEIVING");
public History history(String sourceKey, String customerId, int page, int size) {
requireCargoKey(sourceKey);
return history(sourceKey,customerId,page,size,()->sources.resolve(sourceKey,customerId,null));
}
public History containerHistory(String containerId,String warehouseId,int page,int size) {
return history(AppointmentContainerService.subjectKey(containerId,warehouseId),"0",page,size,()->containers.context(containerId,warehouseId));
}
private History history(String sourceKey,String customerId,int page,int size,Runnable verifySource) {
if (page<1 || size<1 || size>100) throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"分页参数无效");
long total = mapper.count(sourceKey,customerId);
if (total == 0) verifySource.run();
var records = mapper.page(sourceKey,customerId,size,(long)(page-1)*size).stream().map(AppointmentFollowupService::view).toList();
var versions = new java.util.LinkedHashMap<String,Integer>();
STAGES.stream().sorted().forEach(stage -> versions.put(stage, mapper.version(sourceKey,customerId,stage)));
return new History(new PageResult<>(records,page,size,total,(total+size-1)/size),versions);
}
@Transactional(isolation = org.springframework.transaction.annotation.Isolation.READ_COMMITTED)
public Record save(String sourceKey, String customerId, Save request, String operatorId, String operatorName) {
requireCargoKey(sourceKey);
if(!"FBA_RECEIVING".equals(request.stage())) throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"提柜及接仓事项请进入整柜跟进,避免按货物重复联系");
return append(sourceKey,customerId,request,operatorId,operatorName,()->{
var source=sources.resolve(sourceKey,customerId,null);
return new Subject(source.orderId(),source.canFollowup());
});
}
@Transactional(isolation = org.springframework.transaction.annotation.Isolation.READ_COMMITTED)
public Record saveContainer(String containerId,String warehouseId,Save request,String operatorId,String operatorName) {
String key=AppointmentContainerService.subjectKey(containerId,warehouseId);
boolean allowed=warehouseId==null ? Set.of("DRAYAGE_CONTACT","TERMINAL_APPOINTMENT").contains(request.stage()) : "WAREHOUSE_RECEIVING".equals(request.stage());
if(!allowed) throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"请选择对应柜次或接仓点的跟进事项");
return append(key,"0",request,operatorId,operatorName,()->{
var context=containers.context(containerId,warehouseId);
return new Subject(null,context.canFollowup());
});
}
private record Subject(Long orderId,boolean canFollowup) { }
private Record append(String sourceKey,String customerId,Save request,String operatorId,String operatorName,
java.util.function.Supplier<Subject> resolve) {
if (!STAGES.contains(request.stage())) throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"请选择有效跟进事项");
if (request.followupDate()!=null && (request.nextAction()==null || request.nextAction().isBlank())) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"设置跟进日期时请填写下一步安排");
}
final String hash;
try { hash = HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest((customerId+"\n"+operatorId+"\n"+json.writeValueAsString(request)).getBytes(StandardCharsets.UTF_8))); }
catch (JsonProcessingException | NoSuchAlgorithmException error) { throw new IllegalStateException("无法保存跟进请求",error); }
var existing = mapper.command(sourceKey,customerId,request.stage(),request.idempotencyKey());
if (existing!=null) {
if (!hash.equals(existing.getRequestHash())) throw new ResponseStatusException(HttpStatus.CONFLICT,"重复请求内容不一致,请核对跟进记录");
return view(existing);
}
var source = resolve.get();
if (!source.canFollowup()) throw new ResponseStatusException(HttpStatus.CONFLICT,"当前来源仅可查看,请先核对承运状态");
if (mapper.version(sourceKey,customerId,request.stage())!=request.expectedVersion()) throw new ResponseStatusException(HttpStatus.CONFLICT,"跟进记录已更新,请重新读取后提交");
var value = new AppointmentFollowup(); value.setId(IdWorker.getId()); value.setSourceOrderId(source.orderId()); value.setSourceKey(sourceKey); value.setCustomerId(customerId);
value.setStage(request.stage()); value.setVersion(request.expectedVersion()+1); value.setContactedParty(clean(request.contactedParty()));
value.setResult(request.result().trim()); value.setNextAction(clean(request.nextAction())); value.setFollowupDate(request.followupDate());
value.setOperatorId(operatorId); value.setOperatorName(clean(operatorName)); value.setCommandKey(request.idempotencyKey());
value.setRequestHash(hash);
// Return the same precision that DATETIME(3) can persist, including the first response.
value.setCreatedAt(LocalDateTime.now(ZoneOffset.UTC).truncatedTo(java.time.temporal.ChronoUnit.MILLIS));
try { mapper.insert(value); }
catch (org.springframework.dao.DuplicateKeyException conflict) {
var raced = mapper.command(sourceKey,customerId,request.stage(),request.idempotencyKey());
if (raced!=null && hash.equals(raced.getRequestHash())) return view(raced);
throw new ResponseStatusException(HttpStatus.CONFLICT,"跟进记录已更新或请求内容冲突,请重新读取",conflict);
}
return view(value);
}
private static String clean(String value) { return value==null || value.isBlank() ? null : value.trim(); }
private static void requireCargoKey(String sourceKey) {
if(sourceKey==null || !(sourceKey.startsWith("ORDER:") || sourceKey.startsWith("BOOKING:")))
throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"请选择有效货物来源");
}
private static Record view(AppointmentFollowup row) {
return new Record(row.getStage(),row.getVersion(),row.getContactedParty(),row.getResult(),row.getNextAction(),row.getFollowupDate(),row.getOperatorName(),row.getCreatedAt().toInstant(ZoneOffset.UTC));
}
}
@@ -0,0 +1,17 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.ApiResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDateTime;
import java.util.List;
@FeignClient(name="firstleg-service",contextId="appointmentForecastClient",url="${FIRSTLEG_SERVICE_URL:${baiyue.clients.firstleg.url:}}")
public interface AppointmentForecastClient {
record Request(List<Long> containerBookingIds) { }
record Fact(Long containerBookingId,Long factId,String providerCode,String sourceReference,
LocalDateTime observedAt,LocalDateTime estimatedAt,LocalDateTime actualAt) { }
record Forecast(Long containerBookingId,Fact latest,Fact previous,String timeBasis) { }
@PostMapping("/internal/firstleg/appointment-forecasts/batch")
ApiResponse<List<Forecast>> batch(@RequestHeader("X-Internal-Service-Token") String token,@RequestBody Request request);
}
@@ -0,0 +1,20 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.time.LocalDateTime;
@Data @TableName("ll_appointment_impact")
public class AppointmentImpact {
@TableId(type=IdType.INPUT) private String containerBookingId;
private String impactNo;
private String baselineJson;
private String latestJson;
private String forecastToken;
private String status;
private String reason;
private String ownerId;
private String ownerName;
private int version;
private LocalDateTime updatedAt;
}
@@ -0,0 +1,44 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.*;
import com.baiyue.common.security.AuthenticatedUser;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/platform/v1/last-leg/appointment-planning/impacts")
public class AppointmentImpactController {
public record Refresh(@Min(1) int page,@Min(1) @Max(100) int size,@Size(max=128) String keyword) { }
private final AppointmentImpactService service;
private final AppointmentImpactQueryService queries;
public AppointmentImpactController(AppointmentImpactService service,AppointmentImpactQueryService queries){this.service=service;this.queries=queries;}
@GetMapping
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<PageResult<AppointmentImpactQueryService.Row>> page(@AuthenticationPrincipal AuthenticatedUser user,
@RequestParam(defaultValue="1") int page,@RequestParam(defaultValue="20") int size,@RequestParam(required=false) String keyword) {
AppointmentPlanningController.requirePlatform(user);return ApiResponse.success(queries.page(page,size,keyword));
}
@GetMapping("/{id}")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<AppointmentImpactQueryService.Detail> detail(@AuthenticationPrincipal AuthenticatedUser user,@PathVariable String id,
@RequestParam(defaultValue="1") int page,@RequestParam(defaultValue="20") int size) {
AppointmentPlanningController.requirePlatform(user);
boolean trips=SecurityContextHolder.getContext().getAuthentication().getAuthorities().stream().anyMatch(a->"platform:fleet:trip:list".equals(a.getAuthority()));
return ApiResponse.success(queries.detail(id,page,size,trips));
}
@PostMapping("/refresh")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list') and hasAuthority('platform:appointment:followup')")
public ApiResponse<List<AppointmentImpactService.View>> refresh(@AuthenticationPrincipal AuthenticatedUser user,@Valid @RequestBody Refresh request) {
AppointmentPlanningController.requirePlatform(user);return ApiResponse.success(service.refreshPage(request.page(),request.size(),request.keyword(),user.userId().toString(),user.username()));
}
@PostMapping("/{id}/commands")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list') and hasAuthority('platform:appointment:followup')")
public ApiResponse<AppointmentImpactService.View> handle(@AuthenticationPrincipal AuthenticatedUser user,@PathVariable String id,@Valid @RequestBody AppointmentImpactService.Command request) {
AppointmentPlanningController.requirePlatform(user);return ApiResponse.success(service.handle(id,user.userId().toString(),user.username(),request));
}
}
@@ -0,0 +1,23 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.time.LocalDate;
import java.time.LocalDateTime;
@Data @TableName("ll_appointment_impact_history")
public class AppointmentImpactHistory {
@TableId(type=IdType.INPUT) private Long id;
private String containerBookingId;
private int version;
private String action;
private String operatorId;
private String operatorName;
private String result;
private String nextAction;
private LocalDate followupDate;
private String commandKey;
private String requestHash;
private String responseJson;
private LocalDateTime createdAt;
}
@@ -0,0 +1,31 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import java.util.List;
@Mapper
public interface AppointmentImpactMapper extends BaseMapper<AppointmentImpact> {
@Select("<script>SELECT * FROM ll_appointment_impact WHERE container_booking_id IN <foreach collection='ids' item='id' open='(' separator=',' close=')'>#{id}</foreach></script>")
List<AppointmentImpact> byContainers(@Param("ids") List<String> ids);
@Select("SELECT COUNT(*) FROM ll_appointment_impact_history WHERE container_booking_id=#{id}")
long historyCount(String id);
@Select("SELECT * FROM ll_appointment_impact WHERE container_booking_id=#{id} FOR UPDATE")
AppointmentImpact lock(String id);
@Update("""
UPDATE ll_appointment_impact SET baseline_json=#{baselineJson},latest_json=#{latestJson},forecast_token=#{forecastToken},
status=#{status},reason=#{reason},owner_id=#{ownerId},owner_name=#{ownerName},version=#{version},updated_at=#{updatedAt}
WHERE container_booking_id=#{containerBookingId}
""")
int save(AppointmentImpact row);
@Select("SELECT * FROM ll_appointment_impact_history WHERE container_booking_id=#{id} AND operator_id=#{operator} AND command_key=#{key}")
AppointmentImpactHistory command(@Param("id") String id,@Param("operator") String operator,@Param("key") String key);
@Insert("""
INSERT INTO ll_appointment_impact_history
(id,container_booking_id,version,action,operator_id,operator_name,result,next_action,followup_date,command_key,request_hash,response_json,created_at)
VALUES(#{id},#{containerBookingId},#{version},#{action},#{operatorId},#{operatorName},#{result},#{nextAction},#{followupDate},#{commandKey},#{requestHash},#{responseJson},#{createdAt})
""")
int history(AppointmentImpactHistory row);
@Select("SELECT * FROM ll_appointment_impact_history WHERE container_booking_id=#{id} ORDER BY version DESC LIMIT #{size} OFFSET #{offset}")
List<AppointmentImpactHistory> historyPage(@Param("id") String id,@Param("size") int size,@Param("offset") long offset);
}
@@ -0,0 +1,22 @@
package com.baiyue.lastleg.appointmentplanning;
import java.util.Objects;
/** Source-local observations can prove a change, not a cross-time-zone delivery violation. */
public final class AppointmentImpactPolicy {
private AppointmentImpactPolicy() { }
public record Decision(boolean reviewRequired,String reason) { }
public static Decision compare(AppointmentForecastClient.Fact baseline,AppointmentForecastClient.Fact latest) {
if(latest==null || latest.estimatedAt()==null && latest.actualAt()==null) return new Decision(true,"FORECAST_MISSING");
if(latest.actualAt()!=null) {
return baseline==null || !Objects.equals(baseline.actualAt(),latest.actualAt())
? new Decision(true,"ACTUAL_ARRIVAL_REVIEW") : new Decision(false,"UNCHANGED");
}
if(baseline==null) return new Decision(false,"BASELINE_ESTABLISHED");
if(!Objects.equals(baseline.estimatedAt(),latest.estimatedAt()) || !Objects.equals(baseline.actualAt(),latest.actualAt()))
return new Decision(true,"FORECAST_CHANGED");
if(!Objects.equals(baseline.providerCode(),latest.providerCode()) || !Objects.equals(baseline.sourceReference(),latest.sourceReference()))
return new Decision(true,"SOURCE_CHANGED");
return new Decision(false,"UNCHANGED");
}
}
@@ -0,0 +1,40 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.PageResult;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.http.HttpStatus;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class AppointmentImpactQueryService {
public record Row(AppointmentContainer container,AppointmentImpactService.View impact) { }
public record History(int version,String action,String operatorName,String result,String nextAction,java.time.LocalDate followupDate,java.time.LocalDateTime createdAt) { }
public record Detail(AppointmentImpactService.View impact,List<AppointmentImpactRelationMapper.Cargo> cargo,
List<AppointmentImpactRelationMapper.Appointment> appointments,AppointmentImpactTransportGateway.Links transport,
PageResult<History> history) { }
private final AppointmentContainerService containers;
private final AppointmentImpactService service;
private final AppointmentImpactMapper mapper;
private final AppointmentImpactRelationMapper relations;
private final AppointmentImpactTransportGateway transport;
public AppointmentImpactQueryService(AppointmentContainerService containers,AppointmentImpactService service,AppointmentImpactMapper mapper,
AppointmentImpactRelationMapper relations,AppointmentImpactTransportGateway transport){this.containers=containers;this.service=service;this.mapper=mapper;this.relations=relations;this.transport=transport;}
public PageResult<Row> page(int page,int size,String keyword) {
var found=containers.page(page,size,keyword);
var states=found.records().isEmpty()?Map.<String,AppointmentImpact>of():mapper.byContainers(found.records().stream().map(AppointmentContainer::getContainerBookingId).toList()).stream().collect(Collectors.toMap(AppointmentImpact::getContainerBookingId,Function.identity()));
return new PageResult<>(found.records().stream().map(c->new Row(c,states.containsKey(c.getContainerBookingId())?service.view(states.get(c.getContainerBookingId())):null)).toList(),page,size,found.total(),found.pages());
}
public Detail detail(String id,int page,int size,boolean canReadTrips) {
if(page<1 || size<1 || size>100) throw new ResponseStatusException(HttpStatus.BAD_REQUEST,"历史分页无效");
var state=service.detail(id);var cargo=relations.cargo(id);var appointments=relations.appointments(id);
var dispatches=canReadTrips?relations.dispatches(id):List.<AppointmentImpactTransportGateway.Dispatch>of();
if(cargo.size()>1000 || appointments.size()>1000 || dispatches.size()>1000) throw new ResponseStatusException(HttpStatus.CONFLICT,"受影响范围超过读取上限,请逐批核对");
var links=canReadTrips?transport.related(dispatches):null;
long total=mapper.historyCount(id);
var history=mapper.historyPage(id,size,(long)(page-1)*size).stream().map(h->new History(h.getVersion(),h.getAction(),h.getOperatorName(),h.getResult(),h.getNextAction(),h.getFollowupDate(),h.getCreatedAt())).toList();
return new Detail(state,cargo,appointments,links,new PageResult<>(history,page,size,total,(total+size-1)/size));
}
}
@@ -0,0 +1,29 @@
package com.baiyue.lastleg.appointmentplanning;
import org.apache.ibatis.annotations.*;
import java.time.LocalDateTime;
import java.util.List;
@Mapper
public interface AppointmentImpactRelationMapper {
record Cargo(String customerId,Long orderId,String inboundCode,String customerName,Integer packages,String destination) { }
record Appointment(String appointmentNo,String status,String destination,LocalDateTime confirmedAt,String timezone) { }
@Select("SELECT customer_id,id AS order_id,inbound_code,customer_name,package_count AS packages,fba_warehouse_code AS destination FROM ll_order WHERE source_container_booking_id=#{id} AND order_type='FIRST_LEG' AND current_status NOT IN ('CANCELLED','COMPLETED') ORDER BY id LIMIT 1001")
List<Cargo> cargo(String id);
@Select("""
SELECT DISTINCT a.appointment_no,a.appointment_status AS status,a.fba_warehouse_code AS destination,a.appointment_at AS confirmed_at,a.timezone
FROM ll_order o JOIN ll_inbound_fba_appointment_item i ON i.order_id=o.id AND i.customer_id=o.customer_id AND i.active=1
JOIN ll_inbound_fba_appointment a ON a.id=i.appointment_id
WHERE o.source_container_booking_id=#{id} AND o.order_type='FIRST_LEG' AND o.current_status NOT IN ('CANCELLED','COMPLETED')
AND a.appointment_status NOT IN ('CANCELLED','FAILED') ORDER BY a.appointment_no LIMIT 1001
""")
List<Appointment> appointments(String id);
@Select("""
SELECT DISTINCT d.customer_id,d.dispatch_no FROM ll_order o
JOIN ll_dispatch_item i ON i.order_id=o.id AND i.customer_id=o.customer_id
JOIN ll_dispatch_order d ON d.id=i.dispatch_order_id AND d.customer_id=i.customer_id
WHERE o.source_container_booking_id=#{id} AND o.order_type='FIRST_LEG' AND o.current_status NOT IN ('CANCELLED','COMPLETED')
AND d.status NOT IN ('CANCELLED','COMPLETED') ORDER BY d.dispatch_no LIMIT 1001
""")
List<AppointmentImpactTransportGateway.Dispatch> dispatches(String id);
}
@@ -0,0 +1,140 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.validation.constraints.*;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.server.ResponseStatusException;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.time.*;
import java.util.*;
@Service
public class AppointmentImpactService {
public record View(String containerBookingId,String impactNo,int version,String status,String reason,
String ownerId,String ownerName,AppointmentForecastClient.Fact baseline,AppointmentForecastClient.Fact latest,
String forecastToken,LocalDateTime updatedAt) { }
public record Command(@Min(0) int expectedVersion,@NotBlank String forecastToken,
@NotBlank @Size(max=64) String idempotencyKey,@NotBlank String action,
@Size(max=1000) String result,@Size(max=500) String nextAction,LocalDate followupDate) { }
private final AppointmentImpactMapper mapper;
private final AppointmentForecastClient forecasts;
private final AppointmentContainerService containers;
private final ObjectMapper json;
private final String token;
public AppointmentImpactService(AppointmentImpactMapper mapper,AppointmentForecastClient forecasts,
AppointmentContainerService containers,ObjectMapper json,@Value("${baiyue.security.internal-service-token:}") String token) {
this.mapper=mapper;this.forecasts=forecasts;this.containers=containers;this.json=json;this.token=token;
}
public View detail(String id) {
validId(id);var row=mapper.selectById(id);
if(row==null) throw new ResponseStatusException(HttpStatus.NOT_FOUND,"尚未建立该柜船期核对记录");
return view(row);
}
@Transactional
public View refresh(String id,String operatorId,String operatorName) {
validId(id);requireScope(id);
var row=mapper.lock(id);
// Serialize observation reads for an existing item, including an explicit missing forecast.
return observe(id,row,fetch(id),operatorId,operatorName);
}
@Transactional
public List<View> refreshPage(int page,int size,String keyword,String operatorId,String operatorName) {
var active=containers.page(page,size,keyword).records();
if(active.stream().anyMatch(AppointmentContainer::isIncompleteScope)) throw conflict("本页存在接仓范围不完整的柜次,请先逐柜核对");
if(active.isEmpty()) return List.of();
var ids=active.stream().map(AppointmentContainer::getContainerBookingId).sorted().toList();
var locked=new HashMap<String,AppointmentImpact>();
for(var id:ids) {validId(id);locked.put(id,mapper.lock(id));}
var latest=fetchBatch(ids);
return ids.stream().map(id->observe(id,locked.get(id),latest.get(id),operatorId,operatorName)).toList();
}
private View observe(String id,AppointmentImpact row,AppointmentForecastClient.Forecast forecast,String operatorId,String operatorName) {
String latest=write(forecast.latest());String fingerprint=digest(latest);
if(row!=null && fingerprint.equals(row.getForecastToken())) return view(row);
if(row!=null && older(forecast.latest(),read(row.getLatestJson(),AppointmentForecastClient.Fact.class))) return view(row);
boolean first=row==null;
if(first) {
row=new AppointmentImpact();row.setContainerBookingId(id);row.setImpactNo("AI-"+UUID.randomUUID().toString().replace("-","").substring(0,20).toUpperCase(Locale.ROOT));
row.setBaselineJson(write(forecast.previous()==null?forecast.latest():forecast.previous()));
row.setStatus("MONITORING");
}
var decision=AppointmentImpactPolicy.compare(read(row.getBaselineJson(),AppointmentForecastClient.Fact.class),forecast.latest());
row.setLatestJson(latest);row.setForecastToken(fingerprint);
if(decision.reviewRequired()) {row.setStatus("OPEN");row.setReason(decision.reason());}
else if(!"OPEN".equals(row.getStatus())) row.setReason(decision.reason());
row.setVersion(row.getVersion()+1);row.setUpdatedAt(now());
if(first) {
try {mapper.insert(row);} catch(org.springframework.dao.DuplicateKeyException conflict) {
throw new ResponseStatusException(HttpStatus.CONFLICT,"该柜核对记录已建立,请刷新",conflict);
}
} else mapper.save(row);
append(row,"OBSERVED",operatorId,operatorName,null,null,null,null,null);
return view(row);
}
@Transactional
public View handle(String id,String operatorId,String operatorName,Command request) {
validId(id);
if(request==null || request.idempotencyKey()==null || request.idempotencyKey().isBlank()
|| !Set.of("CLAIM","RECORD","RESOLVE").contains(Objects.toString(request.action(),""))) throw bad("请选择有效处理动作和请求编号");
if(!"CLAIM".equals(request.action()) && (request.result()==null || request.result().isBlank())) throw bad("请填写实际处理结果");
String hash=digest(write(request));
var row=mapper.lock(id);
if(row==null) throw new ResponseStatusException(HttpStatus.NOT_FOUND,"尚未建立该柜船期核对记录");
var replay=mapper.command(id,operatorId,request.idempotencyKey());
if(replay!=null) {
if(!hash.equals(replay.getRequestHash())) throw conflict("同一请求编号的内容不一致");
return read(replay.getResponseJson(),View.class);
}
if(row.getVersion()!=request.expectedVersion() || !Objects.equals(row.getForecastToken(),request.forecastToken())) throw conflict("事项已更新,请刷新后处理");
requireScope(id);
if(!row.getForecastToken().equals(digest(write(fetch(id).latest())))) throw conflict("船期来源已有新观察,请先刷新并核对影响");
if(!"OPEN".equals(row.getStatus())) throw conflict("当前事项不需要处理");
if(row.getOwnerId()!=null && !operatorId.equals(row.getOwnerId())) throw conflict("事项已由其他人员认领");
row.setOwnerId(operatorId);row.setOwnerName(operatorName);
if("RESOLVE".equals(request.action())) {row.setStatus("RESOLVED");row.setBaselineJson(row.getLatestJson());}
row.setVersion(row.getVersion()+1);row.setUpdatedAt(now());mapper.save(row);
append(row,request.action(),operatorId,operatorName,request.result(),request.nextAction(),request.followupDate(),request.idempotencyKey(),hash);
return view(row);
}
private void requireScope(String id) {
if(!containers.context(id,null).canFollowup()) throw conflict("柜次范围不完整,请先核对接仓点");
}
private AppointmentForecastClient.Forecast fetch(String id) {return fetchBatch(List.of(id)).get(id);}
private Map<String,AppointmentForecastClient.Forecast> fetchBatch(List<String> ids) {
try {
var response=forecasts.batch(token,new AppointmentForecastClient.Request(ids.stream().map(Long::valueOf).toList()));
if(response==null || !response.successful() || response.data()==null || response.data().size()!=ids.size()) throw new IllegalStateException();
var result=new HashMap<String,AppointmentForecastClient.Forecast>();
for(var row:response.data()) {
if(row==null || row.containerBookingId()==null || !ids.contains(row.containerBookingId().toString()) || !"SOURCE_LOCAL_UNSPECIFIED".equals(row.timeBasis())) throw new IllegalStateException();
for(var fact:Arrays.asList(row.latest(),row.previous())) if(fact!=null && (!Objects.equals(fact.containerBookingId(),row.containerBookingId()) || fact.factId()==null)) throw new IllegalStateException();
if(result.put(row.containerBookingId().toString(),row)!=null) throw new IllegalStateException();
}
return result;
} catch(RuntimeException error) {throw new ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE,"船期来源暂不可用,保留原核对记录",error);}
}
private void append(AppointmentImpact row,String action,String operatorId,String operatorName,String result,String next,LocalDate date,String key,String hash) {
var history=new AppointmentImpactHistory();history.setId(IdWorker.getId());history.setContainerBookingId(row.getContainerBookingId());history.setVersion(row.getVersion());
history.setAction(action);history.setOperatorId(operatorId);history.setOperatorName(operatorName);history.setResult(result);history.setNextAction(next);history.setFollowupDate(date);
history.setCommandKey(key);history.setRequestHash(hash);history.setResponseJson(write(view(row)));history.setCreatedAt(row.getUpdatedAt());mapper.history(history);
}
View view(AppointmentImpact row) {return new View(row.getContainerBookingId(),row.getImpactNo(),row.getVersion(),row.getStatus(),row.getReason(),row.getOwnerId(),row.getOwnerName(),read(row.getBaselineJson(),AppointmentForecastClient.Fact.class),read(row.getLatestJson(),AppointmentForecastClient.Fact.class),row.getForecastToken(),row.getUpdatedAt());}
private String write(Object value){try{return json.writeValueAsString(value);}catch(Exception error){throw new IllegalStateException("船期记录序列化失败",error);}}
private <T> T read(String value,Class<T> type){try{return value==null?null:json.readValue(value,type);}catch(Exception error){throw new IllegalStateException("船期记录读取失败",error);}}
private static String digest(String value){try{return HexFormat.of().formatHex(MessageDigest.getInstance("SHA-256").digest(value.getBytes(StandardCharsets.UTF_8)));}catch(Exception error){throw new IllegalStateException(error);}}
private static LocalDateTime now(){return LocalDateTime.now(ZoneOffset.UTC).truncatedTo(java.time.temporal.ChronoUnit.MILLIS);}
private static boolean older(AppointmentForecastClient.Fact incoming,AppointmentForecastClient.Fact saved) {
if(incoming==null || saved==null) return false;
var order=Comparator.comparing(AppointmentForecastClient.Fact::observedAt,Comparator.nullsFirst(Comparator.naturalOrder()))
.thenComparing(AppointmentForecastClient.Fact::factId);
return order.compare(incoming,saved)<0;
}
private static void validId(String id){try{if(id==null || Long.parseLong(id)<=0)throw new IllegalArgumentException();}catch(RuntimeException error){throw bad("柜次标识无效");}}
private static ResponseStatusException bad(String message){return new ResponseStatusException(HttpStatus.BAD_REQUEST,message);}
private static ResponseStatusException conflict(String message){return new ResponseStatusException(HttpStatus.CONFLICT,message);}
}
@@ -0,0 +1,13 @@
package com.baiyue.lastleg.appointmentplanning;
import java.time.LocalDateTime;
import java.util.List;
/** Fleet owns trip/booking relationships; appointment planning only asks for affected commitments. */
public interface AppointmentImpactTransportGateway {
record Dispatch(String customerId,String dispatchNo) { }
record Trip(String tripNo,String status,LocalDateTime plannedDepartureAt) { }
record Booking(String tripNo,String bookingNo,String customerName,String destinationLabel,String status) { }
record Links(List<Trip> trips,List<Booking> sameTripBookings) { }
Links related(List<Dispatch> dispatches);
}
@@ -0,0 +1,70 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.ApiResponse;
import com.baiyue.common.core.api.PageResult;
import com.baiyue.common.security.AuthenticatedUser;
import org.springframework.http.HttpStatus;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import jakarta.validation.Valid;
import org.springframework.web.server.ResponseStatusException;
@RestController
@RequestMapping("/api/platform/v1/last-leg/appointment-planning")
public class AppointmentPlanningController {
private final AppointmentCargoService service;
private final AppointmentFollowupService followups;
private final AppointmentSourceService sources;
private final AppointmentCoverageService coverage;
public AppointmentPlanningController(AppointmentCargoService service, AppointmentFollowupService followups,
AppointmentSourceService sources, AppointmentCoverageService coverage) {
this.service = service; this.followups = followups; this.sources = sources; this.coverage = coverage;
}
public record Resolved(AppointmentSourceService.Source source, AppointmentCoverageService.Coverage coverage) { }
@GetMapping("/sources/resolve")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<Resolved> resolve(@AuthenticationPrincipal AuthenticatedUser user,
@RequestParam String sourceKey, @RequestParam String customerId, @RequestParam(required=false) String destinationKey) {
requirePlatform(user);
var source = sources.resolve(sourceKey,customerId,destinationKey);
var result = coverage.query(java.util.List.of(new AppointmentCoverageService.SourceRef(source.customerId(),source.sourceKey(),source.destinationKey())));
return ApiResponse.success(new Resolved(source,result.get(0)));
}
@GetMapping("/cargo")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<PageResult<AppointmentCargo>> cargo(@AuthenticationPrincipal AuthenticatedUser user,
@RequestParam(defaultValue = "1") int page, @RequestParam(defaultValue = "20") int size,
@RequestParam(required = false) String warehouseId, @RequestParam(required = false) String destination,
@RequestParam(required = false) String keyword) {
requirePlatform(user);
return ApiResponse.success(service.page(page, size, warehouseId, destination, keyword));
}
@GetMapping("/sources/{sourceKey}/follow-ups")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list')")
public ApiResponse<AppointmentFollowupService.History> history(@AuthenticationPrincipal AuthenticatedUser user,
@PathVariable String sourceKey, @RequestParam String customerId, @RequestParam(defaultValue="1") int page, @RequestParam(defaultValue="20") int size) {
requirePlatform(user); return ApiResponse.success(followups.history(sourceKey,customerId,page,size));
}
@PostMapping("/sources/{sourceKey}/follow-ups")
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list') and hasAuthority('platform:appointment:followup')")
public ApiResponse<AppointmentFollowupService.Record> followup(@AuthenticationPrincipal AuthenticatedUser user,
@PathVariable String sourceKey, @RequestParam String customerId, @Valid @RequestBody AppointmentFollowupService.Save request) {
requirePlatform(user);
return ApiResponse.success(followups.save(sourceKey,customerId,request,user.userId().toString(),user.displayName()==null ? user.username() : user.displayName()));
}
static void requirePlatform(AuthenticatedUser user) {
if (user == null || user.userId()==null) throw new ResponseStatusException(HttpStatus.UNAUTHORIZED);
if (!"PLATFORM".equals(user.appCode()) || !Long.valueOf(0).equals(user.tenantId())) throw new ResponseStatusException(HttpStatus.FORBIDDEN);
}
}
@@ -0,0 +1,84 @@
package com.baiyue.lastleg.appointmentplanning;
import java.time.Instant;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
/** Stage-specific planning rules. Planning never creates stock, vehicles or carrier confirmations. */
public final class AppointmentPlanningPolicy {
private AppointmentPlanningPolicy() { }
public record Cargo(String sourceKey, String customerId, String originWarehouseId,
String destinationKey, String originCountry, String destinationCountry,
Integer packages, Instant readyFrom, Instant readyTo,
boolean eligibleForPlanning, String blockReason) { }
public record Group(String originWarehouseId, String destinationKey, Long packages,
int sourceCount, int customerCount, Instant readyFrom, Instant readyTo,
boolean readinessIncomplete, int unknownQuantitySources) { }
public record Forecast(String sourceKey, String sourceVersion, Instant eta, Instant readyAt) { }
public record Impact(String sourceKey, String reason, Instant previousEta, Instant latestEta,
Instant confirmedAt, boolean reviewRequired) { }
public static Group group(List<Cargo> cargo) {
if (cargo == null || cargo.isEmpty()) throw new IllegalArgumentException("请选择需要安排的真实货物");
if (cargo.size() > 500) throw new IllegalArgumentException("每批最多选择500条来源货物");
Set<String> sources = new HashSet<>();
Set<String> customers = new HashSet<>();
String origin = null, destination = null;
long packages = 0;
int unknownQuantitySources = 0;
Instant from = null, to = null;
boolean incomplete = false;
for (Cargo row : cargo) {
if (row == null || blank(row.sourceKey()) || blank(row.customerId())) {
throw new IllegalArgumentException("货物缺少稳定来源或客户归属");
}
if (!sources.add(row.sourceKey())) throw new IllegalArgumentException("同一来源货物不能重复选择");
if (!row.eligibleForPlanning()) throw new IllegalArgumentException(
blank(row.blockReason()) ? "所选货物暂不具备筹划资格" : row.blockReason());
if (!"US".equals(row.originCountry()) || !"US".equals(row.destinationCountry())) {
throw new IllegalArgumentException("请选择已确认美国起运点及目的地的货物");
}
if (blank(row.originWarehouseId()) || blank(row.destinationKey())) {
throw new IllegalArgumentException("货物缺少实际接仓点或目的地");
}
if (origin == null) { origin = row.originWarehouseId(); destination = row.destinationKey(); }
if (!origin.equals(row.originWarehouseId()) || !destination.equals(row.destinationKey())) {
throw new IllegalArgumentException("同批货物必须具有相同实际起运仓和目的地");
}
if (row.packages() == null || row.packages() <= 0) unknownQuantitySources++;
else packages = Math.addExact(packages, row.packages().longValue());
customers.add(row.customerId());
if (row.readyFrom() == null || row.readyTo() == null) incomplete = true;
if (row.readyFrom() != null && row.readyTo() != null && row.readyTo().isBefore(row.readyFrom())) {
throw new IllegalArgumentException("货物预计备妥窗口无效");
}
if (row.readyFrom() != null && (from == null || row.readyFrom().isAfter(from))) from = row.readyFrom();
if (row.readyTo() != null && (to == null || row.readyTo().isBefore(to))) to = row.readyTo();
}
if (from != null && to != null && to.isBefore(from)) throw new IllegalArgumentException("所选货物预计备妥窗口不相容,请分别安排");
return new Group(origin, destination, unknownQuantitySources==0?packages:null, sources.size(), customers.size(), from, to, incomplete, unknownQuantitySources);
}
/** A new forecast only requests review; it never changes an externally confirmed appointment. */
public static Impact compare(Forecast acknowledged, Forecast latest, Instant confirmedAt) {
if (acknowledged == null || latest == null || blank(latest.sourceKey())
|| !Objects.equals(acknowledged.sourceKey(), latest.sourceKey())) {
throw new IllegalArgumentException("只能比较同一真实货源的预测");
}
boolean changed = !Objects.equals(acknowledged.eta(), latest.eta())
|| !Objects.equals(acknowledged.readyAt(), latest.readyAt());
String reason = "UNCHANGED";
if (changed) {
reason = latest.eta() == null ? "FORECAST_MISSING" : "FORECAST_CHANGED";
if (confirmedAt != null && latest.readyAt() != null && latest.readyAt().isAfter(confirmedAt)) {
reason = "READINESS_AFTER_APPOINTMENT";
}
}
return new Impact(latest.sourceKey(), reason, acknowledged.eta(), latest.eta(), confirmedAt, changed);
}
private static boolean blank(String value) { return value == null || value.isBlank(); }
}
@@ -0,0 +1,31 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.ApiResponse;
import com.baiyue.common.core.api.PageResult;
import com.baiyue.common.security.AuthenticatedUser;
import com.baiyue.lastleg.inboundplan.dto.*;
import com.baiyue.lastleg.inboundplan.service.InboundFbaAppointmentService;
import com.baiyue.lastleg.security.OverseasPermissions;
import jakarta.validation.Valid;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.annotation.AuthenticationPrincipal;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/api/platform/v1/last-leg/appointment-planning/appointments")
public class AppointmentSourceCreateController {
private final InboundFbaAppointmentService service;
public AppointmentSourceCreateController(InboundFbaAppointmentService service){this.service=service;}
@PostMapping
@PreAuthorize("hasAuthority('platform:appointment:list') and hasAuthority('platform:overseas-warehouse:last-mile-order:list') and hasAuthority('"+OverseasPermissions.INBOUND_ORDER_FBA_APPOINTMENT+"')")
public ApiResponse<FbaAppointmentResponse> create(@AuthenticationPrincipal AuthenticatedUser user,@Valid @RequestBody SourceFbaAppointmentRequest request) {
AppointmentPlanningController.requirePlatform(user);
return ApiResponse.success(service.createFromSources(String.valueOf(user.userId()),request));
}
@GetMapping("/unscheduled")
@PreAuthorize("hasAuthority('platform:appointment:list')")
public ApiResponse<PageResult<FbaAppointmentResponse>> unscheduled(@AuthenticationPrincipal AuthenticatedUser user,@RequestParam(defaultValue="1") int page,@RequestParam(defaultValue="20") int size) {
AppointmentPlanningController.requirePlatform(user);
return ApiResponse.success(service.unscheduled(page,size));
}
}
@@ -0,0 +1,42 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baiyue.lastleg.inboundplan.entity.InboundFbaAppointmentItem;
import com.baiyue.lastleg.inboundplan.mapper.InboundFbaAppointmentItemMapper;
import com.baiyue.lastleg.mapper.LastlegOrderMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.http.HttpStatus;
import java.util.List;
import java.util.Objects;
/** Called by actual incoming materialization, never as a migration or historical data repair. */
@Service
public class AppointmentSourceLinker {
private final LastlegOrderMapper orders;
private final InboundFbaAppointmentItemMapper items;
private final AppointmentExternalSourceGateway bookings;
public AppointmentSourceLinker(LastlegOrderMapper orders,InboundFbaAppointmentItemMapper items,AppointmentExternalSourceGateway bookings) {this.orders=orders;this.items=items;this.bookings=bookings;}
@Transactional(propagation=Propagation.MANDATORY)
public void materialized(String customerId,String bookingNo,Long orderId) {
var ref=new AppointmentExternalSourceGateway.SourceRef(customerId,bookingNo);
bookings.lockForAppointment(List.of(ref));
var matched=bookings.resolve(List.of(ref));
if(matched.size()!=1 || !Objects.equals(matched.get(0).customerId(),customerId) || !Objects.equals(matched.get(0).bookingNo(),bookingNo) || !Objects.equals(matched.get(0).orderId(),orderId)) throw conflict("来货与原登记的归属不一致,请核对");
var order=orderId==null?null:orders.selectById(orderId);
if(order==null || !Objects.equals(order.getCustomerId(),customerId)) throw conflict("来货尚未形成对应客户的真实货物");
var rows=items.selectList(new LambdaQueryWrapper<InboundFbaAppointmentItem>().eq(InboundFbaAppointmentItem::getSourceKey,"BOOKING:"+bookingNo)
.eq(InboundFbaAppointmentItem::getCustomerId,customerId).eq(InboundFbaAppointmentItem::getActive,true).last("FOR UPDATE"));
for(var row:rows) {
if(row.getOrderId()!=null && !row.getOrderId().equals(orderId)) throw conflict("原预约已关联其他来货,不能自动改绑");
if(Objects.equals(row.getOrderId(),orderId) && Objects.equals(row.getInboundCode(),order.getInboundCode())) continue;
try {items.update(null,new LambdaUpdateWrapper<InboundFbaAppointmentItem>().eq(InboundFbaAppointmentItem::getId,row.getId()).eq(InboundFbaAppointmentItem::getActive,true)
.set(InboundFbaAppointmentItem::getOrderId,orderId).set(InboundFbaAppointmentItem::getInboundCode,order.getInboundCode()));}
catch(org.springframework.dao.DuplicateKeyException duplicate){throw conflict("该来货已有其他有效预约,请先核对原安排");}
}
}
private static ResponseStatusException conflict(String message){return new ResponseStatusException(HttpStatus.CONFLICT,message);}
}
@@ -0,0 +1,160 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.lastleg.mapper.LastlegOrderMapper;
import com.baiyue.lastleg.shipping.mapper.ContainerShippingGateMapper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service;
import org.springframework.web.server.ResponseStatusException;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.Map;
import java.util.LinkedHashSet;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class AppointmentSourceService {
public record Source(String sourceKey, String customerId, Long orderId, String inboundCode, String bookingNo,
String containerNo, String originWarehouseId, String originWarehouseName,
String destinationKey, String destinationWarehouseCode, Integer packages,
String sourceVersion, boolean canFollowup, List<String> blockReasons) { }
private final LastlegOrderMapper orders;
private final ContainerShippingGateMapper shipping;
private final AppointmentExternalSourceGateway external;
private final AppointmentWarehouseClient warehouses;
private final String token;
@jakarta.annotation.Resource private AppointmentCoverageMapper destinationFacts;
public AppointmentSourceService(LastlegOrderMapper orders, ContainerShippingGateMapper shipping,
AppointmentExternalSourceGateway external, AppointmentWarehouseClient warehouses,
@Value("${baiyue.security.internal-service-token:}") String token) {
this.orders=orders; this.shipping=shipping; this.external=external; this.warehouses=warehouses; this.token=token;
}
public Source resolve(String sourceKey,String customerId,String destinationKey) {
return resolveBatch(List.of(new AppointmentCoverageService.SourceRef(customerId,sourceKey,destinationKey))).get(0);
}
public void lockForWrite(List<AppointmentCoverageService.SourceRef> refs) {
if(refs==null || refs.isEmpty() || refs.size()>100 || refs.stream().anyMatch(Objects::isNull)) throw bad("每批请选择1至100票真实货源");
var bookings=refs.stream().filter(ref->ref.sourceKey()!=null && ref.sourceKey().startsWith("BOOKING:"))
.map(ref->new AppointmentExternalSourceGateway.SourceRef(ref.customerId(),ref.sourceKey().substring(8))).toList();
if(!bookings.isEmpty()) external.lockForAppointment(bookings);
}
public List<AppointmentCoverageService.SourceRef> canonicalOrders(List<AppointmentExternalSourceGateway.OrderRef> refs) {
if(refs==null || refs.isEmpty() || refs.size()>100) throw bad("每批请选择1至100票真实货源");
var bookings=external.resolveOrders(refs);
var byOrder=bookings.stream().collect(Collectors.toMap(s->new AppointmentExternalSourceGateway.OrderRef(s.customerId(),s.orderId()),Function.identity()));
return refs.stream().distinct().map(ref->{
var booking=byOrder.get(ref);
return new AppointmentCoverageService.SourceRef(ref.customerId(),booking==null?"ORDER:"+ref.orderId():"BOOKING:"+booking.bookingNo(),null);
}).toList();
}
public String destinationTimezone(String code) {
var destination=catalog().stream().filter(w->"US".equals(w.countryCode()) && "FBA".equals(w.warehouseType()) && code.equals(w.warehouseCode())).findFirst().orElseThrow(()->bad("目的仓不在美国FBA目录中"));
try {
var response=warehouses.activeDetail(token,destination.id());
if(response==null || !response.successful() || response.data()==null || response.data().warehouse()==null
|| !Objects.equals(response.data().warehouse().id(),destination.id()) || !Long.valueOf(0).equals(response.data().warehouse().tenantId())) throw new IllegalStateException();
return response.data().warehouse().timezone();
} catch(RuntimeException error) { throw new ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE,"目的仓时区读取失败,请稍后核对",error); }
}
/** One catalog request and batched source reads, including mixed first-leg and external bookings. */
public List<Source> resolveBatch(List<AppointmentCoverageService.SourceRef> requested) {
if(requested==null || requested.isEmpty() || requested.size()>100) throw bad("每批请选择1至100票真实货源");
var keys=new LinkedHashSet<String>(); var orderIds=new LinkedHashSet<Long>();
var bookingRefs=new java.util.ArrayList<AppointmentExternalSourceGateway.SourceRef>();
for(var ref:requested) {
if(ref==null || blank(ref.sourceKey()) || ref.sourceKey().length()>160 || blank(ref.customerId()) || ref.customerId().length()>128) throw bad("请选择完整的真实货源");
if(!keys.add(ref.sourceKey())) throw bad("同一来源货物不能重复选择");
if(ref.sourceKey().startsWith("ORDER:")) orderIds.add(orderId(ref.sourceKey()));
else if(ref.sourceKey().startsWith("BOOKING:") && !blank(ref.sourceKey().substring(8))) bookingRefs.add(new AppointmentExternalSourceGateway.SourceRef(ref.customerId(),ref.sourceKey().substring(8)));
else throw bad("不支持的货源类型");
}
var bookings=bookingRefs.isEmpty()?List.<AppointmentExternalSourceGateway.Source>of():external.resolve(bookingRefs);
var bookingMap=new java.util.HashMap<String,AppointmentExternalSourceGateway.Source>();
for(var booking:bookings) {
if(bookingMap.put(booking.customerId()+"\n"+booking.bookingNo(),booking)!=null) throw bad("外接来源重复,请先核对");
if(booking.orderId()!=null) orderIds.add(booking.orderId());
}
var orderRows=orderIds.isEmpty()?List.<com.baiyue.lastleg.entity.LastlegOrder>of():orders.selectBatchIds(orderIds);
var directOrders=requested.stream().filter(ref->ref.sourceKey().startsWith("ORDER:")).map(ref->new AppointmentExternalSourceGateway.OrderRef(ref.customerId(),orderId(ref.sourceKey()))).toList();
if(!directOrders.isEmpty() && !external.resolveOrders(directOrders).isEmpty()) throw bad("该货物来自外接登记,请使用原登记来源继续预约");
var orderMap=orderRows.stream().collect(Collectors.toMap(com.baiyue.lastleg.entity.LastlegOrder::getId,Function.identity()));
var transferRefs=orderRows.stream().filter(o->"WAREHOUSE_TRANSFER".equals(o.getOrderType())).map(o->new AppointmentCoverageMapper.OrderRef(o.getCustomerId(),o.getId())).toList();
var destinations=transferRefs.isEmpty()?Map.<Long,AppointmentCoverageMapper.Source>of():destinationFacts.sources(transferRefs).stream().collect(Collectors.toMap(AppointmentCoverageMapper.Source::orderId,Function.identity()));
var containerIds=orderRows.stream().filter(o->"FIRST_LEG".equals(o.getOrderType())).map(com.baiyue.lastleg.entity.LastlegOrder::getSourceContainerBookingId).filter(Objects::nonNull).distinct().toList();
var gates=containerIds.isEmpty()?Map.<String,Boolean>of():shipping.selectBatchIds(containerIds).stream().collect(Collectors.toMap(g->g.getContainerBookingId(),g->g.getNodeSequence()!=null && g.getNodeSequence()>=40));
var catalog=catalog();
var result=requested.stream().map(ref->resolve(ref.sourceKey(),ref.customerId(),ref.destinationKey(),orderMap,bookingMap,gates,catalog,destinations)).toList();
var materialized=new java.util.HashSet<Long>();
for(var source:result) if(source.orderId()!=null && !materialized.add(source.orderId())) throw bad("同一货物存在重复来源,请保留原登记来源");
return result;
}
private Source resolve(String sourceKey,String customerId,String destinationKey,
Map<Long,com.baiyue.lastleg.entity.LastlegOrder> orderMap,
Map<String,AppointmentExternalSourceGateway.Source> bookingMap,Map<String,Boolean> gates,
List<AppointmentWarehouseClient.Warehouse> catalog,Map<Long,AppointmentCoverageMapper.Source> destinations) {
com.baiyue.lastleg.entity.LastlegOrder order=null;
String bookingNo=null,origin,destination,version;
Integer packages;
boolean followup=true;
List<String> reasons=List.of();
if (sourceKey.startsWith("ORDER:")) {
order=orderMap.get(orderId(sourceKey));
if (order==null || !customerId.equals(order.getCustomerId())) throw missing();
if (!Set.of("FIRST_LEG","WAREHOUSE_TRANSFER").contains(Objects.toString(order.getOrderType(),""))) throw bad("当前货源类型不支持FBA预约");
if ("FIRST_LEG".equals(order.getOrderType()) && (order.getSourceContainerBookingId()==null || !Boolean.TRUE.equals(gates.get(order.getSourceContainerBookingId())))) throw bad("货物尚无已开船或后续实际船节点");
origin=order.getOverseasWarehouseId(); destination="FBA:"+destinationCode(order,destinations);
if (!"FBA".equals(destinationType(order,destinations))) throw bad("当前货源不是FBA送仓货物");
packages=order.getPackageCount(); version=order.getVersion()==null ? null : "ORDER:"+order.getVersion();
} else if (sourceKey.startsWith("BOOKING:")) {
bookingNo=sourceKey.substring(8);
if (blank(bookingNo)) throw bad("外接登记号不能为空");
var source=bookingMap.get(customerId+"\n"+bookingNo);
if (source==null) throw missing();
if (!Objects.equals(source.customerId(),customerId) || !Objects.equals(source.bookingNo(),bookingNo)) throw missing();
origin=source.warehouseId(); destination=source.destinationKey(); packages=source.packageCount();
version=source.recordVersion()==null ? null : "BOOKING:"+source.recordVersion();
followup=Set.of("CONFIRMED","RECEIVED","BOUND").contains(source.bookingStatus()==null ? "" : source.bookingStatus());
if (!followup) reasons=List.of("当前登记尚未确认承运或已取消,仅可查看跟进记录");
if (source.orderId()!=null) {
order=orderMap.get(source.orderId());
if (order==null || !customerId.equals(order.getCustomerId())) throw missing();
if (!Objects.equals(order.getOverseasWarehouseId(),origin)) throw bad("来货的接仓点与原登记不一致,请先核对");
if (!"FBA".equals(destinationType(order,destinations)) || !Objects.equals(destination,"FBA:"+destinationCode(order,destinations))) throw bad("来货目的仓与原登记不一致,请先核对");
packages=order.getPackageCount();
version=version+"/ORDER:"+order.getVersion();
}
} else throw bad("不支持的货源类型");
if (order!=null && Set.of("CANCELLED","COMPLETED").contains(order.getCurrentStatus()==null ? "" : order.getCurrentStatus())) {
followup=false; reasons=List.of("该货物已取消或完成,仅可查看跟进记录");
}
if (!blank(destinationKey) && !Objects.equals(destination,destinationKey)) throw bad("目的地已变化,请返回原业务重新核对");
if (destination==null || !destination.startsWith("FBA:")) throw bad("当前仅支持FBA收货跟进来源");
final String originId=origin; final String code=destination.substring(4);
var warehouse=catalog.stream().filter(w -> w.id()!=null && w.id().toString().equals(originId) && "US".equals(w.countryCode())
&& Set.of("OVERSEAS","OVERSEAS_PARTNER").contains(w.warehouseType()==null ? "" : w.warehouseType())).findFirst().orElseThrow(() -> bad("接仓点不在启用的美国仓目录中"));
if (catalog.stream().noneMatch(w -> "FBA".equals(w.warehouseType()) && "US".equals(w.countryCode()) && code.equals(w.warehouseCode()))) throw bad("目的仓不在启用的美国FBA目录中");
return new Source(sourceKey,customerId,order==null ? null : order.getId(),order==null ? null : order.getInboundCode(),bookingNo,
order==null ? null : order.getContainerNo(),origin,warehouse.warehouseName(),destination,code,packages,version,followup,reasons);
}
private List<AppointmentWarehouseClient.Warehouse> catalog() {
try { var result=warehouses.catalog(token); if (result==null || !result.successful() || result.data()==null) throw new IllegalStateException(); return result.data().stream().filter(Objects::nonNull).toList(); }
catch (RuntimeException error) { throw new ResponseStatusException(HttpStatus.SERVICE_UNAVAILABLE,"仓库目录暂不可用,请稍后重新核对",error); }
}
private static boolean blank(String value) { return value==null || value.isBlank(); }
private static String destinationType(com.baiyue.lastleg.entity.LastlegOrder order,Map<Long,AppointmentCoverageMapper.Source> facts) {
if(!"WAREHOUSE_TRANSFER".equals(order.getOrderType())) return order.getDestinationType();
var fact=facts.get(order.getId());return fact==null?null:fact.destinationType();
}
private static String destinationCode(com.baiyue.lastleg.entity.LastlegOrder order,Map<Long,AppointmentCoverageMapper.Source> facts) {
if(!"WAREHOUSE_TRANSFER".equals(order.getOrderType())) return order.getFbaWarehouseCode();
var fact=facts.get(order.getId());return fact==null?null:fact.fbaWarehouseCode();
}
private static long orderId(String key) {
try { long id=Long.parseLong(key.substring(6)); if(id<=0 || !key.equals("ORDER:"+id)) throw new NumberFormatException(); return id; }
catch(NumberFormatException error) { throw bad("货源标识无效"); }
}
private static ResponseStatusException bad(String message) { return new ResponseStatusException(HttpStatus.BAD_REQUEST,message); }
private static ResponseStatusException missing() { return new ResponseStatusException(HttpStatus.NOT_FOUND,"未找到当前客户的货物来源"); }
}
@@ -0,0 +1,42 @@
package com.baiyue.lastleg.appointmentplanning;
import java.time.DateTimeException;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.List;
/** Resolves a location's appointment window without using the operator's system time zone. */
public final class AppointmentTimePolicy {
private AppointmentTimePolicy() { }
public record Window(Instant start, Instant end, String timezone) { }
public static Window resolve(LocalDateTime start, LocalDateTime end, String timezone,
ZoneOffset startOffset, ZoneOffset endOffset) {
if (start == null) throw new IllegalArgumentException("请填写预约开始时间");
if (timezone == null || timezone.isBlank()) throw new IllegalArgumentException("请先补齐预约地点时区");
final ZoneId zone;
try { zone = ZoneId.of(timezone); }
catch (DateTimeException error) { throw new IllegalArgumentException("预约地点时区无效", error); }
if (zone instanceof ZoneOffset || zone.getRules().isFixedOffset()) throw new IllegalArgumentException("预约地点需要地区时区,不能仅填写固定时差");
Instant first = instant(start, zone, startOffset);
Instant last = end == null ? null : instant(end, zone, endOffset);
if (end == null && endOffset != null) throw new IllegalArgumentException("未填写结束时间,不能指定结束时差");
if (last != null && !last.isAfter(first)) throw new IllegalArgumentException("预约结束时间必须晚于开始时间");
return new Window(first, last, zone.getId());
}
private static Instant instant(LocalDateTime value, ZoneId zone, ZoneOffset selected) {
List<ZoneOffset> offsets = zone.getRules().getValidOffsets(value);
if (offsets.isEmpty()) throw new IllegalArgumentException("该当地时间因夏令时切换不存在,请重新选择");
if (selected == null && offsets.size() > 1) {
throw new IllegalArgumentException("该当地时间在夏令时切换期间出现两次,请明确时差");
}
if (selected != null && !offsets.contains(selected)) {
throw new IllegalArgumentException("所选时差与预约地点及日期不符");
}
return value.toInstant(selected == null ? offsets.get(0) : selected);
}
}
@@ -0,0 +1,19 @@
package com.baiyue.lastleg.appointmentplanning;
import com.baiyue.common.core.api.ApiResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.PathVariable;
import java.util.List;
@FeignClient(name = "warehouse-service", contextId = "appointmentWarehouseClient", url = "${baiyue.clients.domestic-warehouse.url:}")
public interface AppointmentWarehouseClient {
@GetMapping("/internal/warehouses/order-catalog")
ApiResponse<List<Warehouse>> catalog(@RequestHeader("X-Internal-Service-Token") String token);
record Warehouse(Long id, String warehouseCode, String warehouseName, String warehouseType, String countryCode) { }
@GetMapping("/internal/warehouses/0/{warehouseId}/active")
ApiResponse<Detail> activeDetail(@RequestHeader("X-Internal-Service-Token") String token,@PathVariable("warehouseId") long warehouseId);
record Identity(Long id,Long tenantId,String warehouseType,String status,String timezone) { }
record Detail(Identity warehouse) { }
}
@@ -12,6 +12,15 @@ import java.util.List;
@FeignClient(name = "warehouse-service", contextId = "domesticWarehouseDirectoryClient", @FeignClient(name = "warehouse-service", contextId = "domesticWarehouseDirectoryClient",
url = "${baiyue.clients.domestic-warehouse.url:}") url = "${baiyue.clients.domestic-warehouse.url:}")
public interface DomesticWarehouseDirectoryClient { public interface DomesticWarehouseDirectoryClient {
@GetMapping("/internal/warehouses/shared-overseas")
ApiResponse<List<ReceivingWarehouse>> receivingWarehouses(@RequestHeader("X-Internal-Service-Token") String internalToken);
@GetMapping("/internal/warehouses/shared-overseas/{warehouseId}")
ApiResponse<ReceivingWarehouse> receivingWarehouse(@PathVariable("warehouseId") long warehouseId,
@RequestHeader("X-Internal-Service-Token") String internalToken);
record ReceivingWarehouse(Long warehouseId, String warehouseCode, String warehouseName, String countryCode, String status) { }
@GetMapping("/internal/warehouses/0/{warehouseId}/active") @GetMapping("/internal/warehouses/0/{warehouseId}/active")
ApiResponse<Detail> activeWarehouse( ApiResponse<Detail> activeWarehouse(
@PathVariable("warehouseId") long warehouseId, @PathVariable("warehouseId") long warehouseId,
@@ -20,7 +29,7 @@ public interface DomesticWarehouseDirectoryClient {
record Detail(Warehouse warehouse, List<Address> addresses) { } record Detail(Warehouse warehouse, List<Address> addresses) { }
record Warehouse(Long id, Long tenantId, String warehouseCode, String warehouseName, record Warehouse(Long id, Long tenantId, String warehouseCode, String warehouseName,
String warehouseType, String countryCode, String status) { } String warehouseType, String countryCode, String status, String contactName, String contactPhone) { }
record Address(String addressType, String countryCode, String stateProvince, String city, record Address(String addressType, String countryCode, String stateProvince, String city,
String district, String postalCode, String addressLine1, String addressLine2) { } String district, String postalCode, String addressLine1, String addressLine2) { }
@@ -0,0 +1,25 @@
package com.baiyue.lastleg.controller;
import com.baiyue.common.core.api.ApiResponse;
import com.baiyue.lastleg.dto.CustomerOrderProgress;
import com.baiyue.lastleg.security.InternalServiceTokenGuard;
import com.baiyue.lastleg.service.CustomerOrderProgressService;
import jakarta.validation.Valid;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/internal/lastleg/v1/customer-order-progress")
public class InternalCustomerOrderProgressController {
private final InternalServiceTokenGuard guard;
private final CustomerOrderProgressService service;
public InternalCustomerOrderProgressController(InternalServiceTokenGuard guard, CustomerOrderProgressService service) {
this.guard = guard; this.service = service;
}
@PostMapping
public ApiResponse<CustomerOrderProgress.Response> read(
@RequestHeader(value="X-Internal-Service-Token", required=false) String token,
@Valid @RequestBody CustomerOrderProgress.Request request) {
guard.verify(token);
return ApiResponse.success(service.read(request.customerId()));
}
}
@@ -80,7 +80,18 @@ public final class DeliveryRequests {
@Size(max=1000) String remark, @Size(max=1000) String remark,
@NotBlank @Size(max=255) String idempotencyKey, @NotBlank @Size(max=255) String idempotencyKey,
@Size(max=128) String skuCode, @Size(max=128) String skuCode,
@jakarta.validation.constraints.Pattern(regexp = "BOX|PALLET") String unitType) { @jakarta.validation.constraints.Pattern(regexp = "BOX|PALLET") String unitType,
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = WholePieceQuantityDeserializer.class)
@jakarta.validation.constraints.Positive Long quantity,
@Size(min=1, max=200) List<@NotNull @Valid ReturnSkuOutboundItem> items) {
public ReturnOutbound(String recipient, String overseasWarehouseId, String returnNo,
List<String> cartonMarks, String remark, String idempotencyKey, String skuCode, String unitType, Long quantity) {
this(recipient, overseasWarehouseId, returnNo, cartonMarks, remark, idempotencyKey, skuCode, unitType, quantity, null);
}
public ReturnOutbound(String recipient, String overseasWarehouseId, String returnNo,
List<String> cartonMarks, String remark, String idempotencyKey, String skuCode, String unitType) {
this(recipient, overseasWarehouseId, returnNo, cartonMarks, remark, idempotencyKey, skuCode, unitType, null);
}
public ReturnOutbound(String recipient, String overseasWarehouseId, String returnNo, public ReturnOutbound(String recipient, String overseasWarehouseId, String returnNo,
List<String> cartonMarks, String remark, String idempotencyKey) { List<String> cartonMarks, String remark, String idempotencyKey) {
this(recipient, overseasWarehouseId, returnNo, cartonMarks, remark, idempotencyKey, null, null); this(recipient, overseasWarehouseId, returnNo, cartonMarks, remark, idempotencyKey, null, null);
@@ -90,6 +101,10 @@ public final class DeliveryRequests {
this(recipient, overseasWarehouseId, returnNo, cartonMarks, remark, idempotencyKey, skuCode, null); this(recipient, overseasWarehouseId, returnNo, cartonMarks, remark, idempotencyKey, skuCode, null);
} }
} }
public record ReturnSkuOutboundItem(@NotBlank @Size(max=128) String cartonMark,
@NotBlank @Size(max=128) String skuCode,
@NotNull @jakarta.validation.constraints.Positive
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = WholePieceQuantityDeserializer.class) Long quantity) { }
public record WarehouseTransferOutbound( public record WarehouseTransferOutbound(
@NotBlank @Size(max=64) String transferNo, @NotBlank @Size(max=64) String transferNo,
@NotNull @Size(min=1, max=100) List<@NotNull Long> palletIds, @NotNull @Size(min=1, max=100) List<@NotNull Long> palletIds,
@@ -114,7 +129,13 @@ public final class DeliveryRequests {
public record PdaPick(@NotNull Long outboundPalletItemId, Long inventoryPositionId, public record PdaPick(@NotNull Long outboundPalletItemId, Long inventoryPositionId,
@NotNull @Min(1) Long packages, @NotBlank @Size(max=255) String idempotencyKey, @NotNull @Min(1) Long packages, @NotBlank @Size(max=255) String idempotencyKey,
@Size(max=500) List<@NotBlank @Size(max=255) String> cartonMarks, @Size(max=500) List<@NotBlank @Size(max=255) String> cartonMarks,
@Size(max=128) String skuCode) { @Size(max=128) String skuCode,
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(using = WholePieceQuantityDeserializer.class)
@jakarta.validation.constraints.Positive Long productQuantity) {
public PdaPick(Long outboundPalletItemId, Long inventoryPositionId, Long packages, String idempotencyKey,
List<String> cartonMarks, String skuCode) {
this(outboundPalletItemId, inventoryPositionId, packages, idempotencyKey, cartonMarks, skuCode, null);
}
public PdaPick(Long outboundPalletItemId, Long inventoryPositionId, Long packages, String idempotencyKey) { public PdaPick(Long outboundPalletItemId, Long inventoryPositionId, Long packages, String idempotencyKey) {
this(outboundPalletItemId, inventoryPositionId, packages, idempotencyKey, List.of(), null); this(outboundPalletItemId, inventoryPositionId, packages, idempotencyKey, List.of(), null);
} }
@@ -92,7 +92,7 @@ public final class DeliveryResponses {
String skuCode, String inboundCode, long availablePackages, String skuCode, String inboundCode, long availablePackages,
long pickedPackages) {} long pickedPackages) {}
public record PdaTaskItem(Long outboundPalletItemId, String palletNo, String skuCode, String inboundCode, public record PdaTaskItem(Long outboundPalletItemId, String palletNo, String skuCode, String inboundCode,
int packageCount, int pickedPackageCount, String status, int packageCount, int pickedPackageCount, String status,
List<PdaPickPosition> positions) {} List<PdaPickPosition> positions, Long returnSkuQuantity) {}
public record PdaTaskDetail(PdaTask task, List<PdaTaskItem> items) {} public record PdaTaskDetail(PdaTask task, List<PdaTaskItem> items) {}
} }
@@ -0,0 +1,16 @@
package com.baiyue.lastleg.delivery.dto;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import java.io.IOException;
/** Piece quantities must not silently truncate a fractional JSON number. */
public final class WholePieceQuantityDeserializer extends JsonDeserializer<Long> {
@Override public Long deserialize(JsonParser parser, DeserializationContext context) throws IOException {
if (parser.currentToken() != JsonToken.VALUE_NUMBER_INT)
return (Long) context.handleUnexpectedToken(Long.class, parser);
return parser.getLongValue();
}
}
@@ -28,6 +28,8 @@ public class OutboundPalletItem {
private Integer pickedPackageCount; private Integer pickedPackageCount;
private String status; private String status;
private String skuCode; private String skuCode;
/** Immutable piece quantity for a selected single-SKU return source. Null means legacy whole-carton work. */
private Long returnSkuQuantity;
private String cartonMarks; private String cartonMarks;
private String orderRefs; private String orderRefs;
private String inboundCode; private String inboundCode;

Some files were not shown because too many files have changed in this diff Show More