warehouse
This commit is contained in:
@@ -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