diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index 691a59548..ce55ae206 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -76,9 +76,10 @@ type ExcelParam struct { // UpdateStoreSku用,API调用时 type StoreSkuBindSkuInfo struct { - SkuID int `json:"skuID"` - IsSale int `json:"isSale,omitempty"` // -1:不可售,0:忽略,1:可售 - Stock *int `json:"stock"` + SkuID int `json:"skuID"` + IsSale int `json:"isSale,omitempty"` // -1:不可售,0:忽略,1:可售 + Stock *int `json:"stock"` + LocationCode string `json:"location_code"` // 物料货架码 // ElmID int64 `json:"elmID,omitempty"` // EbaiID int64 `json:"ebaiID,omitempty"` MtLadderBoxPrice int `json:"mtLadderBoxPrice"` @@ -1165,7 +1166,7 @@ func GetStoresSkusNew(ctx *jxcontext.Context, storeIDs, skuIDs []int, upcs []str t4.jd_sync_status, t4.ebai_sync_status, t4.mtwm_sync_status,t4.tao_sync_status , t4.dd_sync_status, t4.yb_sync_status, t4.jds_sync_status, t4.jd_price, t4.ebai_price, t4.mtwm_price,t4.tao_price, t4.jx_price, t4.dd_price, t4.yb_price, t4.jds_price, t4.jd_lock_time, t4.ebai_lock_time, t4.mtwm_lock_time,t4.tao_lock_time, t4.dd_lock_time, t4.jx_lock_time, t4.yb_lock_time, t4.jds_lock_time, - t4.status_sale_begin, t4.status_sale_end, t4.stock, t4.mt_ladder_box_price, + t4.status_sale_begin, t4.status_sale_end, t4.stock, t4.mt_ladder_box_price,t4.location_code, t6.mid_unit_price real_mid_unit_price, t7.unit_price audit_unit_price ` + sql @@ -2217,6 +2218,12 @@ func updateStoresSkusWithoutSync(ctx *jxcontext.Context, db *dao.DaoDB, storeIDs skuBind.Stock = *inSkuBind.Stock setStoreSkuBindStatus(skuBind, model.SyncFlagStockMask) } + + if inSkuBind.LocationCode != "" { + updateFieldMap["LocationCode"] = 1 + skuBind.LocationCode = inSkuBind.LocationCode + setStoreSkuBindStatus(skuBind, model.SyncFlagStockMask) + } if inSkuBind.MtLadderBoxPrice != 0 { updateFieldMap["MtLadderBoxPrice"] = 1 skuBind.MtLadderBoxPrice = inSkuBind.MtLadderBoxPrice @@ -6003,7 +6010,7 @@ func doStoreSkuAuditForGy(ctx *jxcontext.Context, storeIDs []int, skuBindInfos [ db := dao.GetDB() for _, storeID := range storeIDs { // stores, _ := dao.GetStoreList(db, []int{storeID}, nil, nil, nil, nil, "") - //扣点的门店改价不进审核 + // 扣点的门店改价不进审核 // if len(stores) > 0 { // if stores[0].PayPercentage <= 50 || stores[0].StoreLevel == "E" || stores[0].StoreLevel == "D" { // globals.SugarLogger.Debugf("doStoreSkuAudit return0 storeID : %v", storeID) diff --git a/business/model/dao/store_sku.go b/business/model/dao/store_sku.go index f0d8c74e2..7bf5e3cc3 100644 --- a/business/model/dao/store_sku.go +++ b/business/model/dao/store_sku.go @@ -83,6 +83,7 @@ type StoreSkuSyncInfo struct { VendorMainId string `orm:"column(vendor_main_id)"` // 主商品id JdsWareID int64 `orm:"column(jds_ware_id)" json:"jdsWareID"` BindDeletedAt time.Time `orm:"type(datetime)" json:"bindDeletedAt"` + LocationCode string `orm:"column(location_code)" json:"locationCode"` // 商品货架码 model.Sku ExdSkuID string `orm:"column(exd_sku_id)"` @@ -273,6 +274,7 @@ type StoreSkuExt struct { Weight int `json:"weight"` // 重量/质量,单位为克,当相应的SkuName的SpecUnit为g或kg时,必须等于SpecQuality SkuStatus int `json:"status"` Stock int `json:"stock"` + LocationCode string `orm:"column(location_code)" json:"locationCode"` CategoryName string `orm:"column(categoryName)"` BindCreatedAt time.Time `orm:"auto_now_add;type(datetime)" json:"createdAt"` BindUpdatedAt time.Time `orm:"auto_now;type(datetime)" json:"updatedAt"` @@ -582,7 +584,7 @@ func GetStoreSkus2(db *DaoDB, vendorID, storeID int, skuIDs []int, mustDirty boo t14.vendor_id, t14.vendor_org_code, t1.id bind_id, t1.sku_id, t1.price, t1.unit_price, t1.status store_sku_status, %s vendor_sku_id, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time,t1.vendor_son_sku_id,t1.vendor_sku_attr_id,t1.vendor_main_id, - t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t1.stock, t1.mt_ladder_box_price, + t1.store_id, t1.deleted_at bind_deleted_at,t1.status_sale_begin,t1.status_sale_end, t1.jds_ware_id, t1.stock, t1.mt_ladder_box_price,t1.location_code, t2.*, t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.category_id name_category_id, t3.yb_name_suffix,t3.tiktok_attribute,t3.mt_attribute, t3.sell_point,t3.sell_point_times,t3.jds_stock_switch, t3.preparation_time, t3.img_watermark, t3.ex_vendor_id, t3.img img_origin,t3.upc_brand_name,t3.upc_tiktok_brand_id, @@ -712,7 +714,7 @@ func GetFullStoreSkus(db *DaoDB, vendorID, storeID int) (skus []*StoreSkuSyncInf sm.vendor_id, sm.vendor_org_code, sm.yb_app_id, sm.yb_app_key, t1.id bind_id, t1.price, t1.unit_price, t1.status store_sku_status, t1.%s_sync_status sku_sync_status, t1.%s_price vendor_price, t1.%s_lock_time lock_time, - t1.store_id, t1.deleted_at bind_deleted_at, t1.stock, + t1.store_id, t1.deleted_at bind_deleted_at, t1.stock,t1.location_code, t2.*, t2.id sku_id, t2m.vendor_thing_id vendor_sku_id, t3.id name_id, t3.prefix, t3.name, t3.unit, t3.upc, t3.status name_status, t3.ex_prefix, t3.ex_prefix_begin, t3.ex_prefix_end, t3.category_id name_category_id,t3.tiktok_attribute,t3.mt_attribute,t3.sell_point,t3.sell_point_times,t3.upc_brand_name,t3.upc_tiktok_brand_id, IF(t11.%s <> '', t11.%s, t3.img) img, diff --git a/business/model/store_sku.go b/business/model/store_sku.go index 1d93c81f4..67248b13a 100644 --- a/business/model/store_sku.go +++ b/business/model/store_sku.go @@ -110,51 +110,44 @@ type StoreSkuBind struct { Stock int `json:"stock"` //门店商品库存 Status int - // ElmID int64 `orm:"column(elm_id);index"` - MtwmID int64 `orm:"column(mtwm_id);index"` - TaoID int64 `orm:"column(tao_id);index"` - EbaiID int64 `orm:"column(ebai_id);index"` - YbID int64 `orm:"column(yb_id);index"` - JdsID int64 `orm:"column(jds_id);index"` - JdsWareID int64 `orm:"column(jds_ware_id)"` - DdID int64 `orm:"column(dd_id);index"` // 子品主商品id - VendorSonSkuID string `orm:"column(vendor_son_sku_id)"` // 子商品skuid - VendorSkuAttrId string `orm:"column(vendor_sku_attr_id)"` // 抖音需要,主品skuid - VendorMainId string `orm:"column(vendor_Main_id)"` // 抖音需要,商品主id - - JdSyncStatus int8 `orm:"default(2)"` - MtwmSyncStatus int8 `orm:"default(2)"` - TaoSyncStatus int8 `orm:"default(2)"` - DdSyncStatus int8 `orm:"default(2)"` - EbaiSyncStatus int8 `orm:"default(2)"` - YbSyncStatus int8 `orm:"default(2)"` - JdsSyncStatus int8 `orm:"default(2)"` //京东商城 - - JdPrice int `json:"jdPrice"` - MtwmPrice int `json:"mtwmPrice"` - TaoPrice int `json:"taoPrice"` - EbaiPrice int `json:"ebaiPrice"` - JxPrice int `json:"jxPrice"` - DdPrice int `json:"ddPrice"` - YbPrice int `json:"ybPrice"` - JdsPrice int `json:"jdsPrice"` - //GmPrice int `json:"gmPrice"` - - JdLockTime *time.Time `orm:"null" json:"jdLockTime"` - JdsLockTime *time.Time `orm:"null" json:"jdsLockTime"` - MtwmLockTime *time.Time `orm:"null" json:"mtwmLockTime"` - TaoLockTime *time.Time `orm:"null" json:"taoLockTime"` - EbaiLockTime *time.Time `orm:"null" json:"ebaiLockTime"` - JxLockTime *time.Time `orm:"null" json:"jxLockTime"` - YbLockTime *time.Time `orm:"null" json:"ybLockTime"` - DdLockTime *time.Time `orm:"null" json:"ddLockTime"` - - AutoSaleAt time.Time `orm:"type(datetime);null" json:"autoSaleAt"` - - StatusSaleBegin int16 //商品可售时间范围 - StatusSaleEnd int16 - - MtLadderBoxPrice int `json:"mtLadderBoxPrice"` //美团门店商品包装费 + MtwmID int64 `orm:"column(mtwm_id);index"` + TaoID int64 `orm:"column(tao_id);index"` + EbaiID int64 `orm:"column(ebai_id);index"` + YbID int64 `orm:"column(yb_id);index"` + JdsID int64 `orm:"column(jds_id);index"` + JdsWareID int64 `orm:"column(jds_ware_id)"` + DdID int64 `orm:"column(dd_id);index"` // 子品主商品id + VendorSonSkuID string `orm:"column(vendor_son_sku_id)"` // 子商品skuid + VendorSkuAttrId string `orm:"column(vendor_sku_attr_id)"` // 抖音需要,主品skuid + VendorMainId string `orm:"column(vendor_Main_id)"` // 抖音需要,商品主id + JdSyncStatus int8 `orm:"default(2)"` + MtwmSyncStatus int8 `orm:"default(2)"` + TaoSyncStatus int8 `orm:"default(2)"` + DdSyncStatus int8 `orm:"default(2)"` + EbaiSyncStatus int8 `orm:"default(2)"` + YbSyncStatus int8 `orm:"default(2)"` + JdsSyncStatus int8 `orm:"default(2)"` //京东商城 + JdPrice int `json:"jdPrice"` + MtwmPrice int `json:"mtwmPrice"` + TaoPrice int `json:"taoPrice"` + EbaiPrice int `json:"ebaiPrice"` + JxPrice int `json:"jxPrice"` + DdPrice int `json:"ddPrice"` + YbPrice int `json:"ybPrice"` + JdsPrice int `json:"jdsPrice"` + JdLockTime *time.Time `orm:"null" json:"jdLockTime"` + JdsLockTime *time.Time `orm:"null" json:"jdsLockTime"` + MtwmLockTime *time.Time `orm:"null" json:"mtwmLockTime"` + TaoLockTime *time.Time `orm:"null" json:"taoLockTime"` + EbaiLockTime *time.Time `orm:"null" json:"ebaiLockTime"` + JxLockTime *time.Time `orm:"null" json:"jxLockTime"` + YbLockTime *time.Time `orm:"null" json:"ybLockTime"` + DdLockTime *time.Time `orm:"null" json:"ddLockTime"` + AutoSaleAt time.Time `orm:"type(datetime);null" json:"autoSaleAt"` + StatusSaleBegin int16 //商品可售时间范围 + StatusSaleEnd int16 + MtLadderBoxPrice int `json:"mtLadderBoxPrice"` //美团门店商品包装费 + LocationCode string `orm:"column(location_code)" json:"locationCode"` } func (*StoreSkuBind) TableUnique() [][]string { diff --git a/business/partner/purchase/ebai/order.go b/business/partner/purchase/ebai/order.go index f56ec62a0..6fd1cd13a 100644 --- a/business/partner/purchase/ebai/order.go +++ b/business/partner/purchase/ebai/order.go @@ -316,6 +316,9 @@ func (p *PurchaseHandler) Map2Order(orderData map[string]interface{}) (order *mo Weight: int(utils.Interface2Int64WithDefault(product["total_weight"], 0)) / productAmount, VendorPrice: utils.MustInterface2Int64(product["product_price"]), } + if shelfPosition, ok := product["shelf_position"]; ok { + sku.LocationCode = shelfPosition.(string) + } var baiduRate int64 sku.SalePrice, baiduRate, sku.StoreSubName = getSkuSalePrice(product) order.PmSubsidyMoney += baiduRate diff --git a/business/partner/purchase/ebai/store_sku2.go b/business/partner/purchase/ebai/store_sku2.go index 0377e4f08..f1326123f 100644 --- a/business/partner/purchase/ebai/store_sku2.go +++ b/business/partner/purchase/ebai/store_sku2.go @@ -524,6 +524,12 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE if isCreate /*storeSku.SkuSyncStatus&(model.SyncFlagPriceMask| model.SyncFlagNewMask) != 0 */ { params["sale_price"] = storeSku.VendorPrice } + if storeSku.LocationCode != "" { + params["shelf_number"] = storeSku.LocationCode + } + if storeSku.LocationCode == "EMPTY_VALUE" { // EMPTY_VALUE 美团置空 + params["shelf_number"] = "" + } if storeSku.SkuSyncStatus&(model.SyncFlagSaleMask|model.SyncFlagNewMask) != 0 { params["status"] = jxSkuStatus2Ebai(storeSku.MergedStatus) } @@ -539,6 +545,7 @@ func genSkuParamsFromStoreSkuInfo2(storeSku *dao.StoreSkuSyncInfo, isCreate, isE if storeSku.MinOrderCount == 0 { params["minimum"] = utils.Int2Float64(1) } + return params } diff --git a/business/partner/purchase/mtwm/store_sku2.go b/business/partner/purchase/mtwm/store_sku2.go index dedcab417..3b2cc00a9 100644 --- a/business/partner/purchase/mtwm/store_sku2.go +++ b/business/partner/purchase/mtwm/store_sku2.go @@ -435,6 +435,9 @@ func (p *PurchaseHandler) createOrUpdateStoreSkus(ctx *jxcontext.Context, storeI if storeSku.Upc != "" { skus[0]["upc"] = storeSku.Upc } + if storeSku.LocationCode != "" { + skus[0]["location_code"] = storeSku.LocationCode + } //skus[0]["ladder_box_num"] = "0" //skus[0]["ladder_box_price"] = "0" // 下面这个两个和上面有点重复,但是上面两个在更新的时候美团不识别,不知道创建的时候会不会覆盖一下吧(更新只能用下面这个) diff --git a/controllers/ebai_callback.go b/controllers/ebai_callback.go index 6a0d9a8cf..e6d32a7cd 100644 --- a/controllers/ebai_callback.go +++ b/controllers/ebai_callback.go @@ -7,7 +7,6 @@ import ( "git.rosy.net.cn/jx-callback/business/jxutils/ddmsg" "git.rosy.net.cn/jx-callback/business/model" "git.rosy.net.cn/jx-callback/business/model/dao" - "git.rosy.net.cn/jx-callback/globals" "net/http" "strings" @@ -27,7 +26,6 @@ func (c *EbaiController) Msg() { obj, callbackResponse := api.EbaiAPI.GetCallbackMsg(c.Ctx.Request) if callbackResponse == nil { vendorStoreId := obj.Body["platform_shop_id"].(string) - globals.SugarLogger.Debugf("-------obj.body := %s,%s", obj.Cmd, vendorStoreId) if vendorStoreId != "" { storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), vendorStoreId, model.VendorIDEBAI, "") if storeDetail == nil {