Develop #22
|
@ -17,6 +17,42 @@ func GetWarehouse() Warehouse {
|
||||||
return Warehouse{}
|
return Warehouse{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AfterCreateWarehouse ...
|
||||||
|
func (w Warehouse) AfterCreateWarehouse(p model.WarehouseNatsResponse) error {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Warehouse.AfterCreateWarehouse, toBytes(p))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var r struct {
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if r.Error != "" {
|
||||||
|
return errors.New(r.Error)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// AfterUpdateWarehouse ...
|
||||||
|
func (w Warehouse) AfterUpdateWarehouse(p model.WarehouseNatsResponse) error {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Warehouse.AfterUpdateWarehouse, toBytes(p))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
var r struct {
|
||||||
|
Error string `json:"error"`
|
||||||
|
}
|
||||||
|
if err = json.Unmarshal(msg.Data, &r); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if r.Error != "" {
|
||||||
|
return errors.New(r.Error)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// CreateOutboundRequest ...
|
// CreateOutboundRequest ...
|
||||||
func (w Warehouse) CreateOutboundRequest(p model.OutboundRequestPayload) (*model.OutboundRequestResponse, error) {
|
func (w Warehouse) CreateOutboundRequest(p model.OutboundRequestPayload) (*model.OutboundRequestResponse, error) {
|
||||||
msg, err := natsio.GetServer().Request(subject.Warehouse.CreateOutboundRequest, toBytes(p))
|
msg, err := natsio.GetServer().Request(subject.Warehouse.CreateOutboundRequest, toBytes(p))
|
||||||
|
|
|
@ -18,7 +18,11 @@ var Warehouse = struct {
|
||||||
FindByCondition string
|
FindByCondition string
|
||||||
Distinct string
|
Distinct string
|
||||||
Count string
|
Count string
|
||||||
|
AfterUpdateWarehouse string
|
||||||
|
AfterCreateWarehouse string
|
||||||
}{
|
}{
|
||||||
|
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
|
||||||
|
AfterUpdateWarehouse: getWarehouseValue("after_update_warehouse"),
|
||||||
CreateOutboundRequest: getWarehouseValue("create_outbound_request"),
|
CreateOutboundRequest: getWarehouseValue("create_outbound_request"),
|
||||||
UpdateOutboundRequestLogistic: getWarehouseValue("update_outbound_request_logistic_info"),
|
UpdateOutboundRequestLogistic: getWarehouseValue("update_outbound_request_logistic_info"),
|
||||||
CancelOutboundRequest: getWarehouseValue("cancel_outbound_request"),
|
CancelOutboundRequest: getWarehouseValue("cancel_outbound_request"),
|
||||||
|
|
Loading…
Reference in New Issue