1.修复缺陷,优化代码:
(1)零售退货时增加"库存已有该串码商品"的判断; (2)门店经营数据中销售数量类型改为int64,可能有负值; (3)零售明细中字段类型int32调整为float64,包含:RetailPrice、SalePrice、WholesalePrice、StaffPrice; (4)库存调拨商品信息表增加字段:CategoryId、CategoryName;
This commit is contained in:
parent
4696c63778
commit
4bf39f8cdb
|
@ -98,7 +98,11 @@ func ErpOrderList(c *gin.Context) {
|
||||||
resp, err := req.List(c)
|
resp, err := req.List(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("erp commodity list err:", logger.Field("err", err))
|
logger.Error("erp commodity list err:", logger.Field("err", err))
|
||||||
|
if err.Error() == "库存已有该串码商品" {
|
||||||
|
app.Error(c, http.StatusInternalServerError, err, err.Error())
|
||||||
|
} else {
|
||||||
app.Error(c, http.StatusInternalServerError, err, "查询失败:"+err.Error())
|
app.Error(c, http.StatusInternalServerError, err, "查询失败:"+err.Error())
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,7 @@ func InsertSysUser(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 是否已经绑定过账号
|
// 是否已经绑定过账号
|
||||||
if userInfo.UserType == 2 {
|
if userInfo.UserType == models.UserTypeShopAssistant {
|
||||||
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID重复,请检查")
|
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID重复,请检查")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -239,7 +239,7 @@ func InsertSysUser(c *gin.Context) {
|
||||||
|
|
||||||
// 如果添加了小程序id,则需要更新user表的user_type字段为2-店员
|
// 如果添加了小程序id,则需要更新user表的user_type字段为2-店员
|
||||||
if req.Uid != 0 {
|
if req.Uid != 0 {
|
||||||
err = models.UpdateUserType(begin, req.Uid, 2)
|
err = models.UpdateUserType(begin, req.Uid, models.UserTypeShopAssistant)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
begin.Rollback()
|
begin.Rollback()
|
||||||
logger.Error("UpdateUserType err:", logger.Field("err", err))
|
logger.Error("UpdateUserType err:", logger.Field("err", err))
|
||||||
|
@ -296,7 +296,7 @@ func UpdateSysUser(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// 是否已经绑定过账号
|
// 是否已经绑定过账号
|
||||||
if userInfo.UserType == 2 {
|
if userInfo.UserType == models.UserTypeShopAssistant {
|
||||||
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID重复,请检查")
|
app.Error(c, http.StatusInternalServerError, err, "小程序账号ID重复,请检查")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -341,12 +341,12 @@ func UpdateSysUser(c *gin.Context) {
|
||||||
|
|
||||||
// 判断是否修改了uid
|
// 判断是否修改了uid
|
||||||
if sysInfo.Uid == 0 && req.Uid != 0 { // 新增uid,直接更新为2即可
|
if sysInfo.Uid == 0 && req.Uid != 0 { // 新增uid,直接更新为2即可
|
||||||
err = models.UpdateUserType(begin, req.Uid, 2)
|
err = models.UpdateUserType(begin, req.Uid, models.UserTypeShopAssistant)
|
||||||
} else if sysInfo.Uid != 0 {
|
} else if sysInfo.Uid != 0 {
|
||||||
if sysInfo.Uid != req.Uid {
|
if sysInfo.Uid != req.Uid {
|
||||||
if req.Uid != 0 {
|
if req.Uid != 0 {
|
||||||
// 原uid的状态更新为1
|
// 原uid的状态更新为1
|
||||||
err = models.UpdateUserType(begin, sysInfo.Uid, 1)
|
err = models.UpdateUserType(begin, sysInfo.Uid, models.UserTypeConsumer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
begin.Rollback()
|
begin.Rollback()
|
||||||
logger.Error("UpdateUserType err:", logger.Field("err", err))
|
logger.Error("UpdateUserType err:", logger.Field("err", err))
|
||||||
|
@ -356,7 +356,7 @@ func UpdateSysUser(c *gin.Context) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 新uid状态更新为2
|
// 新uid状态更新为2
|
||||||
err = models.UpdateUserType(begin, req.Uid, 2)
|
err = models.UpdateUserType(begin, req.Uid, models.UserTypeShopAssistant)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -270,7 +270,7 @@ type StoreManageData struct {
|
||||||
PromotionFee float64 `json:"promotion_fee"` // 推广费
|
PromotionFee float64 `json:"promotion_fee"` // 推广费
|
||||||
SalesProfit float64 `json:"sales_profit"` // 销售毛利
|
SalesProfit float64 `json:"sales_profit"` // 销售毛利
|
||||||
StaffProfit float64 `json:"staff_profit"` // 员工毛利
|
StaffProfit float64 `json:"staff_profit"` // 员工毛利
|
||||||
Count uint32 `json:"count"` // 销售数量
|
Count int64 `json:"count"` // 销售数量
|
||||||
}
|
}
|
||||||
|
|
||||||
// ErpOrderRetailMarginReq 查询商品零售毛利汇总入参
|
// ErpOrderRetailMarginReq 查询商品零售毛利汇总入参
|
||||||
|
@ -346,14 +346,14 @@ type ErpOrderRetailDetailResp struct {
|
||||||
// RetailDetailTotalData 零售明细相关金额汇总
|
// RetailDetailTotalData 零售明细相关金额汇总
|
||||||
type RetailDetailTotalData struct {
|
type RetailDetailTotalData struct {
|
||||||
Count int32 `json:"count"` // 销售数量
|
Count int32 `json:"count"` // 销售数量
|
||||||
RetailPrice int32 `json:"retail_price"` // 指导零售价
|
RetailPrice float64 `json:"retail_price"` // 指导零售价
|
||||||
SalePrice int32 `json:"sale_price"` // 零售价
|
SalePrice float64 `json:"sale_price"` // 零售价
|
||||||
SaleDiscount float64 `json:"sale_discount"` // 零售优惠
|
SaleDiscount float64 `json:"sale_discount"` // 零售优惠
|
||||||
MemberDiscount float64 `json:"member_discount"` // 会员优惠
|
MemberDiscount float64 `json:"member_discount"` // 会员优惠
|
||||||
VmDiscount float64 `json:"vm_discount"` // 会员积分抵扣
|
VmDiscount float64 `json:"vm_discount"` // 会员积分抵扣
|
||||||
Amount float64 `json:"amount"` // 实际零售价
|
Amount float64 `json:"amount"` // 实际零售价
|
||||||
WholesalePrice int32 `json:"wholesale_price"` // 采购单价
|
WholesalePrice float64 `json:"wholesale_price"` // 采购单价
|
||||||
StaffPrice int32 `json:"staff_price"` // 员工成本价
|
StaffPrice float64 `json:"staff_price"` // 员工成本价
|
||||||
SalesProfit float64 `json:"sales_profit"` // 销售毛利
|
SalesProfit float64 `json:"sales_profit"` // 销售毛利
|
||||||
StaffProfit float64 `json:"staff_profit"` // 员工毛利
|
StaffProfit float64 `json:"staff_profit"` // 员工毛利
|
||||||
TotalRetailPrice float64 `json:"total_retail_price"` // 订单总指导零售价
|
TotalRetailPrice float64 `json:"total_retail_price"` // 订单总指导零售价
|
||||||
|
@ -602,19 +602,39 @@ func (m *ErpOrderListReq) List(c *gin.Context) (*ErpOrderListResp, error) {
|
||||||
func QueryListByScanCode(scanCode, showConfig string, c *gin.Context) (*ErpOrderListResp, error) {
|
func QueryListByScanCode(scanCode, showConfig string, c *gin.Context) (*ErpOrderListResp, error) {
|
||||||
resp := &ErpOrderListResp{}
|
resp := &ErpOrderListResp{}
|
||||||
|
|
||||||
|
// 查询扫码串码的零售销售订单的商品信息
|
||||||
var commodity []ErpOrderCommodity
|
var commodity []ErpOrderCommodity
|
||||||
err := orm.Eloquent.Table("erp_order_commodity").Where("imei = ?", scanCode).Find(&commodity).Error
|
err := orm.Eloquent.Table("erp_order_commodity").Where("imei = ? and rejected_count = 0", scanCode).Find(&commodity).Error
|
||||||
if err != nil && err != RecordNotFound {
|
if err != nil && err != RecordNotFound {
|
||||||
logger.Error("get erp_order_commodity err:", logger.Field("err", err))
|
logger.Error("get erp_order_commodity err:", logger.Field("err", err))
|
||||||
return resp, err
|
return resp, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(commodity) == 0 {
|
||||||
|
return &ErpOrderListResp{}, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断该串码商品是否已经退货退回库存列表
|
||||||
|
var stockCount int64
|
||||||
|
err = orm.Eloquent.Table("erp_stock_commodity").
|
||||||
|
Where("state = 1 AND imei = ?", scanCode).Count(&stockCount).Error
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if stockCount > 0 {
|
||||||
|
return nil, errors.New("库存已有该串码商品")
|
||||||
|
}
|
||||||
|
|
||||||
var orders []ErpOrder
|
var orders []ErpOrder
|
||||||
for _, item := range commodity {
|
for _, item := range commodity {
|
||||||
if showConfig == "OFF" {
|
if showConfig == "OFF" {
|
||||||
err = orm.Eloquent.Table("erp_order").Where("id = ? and pay_status = ? and is_print != ?", item.ErpOrderId, HavePaid, NoPrint).Find(&orders).Error
|
err = orm.Eloquent.Table("erp_order").
|
||||||
|
Where("id = ? and pay_status = ? and is_print != ?", item.ErpOrderId, HavePaid, NoPrint).
|
||||||
|
Order("audit_time DESC").Find(&orders).Error
|
||||||
} else {
|
} else {
|
||||||
err = orm.Eloquent.Table("erp_order").Where("id = ? and pay_status = ?", item.ErpOrderId, HavePaid).Find(&orders).Error
|
err = orm.Eloquent.Table("erp_order").
|
||||||
|
Where("id = ? and pay_status = ?", item.ErpOrderId, HavePaid).
|
||||||
|
Order("audit_time DESC").Find(&orders).Error
|
||||||
}
|
}
|
||||||
if err != nil && err != RecordNotFound {
|
if err != nil && err != RecordNotFound {
|
||||||
logger.Error("get erp_order err:", logger.Field("err", err))
|
logger.Error("get erp_order err:", logger.Field("err", err))
|
||||||
|
@ -647,10 +667,15 @@ func QueryListByScanCode(scanCode, showConfig string, c *gin.Context) (*ErpOrder
|
||||||
erpOrderListSetCashier(orders)
|
erpOrderListSetCashier(orders)
|
||||||
erpOrderListSetSalesman(orders)
|
erpOrderListSetSalesman(orders)
|
||||||
|
|
||||||
|
if len(orders) != 0 {
|
||||||
|
// 查询该串码商品是否已经退过货
|
||||||
|
resp.List = append(resp.List, orders[0])
|
||||||
|
} else {
|
||||||
resp.List = orders
|
resp.List = orders
|
||||||
|
}
|
||||||
|
|
||||||
//跟之前保持一致
|
//跟之前保持一致
|
||||||
resp.Total = 1
|
resp.Total = len(resp.List)
|
||||||
resp.PageIndex = 1
|
resp.PageIndex = 1
|
||||||
resp.PageSize = 10
|
resp.PageSize = 10
|
||||||
|
|
||||||
|
@ -1271,7 +1296,7 @@ func erpOrderListSetCashier(list []ErpOrder) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *ErpOrder) SetErpCashier() {
|
func (m *ErpOrder) SetErpCashier() {
|
||||||
if m.CashierList != "" {
|
if m.CashierList != "" && m.RetailType == RetailTypeSale { // 临时限制,退货订单不展示具体付款方式
|
||||||
var cashiers []ErpOrderCashier
|
var cashiers []ErpOrderCashier
|
||||||
err := json.Unmarshal([]byte(m.CashierList), &cashiers)
|
err := json.Unmarshal([]byte(m.CashierList), &cashiers)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -729,7 +729,7 @@ type GameCardGoodsStock struct {
|
||||||
RentStock uint32 `json:"rent_stock"` // 租借库存
|
RentStock uint32 `json:"rent_stock"` // 租借库存
|
||||||
UserHoldStock uint32 `json:"user_hold_stock"`
|
UserHoldStock uint32 `json:"user_hold_stock"`
|
||||||
OrderCount uint32 `json:"order_count"`
|
OrderCount uint32 `json:"order_count"`
|
||||||
TotalStock uint32 `json:"total_stock"`
|
TotalStock uint32 `json:"total_stock"` // 卡池-总数
|
||||||
Name string `json:"name" gorm:"-"` // 名称
|
Name string `json:"name" gorm:"-"` // 名称
|
||||||
CoverImg string `json:"cover_img" gorm:"-"` // 封面
|
CoverImg string `json:"cover_img" gorm:"-"` // 封面
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ type ErpInventoryAllotCommodity struct {
|
||||||
AllotOrderId uint32 `json:"allot_order_id" gorm:"index"` // 库存调拨订单表id
|
AllotOrderId uint32 `json:"allot_order_id" gorm:"index"` // 库存调拨订单表id
|
||||||
CommodityId uint32 `json:"commodity_id" gorm:"index"` // 商品id
|
CommodityId uint32 `json:"commodity_id" gorm:"index"` // 商品id
|
||||||
CommodityName string `json:"commodity_name"` // 商品名称
|
CommodityName string `json:"commodity_name"` // 商品名称
|
||||||
|
CategoryId uint32 `json:"category_id" gorm:"index"` // 分类id
|
||||||
|
CategoryName string `json:"category_name"` // 分类名称
|
||||||
IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码
|
IMEIType uint32 `json:"imei_type"` // 1-无串码 2-串码
|
||||||
IMEI string `json:"imei"` // 商品串码
|
IMEI string `json:"imei"` // 商品串码
|
||||||
Count uint32 `json:"count"` // 数量
|
Count uint32 `json:"count"` // 数量
|
||||||
|
@ -261,6 +263,17 @@ func AddInventoryAllot(req *InventoryAllotAddReq, sysUser *SysUser) (*ErpInvento
|
||||||
// 创建库存调拨商品信息,添加库存调拨订单id
|
// 创建库存调拨商品信息,添加库存调拨订单id
|
||||||
for i, _ := range req.Commodities {
|
for i, _ := range req.Commodities {
|
||||||
req.Commodities[i].AllotOrderId = inventoryAllotOrder.ID
|
req.Commodities[i].AllotOrderId = inventoryAllotOrder.ID
|
||||||
|
|
||||||
|
// 查询商品信息
|
||||||
|
commodityInfo, err := GetCommodity(req.Commodities[i].CommodityId)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error("SetCategory err:", logger.Field("err", err))
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
req.Commodities[i].CategoryId = commodityInfo.ErpCategoryId
|
||||||
|
req.Commodities[i].CategoryName = commodityInfo.ErpCategoryName
|
||||||
|
|
||||||
err = begin.Create(&req.Commodities[i]).Error
|
err = begin.Create(&req.Commodities[i]).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
begin.Rollback()
|
begin.Rollback()
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"go-admin/logger"
|
"go-admin/logger"
|
||||||
"go-admin/tools"
|
"go-admin/tools"
|
||||||
"go-admin/tools/config"
|
"go-admin/tools/config"
|
||||||
|
"math"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
@ -30,13 +31,17 @@ type InventoryReportByProductResp struct {
|
||||||
Total uint32 `json:"total"` // 总条数/记录数
|
Total uint32 `json:"total"` // 总条数/记录数
|
||||||
PageIndex int `json:"pageIndex"` // 页码
|
PageIndex int `json:"pageIndex"` // 页码
|
||||||
PageSize int `json:"pageSize"` // 页面条数
|
PageSize int `json:"pageSize"` // 页面条数
|
||||||
|
ReportByProductSumData
|
||||||
|
ExportUrl string `json:"export_url"` // 导出excel路径
|
||||||
|
List []ReportByProductData `json:"list"` //
|
||||||
|
}
|
||||||
|
|
||||||
|
type ReportByProductSumData struct {
|
||||||
TotalEffectiveCount uint32 `json:"total_effective_count"` // 有效库存数
|
TotalEffectiveCount uint32 `json:"total_effective_count"` // 有效库存数
|
||||||
TotalTransferCount uint32 `json:"total_transfer_count"` // 调入中数量
|
TotalTransferCount uint32 `json:"total_transfer_count"` // 调入中数量
|
||||||
TotalCount uint32 `json:"total_count"` // 总数量
|
TotalCount uint32 `json:"total_count"` // 总数量
|
||||||
TotalEffectiveAmount float64 `json:"total_effective_amount"` // 有效库存金额
|
TotalEffectiveAmount float64 `json:"total_effective_amount"` // 有效库存金额
|
||||||
TotalTransferAmount float64 `json:"total_transfer_amount"` // 调入中金额
|
TotalTransferAmount float64 `json:"total_transfer_amount"` // 调入中金额
|
||||||
ExportUrl string `json:"export_url"` // 导出excel路径
|
|
||||||
List []ReportByProductData `json:"list"` //
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReportByProductData 产品库存汇总(按门店)数据
|
// ReportByProductData 产品库存汇总(按门店)数据
|
||||||
|
@ -275,7 +280,7 @@ func (m *InventoryReportByProductReq) ReportByProductList(c *gin.Context) (*Inve
|
||||||
for _, category := range m.CategoryID {
|
for _, category := range m.CategoryID {
|
||||||
categoryIDs = append(categoryIDs, category)
|
categoryIDs = append(categoryIDs, category)
|
||||||
}
|
}
|
||||||
qs = qs.Where("category_id IN (?)", categoryIDs)
|
qs = qs.Where("erp_category_id IN (?)", categoryIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(m.CommoditySerialNumber) > 0 { // 商品编号
|
if len(m.CommoditySerialNumber) > 0 { // 商品编号
|
||||||
|
@ -291,7 +296,7 @@ func (m *InventoryReportByProductReq) ReportByProductList(c *gin.Context) (*Inve
|
||||||
for _, commodityName := range m.CommodityName {
|
for _, commodityName := range m.CommodityName {
|
||||||
commodityNames = append(commodityNames, commodityName)
|
commodityNames = append(commodityNames, commodityName)
|
||||||
}
|
}
|
||||||
qs = qs.Where("commodity_name IN (?)", commodityNames)
|
qs = qs.Where("erp_commodity_name IN (?)", commodityNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
var count int64
|
var count int64
|
||||||
|
@ -353,12 +358,17 @@ func (m *InventoryReportByProductReq) ReportByProductList(c *gin.Context) (*Inve
|
||||||
reportList = append(reportList, reportData)
|
reportList = append(reportList, reportData)
|
||||||
}
|
}
|
||||||
|
|
||||||
resp.TotalEffectiveCount = nTotalEffectiveCount
|
sumData, err := getReportByProductSumData()
|
||||||
resp.TotalTransferCount = nTotalTransferCount
|
if err != nil {
|
||||||
resp.TotalCount = resp.TotalTransferCount + resp.TotalEffectiveCount
|
return nil, err
|
||||||
resp.TotalEffectiveAmount = nTotalEffectiveAmount
|
}
|
||||||
resp.TotalTransferAmount = nTotalTransferAmount
|
|
||||||
resp.Total = resp.TotalCount
|
resp.TotalEffectiveCount = sumData.TotalEffectiveCount
|
||||||
|
resp.TotalTransferCount = sumData.TotalTransferCount
|
||||||
|
resp.TotalCount = sumData.TotalCount
|
||||||
|
resp.TotalEffectiveAmount = sumData.TotalEffectiveAmount
|
||||||
|
resp.TotalTransferAmount = sumData.TotalTransferAmount
|
||||||
|
resp.Total = uint32(count)
|
||||||
resp.List = reportList
|
resp.List = reportList
|
||||||
|
|
||||||
if m.IsExport == 1 { // 导出excel
|
if m.IsExport == 1 { // 导出excel
|
||||||
|
@ -420,6 +430,30 @@ func getDispatchCommodityAmount(storeId, commodityId uint32) (float64, error) {
|
||||||
return nDispatchCommodityAmount, nil
|
return nDispatchCommodityAmount, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询产品库存汇总(按门店)的汇总数据:总有效库存数、总调入中数量、总数量、总有效库存金额、总调入中金额
|
||||||
|
func getReportByProductSumData() (ReportByProductSumData, error) {
|
||||||
|
var data ReportByProductSumData
|
||||||
|
|
||||||
|
// 查询汇总数据
|
||||||
|
err := orm.Eloquent.Debug().Table("erp_stock_commodity").
|
||||||
|
Select(`
|
||||||
|
SUM(CASE WHEN state = ? THEN wholesale_price ELSE 0 END) AS total_effective_amount,
|
||||||
|
SUM(CASE WHEN state = ? THEN wholesale_price ELSE 0 END) AS total_transfer_amount,
|
||||||
|
SUM(CASE WHEN state = ? THEN Count ELSE 0 END) AS total_effective_count,
|
||||||
|
SUM(CASE WHEN state = ? THEN Count ELSE 0 END) AS total_transfer_count,
|
||||||
|
SUM(CASE WHEN state IN (?, ?) THEN Count ELSE 0 END) AS total_count
|
||||||
|
`, InStock, InAllot, InStock, InAllot, InStock, InAllot).
|
||||||
|
Find(&data).Error
|
||||||
|
if err != nil {
|
||||||
|
return data, err
|
||||||
|
}
|
||||||
|
|
||||||
|
data.TotalEffectiveAmount = math.Round(data.TotalEffectiveAmount*100) / 100
|
||||||
|
data.TotalTransferAmount = math.Round(data.TotalTransferAmount*100) / 100
|
||||||
|
|
||||||
|
return data, nil
|
||||||
|
}
|
||||||
|
|
||||||
// reportByProductExport 产品库存汇总(按门店)导出excel
|
// reportByProductExport 产品库存汇总(按门店)导出excel
|
||||||
func reportByProductExport(req *InventoryReportByProductResp) (string, error) {
|
func reportByProductExport(req *InventoryReportByProductResp) (string, error) {
|
||||||
file := excelize.NewFile()
|
file := excelize.NewFile()
|
||||||
|
@ -894,6 +928,8 @@ func (m *InventoryReportAllotDetailReq) ReportAllotDetailList(c *gin.Context) (*
|
||||||
"END AS state, "+
|
"END AS state, "+
|
||||||
"erp_inventory_allot_commodity.commodity_id, "+
|
"erp_inventory_allot_commodity.commodity_id, "+
|
||||||
"erp_inventory_allot_commodity.commodity_name, "+
|
"erp_inventory_allot_commodity.commodity_name, "+
|
||||||
|
"erp_inventory_allot_commodity.category_id, "+
|
||||||
|
"erp_inventory_allot_commodity.category_name, "+
|
||||||
"erp_inventory_allot_commodity.imei_type, "+
|
"erp_inventory_allot_commodity.imei_type, "+
|
||||||
"erp_inventory_allot_commodity.imei, "+
|
"erp_inventory_allot_commodity.imei, "+
|
||||||
"erp_inventory_allot_commodity.count, "+
|
"erp_inventory_allot_commodity.count, "+
|
||||||
|
@ -934,8 +970,8 @@ func (m *InventoryReportAllotDetailReq) ReportAllotDetailList(c *gin.Context) (*
|
||||||
for _, commodityName := range m.CommodityName {
|
for _, commodityName := range m.CommodityName {
|
||||||
commodityNames = append(commodityNames, commodityName)
|
commodityNames = append(commodityNames, commodityName)
|
||||||
}
|
}
|
||||||
qs = qs.Where("erp_inventory_allot_order.commodity_name IN (?)", commodityNames)
|
qs = qs.Where("erp_inventory_allot_commodity.commodity_name IN (?)", commodityNames)
|
||||||
countQuery = countQuery.Where("erp_inventory_allot_order.commodity_name IN (?)", commodityNames)
|
countQuery = countQuery.Where("erp_inventory_allot_commodity.commodity_name IN (?)", commodityNames)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(m.CategoryID) > 0 { // 商品分类id
|
if len(m.CategoryID) > 0 { // 商品分类id
|
||||||
|
@ -943,8 +979,8 @@ func (m *InventoryReportAllotDetailReq) ReportAllotDetailList(c *gin.Context) (*
|
||||||
for _, category := range m.CategoryID {
|
for _, category := range m.CategoryID {
|
||||||
categoryIDs = append(categoryIDs, category)
|
categoryIDs = append(categoryIDs, category)
|
||||||
}
|
}
|
||||||
qs = qs.Where("erp_inventory_allot_order.category_id IN (?)", categoryIDs)
|
qs = qs.Where("erp_inventory_allot_commodity.category_id IN (?)", categoryIDs)
|
||||||
countQuery = countQuery.Where("erp_inventory_allot_order.category_id IN (?)", categoryIDs)
|
countQuery = countQuery.Where("erp_inventory_allot_commodity.category_id IN (?)", categoryIDs)
|
||||||
}
|
}
|
||||||
|
|
||||||
if m.State != 0 { // 调拨状态
|
if m.State != 0 { // 调拨状态
|
||||||
|
@ -1015,8 +1051,8 @@ func (m *InventoryReportAllotDetailReq) ReportAllotDetailList(c *gin.Context) (*
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加分类信息
|
//// 添加分类信息
|
||||||
reportAllotDetailSetCategory(commodities)
|
//reportAllotDetailSetCategory(commodities)
|
||||||
|
|
||||||
resp.Total = count
|
resp.Total = count
|
||||||
resp.List = commodities
|
resp.List = commodities
|
||||||
|
|
|
@ -1314,14 +1314,16 @@ func InventoryErpPurchaseUpdateStock(gdb *gorm.DB, list []ErpPurchaseInventory,
|
||||||
}
|
}
|
||||||
|
|
||||||
// 遍历库存信息,合并重复数据
|
// 遍历库存信息,合并重复数据
|
||||||
|
if len(waitCreateStockList) > 0 {
|
||||||
newStockList := combineStocks(waitCreateStockList)
|
newStockList := combineStocks(waitCreateStockList)
|
||||||
err := gdb.Debug().Create(&newStockList).Error
|
err := gdb.Debug().Create(&newStockList).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("create erp_stock err:", err)
|
logger.Errorf("create erp_stock err:", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = gdb.Debug().Create(&stockList).Error
|
err := gdb.Debug().Create(&stockList).Error
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("create erp_stock_commodity err:", err)
|
logger.Errorf("create erp_stock_commodity err:", err)
|
||||||
return err
|
return err
|
||||||
|
|
|
@ -50,8 +50,8 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MemberLevelConsumer = 10 // 普通用户
|
MemberLevelConsumer = 10 // 普通用户:有开过零售单,留了手机号,但是小程序端未登陆过的,仍然是普通用户
|
||||||
MemberLevelUser = 1 // 普通会员
|
MemberLevelUser = 1 // 普通会员:仅进入了小程序且授权过手机号的为会员用户,未开通租卡会员的为“普通会员”
|
||||||
MemberLevelGold = 2 // 黄金会员
|
MemberLevelGold = 2 // 黄金会员
|
||||||
MemberLevelPeriod = 3 // 短期会员
|
MemberLevelPeriod = 3 // 短期会员
|
||||||
MemberLevelPlatinum = 4 // 白金会员
|
MemberLevelPlatinum = 4 // 白金会员
|
||||||
|
@ -256,7 +256,7 @@ type U struct {
|
||||||
UserInfo
|
UserInfo
|
||||||
MemberExpireDays uint32 `json:"member_expire_days"` // 会员过期天数
|
MemberExpireDays uint32 `json:"member_expire_days"` // 会员过期天数
|
||||||
OrderCount int `json:"order_count"` // 消费次数
|
OrderCount int `json:"order_count"` // 消费次数
|
||||||
OrderAmount int `json:"order_amount"` // 消费金额
|
OrderAmount float64 `json:"order_amount"` // 消费金额
|
||||||
}
|
}
|
||||||
|
|
||||||
type NewUserListReq struct {
|
type NewUserListReq struct {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user