Selly food #29
			
				
			
		
		
		
	| 
						 | 
				
			
			@ -17,6 +17,24 @@ func GetWarehouse() 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 ...
 | 
			
		||||
func (w Warehouse) AfterCreateWarehouse(p model.WarehouseNatsResponse) error {
 | 
			
		||||
	msg, err := natsio.GetServer().Request(subject.Warehouse.AfterCreateWarehouse, toBytes(p))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -69,3 +69,14 @@ type SyncORStatusRequest struct {
 | 
			
		|||
	ORCode    string `json:"orCode"`
 | 
			
		||||
	OrderCode string `json:"orderCode"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// UpdateSupplierIsClosedRequest ...
 | 
			
		||||
type UpdateSupplierIsClosedRequest struct {
 | 
			
		||||
	Suppliers []SupplierIsClosed `json:"suppliers"`
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SupplierIsClosed ...
 | 
			
		||||
type SupplierIsClosed struct {
 | 
			
		||||
	Supplier string `json:"supplier"`
 | 
			
		||||
	IsClosed bool   `json:"isClosed"`
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -20,6 +20,7 @@ var Warehouse = struct {
 | 
			
		|||
	Count                         string
 | 
			
		||||
	AfterUpdateWarehouse          string
 | 
			
		||||
	AfterCreateWarehouse          string
 | 
			
		||||
	UpdateIsClosedSupplier        string
 | 
			
		||||
}{
 | 
			
		||||
	AfterCreateWarehouse:          getWarehouseValue("after_create_warehouse"),
 | 
			
		||||
	AfterUpdateWarehouse:          getWarehouseValue("after_update_warehouse"),
 | 
			
		||||
| 
						 | 
				
			
			@ -34,4 +35,5 @@ var Warehouse = struct {
 | 
			
		|||
	FindByCondition:               getWarehouseValue("find_all_by_condition"),
 | 
			
		||||
	Distinct:                      getWarehouseValue("distinct"),
 | 
			
		||||
	Count:                         getWarehouseValue("count"),
 | 
			
		||||
	UpdateIsClosedSupplier:        getWarehouseValue("update_is_closed_supplier"),
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue