1、 商品资料、采购需求新增字段:厂家编码;
This commit is contained in:
parent
ddfa6b5de0
commit
3751999ca1
|
@ -102,6 +102,7 @@ func CommodityCreate(c *gin.Context) {
|
|||
Remark: req.Remark,
|
||||
Img: req.Img,
|
||||
StopPurchase: req.StopPurchase,
|
||||
ManufacturerCode: req.ManufacturerCode,
|
||||
}
|
||||
err = commodity.SetErpCategory()
|
||||
if err != nil {
|
||||
|
@ -267,6 +268,7 @@ func CommodityEdit(c *gin.Context) {
|
|||
Remark: req.Remark,
|
||||
Img: req.Img,
|
||||
StopPurchase: req.StopPurchase,
|
||||
ManufacturerCode: req.ManufacturerCode,
|
||||
}
|
||||
commodity.ID = req.Id
|
||||
err = commodity.SetErpCategory()
|
||||
|
|
|
@ -125,6 +125,7 @@ type ErpCommodity struct {
|
|||
StockCount uint32 `json:"stock_count" gorm:"-"` // 库存数量
|
||||
Img string `json:"img"` // 图片
|
||||
StopPurchase uint32 `json:"stop_purchase"` // 0-未勾选,正常采购;1-勾选,停止采购
|
||||
ManufacturerCode string `json:"manufacturer_code"` // 厂家编码
|
||||
|
||||
ErpCategory *ErpCategory `json:"erp_category" gorm:"-"`
|
||||
}
|
||||
|
@ -3627,6 +3628,7 @@ type CommodityCreateRequest struct {
|
|||
Remark string `json:"remark"` // 备注
|
||||
Img string `json:"img"` // 图片
|
||||
StopPurchase uint32 `json:"stop_purchase"` // 0-未勾选,正常采购;1-勾选,停止采购
|
||||
ManufacturerCode string `json:"manufacturer_code"` // 厂家编码
|
||||
}
|
||||
|
||||
type CommodityEditRequest struct {
|
||||
|
@ -3648,6 +3650,7 @@ type CommodityEditRequest struct {
|
|||
Remark string `json:"remark"` // 备注
|
||||
Img string `json:"img"` // 图片
|
||||
StopPurchase uint32 `json:"stop_purchase"` // 0-未勾选,正常采购;1-勾选,停止采购
|
||||
ManufacturerCode string `json:"manufacturer_code"` // 厂家编码
|
||||
}
|
||||
|
||||
type CommodityDetailRequest struct {
|
||||
|
|
|
@ -292,6 +292,7 @@ type DemandData struct {
|
|||
ErpCommodityName string `json:"erp_commodity_name"` // 商品名称
|
||||
ErpCategoryID uint32 `json:"erp_category_id"` // 商品分类id
|
||||
ErpCategoryName string `json:"erp_category_name"` // 商品分类名称
|
||||
ErpManufacturerCode string `json:"erp_manufacturer_code"` // 商品厂家编码
|
||||
Img string `json:"img"` // 图片
|
||||
RetailPrice float64 `json:"retail_price"` // 指导零售价
|
||||
LastWholesalePrice float64 `json:"last_wholesale_price"` // 最近采购价
|
||||
|
@ -2243,6 +2244,7 @@ func convertToDemandDataAll(commodity ErpCommodity, usedStore []uint32, stores [
|
|||
ErpCommodityID: commodity.ID,
|
||||
ErpCommoditySerialNumber: commodity.SerialNumber,
|
||||
ErpCommodityName: commodity.Name,
|
||||
ErpManufacturerCode: commodity.ManufacturerCode,
|
||||
ErpCategoryID: commodity.ErpCategoryId,
|
||||
ErpCategoryName: commodity.ErpCategoryName,
|
||||
RetailPrice: commodity.RetailPrice,
|
||||
|
@ -2545,6 +2547,7 @@ func convertToDemandData(commodity ErpCommodity, usedStore []uint32, stores []St
|
|||
ErpCommodityID: commodity.ID,
|
||||
ErpCommoditySerialNumber: commodity.SerialNumber,
|
||||
ErpCommodityName: commodity.Name,
|
||||
ErpManufacturerCode: commodity.ManufacturerCode,
|
||||
ErpCategoryID: commodity.ErpCategoryId,
|
||||
ErpCategoryName: commodity.ErpCategoryName,
|
||||
RetailPrice: commodity.RetailPrice,
|
||||
|
@ -2991,20 +2994,20 @@ func demandDataExport(list []DemandData) (string, error) {
|
|||
fmt.Println("url fileName:", url+fileName)
|
||||
|
||||
// 组合标题栏第一行数据
|
||||
title1 := []interface{}{"主供应商", "商品名称", "商品编号", "商品分类", "指导零售价", "最近采购价"}
|
||||
title1 := []interface{}{"主供应商", "商品名称", "商品编号", "商品分类", "厂家编码", "指导零售价", "最近采购价"}
|
||||
storeCount := len(list[0].StoreList)
|
||||
var mergeCells []string // 存储需要合并的单元格范围
|
||||
|
||||
for _, v := range list[0].StoreList {
|
||||
for i := 0; i < 3; i++ {
|
||||
for i := 0; i < 4; i++ {
|
||||
title1 = append(title1, v.StoreName)
|
||||
}
|
||||
}
|
||||
|
||||
for i := 0; i < storeCount; i++ {
|
||||
// 计算每个商户名称的起始和结束单元格
|
||||
startCol, _ := excelize.ColumnNumberToName(7 + i*3) // 从第7列开始,每个商户占3列
|
||||
endCol, _ := excelize.ColumnNumberToName(9 + i*3)
|
||||
startCol, _ := excelize.ColumnNumberToName(8 + i*4) // 从第8列开始,每个商户占4列
|
||||
endCol, _ := excelize.ColumnNumberToName(11 + i*4)
|
||||
mergeCell := startCol + "1:" + endCol + "1"
|
||||
mergeCells = append(mergeCells, mergeCell)
|
||||
}
|
||||
|
@ -3020,9 +3023,10 @@ func demandDataExport(list []DemandData) (string, error) {
|
|||
}
|
||||
|
||||
// 组合标题栏第二行数据
|
||||
title2 := []interface{}{"主供应商", "商品名称", "商品编号", "商品分类", "指导零售价", "最近采购价"}
|
||||
title2 := []interface{}{"主供应商", "商品名称", "商品编号", "商品分类", "厂家编码", "指导零售价", "最近采购价"}
|
||||
for _, _ = range list[0].StoreList {
|
||||
title2 = append(title2, "上月销售数")
|
||||
title2 = append(title2, "上周销售数")
|
||||
title2 = append(title2, "库存数量")
|
||||
title2 = append(title2, "需采购数")
|
||||
}
|
||||
|
@ -3054,6 +3058,7 @@ func demandDataExport(list []DemandData) (string, error) {
|
|||
list[i].ErpCommodityName, // 商品名称
|
||||
list[i].ErpCommoditySerialNumber, // 商品编号
|
||||
list[i].ErpCategoryName, // 商品分类名称
|
||||
list[i].ErpManufacturerCode, // 商品厂家编码
|
||||
list[i].RetailPrice, // 指导零售价
|
||||
list[i].LastWholesalePrice, // 最近采购价
|
||||
}
|
||||
|
@ -3065,6 +3070,12 @@ func demandDataExport(list []DemandData) (string, error) {
|
|||
row = append(row, "")
|
||||
}
|
||||
|
||||
if v.LastWeekSales != 0 {
|
||||
row = append(row, v.LastWeekSales) // 上周销售数
|
||||
} else {
|
||||
row = append(row, "")
|
||||
}
|
||||
|
||||
if v.StockCount != 0 {
|
||||
row = append(row, v.StockCount) // 库存数量
|
||||
} else {
|
||||
|
@ -3103,7 +3114,7 @@ func demandDataExport(list []DemandData) (string, error) {
|
|||
}
|
||||
|
||||
// 合并 "需采购总数量","需采购总金额" 和 "备注" 列的单元格
|
||||
strTotalCountCol, strTotalAmountCol, strRemarkCol := computeExtraColumns("F", storeCount)
|
||||
strTotalCountCol, strTotalAmountCol, strRemarkCol := computeExtraColumns("G", storeCount)
|
||||
_ = file.MergeCell(fSheet, strTotalCountCol+"1", strTotalCountCol+"2")
|
||||
_ = file.MergeCell(fSheet, strTotalAmountCol+"1", strTotalAmountCol+"2")
|
||||
_ = file.MergeCell(fSheet, strRemarkCol+"1", strRemarkCol+"2")
|
||||
|
@ -3125,6 +3136,7 @@ func demandDataExport(list []DemandData) (string, error) {
|
|||
_ = file.MergeCell(fSheet, "D1", "D2")
|
||||
_ = file.MergeCell(fSheet, "E1", "E2")
|
||||
_ = file.MergeCell(fSheet, "F1", "F2")
|
||||
_ = file.MergeCell(fSheet, "G1", "G2")
|
||||
|
||||
fmt.Println("save fileName:", config.ExportConfig.Path+fileName)
|
||||
if err := file.SaveAs(config.ExportConfig.Path + fileName); err != nil {
|
||||
|
@ -3155,8 +3167,8 @@ func demandDataExportOnShopAssistant(list []DemandData) (string, error) {
|
|||
|
||||
for i := 0; i < storeCount; i++ {
|
||||
// 计算每个商户名称的起始和结束单元格
|
||||
startCol, _ := excelize.ColumnNumberToName(5 + i*3) // 从第5列开始,每个商户占3列
|
||||
endCol, _ := excelize.ColumnNumberToName(7 + i*3)
|
||||
startCol, _ := excelize.ColumnNumberToName(5 + i*4) // 从第5列开始,每个商户占4列
|
||||
endCol, _ := excelize.ColumnNumberToName(7 + i*4)
|
||||
mergeCell := startCol + "1:" + endCol + "1"
|
||||
mergeCells = append(mergeCells, mergeCell)
|
||||
}
|
||||
|
@ -3173,6 +3185,7 @@ func demandDataExportOnShopAssistant(list []DemandData) (string, error) {
|
|||
title2 := []interface{}{"商品名称", "商品编号", "商品分类", "指导零售价"}
|
||||
for _, _ = range list[0].StoreList {
|
||||
title2 = append(title2, "上月销售数")
|
||||
title2 = append(title2, "上周销售数")
|
||||
title2 = append(title2, "库存数量")
|
||||
title2 = append(title2, "需采购数")
|
||||
}
|
||||
|
@ -3211,6 +3224,12 @@ func demandDataExportOnShopAssistant(list []DemandData) (string, error) {
|
|||
row = append(row, "")
|
||||
}
|
||||
|
||||
if v.LastWeekSales != 0 {
|
||||
row = append(row, v.LastWeekSales) // 上周销售数
|
||||
} else {
|
||||
row = append(row, "")
|
||||
}
|
||||
|
||||
if v.StockCount != 0 {
|
||||
row = append(row, v.StockCount) // 库存数量
|
||||
} else {
|
||||
|
@ -3275,7 +3294,7 @@ func splitMergeCellCoordinates(cell string) (string, string) {
|
|||
// 计算 "需采购总数量","需采购总金额" 和 "备注" 列的坐标字符串
|
||||
func computeExtraColumns(startCol string, storeCount int) (string, string, string) {
|
||||
// "需采购总数量" 列在商户列表结束后的下一列
|
||||
totalCountCol := convertColumnToLetters(convertLettersToColumn(startCol) + storeCount*3 + 1)
|
||||
totalCountCol := convertColumnToLetters(convertLettersToColumn(startCol) + storeCount*4 + 1)
|
||||
|
||||
// "需采购总金额" 列在 "需采购总数量" 列的下一列
|
||||
totalAmountCol := convertColumnToLetters(convertLettersToColumn(totalCountCol) + 1)
|
||||
|
|
16
docs/docs.go
16
docs/docs.go
|
@ -7474,6 +7474,10 @@ const docTemplate = `{
|
|||
"description": "是否串码:1-串码类 2-非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"manufacturer_code": {
|
||||
"description": "厂家编码",
|
||||
"type": "string"
|
||||
},
|
||||
"member_discount": {
|
||||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
|
@ -7584,6 +7588,10 @@ const docTemplate = `{
|
|||
"description": "是否串码:1-串码类 2-非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"manufacturer_code": {
|
||||
"description": "厂家编码",
|
||||
"type": "string"
|
||||
},
|
||||
"member_discount": {
|
||||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
|
@ -8480,6 +8488,10 @@ const docTemplate = `{
|
|||
"description": "商品编号",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_manufacturer_code": {
|
||||
"description": "商品厂家编码",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "主供应商id",
|
||||
"type": "integer"
|
||||
|
@ -8816,6 +8828,10 @@ const docTemplate = `{
|
|||
"description": "是否串码:1-串码类 2-非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"manufacturer_code": {
|
||||
"description": "厂家编码",
|
||||
"type": "string"
|
||||
},
|
||||
"member_discount": {
|
||||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
|
|
|
@ -7463,6 +7463,10 @@
|
|||
"description": "是否串码:1-串码类 2-非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"manufacturer_code": {
|
||||
"description": "厂家编码",
|
||||
"type": "string"
|
||||
},
|
||||
"member_discount": {
|
||||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
|
@ -7573,6 +7577,10 @@
|
|||
"description": "是否串码:1-串码类 2-非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"manufacturer_code": {
|
||||
"description": "厂家编码",
|
||||
"type": "string"
|
||||
},
|
||||
"member_discount": {
|
||||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
|
@ -8469,6 +8477,10 @@
|
|||
"description": "商品编号",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_manufacturer_code": {
|
||||
"description": "商品厂家编码",
|
||||
"type": "string"
|
||||
},
|
||||
"erp_supplier_id": {
|
||||
"description": "主供应商id",
|
||||
"type": "integer"
|
||||
|
@ -8805,6 +8817,10 @@
|
|||
"description": "是否串码:1-串码类 2-非串码",
|
||||
"type": "integer"
|
||||
},
|
||||
"manufacturer_code": {
|
||||
"description": "厂家编码",
|
||||
"type": "string"
|
||||
},
|
||||
"member_discount": {
|
||||
"description": "会员优惠",
|
||||
"type": "number"
|
||||
|
|
|
@ -570,6 +570,9 @@ definitions:
|
|||
is_imei:
|
||||
description: 是否串码:1-串码类 2-非串码
|
||||
type: integer
|
||||
manufacturer_code:
|
||||
description: 厂家编码
|
||||
type: string
|
||||
member_discount:
|
||||
description: 会员优惠
|
||||
type: number
|
||||
|
@ -649,6 +652,9 @@ definitions:
|
|||
is_imei:
|
||||
description: 是否串码:1-串码类 2-非串码
|
||||
type: integer
|
||||
manufacturer_code:
|
||||
description: 厂家编码
|
||||
type: string
|
||||
member_discount:
|
||||
description: 会员优惠
|
||||
type: number
|
||||
|
@ -1314,6 +1320,9 @@ definitions:
|
|||
erp_commodity_serial_number:
|
||||
description: 商品编号
|
||||
type: string
|
||||
erp_manufacturer_code:
|
||||
description: 商品厂家编码
|
||||
type: string
|
||||
erp_supplier_id:
|
||||
description: 主供应商id
|
||||
type: integer
|
||||
|
@ -1557,6 +1566,9 @@ definitions:
|
|||
is_imei:
|
||||
description: 是否串码:1-串码类 2-非串码
|
||||
type: integer
|
||||
manufacturer_code:
|
||||
description: 厂家编码
|
||||
type: string
|
||||
member_discount:
|
||||
description: 会员优惠
|
||||
type: number
|
||||
|
|
Loading…
Reference in New Issue
Block a user