refactor-location #134
|
@ -17,6 +17,24 @@ func GetWarehouse() Warehouse {
|
||||||
return Warehouse{}
|
return Warehouse{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateIsClosedSupplier ...
|
||||||
|
func (w Warehouse) UpdateIsClosedSupplier(p model.WarehouseNatsResponse) error {
|
||||||
|
msg, err := natsio.GetServer().Request(subject.Warehouse.UpdateIsClosedSupplier, 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
|
||||||
|
}
|
||||||
|
|
||||||
// AfterCreateWarehouse ...
|
// AfterCreateWarehouse ...
|
||||||
func (w Warehouse) AfterCreateWarehouse(p model.WarehouseNatsResponse) error {
|
func (w Warehouse) AfterCreateWarehouse(p model.WarehouseNatsResponse) error {
|
||||||
msg, err := natsio.GetServer().Request(subject.Warehouse.AfterCreateWarehouse, toBytes(p))
|
msg, err := natsio.GetServer().Request(subject.Warehouse.AfterCreateWarehouse, toBytes(p))
|
||||||
|
|
|
@ -2,8 +2,9 @@ package model
|
||||||
|
|
||||||
// ResponseSupplierInfo ...
|
// ResponseSupplierInfo ...
|
||||||
type ResponseSupplierInfo struct {
|
type ResponseSupplierInfo struct {
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
BusinessType string `json:"businessType"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// ResponseSupplierContract ...
|
// ResponseSupplierContract ...
|
||||||
|
@ -16,11 +17,12 @@ type ResponseSupplierContract struct {
|
||||||
|
|
||||||
// SupplierBrief ...
|
// SupplierBrief ...
|
||||||
type SupplierBrief struct {
|
type SupplierBrief struct {
|
||||||
ID string `json:"_id"`
|
ID string `json:"_id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
CreatedAt string `json:"createdAt"`
|
BusinessType string `json:"businessType"`
|
||||||
UpdatedAt string `json:"updatedAt"`
|
CreatedAt string `json:"createdAt"`
|
||||||
|
UpdatedAt string `json:"updatedAt"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type SupplierAll struct {
|
type SupplierAll struct {
|
||||||
|
|
|
@ -69,3 +69,14 @@ type SyncORStatusRequest struct {
|
||||||
ORCode string `json:"orCode"`
|
ORCode string `json:"orCode"`
|
||||||
OrderCode string `json:"orderCode"`
|
OrderCode string `json:"orderCode"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UpdateSupplierIsClosedRequest ...
|
||||||
|
type UpdateSupplierIsClosedRequest struct {
|
||||||
|
Suppliers []SupplierIsClosed `json:"suppliers"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// SupplierIsClosed ...
|
||||||
|
type SupplierIsClosed struct {
|
||||||
|
Supplier string `json:"supplier"`
|
||||||
|
IsClosed bool `json:"isClosed"`
|
||||||
|
}
|
||||||
|
|
|
@ -25,6 +25,20 @@ type WarehouseConfiguration struct {
|
||||||
Partner WarehousePartner `json:"partner"`
|
Partner WarehousePartner `json:"partner"`
|
||||||
Delivery WarehouseDelivery `json:"delivery"`
|
Delivery WarehouseDelivery `json:"delivery"`
|
||||||
Other WarehouseOther `json:"other"`
|
Other WarehouseOther `json:"other"`
|
||||||
|
Food WarehouseFood `json:"food"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// WarehouseFood ...
|
||||||
|
type WarehouseFood struct {
|
||||||
|
ForceClosed bool `json:"forceClosed"`
|
||||||
|
IsClosed bool `json:"isClosed"`
|
||||||
|
TimeRange []TimeRange `json:"timeRange"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// TimeRange ...
|
||||||
|
type TimeRange struct {
|
||||||
|
From int64 `json:"from"`
|
||||||
|
To int64 `json:"to"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// WarehouseOther ...
|
// WarehouseOther ...
|
||||||
|
@ -109,6 +123,7 @@ type ResponseLatLng struct {
|
||||||
type WarehouseNatsResponse struct {
|
type WarehouseNatsResponse struct {
|
||||||
ID string `json:"_id"`
|
ID string `json:"_id"`
|
||||||
Staff string `json:"staff"`
|
Staff string `json:"staff"`
|
||||||
|
BusinessType string `json:"businessType"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
SearchString string `json:"searchString"`
|
SearchString string `json:"searchString"`
|
||||||
Slug string `json:"slug"`
|
Slug string `json:"slug"`
|
||||||
|
|
|
@ -7,35 +7,37 @@ func getWarehouseValue(val string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
var Warehouse = struct {
|
var Warehouse = struct {
|
||||||
CreateOutboundRequest string
|
CreateOutboundRequest string
|
||||||
UpdateOutboundRequestLogistic string
|
UpdateOutboundRequestLogistic string
|
||||||
CancelOutboundRequest string
|
CancelOutboundRequest string
|
||||||
GetConfiguration string
|
GetConfiguration string
|
||||||
SyncORStatus string
|
SyncORStatus string
|
||||||
WebhookTNC string
|
WebhookTNC string
|
||||||
WebhookGlobalCare string
|
WebhookGlobalCare string
|
||||||
FindOne string
|
FindOne string
|
||||||
FindByCondition string
|
FindByCondition string
|
||||||
Distinct string
|
Distinct string
|
||||||
Count string
|
Count string
|
||||||
AfterUpdateWarehouse string
|
AfterUpdateWarehouse string
|
||||||
AfterCreateWarehouse string
|
AfterCreateWarehouse string
|
||||||
|
UpdateIsClosedSupplier string
|
||||||
CreateWarehouseIntoServiceSupplier string
|
CreateWarehouseIntoServiceSupplier string
|
||||||
UpdateWarehouseIntoServiceSupplier string
|
UpdateWarehouseIntoServiceSupplier string
|
||||||
}{
|
}{
|
||||||
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
|
AfterCreateWarehouse: getWarehouseValue("after_create_warehouse"),
|
||||||
AfterUpdateWarehouse: getWarehouseValue("after_update_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"),
|
||||||
GetConfiguration: getWarehouseValue("get_configuration"),
|
GetConfiguration: getWarehouseValue("get_configuration"),
|
||||||
SyncORStatus: getWarehouseValue("sync_or_status"),
|
SyncORStatus: getWarehouseValue("sync_or_status"),
|
||||||
WebhookTNC: getWarehouseValue("webhook_tnc"),
|
WebhookTNC: getWarehouseValue("webhook_tnc"),
|
||||||
WebhookGlobalCare: getWarehouseValue("webhook_global_care"),
|
WebhookGlobalCare: getWarehouseValue("webhook_global_care"),
|
||||||
FindOne: getWarehouseValue("find_one"),
|
FindOne: getWarehouseValue("find_one"),
|
||||||
FindByCondition: getWarehouseValue("find_all_by_condition"),
|
FindByCondition: getWarehouseValue("find_all_by_condition"),
|
||||||
Distinct: getWarehouseValue("distinct"),
|
Distinct: getWarehouseValue("distinct"),
|
||||||
Count: getWarehouseValue("count"),
|
Count: getWarehouseValue("count"),
|
||||||
|
UpdateIsClosedSupplier: getWarehouseValue("update_is_closed_supplier"),
|
||||||
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"),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue