合并请求
This commit is contained in:
@@ -1096,6 +1096,11 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
return nil, fmt.Errorf("商品:%s价格:%s太夸张", allBinds[0].Name, jxutils.IntPrice2StandardCurrencyString(int64(skuBindInfo.UnitPrice)))
|
||||
}
|
||||
unitPrice = skuBindInfo.UnitPrice
|
||||
if isRefreshHigh {
|
||||
if allBinds[0].UnitPrice <= unitPrice {
|
||||
continue
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unitPrice = allBinds[0].UnitPrice
|
||||
if unitPrice == 0 {
|
||||
@@ -1213,21 +1218,11 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs
|
||||
setStoreSkuBindStatus(skuBind, model.SyncFlagPriceMask)
|
||||
updateFieldMap["Price"] = 1
|
||||
}
|
||||
if isRefreshHigh {
|
||||
if beforeMsg.UnitPrice > skuBindInfo.UnitPrice {
|
||||
skuBind.UnitPrice = unitPrice
|
||||
skuBind.Price = price
|
||||
skuBind.JxPrice = jxPrice
|
||||
updateFieldMap["UnitPrice"] = 1
|
||||
updateFieldMap["JxPrice"] = 1
|
||||
}
|
||||
} else {
|
||||
skuBind.UnitPrice = unitPrice
|
||||
skuBind.Price = price
|
||||
skuBind.JxPrice = jxPrice
|
||||
updateFieldMap["UnitPrice"] = 1
|
||||
updateFieldMap["JxPrice"] = 1
|
||||
}
|
||||
skuBind.UnitPrice = unitPrice
|
||||
skuBind.Price = price
|
||||
skuBind.JxPrice = jxPrice
|
||||
updateFieldMap["UnitPrice"] = 1
|
||||
updateFieldMap["JxPrice"] = 1
|
||||
}
|
||||
}
|
||||
if skuBindInfo.StatusSaleBegin != 0 && skuBindInfo.StatusSaleEnd != 0 {
|
||||
@@ -1739,6 +1734,41 @@ func CopyStoreSkus(ctx *jxcontext.Context, fromStoreID int, toStoreIDs []int, co
|
||||
}
|
||||
globals.SugarLogger.Debugf("CopyStoreSkus fromStoreID:%d, toStoreID:%d, trackInfo:%s num3:%d", fromStoreID, toStoreID, ctx.GetTrackInfo(), num2)
|
||||
dao.Commit(db)
|
||||
|
||||
//同一商品若源门店的规格少于要复制到的门店,则在复制的门店里的其他规格的unitprice不会变,
|
||||
//导致复制的门店的商品unitprice不尽相同,这里先处理一下
|
||||
type tStore struct {
|
||||
NameID int `orm:"column(name_id)"`
|
||||
StoreID int `orm:"column(store_id)"`
|
||||
}
|
||||
var resultList []*tStore
|
||||
sql3 := `
|
||||
SELECT a.name_id, a.store_id FROM (
|
||||
SELECT DISTINCT a.unit_price, b.name_id, a.store_id FROM store_sku_bind a, sku b, store c
|
||||
WHERE a.sku_id = b.id
|
||||
AND c.id = a.store_id
|
||||
AND c.deleted_at = ?
|
||||
AND a.store_id = ?
|
||||
AND a.deleted_at = ?)a
|
||||
GROUP BY 1, 2
|
||||
HAVING COUNT(a.unit_price) > 1
|
||||
`
|
||||
sqlParams3 := []interface{}{utils.DefaultTimeValue, toStoreID, utils.DefaultTimeValue}
|
||||
err = dao.GetRows(db, &resultList, sql3, sqlParams3)
|
||||
if len(resultList) > 0 {
|
||||
var skuBindInfos []*StoreSkuBindInfo
|
||||
for _, v := range resultList {
|
||||
storeSkus, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID)
|
||||
unitPirce := storeSkus[0].UnitPrice
|
||||
skuBindInfo := &StoreSkuBindInfo{
|
||||
StoreID: v.StoreID,
|
||||
NameID: v.NameID,
|
||||
UnitPrice: int(unitPirce),
|
||||
}
|
||||
skuBindInfos = append(skuBindInfos, skuBindInfo)
|
||||
}
|
||||
_, err = updateStoresSkusWithoutSync(ctx, db, []int{toStoreID}, skuBindInfos, false, false)
|
||||
}
|
||||
}
|
||||
if globals.IsAddEvent {
|
||||
mapAfter := make(map[string]interface{})
|
||||
@@ -4624,10 +4654,8 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku
|
||||
if len(storeAudits) > 1 {
|
||||
return retVal, fmt.Errorf("查询到该门店该商品的待审核信息大于1条!storeID: %v, nameID: %v", storeAudit.StoreID, storeAudit.NameID)
|
||||
}
|
||||
// flag := false
|
||||
//审核通过
|
||||
if status == model.StoreAuditStatusCreated {
|
||||
// flag = true
|
||||
storeAudits[0].UserID = ctx.GetUserID()
|
||||
storeAudits[0].Status = model.StoreAuditStatusCreated
|
||||
storeAudits[0].Remark = storeAudit.Remark
|
||||
@@ -4661,7 +4689,6 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku
|
||||
if num == 0 || !isAsync || hint == "" {
|
||||
hint = utils.Int64ToStr(num)
|
||||
}
|
||||
// _, err = UpdateStoresSkus(ctx, 0, []int{storeID}, skuBindInfos, false, isAsync, isContinueWhenError)
|
||||
} else if status == model.StoreAuditStatusRejected {
|
||||
storeAudits[0].UserID = ctx.GetUserID()
|
||||
storeAudits[0].Status = model.StoreAuditStatusRejected
|
||||
|
||||
Reference in New Issue
Block a user