add warehouse client method
This commit is contained in:
parent
aa9471590d
commit
91d8ffe40f
|
@ -3,6 +3,7 @@ package client
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"git.selly.red/Selly-Modules/natsio"
|
"git.selly.red/Selly-Modules/natsio"
|
||||||
"git.selly.red/Selly-Modules/natsio/model"
|
"git.selly.red/Selly-Modules/natsio/model"
|
||||||
|
@ -163,3 +164,21 @@ func (w Warehouse) GetWarehouses(p model.GetWarehousesRequest) (*model.GetWareho
|
||||||
}
|
}
|
||||||
return r.Data, nil
|
return r.Data, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateORDeliveryStatus ...
|
||||||
|
func (w Warehouse) UpdateORDeliveryStatus(p model.WarehouseORUpdateDeliveryStatus) error {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Warehouse.GetWarehouses, toBytes(p))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var r struct {
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||||
|
return fmt.Errorf("nats: update_or_delivery_status %v", err)
|
||||||
|
}
|
||||||
|
if r.Error != "" {
|
||||||
|
return errors.New(r.Error)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
|
@ -105,3 +105,11 @@ type GetWarehousesRequest struct {
|
||||||
Page int64 `json:"page"`
|
Page int64 `json:"page"`
|
||||||
Limit int64 `json:"limit"`
|
Limit int64 `json:"limit"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WarehouseORUpdateDeliveryStatus ...
|
||||||
|
type WarehouseORUpdateDeliveryStatus struct {
|
||||||
|
ORCode string `json:"orCode"`
|
||||||
|
OrderCode string `json:"orderCode"`
|
||||||
|
OrderID string `json:"orderId"`
|
||||||
|
DeliveryStatus string `json:"deliveryStatus"`
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@ var Warehouse = struct {
|
||||||
AfterCreateWarehouse string
|
AfterCreateWarehouse string
|
||||||
UpdateIsClosedSupplier string
|
UpdateIsClosedSupplier string
|
||||||
GetWarehouses string
|
GetWarehouses string
|
||||||
|
UpdateORDeliveryStatus string
|
||||||
}{
|
}{
|
||||||
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
|
CreateWarehouseIntoServiceSupplier: getWarehouseValue("create_warehouse_into_service_supplier"),
|
||||||
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
|
UpdateWarehouseIntoServiceSupplier: getWarehouseValue("update_warehouse_into_service_supplier"),
|
||||||
|
@ -44,4 +45,5 @@ var Warehouse = struct {
|
||||||
Count: getWarehouseValue("count"),
|
Count: getWarehouseValue("count"),
|
||||||
UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"),
|
UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"),
|
||||||
GetWarehouses: getWarehouseValue("get_warehouses"),
|
GetWarehouses: getWarehouseValue("get_warehouses"),
|
||||||
|
UpdateORDeliveryStatus: getWarehouseValue("update_or_delivery_status"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue