diff --git a/models/product_book.go b/models/product_book.go index 90a39de..baba6de 100644 --- a/models/product_book.go +++ b/models/product_book.go @@ -7,43 +7,44 @@ import ( // ProductBook 商品书籍分表(按ISBN后两位分表 product_book_00 ~ product_book_99) type ProductBook struct { - ID int64 `json:"id" gorm:"primarykey;comment:自增ID"` - SelfID int64 `json:"self_id" gorm:"not null;default:0;comment:再分库商品表中的商品ID"` - CategoryID int64 `json:"category_id" gorm:"not null;default:0;comment:分类ID"` - AboutId int64 `json:"about_id" gorm:"not null;default:0;index;comment:关联ID"` - WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;comment:仓库ID"` - WarehouseName string `json:"warehouse_name" gorm:"size:100;not null;default:'';comment:仓库名称"` - LocationID int64 `json:"location_id" gorm:"not null;default:0;index;comment:货位ID"` - LocationName string `json:"location_name" gorm:"size:50;not null;default:'';comment:货位名称"` - StandardProductID int64 `json:"standard_product_id" gorm:"not null;default:0;index;comment:关联标品ID"` - Fid int64 `json:"fid" gorm:"not null;default:0;comment:父级ID"` - Type int8 `json:"type" gorm:"not null;default:0;comment:类型 1正常 2套装书 3一号多书 4无书号"` - ISBN string `json:"isbn" gorm:"size:20;not null;default:'';index:idx_isbn;comment:ISBN"` - FISBN string `json:"f_isbn" gorm:"size:20;not null;default:'';comment:FISBN"` - BookName string `json:"book_name" gorm:"size:100;not null;default:'';comment:书名"` - FBookName string `json:"f_book_name" gorm:"size:100;not null;default:'';comment:副书名"` - Author string `json:"author" gorm:"size:100;not null;default:'';comment:作者"` - Publishing string `json:"publishing" gorm:"size:50;not null;default:'';comment:出版社"` - PublicationTime int64 `json:"publication_time" gorm:"type:bigint;not null;default:0;comment:出版日期时间戳"` - Binding string `json:"binding" gorm:"size:10;not null;default:'';comment:装帧"` - PagesCount int64 `json:"pages_count" gorm:"not null;default:0;comment:页数"` - WordsCount int64 `json:"words_count" gorm:"not null;default:0;comment:字数"` - Format int64 `json:"format" gorm:"not null;default:0;comment:开本"` - CatID datatypes.JSON `json:"cat_id" gorm:"type:json;not null;comment:类目json"` - Name string `json:"name" gorm:"size:255;not null;default:'';comment:商品名称"` - Appearance int64 `json:"appearance" gorm:"not null;default:0;comment:品相"` - Barcode string `json:"barcode" gorm:"size:100;not null;default:'';index;comment:条码"` - Price int64 `json:"price" gorm:"not null;default:0;comment:价格"` - SalePrice int64 `json:"sale_price" gorm:"not null;default:0;comment:书价"` - Cost int64 `json:"cost" gorm:"not null;default:0;comment:最低运费"` - Stock int64 `json:"stock" gorm:"not null;default:0;comment:库存"` - LiveImage datatypes.JSON `json:"live_image" gorm:"type:json;not null;comment:实拍图json"` - IsBatchManaged int8 `json:"is_batch_managed" gorm:"type:tinyint(1);not null;default:0;comment:是否批次管理(0:否,1:是)"` - IsShelfLifeManaged int8 `json:"is_shelf_life_managed" gorm:"type:tinyint(1);not null;default:0;comment:是否效期管理(0:否,1:是)"` - Status int8 `json:"status" gorm:"type:tinyint(1);not null;default:1;comment:状态(0:禁用,1:启用)"` - CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳"` - UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳"` - IsDel int8 `json:"is_del" gorm:"not null;default:0;comment:逻辑删除"` + ID int64 `json:"id" gorm:"primarykey;comment:自增ID"` // 自增ID + SelfID int64 `json:"self_id" gorm:"not null;default:0;comment:再分库商品表中的商品ID"` // 再分库商品表中的商品ID + CategoryID int64 `json:"category_id" gorm:"not null;default:0;comment:分类ID"` // 分类ID + AboutId int64 `json:"about_id" gorm:"not null;default:0;index;comment:关联ID"` // 关联ID + WarehouseID int64 `json:"warehouse_id" gorm:"not null;default:0;index;comment:仓库ID"` // 仓库ID + WarehouseName string `json:"warehouse_name" gorm:"size:100;not null;default:'';comment:仓库名称"` // 仓库名称 + LocationID int64 `json:"location_id" gorm:"not null;default:0;index;comment:货位ID"` // 货位ID + LocationName string `json:"location_name" gorm:"size:50;not null;default:'';comment:货位名称"` // 货位名称 + StandardProductID int64 `json:"standard_product_id" gorm:"not null;default:0;index;comment:关联标品ID"` // 关联标品ID + Fid int64 `json:"fid" gorm:"not null;default:0;comment:父级ID"` // 父级ID + Type int8 `json:"type" gorm:"not null;default:0;comment:类型 1正常 2套装书 3一号多书 4无书号"` // 类型 + ISBN string `json:"isbn" gorm:"size:20;not null;default:'';index:idx_isbn;comment:ISBN"` // ISBN + FISBN string `json:"f_isbn" gorm:"size:20;not null;default:'';comment:FISBN"` // FISBN + BookName string `json:"book_name" gorm:"size:100;not null;default:'';comment:书名"` // 书名 + FBookName string `json:"f_book_name" gorm:"size:100;not null;default:'';comment:副书名"` // 副书名 + Author string `json:"author" gorm:"size:100;not null;default:'';comment:作者"` // 作者 + Publishing string `json:"publishing" gorm:"size:50;not null;default:'';comment:出版社"` // 出版社 + PublicationTime int64 `json:"publication_time" gorm:"type:bigint;not null;default:0;comment:出版日期时间戳"` // 出版日期时间戳 + Binding string `json:"binding" gorm:"size:10;not null;default:'';comment:装帧"` // 装帧 + PagesCount int64 `json:"pages_count" gorm:"not null;default:0;comment:页数"` // 页数 + WordsCount int64 `json:"words_count" gorm:"not null;default:0;comment:字数"` // 字数 + Format int64 `json:"format" gorm:"not null;default:0;comment:开本"` // 开本 + CatID datatypes.JSON `json:"cat_id" gorm:"type:json;not null;comment:类目json"` // 类目json + Name string `json:"name" gorm:"size:255;not null;default:'';comment:商品名称"` // 商品名称 + Appearance int64 `json:"appearance" gorm:"not null;default:0;comment:品相"` // 品相 + Barcode string `json:"barcode" gorm:"size:100;not null;default:'';index;comment:条码"` // 条码 + Price int64 `json:"price" gorm:"not null;default:0;comment:价格"` // 价格 + SalePrice int64 `json:"sale_price" gorm:"not null;default:0;comment:书价"` // 书价 + Cost int64 `json:"cost" gorm:"not null;default:0;comment:最低运费"` // 最低运费 + Stock int64 `json:"stock" gorm:"not null;default:0;comment:库存"` // 库存 + + LiveImage datatypes.JSON `json:"live_image" gorm:"type:json;not null;comment:实拍图json"` // 实拍图json + IsBatchManaged int8 `json:"is_batch_managed" gorm:"type:tinyint(1);not null;default:0;comment:是否批次管理(0:否,1:是)"` // 是否批次管理(0:否,1:是) + IsShelfLifeManaged int8 `json:"is_shelf_life_managed" gorm:"type:tinyint(1);not null;default:0;comment:是否效期管理(0:否,1:是)"` // 是否效期管理(0:否,1:是) + Status int8 `json:"status" gorm:"type:tinyint(1);not null;default:1;comment:状态(0:禁用,1:启用)"` // 状态(0:禁用,1:启用) + CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳"` // 创建时间戳 + UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳"` // 更新时间戳 + IsDel int8 `json:"is_del" gorm:"not null;default:0;comment:逻辑删除"` // 逻辑删除 } func (ProductBook) TableName() string { diff --git a/models/request/location.go b/models/request/location.go index 09e5491..9ea1fa3 100644 --- a/models/request/location.go +++ b/models/request/location.go @@ -2,45 +2,45 @@ package request // QueryAllLocationRequest 查询所有库位请求(仓库ID可选) type QueryAllLocationRequest struct { - WarehouseID *int64 `json:"warehouse_id" form:"warehouse_id"` - Code string `json:"code" form:"code"` - Type *int8 `json:"type" form:"type"` - Status *int8 `json:"status" form:"status"` - Page int `json:"page" form:"page,default=1"` - PageSize int `json:"page_size" form:"page_size,default=10"` + WarehouseID *int64 `json:"warehouse_id" form:"warehouse_id"` // 仓库ID + Code string `json:"code" form:"code"` // 编码 + Type *int8 `json:"type" form:"type"` // 类型 + Status *int8 `json:"status" form:"status"` // 状态 + Page int `json:"page" form:"page,default=1"` // 页码 + PageSize int `json:"page_size" form:"page_size,default=10"` // 每页数量 } type QueryLocationRequest struct { - WarehouseID int64 `json:"warehouse_id" form:"warehouse_id" binding:"required"` - Code string `json:"code" form:"code"` - Type *int8 `json:"type" form:"type"` - Status *int8 `json:"status" form:"status"` - Page int `json:"page" form:"page,default=1"` - PageSize int `json:"page_size" form:"page_size,default=10"` + WarehouseID int64 `json:"warehouse_id" form:"warehouse_id" binding:"required"` // 仓库ID + Code string `json:"code" form:"code"` // 编码 + Type *int8 `json:"type" form:"type"` // 类型 + Status *int8 `json:"status" form:"status"` // 状态 + Page int `json:"page" form:"page,default=1"` // 页码 + PageSize int `json:"page_size" form:"page_size,default=10"` // 每页数量 } type CreateLocationRequest struct { - WarehouseID int64 `form:"warehouse_id" binding:"required"` - Code string `form:"code" binding:"required,max=50"` - Type int8 `form:"type" binding:"required"` - Capacity int64 `form:"capacity" binding:"required"` - Status int8 `form:"status" binding:"required"` + WarehouseID int64 `form:"warehouse_id" binding:"required"` // 仓库ID + Code string `form:"code" binding:"required,max=50"` // 编码 + Type int8 `form:"type" binding:"required"` // 类型 + Capacity int64 `form:"capacity" binding:"required"` // 容量 + Status int8 `form:"status" binding:"required"` // 状态 } type BatchGenerateLocationRequest struct { - WarehouseID int64 `form:"warehouse_id" binding:"required"` - Groups []GroupConfig `form:"groups[]"` - Type int8 `form:"type"` - Capacity int64 `form:"capacity"` - Status int8 `form:"status"` + WarehouseID int64 `form:"warehouse_id" binding:"required"` // 仓库ID + Groups []GroupConfig `form:"groups[]"` // 分组 + Type int8 `form:"type"` // 类型 + Capacity int64 `form:"capacity"` // 容量 + Status int8 `form:"status"` // 状态 } type GroupConfig struct { - FormatType int `form:"format_type" binding:"required,oneof=1 2 3 4"` - StartValue string `form:"start_value" binding:"required"` - EndValue string `form:"end_value" binding:"required"` - PaddingLen int `form:"padding_len"` - Separator string `form:"separator" binding:"max=5"` + FormatType int `form:"format_type" binding:"required,oneof=1 2 3 4"` // 格式类型 + StartValue string `form:"start_value" binding:"required"` // 起始值 + EndValue string `form:"end_value" binding:"required"` // 结束值 + PaddingLen int `form:"padding_len"` // 填充长度 + Separator string `form:"separator" binding:"max=5"` // 分隔符 } type UpdateLocationRequest struct { @@ -54,72 +54,72 @@ type UpdateLocationRequest struct { } type DeleteLocationRequest struct { - IDs []int64 `form:"ids[]"` + IDs []int64 `form:"ids[]"` // 库位ID } type GetLocationIdRequest struct { - Code string `form:"code"` - WarehouseCode string `form:"warehouse_code"` + Code string `form:"code"` // 库位编码 + WarehouseCode string `form:"warehouse_code"` // 仓库编码 } type SyncLocationRequest struct { - UserID int64 `json:"user_id" binding:"required"` - Data []SyncLocationAreaRequest `json:"data" binding:"required"` + UserID int64 `json:"user_id" binding:"required"` // 用户ID + Data []SyncLocationAreaRequest `json:"data" binding:"required"` // 库位数据 } type SyncLocationAreaRequest struct { - Code string `json:"code" binding:"required"` - Name string `json:"name" binding:"required"` - TemplateId int64 `json:"templateId" binding:"required"` - Status string `json:"status" binding:"required"` - Logistics SyncLogisticsRequest `json:"logistics" binding:"required"` - Data []SyncLocationItemRequest `json:"data" binding:"required"` + Code string `json:"code" binding:"required"` // 库位编码 + Name string `json:"name" binding:"required"` // 库位名称 + TemplateId int64 `json:"templateId" binding:"required"` // 模板ID + Status string `json:"status" binding:"required"` // 状态 + Logistics SyncLogisticsRequest `json:"logistics" binding:"required"` // 物流信息 + Data []SyncLocationItemRequest `json:"data" binding:"required"` // 库位数据 } type SyncLogisticsRequest struct { - Id int64 `json:"id"` - TemplateName string `json:"templateName" binding:"required"` - DeliveryProvince string `json:"deliveryProvince" binding:"required"` - DeliveryCity string `json:"deliveryCity" binding:"required"` - DeliveryArea string `json:"deliveryArea" binding:"required"` - DeliveryAddress string `json:"deliveryAddress" binding:"required"` - PricingMethod string `json:"pricingMethod" binding:"required"` - Shipping string `json:"shipping" binding:"required"` - FirWbv float64 `json:"firWbv"` - FirPrice float64 `json:"firPrice"` - ContinueWbv float64 `json:"continueWbv"` - ContinuePrice float64 `json:"continuePrice"` - CreateBy int64 `json:"createBy"` - CreateTime string `json:"createTime"` - UpdateBy int64 `json:"updateBy"` - UpdateTime string `json:"updateTime"` - Status string `json:"status"` - DelFlag string `json:"delFlag"` - TenantId string `json:"tenantId"` - CreateDept int64 `json:"createDept"` - ShippingRange string `json:"shippingRange"` - WarehouseId int64 `json:"warehouseId"` - Remark string `json:"remark"` - PhoneNumber int64 `json:"phoneNumber"` - Contact string `json:"contact"` - FullAddress string `json:"fullAddress"` + Id int64 `json:"id"` // 物流ID + TemplateName string `json:"templateName" binding:"required"` // 模板名称 + DeliveryProvince string `json:"deliveryProvince" binding:"required"` // 发货省 + DeliveryCity string `json:"deliveryCity" binding:"required"` // 发货市 + DeliveryArea string `json:"deliveryArea" binding:"required"` // 发货区 + DeliveryAddress string `json:"deliveryAddress" binding:"required"` // 发货地址 + PricingMethod string `json:"pricingMethod" binding:"required"` // 计费方式 + Shipping string `json:"shipping" binding:"required"` // 配送方式 + FirWbv float64 `json:"firWbv"` // 首重 + FirPrice float64 `json:"firPrice"` // 首费 + ContinueWbv float64 `json:"continueWbv"` // 续重 + ContinuePrice float64 `json:"continuePrice"` // 续费 + CreateBy int64 `json:"createBy"` // 创建人 + CreateTime string `json:"createTime"` // 创建时间 + UpdateBy int64 `json:"updateBy"` // 更新人 + UpdateTime string `json:"updateTime"` // 更新时间 + Status string `json:"status"` // 状态 + DelFlag string `json:"delFlag"` // 删除标记 + TenantId string `json:"tenantId"` // 租户ID + CreateDept int64 `json:"createDept"` // 创建部门 + ShippingRange string `json:"shippingRange"` // 配送范围 + WarehouseId int64 `json:"warehouseId"` // 仓库 + Remark string `json:"remark"` // 备注 + PhoneNumber int64 `json:"phoneNumber"` // 手机号 + Contact string `json:"contact"` // 联系人 + FullAddress string `json:"fullAddress"` // 全地址 } type SyncLocationItemRequest struct { - Code string `json:"code" binding:"required"` - SheQuantityMax int64 `json:"sheQuantityMax" binding:"required"` + Code string `json:"code" binding:"required"` // 编码 + SheQuantityMax int64 `json:"sheQuantityMax" binding:"required"` // 最大数量 } type SyncGoodsRequest struct { - UserID int64 `json:"user_id" binding:"required"` - Data []SyncGoodsItem `json:"data" binding:"required"` + UserID int64 `json:"user_id" binding:"required"` // 用户ID + Data []SyncGoodsItem `json:"data" binding:"required"` // 商品数据 } type SyncGoodsItem struct { - GoodsName string `json:"goods_name" binding:"required"` - ISBN string `json:"isbn" binding:"required"` - Price int64 `json:"price" binding:"required"` - Appearance string `json:"appearance" binding:"required"` - LiveImage []string `json:"live_image" binding:"required"` - LocationCode string `json:"location_code" binding:"required"` - Inventory int64 `json:"inventory" binding:"required"` + GoodsName string `json:"goods_name" binding:"required"` // 商品名称 + ISBN string `json:"isbn" binding:"required"` // ISBN + Price int64 `json:"price" binding:"required"` // 价格 + Appearance string `json:"appearance" binding:"required"` // 外观 + LiveImage []string `json:"live_image" binding:"required"` // 图片 + LocationCode string `json:"location_code" binding:"required"` // 库位编码 + Inventory int64 `json:"inventory" binding:"required"` // 库存 } diff --git a/models/request/process.go b/models/request/process.go index f87051f..5eac127 100644 --- a/models/request/process.go +++ b/models/request/process.go @@ -28,9 +28,9 @@ type WaveRequest struct { } type WaveItemRequest struct { - ProductID int64 `form:"product_id" binding:"required"` - Quantity int64 `form:"quantity" binding:"required,gt=0"` - UnitPrice int64 `form:"unit_price" binding:"required,gt=0"` + ProductID int64 `form:"product_id" binding:"required"` // 商品ID + Quantity int64 `form:"quantity" binding:"required,gt=0"` // 数量 + UnitPrice int64 `form:"unit_price" binding:"required,gt=0"` // 单价 } type BindWaveRequest struct { @@ -41,7 +41,7 @@ type BindWaveRequest struct { } type GetIdRequest struct { - ID int64 `form:"id" binding:"required"` + ID int64 `form:"id" binding:"required"` // ID } type ReceivingSubmitRequest struct { @@ -52,72 +52,72 @@ type ReceivingSubmitRequest struct { } type ReceivingItemRequest struct { - ProductID int64 `form:"product_id" binding:"required"` - LocationID int64 `form:"location_id" binding:"required"` - BatchNo string `form:"batch_no" binding:"required"` - ProductionDate int64 `form:"production_date"` - ExpiryDate int64 `form:"expiry_date"` - Quantity int64 `form:"quantity" binding:"required,gt=0"` + ProductID int64 `form:"product_id" binding:"required"` // 商品ID + LocationID int64 `form:"location_id" binding:"required"` // 仓库ID + BatchNo string `form:"batch_no" binding:"required"` // 批次号 + ProductionDate int64 `form:"production_date"` // 生产日期 + ExpiryDate int64 `form:"expiry_date"` // 到期日期 + Quantity int64 `form:"quantity" binding:"required,gt=0"` // 数量 //SerialNumbers []string `form:"serial_numbers"` } type SalesOrderCreateRequest struct { - AboutId int64 `form:"about_id"` - AssociationOrderID int64 `form:"association_order_id" binding:"required"` - AssociationOrderNo string `form:"association_order_no" binding:"required"` - FromType int8 `form:"from_type"` - ShopType int8 `form:"shop_type"` - CustomerID int64 `form:"customer_id"` - RequiredDeliveryDate int64 `form:"required_delivery_date"` - Remark string `form:"remark"` - SalesPerson string `form:"sales_person"` - SalesPersonID int64 `form:"sales_person_id"` - ReceiverName string `form:"receiver_name"` - ReceiverPhone string `form:"receiver_phone"` - ReceiverAddress string `form:"receiver_address"` - IsDistribution int8 `form:"is_distribution"` - Items []SalesOrderItemRequest `form:"items[]"` + AboutId int64 `form:"about_id"` // 关联ID + AssociationOrderID int64 `form:"association_order_id" binding:"required"` // 关联订单ID + AssociationOrderNo string `form:"association_order_no" binding:"required"` // 关联订单号 + FromType int8 `form:"from_type"` // 来源类型 + ShopType int8 `form:"shop_type"` // 店铺类型 + CustomerID int64 `form:"customer_id"` // 客户ID + RequiredDeliveryDate int64 `form:"required_delivery_date"` // 要求发货时间 + Remark string `form:"remark"` // 备注 + SalesPerson string `form:"sales_person"` // 销售人员 + SalesPersonID int64 `form:"sales_person_id"` // 销售人员ID + ReceiverName string `form:"receiver_name"` // 收货人 + ReceiverPhone string `form:"receiver_phone"` // 收货人电话 + ReceiverAddress string `form:"receiver_address"` // 收货地址 + IsDistribution int8 `form:"is_distribution"` // 是否分销 + Items []SalesOrderItemRequest `form:"items[]"` // 销售订单项 } // CreateOutboundOrderRequest 基于销售订单创建出库单请求 type CreateOutboundOrderRequest struct { - SalesOrderIDs []int64 `form:"order_ids[]"` - Total int `form:"total"` - Remark string `form:"remark"` + SalesOrderIDs []int64 `form:"order_ids[]"` // 销售订单ID + Total int `form:"total"` // 销售订单数量 + Remark string `form:"remark"` // 备注 } type CreateOutboundWaveRequest struct { - OutboundOrderID int64 `form:"outbound_order_id" binding:"required"` + OutboundOrderID int64 `form:"outbound_order_id" binding:"required"` // 出库单ID } type SalesOrderItemRequest struct { - ProductID int64 `form:"product_id" binding:"required"` - Quantity int64 `form:"quantity" binding:"required,gt=0"` - UnitPrice int64 `form:"unit_price" binding:"required,gt=0"` + ProductID int64 `form:"product_id" binding:"required"` // 商品ID + Quantity int64 `form:"quantity" binding:"required,gt=0"` // 数量 + UnitPrice int64 `form:"unit_price" binding:"required,gt=0"` // 单价 } type OutboundSubmitRequest struct { - OutboundOrderID int64 `form:"outbound_order_id" binding:"required"` - WaveTaskID int64 `form:"wave_task_id" binding:"required"` - Force int8 `form:"force"` - Items []OutboundItemRequest `form:"items[]"` + OutboundOrderID int64 `form:"outbound_order_id" binding:"required"` // 出库单ID + WaveTaskID int64 `form:"wave_task_id" binding:"required"` // 波次ID + Force int8 `form:"force"` // 强制 + Items []OutboundItemRequest `form:"items[]"` // 出库单项 } type OutboundItemRequest struct { - ProductID int64 `form:"product_id" binding:"required"` - LocationID int64 `form:"location_id" binding:"required"` - BatchNo string `form:"batch_no"` - ProductionDate int64 `form:"production_date"` - ExpiryDate int64 `form:"expiry_date"` - Quantity int64 `form:"quantity" binding:"required,gt=0"` + ProductID int64 `form:"product_id" binding:"required"` // 商品ID + LocationID int64 `form:"location_id" binding:"required"` // 仓库ID + BatchNo string `form:"batch_no"` // 批次号 + ProductionDate int64 `form:"production_date"` // 生产日期 + ExpiryDate int64 `form:"expiry_date"` // 到期日期 + Quantity int64 `form:"quantity" binding:"required,gt=0"` // 数量 } // CreateShippingOrderRequest 基于出库单创建发货单请求 type CreateShippingOrderRequest struct { - OutboundOrderIDs []int64 `form:"order_ids[]"` - Total int `form:"total"` - ExpectedArriveTime *int64 `form:"expected_arrive_time"` - Remark string `form:"remark"` + OutboundOrderIDs []int64 `form:"order_ids[]"` // 出库单ID + Total int `form:"total"` // 出库单数量 + ExpectedArriveTime *int64 `form:"expected_arrive_time"` // 预计到达时间 + Remark string `form:"remark"` // 备注 } // UpdateShippingLogisticsRequest 更新发货单物流信息请求 @@ -130,11 +130,11 @@ type UpdateShippingLogisticsRequest struct { } type CancelSalesOrderRequest struct { - OrderID int64 `form:"order_id" binding:"required"` + OrderID int64 `form:"order_id" binding:"required"` // 订单ID } type CancelOutboundWaveRequest struct { - WaveID int64 `form:"wave_id" binding:"required"` + WaveID int64 `form:"wave_id" binding:"required"` // 波次ID } // StockCheckAdjustRequest 盘库调整请求(加库存/减库存) diff --git a/models/request/product.go b/models/request/product.go index d8e2d6c..d77cd9c 100644 --- a/models/request/product.go +++ b/models/request/product.go @@ -2,17 +2,21 @@ package request // ProductRequest 创建商品请求 type ProductRequest struct { - ID int64 `form:"id"` // 商品ID - CategoryID int64 `form:"category_id"` // 分类ID - StandardProductID int64 `form:"standard_product_id"` // 标准商品ID - Name string `form:"name" binding:"required"` // 商品名称 - Appearance int64 `form:"appearance" binding:"required"` // 商品外观 - Barcode string `form:"barcode" binding:"required"` // 商品条码 - Price int64 `form:"price"` // 商品价格 - LiveImage []string `form:"live_image[]"` // 商品图片 - IsBatchManaged int8 `form:"is_batch_managed"` // 批次管理 - IsShelfLifeManaged int8 `form:"is_shelf_life_managed"` // 保质期管理 - Status int8 `form:"status"` // 商品状态 + ID int64 `form:"id"` // 商品ID + CategoryID int64 `form:"category_id"` // 分类ID + StandardProductID int64 `form:"standard_product_id"` // 标准商品ID + Name string `form:"name" binding:"required"` // 商品名称 + Appearance int64 `form:"appearance" binding:"required"` // 商品外观 + Barcode string `form:"barcode" binding:"required"` // 商品条码 + Price int64 `form:"price"` // 商品价格 + + SalePrice int64 `form:"sale_price"` // 商品售价 + Cost int64 `form:"cost"` // 运费 + + LiveImage []string `form:"live_image[]"` // 商品图片 + IsBatchManaged int8 `form:"is_batch_managed"` // 批次管理 + IsShelfLifeManaged int8 `form:"is_shelf_life_managed"` // 保质期管理 + Status int8 `form:"status"` // 商品状态 } // GetProductListRequest 获取商品列表请求 diff --git a/models/response/Employee.go b/models/response/Employee.go index 7b4ca36..4dc3903 100644 --- a/models/response/Employee.go +++ b/models/response/Employee.go @@ -31,65 +31,65 @@ type EmployeeLevelInfo struct { // EmployeeListResponse 员工列表响应 type EmployeeListResponse struct { - List []EmployeeItem `json:"list"` - Total int64 `json:"total"` - Page int `json:"page"` - PageSize int `json:"pageSize"` + List []EmployeeItem `json:"list"` // 员工列表 + Total int64 `json:"total"` // 总数 + Page int `json:"page"` // 当前页 + PageSize int `json:"pageSize"` // 每页数量 } // AddEmployeeResponse 添加员工响应 type AddEmployeeResponse struct { - EmployeeID string `json:"employee_id"` - Username string `json:"username"` - Name string `json:"name"` + EmployeeID string `json:"employee_id"` // 工号 + Username string `json:"username"` // 用户名 + Name string `json:"name"` // 姓名 } // EmployeeItem 员工列表项 type EmployeeItem struct { - ID int64 `json:"id"` - EmployeeIDStr string `json:"employee_id"` - Fid int64 `json:"fid"` // 父级ID - AboutId int64 `json:"about_id"` // 租户ID - Code string `json:"code"` // 机械码 - Username string `json:"username"` - Name string `json:"name"` - Phone string `json:"phone"` - Role int64 `json:"role"` - Score int64 `json:"score"` - Status int8 `json:"status"` - From string `json:"from"` - LastLoginAt int64 `json:"last_login_at"` - CreatedAt int64 `json:"created_at"` - ExpireTime int64 `json:"expire_time"` - LevelInfo *EmployeeLevelInfo `json:"level_info"` // 等级信息 - Settings models.EmployeeSettingsConfig `json:"settings"` - UserType *UserTypeInfo `json:"user_type"` + ID int64 `json:"id"` // 员工ID + EmployeeIDStr string `json:"employee_id"` // 工号 + Fid int64 `json:"fid"` // 父级ID + AboutId int64 `json:"about_id"` // 租户ID + Code string `json:"code"` // 机械码 + Username string `json:"username"` // 用户名 + Name string `json:"name"` // 姓名 + Phone string `json:"phone"` // 手机号 + Role int64 `json:"role"` // 角色 + Score int64 `json:"score"` // 积分 + Status int8 `json:"status"` // 状态 + From string `json:"from"` // 来源 + LastLoginAt int64 `json:"last_login_at"` // 最后登录时间 + CreatedAt int64 `json:"created_at"` // 创建时间 + ExpireTime int64 `json:"expire_time"` // 到期时间 + LevelInfo *EmployeeLevelInfo `json:"level_info"` // 等级信息 + Settings models.EmployeeSettingsConfig `json:"settings"` // 员工设置 + UserType *UserTypeInfo `json:"user_type"` // 用户类型 } type UserTypeInfo struct { - ID int64 `json:"id"` - Name string `json:"name"` - Icon string `json:"icon"` + ID int64 `json:"id"` // 用户类型ID + Name string `json:"name"` // 用户类型名称 + Icon string `json:"icon"` // 用户类型图标 } // ConvertEmployeeToItem 将员工模型转换为响应项 func ConvertEmployeeToItem(emp models.Employee) EmployeeItem { return EmployeeItem{ - ID: emp.ID, - EmployeeIDStr: emp.EmployeeIDStr, - Fid: emp.Fid, - AboutId: emp.AboutId, - Code: emp.Code, - Username: emp.Username, - Name: emp.Name, - Phone: emp.Phone, - Role: emp.Role, - Score: emp.Score, - From: emp.From, - Status: emp.Status, - LastLoginAt: emp.LastLoginAt, - CreatedAt: emp.CreatedAt, - ExpireTime: emp.ExpireTime, + ID: emp.ID, // 员工ID + EmployeeIDStr: emp.EmployeeIDStr, // 工号 + Fid: emp.Fid, // 父级ID + AboutId: emp.AboutId, // 租户ID + Code: emp.Code, // 机械码 + Username: emp.Username, // 用户名 + Name: emp.Name, // 姓名 + Phone: emp.Phone, // 手机号 + Role: emp.Role, // 角色 + Score: emp.Score, // 积分 + From: emp.From, // 来源 + Status: emp.Status, // 状态 + LastLoginAt: emp.LastLoginAt, // 最后登录时间 + CreatedAt: emp.CreatedAt, // 创建时间 + ExpireTime: emp.ExpireTime, // 到期时间 } } @@ -103,13 +103,13 @@ type EmployeeLevelConfigResponse struct { // UserListItem 用户列表项 type UserListItem struct { - ID int64 `json:"id"` - EmployeeIDStr string `json:"employee_id_str"` - Username string `json:"username"` - Name string `json:"name"` - Role int64 `json:"role"` - Status int8 `json:"status"` - SplitAccountConfigId int64 `json:"split_account_config_id"` + ID int64 `json:"id"` // 用户ID + EmployeeIDStr string `json:"employee_id_str"` // 工号 + Username string `json:"username"` // 用户名 + Name string `json:"name"` // 姓名 + Role int64 `json:"role"` // 角色 + Status int8 `json:"status"` // 状态 + SplitAccountConfigId int64 `json:"split_account_config_id"` // 分账配置ID SplitAccountConfig *SplitAccountConfigInfo `json:"split_account_config,omitempty"` // 分账配置详情 AboutId int64 `json:"about_id"` // 租户ID Phone string `json:"phone"` // 手机号 @@ -122,52 +122,52 @@ type UserListItem struct { // GetUserListResponse 用户列表响应 type GetUserListResponse struct { - List []UserListItem `json:"list"` - Total int64 `json:"total"` - Page int `json:"page"` - PageSize int `json:"page_size"` + List []UserListItem `json:"list"` // 用户列表 + Total int64 `json:"total"` // 总数 + Page int `json:"page"` // 当前页 + PageSize int `json:"page_size"` // 每页数量 } // UpdateEmployeeSplitAccountConfigResponse 更新员工分账配置响应 type UpdateEmployeeSplitAccountConfigResponse struct { - ID int64 `json:"id"` - EmployeeIDStr string `json:"employee_id_str"` - Username string `json:"username"` - Name string `json:"name"` - Phone string `json:"phone"` - AboutId int64 `json:"about_id"` - SplitAccountConfigId int64 `json:"split_account_config_id"` - Status int8 `json:"status"` - UpdatedAt int64 `json:"updated_at"` + ID int64 `json:"id"` // 员工分账配置ID + EmployeeIDStr string `json:"employee_id_str"` // 工号 + Username string `json:"username"` // 用户名 + Name string `json:"name"` // 姓名 + Phone string `json:"phone"` // 手机号 + AboutId int64 `json:"about_id"` // 租户ID + SplitAccountConfigId int64 `json:"split_account_config_id"` // 分账配置ID + Status int8 `json:"status"` // 状态 + UpdatedAt int64 `json:"updated_at"` // 更新时间 } // CurrentUserResponse 当前用户信息响应(包含分账配置) type CurrentUserResponse struct { - ID int64 `json:"id"` - EmployeeIDStr string `json:"employee_id_str"` - Username string `json:"username"` - Name string `json:"name"` - Phone string `json:"phone"` - Role int64 `json:"role"` - Fid int64 `json:"fid"` - AboutId int64 `json:"about_id"` - Status int8 `json:"status"` - Score int64 `json:"score"` - SplitAccountConfigId int64 `json:"split_account_config_id"` + ID int64 `json:"id"` // 员工ID + EmployeeIDStr string `json:"employee_id_str"` // 工号 + Username string `json:"username"` // 用户名 + Name string `json:"name"` // 姓名 + Phone string `json:"phone"` // 手机号 + Role int64 `json:"role"` // 角色 + Fid int64 `json:"fid"` // 父级ID + AboutId int64 `json:"about_id"` // 租户ID + Status int8 `json:"status"` // 状态 + Score int64 `json:"score"` // 积分 + SplitAccountConfigId int64 `json:"split_account_config_id"` // 分账配置ID SplitAccountConfig *SplitAccountConfigInfo `json:"split_account_config,omitempty"` // 分账配置详情 - CreatedAt int64 `json:"created_at"` - UpdatedAt int64 `json:"updated_at"` + CreatedAt int64 `json:"created_at"` // 创建时间 + UpdatedAt int64 `json:"updated_at"` // 更新时间 } // SplitAccountConfigInfo 分账配置信息 type SplitAccountConfigInfo struct { - ID int64 `json:"id"` - RuleName string `json:"rule_name"` - RuleValue json.RawMessage `json:"rule_value"` - Status int8 `json:"status"` - Description string `json:"description"` - CreatedBy string `json:"created_by"` - UpdatedBy string `json:"updated_by"` - CreatedAt int64 `json:"created_at"` - UpdatedAt int64 `json:"updated_at"` + ID int64 `json:"id"` // 分账配置ID + RuleName string `json:"rule_name"` // 规则名称 + RuleValue json.RawMessage `json:"rule_value"` // 规则值 + Status int8 `json:"status"` // 状态 + Description string `json:"description"` // 描述 + CreatedBy string `json:"created_by"` // 创建人 + UpdatedBy string `json:"updated_by"` // 更新人 + CreatedAt int64 `json:"created_at"` // 创建时间 + UpdatedAt int64 `json:"updated_at"` // 更新时间 } diff --git a/models/response/ocr.go b/models/response/ocr.go index 8071674..110778a 100644 --- a/models/response/ocr.go +++ b/models/response/ocr.go @@ -1,7 +1,7 @@ package response type OcrResponse struct { - Success bool `json:"success"` - Texts []string `json:"texts"` + Success bool `json:"success"` // 是否成功 + Texts []string `json:"texts"` // 识别结果 GuessBookInfo } diff --git a/models/sales_order_item.go b/models/sales_order_item.go index b1b1ec9..7e2fb1a 100644 --- a/models/sales_order_item.go +++ b/models/sales_order_item.go @@ -2,22 +2,22 @@ package models // SalesOrderItem 销售订单明细表 type SalesOrderItem struct { - ID int64 `json:"id" gorm:"primarykey;comment:明细ID"` - SalesOrderID int64 `json:"sales_order_id" gorm:"not null;default:0;index;comment:销售单ID"` - ProductID int64 `json:"product_id" gorm:"not null;default:0;index;comment:商品ID"` - Quantity int64 `json:"quantity" gorm:"not null;default:0;comment:订购数量(最小单位)"` - AllocatedQuantity int64 `json:"allocated_quantity" gorm:"not null;default:0;comment:已分配数量"` - ShippedQuantity int64 `json:"shipped_quantity" gorm:"not null;default:0;comment:已发货数量"` - UnitPrice int64 `json:"unit_price" gorm:"not null;default:0;comment:单价(分/基本单位)"` - Amount int64 `json:"amount" gorm:"->;comment:金额(分)"` - ReceiverName string `json:"receiver_name" gorm:"size:100;not null;default:'';comment:收货人姓名"` - ReceiverPhone string `json:"receiver_phone" gorm:"size:20;not null;default:'';comment:收货人电话"` - ReceiverAddress string `json:"receiver_address" gorm:"size:200;not null;default:'';comment:收货地址"` - LogisticsCompany string `json:"logistics_company" gorm:"size:100;not null;default:'';comment:物流公司"` - LogisticsNo string `json:"logistics_no" gorm:"size:100;not null;default:'';comment:物流运单号"` - CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` - UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` - IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` + ID int64 `json:"id" gorm:"primarykey;comment:明细ID"` // 明细ID + SalesOrderID int64 `json:"sales_order_id" gorm:"not null;default:0;index;comment:销售单ID"` // 销售单 + ProductID int64 `json:"product_id" gorm:"not null;default:0;index;comment:商品ID"` // 商品 + Quantity int64 `json:"quantity" gorm:"not null;default:0;comment:订购数量(最小单位)"` // 订购数量 + AllocatedQuantity int64 `json:"allocated_quantity" gorm:"not null;default:0;comment:已分配数量"` // 已分配数量 + ShippedQuantity int64 `json:"shipped_quantity" gorm:"not null;default:0;comment:已发货数量"` // 已发货数量 + UnitPrice int64 `json:"unit_price" gorm:"not null;default:0;comment:单价(分/基本单位)"` // 单价 + Amount int64 `json:"amount" gorm:"->;comment:金额(分)"` // 金额 + ReceiverName string `json:"receiver_name" gorm:"size:100;not null;default:'';comment:收货人姓名"` // 收货人姓名 + ReceiverPhone string `json:"receiver_phone" gorm:"size:20;not null;default:'';comment:收货人电话"` // 收货人电话 + ReceiverAddress string `json:"receiver_address" gorm:"size:200;not null;default:'';comment:收货地址"` // 收货地址 + LogisticsCompany string `json:"logistics_company" gorm:"size:100;not null;default:'';comment:物流公司"` // 物流公司 + LogisticsNo string `json:"logistics_no" gorm:"size:100;not null;default:'';comment:物流运单号"` // 物流运单号 + CreatedAt int64 `json:"created_at" gorm:"type:bigint;not null;default:0;comment:创建时间戳(秒)"` // 创建时间戳(秒) + UpdatedAt int64 `json:"updated_at" gorm:"type:bigint;not null;default:0;comment:更新时间戳(秒)"` // 更新时间戳(秒) + IsDel int8 `json:"is_del" gorm:"type:tinyint(1);not null;default:0;comment:逻辑删除标记(0:未删除,1:已删除)"` // 逻辑删除标记(0:未删除,1:已删除) } func (SalesOrderItem) TableName() string { diff --git a/routes/routes.go b/routes/routes.go index 3790c79..a7fa054 100644 --- a/routes/routes.go +++ b/routes/routes.go @@ -88,6 +88,12 @@ func initRouter() (r *gin.Engine) { public.GET("/product_book/del", productBookApi.Del) // 删除商品反射 public.GET("/product/full_info", productApi.GetProductFullInfo) // 没有签名认证获取商品完整信息 + public.GET("/split-account-deduction-log/list", splitAccountDeductionLogApi.GetSplitAccountDeductionLogList) // 获取分账扣钱日志列表 + public.GET("/split-account-deduction-log/detail/:id", splitAccountDeductionLogApi.GetSplitAccountDeductionLogDetail) // 获取分账扣钱日志详情 + public.POST("/split-account-deduction-log/create", splitAccountDeductionLogApi.CreateSplitAccountDeductionLog) // 创建分账 + public.PUT("/split-account-deduction-log/update", splitAccountDeductionLogApi.UpdateSplitAccountDeductionLog) // 更新分账 + public.DELETE("/split-account-deduction-log/delete", splitAccountDeductionLogApi.DeleteSplitAccountDeductionLog) // 删除分账 + } sign := api.Group("") @@ -242,11 +248,11 @@ func initRouter() (r *gin.Engine) { auth.PUT("/split-account-config/update", splitAccountConfigApi.UpdateSplitAccountConfig) // 更新分账配置 auth.DELETE("/split-account-config/delete", splitAccountConfigApi.DeleteSplitAccountConfig) // 删除分账配置 // 分账扣钱日志管理 - auth.GET("/split-account-deduction-log/list", splitAccountDeductionLogApi.GetSplitAccountDeductionLogList) // 获取分账扣钱日志列表 + /*auth.GET("/split-account-deduction-log/list", splitAccountDeductionLogApi.GetSplitAccountDeductionLogList) // 获取分账扣钱日志列表 auth.GET("/split-account-deduction-log/detail/:id", splitAccountDeductionLogApi.GetSplitAccountDeductionLogDetail) // 获取分账扣钱日志详情 auth.POST("/split-account-deduction-log/create", splitAccountDeductionLogApi.CreateSplitAccountDeductionLog) // 创建分账 auth.PUT("/split-account-deduction-log/update", splitAccountDeductionLogApi.UpdateSplitAccountDeductionLog) // 更新分账 - auth.DELETE("/split-account-deduction-log/delete", splitAccountDeductionLogApi.DeleteSplitAccountDeductionLog) // 删除分账 + auth.DELETE("/split-account-deduction-log/delete", splitAccountDeductionLogApi.DeleteSplitAccountDeductionLog) // 删除分账*/ // 产品日志管理 auth.GET("/product_log/list", productApi.GetProductLogList) // 获取产品日志列表 auth.POST("/product_log/save", productApi.SaveProductLog) // 保存产品日志 diff --git a/service/employee.go b/service/employee.go index cf2317f..97ed432 100644 --- a/service/employee.go +++ b/service/employee.go @@ -19,7 +19,7 @@ type EmployeeService struct{} // Login 管理员登录 func (s *EmployeeService) Login(req systemReq.LoginRequest, userType string, c *gin.Context) (*systemRes.LoginResponse, error) { var employee models.Employee - + // result := database.DB.Where("username = ? AND deleted_at = ?", req.Username, 0).First(&employee) if result.Error != nil { return nil, utils.NewError("用户不存在") @@ -39,7 +39,7 @@ func (s *EmployeeService) Login(req systemReq.LoginRequest, userType string, c * return nil, utils.NewError("子账号已过期,无法登录") } } - + // 检查账号类型 if req.Type == 1 { expectedRole := 255 if userType == "128" { @@ -95,26 +95,26 @@ func (s *EmployeeService) Login(req systemReq.LoginRequest, userType string, c * levelResult := database.DB.Where("emp_id = ? AND is_del = ?", employee.ID, 0).First(&employeeLevel) if levelResult.Error == nil { levelInfo = &systemRes.EmployeeLevelInfo{ - Level: employeeLevel.Level, - MaxNum: employeeLevel.MaxNum, - ExpireTime: employeeLevel.ExpireTime, - PayTime: employeeLevel.PayTime, + Level: employeeLevel.Level, // 等级 + MaxNum: employeeLevel.MaxNum, // 最大数量 + ExpireTime: employeeLevel.ExpireTime, // 到期时间 + PayTime: employeeLevel.PayTime, // 支付时间 } } return &systemRes.LoginResponse{ - ID: employee.ID, - EmployeeID: employee.EmployeeIDStr, - Fid: employee.Fid, - AboutId: strconv.FormatInt(employee.AboutId, 10), - Username: employee.Username, - Name: employee.Name, - Role: employee.Role, - Score: employee.Score, - From: employee.From, - Token: token, - ExpireIn: config.AppConfig.JWT.ExpireHours, - LevelInfo: levelInfo, + ID: employee.ID, // 员工ID + EmployeeID: employee.EmployeeIDStr, // 员工ID + Fid: employee.Fid, // 父级ID + AboutId: strconv.FormatInt(employee.AboutId, 10), // 租户ID + Username: employee.Username, // 用户名 + Name: employee.Name, // 姓名 + Role: employee.Role, // 角色 + Score: employee.Score, // 积分 + From: employee.From, // 来源 + Token: token, // 令牌 + ExpireIn: config.AppConfig.JWT.ExpireHours, // 令牌有效期 + LevelInfo: levelInfo, // 等级信息 }, nil } @@ -141,15 +141,15 @@ func (s *EmployeeService) GetEmployeeList(req systemReq.GetEmployeeListRequest, type EmployeeWithRelations struct { models.Employee - Settings string `gorm:"column:settings"` - LevelID int64 `gorm:"column:level_id"` - LevelLevel int8 `gorm:"column:level_level"` - MaxNum int64 `gorm:"column:max_num"` - LevelPayTime int64 `gorm:"column:level_pay_time"` - LevelExpireTime int64 `gorm:"column:level_expire_time"` - UserTypeID int8 `gorm:"column:user_type_id"` - UserTypeName string `gorm:"column:user_type_name"` - UserTypeIcon string `gorm:"column:user_type_icon"` + Settings string `gorm:"column:settings"` // 员工设置 + LevelID int64 `gorm:"column:level_id"` // 等级ID + LevelLevel int8 `gorm:"column:level_level"` // 等级等级 + MaxNum int64 `gorm:"column:max_num"` // 最大数量 + LevelPayTime int64 `gorm:"column:level_pay_time"` // 支付时间 + LevelExpireTime int64 `gorm:"column:level_expire_time"` // 到期时间 + UserTypeID int8 `gorm:"column:user_type_id"` // 用户类型ID + UserTypeName string `gorm:"column:user_type_name"` // 用户类型名称 + UserTypeIcon string `gorm:"column:user_type_icon"` // 用户类型图标 } query := database.DB.Table("employees"). Select("employees.*, employees_settings.settings, employees_level.id as level_id, employees_level.level as level_level, employees_level.max_num, employees_level.pay_time as level_pay_time, employees_level.expire_time as level_expire_time, user_type.id as user_type_id, user_type.name as user_type_name, user_type.icon as user_type_icon"). @@ -200,10 +200,10 @@ func (s *EmployeeService) GetEmployeeList(req systemReq.GetEmployeeListRequest, // 添加等级信息 if emp.LevelID > 0 { item.LevelInfo = &systemRes.EmployeeLevelInfo{ - Level: emp.LevelLevel, - MaxNum: emp.MaxNum, - ExpireTime: emp.LevelExpireTime, - PayTime: emp.LevelPayTime, + Level: emp.LevelLevel, // 等级 + MaxNum: emp.MaxNum, // 最大数量 + ExpireTime: emp.LevelExpireTime, // 到期时间 + PayTime: emp.LevelPayTime, // 支付时间 } } @@ -211,8 +211,8 @@ func (s *EmployeeService) GetEmployeeList(req systemReq.GetEmployeeListRequest, if emp.UserTypeID > 0 { item.UserType = &systemRes.UserTypeInfo{ ID: int64(emp.UserTypeID), - Name: emp.UserTypeName, - Icon: emp.UserTypeIcon, + Name: emp.UserTypeName, // 用户类型名称 + Icon: emp.UserTypeIcon, // 用户类型图标 } } @@ -220,10 +220,10 @@ func (s *EmployeeService) GetEmployeeList(req systemReq.GetEmployeeListRequest, } return &systemRes.EmployeeListResponse{ - List: employeeItems, - Total: total, - Page: req.Page, - PageSize: req.PageSize, + List: employeeItems, // 员工列表 + Total: total, // 总数 + Page: req.Page, // 当前页码 + PageSize: req.PageSize, // 每页数量 }, nil } @@ -310,21 +310,21 @@ func (s *EmployeeService) AddEmployee(req systemReq.AddEmployeeRequest) (*system now := time.Now().Unix() employee := models.Employee{ - EmployeeIDStr: newEmployeeID, - Username: utils.Ternary(req.UserName == "", username, req.UserName), - Password: hashedPassword, - Name: req.Name, - Phone: req.Phone, - Role: int64(utils.Ternary(req.Fid == 0, 255, 128)), - Fid: req.Fid, - AboutId: req.AboutId, - Score: 0, - Status: 1, - From: utils.Ternary(req.From == "", "system", req.From), - CreatedAt: now, - UpdatedAt: now, - DeletedAt: 0, - ExpireTime: req.ExpireTime, + EmployeeIDStr: newEmployeeID, // 员工编号 + Username: utils.Ternary(req.UserName == "", username, req.UserName), // 用户名 + Password: hashedPassword, // 密码 + Name: req.Name, // 姓名 + Phone: req.Phone, // 手机号 + Role: int64(utils.Ternary(req.Fid == 0, 255, 128)), // 角色 + Fid: req.Fid, // 上级ID + AboutId: req.AboutId, // 关联id + Score: 0, // 积分 + Status: 1, // 状态 + From: utils.Ternary(req.From == "", "system", req.From), // 来源 + CreatedAt: now, // 创建时间 + UpdatedAt: now, // 更新时间 + DeletedAt: 0, // 删除时间 + ExpireTime: req.ExpireTime, // 到期时间 } if err := database.DB.Create(&employee).Error; err != nil { @@ -332,9 +332,9 @@ func (s *EmployeeService) AddEmployee(req systemReq.AddEmployeeRequest) (*system } return &systemRes.AddEmployeeResponse{ - EmployeeID: employee.EmployeeIDStr, - Username: employee.Username, - Name: employee.Name, + EmployeeID: employee.EmployeeIDStr, // 员工编号 + Username: employee.Username, // 用户名 + Name: employee.Name, // 姓名 }, nil } @@ -491,37 +491,37 @@ func (s *EmployeeService) ClearCodeEmployee(req systemReq.ClearCodeEmployeeReque func GetLevelConfig(level int8) interface{} { configs := map[int8]systemRes.EmployeeLevelConfigResponse{ 1: { - Level: 1, - MaxNum: 5, - Price: 9800, - LevelName: "基础版(5个子账号,98元/30天)", + Level: 1, // 等级 + MaxNum: 5, // 最大数量 + Price: 9800, // 价格 + LevelName: "基础版(5个子账号,98元/30天)", // 等级名称 }, 2: { - Level: 2, - MaxNum: 10, - Price: 15600, - LevelName: "专业版(10个子账号,156元/30天)", + Level: 2, // 等级 + MaxNum: 10, // 最大数量 + Price: 15600, // 价格 + LevelName: "专业版(10个子账号,156元/30天)", // 等级名称 }, 3: { - Level: 3, - MaxNum: 15, - Price: 20500, - LevelName: "企业版(15个子账号,205元/30天)", + Level: 3, // 等级 + MaxNum: 15, // 最大数量 + Price: 20500, // 价格 + LevelName: "企业版(15个子账号,205元/30天)", // 等级名称 }, 4: { - Level: 4, - MaxNum: 20, - Price: 23500, - LevelName: "旗舰版(20个子账号,235元/30天)", + Level: 4, // 等级 + MaxNum: 20, // 最大数量 + Price: 23500, // 价格 + LevelName: "旗舰版(20个子账号,235元/30天)", // 等级名称 }, 5: { - Level: 5, - MaxNum: 25, - Price: 24500, - LevelName: "至尊版(25个子账号,245元/30天)", + Level: 5, // 等级 + MaxNum: 25, // 最大数量 + Price: 24500, // 价格 + LevelName: "至尊版(25个子账号,245元/30天)", // 等级名称 }, } - + // 获取所有等级配置 if level == 0 { var allConfigs []systemRes.EmployeeLevelConfigResponse for i := int8(1); i <= 5; i++ { @@ -748,8 +748,8 @@ func (s *EmployeeService) SaveEmployeeSettings(req systemReq.SaveEmployeeSetting now := time.Now().Unix() config := models.EmployeeSettingsConfig{ - ShowPrice: req.ShowPrice, - ShowCategory: req.ShowCategory, + ShowPrice: req.ShowPrice, // 是否显示价格 + ShowCategory: req.ShowCategory, // 是否显示分类 ShowCache: req.ShowCache, CompareCount: req.CompareCount, CompareCountEditable: req.CompareCountEditable, @@ -1050,12 +1050,12 @@ func (s *EmployeeService) GetUserList(req systemReq.GetUserListRequest) (*system Status: emp.Status, SplitAccountConfigId: emp.SplitAccountConfigId, AboutId: emp.AboutId, - Phone: emp.Phone, - From: emp.From, - LastLoginIp: emp.LastLoginIp, - LastLoginAt: emp.LastLoginAt, - Code: emp.Code, - ExpireTime: emp.ExpireTime, + Phone: emp.Phone, // emp.Phone, + From: emp.From, // emp.From, + LastLoginIp: emp.LastLoginIp, // emp.LastLoginIp, + LastLoginAt: emp.LastLoginAt, // emp.LastLoginAt, + Code: emp.Code, // emp.Code, + ExpireTime: emp.ExpireTime, // emp.ExpireTime, } // 如果有关联的分账配置,添加详情 @@ -1069,10 +1069,10 @@ func (s *EmployeeService) GetUserList(req systemReq.GetUserListRequest) (*system } return &systemRes.GetUserListResponse{ - List: items, - Total: total, - Page: req.Page, - PageSize: req.PageSize, + List: items, // items, + Total: total, // total, + Page: req.Page, // req.Page, + PageSize: req.PageSize, // req.PageSize, }, nil } @@ -1099,15 +1099,15 @@ func (s *EmployeeService) UpdateEmployeeSplitAccountConfigByAboutId(req systemRe } return &systemRes.UpdateEmployeeSplitAccountConfigResponse{ - ID: employee.ID, - EmployeeIDStr: employee.EmployeeIDStr, - Username: employee.Username, - Name: employee.Name, - Phone: employee.Phone, - AboutId: employee.AboutId, - SplitAccountConfigId: employee.SplitAccountConfigId, - Status: employee.Status, - UpdatedAt: employee.UpdatedAt, + ID: employee.ID, // 员工ID + EmployeeIDStr: employee.EmployeeIDStr, // 员工ID + Username: employee.Username, // 员工用户名 + Name: employee.Name, // 员工姓名 + Phone: employee.Phone, // 员工手机号 + AboutId: employee.AboutId, // 员工所属商户ID + SplitAccountConfigId: employee.SplitAccountConfigId, // 员工分账配置ID + Status: employee.Status, // 员工状态 + UpdatedAt: employee.UpdatedAt, // 员工更新时间 }, nil } diff --git a/service/ocr.go b/service/ocr.go index bbc7758..2b4ffef 100644 --- a/service/ocr.go +++ b/service/ocr.go @@ -17,12 +17,12 @@ import ( type OcrService struct{} type ocrServiceRequest struct { - ImageBase64 string `json:"image_base64"` + ImageBase64 string `json:"image_base64"` // 图片的base64编码 } type ocrServiceResponse struct { - Error string `json:"error,omitempty"` - Texts []string `json:"texts,omitempty"` + Error string `json:"error,omitempty"` // 错误信息 + Texts []string `json:"texts,omitempty"` // 识别的文本列表 } // RecognizeText 调用OCR服务进行文字识别 @@ -30,7 +30,7 @@ func (s *OcrService) RecognizeText(imageData []byte) (systemRes.OcrResponse, err base64Data := base64.StdEncoding.EncodeToString(imageData) reqBody := ocrServiceRequest{ - ImageBase64: base64Data, + ImageBase64: base64Data, // 图片的base64编码 } jsonData, err := json.Marshal(reqBody) @@ -61,16 +61,16 @@ func (s *OcrService) RecognizeText(imageData []byte) (systemRes.OcrResponse, err } guessedInfo := s.analyzeBookInfo(ocrResp.Texts) return systemRes.OcrResponse{ - Success: true, - Texts: ocrResp.Texts, - GuessBookInfo: guessedInfo, + Success: true, // 是否成功 + Texts: ocrResp.Texts, // 识别的文本列表 + GuessBookInfo: guessedInfo, // 图书信息 }, nil } type candidate struct { - text string - priority int - index int + text string // 文本内容 + priority int // 优先级 + index int // 文本在列表中的索引 } // analyzeBookInfo 分析识别结果 diff --git a/service/process.go b/service/process.go index 57ea8f0..6411471 100644 --- a/service/process.go +++ b/service/process.go @@ -89,28 +89,28 @@ func (s *ProcessService) CreatePurchaseOrderWithWave(req systemReq.PurchaseOrder return 0, 0, fmt.Errorf("生成波次号失败: %v", err) } - var totalAmount int64 + var totalAmount int64 // 采购金额 for _, item := range req.Items { totalAmount += item.Quantity * item.UnitPrice } - var purchaseOrderID int64 - var waveID int64 + var purchaseOrderID int64 // 采购订单ID + var waveID int64 // 入库波次ID err = executeInTransactionWithDB(databaseConn, func(tx *gorm.DB) error { purchaseOrder := models.PurchaseOrder{ - PoNo: poNo, - SupplierID: req.SupplierID, - WarehouseID: req.WarehouseID, - OrderDate: now, - ExpectedArrivalDate: req.ExpectedArrivalDate, - TotalAmount: totalAmount, - Status: constant.PurchaseStatusSubmitted, - Creator: creator, - CreatorID: creatorID, - Remark: req.Remark, - CreatedAt: now, - UpdatedAt: now, - IsDel: 0, + PoNo: poNo, //采购订单号 + SupplierID: req.SupplierID, //供应商ID + WarehouseID: req.WarehouseID, //仓库ID + OrderDate: now, //订单日期 + ExpectedArrivalDate: req.ExpectedArrivalDate, //预计到货日期 + TotalAmount: totalAmount, //采购金额 + Status: constant.PurchaseStatusSubmitted, //订单状态 + Creator: creator, //创建人 + CreatorID: creatorID, //创建人ID + Remark: req.Remark, //备注 + CreatedAt: now, //创建时间戳 + UpdatedAt: now, //更新时间戳 + IsDel: 0, //逻辑删除标记 } if err := tx.Create(&purchaseOrder).Error; err != nil { @@ -142,8 +142,8 @@ func (s *ProcessService) ReleaseWave(req systemReq.WaveRequest, carCapacity int6 now := time.Now().Unix() - var waveID int64 - var waveNo string + var waveID int64 // 波次ID + var waveNo string // 波次号 err := executeInTransactionWithDB(databaseConn, func(tx *gorm.DB) error { var waveHeader models.WaveHeader @@ -219,22 +219,22 @@ func (s *ProcessService) ReleaseWave(req systemReq.WaveRequest, carCapacity int6 newItemsTotalQuantity += itemReq.Quantity items = append(items, WaveItemData{ - ProductID: itemReq.ProductID, - Quantity: itemReq.Quantity, - UnitPrice: itemReq.UnitPrice, + ProductID: itemReq.ProductID, // 产品ID + Quantity: itemReq.Quantity, // 数量 + UnitPrice: itemReq.UnitPrice, // 单价 LocationID: 0, }) purchaseOrderItems = append(purchaseOrderItems, models.PurchaseOrderItem{ - PurchaseOrderID: req.RelatedOrderID, - ProductID: itemReq.ProductID, - Quantity: itemReq.Quantity, - ReceivedQuantity: 0, - UnitPrice: itemReq.UnitPrice, - Amount: amount, - CreatedAt: now, - UpdatedAt: now, - IsDel: 0, + PurchaseOrderID: req.RelatedOrderID, //采购单ID + ProductID: itemReq.ProductID, //产品ID + Quantity: itemReq.Quantity, // 数量 + ReceivedQuantity: 0, //已入库数量 + UnitPrice: itemReq.UnitPrice, //单价 + Amount: amount, //金额 + CreatedAt: now, //创建时间戳 + UpdatedAt: now, //更新时间戳 + IsDel: 0, //逻辑删除标记 }) } @@ -303,9 +303,9 @@ func (s *ProcessService) BindWave(req systemReq.BindWaveRequest, db ...*gorm.DB) databaseConn := database.OptionalDB(db...) now := time.Now().Unix() - var receivingOrderID int64 - var waveTaskID int64 - var waveTaskBatchNo string + var receivingOrderID int64 //入库单ID + var waveTaskID int64 //入库任务ID + var waveTaskBatchNo string //入库任务批次号 err := executeInTransactionWithDB(databaseConn, func(tx *gorm.DB) error { var waveHeader models.WaveHeader @@ -336,19 +336,19 @@ func (s *ProcessService) BindWave(req systemReq.BindWaveRequest, db ...*gorm.DB) receivingNo := utils.GenerateReceivingNo() receivingOrder := models.ReceivingOrder{ - ReceivingNo: receivingNo, - PurchaseOrderID: purchaseOrder.ID, - WaveTaskID: waveTaskID, - WarehouseID: purchaseOrder.WarehouseID, - SupplierID: purchaseOrder.SupplierID, - ReceivingDate: now, - Status: constant.ReceivingStatusPending, - Operator: req.Operator, - OperatorID: req.OperatorID, - Remark: req.Remark, - CreatedAt: now, - UpdatedAt: now, - IsDel: 0, + ReceivingNo: receivingNo, //入库单号 + PurchaseOrderID: purchaseOrder.ID, //采购订单ID + WaveTaskID: waveTaskID, //入库任务ID + WarehouseID: purchaseOrder.WarehouseID, //仓库ID + SupplierID: purchaseOrder.SupplierID, //供应商ID + ReceivingDate: now, //入库日期时间戳(秒) + Status: constant.ReceivingStatusPending, //状态(1:待收货/pending, ) + Operator: req.Operator, //操作人 + OperatorID: req.OperatorID, //操作人ID + Remark: req.Remark, //备注 + CreatedAt: now, //创建时间戳(秒) + UpdatedAt: now, //更新时间戳(秒) + IsDel: 0, //逻辑删除标记 } if err := tx.Create(&receivingOrder).Error; err != nil { @@ -374,16 +374,16 @@ func (s *ProcessService) BindWave(req systemReq.BindWaveRequest, db ...*gorm.DB) receivingItems := make([]models.ReceivingOrderItem, 0, len(waveTaskDetails)) for _, detail := range waveTaskDetails { receivingItems = append(receivingItems, models.ReceivingOrderItem{ - ReceivingOrderID: receivingOrder.ID, - ProductID: detail.ProductID, - LocationID: 0, - BatchNo: detail.BatchNo, - ProductionDate: 0, - ExpiryDate: 0, - Quantity: 0, - CreatedAt: now, - UpdatedAt: now, - IsDel: 0, + ReceivingOrderID: receivingOrder.ID, //入库单ID + ProductID: detail.ProductID, //商品ID + LocationID: 0, //库位ID + BatchNo: detail.BatchNo, //批次号 + ProductionDate: 0, //生产日期时间戳(秒) + ExpiryDate: 0, //失效日期时间戳(秒) + Quantity: 0, //入库数量(最小单位) + CreatedAt: now, //创建时间戳(秒) + UpdatedAt: now, //更新时间戳(秒) + IsDel: 0, //逻辑删除标记 }) } @@ -465,11 +465,11 @@ func (s *ProcessService) GetWaveTaskInfo(waveTaskID int64, db ...*gorm.DB) (inte } item := map[string]interface{}{ - "product_id": detail.ProductID, - "product_name": product.Name, - "product_code": product.Barcode, - "planned_quantity": detail.PlannedQuantity, - "actual_quantity": detail.ActualQuantity, + "product_id": detail.ProductID, //商品ID + "product_name": product.Name, //商品名称 + "product_code": product.Barcode, //商品编码 + "planned_quantity": detail.PlannedQuantity, //计划数量(最小单位) + "actual_quantity": detail.ActualQuantity, //实际 } if detail.LocationID > 0 { @@ -483,14 +483,14 @@ func (s *ProcessService) GetWaveTaskInfo(waveTaskID int64, db ...*gorm.DB) (inte } result := map[string]interface{}{ - "wave_task_id": waveTask.ID, - "task_no": waveTask.TaskNo, - "type": waveTask.Type, - "status": waveTask.Status, - "assignee": waveTask.Assignee, - "direction": waveHeader.Direction, - "warehouse_id": waveHeader.WarehouseID, - "items": items, + "wave_task_id": waveTask.ID, //波次任务ID + "task_no": waveTask.TaskNo, //波次任务号 + "type": waveTask.Type, //波次任务类型(1:入库,2:出) + "status": waveTask.Status, //波次任务状态(1:待处理,2:处理中) + "assignee": waveTask.Assignee, //指定处理人 + "direction": waveHeader.Direction, //方向(1:出库,2:入库) + "warehouse_id": waveHeader.WarehouseID, //仓库ID + "items": items, //波次任务明细 } return result, nil @@ -501,12 +501,12 @@ func (s *ProcessService) SubmitReceiving(req systemReq.ReceivingSubmitRequest, o items := make([]orderItemInfo, 0, len(req.Items)) for _, item := range req.Items { items = append(items, orderItemInfo{ - productID: item.ProductID, - locationID: item.LocationID, - batchNo: item.BatchNo, - productionDate: item.ProductionDate, - expiryDate: item.ExpiryDate, - quantity: item.Quantity, + productID: item.ProductID, //商品ID + locationID: item.LocationID, //库位ID + batchNo: item.BatchNo, //批次号 + productionDate: item.ProductionDate, //生产日期时间戳(秒) + expiryDate: item.ExpiryDate, //失效日期时间戳(秒) + quantity: item.Quantity, //入库数量(最小单位) }) } @@ -525,12 +525,12 @@ func (s *ProcessService) SubmitOutbound(req systemReq.OutboundSubmitRequest, ope items := make([]orderItemInfo, 0, len(req.Items)) for _, item := range req.Items { items = append(items, orderItemInfo{ - productID: item.ProductID, - locationID: item.LocationID, - batchNo: item.BatchNo, - productionDate: item.ProductionDate, - expiryDate: item.ExpiryDate, - quantity: item.Quantity, + productID: item.ProductID, //商品ID + locationID: item.LocationID, //库位ID + batchNo: item.BatchNo, //批次号 + productionDate: item.ProductionDate, //生产日期时间戳(秒) + expiryDate: item.ExpiryDate, //失效日期时间戳(秒) + quantity: item.Quantity, //出库数量(最小单位) }) } @@ -675,10 +675,10 @@ func (s *ProcessService) validateAndGetOrderInfo(tx *gorm.DB, orderID, waveTaskI } return &orderInfo{ - orderID: receivingOrder.ID, - orderNo: receivingOrder.ReceivingNo, - warehouseID: receivingOrder.WarehouseID, - status: int(receivingOrder.Status), + orderID: receivingOrder.ID, //入库单ID + orderNo: receivingOrder.ReceivingNo, //入库单号 + warehouseID: receivingOrder.WarehouseID, //仓库ID + status: int(receivingOrder.Status), //订单状态 }, nil } else { var outboundOrder models.OutboundOrder @@ -699,10 +699,10 @@ func (s *ProcessService) validateAndGetOrderInfo(tx *gorm.DB, orderID, waveTaskI } return &orderInfo{ - orderID: outboundOrder.ID, - orderNo: outboundOrder.OutNo, - warehouseID: outboundOrder.WarehouseID, - status: int(outboundOrder.Status), + orderID: outboundOrder.ID, //出库单ID + orderNo: outboundOrder.OutNo, //出库单号 + warehouseID: outboundOrder.WarehouseID, //仓库ID + status: int(outboundOrder.Status), //订单状态 }, nil } } @@ -814,13 +814,13 @@ func (s *ProcessService) processOrderItems(tx *gorm.DB, items []orderItemInfo, o } if orderItem, exists := orderItemMap[itemReq.productID]; exists { - receivingItem := orderItem.(*models.ReceivingOrderItem) - receivingItem.LocationID = itemReq.locationID - receivingItem.BatchNo = itemReq.batchNo - receivingItem.ProductionDate = itemReq.productionDate - receivingItem.ExpiryDate = itemReq.expiryDate - receivingItem.Quantity += itemReq.quantity - receivingItem.UpdatedAt = now + receivingItem := orderItem.(*models.ReceivingOrderItem) // 类型断言 + receivingItem.LocationID = itemReq.locationID //入库库位ID + receivingItem.BatchNo = itemReq.batchNo //批次号 + receivingItem.ProductionDate = itemReq.productionDate //生产日期 + receivingItem.ExpiryDate = itemReq.expiryDate //到期日期 + receivingItem.Quantity += itemReq.quantity // 数量 + receivingItem.UpdatedAt = now //更新时间戳(秒) } else { return nil, nil, fmt.Errorf("订单中不存在该商品: %d", itemReq.productID) } @@ -830,21 +830,21 @@ func (s *ProcessService) processOrderItems(tx *gorm.DB, items []orderItemInfo, o return nil, nil, fmt.Errorf("波次任务明细不存在: %d", itemReq.productID) } - waveTaskDetail.ActualQuantity += itemReq.quantity - waveTaskDetail.LocationID = itemReq.locationID - waveTaskDetail.BatchNo = itemReq.batchNo - waveTaskDetail.UpdatedAt = now + waveTaskDetail.ActualQuantity += itemReq.quantity // 数量 + waveTaskDetail.LocationID = itemReq.locationID //入库库位ID + waveTaskDetail.BatchNo = itemReq.batchNo //批次号 + waveTaskDetail.UpdatedAt = now //更新时间戳(秒) if waveTaskDetail.ActualQuantity >= waveTaskDetail.PlannedQuantity { waveTaskDetail.Status = constant.WaveStatusReleased } key := inventoryKey{ - warehouseID: orderInfo.warehouseID, - productID: itemReq.productID, - batchNo: itemReq.batchNo, - productionDate: itemReq.productionDate, - expiryDate: itemReq.expiryDate, + warehouseID: orderInfo.warehouseID, //仓库ID + productID: itemReq.productID, //商品ID + batchNo: itemReq.batchNo, //批次号 + productionDate: itemReq.productionDate, //生产日期 + expiryDate: itemReq.expiryDate, //到期日期 } if op, exists := inventoryOpMap[key]; exists { @@ -927,11 +927,11 @@ func (s *ProcessService) processOrderItems(tx *gorm.DB, items []orderItemInfo, o productUsedIndex[itemReq.productID] = foundIdx + 1 // 更新找到的出库单明细 - outboundItem.LocationID = itemReq.locationID - outboundItem.BatchNo = itemReq.batchNo - outboundItem.ProductionDate = itemReq.productionDate - outboundItem.ExpiryDate = itemReq.expiryDate - outboundItem.Quantity = itemReq.quantity + outboundItem.LocationID = itemReq.locationID //出库库位ID + outboundItem.BatchNo = itemReq.batchNo //批次号 + outboundItem.ProductionDate = itemReq.productionDate //生产日期 + outboundItem.ExpiryDate = itemReq.expiryDate //到期日期 + outboundItem.Quantity = itemReq.quantity // 数量 outboundItem.UpdatedAt = now // 获取该商品ID对应的波次任务明细列表 diff --git a/service/product.go b/service/product.go index 75fa615..f2f18b2 100644 --- a/service/product.go +++ b/service/product.go @@ -112,14 +112,14 @@ func (s *ProductService) GetProductList(req systemReq.GetProductListRequest, db var productItems []systemRes.ProductItem for _, product := range products { item := systemRes.ConvertProductWithInfoToItem(product) - if outTaskInfo, exists := outTaskInfoMap[product.ID]; exists { item.ShopList = outTaskInfo.ShopList } - // item.LiveImage[0] 按照 , 分割数组 - liveImage := strings.Split(item.LiveImage[0], ",") - item.LiveImage[0] = liveImage[0] productItems = append(productItems, item) + /* // item.LiveImage[0] 按照 , 分割数组 + liveImage := strings.Split(item.LiveImage[0], ",") + item.LiveImage[0] = liveImage[0] + productItems = append(productItems, item)*/ } return &systemRes.ProductListResponse{ @@ -230,7 +230,9 @@ func (s *ProductService) GetDistributionProductList(req systemReq.GetDistributio var productItems []systemRes.ProductItem for _, product := range products { item := systemRes.ConvertProductWithInfoToItem(product) - + /*if outTaskInfo, exists := outTaskInfoMap[product.ID]; exists { + item.ShopList = outTaskInfo.ShopList + }*/ productItems = append(productItems, item) } @@ -678,6 +680,8 @@ func (s *ProductService) createProduct(req systemReq.ProductRequest, now int64, Appearance: req.Appearance, Barcode: req.Barcode, Price: req.Price, + SalePrice: req.SalePrice, + Cost: req.Cost, LiveImage: liveImage, IsBatchManaged: req.IsBatchManaged, IsShelfLifeManaged: req.IsShelfLifeManaged, @@ -716,6 +720,8 @@ func (s *ProductService) updateProduct(req systemReq.ProductRequest, now int64, "appearance": req.Appearance, "barcode": req.Barcode, "price": req.Price, + "sale_price": req.SalePrice, + "cost": req.Cost, "live_image": liveImage, "is_batch_managed": req.IsBatchManaged, "is_shelf_life_managed": req.IsShelfLifeManaged,