| | |
| | | |
| | | func UpdatePurchaseStatus(source, number string) { |
| | | if source == "SRM_PURCHASE" { |
| | | count, err := models.NewOperationSearch().SetSourceNumber(number).SetStatus(constvar.OperationStatus_Ready).Count() |
| | | if err != nil || count > 0 { |
| | | return |
| | | } |
| | | cl := purchase_wms.NewPurchaseServiceClient(init_client.SrmConn) |
| | | _, err := cl.UpdatePurchaseStatus(context.Background(), &purchase_wms.UpdatePurchaseStatusRequest{Number: number}) |
| | | _, err = cl.UpdatePurchaseStatus(context.Background(), &purchase_wms.UpdatePurchaseStatusRequest{Number: number}) |
| | | if err != nil { |
| | | logx.Errorf("grpc dial UpdatePurchaseStatus service error: %v", err) |
| | | } |
| | |
| | | } |
| | | return int(total), nil |
| | | } |
| | | |
| | | func (slf *OperationSearch) Count() (int64, error) { |
| | | var ( |
| | | total int64 |
| | | db = slf.build() |
| | | ) |
| | | |
| | | err := db.Count(&total).Error |
| | | return total, err |
| | | } |