包裹明细增加商品图片 ImageUrl,支持采集落库与列表返回。
包裹明细增加商品图片 ImageUrl,支持采集落库与列表返回。
This commit is contained in:
commit
9d5203319f
1
db.sql
1
db.sql
@ -1380,6 +1380,7 @@ CREATE TABLE `C_parcel_item` (
|
|||||||
`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 '规格属性',
|
`AttributeText` VARCHAR(256) NULL COMMENT '规格属性',
|
||||||
|
`ImageUrl` VARCHAR(1024) NULL COMMENT '商品图片URL',
|
||||||
`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编码',
|
||||||
|
|||||||
20
sql/C_parcel_item_ImageUrl.sql
Normal file
20
sql/C_parcel_item_ImageUrl.sql
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
-- 已有库增量:包裹明细增加商品图片 ImageUrl
|
||||||
|
-- 可重复执行
|
||||||
|
|
||||||
|
SET @col_exists := (
|
||||||
|
SELECT COUNT(1)
|
||||||
|
FROM information_schema.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'C_parcel_item'
|
||||||
|
AND COLUMN_NAME = 'ImageUrl'
|
||||||
|
);
|
||||||
|
|
||||||
|
SET @sql := IF(
|
||||||
|
@col_exists = 0,
|
||||||
|
'ALTER TABLE `C_parcel_item` ADD COLUMN `ImageUrl` VARCHAR(1024) NULL COMMENT ''商品图片URL'' AFTER `AttributeText`',
|
||||||
|
'SELECT ''C_parcel_item.ImageUrl already exists'' AS info'
|
||||||
|
);
|
||||||
|
|
||||||
|
PREPARE stmt FROM @sql;
|
||||||
|
EXECUTE stmt;
|
||||||
|
DEALLOCATE PREPARE stmt;
|
||||||
@ -3,5 +3,5 @@
|
|||||||
OMS / 共用库的建表脚本已统一到仓库根目录 `db.sql`。
|
OMS / 共用库的建表脚本已统一到仓库根目录 `db.sql`。
|
||||||
|
|
||||||
- 新环境:直接执行 `db.sql`(会 DROP 后重建,勿在有生产数据的库上执行)
|
- 新环境:直接执行 `db.sql`(会 DROP 后重建,勿在有生产数据的库上执行)
|
||||||
- 已有库:用 diff 对比 `db.sql` 与现库结构后手工 ALTER;本目录下单个表脚本(如 `C_parcel_arrival.sql`、`C_parcel_item_AttributeText.sql`)可直接在已有库执行增量建表
|
- 已有库:用 diff 对比 `db.sql` 与现库结构后手工 ALTER;本目录下单个表脚本(如 `C_parcel_arrival.sql`、`C_parcel_item_AttributeText.sql`、`C_parcel_item_ImageUrl.sql`)可直接在已有库执行增量建表
|
||||||
- 数据权限表(`user_org_perm` 等)若 RBAC 与 OMS 分库,请只在 RBAC 库执行 `db.sql` 末尾对应段落
|
- 数据权限表(`user_org_perm` 等)若 RBAC 与 OMS 分库,请只在 RBAC 库执行 `db.sql` 末尾对应段落
|
||||||
|
|||||||
@ -333,6 +333,9 @@ public class WarehouseParcelItemSaveInput
|
|||||||
|
|
||||||
public string? AttributeText { get; set; }
|
public string? AttributeText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>商品图片 URL。</summary>
|
||||||
|
public string? ImageUrl { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
public string? Remark { get; set; }
|
public string? Remark { get; set; }
|
||||||
@ -346,6 +349,9 @@ public class WarehouseParcelItemOutput
|
|||||||
|
|
||||||
public string? AttributeText { get; set; }
|
public string? AttributeText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>商品图片 URL。</summary>
|
||||||
|
public string? ImageUrl { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
public int? SkuId { get; set; }
|
public int? SkuId { get; set; }
|
||||||
|
|||||||
@ -160,6 +160,12 @@ public partial class WarehouseService
|
|||||||
throw new BusinessException("商品数量必须大于 0");
|
throw new BusinessException("商品数量必须大于 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var imageUrl = string.IsNullOrWhiteSpace(itemInput.ImageUrl) ? null : itemInput.ImageUrl.Trim();
|
||||||
|
if (imageUrl != null && imageUrl.Length > 1024)
|
||||||
|
{
|
||||||
|
imageUrl = imageUrl[..1024];
|
||||||
|
}
|
||||||
|
|
||||||
var item = new CParcelItem
|
var item = new CParcelItem
|
||||||
{
|
{
|
||||||
ParcelId = parcel.Id,
|
ParcelId = parcel.Id,
|
||||||
@ -167,6 +173,7 @@ public partial class WarehouseService
|
|||||||
AttributeText = string.IsNullOrWhiteSpace(itemInput.AttributeText)
|
AttributeText = string.IsNullOrWhiteSpace(itemInput.AttributeText)
|
||||||
? null
|
? null
|
||||||
: itemInput.AttributeText.Trim(),
|
: itemInput.AttributeText.Trim(),
|
||||||
|
ImageUrl = imageUrl,
|
||||||
Quantity = itemInput.Quantity,
|
Quantity = itemInput.Quantity,
|
||||||
Remark = string.IsNullOrWhiteSpace(itemInput.Remark) ? null : itemInput.Remark.Trim()
|
Remark = string.IsNullOrWhiteSpace(itemInput.Remark) ? null : itemInput.Remark.Trim()
|
||||||
};
|
};
|
||||||
@ -287,6 +294,7 @@ public partial class WarehouseService
|
|||||||
Id = item.Id,
|
Id = item.Id,
|
||||||
ProductName = item.ProductName,
|
ProductName = item.ProductName,
|
||||||
AttributeText = item.AttributeText,
|
AttributeText = item.AttributeText,
|
||||||
|
ImageUrl = item.ImageUrl,
|
||||||
Quantity = item.Quantity,
|
Quantity = item.Quantity,
|
||||||
SkuId = item.SkuId,
|
SkuId = item.SkuId,
|
||||||
SkuCode = item.SkuCode,
|
SkuCode = item.SkuCode,
|
||||||
|
|||||||
@ -13,6 +13,9 @@ public class CParcelItem : OmsAuditedAggregateRoot
|
|||||||
/// <summary>规格属性。</summary>
|
/// <summary>规格属性。</summary>
|
||||||
public string? AttributeText { get; set; }
|
public string? AttributeText { get; set; }
|
||||||
|
|
||||||
|
/// <summary>商品图片 URL(采集/手工)。</summary>
|
||||||
|
public string? ImageUrl { get; set; }
|
||||||
|
|
||||||
public int Quantity { get; set; }
|
public int Quantity { get; set; }
|
||||||
|
|
||||||
public int? SkuId { get; set; }
|
public int? SkuId { get; set; }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user