warehouse
This commit is contained in:
@@ -174,7 +174,7 @@ func CreateOrUpdateAll(vendorOrgCode string, storeID, vendorStoreID int64) error
|
||||
}
|
||||
if len(bindWarehouseAndFence) == 0 || utils.IsNil(bindWarehouseAndFence) { //未绑定仓库以及电子围栏
|
||||
//(1)创建仓库
|
||||
warehouseID, err := CreateWarehouse(vendorOrgCode, utils.Int64ToStr(storeID))
|
||||
warehouseID, err := CreateWarehouse(vendorOrgCode, storeID)
|
||||
if err != nil || warehouseID == 0 || utils.IsNil(warehouseID) {
|
||||
globals.SugarLogger.Debugf("门店(%d) 创建仓库失败:%v", storeID, err)
|
||||
errList.AddErr(fmt.Errorf("门店(%d) 创建仓库失败:%v", storeID, err))
|
||||
@@ -332,7 +332,7 @@ func (P *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
||||
errList.AddErr(err3)
|
||||
}
|
||||
//获取电子围栏
|
||||
bindWarehouseAndFence, err := GetWarehouseByStore(storeInfo.VendorOrgCode, utils.Str2Int64(storeInfo.VendorStoreID))
|
||||
bindWarehouseAndFence, err := GetWarehouseByStore(storeInfo.VendorOrgCode, utils.Str2Int64(storeInfo.VendorStoreID)) //todo 此接口暂时有问题
|
||||
if err != nil {
|
||||
errList.AddErr(fmt.Errorf("获取门店(%d) 电子围栏失败:%v", utils.Str2Int64(storeInfo.VendorStoreID), err))
|
||||
}
|
||||
|
||||
@@ -26,18 +26,30 @@ const (
|
||||
)
|
||||
|
||||
// /warehouse/create 创建单个区域仓
|
||||
func CreateWarehouse(appOrgCode, outWarehouseID string) (warehouseID int64, err error) {
|
||||
tempName := "京西菜市(" + outWarehouseID + ") 的区域仓"
|
||||
req := &warehouse_create_request.WarehouseCreateParam{
|
||||
OutWarehouseId: outWarehouseID,
|
||||
Name: tempName,
|
||||
Intro: "",
|
||||
}
|
||||
resp, err := getAPI(appOrgCode, 0, "").CreateWarehouse(req)
|
||||
func CreateWarehouse(appOrgCode string, storeID int64) (warehouseID int64, err error) {
|
||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), int(storeID), 0, "")
|
||||
if err != nil {
|
||||
return 0, err
|
||||
return 0, fmt.Errorf("获取门店本地信息失败:%v", err)
|
||||
}
|
||||
return resp.Data, err
|
||||
param := &warehouse_create_request.WarehouseCreateParam{
|
||||
OutWarehouseId: utils.Int64ToStr(storeID), //本地storeID绑定
|
||||
Name: "京西菜市_" + storeDetail.Name + "_" + utils.Int64ToStr(storeID) + "_区域仓",
|
||||
Intro: "",
|
||||
Warehouse: &warehouse_create_request.Warehouse{
|
||||
WarehouseLocation: &warehouse_create_request.WarehouseLocation{
|
||||
AddressId1: utils.Str2Int64(utils.Int2Str(storeDetail.ProvinceCode)[:2]),
|
||||
AddressId2: int64(storeDetail.CityCode),
|
||||
AddressId3: int64(storeDetail.DistrictCode),
|
||||
AddressId4: 0,
|
||||
},
|
||||
AddressDetail: storeDetail.Address,
|
||||
},
|
||||
}
|
||||
resp, err := getAPI(appOrgCode, 0, "").CreateWarehouse(param)
|
||||
if err != nil {
|
||||
return 0, fmt.Errorf("创建单个区域仓失败:%v", err)
|
||||
}
|
||||
return resp.Data, nil
|
||||
}
|
||||
|
||||
// /warehouse/createBatch 批量创建区域仓
|
||||
|
||||
Reference in New Issue
Block a user