Merge branch 'integrate-onpoint' into develop
This commit is contained in:
		
						commit
						68146c7c2a
					
				| 
						 | 
					@ -98,3 +98,24 @@ func (o Order) ORNotUpdateStatus(p model.OrderORsNotUpdateStatus) error {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// GetSupplierOrders ...
 | 
				
			||||||
 | 
					func (o Order) GetSupplierOrders(p model.OrderSupplierQuery) (*model.SupplierOrderList, error) {
 | 
				
			||||||
 | 
						msg, err := natsio.GetServer().Request(subject.Order.GetSupplierOrders, toBytes(p))
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						var (
 | 
				
			||||||
 | 
							r struct {
 | 
				
			||||||
 | 
								Data  model.SupplierOrderList `json:"data"`
 | 
				
			||||||
 | 
								Error string                  `json:"error"`
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						)
 | 
				
			||||||
 | 
						if err = json.Unmarshal(msg.Data, &r); err != nil {
 | 
				
			||||||
 | 
							return nil, err
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if r.Error != "" {
 | 
				
			||||||
 | 
							return nil, errors.New(r.Error)
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return &r.Data, nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -38,3 +38,13 @@ type OrderUpdateLogisticInfoFailed struct {
 | 
				
			||||||
type OrderORsNotUpdateStatus struct {
 | 
					type OrderORsNotUpdateStatus struct {
 | 
				
			||||||
	ORCodes []string `json:"orCodes"`
 | 
						ORCodes []string `json:"orCodes"`
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// OrderSupplierQuery ...
 | 
				
			||||||
 | 
					type OrderSupplierQuery struct {
 | 
				
			||||||
 | 
						Limit        int64    `json:"limit"`
 | 
				
			||||||
 | 
						Page         int64    `json:"page"`
 | 
				
			||||||
 | 
						FromDate     string   `json:"fromDate"`
 | 
				
			||||||
 | 
						ToDate       string   `json:"toDate"`
 | 
				
			||||||
 | 
						SupplierID   string   `json:"supplierId"`
 | 
				
			||||||
 | 
						WarehouseIDs []string `json:"warehouseIDs"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,35 @@
 | 
				
			||||||
 | 
					package model
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SupplierOrderList ...
 | 
				
			||||||
 | 
					type SupplierOrderList struct {
 | 
				
			||||||
 | 
						List  []SupplierOrder `json:"list"`
 | 
				
			||||||
 | 
						Total int64           `json:"total" example:"100"`
 | 
				
			||||||
 | 
						Limit int64           `json:"limit" example:"20"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SupplierOrder ...
 | 
				
			||||||
 | 
					type SupplierOrder struct {
 | 
				
			||||||
 | 
						ID              string                `json:"_id"`
 | 
				
			||||||
 | 
						Code            string                `json:"code"`
 | 
				
			||||||
 | 
						CreatedAt       time.Time             `json:"createdAt"`
 | 
				
			||||||
 | 
						Status          string                `json:"status"`
 | 
				
			||||||
 | 
						WarehouseStatus string                `json:"warehouseStatus"`
 | 
				
			||||||
 | 
						Items           []SupplierOrderItem   `json:"items"`
 | 
				
			||||||
 | 
						Delivery        SupplierOrderDelivery `json:"delivery"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SupplierOrderItem ...
 | 
				
			||||||
 | 
					type SupplierOrderItem struct {
 | 
				
			||||||
 | 
						ID          string `json:"_id" example:"1231"`
 | 
				
			||||||
 | 
						SupplierSKU string `json:"supplierSku" example:"SUPPLIER_SKU"`
 | 
				
			||||||
 | 
						Quantity    int64  `json:"quantity" example:"2"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SupplierOrderDelivery ...
 | 
				
			||||||
 | 
					type SupplierOrderDelivery struct {
 | 
				
			||||||
 | 
						Code    string `json:"code" example:"123187287"`
 | 
				
			||||||
 | 
						Status  string `json:"status" enums:"waiting_to_confirm,waiting_to_pick,picking,picked,delay_pickup,pickup_failed,delivering,delay_delivery,delivered,cancelled,delivery_failed,waiting_to_return,returning,delay_return,compensation,returned"`
 | 
				
			||||||
 | 
						TPLCode string `json:"tplCode" enums:"SLY,GHTK,GHN,SSC,SPY,VTP,SE,NTL,BEST"`
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -12,10 +12,12 @@ var Order = struct {
 | 
				
			||||||
	ChangeDeliveryStatus     string
 | 
						ChangeDeliveryStatus     string
 | 
				
			||||||
	UpdateLogisticInfoFailed string
 | 
						UpdateLogisticInfoFailed string
 | 
				
			||||||
	ORNotUpdateStatus        string
 | 
						ORNotUpdateStatus        string
 | 
				
			||||||
 | 
						GetSupplierOrders        string
 | 
				
			||||||
}{
 | 
					}{
 | 
				
			||||||
	UpdateORStatus:           getOrderValue("update_outbound_request_status"),
 | 
						UpdateORStatus:           getOrderValue("update_outbound_request_status"),
 | 
				
			||||||
	CancelDelivery:           getOrderValue("cancel_delivery"),
 | 
						CancelDelivery:           getOrderValue("cancel_delivery"),
 | 
				
			||||||
	ChangeDeliveryStatus:     getOrderValue("change_delivery_status"),
 | 
						ChangeDeliveryStatus:     getOrderValue("change_delivery_status"),
 | 
				
			||||||
	UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
 | 
						UpdateLogisticInfoFailed: getOrderValue("update_logistic_info_failed"),
 | 
				
			||||||
	ORNotUpdateStatus:        getOrderValue("outbound_request_not_update_status"),
 | 
						ORNotUpdateStatus:        getOrderValue("outbound_request_not_update_status"),
 | 
				
			||||||
 | 
						GetSupplierOrders:        getOrderValue("get_supplier_orders"),
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue