Compare commits

...

3 Commits

Author SHA1 Message Date
b817b7fd40 1.优化采购需求导出全部数据时偶尔崩溃的问题; 2024-07-23 17:14:19 +08:00
5ed025bb22 1.优化采购需求excel导出格式,数据为0的单元格置空; 2024-07-23 10:51:11 +08:00
596fd1dc44 1.修复采购需求的缺陷;
2.优惠券Coupon增加规则字段rule;
2024-07-23 10:28:53 +08:00
3 changed files with 380 additions and 771 deletions

View File

@ -521,6 +521,44 @@ func (m *ErpCommodityListReq) List() (*ErpCommodityListResp, error) {
return resp, nil
}
// SortByErpSupplierId 对商品数组进行排序先按供应商ID排序如果相同则按商品编号排序升序
func SortByErpSupplierId(commodities []ErpCommodity, supplierIDDesc bool) {
// 定义排序函数
less := func(i, j int) bool {
// 按照供应商ID排序
if commodities[i].ErpSupplierId != commodities[j].ErpSupplierId {
if supplierIDDesc { // 降序 DESC
return commodities[i].ErpSupplierId > commodities[j].ErpSupplierId
}
return commodities[i].ErpSupplierId < commodities[j].ErpSupplierId // 升序 ASC
}
// 解析商品编号,提取分类编号和商品编号的数字部分
catNumI, subCatNumI, threeSubCatNumI, itemNumI := parseSerialNumber(commodities[i].SerialNumber)
catNumJ, subCatNumJ, threeSubCatNumJ, itemNumJ := parseSerialNumber(commodities[j].SerialNumber)
// 按照分类编号从小到大排序
if catNumI != catNumJ {
return catNumI < catNumJ
}
// 如果分类编号相同,按照具体分类下的商品编号递增排序
if subCatNumI != subCatNumJ {
return subCatNumI < subCatNumJ
}
if threeSubCatNumI != threeSubCatNumJ {
return threeSubCatNumI < threeSubCatNumJ
}
// 如果具体分类编号也相同,按照商品编号递增排序
return itemNumI < itemNumJ
}
// 调用排序函数进行排序
sort.SliceStable(commodities, less)
}
// SortStockCommodities 对库存商品数组进行排序
func SortStockCommodities(commodities []ErpStock) {
// 定义排序函数

View File

@ -12,18 +12,19 @@ const (
type Coupon struct {
Model
Name string `json:"name"`
Describe string `json:"describe" gorm:"type:text;"` // 描述
CouponType string `json:"coupon_type"`
ActivityType uint32 `json:"activity_type"` // 活动类型 1-会员续费
ActivityId uint32 `json:"activity_id" gorm:"index"`
Value uint32 `json:"value"`
OutCount uint32 `json:"out_count"` // 用户已领取数量
UsedCount uint32 `json:"used_count"` // 用户已使用数量
ActiveStart time.Time `json:"active_start"` // 有效期开始
ActiveEnd time.Time `json:"active_end"` // 有效期结束 零值永不结束
MemberLevel uint32 `json:"member_level"` // 会员等级 1-用户 2-会员
IsDraw bool `json:"is_draw" gorm:"-"`
Name string `json:"name"` // 优惠券名称
Describe string `json:"describe" gorm:"type:text"` // 优惠券简介
Rule string `json:"rule" gorm:"type:text"` // 优惠券使用规则
CouponType string `json:"coupon_type"` //
ActivityType uint32 `json:"activity_type"` // 活动类型 1-会员续费
ActivityId uint32 `json:"activity_id" gorm:"index"` //
Value uint32 `json:"value"` //
OutCount uint32 `json:"out_count"` // 用户已领取数量
UsedCount uint32 `json:"used_count"` // 用户已使用数量
ActiveStart time.Time `json:"active_start"` // 有效期开始
ActiveEnd time.Time `json:"active_end"` // 有效期结束 零值永不结束
MemberLevel uint32 `json:"member_level"` // 会员等级 1-用户 2-会员
IsDraw bool `json:"is_draw" gorm:"-"` //
}
// gen:qs

File diff suppressed because it is too large Load Diff