包裹明细增加 AttributeText 属性字段。

EOF

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
zzh 2026-07-14 20:10:39 +08:00
parent d0df7e864c
commit f0d0659750
6 changed files with 33 additions and 1 deletions

1
db.sql
View File

@ -1379,6 +1379,7 @@ CREATE TABLE `C_parcel_item` (
`Id` INT NOT NULL AUTO_INCREMENT COMMENT '主键', `Id` INT NOT NULL AUTO_INCREMENT COMMENT '主键',
`ParcelId` INT NOT NULL COMMENT '包裹ID → C_parcel.Id', `ParcelId` INT NOT NULL COMMENT '包裹ID → C_parcel.Id',
`ProductName` VARCHAR(512) NULL COMMENT '商品名称', `ProductName` VARCHAR(512) NULL COMMENT '商品名称',
`AttributeText` VARCHAR(256) NULL COMMENT '规格属性',
`Quantity` INT NOT NULL DEFAULT 0 COMMENT '数量', `Quantity` INT NOT NULL DEFAULT 0 COMMENT '数量',
`SkuId` INT NULL COMMENT '库内SKU ID → C_sku.Id', `SkuId` INT NULL COMMENT '库内SKU ID → C_sku.Id',
`SkuCode` VARCHAR(64) NULL COMMENT '冗余SKU编码', `SkuCode` VARCHAR(64) NULL COMMENT '冗余SKU编码',

View File

@ -0,0 +1,20 @@
-- 已有库增量:包裹明细增加属性字段 AttributeText
-- 可重复执行
SET @col_exists := (
SELECT COUNT(1)
FROM information_schema.COLUMNS
WHERE TABLE_SCHEMA = DATABASE()
AND TABLE_NAME = 'C_parcel_item'
AND COLUMN_NAME = 'AttributeText'
);
SET @sql := IF(
@col_exists = 0,
'ALTER TABLE `C_parcel_item` ADD COLUMN `AttributeText` VARCHAR(256) NULL COMMENT ''规格属性'' AFTER `ProductName`',
'SELECT ''C_parcel_item.AttributeText already exists'' AS info'
);
PREPARE stmt FROM @sql;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;

View File

@ -3,5 +3,5 @@
OMS / 共用库的建表脚本已统一到仓库根目录 `db.sql`。 OMS / 共用库的建表脚本已统一到仓库根目录 `db.sql`。
- 新环境:直接执行 `db.sql`(会 DROP 后重建,勿在有生产数据的库上执行) - 新环境:直接执行 `db.sql`(会 DROP 后重建,勿在有生产数据的库上执行)
- 已有库:用 diff 对比 `db.sql` 与现库结构后手工 ALTER;本目录下单个表脚本(如 `C_parcel_arrival.sql`)可直接在已有库执行增量建表 - 已有库:用 diff 对比 `db.sql` 与现库结构后手工 ALTER;本目录下单个表脚本(如 `C_parcel_arrival.sql`、`C_parcel_item_AttributeText.sql`)可直接在已有库执行增量建表
- 数据权限表(`user_org_perm` 等)若 RBAC 与 OMS 分库,请只在 RBAC 库执行 `db.sql` 末尾对应段落 - 数据权限表(`user_org_perm` 等)若 RBAC 与 OMS 分库,请只在 RBAC 库执行 `db.sql` 末尾对应段落

View File

@ -325,6 +325,8 @@ public class WarehouseParcelItemSaveInput
public string? ProductName { get; set; } public string? ProductName { get; set; }
public string? AttributeText { get; set; }
public int Quantity { get; set; } public int Quantity { get; set; }
public string? Remark { get; set; } public string? Remark { get; set; }
@ -336,6 +338,8 @@ public class WarehouseParcelItemOutput
public string? ProductName { get; set; } public string? ProductName { get; set; }
public string? AttributeText { get; set; }
public int Quantity { get; set; } public int Quantity { get; set; }
public int? SkuId { get; set; } public int? SkuId { get; set; }

View File

@ -128,6 +128,9 @@ public partial class WarehouseService
{ {
ParcelId = parcel.Id, ParcelId = parcel.Id,
ProductName = string.IsNullOrWhiteSpace(itemInput.ProductName) ? null : itemInput.ProductName.Trim(), ProductName = string.IsNullOrWhiteSpace(itemInput.ProductName) ? null : itemInput.ProductName.Trim(),
AttributeText = string.IsNullOrWhiteSpace(itemInput.AttributeText)
? null
: itemInput.AttributeText.Trim(),
Quantity = itemInput.Quantity, Quantity = itemInput.Quantity,
Remark = string.IsNullOrWhiteSpace(itemInput.Remark) ? null : itemInput.Remark.Trim() Remark = string.IsNullOrWhiteSpace(itemInput.Remark) ? null : itemInput.Remark.Trim()
}; };
@ -247,6 +250,7 @@ public partial class WarehouseService
{ {
Id = item.Id, Id = item.Id,
ProductName = item.ProductName, ProductName = item.ProductName,
AttributeText = item.AttributeText,
Quantity = item.Quantity, Quantity = item.Quantity,
SkuId = item.SkuId, SkuId = item.SkuId,
SkuCode = item.SkuCode, SkuCode = item.SkuCode,

View File

@ -10,6 +10,9 @@ public class CParcelItem : OmsAuditedAggregateRoot
public string? ProductName { get; set; } public string? ProductName { get; set; }
/// <summary>规格属性。</summary>
public string? AttributeText { get; set; }
public int Quantity { get; set; } public int Quantity { get; set; }
public int? SkuId { get; set; } public int? SkuId { get; set; }