This commit is contained in:
richboo111
2022-10-11 11:43:30 +08:00
parent a24d781657
commit 7280843851
2 changed files with 9 additions and 13 deletions

View File

@@ -82,7 +82,6 @@ func (P *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
var (
storeIDs string
tempStoreID []int64
fences []string
lists []shop_batchCreateStore_request.StoreListItem
ShopBatchCreateStoreParam *shop_batchCreateStore_request.ShopBatchCreateStoreParam
FreightTemplate = &model.FreightTemplate{}
@@ -134,8 +133,7 @@ func (P *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
}
globals.SugarLogger.Debug("Success createStore and return storeID=====", resp.ResultList[0].Store.StoreId, utils.Str2Int(storeIDs))
if utils.Str2Int(storeIDs) == 0 {
errList.AddErr(fmt.Errorf("storeIDs=0 %v", err))
//return "", errors.New(fmt.Sprintf("创建店铺失败原因storeIDs = 0:%v,%v", err, resp.ResultList[0].Msg))
return "", errors.New(fmt.Sprintf("创建店铺失败原因storeIDs = 0:%v,%v", err, resp.ResultList[0].Msg))
}
//创建并绑定运费模板
@@ -146,7 +144,7 @@ func (P *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
} else {
if freightTemplateID == 0 {
globals.SugarLogger.Debug("freightTemplateID=========", freightTemplateID)
errList.AddErr(fmt.Errorf(" ", int64(storeDetail.Store.ID), freightTemplateID, err))
errList.AddErr(fmt.Errorf("创建运费模板失败:%d %d %v", int64(storeDetail.Store.ID), freightTemplateID, err))
}
err = P.ShopBindStoreFreight(int64(storeDetail.Store.ID), freightTemplateID)
if err != nil {
@@ -181,7 +179,7 @@ func (P *PurchaseHandler) CreateStore2(db *dao.DaoDB, storeID int, userName stri
if fenceID, err := CreateFenceByStore(int(resp.ResultList[0].Store.StoreId)); err != nil {
errList.AddErr(fmt.Errorf("创建电子围栏失败原因:%v", err))
} else {
fences = append(fences, fenceID)
fences := []string{utils.Int2Str(storeDetail.Store.ID)}
if err := BindFenceByStore(resp.ResultList[0].Store.StoreId, fences); err != nil {
errList.AddErr(fmt.Errorf("门店:%d 绑定电子围栏:%d 失败原因:%v", int64(storeDetail.Store.ID), warehouse, err))
} else {

View File

@@ -58,10 +58,9 @@ func (P *PurchaseHandler) BatchCreateWarehouse(param warehouse_createBatch_reque
// /warehouse/bindStore 仓库绑定门店
func (P *PurchaseHandler) BindStoreWarehouse(storeIDs []int64, outWarehouseID, appOrgCode string) error {
tempWarehouseID := "门店编码:" + outWarehouseID + "的仓库"
param := &warehouse_bindStore_request.WarehouseBindStoreParam{
StoreIds: storeIDs,
OutWarehouseId: tempWarehouseID,
OutWarehouseId: outWarehouseID,
}
if _, err := getAPI(appOrgCode, 0, "").StoreBindWarehouse(param); err != nil {
return err
@@ -99,7 +98,7 @@ func CreateFenceByStore(storeID int) (fenceID string, err error) {
if err = dao.GetRow(db, &localStore, sqlStr, sqlParam...); err == nil {
param := &warehouse_createFence_request.WarehouseCreateFenceParam{
FenceInfo: &warehouse_createFence_request.FenceInfo{
OutFenceId: "京西门店:" + utils.Int2Str(storeID) + " 的电子围栏",
OutFenceId: utils.Int2Str(storeID), //绑定基于此id
Shape: int32(localStore.DeliveryRangeType),
},
}
@@ -136,7 +135,7 @@ func CreateFenceByStore(storeID int) (fenceID string, err error) {
}
//直接创建电子围栏方式
func (P *PurchaseHandler) CreateFenceDirectly(param warehouse_createFence_request.WarehouseCreateFenceParam) (fenceID string, err error) {
func CreateFenceDirectly(param warehouse_createFence_request.WarehouseCreateFenceParam) (fenceID string, err error) {
info := &warehouse_createFence_request.WarehouseCreateFenceParam{
FenceInfo: param.FenceInfo,
}
@@ -169,8 +168,8 @@ func UpdateFenceByStore(storeID int) error {
if err := dao.GetRow(db, &localStore, sqlStr, sqlParam...); err == nil {
param := &warehouse_createFence_request.WarehouseCreateFenceParam{
FenceInfo: &warehouse_createFence_request.FenceInfo{
//OutFenceId: "京西门店:" + utils.Int2Str(storeID) + " 的电子围栏",
Shape: int32(localStore.DeliveryRangeType),
OutFenceId: utils.Int2Str(storeID),
Shape: int32(localStore.DeliveryRangeType),
},
}
if localStore.DeliveryRangeType == tiktok_api.ShapeCircular {
@@ -197,12 +196,11 @@ func UpdateFenceByStore(storeID int) error {
_, err := getAPI("", 0, "").CreateFence(param)
if err != nil {
return err
} else {
return err
}
} else {
return err
}
return nil
}
//门店直接绑定围栏